<!--
pic0= new Image(61,24); 
pic0.src="/images/but_home_over.gif"; 
pic1= new Image(95,24); 
pic1.src="/images/but_try_over.gif"; 
pic2= new Image(115,24); 
pic2.src="/images/but_how_over.gif"; 
pic3= new Image(111,24); 
pic3.src="/images/but_tips_over.gif"; 
pic4= new Image(139,24); 
pic4.src="/images/but_guarantee_over.gif"; 
pic5= new Image(49,24); 
pic5.src="/images/but_faq_over.gif"; 
pic6= new Image(103,24); 
pic6.src="/images/but_ingredients_over.gif"; 
pic7= new Image(84,24); 
pic7.src="/images/but_contact_over.gif"; 
pic8= new Image(275,79);
pic8.src="/images/single_off.gif";
pic9= new Image(275,79);
pic9.src="/images/twin_on.gif";

function swapImg(o) {
	var srcLen = o.src.length;
	if (o.src.indexOf("over")>-1) {
		o.src = o.src.substring(0,(srcLen-9)) + ".gif";
	}
	else {
		o.src = o.src.substring(0,(srcLen-4)) + "_over.gif";
	}
}

function validateContactForm() {
	var name = document.contactform.name.value;
	var sender_email = document.contactform.sender_email.value;
	var comment = document.contactform.comment.value;
	var validate = true;
	var msg = "";
	if (name.length<2) {
		msg += "Please enter your name.\n\n";
		validate = false;
	}
	if (sender_email.length<7) {
		msg += "Please enter your email in the form email@address.com.\n\n";
		validate = false;
	}
	if (comment.length<2) {
		msg += "Please enter your message.\n\n";
		validate = false;
	}
	if (!validate) alert(msg);
	return validate;
}

function validateLoginForm() {
	var email = document.loginform.email.value;
	var pass = document.loginform.pass.value;
	var validate = true;
	var msg = "";
	if (email.length<2) {
		msg += "Please enter your email address.\n\n";
		validate = false;
	}
	if (pass.length<3) {
		msg += "Please enter your password.\n\n";
		validate = false;
	}
	if (!validate) alert(msg);
	return validate;
}

function checkProduct(button) {
	if (button=="singlebutton")	{
		document.getElementById("singlebutton").style.background = "url(/images/single_on.gif) no-repeat";
		document.getElementById("twinbutton").style.background = "url(/images/twin_off.gif) no-repeat";
		document.orderform.product[0].checked = true;
		document.orderform.product[1].checked = false;

	}
	else {
		document.getElementById("singlebutton").style.background = "url(/images/single_off.gif) no-repeat";
		document.getElementById("twinbutton").style.background = "url(/images/twin_on.gif) no-repeat";
		document.orderform.product[1].checked = true;
		document.orderform.product[0].checked = false;
	}
}

function setButtonId(isInternational) {
	var product = "";
	if (document.orderform.product[0].checked) product = document.orderform.product[0].value;
	if (document.orderform.product[1].checked) product = document.orderform.product[1].value;
	if (!isInternational) {
		document.orderform.country.value = "US";
		document.orderform.os0.value = "USPS Priority Mail Domestic (2 to 5 days) - Free";
		if (product=="single") document.orderform.hosted_button_id.value = "7261575";
		if (product=="twin") document.orderform.hosted_button_id.value = "7261892";
	}
	else {
		document.orderform.country.value = "";
		document.orderform.os0.value = "USPS Priority Mail International (3 to 10 business days) - $4.95";
		if (product=="single") document.orderform.hosted_button_id.value = "7261908";
		if (product=="twin") document.orderform.hosted_button_id.value = "7261923";
	}
}

function setButtonCodes() {
	var product = "";
	if (document.orderform.product[0].checked) product = document.orderform.product[0].value;
	if (document.orderform.product[1].checked) product = document.orderform.product[1].value;
	document.orderform.os0.value = "USPS Priority Mail International (3 to 10 business days) - Free";
	if (product=="single") document.orderform.hosted_button_id.value = "7261575";
	if (product=="twin") document.orderform.hosted_button_id.value = "7261892";
}

function validateOrderForm() {
	var fields = "";
	if (document.detailsform.first_name.value=="") fields += "First name cannot be empty\n";
	if (document.detailsform.last_name.value=="") fields += "Last name cannot be empty\n";
	if (document.detailsform.email.value=="") fields += "Email cannot be empty\n";
	if (document.detailsform.address_line_1.value=="") fields += "Address line 1 cannot be empty\n";
	if (document.detailsform.country.options[0].selected) fields += "You must select a country\n";
	if (document.detailsform.city.value=="") fields += "City cannot be empty\n";
	if (document.detailsform.state.value=="") fields += "State/province cannot be empty\n";
	if (document.detailsform.post_code.value=="") fields += "Zip/postal code cannot be empty\n";
	if (!document.detailsform.same_billing.checked)	{
		if (document.detailsform.billing_first_name.value=="") fields += "Billing first name cannot be empty\n";
		if (document.detailsform.billing_last_name.value=="") fields += "Billing last name cannot be empty\n";
		if (document.detailsform.billing_address_line_1.value=="") fields += "Billing address line 1 cannot be empty\n";
		if (document.detailsform.billing_country.options[0].selected) fields += "You must select a billing country\n";
		if (document.detailsform.billing_city.value=="") fields += "Billing city cannot be empty\n";
		if (document.detailsform.billing_state.value=="") fields += "Billing state/province cannot be empty\n";
		if (document.detailsform.billing_post_code.value=="") fields += "Billing zip/postal code cannot be empty\n";
	}
	if (document.detailsform.card_type.options[0].selected) fields += "Select a card type\n";
	if (document.detailsform.card_number.value=="") fields += "Card number cannot be empty\n";
	if (document.detailsform.card_number.value.length<16) fields += "Card number must be 16 digits in length\n";
	if (document.detailsform.expiration_month.options[0].selected) fields += "Select an expiration month\n";
	if (document.detailsform.expiration_year.options[0].selected) fields += "Select an expiration year\n";
	if (document.detailsform.security_code=="") fields += "Security code cannot be empty\n";
	if (fields!="")	{
		alert("Fields are missing or have been entered incorrectly:\n\n" + fields + "\nPlease check the form before resubmitting.\n\n");
		return false;
	}
	return true;
}

function getShipping() {
	var i = document.detailsform.country.selectedIndex;
	var country = document.detailsform.country.options[i].value;
	var code = document.detailsform.code.value;
	var shipping = "";
	var shippingPrice = "";
	if (country!="") {
		if (country=="US") {
			if (code=="FREESHIP11") {
				shipping = "Shipping: USPS Priority Mail Domestic (2 to 5 days) - $0.00";
				shippingPrice = "0.00";
			}
			else {
				shipping = "Shipping: USPS Priority Mail Domestic (2 to 5 days) - $4.95";
				shippingPrice = "4.95";
			}
		}
		else {
			shipping = "Shipping: USPS Priority Mail International (3 to 10 business days) - $14.95";
			shippingPrice = "14.95";
		}
		document.getElementById("shipping_info").innerHTML = shipping;
		document.detailsform.shipping.value = shippingPrice;
		document.getElementById("pricing_info").innerHTML = " plus <b>$" + shippingPrice + "</b> for shipping";
	}
}

//-->
