	
	function DESemail(emailname, emailserver) {
		document.write('<a href="mailto:' + emailname + '@' + emailserver +'">' + emailname + '@' + emailserver + '</a>'); 
	}
	
	
	/* Functions are DONE */
	$(function() {

        $('body').addClass('js');
		//$('.products_list > li').bigTarget();
		//Des.cart_donate();
		
		$("#promo").click( function () {
			
			link = $(this).find("a").attr("href");
			window.location = link;
			
		});
		
		$('a.page_popup').click(function() {
			
			
			queryString = $(this).attr('href');
			
			itemLink = '/incs/actions/page_popup.php?query='+queryString;
			
			$.fn.colorbox({
				href:itemLink,
				innerWidth: 650,
				innerHeight: 500,
				opacity: .7,
				iframe: false,
				open: true
			});
			
			return false;
		});

        
	});



	/* Define functions in the Des object */

	var Des = Des || {};

    /*
	Des.css_on = function() {
		//	FOR THIS TO WORK make sure the following CSS is being referenced somewhere:
		//	.css_test { display: none; height: 1px; width: 1px; }

		$('<div class="css_test"></div>').appendTo('body');
		result = $('.css_test').width() > 0;
		$('.css_test').remove();
		return result;
	}

	Des.print_mode = function() {
		//	FOR THIS TO WORK make sure the following CSS is being referenced somewhere:
		//	.print_test { display: none; height: 1px; width: 1px; }

		$('<div class="print_test"></div>').appendTo('body');
		result = $('.print_test').width() > 0;
		$('.print_test').remove();
		return result;
	}
    */
	
	Des.cart_donate = function() {
		
		$("#donate").click(function() {
			isDonate = $(this).attr('checked');
			donateAmount = parseFloat($(this).val());
			totalAmount = parseFloat($("#ct").val());
			newTotal = totalAmount + donateAmount;
			
			if (isDonate) {
				$.post("/incs/actions/cart_donate.php?add_donate=Y",
					function(data){
						
						donateRow = $("<tr></tr>");
						donateRow.attr("id","donate_row");
						donateRow.html("<th>Donation:</th><td>&pound;"+donateAmount.toFixed(2)+"</td>");
						$("#cart_total_row").before(donateRow);

						// update total price
						$("#cart_total_row td.cart_total_price").html(data);

					}
				);
			}
			else {
				$.post("/incs/actions/cart_donate.php?add_donate=N",
					function(data){
						
						$("#donate_row").remove();
						
						// update total price
						$("#cart_total_row td.cart_total_price").html(data);

					}
				);
		
			}
		});
		
	}
	


	/* Big Target */
    /*
	;(function($) {
		$.fn.bigTarget = function() {
			
			return this.each(function() {

				$(this)
					.css('cursor', 'pointer')
					.click(function() {
						
						// using event.target should have worked here, but lamo IE was misbehaving
						var e = e || window.event;
						var tgt = e.target || e.srcElement;
						if (tgt.nodeName.toLowerCase() != 'button' && tgt.nodeName.toLowerCase() != 'a' ) {
							window.location = $(this).find('li.title a').attr('href');
							return false;
						}
					})
			})

		}
	})(jQuery);
    */


	/* Log */
	//;(function($){$.fn.log=function(message){console.log("%s: %o",message,this);return this}})(jQuery);
