//pop up menu

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);//v2.0  window.open(theURL,winName,features);
  return false;
}

function checkdata(){
	//for Google Checkout
	var theMessage = "Please complete the following:\n";
	var noErrors = theMessage
	
		if (!document.checkout.agree.checked) {
		//alert("Have you read the terms and conditions?.");
		theMessage = theMessage + "\n --> Have you read the terms and conditions?";
		}
	if (theMessage == noErrors) {
return true;

} else {

alert(theMessage);
return false;
}
}

function call_back(){
	//for call back
	var theMessage = "Please complete the following:\n";
	var noErrors = theMessage
	
		if (document.callback.name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Your name";
	    }
		if (document.callback.phone.value=="") {
		//alert("Enter delivery address.");
		theMessage = theMessage + "\n --> Your contact number";
	    }
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.callback.email.value)){
		theMessage = theMessage + "\n --> Your email address";
	    }
		
		
	if (theMessage == noErrors) {
return true;

} else {

alert(theMessage);
return false;
}
}


function validate(){
	//for Google Checkout
	var theMessage = "Please complete the following: \n-----------------------------------\n";
	var noErrors = theMessage
	
	if (document.form.name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Your name";

	}
		
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.form.email.value)){
		theMessage = theMessage + "\n --> Your e-mail address";
	}

	
		if (document.form.message.value=="") {
		//alert("Enter delivery address.");
		theMessage = theMessage + "\n --> Your message";
	}
		
	if (theMessage == noErrors) {
return true;

} else {

alert(theMessage);
return false;
}
}

function validate_quote(){
	var theMessage = "Please complete the following: \n-----------------------------------\n";
	var noErrors = theMessage
	
	if (document.customer_info.first_name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> First Name";

	}
	if (document.customer_info.last_name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Last Name";

	}
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.customer_info.email.value)){
		theMessage = theMessage + "\n --> Email Address";
	}

		if (document.customer_info.postcode.value=="") {
		//alert("Enter the postcode.");
		theMessage = theMessage + "\n --> Postcode";
	}
		if (document.customer_info.agree.value=="") {
		//alert("Enter the postcode.");
		theMessage = theMessage + "\n --> Postcode";
	}
	    if (!document.customer_info.agree.checked) {
		//alert("Have you read the terms and conditions?.");
		theMessage = theMessage + "\n --> Have you read the terms and conditions?";
		}
		
	if (theMessage == noErrors) {
return true;

} else {

alert(theMessage);
return false;
}
}

function validate_order(){
	var theMessage = "Please complete the following: \n-----------------------------------\n";
	var noErrors = theMessage
	
	if (document.order_form.first_name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> First Name";

	}
	if (document.order_form.last_name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Last Name";

	}
	if (document.order_form.house_name.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> House Name/No";

	}
		if (document.order_form.street.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Street";

	}
		if (document.order_form.city.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Town/City";

	}
		if (document.order_form.county.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> County";

	}
		if (document.order_form.postcode.value=="") {
		//alert("Enter your name.");
		theMessage = theMessage + "\n --> Postcode";

	}
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.order_form.email.value)){
		theMessage = theMessage + "\n --> Email Address";
	}

		if (document.order_form.telephone.value=="") {
		//alert("Enter the postcode.");
		theMessage = theMessage + "\n --> Telephone";
	}
	if (!document.order_form.agree.checked) {
		//alert("Have you read the terms and conditions?.");
		theMessage = theMessage + "\n --> Have you read the terms and conditions?";
		}
		
	if (theMessage == noErrors) {
return true;

} else {

alert(theMessage);
return false;
}
}


function clearText(field){

    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

function shToggle(content) {
	if (document.getElementById(content).style.display == "none") 
		document.getElementById(content).style.display = "block"
	else
		document.getElementById(content).style.display = "none"
}
