//////////////////////////////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 formsubmit(a,e)
{
	var regBlank = /[^\s]/;
var regBlank1=/[^\s]/;
		if(document.form1.categoryId.value==0){
alert("Please Select Category");
document.form1.categoryId.focus();
return false;
}
		if(document.form1.SiteTitle.value=='')
		{
		alert('Please  enter the SiteTitle  !! ');
		document.form1.SiteTitle.focus();
		return false;
		}
		
		 var theurl=document.form1.Siteurl.value;
     var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
     if (tomatch.test(theurl))
     {
     }
     else
     {
         window.alert("URL invalid. Try again.");
         return false; 
     }
	 
	 
		if(document.form1.Description.value=='')
		{
		alert('Please  enter the Description  !! ');
		document.form1.Description.focus();
		return false;
		}

	

	if(!regBlank.test(document.form1.email.value)){
		alert("Please insert  Email");
		document.form1.email.focus();
		return false;
	}
	if(the_mail(document.form1.email.value))
	{
	document.form1.email.focus();
	return false;
	}
		
		if(document.form1.latter.value=='')
		{
		alert('Please  enter the above text !! ');
		document.form1.latter.focus();
		return false;
		}
	
		if(document.form1.latter.value!=a)
		{
		alert('The text do not match !! ');
		document.form1.latter.focus();
		return false;
		}
	}
	
function reclink(){
	document.getElementById('recurlon').style.display='block';	
}
function reclinkclose(){
	document.getElementById('recurlon').style.display='none';	
}

