function window_onload()
{
    
	document.form.applier_name.focus();
  
   }

function window_reset()
{   
	window.form.reset();
	document.form.applier_name.value="";
	document.form.age.value="";
	document.form.job_qualification.value="";
	document.form.job_currentlocation.value="";
	document.form.job_technology.value="";
	document.form.current_organization.value="";
	document.form.year_experience.value="";
	document.form.contact_number.value="";
	document.form.email.value="";
	document.form.txtCaptcha.value="";
	document.form.applier_name.focus();	
	return false;
   }

function uploadfile_reset(){
	document.form.attach_profile.value=" ";
	return false;
}

function checkform()
{

if(document.form.applier_name.value=="")
            {
            	alert("Please Enter Name");
				document.form.applier_name.focus();
                return false;
            }


               if(document.form.applier_name.value!=""){
				if (document.form.applier_name.value.match(/^[a-zA-Z ]+$/))
				{
					
					}
				else
				{
alert("You can only enter Alphabets in this box.");
document.form.applier_name.focus();
return false;
} 
}       
			
 if(document.form.age.value!=""){
	 
if (document.form.age.value.match(/^[0-9 .+]+$/))
{
	
}
else
{
alert("You can only enter numbers in this box.");
document.form.age.focus();
return false;
} 
}
			
		
			
if(document.form.year_experience.value!=""){
 if (document.form.year_experience.value.match(/^[0-9.]+$/))
	{
	
}else{
alert("You can only enter numbers in this box.");
document.form.year_experience.focus();
return false;
}
 }


			
			if (document.form.contact_number.value=="")
            {
				
            	alert("Please Enter Contact Number");
                document.form.contact_number.focus();
            	return false;
			}

			

	if(document.form.contact_number.value!=""){

if (document.form.contact_number.value.match(/^[0-9 ,-]+$/))
{
	
}
else
{
alert("Please Enter a Valid Contact Number.");
document.form.contact_number.focus();
return false;
} 
}


if (document.form.email.value=="")
	    {
		alert("Please Enter Email ID");
		document.form.email.focus();
		return false;
	    }
            
if(document.form.email.value!=""){
if (echeck(document.form.email.value)==false)
            {
		document.form.email.focus();
		return false;
	     }
}
		

if (document.form.attach_profile.value=="")
            {
				
            	alert("Please Attach Profile");
                document.form.attach_profile.focus();
            	return false;
			}



            if (document.form.attach_profile.value!="")
            {

			var sFileName=document.form.attach_profile.value;
             var i = sFileName.lastIndexOf(".") ;
            
			if (i == -1 || sFileName.substring(i,sFileName.length).toLowerCase() == ".doc" || sFileName.substring(i,sFileName.length).toLowerCase()==".txt" || sFileName.substring(i,sFileName.length).toLowerCase()== ".rtf" || sFileName.substring(i,sFileName.length).toLowerCase() == ".pdf")
            {
                
	         var objUpload=eval("document.form.attach_profile");
			 var sUpload=objUpload.value;			
					  
		 if(sUpload!="")
        {
	    var islesh;
		var browseroperas=navigator.appName;
	    //alert(browseroperas);
				
		if(browseroperas=='Opera'){
			//alert(browseroperas);
		  islesh=sUpload.indexOf('document.form.oprchk.value');
		  
		}else{
		 islesh=sUpload.indexOf("\\");
		}
					
        		var iDotdot=sUpload.indexOf(".");
        
		if(browseroperas=='Opera'){
			
			if((islesh < -1 ) || (iDotdot < 0))
            {
				//alert(islesh);
            alert("Invalid File Path for Upload!");
            objUpload.focus();
            event.returnValue=false; 
            return; 
        }
		}else{
		if((islesh < 0 ) || (iDotdot < 0))
            {
            alert("Invalid File Path for Upload!");
            objUpload.focus();
            event.returnValue=false; 
            return; 
        }

		}
        
        }
   	} else
            {
                 alert ("Attached file should be of either doc,txt,rtf,pdf extension.") ;
                    return false ;
            }
			}

		
			
			if (document.form.txtCaptcha.value=="")
            {
				
            	alert("Please Enter Verify Code from Above Image");
                document.form.txtCaptcha.focus();
            	return false;
			}



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")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
	 	 }
			if (str.indexOf(",")!=-1){
		    alert("Invalid E-mail ID")
		    return false
	 	 }
		
				
   }



}



function hidvcode()
                {
                  elementteam = document.getElementById("vcodeerror");
				  elementteam.style.display="none";	  		      			   
				}
				
	
					

				
			

