/** To validate forms before submit - added by MW March 2009 **/


function checkCt() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfname = document.contact.realname.value;
	tcfemail = document.contact.email.value; cfemail = tcfemail.match("@");
	tcfphone = document.contact.telephone.value; cfphone = tcfphone.replace(/ /gi, "");
	
	cfcontacts= document.contact.contacts.value;
	cfaddress = document.contact.address.value;
	
	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
	{
		document.getElementById("errorA").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorA").style.display = "none";
	}

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("errorB").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorB").style.display = "none";
	}
	
	if(isNaN(cfphone) || cfphone == "" || cfphone == " " || cfphone == "  " || cfphone == "   ")
	{
		document.getElementById("errorC").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorC").style.display = "none";
	}


	if(cfcontacts == "" || cfcontacts == " " || cfcontacts == "  " || cfcontacts == "   ")
	{
		document.getElementById("errorE").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorE").style.display = "none";
	}
	
	if(cfaddress == "" || cfaddress == " " || cfaddress == "  " || cfaddress == "   ")
	{
		document.getElementById("errorD").style.display = "inline";
		theform += "addme";
	}
	else
	{
		document.getElementById("errorD").style.display = "none";
	}
	


	if (theform == origform)
	{
		document.contact.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
	}
	else
	{
		document.getElementById("errormsg").style.display = "inline";
		window.scrollTo(0,0);
		return false;
	}

}
