function checkform()
{
	
	if(document.schoolregistration.companyname.value =="")
	{

		document.schoolregistration.companyname.focus();
		document.getElementById('lbl_companyname').style.color = "red";
		return false;
	}
	
	if(document.schoolregistration.contactname.value =="")
	{

		document.schoolregistration.contactname.focus();
		document.getElementById('lbl_contactname').style.color = "red";
		return false;
	}
	if(document.schoolregistration.telephone.value =="")
	{

		document.schoolregistration.telephone.focus();
		document.getElementById('lbl_telephone').style.color = "red";
		return false;
	}
	
	if(document.schoolregistration.add.value =="")
	{

		document.schoolregistration.add.focus();
		document.getElementById('lbl_add').style.color = "red";
		return false;
	}
	
	if(document.schoolregistration.p_code.value =="")
	{

		document.schoolregistration.p_code.focus();
		document.getElementById('lbl_p_code').style.color = "red";
		return false;
	}
	
	if(document.schoolregistration.email.value =="")
	{

		document.schoolregistration.email.focus();
		document.getElementById('lbl_email').style.color = "red";
		return false;
	}
	else
	{
			if(!isValidEmail(document.schoolregistration.email.value))
			{
				document.schoolregistration.email.focus();
				document.getElementById('lbl_email').style.color = "red";
				return false;
				
			}
	}
 	document.schoolregistration.submit();
	//return true;
}


function isValidEmail(emailStr) {
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Ths username contains invalid characters in e-mail address.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ths domain name contains invalid characters in e-mail address.");
			return false;
		}
	}
	if (user.match(userPat)==null) {
		alert("The username doesn't seem to be valid in e-mail address.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				return false;
	   		}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid in e-mail address.");
			return false;
	   }	
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	if (len<2) {
		alert("This e-mail address is missing a hostname!");
		return false;
	}	
	return true;
}


function normal(val)
{
	var ele = "lbl_" + val;
//	document.getElementById(ele).style.border="solid 1px black";

	document.getElementById(ele).style.color= "#000";
}

function checkVisitorForm()
{
	
	if(document.visitorregistration.firstname.value =="")
	{

		document.visitorregistration.firstname.focus();
		document.getElementById('lbl_firstname').style.color = "red";
		return false;
	}
	if(document.visitorregistration.lastname.value =="")
	{

		document.visitorregistration.lastname.focus();
		document.getElementById('lbl_lastname').style.color = "red";
		return false;
	}
	
	if(document.visitorregistration.telephone.value =="")
	{

		document.visitorregistration.telephone.focus();
		document.getElementById('lbl_telephone').style.color = "red";
		return false;
	}
	if(document.visitorregistration.address.value =="")
	{

		document.visitorregistration.address.focus();
		document.getElementById('lbl_address').style.color = "red";
		return false;
	}
	if(document.visitorregistration.post_code.value =="")
	{

		document.visitorregistration.post_code.focus();
		document.getElementById('lbl_post_code').style.color = "red";
		return false;
	}
	
	if(document.visitorregistration.email.value =="")
	{

		document.visitorregistration.email.focus();
		document.getElementById('lbl_email').style.color = "red";
		return false;
	}
	else
	{
			if(!isValidEmail(document.visitorregistration.email.value))
			{
				document.visitorregistration.email.focus();
				document.getElementById('lbl_email').style.color = "red";
				return false;
				
			}
	}
	if(document.visitorregistration.proNumber.value =="")
	{

		document.visitorregistration.proNumber.focus();
		document.getElementById('lbl_proNumber').style.color = "red";
		return false;
	}
	
	
	if(document.getElementById('terms').checked==false)
	{
			
			alert("Please Accept Terms & Conditions");
			return false;
			
	}
	 document.visitorregistration.submit();

	 
//	return true;
}

function checkContactForm()
{
	
	if(document.contactus.firstname.value =="")
	{

		document.contactus.firstname.focus();
		document.getElementById('lbl_firstname').style.color = "red";
		return false;
	}
	if(document.contactus.lastname.value =="")
	{

		document.contactus.lastname.focus();
		document.getElementById('lbl_lastname').style.color = "red";
		return false;
	}
	
	if(document.contactus.telephone.value =="")
	{

		document.contactus.telephone.focus();
		document.getElementById('lbl_telephone').style.color = "red";
		return false;
	}
	if(document.contactus.address.value =="")
	{

		document.contactus.address.focus();
		document.getElementById('lbl_address').style.color = "red";
		return false;
	}
	if(document.contactus.post_code.value =="")
	{

		document.contactus.post_code.focus();
		document.getElementById('lbl_post_code').style.color = "red";
		return false;
	}
	
	if(document.contactus.email.value =="")
	{

		document.contactus.email.focus();
		document.getElementById('lbl_email').style.color = "red";
		return false;
	}
	else
	{
			if(!isValidEmail(document.contactus.email.value))
			{
				document.contactus.email.focus();
				document.getElementById('lbl_email').style.color = "red";
				return false;
				
			}
	}
	 document.contactus.submit();

	 
//	return true;
}