// JavaScript Document
function checkEmail (thevalue) 
{
				
	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=thevalue.match(emailPat);
						
	if (matchArray==null) {
						
						
						alert("Email address seems incorrect (check @ and .'s)");
						return false;
						}
						var user=matchArray[1];
						var domain=matchArray[2];
						
						
						for (i=0; i<user.length; i++) {
						if (user.charCodeAt(i)>127) {
						alert("Ths username in email address contains invalid characters.");
						return false;
						   }
						}
						for (i=0; i<domain.length; i++) {
						if (domain.charCodeAt(i)>127) {
						alert("Ths domain name in email address contains invalid characters.");
						return false;
						   }
						}
						
						
						
						if (user.match(userPat)==null) {
						
						// user is not valid
						
						alert("The username in email address doesn't seem to be valid.");
						return false;
						}
						
						
						var IPArray=domain.match(ipDomainPat);
						if (IPArray!=null) {
						
						// this is an IP address
						
						for (var i=1;i<=4;i++) {
						if (IPArray[i]>255) {
						alert("Destination IP address in email address is invalid!");
						return false;
						   }
						}
						return true;
						}
						
						// Domain is symbolic name.  Check if it's valid.
						 
						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 in email address does not seem to be valid.");
						return false;
						   }
						}
						
						if (checkTLD && domArr[domArr.length-1].length!=2 && 
						domArr[domArr.length-1].search(knownDomsPat)==-1) {
						alert("The email address must end in a well-known domain or two letter " + "country.");
						return false;
						}
						
						// Make sure there's a host name preceding the domain.
						
						if (len<2) {
						alert("This email address is missing a hostname!");
						return false;
						}
						
						// If we've gotten this far, everything's valid!
						return true;
						}
						
					function onSubmmission()
					{
						if(document.frm.txtName.value==0)
						{
							alert("Please enter Name");
							document.frm.txtName.focus();
							return false;
						}
						if(document.frm.txtEmail.value==0)
						{
							alert("Please enter Email Address");
							document.frm.txtEmail.focus();
							return false;
						}
						else
						{
							ret = checkEmail (document.frm.txtEmail.value); 
							if(ret==false)
							{
								document.frm.txtEmail.focus();
								return false;
							}
						}
						if(document.frm.cmdEnq[document.frm.cmdEnq.selectedIndex].value=="")
						{
							alert("Please select Nature of enquiry");
							document.frm.cmdEnq.focus();
							return false;
						}
					}
					
						
						function onSubmit()
	{
		if(document.apply.fname.value==0)
		{
			alert("Please enter First Name");
			document.apply.fname.focus();
			return false;
		}
		if(document.apply.lname.value==0)
		{
			alert("Please enter Last Name");
			document.apply.lname.focus();
			return false;
		}
		if(document.apply.contact.value==0)
		{
			alert("Please enter Contact Number");
			document.apply.contact.focus();
			return false;
		}
		if(document.apply.email.value==0)
		{
			alert("Please enter Email Address");
			document.apply.email.focus();
			return false;
		}
		else
		{
			ret = checkEmail (document.apply.email.value); 
			if(ret==false)
			{
				document.apply.email.focus();
				return false;
			}
		}
		if(document.apply.totexp[document.apply.totexp.selectedIndex].value=="")
		{
			alert("Please select Total Experience");
			document.apply.totexp.focus();
			return false;
		}
		
	}
	
	
	function requestSubmit()
     {
      
 
      if(document.frm.txtName.value==0)
      {
       alert("Please enter Name");
       document.frm.txtName.focus();
       return false;
      }
      
      
      if(document.frm.txtEmail.value==0)
      {
       alert("Please enter Email Address");
       document.frm.txtEmail.focus();
       return false;
      }
      else
      {
       ret = checkEmail (document.frm.txtEmail.value); 
       if(ret==false)
       {
        document.frm.txtEmail.focus();
        return false;
       }
      }
      
if(document.frm.txtCompany.value==0)
      {
       alert("Please enter company Name");
       document.frm.txtCompany.focus();
       return false;
      }
      if(document.frm.txtsubject.value==0)
      {
       alert("Please enter Subject");
       document.frm.txtsubject.focus();
       return false;
      }
      
 
     }
