// JavaScript Document
// JavaScript Document
var reWhitespace = /^\s+$/

function isEmpty(s)
{  
 return ((s == null) || (s.length == 0))
}


function isWhitespace (s)
{   
// Is s empty?
    return (isEmpty(s) || reWhitespace.test(s));
}
function isWhitespace (s)
{   
// Is s empty?
    return (isEmpty(s) || reWhitespace.test(s));
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID.\n")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID.\n")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID.\n")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID.\n")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID.\n")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID.\n")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID.\n")
		    return false
		 }

 		 return true					
	}


function ValidateNo(NumStr, String)
{    
for(var Idx=0; Idx<NumStr.length; Idx++)    
{        
var Char = NumStr.charAt(Idx);        
var Match = false;        
for(var Idx1=0; Idx1<String.length; Idx1++)        
{            
if(Char == String.charAt (Idx1))                
Match = true;        
}       
 if (!Match)            
return false;    
}    
return true;
} 

 function fun()
{
	document.frmEnq.reset();  
}

function check(){
	if((document.frmEnq.txtName.value == null)||isWhitespace(document.frmEnq.txtName.value))
	 {       
	 alert("Please enter the Name.\n");       
	 document.frmEnq.txtName.focus();       
	 return false;    
	 }

	if((document.frmEnq.txtOrg.value == null)||isWhitespace(document.frmEnq.txtOrg.value))
	 {       
	 alert("Please enter the Organization.\n");       
	 document.frmEnq.txtOrg.focus();       
	 return false;    
	 }
	 	if((document.frmEnq.txtDes.value == null)||isWhitespace(document.frmEnq.txtDes.value))
	 {       
	 alert("Please enter the Designation.\n");       
	 document.frmEnq.txtDes.focus();       
	 return false;    
	 }

	var emailID=document.frmEnq.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your Email ID.\n")
		emailID.focus()
		return false
	}
	
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	
		 if((document.frmEnq.txtPh.value == null)||isWhitespace(document.frmEnq.txtPh.value))
	 {       
	 alert("Please specify your phone Number.\n");       
	 document.frmEnq.txtPh.focus();       
	 return false;    
	 }
	 if(!ValidateNo(document.frmEnq.txtPh.value,"1234567890+- "))    
	 {        
	 alert("Please Enter Only Number.\n");        
	 document.frmEnq.txtPh.focus();        
	 return false;    
	 }
	 if((document.frmEnq.txtMob.value == null)||isWhitespace(document.frmEnq.txtMob.value))
	 {       
	 alert("Please specify your Mobile Number.\n");       
	 document.frmEnq.txtMob.focus();       
	 return false;    
	 }
	 if(!ValidateNo(document.frmEnq.txtMob.value,"1234567890+- "))    
	 {        
	 alert("Please Enter Only Number.\n");        
	 document.frmEnq.txtMob.focus();        
	 return false;    
	 }

	if((document.frmEnq.txtCom.value == null)||isWhitespace(document.frmEnq.txtCom.value))
	 {       
	 alert("Please enter the Message.\n");       
	 document.frmEnq.txtCom.focus();       
	 return false;    
	 }
	 return true;
}
// Job Req

 function clear()
{
	document.emp.reset();  
}


