// JavaScript Document


	function validateForm(orderForm) 
	{
		
		var Name = orderForm.Name.value;
		var Phone = orderForm.Phone.value;
		var Email = orderForm.Email.value;
		var ShipAddress1 = orderForm.ShipAddress1.value;
		var ShipCity = orderForm.ShipCity.value;
		var ShipState = orderForm.ShipState.value;
		var ShipZip = orderForm.ShipZip.value;
		var CardholderName = orderForm.CardholderName.value;
		var CardNumber = orderForm.CardNumber.value;
		var ExpMonth = orderForm.ExpMonth.value;
		var ExpYear = orderForm.ExpYear.value;
		var CVVNumber = orderForm.CVVNumber.value;
		var BillAddress1 = orderForm.BillAddress1.value;
		var BillCity = orderForm.BillCity.value;
		var BillState = orderForm.BillState.value;
		var BillZip = orderForm.BillZip.value;
		var ErrorMsg = "";


		if(Name == "" || Phone == "" || Email == "" || ShipAddress1 == "" || ShipCity == "" || ShipState == "" || ShipZip == "" || CardholderName == "" || CardNumber == "" || ExpMonth == "" || ExpYear == "" || CVVNumber == "" || (orderForm.SameAddress.checked ==false && BillAddress1 == "" )|| (orderForm.SameAddress.checked ==false && BillCity == "") || (orderForm.SameAddress.checked ==false && BillState == "") || (orderForm.SameAddress.checked ==false && BillZip == "")  )
		{
			ErrorMsg=ErrorMsg + "<b>Please enter the following missing information:</b><br />";	
			
			if (Name == "") {
				ErrorMsg=ErrorMsg + "Name<br />";	
			}
	
			if (Phone == "") {
				ErrorMsg=ErrorMsg + "Phone<br />";
			}
	
			if (Email == "") {
				ErrorMsg=ErrorMsg + "Email<br />";
			}
			
			if (ShipAddress1 == "") {
				ErrorMsg=ErrorMsg + "Shipping Address<br />";
			}
	
			if (ShipCity == "") {
				ErrorMsg=ErrorMsg + "Shipping City<br />";
			}
	
			if (ShipState == "") {
				ErrorMsg=ErrorMsg + "Shipping State<br />";
			}
	
			if (ShipZip == "") {
				ErrorMsg=ErrorMsg + "Shipping Zip<br />";
			}
	
			if (CardholderName == "") {
				ErrorMsg=ErrorMsg + "Cardholders Name<br />";
			}
	
			if (CardNumber == "") {
				ErrorMsg=ErrorMsg + "Credit Card Number<br />";
			}
	
			if (ExpMonth == "") {
				ErrorMsg=ErrorMsg + "Credit Card Expiration Month<br />";
			}
	
			if (ExpYear == "") {
				ErrorMsg=ErrorMsg + "Credit Card Expiration Year<br />";
			}
	
			if (CVVNumber == "") {
				ErrorMsg=ErrorMsg + "Credit Card CVV Number<br />";
			}
	
			if (orderForm.SameAddress.checked ==false && BillAddress1 == "") {
				ErrorMsg=ErrorMsg + "Billing Address<br />";
			}
	
			if (orderForm.SameAddress.checked ==false && BillCity == "") {
				ErrorMsg=ErrorMsg + "Billing City<br />";
			}
	
			if (orderForm.SameAddress.checked ==false && BillState == "") {
				ErrorMsg=ErrorMsg + "Billing State<br />";
			}
	
			if (orderForm.SameAddress.checked ==false && BillZip == "") {
				ErrorMsg=ErrorMsg + "Billing Zip<br />";
			}
			
			ErrorMsg=ErrorMsg + "<br />";	
			
			document.getElementById('errors').innerHTML=ErrorMsg;
			
			return false;
		}	

		return true;
	}	


function togglebilling()
	
{
	if (document.forms[0].SameAddress.checked ==true)
	{
		document.forms[0].BillAddress1.readOnly = true;
		document.forms[0].BillAddress2.readOnly = true;
		document.forms[0].BillCity.readOnly = true;
		document.forms[0].BillState.disabled = true;
		document.forms[0].BillZip.readOnly = true;
		//--
		document.forms[0].BillAddress1.style.color = "#999999";
		document.forms[0].BillAddress2.style.color = "#999999";
		document.forms[0].BillCity.style.color = "#999999";
		document.forms[0].BillZip.style.color = "#999999";
		//--
		document.forms[0].BillAddress1.style.backgroundColor = "#dddddd";
		document.forms[0].BillAddress2.style.backgroundColor = "#dddddd";
		document.forms[0].BillCity.style.backgroundColor = "#dddddd";
		document.forms[0].BillState.style.backgroundColor = "#dddddd";
		document.forms[0].BillZip.style.backgroundColor = "#dddddd";
		//--
		document.forms[0].BillAddress1.value = document.forms[0].ShipAddress1.value;
		document.forms[0].BillAddress2.value = document.forms[0].ShipAddress2.value;
		document.forms[0].BillCity.value = document.forms[0].ShipCity.value;
		document.forms[0].BillState.value = document.forms[0].ShipState.value;
		document.forms[0].BillZip.value = document.forms[0].ShipZip.value;
	}
	else if (document.forms[0].SameAddress.checked ==false)
	{
		document.forms[0].BillAddress1.readOnly = false;
		document.forms[0].BillAddress2.readOnly = false;
		document.forms[0].BillCity.readOnly = false;
		document.forms[0].BillState.disabled = false;
		document.forms[0].BillZip.readOnly = false;
		//--
		document.forms[0].BillAddress1.style.color = "";
		document.forms[0].BillAddress2.style.color = "";
		document.forms[0].BillCity.style.color = "";
		document.forms[0].BillZip.style.color = "";
		//--
		document.forms[0].BillAddress1.style.backgroundColor = "";
		document.forms[0].BillAddress2.style.backgroundColor = "";
		document.forms[0].BillCity.style.backgroundColor = "";
		document.forms[0].BillState.style.backgroundColor = "";
		document.forms[0].BillZip.style.backgroundColor = "";
		//--
		document.forms[0].BillAddress1.value = "";
		document.forms[0].BillAddress2.value = "";
		document.forms[0].BillCity.value = "";
		document.forms[0].BillState.value = "";
		document.forms[0].BillZip.value = "";
	}
}



function updatebilling()
{
	if (document.forms[0].SameAddress.checked ==true)
	{
		document.forms[0].BillAddress1.value = document.forms[0].ShipAddress1.value;
		document.forms[0].BillAddress2.value = document.forms[0].ShipAddress2.value;
		document.forms[0].BillCity.value = document.forms[0].ShipCity.value;
		document.forms[0].BillState.value = document.forms[0].ShipState.value;
		document.forms[0].BillZip.value = document.forms[0].ShipZip.value;
		
	}
}
