
//	Uncomment to load the Firebug console
//	window.loadFirebugConsole();

	function DESemail(emailname,emailserver) {
		document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
		document.write(emailname + "@" + emailserver); 
		document.write("</a>"); 
	}

	// Accessible Pop Ups
	function DESopen(url,width,height,toolbar,scroll) {
		window.open(url, "", "scrollbars="+scroll+",toolbar="+toolbar+",height="+ height +",width="+width);
		return false;
	}



	$(function() {
		if (document.getElementById("add_cart")) {
			$("#add_cart").hover(
				function() { $(this).addClass('rollover'); },
				function() { $(this).removeClass('rollover'); }
			);
		}
	
		$("#mailing_list").submit(
			function() {
			
				var nameVal  = $("#ml_name").val();
				var emailVal = $("#ml_email").val();
			
				$("#ml_name").removeClass("error");
				$("#ml_email").removeClass("error");
			
				if (nameVal == '' || nameVal == 'enter your name here') {
					$("#ml_name").addClass("error");
					alert('You must enter your name');
					return false;
				}
			
				var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

				if (!filter.test(emailVal)) {
					// Invalid email

					$("#ml_email").addClass("error");
					alert('You must enter a valid email address');
					return false;
				} else {
					// Submit form

					$("#news_submit").val('Please Wait');
					$.ajax({
						type     : "GET",
						dataType : "html",
						url      : "/incs/ajax/signup.php?email="+emailVal+"&name="+nameVal+"",
						success  : function(msg) {
							if (msg == 'The email address you entered is already subscribed to our mailing list') {
								$("#news_submit").val('Signup!');
								$("#ml_email").addClass("error");
								alert(msg);
							} else {
								$("#mailing_list").hide();
								$("#mailing_list_message").html('<p><strong>Success!</strong> You have signed up to recieve our free pain relief report, which will be delivered by email. Many Thanks!</p>');
							}
						}
					});

					return false;
				}
			}
		);

		var tallest_product = 0;

		jQuery.each($('#page .container_list li'), function() {

			if ($(this).css('height') == 'auto') {
				tallest_product = 250;
			} else {
				current_height = Math.ceil($(this).css('height').substr(0, $(this).css('height').length - 2));

				if (current_height > tallest_product) tallest_product = current_height;
			}

		});

		$('#page .container_list li').css({ height : tallest_product });

	}); // End jQuery

