
//////////////////////////////EMAIL VALIDATION//////////////////////////////////////////////////////////
function the_mail(control_value)
{
		var emailStr = control_value;
		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 ");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null)
		{
			alert("The Email address doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		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!");
					//eval("document."+form_name+"."+control_name).focus();
					return true;
				}
			}
				 
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
			alert("The address must end in a three-letter domain, or two letter country.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		if (len<2) 
		{
			alert("This address is missing a hostname!");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		return false;
	
}
///////////////////////////////////////////////////////////////////////////////////////////


function check_reg(a){
	var regBlank = /[^\s]/;
	var regBlank1=/[^\s]/;
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	
	if(!regBlank.test(document.regform01.company.value)){
	alert("Please Enter Your company");
	document.regform01.company.focus();
	document.getElementById("company").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.area.value)){
	alert("Please select area");
	document.regform01.area.focus();
	document.getElementById("area").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.plot.value)){
	alert("Please Enter Your plot");
	document.regform01.plot.focus();
	document.getElementById("plot").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.phone.value)){
	alert("Please Enter Your phone number");
	document.regform01.phone.focus();
	document.getElementById("phone").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.plot.value)){
	alert("Please Enter Your plot");
	document.regform01.plot.focus();
	document.getElementById("plot").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.useremail.value)){
	alert("Please Enter Your email");
	document.regform01.useremail.focus();
	document.getElementById("useremail").style.backgroundColor="#FF9393";
	return false;
	}
	if(the_mail(document.regform01.useremail.value)){
		alert("Please enter a valid emial id");
		document.regform01.useremail.focus();
		document.getElementById("useremail").style.backgroundColor="#FF9393";
		return false;
	}
	if(!regBlank.test(document.regform01.cp1.value)){
	alert("Please Enter atlest one contact details");
	document.regform01.cp1.focus();
	document.getElementById("cp1").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.designation01.value)){
	alert("Please Enter atlest one contact designation1");
	document.regform01.designation01.focus();
	document.getElementById("designation01").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.mobile01.value)){
	alert("Please Enter atlest one contact mobile1");
	document.regform01.mobile01.focus();
	document.getElementById("mobile01").style.backgroundColor="#FF9393";
	return false;
	}
	if(!regBlank.test(document.regform01.email01.value)){
	alert("Please Enter atlest one contact details");
	document.regform01.email01.focus();
	document.getElementById("email01").style.backgroundColor="#FF9393";
	return false;
	}
	if(the_mail(document.regform01.email01.value)){
		alert("Please enter a valid emial id");
		document.regform01.email01.focus();
		document.getElementById("email01").style.backgroundColor="#FF9393";
		return false;
	}
	
/*	if(!regBlank.test(document.regform01.agree_to_publish_details.value)){
	alert("Please agree with all terms and condition.");
	document.regform01.agree_to_publish_details.focus();
	document.getElementById("agree_to_publish_details").style.backgroundColor="#FF9393";
	return false;
	}*/
	
	

}

