 function validate()
 {
     if (document.applnform.txtCandName.value == "")
		    {
			    alert("You must enter your Name.");
			    document.applnform.txtCandName.focus();
			    return false;
		    }
             var notused="1234567890~!@#$%^&*()=+`<>,?{}[]:\";'\|";
	         var userid=document.applnform.txtCandName.value;
	         var idlen=userid.length;
	         var notlen=notused.length;
	         var i,j;
	            for(i=0;i<idlen;i++)
			    {
		    	    for(j=0;j<notlen;j++)
				    {
		        	    if(userid.charAt(i)==notused.charAt(j))
					    {
						    alert("Special characters are not allowed in Name field");
						    document.applnform.txtCandName.value="";
						    document.applnform.txtCandName.focus();
						    return false;
			    	    }
			 	    }
	        }

          if(document.applnform.txtFMName.value == "")
           {
            alert("You must enter Father's/Mother's Name.");
            document.applnform.txtFMName.focus();
            return false;
           }
        
            var notused="~!@#$%^&*()=+`<>,?{}[]:\";'\|";
	         var userid=document.applnform.txtFMName.value;
	         var idlen=userid.length;
	         var notlen=notused.length;
	         var i,j;
	            for(i=0;i<idlen;i++)
			    {
		    	    for(j=0;j<notlen;j++)
				    {
		        	    if(userid.charAt(i)==notused.charAt(j))
					    {
						    alert("Special characters are not allowed in Father's/Mother's Name field");
						    document.applnform.txtFMName.value="";
						    document.applnform.txtFMName.focus();
						    return false;
			    	    }
			 	    }
	            }
      //date validation
   
	    if(document.applnform.txtDD.value=="")
		    {
		    alert("Please enter the correct date of birth eg:08");
		    document.applnform.txtDD.focus();
		    return false;
		    }

	    if(isNaN(document.applnform.txtDD.value))
		    {
		    alert("Please enter the correct date of birth eg:08");
		    document.applnform.txtDD.focus();
		    return false;
		    }
        if(document.applnform.txtDD.value<1 || document.applnform.txtDD.value>31 )
		    {
		    alert("Please enter the correct date of birth eg:08");
		    document.applnform.txtDD.focus();
		    return false;
		    }
    		  
	    if(document.applnform.txtDD.value.length<2)
		    {
		    alert("Please enter correct 2 digit birth date eg:18");
		    document.applnform.txtDD.focus();
		    return false;
		    }


       if(document.applnform.txtMM.value=="")
		    {
		    alert("Please enter correct birth month eg:04 for April");
		    document.applnform.txtMM.focus();
		    return false;
		    }

	    if(isNaN(document.applnform.txtMM.value))
		    {
		    alert("Please enter correct birth month eg:04 for April");
		    document.applnform.txtMM.focus();
		    return false;
		    }
    			
	    if(document.applnform.txtMM.value<1 || document.applnform.txtMM.value>12 )
		    {
		    alert("Please enter correct birth month eg:04 for April");
		    document.applnform.txtMM.focus();
		    return false;
		    }
    				  
	    if(document.applnform.txtMM.value.length<2 || document.applnform.txtMM.value.length>2)
		    {
		    alert("Please enter correct 2 digit birth month eg:04 for April");
		    document.applnform.txtMM.focus();
		    return false;
		    }
    		
    		    		   		
       if(document.applnform.txtYY.value=="")
		    {
		    alert("Please enter correct birth year eg:1983");
		    document.applnform.txtYY.focus();
		    return false;
		    }
	    if(isNaN(document.applnform.txtYY.value))
		    {
		    alert("Please enter correct birth year eg:1983");
		    document.applnform.txtYY.focus();
		    return false;
		    }


	    if(document.applnform.txtYY.value<1900 || document.applnform.txtYY.value>2006)
		    {
		    alert("Please enter correct birth year eg:1983");
		    document.applnform.txtYY.focus();
		    return false;
		    }
    				  
	    if(document.applnform.txtYY.value.length<4 ||document.applnform.txtYY.value.length>4)
		    {
		    alert("Please enter correct 4 digit birth year eg:1983");
		    document.applnform.txtYY.focus();
		    return false;
		    }
    		
				
  			  
	/*   if(document.applnform.txtImgName.value=="" || document.applnform.txtImgName.value=="./images/yourphoto.jpg")
		    {
		    alert("Please Upload a photo");
		    document.applnform.txtCandPhoto.focus();
		    return false;
		    } */
    		
  
  
  
  
  
    //address
     
        if(document.applnform.txtaddress1.value == "")
      {
      alert("You must enter address.");
      document.applnform.txtaddress1.focus();
      return false;
      }
      
      if(document.applnform.txtaddress1.value.length >40)
      {
      alert("Your address should be less than 40 characters.");
      document.applnform.txtaddress1.focus();
      return false;
      }
    
      if(document.applnform.txtaddress2.value.length >40)
      {
      alert("Your address should be less than 40 characters.");
      document.applnform.txtaddress2.focus();
      return false;
      }
      if(document.applnform.txtaddress3.value.length >40)
      {
      alert("Your address should be less than 40 characters.");
      document.applnform.txtaddress3.focus();
      return false;
      }

	if(document.applnform.strcity1.value =="")
      {
      alert("Your must enter city.");
      document.applnform.strcity1.focus();
      return false;
      }

     /* if(document.applnform.txtaddress4.value.length >35)
      {
       alert("Your address should be less than 35 characters.");
      document.applnform.txtaddress4.focus();
      return false;
      }
        if(document.applnform.txtaddress5.value.length >35)
      {
      alert("Your address should be less than 35 characters.");
      document.applnform.txtaddress5.focus();
      return false;
      }
      */
            
       if(document.applnform.txtPIN1.value == "")
      {
      alert("You must enter PIN code.");
      document.applnform.txtPIN1.focus();
      return false;
      }
      
      if(isNaN(document.applnform.txtPIN1.value))
		{
		alert("Please enter correct PIN code");
		document.applnform.txtPIN1.focus();
		return false;
		}
      
      if(document.applnform.txtPIN1.value.length<6 ||document.applnform.txtPIN1.value.length>6)
		{
		alert("Please enter correct 6 digit PIN code");
		document.applnform.txtPIN1.focus();
		return false;
		}
        

//added by sami

/*      if(document.applnform.txtsslc1.value.length<0 ||document.applnform.txtsslc1.value=="")
		{
		alert("Please enter correct year of SSLC");
		document.applnform.txtsslc1.focus();
		return false;
		}

      if(document.applnform.txtsslc2.value.length<0 ||document.applnform.txtsslc2.value=="")
		{
		alert("Please enter correct total marks obtained");
		document.applnform.txtsslc2.focus();
		return false;
		}

      if(document.applnform.txtsslc3.value.length<0 ||document.applnform.txtsslc3.value=="")
		{
		alert("Please enter correct total marks");
		document.applnform.txtsslc3.focus();
		return false;
		}

		*/
// end 

      if(document.applnform.strdistrict.value == "")
      {
      alert("You must enter the District.");
      document.applnform.strdistrict.focus();
      return false;
      }
      

	if(document.applnform.strstate1.value == "")
      {
      alert("You must enter the State.");
      document.applnform.strstate1.focus();
      return false;
      }
      
      if(document.applnform.txtEmail.value == "")
      {
      alert("You must enter your Email.");
      document.applnform.txtEmail.focus();
      return false;
      }
      
      if(document.applnform.txtEmail.value.indexOf("@") == -1 || document.applnform.txtEmail.value.indexOf(".") == -1)
		{
		alert("E-mail address must include an @ symbol and a (.) symbol!");
		document.applnform.txtEmail.focus();
		return false;
		}
      
           
           if(document.applnform.txtStdCode.value=="")
          {
          alert("You must enter STD code.");
          document.applnform.txtStdCode.focus();
          return false;
          }
          
          if(isNaN(document.applnform.txtStdCode.value))
		    {
		    alert("Please enter correct STD code");
		    document.applnform.txtStdCode.focus();
		    return false;
		    }
          
          if(document.applnform.txtStdCode.value.length<2 || document.applnform.txtStdCode.value.length>6)
		    {
		    alert("Please enter correct digit STD code");
		    document.applnform.txtStdCode.focus();
		    return false;
		    }
                
    if(document.applnform.txtPhone.value == "")
          {
          alert("You must enter Telephone No.");
          document.applnform.txtPhone.focus();
          return false;
          }
          
          if(isNaN(document.applnform.txtPhone.value))
		    {
		    alert("Please enter correct Telephone No");
		    document.applnform.txtPhone.focus();
		    return false;
		    }

 	if(document.applnform.txtMobile.value.length=="")
		    {
		    alert("Please enter correct Mobile No. less than 11 digits");
		    document.applnform.txtMobile.focus();
		    return false;
		    }
	
	//document.applnform.cmbOccupation.focus();  


  //  	    if(document.applnform.cmbOccupation.options[document.applnform.cmbOccupation.selectedIndex].value=="")
		    if(document.applnform.cmbOccupation.selectedIndex==0)
		   {
		   alert("You must select Choice of centre.");
		   document.applnform.cmbOccupation.focus();
		    return false;
		  }


    if (document.applnform.txtDDNo.value=="")
		    {
			    alert("You must enter D.D.No.");
    			
			    document.applnform.txtDDNo.focus();
			    return false;
		    }
    		
		     if(document.applnform.txtDDNo.value.length>8)
		    {
		    alert("Please enter the correct D.D.No.");
		    document.applnform.txtDDNo.focus();
		    return false;
		    } 

   if(document.applnform.txtDDDD.value=="")
		    {
	 	    alert("Please enter correct D.D.No. date");
	 	    document.applnform.txtDDDD.focus();
	 	    return false;
	 	    }

	     if(isNaN(document.applnform.txtDDDD.value))
 		    {
 		    alert("Please enter correct D.D.No. date");
 		    document.applnform.txtDDDD.focus();
 		    return false;
 		    }
     if(document.applnform.txtDDDD.value<1 ||document.applnform.txtDDDD.value>31 )
	 	    {
	 	    alert("Please enter correct D.D.No. date");
	 	    document.applnform.txtDDDD.focus();
	 	    return false;
	 	    }

     if(document.applnform.txtDDDD.value.length<2)
	 	    {
	 	    alert("Please enter correct D.D.No. date e.g:01");
	 	    document.applnform.txtDDDD.focus();
	 	    return false;
	 	    }

     if(document.applnform.txtDDMM.value=="")
 		    {
 		    alert("Please enter correct D.D.No. month");
 		    document.applnform.txtDDMM.focus();
 		    return false;
 		    }
 
 	    if(isNaN(document.applnform.txtDDMM.value))
 		    {
 		    alert("Please enter correct D.D.No. month");
 		    document.applnform.txtDDMM.focus();
 		    return false;
 		    }
     			
	     if(document.applnform.txtDDMM.value<1 || document.applnform.txtDDMM.value>12 )
	 	    {
	 	    alert("Please enter correct D.D.No. month");
	 	    document.applnform.txtDDMM.focus();
	 	    return false;
	 	    }
	 	    if(document.applnform.txtDDMM.value.length<2)
	 	    {
	 	    alert("Please enter correct D.D.No. month e.g:01 for January");
	 	    document.applnform.txtDDMM.focus();
	 	    return false;
	 	    }

   if(document.applnform.txtDDYY.value=="")
		    {
		    alert("Please enter correct D.D. year");
		    document.applnform.txtDDYY.focus();
		    return false;
		    }
	    if(isNaN(document.applnform.txtDDYY.value))
		    {
		    alert("Please enter correct D.D year");
		    document.applnform.txtDDYY.focus();
		    return false;
		   } 


	  if(document.applnform.txtDDYY.value<2009 || applnform.txtDDYY.value>2010)
		    {
		    alert("Please enter correct D.D. year between 2009 and 2010");
		    document.applnform.txtDDYY.focus();
		    return false;
		    }
		   
		 if(document.applnform.txtDDYY.value.length<4)
		    {
		    alert("Please enter correct D.D. year e.g:2009 / 2010 ");
		    document.applnform.txtDDYY.focus();
		    return false;
		    }


if(document.applnform.txtBank.value=="")
			{
		    alert("Please enter Name of the Drawee Bank");
		    document.applnform.txtBank.focus();
		    return false;
		    }
    		
		    if(document.applnform.txtBank.value.length>40)
		    {
	    		alert("Please enter Name of the Drawee Bank less than 40 characters");
		    document.applnform.txtBank.focus();
		    return false;
		    }
		

		if(document.applnform.txtUni.value=="")
		    {
	    		alert("Please enter Name of the University");
		    document.applnform.txtUni.focus();
		    return false;
		    }

	if(document.applnform.txtCollege.value=="")
		    {
	    		alert("Please enter Name of the College");
		    document.applnform.txtCollege.focus();
		    return false;
		    }


		if(document.applnform.txtPassMM.value=="")
		    {
	    	    alert("Please enter month of Passing");
		    document.applnform.txtPassMM.focus();
		    return false;
		    }
		
		if(document.applnform.txtPassYY.value=="")
		    {
	    	    alert("Please enter year of passing");
		    document.applnform.txtPassYY.focus();
		    return false;
		    }

		if(document.applnform.txtPassMM1.value=="")
		    {
	    	    alert("Please enter year of passing");
		    document.applnform.txtPassMM1.focus();
		    return false;
		    }

		if(document.applnform.txtPassYY1.value=="")
		    {
	    	    alert("Please enter year of passing");
		    document.applnform.txtPassYY1.focus();
		    return false;
		    }

    		
	       var answer = confirm("Are you sure to submit the form ? ")
		if (answer){
		
		document.applnform.action="pgaiettenform.asp?Mode=N";
 	        document.applnform.submit();	
		}
		else
		{
		alert("Fill in all the required fields");
		document.applnform.txsslc1.focus();
		return false;
		}       
      } 
      
      
      function Trim(Strvalue)
			{
				while(''+Strvalue.charAt(0)==' ')
				Strvalue=Strvalue.substring(1,Strvalue.length)
				
				while(''+Strvalue.charAt(Strvalue.length-1)==' ')
				Strvalue=Strvalue.substring(0,Strvalue.length-1)
				
				return Strvalue
			}