/** To validate forms before submit **/


function checkEnq() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfname = document.enqform.realname.value;
	tcfemail = document.enqform.email.value; cfemail = tcfemail.match("@");
	cfphone = document.enqform.phone.value;
	cfreplyby = document.enqform.replyby.value;
	cfenquiry = document.enqform.enquiry.value;
	
	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
	{
		document.getElementById("errorB").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorB").style.display = "none";
	}

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}

	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}

	if(cfreplyby == "" || cfreplyby == " " || cfreplyby == "  " || cfreplyby == "   ")
	{
		document.getElementById("errorE").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorE").style.display = "none";
	}

	if(cfenquiry == "" || cfenquiry == " " || cfenquiry == "  " || cfenquiry == "   ")
	{
		document.getElementById("errorF").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorF").style.display = "none";
	}

	if (theform == origform)
	{
		document.enqform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
 	}
 	else
 	{
 		document.getElementById("errormsg").style.display = "inline";
 		window.scrollTo(0,0);
 		return false;
 	}
}


function checkPri() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfname = document.priform.realname.value;
	tcfemail = document.priform.email.value; cfemail = tcfemail.match("@");
	cfphone = document.priform.phone.value;
	cfreplyby = document.priform.replyby.value;
	cfaddress = document.priform.address.value;
	cftown = document.priform.townORcity.value;
	cfpostcode = document.priform.postcode.value;
	cfcounty = document.priform.county.value;
	
	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}
	
	if(cfaddress == "" || cfaddress == " " || cfaddress == "  " || cfaddress == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}
	
	if(cftown == "" || cftown == " " || cftown == "  " || cftown == "   ")
	{
		document.getElementById("errorE").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorE").style.display = "none";
	}
	
	if(cfcounty == "" || cfcounty == " " || cfcounty == "  " || cfcounty == "   ")
	{
		document.getElementById("errorF").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorF").style.display = "none";
	}
	
	if(cfpostcode == "" || cfpostcode == " " || cfpostcode == "  " || cfpostcode == "   ")
	{
		document.getElementById("errorG").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorG").style.display = "none";
	}

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorH").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorH").style.display = "none";
	}

	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorI").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorI").style.display = "none";
	}

	if(cfreplyby == "" || cfreplyby == " " || cfreplyby == "  " || cfreplyby == "   ")
	{
		document.getElementById("errorJ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorJ").style.display = "none";
	}


	if (theform == origform)
	{
		document.priform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
 	}
 	else
 	{
 		document.getElementById("errormsg").style.display = "inline";
 		window.scrollTo(0,0);
 		return false;
 	}
 	
 }
 
 function checkFee() {
 
 	var theform = "Required Fields";
 	var origform = theform;
 	
 	cfname = document.feedform.realname.value;

 	
 	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
 	{
 		document.getElementById("errorA").style.display = "inline";
 		theform += "addme";
 	}
 	else
 	{
 		document.getElementById("errorA").style.display = "none";
 	}
 
 
 	if (theform == origform)
 	{
 		document.enqform.submit();
 		document.getElementById("errormsg").style.display = "none";
 		return true;
  	}
  	else
  	{
  		document.getElementById("errormsg").style.display = "inline";
  		window.scrollTo(0,0);
  		return false;
  	}
}



function checkRec() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfname = document.recform.realname.value;
	cfaddress = document.recform.address.value;
	cftown = document.recform.townORcity.value;
	cfcounty = document.recform.county.value;
	cfcode = document.recform.postcode.value;
	tcfemail = document.recform.email.value; cfemail = tcfemail.match("@");
	cfphone = document.recform.phone.value;
	cforder = document.recform.ordernumber.value;
	cfdelivery = document.recform.dateofdelivery.value;
	
	cfnameF = document.recform.friendname.value;
	cfaddressF = document.recform.friendaddress.value;
	cftownF = document.recform.friendtownORcity.value;
	cfcountyF = document.recform.friendcounty.value;
	cfcodeF = document.recform.friendpostcode.value;
	cfphoneF = document.recform.friendphone.value;
	
	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
	{
		document.getElementById("errorB").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorB").style.display = "none";
	}
	
	if(cfaddress == "" || cfaddress == " " || cfaddress == "  " || cfaddress == "   ")
	{
		document.getElementById("errorN").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorN").style.display = "none";
	}
	
	if(cftown == "" || cftown == " " || cftown == "  " || cftown == "   ")
	{
		document.getElementById("errorO").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorO").style.display = "none";
	}
	
	if(cfcounty == "" || cfcounty == " " || cfcounty == "  " || cfcounty == "   ")
	{
		document.getElementById("errorP").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorP").style.display = "none";
	}
	
	if(cfcode == "" || cfcode == " " || cfcode == "  " || cfcode == "   ")
	{
		document.getElementById("errorQ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorQ").style.display = "none";
	}

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}

	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}

	if(cforder == "" || cforder == " " || cforder == "  " || cforder == "   ")
	{
		document.getElementById("errorE").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorE").style.display = "none";
	}

	if(cfdelivery == "" || cfdelivery == " " || cfdelivery == "  " || cfdelivery == "   ")
	{
		document.getElementById("errorF").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorF").style.display = "none";
	}
	
	if(cfnameF == "" || cfnameF == " " || cfnameF == "  " || cfnameF == "   ")
	{
		document.getElementById("errorH").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorH").style.display = "none";
	}
	
	if(cfaddressF == "" || cfaddressF == " " || cfaddressF == "  " || cfaddressF == "   ")
	{
		document.getElementById("errorI").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorI").style.display = "none";
	}
	
	if(cftownF == "" || cftownF == " " || cftownF == "  " || cftownF == "   ")
	{
		document.getElementById("errorJ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorJ").style.display = "none";
	}
	
	if(cfcountyF == "" || cfcountyF == " " || cfcountyF == "  " || cfcountyF == "   ")
	{
		document.getElementById("errorK").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorK").style.display = "none";
	}
	
	if(cfcodeF == "" || cfcodeF == " " || cfcodeF == "  " || cfcodeF == "   ")
	{
		document.getElementById("errorL").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorL").style.display = "none";
	}
	
	if(isNaN(cfphoneF) || cfphoneF == "" || cfphoneF == " " || cfphoneF == "  " || cfphoneF == "   ")
	{
		document.getElementById("errorM").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorM").style.display = "none";
	}

	if (theform == origform)
	{
		document.enqform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
 	}
 	else
 	{
 		document.getElementById("errormsg").style.display = "inline";
 		window.scrollTo(0,0);
 		return false;
 	}
}


/*
function checkQuo() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfmodel = document.quoform.model.value;
	cfwidth = document.quoform.width.value;
	cflength = document.quoform.length.value;
	cfheighttoeaves = document.quoform.heighttoeaves.value;
	cfupandover = document.quoform.upandover.value;
	cfupandoverfinish = document.quoform.upandoverfinish.value;
	cfpersonneldoor = document.quoform.personneldoor.value;
	cfpersonneldoorfinish = document.quoform.personneldoorfinish.value;
	cftruebrick = document.quoform.truebrick.value;
	cfroofsheets = document.quoform.roofsheets.value;
	cfroofcolour = document.quoform.roofcolour.value;
	cftimberwindowsize = document.quoform.timberwindowsize.value;
	cfPVCuwindowsize = document.quoform.PVCuwindowsize.value;
	cfrealname = document.quoform.realname.value;
	cfaddress = document.quoform.address.value;
	cftownORcity = document.quoform.townORcity.value;
	cfcounty = document.quoform.county.value;
	cfpostcode = document.quoform.postcode.value;
	tcfemail = document.quoform.email.value; cfemail = tcfemail.match("@");
	cfphone = document.quoform.phone.value;
	
	if(cfmodel == "" || cfmodel == " " || cfmodel == "  " || cfmodel == "   ")
	{
		document.getElementById("errorA").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorA").style.display = "none";
	}
	
	if(cfwidth == "" || cfwidth == " " || cfwidth == "  " || cfwidth == "   ")
	{
		document.getElementById("errorB").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorB").style.display = "none";
	}
	
	if(cflength == "" || cflength == " " || cflength == "  " || cflength == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}

	if(cfheighttoeaves == "" || cfheighttoeaves == " " || cfheighttoeaves == "  " || cfheighttoeaves == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}

	if(cfupandover == "" || cfupandover == " " || cfupandover == "  " || cfupandover == "   ")
	{
		document.getElementById("errorE").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorE").style.display = "none";
	}
	
	if(cfupandoverfinish == "" || cfupandoverfinish == " " || cfupandoverfinish == "  " || cfupandoverfinish == "   ")
	{
		document.getElementById("errorF").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorF").style.display = "none";
	}
	
	if(cfpersonneldoor == "" || cfpersonneldoor == " " || cfpersonneldoor == "  " || cfpersonneldoor == "   ")
	{
		document.getElementById("errorG").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorG").style.display = "none";
	}
	
	if(cfpersonneldoorfinish == "" || cfpersonneldoorfinish == " " || cfpersonneldoorfinish == "  " || cfpersonneldoorfinish == "   ")
	{
		document.getElementById("errorH").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorH").style.display = "none";
	}
	
	if(cftruebrick == "" || cftruebrick == " " || cftruebrick == "  " || cftruebrick == "   ")
	{
		document.getElementById("errorI").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorI").style.display = "none";
	}
	
	if(cfroofsheets == "" || cfroofsheets == " " || cfroofsheets == "  " || cfroofsheets == "   ")
	{
		document.getElementById("errorJ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorJ").style.display = "none";
	}
	
	if(cfroofcolour == "" || cfroofcolour == " " || cfroofcolour == "  " || cfroofcolour == "   ")
	{
		document.getElementById("errorK").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorK").style.display = "none";
	}
	
	if(cfrealname == "" || cfrealname == " " || cfrealname == "  " || cfrealname == "   ")
	{
		document.getElementById("errorP").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorP").style.display = "none";
	}
	
	if(cfaddress == "" || cfaddress == " " || cfaddress == "  " || cfaddress == "   ")
	{
		document.getElementById("errorQ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorQ").style.display = "none";
	}
	
	if(cftownORcity == "" || cftownORcity == " " || cftownORcity == "  " || cftownORcity == "   ")
	{
		document.getElementById("errorR").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorR").style.display = "none";
	}
	
	if(cfcounty == "" || cfcounty == " " || cfcounty == "  " || cfcounty == "   ")
	{
		document.getElementById("errorS").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorS").style.display = "none";
	}
	
	if(cfpostcode == "" || cfpostcode == " " || cfpostcode == "  " || cfpostcode == "   ")
	{
		document.getElementById("errorT").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorT").style.display = "none";
	}
	

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorU").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorU").style.display = "none";
	}

	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorV").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorV").style.display = "none";
	}

	if (theform == origform)
	{
		document.enqform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
 	}
 	else
 	{
 		document.getElementById("errormsg").style.display = "inline";
 		window.scrollTo(0,0);
 		return false;
 	}
}
*/

function checkQuo() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfmodel = document.quoform.model.value;
	cfwidth = document.quoform.width.value;
	cflength = document.quoform.length.value;
	cfheighttoeaves = document.quoform.heighttoeaves.value;
	cfrealname = document.quoform.realname.value;
	cfaddress = document.quoform.address.value;
	cftownORcity = document.quoform.townORcity.value;
	cfcounty = document.quoform.county.value;
	cfpostcode = document.quoform.postcode.value;
	tcfemail = document.quoform.email.value; cfemail = tcfemail.match("@");
	cfphone = document.quoform.phone.value;
	
	if(cfmodel == "" || cfmodel == " " || cfmodel == "  " || cfmodel == "   ")
	{
		document.getElementById("errorA").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorA").style.display = "none";
	}
	
	if(cfwidth == "" || cfwidth == " " || cfwidth == "  " || cfwidth == "   ")
	{
		document.getElementById("errorB").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorB").style.display = "none";
	}
	
	if(cflength == "" || cflength == " " || cflength == "  " || cflength == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}

	if(cfheighttoeaves == "" || cfheighttoeaves == " " || cfheighttoeaves == "  " || cfheighttoeaves == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}

	if(cfrealname == "" || cfrealname == " " || cfrealname == "  " || cfrealname == "   ")
	{
		document.getElementById("errorP").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorP").style.display = "none";
	}
	
	if(cfaddress == "" || cfaddress == " " || cfaddress == "  " || cfaddress == "   ")
	{
		document.getElementById("errorQ").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorQ").style.display = "none";
	}
	
	if(cftownORcity == "" || cftownORcity == " " || cftownORcity == "  " || cftownORcity == "   ")
	{
		document.getElementById("errorR").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorR").style.display = "none";
	}
	
	if(cfcounty == "" || cfcounty == " " || cfcounty == "  " || cfcounty == "   ")
	{
		document.getElementById("errorS").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorS").style.display = "none";
	}
	
	if(cfpostcode == "" || cfpostcode == " " || cfpostcode == "  " || cfpostcode == "   ")
	{
		document.getElementById("errorT").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorT").style.display = "none";
	}
	

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorU").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorU").style.display = "none";
	}

	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorV").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorV").style.display = "none";
	}

	if (theform == origform)
	{
		document.enqform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
 	}
 	else
 	{
 		document.getElementById("errormsg").style.display = "inline";
 		window.scrollTo(0,0);
 		return false;
 	}
}