	function showhideshipform()
	{
		if (document.billing.chckbox.checked)
			{
				document.getElementById("ship").style.visibility = "visible";
				var shipping_address_different = 1;
				document.billing.chckbox.value = 1;
				showhideshipfield();
			}
			else
			{
				document.getElementById("ship").style.visibility = "hidden";
				var shipping_address_different = 9;
				document.billing.chckbox.value = 0;
				document.getElementById("ship_state").style.visibility = "hidden";
				document.getElementById("ship_state_title").style.visibility = "hidden";
			}
	}

	function confirmcond()
	{
		if (document.billing.confirm_cond.checked)
			{
				document.billing.confirm_cond.checked = true;
				document.billing.confirm_cond.value = 1;
			}
			else
			{
				document.billing.confirm_cond.checked = false;
				document.billing.confirm_cond.value = 0;
			}
	}
	
	function showhidebillingfield()
	{
		var country = document.getElementById('billing_country');
		var countryvalue = country.value.slice(0,2);
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("billing_state").style.visibility = "visible" : document.getElementById("billing_state").style.visibility = "hidden";
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("billing_state").disabled = "": document.getElementById("billing_state").disabled = "disabled";
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("billing_state_title").style.visibility = "visible" : document.getElementById("billing_state_title").style.visibility = "hidden"


	}
	function showhideshipfield()
	{
		var country = document.getElementById('billing_country');
		var countryvalue = country.value.slice(0,2);
		var country = document.getElementById('ship_country');
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("ship_state").style.visibility = "visible" : document.getElementById("ship_state").style.visibility = "hidden";
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("ship_state").style.visibility = "visible" : document.getElementById("ship_state").value = "";
		(countryvalue == "US" || countryvalue == "CA" || countryvalue == "AU")? document.getElementById("ship_state_title").style.visibility = "visible" : document.getElementById("ship_state_title").style.visibility = "hidden"

	}
	function regform_cookie(cookie_name)
	{
		var billing_first_name = document.billing.billing_first_name.value;
		var billing_last_name = document.billing.billing_last_name.value;
		var billing_address_1 = document.billing.billing_address_1.value;
		var billing_address_2 = document.billing.billing_address_2.value;
		var billing_city = document.billing.billing_city.value;
		var billing_country = document.billing.billing_country.value;
		var billing_state = document.billing.billing_state.value;
		var billing_zip_code = document.billing.billing_zip_code.value;
		var billing_telephone = document.billing.billing_telephone.value;
		var chckbox = document.billing.chckbox.checked;
		var ship_first_name = document.billing.ship_first_name.value;
		var ship_last_name = document.billing.ship_last_name.value;
		var ship_address_1 = document.billing.ship_address_1.value;
		var ship_address_2 = document.billing.ship_address_2.value;
		var ship_city = document.billing.ship_city.value;
		var ship_country = document.billing.ship_country.value;
		var ship_state = document.billing.ship_state.value;
		var ship_zip_code = document.billing.ship_zip_code.value;
		var ship_telephone = document.billing.ship_telephone.value;
		var confirm_cond = document.billing.confirm_cond.checked;
		
		var regform_cookie = 	billing_first_name+'%%##'+
					billing_last_name+'%%##'+
					billing_address_1+'%%##'+
					billing_address_2+'%%##'+
					billing_city+'%%##'+
					billing_country+'%%##'+
					billing_state+'%%##'+
					billing_zip_code+'%%##'+
					billing_telephone+'%%##'+
					chckbox+'ship%%##'+
					ship_first_name+'%%##'+
					ship_last_name+'%%##'+
					ship_address_1+'%%##'+
					ship_address_2+'%%##'+
					ship_city+'%%##'+
					ship_country+'%%##'+
					ship_state+'%%##'+
					ship_zip_code+'%%##'+
					ship_telephone+'%%##'+
					confirm_cond+'cond%%##';
		
		var expiredays = 1;
		var exdate=new Date();
                var cookie_name = cookie_name;
		exdate.setDate(exdate.getDate() +expiredays);
		if (cookie_name == 'account_cookie'){}
		else
		{document.cookie= cookie_name + "%%##" +regform_cookie  + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());}
		
		
	}

	function check_cookie()
	{
	var cookie = document.cookie;
	regform_cookie = 'regform_cookie%%##';
	var check_cookie = cookie.search(regform_cookie);
	if (check_cookie == -1)
	{
	window.location.href='/checkout.php?regref=cart&checkout=1&check_cookie=0';
	}
	else
	{
	window.location.href='/checkout.php?regref=cart&checkout=1&check_cookie=1';
	}
	}

	function read_regform_cookie(name)
	{
	var cookie = document.cookie;
        var inputvalue = cookie.split('%%##');

	
	for (var i in inputvalue)
	{
	if (i > 0){
	document.billing.elements[i-1].value = inputvalue[i];


	if (inputvalue[i] == 'falseship')
	{
	document.billing.elements[i-1].checked = false;
	document.getElementById("ship").style.visibility = "hidden";
	document.billing.elements[i-1].value = 0;
	}
	if (inputvalue[i] == 'trueship')
	{
	document.billing.elements[i-1].checked = true;
	document.getElementById("ship").style.visibility = "visible";
	document.billing.elements[i-1].value = 1;
	showhideshipfield();
	}


	if (inputvalue[i] == 'falsecond')
	{
	document.billing.elements[i-1].checked = false;
	document.billing.elements[i-1].value = 0;
	}
	if (inputvalue[i] == 'truecond')
	{
	document.billing.elements[i-1].checked = true;
	document.billing.elements[i-1].value = 1;
	}

	i = i + 1;
	}
	}
	showhidebillingfield();
	}
	
	
	
	function check_eudebitde_form()
	{
if(document.getElementById("CKABA").value==""){document.getElementById("CKABA").style.backgroundColor="#ffcccc";var CKABAerror=1;}else{document.getElementById("CKABA").style.backgroundColor="#ffffff";var CKABAerror=0;}
if(document.getElementById("CKAcct").value==""){document.getElementById("CKAcct").style.backgroundColor="#ffcccc";var CKAccterror=1;}else{document.getElementById("CKAcct").style.backgroundColor="#ffffff";var CKAccterror=0;}
if(document.getElementById("IDField1").value==""){document.getElementById("IDField1").style.backgroundColor="#ffcccc";var IDField1error=1;}else{document.getElementById("IDField1").style.backgroundColor="#ffffff";var IDField1error=0;}
if(document.getElementById("IDField2").value==""){document.getElementById("IDField2").style.backgroundColor="#ffcccc";var IDField2error=1;}else{document.getElementById("IDField2").style.backgroundColor="#ffffff";var IDField2error=0;}
if(document.getElementById("IDField3").value==""){document.getElementById("IDField3").style.backgroundColor="#ffcccc";var IDField3error=1;}else{document.getElementById("IDField3").style.backgroundColor="#ffffff";var IDField3error=0;}
if(document.getElementById("IDField4").value==""){document.getElementById("IDField4").style.backgroundColor="#ffcccc";var IDField4error=1;}else{document.getElementById("IDField4").style.backgroundColor="#ffffff";var IDField4error=0;}
if(document.getElementById("Country").value==""){document.getElementById("Country").style.backgroundColor="#ffcccc";var Countryerror=1;}else{document.getElementById("Country").style.backgroundColor="#ffffff";var Countryerror=0;}
if(document.getElementById("State").value==""){document.getElementById("State").style.backgroundColor="#ffcccc";var Stateerror=1;}else{document.getElementById("State").style.backgroundColor="#ffffff";var Stateerror=0;}
if(document.getElementById("FirstName").value==""){document.getElementById("FirstName").style.backgroundColor="#ffcccc";var FirstNameerror=1;}else{document.getElementById("FirstName").style.backgroundColor="#ffffff";var FirstNameerror=0;}
if(document.getElementById("LastName").value==""){document.getElementById("LastName").style.backgroundColor="#ffcccc";var LastNameerror=1;}else{document.getElementById("LastName").style.backgroundColor="#ffffff";var LastNameerror=0;}
if(document.getElementById("Address1").value==""){document.getElementById("Address1").style.backgroundColor="#ffcccc";var Address1error=1;}else{document.getElementById("Address1").style.backgroundColor="#ffffff";var Address1error=0;}
if(document.getElementById("City").value==""){document.getElementById("City").style.backgroundColor="#ffcccc";var Cityerror=1;}else{document.getElementById("City").style.backgroundColor="#ffffff";var Cityerror=0;}
if(document.getElementById("Zip").value==""){document.getElementById("Zip").style.backgroundColor="#ffcccc";var Ziperror=1;}else{document.getElementById("Zip").style.backgroundColor="#ffffff";var Ziperror=0;}
if(document.getElementById("Phone").value==""){document.getElementById("Phone").style.backgroundColor="#ffcccc";var Phoneerror=1;}else{document.getElementById("Phone").style.backgroundColor="#ffffff";var Phoneerror=0;}
if(document.getElementById("Email").value==""){document.getElementById("Email").style.backgroundColor="#ffcccc";var Emailerror=1;}else{document.getElementById("Email").style.backgroundColor="#ffffff";var Emailerror=0;}
	if(CKABAerror==1||CKAccterror==1||IDField1error==1||IDField2error==1||IDField3error==1||IDField4error==1||Countryerror==1||Stateerror==1||FirstNameerror==1||LastNameerror==1||Address1error==1||Cityerror==1||Ziperror==1||Phoneerror==1||Emailerror==1)
	{return false}
	else
	{document.getElementById("eudebitde").submit();}
	}
	
	
	function check_eudebitnl_form()
	{
if(document.getElementById("CKAcct").value==""){document.getElementById("CKAcct").style.backgroundColor="#ffcccc";var CKAccterror=1;}else{document.getElementById("CKAcct").style.backgroundColor="#ffffff";var CKAccterror=0;}
if(document.getElementById("Country").value==""){document.getElementById("Country").style.backgroundColor="#ffcccc";var Countryerror=1;}else{document.getElementById("Country").style.backgroundColor="#ffffff";var Countryerror=0;}
if(document.getElementById("FirstName").value==""){document.getElementById("FirstName").style.backgroundColor="#ffcccc";var FirstNameerror=1;}else{document.getElementById("FirstName").style.backgroundColor="#ffffff";var FirstNameerror=0;}
if(document.getElementById("LastName").value==""){document.getElementById("LastName").style.backgroundColor="#ffcccc";var LastNameerror=1;}else{document.getElementById("LastName").style.backgroundColor="#ffffff";var LastNameerror=0;}
if(document.getElementById("Address1").value==""){document.getElementById("Address1").style.backgroundColor="#ffcccc";var Address1error=1;}else{document.getElementById("Address1").style.backgroundColor="#ffffff";var Address1error=0;}
if(document.getElementById("City").value==""){document.getElementById("City").style.backgroundColor="#ffcccc";var Cityerror=1;}else{document.getElementById("City").style.backgroundColor="#ffffff";var Cityerror=0;}
if(document.getElementById("Zip").value==""){document.getElementById("Zip").style.backgroundColor="#ffcccc";var Ziperror=1;}else{document.getElementById("Zip").style.backgroundColor="#ffffff";var Ziperror=0;}
if(document.getElementById("Phone").value==""){document.getElementById("Phone").style.backgroundColor="#ffcccc";var Phoneerror=1;}else{document.getElementById("Phone").style.backgroundColor="#ffffff";var Phoneerror=0;}
if(document.getElementById("Email").value==""){document.getElementById("Email").style.backgroundColor="#ffcccc";var Emailerror=1;}else{document.getElementById("Email").style.backgroundColor="#ffffff";var Emailerror=0;}
	if(CKAccterror==1||Countryerror==1||FirstNameerror==1||LastNameerror==1||Address1error==1||Cityerror==1||Ziperror==1||Phoneerror==1||Emailerror==1)
	{return false}
	else
	{document.getElementById("eudebitnl").submit();}
	}

	function check_eudebitat_form()
	{
if(document.getElementById("CKABA").value==""){document.getElementById("CKABA").style.backgroundColor="#ffcccc";var CKABAerror=1;}else{document.getElementById("CKABA").style.backgroundColor="#ffffff";var CKABAerror=0;}
if(document.getElementById("CKAcct").value==""){document.getElementById("CKAcct").style.backgroundColor="#ffcccc";var CKAccterror=1;}else{document.getElementById("CKAcct").style.backgroundColor="#ffffff";var CKAccterror=0;}
if(document.getElementById("Country").value==""){document.getElementById("Country").style.backgroundColor="#ffcccc";var Countryerror=1;}else{document.getElementById("Country").style.backgroundColor="#ffffff";var Countryerror=0;}
if(document.getElementById("State").value==""){document.getElementById("State").style.backgroundColor="#ffcccc";var Stateerror=1;}else{document.getElementById("State").style.backgroundColor="#ffffff";var Stateerror=0;}
if(document.getElementById("FirstName").value==""){document.getElementById("FirstName").style.backgroundColor="#ffcccc";var FirstNameerror=1;}else{document.getElementById("FirstName").style.backgroundColor="#ffffff";var FirstNameerror=0;}
if(document.getElementById("LastName").value==""){document.getElementById("LastName").style.backgroundColor="#ffcccc";var LastNameerror=1;}else{document.getElementById("LastName").style.backgroundColor="#ffffff";var LastNameerror=0;}
if(document.getElementById("Address1").value==""){document.getElementById("Address1").style.backgroundColor="#ffcccc";var Address1error=1;}else{document.getElementById("Address1").style.backgroundColor="#ffffff";var Address1error=0;}
if(document.getElementById("City").value==""){document.getElementById("City").style.backgroundColor="#ffcccc";var Cityerror=1;}else{document.getElementById("City").style.backgroundColor="#ffffff";var Cityerror=0;}
if(document.getElementById("Zip").value==""){document.getElementById("Zip").style.backgroundColor="#ffcccc";var Ziperror=1;}else{document.getElementById("Zip").style.backgroundColor="#ffffff";var Ziperror=0;}
if(document.getElementById("Phone").value==""){document.getElementById("Phone").style.backgroundColor="#ffcccc";var Phoneerror=1;}else{document.getElementById("Phone").style.backgroundColor="#ffffff";var Phoneerror=0;}
if(document.getElementById("Email").value==""){document.getElementById("Email").style.backgroundColor="#ffcccc";var Emailerror=1;}else{document.getElementById("Email").style.backgroundColor="#ffffff";var Emailerror=0;}
	if(CKABAerror==1||CKAccterror==1||Countryerror==1||Stateerror==1||FirstNameerror==1||LastNameerror==1||Address1error==1||Cityerror==1||Ziperror==1||Phoneerror==1||Emailerror==1)
	{return false}
	else
	{document.getElementById("eudebitat").submit();}
	}
	
	function check_giropay_form()
	{
if(document.getElementById("RoutingNumber").value==""){document.getElementById("RoutingNumber").style.backgroundColor="#ffcccc";var RoutingNumbererror=1;}else{document.getElementById("RoutingNumber").style.backgroundColor="#ffffff";var RoutingNumbererror=0;}
if(document.getElementById("AccountNumber").value==""){document.getElementById("AccountNumber").style.backgroundColor="#ffcccc";var AccountNumbererror=1;}else{document.getElementById("AccountNumber").style.backgroundColor="#ffffff";var AccountNumbererror=0;}
if(document.getElementById("FirstName").value==""){document.getElementById("FirstName").style.backgroundColor="#ffcccc";var FirstNameerror=1;}else{document.getElementById("FirstName").style.backgroundColor="#ffffff";var FirstNameerror=0;}
if(document.getElementById("LastName").value==""){document.getElementById("LastName").style.backgroundColor="#ffcccc";var LastNameerror=1;}else{document.getElementById("LastName").style.backgroundColor="#ffffff";var LastNameerror=0;}
if(document.getElementById("Email").value==""){document.getElementById("Email").style.backgroundColor="#ffcccc";var Emailerror=1;}else{document.getElementById("Email").style.backgroundColor="#ffffff";var Emailerror=0;}
	if(RoutingNumbererror==1||AccountNumbererror==1||FirstNameerror==1||LastNameerror==1||Emailerror==1)
	{return false}
	else
	{document.getElementById("giropay").submit();}
	}

