// JavaScript Document

function Toogle(Obj){
	if(Obj.style.display == "block") Obj.style.display = "none";
	else Obj.style.display = "block";
}

function SubmitForm(Form){
	document.getElementById(Form).submit();
}

function SetPPShipping(){
	Country = document.getElementById('Country').options[document.getElementById('Country').selectedIndex].value;
	
	if(Country == "DE") document.getElementById('PPShippingValue').value = document.getElementById('ShippingD').value;
	else document.getElementById('PPShippingValue').value = document.getElementById('ShippingND').value;
}

function CheckForm(FormID){
	Elements = document.getElementById(FormID).elements;
	Throw = false;

	for(M=0; M<Elements.length; M++){

		Element = Elements[M];
		if(Element.id.indexOf('-Req') != -1){

			Element.parentNode.nextSibling.className = "NoError";
			if(Element.parentNode.parentNode.style.display == "none") continue;
			
			Value = new String(Element.value);

			if(Value.length == 0){
				Element.parentNode.nextSibling.className = "Error";
				Throw = true;
				continue;
			}
			
			if(Element.type.toLowerCase() == "checkbox" && Element.checked != true){
				Element.parentNode.nextSibling.className = "Error";
				Throw = true;
				continue;
			}

			if(Element.id.indexOf('-Email') != -1 && (Value.indexOf('@') == -1 || Value.indexOf('.') == -1 || Value.indexOf('@') >= Value.lastIndexOf('.'))){
				Element.parentNode.nextSibling.className = "Error";
				Throw = true;
				continue;
			}
		}
	}

	if(Throw == false) return true;
	else return false;
}