// JavaScript Document
<!--

//var arr0=new Array('Hindu','Christian','Muslim','Buddhist','Sikh','Parsi','Jain','Others')
var arr0=new Array('Christian','Muslim','Neo Buddhist','Sikh','Zoroastrian')
var arr1=new Array('B E','B Tech','B sc(Engg)','Others')
var arr2=new Array('Computer Science & Engg.','Information Technology','Electrical','Electrical & Electronics','Electrical, Inst & Control','High Voltage Engg.','Power Sys. & High Voltage','Electrical Machine','Electronics','Electronics & Telecomm.','Instrumentation','Electronics & Instn.','Electronics & Power','Electronics Design & Tech','Applied Electronics','Power Electronics','Electronics & Communication','Mechanical','Production Engg.','Production & Indl. Engg.','Power Plant Engg.','Mech. Prodn. & Tool Engg.','Thermal Engg.','Prodn. Tech. Manufg. Engg.','Industrial & Prodn. Engg.','Others')
var arr3=new Array('M E','M Tech','M S','M sc(Engg)','MBA','Others')
var arr4=new Array('Mechanical','Electrical','Electronics','Computer Science')
var arr5=new Array('IIT','NIT/REC','Others')

function ValidData()
{

var names=new Array(101)
names[0]="Discipline of Engg."
names[1]="Written Test Centre "

names[2]="Name"
names[3]="Date of birth"
names[4]="Gender"
names[5]="Marital Status"
names[6]="" // removed spouse name
names[7]="Father's Name"

names[8]="Nationality"
names[9]="Category"
names[10]="Minority Community (if applicable) else Select Not Applicable"
names[11]="whether Ex-Serviceman or Not"
names[12]="Service Period"
names[13]="whether Physically Challenged or Not"
names[14]="% of Locomotor disablility or loss of Hearing in decibels"
names[15]="whether domiciled in J and K between 01/01/1980 to 31/12/1989"


names[16]="Email id"
names[17]="Retyped Email id"
names[18]="Mobile No."
names[19]="Alternate Phone No."




names[20]="Address for Correspondence Line 1 "
names[21]="Address for Correspondence Line 2 "
names[22]="Address for Correspondence Line 3 "
names[23]="Address for Correspondence Line 4 "
names[24]="State"
names[25]="Country"
names[26]="Pin Code"

names[27]="checkbox copy"

names[28]=" Permanent Address Line 1 "
names[29]="Permanent Address  Line 2 "
names[30]="Permanent Address  Line 3 "
names[31]="Permanent Address  Line 4 "
names[32]="State"
names[33]="Country"
names[34]="Pin Code"



///
names[35]="Graduation Degree"
names[36]="Graduation Discipline"
// to be removed...  
//names[25]="Graduation 'From Month'"
//names[26]="Graduation 'From Year'"
//names[27]="Graduation 'To Month'"
//names[28]="Graduation 'To Year'"
// removed on 13-Aug-2009
names[37]="Graduation 'Pass Month'"
names[38]="Graduation 'Pass Year'"
names[39]="Graduation Course Type"
names[40]=""
names[41]=""
names[42]=""
names[43]=""
names[44]=""
names[45]=""
names[46]=""
names[47]=""
names[48]=""
names[49]=""
names[50]=""
names[51]=""
names[52]=""


names[53]="Graduation Institute/College"
names[54]="Graduation Institute/College (Others)"
names[55]="Graduation Universtity Name"
names[56]="Graduation Universtity Type"







	
	for (i=0;i<=1;i++)
	{
			if (document.forms[0].elements[i].selectedIndex==0)
			{
			alert("Please Select "+names[i])
			document.forms[0].elements[i].focus()
			return false
			}
	}
  
  



	
	
	
	for (i=2;i<34;i++)
	{
			if ( i==4 || i==5 || i==8 || i==9 || i==10 || i==11 || i==13 || i==15 ) 
			{
				if (document.forms[0].elements[i].selectedIndex==0)
				{
				alert("Please Select "+names[i])
				document.forms[0].elements[i].focus()
				return false
				}
					
			}
			else
			{
								if (i==22 || i==23|| i==30|| i==31|| i==27|| i==12|| i==14|| i==6||i==19)
							{
							} else{
								if (document.forms[0].elements[i].value=="")
								{
								alert("Please Enter your "+names[i])
								document.forms[0].elements[i].focus()
								return false
								}
							}
			}
	}

  
if (document.forms[0].elements[18].value.length<10)
	{
		alert("Please Enter correct Mobile no.")
		document.forms[0].elements[18].focus()
		return false
	}


  
			if (document.forms[0].elements[11].selectedIndex==0)
			{
				alert("Please Select exserv "+names[11])
				document.forms[0].elements[11].focus()
				return false
			}
			if ( document.forms[0].elements[11].selectedIndex==1 && document.forms[0].elements[12].value=="")
			{
				alert("Please Enter  "+names[12])
				document.forms[0].elements[12].focus()
				return false
			}

			if (document.forms[0].elements[13].selectedIndex==0)
			{
				alert("Please Select "+names[13])
				document.forms[0].elements[13].focus()
				return false
			}
			if ( document.forms[0].elements[13].selectedIndex>1 && document.forms[0].elements[14].value=="")
			{
				alert("Please Enter "+names[14])
				document.forms[0].elements[14].focus()
				return false
			}
			if (document.forms[0].elements[15].selectedIndex==0)
			{
				alert("Please Select "+names[15])
				document.forms[0].elements[15].focus()
				return false
			}
			for (i=35;i<=39;i++)
			{
				if (document.forms[0].elements[i].selectedIndex==0)
				{
				alert("Please Select "+names[i])
				document.forms[0].elements[i].focus()
				return false
				}
			
			}

			////// degree marks


/*

		if (document.forms[0].elements[13].value.length<6)
	{
		alert("Please Enter correct Pin Code")
		document.forms[0].elements[13].focus()
		return false
	}

	if (document.forms[0].elements[14].value.length<11)
	{
		alert("Please Enter correct phone no. with STD code")
		document.forms[0].elements[14].focus()
		return false
	}
/////bhara   
//alert ("test "+document.forms[0].phoneno.value.substr(0,1))
	if (document.forms[0].phoneno.value.substr(0,1)!="0")
	{

		alert("Please Enter correct phone no. with STD code starting from 0")
		document.forms[0].phoneno.focus()
		return false
	}
///   bharat 


	if (document.forms[0].elements[18].selectedIndex==0)
	{
		alert("Please Select exserv "+names[18])
		document.forms[0].elements[18].focus()
		return false
	}
	if ( document.forms[0].elements[18].selectedIndex==1 && document.forms[0].elements[19].value=="")
	{
		alert("Please Enter  "+names[19])
		document.forms[0].elements[19].focus()
		return false
	}

	if (document.forms[0].elements[20].selectedIndex==0)
	{
		alert("Please Select "+names[20])
		document.forms[0].elements[20].focus()
		return false
	}
	if ( document.forms[0].elements[20].selectedIndex>1 && document.forms[0].elements[21].value=="")
	{
		alert("Please Enter "+names[21])
		document.forms[0].elements[21].focus()
		return false
	}
    if (document.forms[0].elements[22].selectedIndex==0)
	{
		alert("Please Select "+names[22])
		document.forms[0].elements[22].focus()
		return false
	}
	for (i=23;i<=27;i++)
	{
		if (document.forms[0].elements[i].selectedIndex==0)
		{
		alert("Please Select "+names[i])
		document.forms[0].elements[i].focus()
		return false
		}
	
	}
	*/
/*
	if (document.forms[0].elements[28].value<document.forms[0].elements[26].value)
	{
		alert("Kindly check Duration")
		document.forms[0].elements[28].focus()
		return false
		
	}
    
	if (document.forms[0].elements[30].value<document.forms[0].elements[26].value)
	{
		alert("Kindly check Duration")
		document.forms[0].elements[30].focus()
		return false
		
	}*/




////
	if (document.forms[0].ug.selectedIndex==5 || document.forms[0].ug.selectedIndex==6) /// for diploma+3 years engg Bsc+ 3years
	{
		for (i=42;i<=47;i++) // 2nd year to 4th year
		{
			  // alert(" test "+document.forms[0].exserv.value);
						if (document.forms[0].exserv.value=="N")
						{
						
									if (document.forms[0].elements[i].value==0)
									{
									alert("Please Enter Correct Marks")
									document.forms[0].elements[i].focus()
									return false
									}
						} // for not exservice men only
		}
		
	}
    
	if ((document.forms[0].ug.selectedIndex==4) || (document.forms[0].ug.selectedIndex==8))
	{
		for (i=40;i<=49;i++)
		{
						if (document.forms[0].exserv.value=="N")
						{
									if (document.forms[0].elements[i].value==0)
								{
								alert("Please Enter Correct Marks")
								document.forms[0].elements[i].focus()
								return false
								}
								} // for not exservice men only


		}
		
	}
   
   if ((document.forms[0].ug.selectedIndex<4))
	{
		for (i=40;i<=47;i++)
		{
			if (document.forms[0].exserv.value=="N")
						{
									if (document.forms[0].elements[i].value==0)
								{
								alert("Please Enter Correct Marks")
								document.forms[0].elements[i].focus()
								return false
								}

								} // for not exservice men only

		}
		
	}


	if ((document.forms[0].ug.selectedIndex==7) || (document.forms[0].ug.selectedIndex==9))
	{
		for (i=40;i<=43;i++)
		{
			if (document.forms[0].exserv.value=="N")
						{
									if (document.forms[0].elements[i].value==0)
								{
								alert("Please Enter Correct Marks")
								document.forms[0].elements[i].focus()
								return false
								}


								} // for not exservice men only

		}
		
	}


	for (i=40;i<=49;i++)
	{
		if (document.forms[0].elements[i].value<0)
		{
		alert("Please Enter Correct Marks ")
		document.forms[0].elements[i].focus()
		return false
		}
	
	}

	
    
	if (document.forms[0].uginstitute.selectedIndex==0)
				{
				alert("Please Select "+names[53])
				document.forms[0].uginstitute.focus()
				return false
				}
	if ( (document.forms[0].uginstitute.value=="Others") && (document.forms[0].ug_inst_other.value=="") )
				{
				alert("Please Enter "+names[54])
				document.forms[0].ug_inst_other.focus()
				return false
				}
	
	if (document.forms[0].uguniversity.value=="")
				{
				alert("Please Enter Graduation Universtity Name")
				document.forms[0].uguniversity.focus()
				return false
				}

	if (document.forms[0].uguniv.selectedIndex==0)
				{
				alert("Please Select Graduation Degree Universtity Type")
				document.forms[0].uguniv.focus()
				return false
				}

    
if (document.forms[0].pg.selectedIndex>0)
				{

	  
    
	if ( (document.forms[0].pg.value=="Others") && (document.forms[0].pgothers.value=="") )
				{
				alert("Please Enter PG Degree Others")
				document.forms[0].pgothers.focus()
				return false
				}

				if (document.forms[0].pgbranch.selectedIndex==0)
				{
				alert("Please Select PG Branch")
				document.forms[0].pgbranch.focus()
				return false
				}
	        if ( (document.forms[0].pgbranch.value=="Others") && (document.forms[0].pgbranchothers.value=="") )
				{
				alert("Please Select PG Branch Others ")
				document.forms[0].pgbranchothers.focus()
				return false
				}


				if (document.forms[0].pgpassmm.selectedIndex==0)
				{
				alert("Please Select PG Pass Month")
				document.forms[0].pgpassmm.focus()
				return false
				}

				if (document.forms[0].pgpassyy.selectedIndex==0)
				{
				alert("Please Select PG Pass Year")
				document.forms[0].pgpassyy.focus()
				return false
				}

				if (document.forms[0].pgtype.selectedIndex==0)
				{
				alert("Please Select PG Course Type")
				document.forms[0].pgtype.focus()
				return false
				}
				

					 if (document.forms[0].pgpercmark.value<0 ||document.forms[0].pgpercmark.value>100 )
						{
						alert("Please Enter Correct PG Marks ")
						document.forms[0].pgpercmark.focus()
						return false
						}


           if (document.forms[0].pginstitute.value=="")
				{
				alert("Please Enter PG Institute Name")
				document.forms[0].pginstitute.focus()
				return false
				}

				if (document.forms[0].pguniversity.value=="")
				{
				alert("Please Enter PG Universtity Name")
				document.forms[0].pguniversity.focus()
				return false
				}
				




				}



		//
		/*
			if ( document.forms[0].elements[18].selectedIndex>1 )
			{
				for (i=67;i<=70;i++)
				{
					if (document.forms[0].elements[i].value=="")
					{
					alert("Please Enter your "+names[i])
					document.forms[0].elements[i].focus()
					return false
					}
				}
			}
			*/

    /*  if (chckOBC(document.form1.catcertdate)==false)
		{
		return false
		}
		
		if (chckphch(document.form1.phcertdate)==false)
		{
		return false
		}*/


			/* if ( document.forms[0].elements[22].selectedIndex>1 )
			{
				for (i=71;i<=74;i++)
				{
					if (document.forms[0].elements[i].value=="")
					{
					alert("Please Enter your "+names[i])
					document.forms[0].elements[i].focus()
					return false
					}
				}
			} */
			if ( document.forms[0].bhelemp.selectedIndex==0 )
			{
			alert("Whether BHEL Employee?")
			document.forms[0].bhelemp.focus()
			return false
			}
			///// one added for  designation...and becomes 66


			if ( document.forms[0].bhelemp.selectedIndex==1 )
			{
				    if (document.forms[0].empdesig.value=="" )
					{
					alert("Please Enter your current BHEL Designation Correctly");
					document.forms[0].empdesig.focus()
					return false
					}

					if (document.forms[0].empstaffno.value=="" || document.forms[0].empstaffno.value.length<7)
					{
					alert("Please Enter your current BHEL Staff Number Correctly");
					document.forms[0].empstaffno.focus()
					return false
					}
					if (document.forms[0].empunit.selectedIndex==0)
					{
					alert("Please Select your current BHEL Unit/Division");
					document.forms[0].empunit.focus()
					return false
					}
			}
			
			if ( document.forms[0].ward.selectedIndex==0 )
			{
			alert("Is/was your parent/spouse a serving/retired/deceased/resigned/removed BHEL employee?")
			document.forms[0].ward.focus()
			return false
			}
			if ( (document.forms[0].ward.selectedIndex>0) && (document.forms[0].ward.selectedIndex!=6) )
			{
			if (document.forms[0].parentstaffno.value=="" || document.forms[0].parentstaffno.value.length<7)
			{
			alert("Please Enter your parent's BHEL Correct Staff Number");
			document.forms[0].parentstaffno.focus()
			return false
			}
			if (document.forms[0].parentunit.selectedIndex==0)
			{
			alert("Please Select your parent's BHEL Unit/Division");
			document.forms[0].parentunit.focus()
			return false
			}
			}

			/*if ( document.forms[0].elements[24].selectedIndex==1 )
			{
				for (i=81;i<=84;i++)
				{
					if (document.forms[0].elements[i].value=="")
					{
					alert("Please Enter your "+names[i])
					document.forms[0].elements[i].focus()
					return false
					}
				}
			}*/
			if ( document.forms[0].psuemp.selectedIndex==0 )
					{
					alert("Please Select your current Employment status")
					document.forms[0].psuemp.focus()
					return false
					}
					
// changed on 05 sept for SC ST only 
////if ( (document.forms[0].disabled.selectedIndex==1) && ((document.forms[0].category.selectedIndex==1) || (document.forms[0].category.selectedIndex==4)) )
/*	if ( (document.forms[0].disabled.selectedIndex==1) && ((document.forms[0].category.selectedIndex==1) || (document.forms[0].category.selectedIndex==4)) )
			
			{
				if (document.forms[0].ddno.value=="")
				{
				alert("Please Enter your  Challan Journal  Number");
				document.forms[0].ddno.focus()
				return false
				}
				if (document.forms[0].dddate.value=="")
				{
				alert("Please Enter your Challan  Date");
				document.forms[0].dddate.focus()
				return false
				}

			    /*if (parseInt(document.forms[0].dddate.value.substring(3,5))<8 || parseInt(document.forms[0].dddate.value.substring(3,5))>9)
				{
				alert("Challan Date month should be of August / September");
				document.forms[0].dddate.value="";

				document.forms[0].dddate.focus()
				return false
				} /

				if (parseInt(document.forms[0].dddate.value.substring(6,10))<2011 || parseInt(document.forms[0].dddate.value.substring(6,10))>2011)
				{
				alert("Challan Date year should be of 2011");
				document.forms[0].dddate.value="";
				document.forms[0].dddate.focus()
				return false
				}
				/*if (document.forms[0].elements[76].selectedIndex==0)
				{
				alert("Please select your Demand Draft Drawee bank");
				document.forms[0].elements[76].focus()
				return false
				}/

				if (document.forms[0].bankname.value=="")
				{
				alert("Please Enter Bank's Branch Name");
				document.forms[0].bankname.focus()
				return false
				}
					
 ///////
/*
    if (document.forms[0].pref1.value!="NA")
     {
		  if (checkpref()==false)
			  retrun false
     }
	
 //////


				
			}


			*/

			if (document.forms[0].pref1.value!="NA")
				 {
					//alert("hello "+document.forms[0].pref1.value);
					 var temp;
									for(i=2;i<=5 ;i++ ){  
									    temp="pref"+i;
												if (document.getElementById(temp).value=="NA")
												{
												alert('Please select preference of posting')
												document.getElementById(temp).focus()
												return false
												}
												
								}
						
						}  

	/*	if(!document.forms[0].accept.checked)
		{
		alert ('Kindly Accept the decalaration')
		document.forms[0].accept.focus()
		return false
		}	
		*/
		temp="accept";
	if(!document.getElementById(temp).checked)
		{
		alert ('Kindly Accept the decalaration')
		document.getElementById(temp).focus()
		return false
		}
		
//alert(document.forms[0].elements[88].name);
//alert(document.forms[0].elements[89].name);
//alert(document.forms[0].elements[90].name);
//alert(document.forms[0].elements[22].name);
//return false
//Datediff()

//return checkdob(document.forms[0].elements[4].value,document.forms[0].elements[16].selectedIndex,document.forms[0].elements[18].selectedIndex,document.forms[0].elements[19].value,document.forms[0].elements[20].selectedIndex,document.forms[0].elements[21].value)
return checkdob(document.forms[0].dtbirth.value,document.forms[0].category.selectedIndex,document.forms[0].exserv.selectedIndex,document.forms[0].yrexserv.value,document.forms[0].disabled.selectedIndex,document.forms[0].perdisabled.value)
//return false

//return false
}








function EmailValid(X)
{
    
	var checkStr = X.value;
	//alert(checkStr+"test")
		if (checkStr=="")
		{
		alert("Empty Email ID")
		  X.value=""
	 	X.focus()
		}
    i=checkStr.indexOf("@")
    if(i!=-1)
      j=checkStr.indexOf(".",i)
    if(i==-1 || j == -1)
    {
      alert("Email ID is Invalid")
		  X.value=""
	 	X.focus()
      return false
    }  
    else
	{
     mailwarn()
	  //return true
	}
}


function getyear(X)
{
	var s=document.forms[0].elements[X].value
	var dd=s.substring(0,2)
	var slash1=s.substring(2,3)
	var mm=s.substring(3,5)
   	var slash2=s.substring(5,6)
	var yy=s.substring(6,10)
	return yy
}

function getyear_fname(obj)
{
	//var s=document.forms[0].X.value
	var s=obj.value
	var dd=s.substring(0,2)
	var slash1=s.substring(2,3)
	var mm=s.substring(3,5)
   	var slash2=s.substring(5,6)
	var yy=s.substring(6,10)
	return yy
}
function CheckDate(X,field_name)
{
	var s=document.forms[0].elements[X].value
	var dd=s.substring(0,2)
	var slash1=s.substring(2,3)
	var mm=s.substring(3,5)
   	var slash2=s.substring(5,6)
	var yy=s.substring(6,10)
   	      
      if (s.length != 10 || slash1 !="/" || slash2!="/")
      {
       		alert("Please enter "+field_name+" as dd/mm/yyyy")
        	document.forms[0].elements[X].focus()
			return false
      }
      else if((NumCheck(X,field_name,dd)==false) || (NumCheck(X,field_name,mm)==false) || (NumCheck(X,field_name,yy)==false))
      {
      		return false
      }
      else if((yy>1986 || yy <1944)&& X==4 )
	  {
	  		alert("Please check the year of birth")
			document.forms[0].elements[X].focus()
			return false		
	  }
	  else if(X==92 &&!(yy ==2005 || yy==2006))
	  {
	  		alert("Please check the year of "+field_name)
			document.forms[0].elements[X].focus()
			return false		
	  }
	  else if(yy>2005)
	  {
	  		alert("Please check the year of "+field_name)
			document.forms[0].elements[X].focus()
			return false		
	  }
	  else if(yy<=0)
	  {
	  		alert("Please check the year of "+field_name)
			document.forms[0].elements[X].focus()
			return false				
	  }
	   else if(dd < 1)
	  {
	  		alert(field_name+": Date should not be less than 01")
			document.forms[0].elements[X].focus()
			return false		
	  }
      else if (mm <1 || mm>12)
      {
	       alert(field_name+": Invalid month")
			document.forms[0].elements[X].focus()
			return false
      }
      else if (dd>31)
      {
         	alert(field_name+": Invalid date")
			document.forms[0].elements[X].focus()
			return false
      }
      else if (mm==4 || mm==6 || mm==9 || mm==11)
      {
          if (dd >30)
          { 
            	alert(field_name+": Invalid date")
				document.forms[0].elements[X].focus()
				return false
          }
          
      }
	  else if (mm==2)
	  {
	      if ( (yy % 4) == 0)
	      {
	          if (dd > 29)
	          {
                 alert(field_name+": Invalid date")
					document.forms[0].elements[X].focus()
					return false
              }

	       }
           else if(dd > 28)
           {
	   			alert(field_name+": Invalid date");
				document.forms[0].elements[X].focus();
				return false
           }
       }
      
}
function NumCheck(X,field_name,val)
        {
		 NumStr=val;
        for (var i=0;i<NumStr.length;i++)
                {
                if(isNaN(NumStr.charAt(i)))
                        {
                        alert("Please check "+field_name+"  must be a number!")
                        document.forms[0].elements[X].focus()
                        return false
                        }
                }
        return true
        }
        
function checkit(event)
{
  var charcode=event.keyCode
  if(charcode >31 && (charcode <48 || charcode>57)) 
  {
        return false
  }
  return true
}
function staffnochk(no)
{
	if(NumCheck(no,'Staffno',document.forms[0].elements[no].value)==true)
	{
		if(document.forms[0].elements[no].value.length==7)
		{
			var count=1;
			var tot=0;
			for(i=7;i>0;i--)
			{
				tot += count*( parseInt(document.forms[0].elements[no].value.substring(i-1,i)));
				count++;
			}   
	 
	 		var ch=tot/11;
			var ch1=Math.round(ch);
			if(ch!=ch1 || document.forms[0].elements[no].value==0)
			{
				alert('invalid Staffno');
				document.forms[0].elements[no].focus();
				return false;
			}
			
	 			
		}
		else
		{
			alert('Please Enter 7 Digits in Staff no.');
			document.forms[0].elements[no].focus();
			return false;
		}
	}
	else
			return false;
	

}

function inpchk(event,nm)
{
  var charcode=event.keyCode
  if(charcode >31 && (charcode <48 || charcode>57) && charcode!=46 ) 
  {
  		var nam="document.forms[0]."+nm;
		this.value="RA"
       return false
	}
  return true

}

function markchk(no,val)
{
if(document.forms[0].elements[no].value==parseFloat(document.forms[0].elements[no].value))
{
	if(document.forms[0].elements[no].value>100 || 0 >=document.forms[0].elements[no].value )
	{
		alert("Please Enter Valid "+val)
		document.forms[0].elements[no].focus()
		return false
	}
}
else if(document.forms[0].elements[no].value!="RA")
{
	alert("Please Enter Only numeric (or) RA ")
	document.forms[0].elements[no].focus()
	return false
}
else if(document.forms[0].elements[no].value=="RA" && ( /*(no==34 && document.forms[0].elements[no-2].selectedIndex>2)||*/(no==69 && document.forms[0].elements[no-2].selectedIndex>3)))
{
	alert("Please Enter Valid "+val)
	document.forms[0].elements[no].focus()
	return false
}
}
function othchk(n1,n2,n3)
{
	if(document.forms[0].elements[n1-1].selectedIndex!=n2 && n3==0)
	{
		document.forms[0].elements[n1].value=""
		document.forms[0].elements[n1+1].focus()
	}
	else if(!(document.forms[0].elements[n1-1].selectedIndex>=n2) && n3==1)
	{
		document.forms[0].elements[n1].value=""
		document.forms[0].elements[n1+1].focus()
	}
	else if(!(document.forms[0].elements[n1-1].selectedIndex!=n2) && n3==2)
	{
		document.forms[0].elements[n1].value=""
		document.forms[0].elements[n1+2].focus()
	}
		 
}


function othchk1(n1,n2,n3)
{
	//alert(document.forms[0].elements[44].name)
if((document.forms[0].elements[n1].selectedIndex!=4)&&(document.forms[0].elements[n1].selectedIndex!=7))
	{
		
	if(document.forms[0].elements[n1].selectedIndex<4 && n2==42)
		{
		document.forms[0].elements[n2].value="0"
		document.forms[0].elements[n2+1].value="0"
		document.forms[0].elements[n3].focus()
		}
	else if(document.forms[0].elements[n1].selectedIndex==5 && n2==42)
		{
		document.forms[0].elements[n2].value="0"
		document.forms[0].elements[n2+1].value="0"
		document.forms[0].elements[n3].focus()
		}
	else if(document.forms[0].elements[n1].selectedIndex==6 && n2==38)
		{
		for (i=0;i<6;i+=2)
		{
		document.forms[0].elements[n2+i].value="0"
		document.forms[0].elements[n2+1+i].value="0"
		}
		document.forms[0].elements[n3].focus()
		}
	else if(document.forms[0].elements[n1].selectedIndex==5 && n2==34)
		{
		document.forms[0].elements[n2].value="0"
		document.forms[0].elements[n2+1].value="0"
		document.forms[0].elements[n3].focus()
		}
	}
}

function valchk(ar,mes,ee)
{
	dt1=document.forms[0].elements[ee].value
	dt2=document.forms[0].elements[ar].value
	
	dd=dt1.substring(0,2)
	mm=dt1.substring(3,5)
	yy=dt1.substring(6,10)
	
	dd1=dt2.substring(0,2)
	mm1=dt2.substring(3,5)
	yy1=dt2.substring(6,10)
	
	S1=new Date()
	S1.setYear(yy1)
	S1.setMonth(mm1)
	S1.setDate(dd1)
	
	S2=new Date()
	S2.setYear(yy)
	S2.setMonth(mm)
	S2.setDate(dd)
	
	if((S1-S2)<0)
	{ 
		alert('Please check '+mes)
		document.forms[0].elements[ar].focus()
		return false
	}
	
}
function clall(nf,ne,mess,bl,nele)
{
	if(bl==0 && document.forms[0].elements[nf].selectedIndex==ne)
	{
		if(document.forms[0].elements[nele].value!="" || document.forms[0].elements[nele+1].selectedIndex>0)
		{
				alert(mess)
				document.forms[0].elements[nf].focus()
				return false
		}
	}
	else if(bl==1 && document.forms[0].elements[nf].selectedIndex<ne && document.forms[0].elements[nele].value!="")
	{
		alert('In '+mess+' you have entered both '+document.forms[0].elements[nf].options[document.forms[0].elements[nf].selectedIndex].value+' and '+document.forms[0].elements[nele].value+'. Please Enter '+mess+' correctly')
		document.forms[0].elements[nf].focus()
		return false
	}
	else if(bl==1 && document.forms[0].elements[nf].selectedIndex==ne && document.forms[0].elements[nele].value=="")
	{
		alert('In '+mess+' you have selected other ,other value is blank Please Enter correctly')
		document.forms[0].elements[nele].focus()
		return false
	}
	else if(bl==2 && document.forms[0].elements[nf].selectedIndex==ne && document.forms[0].elements[nele].value!="")
	{
//		alert('In '+mess+' you have entered both '+document.forms[0].elements[nf].value+' and '+document.forms[0].elements[nele].value+'. Please Enter '+mess+' correctly')
	alert(mess)
		document.forms[0].elements[nf].focus()
		return false
	}
}



////

function bhelempwarn()
{
	//alert ("test "+document.forms[0].bhelemp.value);
	 if (document.forms[0].bhelemp.value=="Y") 
	 {
		
	document.forms[0].empstaffno.disabled=false;
	document.forms[0].empdesig.disabled=false;
	
    document.forms[0].empunit.disabled=false;
	document.forms[0].empstaffno.value=0;
	document.forms[0].empunit.value="";
	document.forms[0].empdesig.value="";
	//alert("If you joined BHEL as Supervisor Trainee after 14th Sept, 2007, you are not eligible to apply.");
	 		return
	}else
	{
	document.forms[0].empstaffno.disabled=true;
	document.forms[0].empdesig.disabled=true;
    document.forms[0].empunit.disabled=true;
	document.forms[0].empstaffno.value=0;
	document.forms[0].empunit.value="";
	document.forms[0].empdesig.value="";
     if (document.forms[0].ug.selectedIndex>6)
     {
		 document.forms[0].ug.selectedIndex=0;
	     alert(" 'AMIE  OR AMIETE  OR B.E. 5 yrs Part Time  are valid for only for BHEL employees'. Select UG degree");
			document.forms[0].ug.focus();

     }
    


	return
	}
	


}

function wardwarn()
{
	//alert ("test "+document.forms[0].ward.value);
	 if (document.forms[0].ward.value=="No") 
	 {
	document.forms[0].parentstaffno.disabled=true;
	
    document.forms[0].parentunit.disabled=true;
	document.forms[0].parentstaffno.value=0;
	document.forms[0].parentunit.value="";
	return
	}else {
		
	document.forms[0].parentstaffno.disabled=false;
	
    document.forms[0].parentunit.disabled=false;
	document.forms[0].parentstaffno.value=0;
	document.forms[0].parentunit.value="";
	 		return
	}
	


}


/////


function catgwarn()
{
	 if (document.forms[0].category.value=="OBC") 
	 {
		
	// alert(' OBC Certificate Issued After 01-Jan-2005 will only be Accepted.Click OK to proceed  ') 
					  alert("Kindly select carefully, category once declared will not be allowed to change at the later date and candidate will have to send the valid category certificate  along with Acknowledgement Slip");
		return enab_ddno();
	 		return true

		 }
	if (document.forms[0].category.value=="") 
	 {
		return enab_ddno();
	 		return true

		 }else{
			 if (document.forms[0].category.value=="Gen") 
			 { 
				 return enab_ddno();
			 }else{

								//  alert("Kindly select carefully, category once declared will not be allowed to change at the later date and candidate will have to send the valid category certificate along with Acknowledgement Slip");
								 // alert("Kindly select carefully, category once declared will not be allowed to change at the later date and candidate will have to send the valid category certificate along with Acknowledgement Slip");
			 return dis_ddno()
			 }

		 }


}

function catgwarn1()
{
	 if (document.forms[0].category.value=="OBC") 
	 {
		
	// alert(' OBC Certificate Issued After 01-Jan-2005 will only be Accepted.Click OK to proceed  ') 
					  alert("Kindly select carefully, category once declared will not be allowed to change at the later date and candidate will have to send the valid category certificate  along with Acknowledgement Slip");
		return enab_ddno1();
	 		return true

		 }
	if (document.forms[0].category.value=="") 
	 {
		return enab_ddno1();
	 		return true

		 }else{
			 if (document.forms[0].category.value=="Gen") 
			 { 
				 return enab_ddno1();
			 }else{

			 				//  alert("Kindly select carefully, category once declared will not be allowed to change at the later date and candidate will have to send the valid category certificate  along with Acknowledgement Slip");
							  return dis_ddno1()
			 }

		 }


}


 function chckOBC(obj)
  {
	  if (document.forms[0].category.value=="OBC")
			{
		  // alert("test date " +obj.value);
			var year=0
			var ddate="" 
				  if ((document.forms[0].catcertdate.value=="")||(document.forms[0].catcertdate.value==null))
				  {
// alert("test 2 date " +obj.value);
				  }else{
						year=getyear_fname(obj);
						if ((year == 2005)||(year == 2006)||(year == 2007))
						{
 //alert("test 3 date " +obj.value);
						} else{
								alert("OBC Certificate date should pertain to 2005 or Above only !")
								document.forms[0].catcertdate.value="";
								document.forms[0].catcertdate.focus();
								return false
						}
				  }

			}
			return true
}

function chckdddate(obj)
  {
	  
			var year=0
			var ddate="" 
				  if ((document.forms[0].dddate.value=="")||(document.forms[0].dddate.value==null))
				  {}
			      else
				  {
						year=getyear_fname(obj);
						//if ((year == 2006)||(year == 2007))
						if (year == 2009)
						{}
						else{
								alert("Challan date should pertain to 2009  only !")
								document.forms[0].dddate.value="";
								document.forms[0].dddate.focus();
								return false
						    }
				  }

			
}

function chkugdur1()
{ 
	//alert("check");
	var chkyear=0;
		var mnth="";
	chkyear=document.forms[0].ugtoyy.value;
	mnth=document.forms[0].ugtomm.value;
	if (chkyear=="")
	{
		 
	
	} else{
	if (document.forms[0].ugtoyy.value<=document.forms[0].ugfromyy.value)
	{
		alert("Kindly Check  Duration of Course. ");
		document.forms[0].ugtoyy.value="";
		document.forms[0].ugtoyy.focus();


	}
	}

}


function chkugdur()
{ 
	//alert("check");
	var chkyear=0;
		var mnth="";
	chkyear=document.forms[0].ugtoyy.value;
	mnth=document.forms[0].ugtomm.value;
	if (chkyear==2011)
	{
		 if (mnth=="SEP"||mnth=="OCT"||mnth=="NOV"||mnth=="DEC")
		 {
			 alert ("Degree Completion after August 2011 -- NOT Allowed");
			 document.forms[0].ugtoyy.value="";
			 document.forms[0].ugtomm.value="";
			 document.forms[0].ugtomm.focus();
		 }
	}

	if (document.forms[0].ugtoyy.value<=document.forms[0].ugfromyy.value)
	{
		alert("Kindly Check  Duration of Course. ");
		document.forms[0].ugtoyy.value="";
		document.forms[0].ugtoyy.focus();


	}

}

function chkugpassdur()
{ 
	//alert("check");
	var chkyear=0;
		var mnth="";
	chkyear=document.forms[0].ugpassyy.value;
	mnth=document.forms[0].ugpassmm.value;
	if (chkyear==2011)
	{
		 if (mnth=="SEP"||mnth=="OCT"||mnth=="NOV"||mnth=="DEC")
		 {
			 alert ("Degree Completion afterAugust 2011 -- NOT Allowed");
			 document.forms[0].ugpassyy.value="";
			 document.forms[0].ugpassmm.value="";
			 document.forms[0].ugpassmm.focus();
		 }
	}
	/*if (document.forms[0].ugpassyy.value<=document.forms[0].ugfromyy.value)
	{
		alert("Kindly Check  Duration of Course. ");
		document.forms[0].ugpassyy.value="";
		document.forms[0].ugpassyy.focus();


	}*/ // taken out on 13 Aug 2009 


}



function chkpgdur()
{ 
	//alert("check");
	var chkyear=0;
		var mnth="";
	chkyear=document.forms[0].pgtoyy.value;
	mnth=document.forms[0].pgtomm.value;
	if (chkyear==2011)
	{
		 if (mnth=="OCT"||mnth=="NOV"||mnth=="DEC")
		 {
			 alert (" PG Degree Completion after September 2011 -- NOT Allowed");
			 document.forms[0].ugtoyy.value="";
			 document.forms[0].ugtomm.value="";
			 document.forms[0].ugtomm.focus();
		 }
	}

}

function chkpgpassdur()
{ 
	//alert("check");
	var chkyear=0;
		var mnth="";
	chkyear=document.forms[0].pgpassyy.value;
	mnth=document.forms[0].pgpassmm.value;
	if (chkyear==2011)
	{
		 if (mnth=="OCT"||mnth=="NOV"||mnth=="DEC")
		 {
			 alert ("Degree Completion after September 2011-- NOT Allowed");
			 document.forms[0].pgpassyy.value="";
			 document.forms[0].pgpassmm.value="";
			 document.forms[0].pgpassmm.focus();
		 }
	}

}




function chckphch(obj)
  {
	  if ((document.forms[0].disabled.value=="None")||(document.forms[0].disabled.value==""))
			{ 
			} 
			else {
		  // alert("test date " +obj.value);
			var year=0
			var ddate="" 
				  if ((document.forms[0].phcertdate.value=="")||(document.forms[0].phcertdate.value==null))
				  {
// alert("test 2 date " +obj.value);
				  }else{
						year=getyear_fname(obj);
						//if ((year == 2004)||(year == 2005)||(year == 2006)||(year==2007))
							if (year<2004)
						{
								//alert("Physically Challenged  Medical Certificate date should pertain to 2004 or Above only !")
								document.forms[0].phcertdate.value="";
								document.forms[0].phcertdate.focus();
								return false
						}
				  }

			}
			return true
}


function exservicewarn()
{
	 if ((document.forms[0].exserv.value=="N") ||(document.forms[0].exserv.value==""))
	 {
       document.forms[0].yrexserv.value="";
	   document.forms[0].yrexserv.disabled=true;

		 return true
	 } else{

			 document.forms[0].yrexserv.value="";
	         document.forms[0].yrexserv.disabled=false;

	  alert('Exservicemen is a person who has served in any rank (whether as combatant or as a non-combatant ) in the Regular Army ,Navy and Air Force of the Indian Union.  Candidate will have to send the valid certificate  along with Acknowledgement Slip. Click OK to proceed.') 

		/// commented on 09-Aug-2011  alert("Exservicemen with only TOTAL MARKS can enter the same in any one of the Years Marks fields. In case the requisite qualification posses by you is from other then Armed Forces, you are required to fulfill the eligibilty criteria as regard the stipulated percentage of marks prescribed")

	 		return true
		 }
}

function dis_ddno()
{       // alert ("Since you have selected your category as  SC/ST/  or Physically Challenged , You are exempted from payment of this fees.");
			 document.forms[0].ddno.value="";
			 document.forms[0].ddno.disabled=true;
			 document.forms[0].dddate.value="";
			 document.forms[0].dddate.disabled=true;
			 document.forms[0].bankname.value="";
			 document.forms[0].bankname.disabled=true;

}

function enab_ddno()
{            
	         document.forms[0].ddno.value="";
			 document.forms[0].ddno.disabled=false;
			 document.forms[0].dddate.value="";
			 document.forms[0].dddate.disabled=false;
			 document.forms[0].bankname.value="";
			 document.forms[0].bankname.disabled=false;
			

}

function prefwarn1()
{
	 //alert ("test alert");
	if (document.forms[0].pref1.value !="NA") 
	 {
		
	//alert(" enable preferences  ") ;
		//return enab_pref();
		return enabnew_pref(1);
	 		return true

		 } else
		 {
      // alert(" disable preferences  ") ;
		return dis_pref_new(1);
	 		return true

		 }


}

function enab_pref()
{            
	         document.forms[0].pref2.value="NA";
			 document.forms[0].pref2.disabled=false;
			/* document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=false;
			 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=false;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=false;*/

			

}

function enabnew_pref(i)
{  
	var temp,element;
	//int j=i+1;      
	 if (i==1)
	 {
		 //element="document.forms[0].pref"+j;
		 document.forms[0].pref2.value="NA";
			 document.forms[0].pref2.disabled=false;
			 document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=true;
			 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==2)
	 {
		 //element="document.forms[0].pref"+j;
		 document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=false;
			  document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==3)
	 {
		 //element="document.forms[0].pref"+j;
		 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=false;
			
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==4)
	 {
		 //element="document.forms[0].pref"+j;
		 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=false;
		
	 }


	//temp="pref"+j;

	
}

function dis_pref_new(i)
{
	var temp,element;
	//alert ("Since you have selected  no Preference , all the subsequent preferences are disabled.");
	//alert("test"+i);
	 if (i==1)
	 {
		 document.forms[0].pref2.value="NA";
			 document.forms[0].pref2.disabled=true;
			 document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=true;
			 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==2)
	 {
		 // document.forms[0].pref2.value="NA";
		//	 document.forms[0].pref2.disabled=true;
			 document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=true;
			 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==3)
	 {
		     document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }
	  if (i==4)
	 {
		  document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;
		
	 }

			
//return
}


function pref_enable(init)
{            if (init==true)
	{ 
	         //document.forms[0].pref2.value="NA";
			 document.forms[0].pref2.disabled=false;
			// document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=false;
			 //document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=false;
			 //document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=false;

	}

}


function dis_pref()
{        alert ("Since you have selected  no Preference , all the subsequent preferences are disabled.");
			 document.forms[0].pref2.value="NA";
			 document.forms[0].pref2.disabled=true;
			 document.forms[0].pref3.value="NA";
			 document.forms[0].pref3.disabled=true;
			 document.forms[0].pref4.value="NA";
			 document.forms[0].pref4.disabled=true;
			 document.forms[0].pref5.value="NA";
			 document.forms[0].pref5.disabled=true;


}


function prefwarn(n)
{
    var temp,vtemp,element,varelement ;
	
 temp="pref"+n;

 var flag=true;
		element = document.getElementById(temp);
		//	alert ("test "+element.value);
	 if (element.value!="NA") 
	 {
				for (i=1;i<=5 ; i++)
				{
					 if (i!=n)
					 { 
						vtemp="pref"+i;
						varelement=document.getElementById(vtemp);

							if (element.value==varelement.value)
							{
								alert ("preference of choices cannot be same. Kindly select different joining preference");
								flag=false;
								element.value="NA";
								element.focus();
								return flag;
							}	
					 }
				}

				return enabnew_pref(n);
			  if (flag)
			  {
				  return flag;
			  }
	

		 }else
	{
			 return dis_pref_new(n);
			 //alert (" select Preference of posting");
			 //element.focus();
	}


}



function phchwarn()
{
	 if ((document.forms[0].disabled.value=="None") ||(document.forms[0].disabled.value==""))
	 {
		  document.forms[0].perdisabled.value="";
	   document.forms[0].perdisabled.disabled=true;
		  return enab_ddno();
		 return true
	 } else{
			 document.forms[0].perdisabled.value="";
	   document.forms[0].perdisabled.disabled=false;
			
	// alert('The Certificates would be considered VALID whose Issue Date later than 01-jan-2004. ( Govt Guidelines: Certificate Validity for period of THREE (03) YEARS. Kindly Note For Locomotor Disability % should be greater than equal to >=40 , For Hearing Impairment Decibel Loss should be greater than equal to >=60 DB ') 
	 alert('  Kindly Note For Locomotor Disability % should be greater than equal to  >=40 , For Hearing Impairment Decibel Loss should be greater than equal to >=60 DB. Candidates will have to send the valid certificate to this effect along with Acknowledgement Slip.') 
	 
	  return dis_ddno();		
	 return true
	 }	
}

function dis_ddno1()
{       // alert ("Since you have selected your category as  SC/ST/  or Physically Challenged , You are exempted from payment of this fees.");
			 document.forms[0].ddno.value="";
			 document.forms[0].ddno.disabled=true;
			 document.forms[0].dddate.value="";
			 document.forms[0].dddate.disabled=true;
			 document.forms[0].bankname.value="";
			 document.forms[0].bankname.disabled=true;

}

function enab_ddno1()
{            
	        // document.forms[0].ddno.value="";
			 document.forms[0].ddno.disabled=false;
			// document.forms[0].dddate.value="";
			 document.forms[0].dddate.disabled=false;
			// document.forms[0].bankname.value="";
			 document.forms[0].bankname.disabled=false;
			

}

function typewarn()
{
	 if (document.forms[0].ugtype.value=="Full") 
	 {
		 return 
	 } else{
			
	 alert('Part Time and Correspondence Course type are applicable to BHEL Departmental Candidates ONLY. ') 
		
	 return 
	 }	
}



function phchwarn1()
{
	 if ((document.forms[0].disabled.value=="None") ||(document.forms[0].disabled.value==""))
	 {
		  return enab_ddno1();
		 return true
	 } else{
			
	// alert('The Certificates would be considered VALID whose Issue Date later than 01-jan-2004. ( Govt Guidelines: Certificate Validity for period of THREE (03) YEARS. Kindly Note For Locomotor Disability % should be greater than equal to >=40 , For Hearing Impairment Decibel Loss should be greater than equal to >=60 DB ') 
	  return dis_ddno1();		
	 return true
	 }	
}
function mailwarn()
{
	 if( confirm('All communications will be sent to this mail-id. so please give your current valid mail-id. Click OK to proceed  or Cancel to modify') )
	{
		
		 return true
	}
	 else
	 {
	 		document.forms[0].emailid1.focus()
			return false
	 }			
}

function mailretype()
{
//alert(document.forms[0].elements[12].value+"-"+document.forms[0].elements[14].value);
	 if ((document.forms[0].emailid1.value) == (document.forms[0].emailid.value))
	 		return true
	 else
	 {
	        alert('Retyped Mail ids are different!!! Please check')
			document.forms[0].emailid.value=""
	 		document.forms[0].emailid.focus()
			return false
	 }			
}
function degchk(de)
{
//alert(document.forms[0].elements[12].name+"-"+document.forms[0].elements[10].name);
//alert (document.forms[0].elements[de].selectedIndex);
	 if (document.forms[0].elements[de].selectedIndex==2)
	 {
	        alert('Only Indian Degree is  allowed')
			document.forms[0].elements[de].selectedIndex=0
	 		document.forms[0].elements[de].focus()
			return false
	 }			
}

/*********** semester Percentage Check ***************/
function createArray(length)
{
this.length=length;
for (var i=1;i<=length;i++) this[i]=null;
return this;
}

function currval()
{

					if (parseFloat(document.forms[0].ugmaxmark1.value)<parseFloat(document.forms[0].ugmark1.value))
					{
						alert ("Maximum marks cannot be Less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark1.value=0;
						document.forms[0].ugmaxmark1.focus;
						return false
					}
					if (parseFloat(document.forms[0].ugmaxmark2.value)<parseFloat(document.forms[0].ugmark2.value))
					{
						alert ("Maximum marks cannot be less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark2.value=0;
						document.forms[0].ugmaxmark2.focus;
						return false
					}
						if (parseFloat(document.forms[0].ugmaxmark3.value)<parseFloat(document.forms[0].ugmark3.value))
					{
						alert ("Maximum marks cannot be less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark3.value=0;
						document.forms[0].ugmaxmark3.focus;
						return false
					}
						if (parseFloat(document.forms[0].ugmaxmark4.value)<parseFloat(document.forms[0].ugmark4.value))
					{
						alert ("Maximum marks cannot be less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark4.value=0;
						document.forms[0].ugmaxmark4.focus;
						return false
					}
						if (parseFloat(document.forms[0].ugmaxmark5.value)<parseFloat(document.forms[0].ugmark5.value))
					{
						alert ("Maximum marks cannot be less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark5.value=0;
						document.forms[0].ugmaxmark5.focus;
						return false
					}
				document.forms[0].ugtotmaxmark.value=parseFloat(document.forms[0].ugmaxmark1.value)+parseFloat(document.forms[0].ugmaxmark2.value)+parseFloat(document.forms[0].ugmaxmark3.value)+parseFloat(document.forms[0].ugmaxmark4.value)+parseFloat(document.forms[0].ugmaxmark5.value)
				document.forms[0].ugtotmark.value=parseFloat(document.forms[0].ugmark1.value)+parseFloat(document.forms[0].ugmark2.value)+parseFloat(document.forms[0].ugmark3.value)+parseFloat(document.forms[0].ugmark4.value)+parseFloat(document.forms[0].ugmark5.value)
				if (document.forms[0].ugtotmaxmark.value!=0)
				{
				document.forms[0].ugpercmark.value=(document.forms[0].ugtotmark.value/document.forms[0].ugtotmaxmark.value)*100
				}
				if (parseFloat(document.forms[0].ugtotmaxmark.value)<parseFloat(document.forms[0].ugtotmark.value))
					{
						alert ("Total Maximum marks cannot be less than marks obtained , Kindly check");
						document.forms[0].ugmaxmark1.value=0;
						document.forms[0].ugmaxmark1.focus;
						return false
					}


//document.forms[0].elements[37].value=(document.forms[0].elements[35].value/document.forms[0].elements[36].value)*100
}



function checkTotal(ino)
{
v1=0.0;
v2=0;
v3=0;
offset=34

if (ino==0)
offset=offset;
else
{
offset=offset+1;
}
for (var k=0;k<5;k++)
{ 
if (document.forms[0].elements[(2*k)+offset].value!=null && document.forms[0].elements[(2*k)+offset].value!=NaN)
v1=v1+parseFloat(document.forms[0].elements[(2*k)+offset].value);
}       
if (ino==1)
{
document.forms[0].elements[46].value=(document.forms[0].elements[45].value/document.forms[0].elements[44].value)*100
}
v2=v1*1000;
v2=Math.round(v2);
v3=Math.round(parseFloat(document.forms[0].elements[offset+10].value)*1000);
if (v2!=v3)
	{
	alert ("Total is not matching");
if(document.forms[0].elements[26].selectedIndex==5)
        document.forms[0].elements[offset+2].focus();	
else
        document.forms[0].elements[offset].focus();	

	document.forms[0].elements[55].value="";
	}
}
function trunc(value,npos){
var roundValue=makeRoundValue(npos);
var multiValue=Math.pow(10,npos-1)
var temp=value-roundValue;
temp=temp*multiValue;
temp=Math.round(temp);
temp=temp/multiValue;
return temp;
}
function makeRoundValue(npos) {
if (npos<=0)
return 0;
var result=0.5;
for (var i=1;i<npos;i++) {
result=result/10;
}
return result;
}
function Datediff()
{
	var date1=document.forms[0].elements[6].value
	var date2="15/01/2007"
	var s1=date1
	var dd1=0;
	var mm1=0;
	var yy1=0;
	var d1=0;
	var m1=0;
	var y1=0;
	dd1=s1.substring(0,2)
	var slash11=s1.substring(2,3)
	mm1=s1.substring(3,5)
   	var slash12=s1.substring(5,6)
	yy1=s1.substring(6,10)
	y1=2007-parseInt(yy1);	
	m1=11-parseInt(mm1);	
        d1=parseInt(dd1);
        if (dd1=="08")
           d1=8;
//	d1=10-parseInt(dd1);	
	d1=1-d1;
//alert(d1);
	var diff=0.0;
	var fm1=0.0;
	var fy1=0.0;
	var fd1=0.0;
	
	if (d1<0) { m1=m1-1; d1=d1+30}
	if (m1<0) { y1=y1-1; m1=m1+12}
	if ((d1==0)&&(m1==0))
	fm1=0.0;
	else if ((d1==0))
	fm1=m1/12;
	else if ((m1==0))
	fd1=d1/366;
	else
	{
	fm1=m1/12;
	fd1=d1/366;
	}
	diff=y1+fm1+fd1;
	//alert(diff)
return diff;
}


function checkdob(dob,category,exserv,exservprd,phchall,phchallpercent)
{
var dd = dob.substring(0,2)
var mm = dob.substring(3,5)
var yyyy = dob.substring(6,10)

var minage = 18
minage = parseInt(minage)



//alert(dd+"-"+mm+"-"+yyyy)
//alert(category)
//alert(exserv)
//alert(exservprd)
//alert(phchall)
//alert(phchallpercent)
mm = parseInt(mm-1)
dd = parseInt(dd)
yyyy = parseInt(yyyy)
//var endDate = new Date(2007,0,15)
var endDate = new Date(2011,7,01) ///  for 01-August-2011
var dobirth = new Date(yyyy,mm,dd)
var one_year = 1000*60*60*24*365.25
var age = Math.floor((endDate.getTime()-dobirth.getTime())/one_year)
age = parseInt(age)

if (age<minage)
{
alert("Minimum age for applying is "+minage+" Years")
document.forms[0].dtbirth.focus()
return false
}
//alert("Age is "+age+" Years")
}

/*function coll_univ()
{
	//alert(document.forms[0].elements[47].selectedIndex)
	//alert("Gaurav")
		//alert("test "+ arr6[document.forms[0].elements[47].selectedIndex])

	//document.forms[0].elements[49].value = arr6[document.forms[0].elements[47].selectedIndex]
	
	
} */


function markswarn()
{
	 //alert ("test alert");
	if (document.forms[0].ug.selectedIndex <=3)  /// only for 1st 4 years... 
	 {
		//alert(" Since Diploma Duration is 2 years lateral Entry, Marks for 3rd and 4th year not required. "); 
			 document.forms[0].ugmaxmark5.value="0";
			 document.forms[0].ugmaxmark5.disabled=true;
			 //document.forms[0].ugmaxmark4.value="0";
			// document.forms[0].ugmaxmark4.disabled=true;
			 document.forms[0].ugmark5.value="0";
			 document.forms[0].ugmark5.disabled=true;

			 document.forms[0].ugmark4.value="0";
			 document.forms[0].ugmark4.disabled=false;
			 document.forms[0].ugmaxmark4.value="0";
			 document.forms[0].ugmaxmark4.disabled=false;

			 document.forms[0].ugmark3.value="0";
			 document.forms[0].ugmark3.disabled=false;
			 document.forms[0].ugmaxmark3.value="0";
			 document.forms[0].ugmaxmark3.disabled=false;

			 document.forms[0].ugmark2.value="0";
			 document.forms[0].ugmark2.disabled=false;
			 document.forms[0].ugmaxmark2.value="0";
			 document.forms[0].ugmaxmark2.disabled=false;

			 document.forms[0].ugmark1.value="0";
			 document.forms[0].ugmark1.disabled=false;
			 document.forms[0].ugmaxmark1.value="0";
			 document.forms[0].ugmaxmark1.disabled=false;



			 //document.forms[0].ugmark4.value="0";
			// document.forms[0].ugmark4.disabled=true;
	 }

	 if (document.forms[0].ug.selectedIndex ==4)    /// for all 5 years  
	 { 
		 alert("Fifth Year Marks are applicable for '5 yrs Engg. Dual degree course' OR 'B.E. 5 yrs Part Time (Only BHEL Employees) '")
		   document.forms[0].ugmaxmark5.value="0";
			 document.forms[0].ugmaxmark5.disabled=false;
			 //document.forms[0].ugmaxmark4.value="0";
			// document.forms[0].ugmaxmark4.disabled=true;
			 document.forms[0].ugmark5.value="0";
			 document.forms[0].ugmark5.disabled=false;

			 document.forms[0].ugmark4.value="0";
			 document.forms[0].ugmark4.disabled=false;
			 document.forms[0].ugmaxmark4.value="0";
			 document.forms[0].ugmaxmark4.disabled=false;

			 document.forms[0].ugmark3.value="0";
			 document.forms[0].ugmark3.disabled=false;
			 document.forms[0].ugmaxmark3.value="0";
			 document.forms[0].ugmaxmark3.disabled=false;

			 document.forms[0].ugmark2.value="0";
			 document.forms[0].ugmark2.disabled=false;
			 document.forms[0].ugmaxmark2.value="0";
			 document.forms[0].ugmaxmark2.disabled=false;

			 document.forms[0].ugmark1.value="0";
			 document.forms[0].ugmark1.disabled=false;
			 document.forms[0].ugmaxmark1.value="0";
			 document.forms[0].ugmaxmark1.disabled=false;

	 }


	if (document.forms[0].ug.selectedIndex ==5||document.forms[0].ug.selectedIndex ==6 )    /// for diploma + 3 years  and Bsc + 3years
	 {
		   document.forms[0].ugmaxmark5.value="0";
			 document.forms[0].ugmaxmark5.disabled=true;
			 //document.forms[0].ugmaxmark4.value="0";
			// document.forms[0].ugmaxmark4.disabled=true;
			 document.forms[0].ugmark5.value="0";
			 document.forms[0].ugmark5.disabled=true;

			 document.forms[0].ugmark4.value="0";
			 document.forms[0].ugmark4.disabled=false;
			 document.forms[0].ugmaxmark4.value="0";
			 document.forms[0].ugmaxmark4.disabled=false;

			 document.forms[0].ugmark3.value="0";
			 document.forms[0].ugmark3.disabled=false;
			 document.forms[0].ugmaxmark3.value="0";
			 document.forms[0].ugmaxmark3.disabled=false;

			 document.forms[0].ugmark2.value="0";
			 document.forms[0].ugmark2.disabled=false;
			 document.forms[0].ugmaxmark2.value="0";
			 document.forms[0].ugmaxmark2.disabled=false;

			 document.forms[0].ugmark1.value="0";
			 document.forms[0].ugmark1.disabled=true;
			 document.forms[0].ugmaxmark1.value="0";
			 document.forms[0].ugmaxmark1.disabled=true;

	 }

if (document.forms[0].ug.selectedIndex ==7 ||document.forms[0].ug.selectedIndex==9 )    /// amie or amiete fro BHEL employees
	 { 
		  alert (" 3rd/4th Year Marks are not applicable for 'AMIE (only for BHEL employees)' OR 'AMIETE (only for BHEL employees)'")
		   document.forms[0].ugmaxmark5.value="0";
			 document.forms[0].ugmaxmark5.disabled=true;
			 //document.forms[0].ugmaxmark4.value="0";
			// document.forms[0].ugmaxmark4.disabled=true;
			 document.forms[0].ugmark5.value="0";
			 document.forms[0].ugmark5.disabled=true;

			 document.forms[0].ugmark4.value="0";
			 document.forms[0].ugmark4.disabled=true;
			 document.forms[0].ugmaxmark4.value="0";
			 document.forms[0].ugmaxmark4.disabled=true;

			 document.forms[0].ugmark3.value="0";
			 document.forms[0].ugmark3.disabled=true;
			 document.forms[0].ugmaxmark3.value="0";
			 document.forms[0].ugmaxmark3.disabled=true;

			 document.forms[0].ugmark2.value="0";
			 document.forms[0].ugmark2.disabled=false;
			 document.forms[0].ugmaxmark2.value="0";
			 document.forms[0].ugmaxmark2.disabled=false;

			 document.forms[0].ugmark1.value="0";
			 document.forms[0].ugmark1.disabled=false;
			 document.forms[0].ugmaxmark1.value="0";
			 document.forms[0].ugmaxmark1.disabled=false;


			 // only for bhel Employee...
			 document.forms[0].bhelemp.value="Y";
			 document.forms[0].empstaffno.disabled=false;
				document.forms[0].empdesig.disabled=false;
				
				document.forms[0].empunit.disabled=false;
				document.forms[0].empstaffno.value=0;
				document.forms[0].empunit.value="";
				document.forms[0].empdesig.value="";

	 }

	 if (document.forms[0].ug.selectedIndex ==8  )    /// BE PART TIME fro BHEL employees
	 {
		 alert("Fifth Year Marks are applicable for '5 yrs Engg. Dual degree course' OR 'B.E. 5 yrs Part Time (Only BHEL Employees) '")
		   document.forms[0].ugmaxmark5.value="0";
			 document.forms[0].ugmaxmark5.disabled=false;
			 //document.forms[0].ugmaxmark4.value="0";
			// document.forms[0].ugmaxmark4.disabled=true;
			 document.forms[0].ugmark5.value="0";
			 document.forms[0].ugmark5.disabled=false;

			 document.forms[0].ugmark4.value="0";
			 document.forms[0].ugmark4.disabled=false;
			 document.forms[0].ugmaxmark4.value="0";
			 document.forms[0].ugmaxmark4.disabled=false;

			 document.forms[0].ugmark3.value="0";
			 document.forms[0].ugmark3.disabled=false;
			 document.forms[0].ugmaxmark3.value="0";
			 document.forms[0].ugmaxmark3.disabled=false;

			 document.forms[0].ugmark2.value="0";
			 document.forms[0].ugmark2.disabled=false;
			 document.forms[0].ugmaxmark2.value="0";
			 document.forms[0].ugmaxmark2.disabled=false;

			 document.forms[0].ugmark1.value="0";
			 document.forms[0].ugmark1.disabled=false;
			 document.forms[0].ugmaxmark1.value="0";
			 document.forms[0].ugmaxmark1.disabled=false;


			 // only for bhel Employee...
			 document.forms[0].bhelemp.value="Y";
			 document.forms[0].empstaffno.disabled=false;
				document.forms[0].empdesig.disabled=false;
				
				document.forms[0].empunit.disabled=false;
				document.forms[0].empstaffno.value=0;
				document.forms[0].empunit.value="";
				document.forms[0].empdesig.value="";

	 }


}





//////

function disc_degree()
{
				if (document.forms[0].ug.selectedIndex<6) /// for non bhel only
				{
				
						if (document.forms[0].elements[0].selectedIndex==0 ||document.forms[0].ugbranch.selectedIndex==1 ||document.forms[0].ugbranch.selectedIndex==13 ||document.forms[0].ugbranch.selectedIndex==24  )
						{
							alert("Please Select Discipline equivalent")
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].ugbranch.focus()
						}
						else if ((document.forms[0].elements[0].selectedIndex==1) && ((document.forms[0].ugbranch.selectedIndex<2)|| (document.forms[0].ugbranch.selectedIndex>12)) )
						{
							alert("Discipline Mismatch")
							document.forms[0].elements[0].selectedIndex=0
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].elements[0].focus()
						}
						else if ((document.forms[0].elements[0].selectedIndex==2) && ((document.forms[0].ugbranch.selectedIndex<14) || (document.forms[0].ugbranch.selectedIndex>23)) )
						{
							alert("Discipline Mismatch")
							document.forms[0].elements[0].selectedIndex=0
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].elements[0].focus()
						}
						else if ((document.forms[0].elements[0].selectedIndex==3) && ((document.forms[0].ugbranch.selectedIndex<25) || (document.forms[0].ugbranch.selectedIndex>38)) )
						{
							alert("Discipline Mismatch")
							document.forms[0].elements[0].selectedIndex=0
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].elements[0].focus()
						}
					/*	else if ((document.forms[0].elements[0].selectedIndex==4) && (document.forms[0].ugbranch.selectedIndex<34) )
						{
							alert("Discipline Mismatch")
							document.forms[0].elements[0].selectedIndex=0
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].elements[0].focus()
						}*/
				}  else {
					 document.forms[0].bhelemp.value="Y";
					 if (document.forms[0].elements[0].selectedIndex==0 ||document.forms[0].ugbranch.selectedIndex==1 ||document.forms[0].ugbranch.selectedIndex==13 ||document.forms[0].ugbranch.selectedIndex==24  )
						{
							alert("Please Select Discipline equivalent")
							document.forms[0].ugbranch.selectedIndex=0
							document.forms[0].ugbranch.focus()
						}

				}// end if non bhel 
				
}


function chkoptions()
{
	if ((document.forms[0].elements[1].selectedIndex!=0) && (document.forms[0].elements[2].selectedIndex!=0) && (document.forms[0].elements[2].selectedIndex!=0) )
	{
		if ( (document.forms[0].elements[1].selectedIndex==document.forms[0].elements[2].selectedIndex) || (document.forms[0].elements[1].selectedIndex==document.forms[0].elements[3].selectedIndex) || (document.forms[0].elements[2].selectedIndex==document.forms[0].elements[3].selectedIndex) )
			{
					alert("Please Select Different Options for Test Centers")
					document.forms[0].elements[1].selectedIndex=0
					document.forms[0].elements[2].selectedIndex=0
					document.forms[0].elements[3].selectedIndex=0
					document.forms[0].elements[1].focus()
					return false
			}
	}
	
}

function othchk11()
{
if ((document.forms[0].ug.selectedIndex!=4) && (document.forms[0].ug.selectedIndex!=8))
{
	//alert(document.forms[0].elements[25].value)
	alert("Fifth Year Marks are applicable for '5 yrs Engg. Dual degree course' OR 'B.E. 5 yrs Part Time (Only BHEL Employees) '")
	
}
}

function othchk22()
{
if ((document.forms[0].ug.selectedIndex==7) || (document.forms[0].ug.selectedIndex==9))
{
	//alert(document.forms[0].elements[25].value)
	alert("3rd/4th Year Marks are not applicable for 'AMIE (only for BHEL employees)' OR 'AMIETE (only for BHEL employees)'")
	
}
}



function copyaddr()
{
	if (document.forms[0].pcheck.checked)
	{
		    document.forms[0].paddr1.value=document.forms[0].addr1.value
			document.forms[0].paddr2.value=document.forms[0].addr2.value
			document.forms[0].paddr3.value=document.forms[0].addr3.value
			document.forms[0].paddr4.value=document.forms[0].addr4.value
			document.forms[0].pstate.value=document.forms[0].state.value
			document.forms[0].pcountry.value=document.forms[0].country.value
			document.forms[0].ppin.value=document.forms[0].pin.value

	}


}



function mstatuswarn()
{

if (document.forms[0].mstatus.selectedIndex ==1)  /// only for 1st 4 years... 
	 {
      document.forms[0].spousename.disabled=false
	  document.forms[0].spousename.value=""
      document.forms[0].spousename.focus()


	 }else{
		 document.forms[0].spousename.disabled=true
	  document.forms[0].spousename.value=""


	 }
}




//-->

