function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function showtai()
{
    var fnam="pratibhataipatil/index.htm"; 
	window.open(fnam,"Pratibhataipatil","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=400,width=565,,scrollbars=0");
	return 1;
}



function admission()
{
fname="html/admission notice.htm";
window.open(fname,"_newwindow","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=800,width=600,,scrollbars=0");
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function valfrm()
{
if(window.document.admission.surname.value=="")
{
alert ("Please type your Surname");
window.document.admission.surname.focus();
return false;
}
if(window.document.admission.firstname.value=="")
{
alert ("Please type your First name");
window.document.admission.firstname.focus();
return false;
}
if(window.document.admission.fathername.value=="")
{
alert ("Please type your Father's Name");
window.document.admission.fathername.focus();
return false;
}
if(window.document.admission.address.value=="")
{
alert ("Please type your Complete Address (do not type city name)...");
window.document.admission.address.focus();
return false;
}
if(window.document.admission.cityname.value=="")
{
alert ("Please type your Place/ City name)...");
window.document.admission.cityname.focus();
return false;
}
if(window.document.admission.district.value=="")
{
alert ("Please type your District...");
window.document.admission.district.focus();
return false;
}

	Item = window.document.admission.statename.selectedIndex; 
	Result = window.document.admission.statename.options[Item].text; 
    if (Result == "----- Select -----") 
	{
		alert("Please Select your State Name...");
		window.document.admission.statename.focus();
		return false;
	}

if(window.document.admission.telephones.value=="" && window.document.admission.telephones.value2=="" && window.document.admission.telephones3.value=="")
{
alert ("Please specify your any one Telephone No:");
window.document.admission.telephones.focus();
return false;
}

	Item = window.document.admission.prefer1.selectedIndex; 
	Result = window.document.admission.prefer1.options[Item].text; 
    if (Result == "----- Select -----") 
	{
		alert ("Please select your Admission Preference Sequence (at least one)...");
		window.document.admission.prefer1.focus();
		return false;
	}

	Item = window.document.admission.category.selectedIndex; 
	Result = window.document.admission.category.options[Item].text; 
    if (Result == "------ Select ------") 
	{
		alert ("Please select your Category...");
		window.document.admission.category.focus();
		return false;
	}

if(window.document.admission.birthdate.value=="")
{
alert ("Please type your Birth Date...");
window.document.admission.birthdate.focus();
return false;
}
if(window.document.admission.familyoccupation.value=="")
{
alert ("Please type your Family Head Occupation...");
window.document.admission.familyoccupation.focus();
return false;
}
if(window.document.admission.annualincome.value=="")
{
alert ("Please type your Family's approximate Annual Income...");
window.document.admission.annualincome.focus();
return false;
}
	Item = window.document.admission.cettype.selectedIndex; 
	Result = window.document.admission.cettype.options[Item].text; 
    if (Result == "------ Select ------") 
	{
		alert ("Please Specify CET Exam you attended...");
		window.document.admission.cettype.focus();
		return false;
	}
if(window.document.admission.cetseat.value=="")
{
alert ("Please type your CET Seat No...");
window.document.admission.cetseat.focus();
return false;
}
if(window.document.admission.cetmarks.value=="")
{
alert ("Please type your CET Marks...");
window.document.admission.cetmarks.focus();
return false;
}
if(window.document.admission.cetmerit.value=="")
{
alert ("Please type CET Merit List No...");
window.document.admission.cetmerit.focus();
return false;
}
if(window.document.admission.passmonth.value=="")
{
alert ("Please type your H.Sc. Pass Month...");
window.document.admission.passmonth.focus();
return false;
}
if(window.document.admission.passinst.value=="")
{
alert ("Please type College from where you passed HSC...");
window.document.admission.passinst.focus();
return false;
}
if(window.document.admission.passuniv.value=="")
{
alert ("Please specify your HSC University Name...");
window.document.admission.passuniv.focus();
return false;
}
if(window.document.admission.outofs1.value=="" || window.document.admission.outofs2.value=="" || window.document.admission.outofs3.value=="" || window.document.admission.outofs4.value=="")
{
alert ("Please Specify your PCME Subject Marks...");
window.document.admission.outofs1.focus();
return false;
}
if(window.document.admission.marks1.value=="" || window.document.admission.marks2.value=="" || window.document.admission.marks3.value=="" || window.document.admission.marks4.value=="")
{
alert ("Please Specify your PCME  Theory Marks...");
window.document.admission.marks1.focus();
return false;
}
if(window.document.admission.marksp1.value=="" || window.document.admission.marksp2.value=="" || window.document.admission.marksp3.value=="")
{
alert ("Please Specify your PCME Practical Marks...");
window.document.admission.marksp1.focus();
return false;
}
if(window.document.admission.pcmtotal.value=="")
{
alert ("Please specify your PCM aggregate Total...");
window.document.admission.pcmtotal.focus();
return false;
}
if(window.document.admission.agmarks.value=="")
{
alert ("Please specify your HSC Grant Total...");
window.document.admission.agmarks.focus();
return false;
}
if(window.document.admission.agoutof.value=="")
{
alert ("Please specify your HSC Grant Marks Total...");
window.document.admission.agoutof.focus();
return false;
}
if(window.document.admission.sscyear.value=="")
{
alert ("Please specify your SSC Year...");
window.document.admission.sscyear.focus();
return false;
}

if(window.document.admission.sscmonth.value=="")
{
alert ("Please specify your SSC Month...");
window.document.admission.sscmonth.focus();
return false;
}

if(window.document.admission.sscmarks.value=="")
{
alert ("Please specify marks obtained in SSC Exam...");
window.document.admission.sscmarks.focus();
return false;
}


if(window.document.admission.sscoutof.value=="")
{
alert ("Please specify SSC Grant Marks Total...");
window.document.admission.sscoutof.focus();
return false;
}

if(window.document.admission.submitplace.value=="")
{
alert ("Please specify your place of submission of this form...");
window.document.admission.submitplace.focus();
return false;
}
window.document.admission.action="onlineform2.asp";
window.document.admission.submit();
return true;
}


function valform()
{
if (window.document.resetpass.rid.value=="")
{
alert("Please Specify Valid Registration ID to Reset....");
window.document.resetpass.rid.focus();
return 0;
}
return 1;
}


function valform1()
{
if (window.document.resetpass.rid.value=="")
{
alert("Please Specify Valid Registration ID to Reset....");
window.document.resetpass.rid.focus();
return 0;
}
window.document.resetpass.action="forgotpass.asp";
window.document.resetpass.submit();
return 1;
}


function ch2frm()
{
	if (window.document.login.email.value =="")
	{
		k = 1;
		alert("Please type E-mail Address...");
		return false;
	}
	return true;

}
//used in mailform.asp
function validatefrm()
{
	if (window.document.frmcontact.name.value == "")
	{
		alert("Name is not a blank field");
		return false;
	}
	if (window.document.frmcontact.email.value == "")
	{
		alert("Please key in your E-mail ID");
		return false;
	}
	if (window.document.frmcontact.comments.value == "")
	{
		alert("Please type your message to be sent...");
		return false;
	}
}

//used in alumni/register.asp
function chkfrmalum()
{
	var k = 0;
	
	if (window.document.alumni.name.value =="")
	{
		alert("Name is not a blank field");
		k = 1;
		window.document.alumni.name.focus();
		return false;
	}

	Item = window.document.alumni.date.selectedIndex; 
	Result = window.document.alumni.date.options[Item].text; 

    if (Result == "--- Select ---") 
	{
		k = 1;
		alert("Please Select Birth Date");
		window.document.alumni.date.focus();
		return false;
	}

	Item = window.document.alumni.month.selectedIndex; 
	Result = window.document.alumni.month.options[Item].text; 

    if (Result == "--- Select ---") 
	{
		k = 1;
		alert("Please Select Birth Month");
		window.document.alumni.month.focus();
		return false;
	}
	Item = window.document.alumni.year.selectedIndex; 
	Result = window.document.alumni.year.options[Item].text; 

    if (Result == "--- Select ---") 
	{
		k = 1;
		alert("Please Select Birth Year");
		window.document.alumni.year.focus();
		return false;
	}

	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.alumni.email.value.match(emailpat);

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
		window.document.alumni.email.focus();
        return false;
      }

	if (window.document.alumni.loginid.value =="")
	{
		alert("Please Specify a Valid Login name [For later Updates]");
		window.document.alumni.loginid.focus();
		k = 1;
		return false;
	}

	if (window.document.alumni.passwd.value =="")
	{
		alert("Please specify a Valid Password for your Login...");
		window.document.alumni.passwd.focus();
		k = 1;
		return false;
	}

	if (window.document.alumni.hobbies.value =="")
	{
		alert("Hobbies is not a blank Field");
		window.document.alumni.hobbies.focus();
		k = 1;
		return false;
	}
	
	if (window.document.alumni.qualification.value =="")
	{
		alert("Qualification is not a blank field");
		k = 1;
		window.document.alumni.qualification.focus();
		return false;
	}
	
	Item = window.document.alumni.coetbranch.selectedIndex; 
	Result = window.document.alumni.coetbranch.options[Item].text; 

    if (Result == "----- Select -----") 
	{
		k = 1;
		alert("Please Select a valid Branch");
		return false;
	}

	if (window.document.alumni.passyear.value =="")
	{
		alert("Year is not a blank field");
		k = 1;
		window.document.alumni.passyear.focus();
		return false;
	}	

	if (window.document.alumni.passyear.value <"1975")
	{
		alert("Incorrect year");
		k = 1;
		window.document.alumni.passyear.focus();
		return false;
	}	

	if (window.document.alumni.spmoments.value =="")
	{
		alert("Please take time to tell your best experience/ comment about college");
		k = 1;
		window.document.alumni.spmoments.focus();
		return false;
	}	

	if (window.document.alumni.company.value =="")
	{
		alert("Please specify your Current Company/ Work details");
		k = 1;
		window.document.alumni.company.focus();
		return false;
	}	

	if (window.document.alumni.designation.value =="")
	{
		alert("Please specify your Designation");
		k = 1;
		window.document.alumni.designation.focus();
		return false;
	}	

	if (window.document.alumni.phones.value =="")
	{
		alert("Please specify your work phones");
		k = 1;
		window.document.alumni.phones.focus();
		return false;
	}	
	return true;
}

//used in alumni/updatebio.asp
function chkfrmupdtalum()
{
	var k = 0;
	
	if (window.document.alumni.name.value =="")
	{
		alert("Name is not a blank field");
		k = 1;
		window.document.alumni.name.focus();
		return false;
	}
	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.alumni.email.value.match(emailpat);

	if (window.document.alumni.email.value !="")
	{
    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
        return false;
      }
	}

	if (window.document.alumni.loginid.value =="")
	{
		alert("Please Specify a Valid Login name [For later Updates]");
		window.document.alumni.loginid.focus();
		k = 1;
		return false;
	}

	if (window.document.alumni.passwd.value =="")
	{
		alert("Please specify a Valid Password for your Login...");
		window.document.alumni.passwd.focus();
		k = 1;
		return false;
	}

	if (window.document.alumni.hobbies.value =="")
	{
		alert("Hobbies is not a blank Field");
		window.document.alumni.hobbies.focus();
		k = 1;
		return false;
	}
	
	if (window.document.alumni.qualification.value =="")
	{
		alert("Qualification is not a blank field");
		k = 1;
		window.document.alumni.qualification.focus();
		return false;
	}
	
	Item = window.document.alumni.coetbranch.selectedIndex; 
	Result = window.document.alumni.coetbranch.options[Item].text; 

    if (Result == "----- Select -----") 
	{
		k = 1;
		alert("Please Select a valid Branch");
		return false;
	}

	if (window.document.alumni.passyear.value =="")
	{
		alert("Year is not a blank field");
		k = 1;
		window.document.alumni.passyear.focus();
		return false;
	}	

	if (window.document.alumni.passyear.value <"1975")
	{
		alert("Incorrect year");
		k = 1;
		window.document.alumni.passyear.focus();
		return false;
	}	

	if (window.document.alumni.spmoments.value =="")
	{
		alert("Please take time to tell your best experience/ comment about college");
		k = 1;
		window.document.alumni.spmoments.focus();
		return false;
	}	

	if (window.document.alumni.designation.value =="")
	{
		alert("Please specify your Designation");
		k = 1;
		window.document.alumni.designation.focus();
		return false;
	}	

	if (window.document.alumni.phones.value =="")
	{
		alert("Please specify your work phones");
		k = 1;
		window.document.alumni.phones.focus();
		return false;
	}	
	return true;
}


//used in placement cell/feedback form.asp
function chkfrmpcellfdbck()
{
  
       if (window.document.form1.name.value == "")
	   {

		alert("Please specify your Company Name...");
		window.document.form1.name.focus();
		return false;
	   }
	
	if (window.document.form1.address.value == "")
	  {
		alert("Please specify your Company Office Address..");
		window.document.form1.address.focus();
		return false;
	  }
	
       if (window.document.form1.phone.value == "")
	{
		alert("Please specify Contact Phone Number...");
		window.document.form1.phone.focus();
		return false;
	}
	
	str = window.document.form1.phone.value;
	    for (var i = 0; i < str.length; i++) 
	    {
	        var ch = str.substring(i, i + 1)
        	if ((ch < "0" || "9" < ch) && ch != '.') 
			{
				window.document.form1.phone.value=""
		        alert("Please Enter Numeric Value in Phone Number...");
				window.document.form1.phone.focus();
		   		return false;
    		}
		}
	     
     if(window.document.form1.email.value=="")
	{
		alert("Please specify your Contact E-mail ID...");
		window.document.form1.email.focus();
		return false;
	}
	else
	{
   var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.form1.email.value.match(emailpat);

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id specified...");
		window.document.form1.email.focus();
        return false;
      } 
	}
   
     
       Item = window.document.form1.industrytype.selectedIndex; 
	Result = window.document.form1.industrytype.options[Item].text; 

	if (Result=="--- Select ---")
	{
		alert("Please Select Industry Type");
		window.document.form1.industrytype.focus();
		return false;
	}

      if (window.document.form1.products.value == "")
	{
		alert("Please give a brief description of your Work/ Company Development Areas:");
		window.document.form1.products.focus();	
		return false;
	}

	 if (window.document.form1.procedure.value == "")
	{
		alert("Please specify how you wish to Process this recruitment Intent...");
		window.document.form1.procedure.focus();
		return false;
	}

    if (window.document.form1.contactperson.value == "")
	{
		alert("Let us know Contact Person details [For conducting T & P Activity]");
		window.document.form1.contactperson.focus();
		return false;
	}
      
   
	 if (window.document.form1.email1.value == "")
	{
		alert("Let us know Contact Person E-mail ID [For conducting T & P Activity]");
		window.document.form1.email1.focus();
		return false;
	}
	else
	{
   var emailpat1 =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray1 = window.document.form1.email1.value.match(emailpat1);

    if (matcharray1 == null)
      { k=1;
        alert("Invalid E-mail Id");
		window.document.form1.email1.focus();
        return false;
      }
	}	
	window.document.form1.action="submitfeedback.asp";
	window.document.form1.submit();
	return true;
 }
 
//used in placement cell/register.asp
 function chkfrmpcellreg()
{
	var k = 0;
	
	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = placement.email.value.match(emailpat);


	if (placement.name.value =="")
	{
		alert("Name is not a blank field");
		k = 1;
		placement.name.focus();
		return false;
	}

	if (placement.login.value =="")
	{
		alert("Please Specify valid login name");
		k = 1;
		placement.login.focus();
		return false;
	}

	if (placement.pass1.value =="")
	{
		alert("Blank password not allowed...");
		k = 1;
		placement.pass1.focus();
		return false;
	}

	if (placement.pass2.value =="")
	{
		alert("Blank password not allowed...");
		k = 1;
		placement.pass2.focus();
		return false;
	}

	if ((placement.pass1.value) != (placement.pass2.value))
	{
		alert("Your Password Confirmatino do not match Password... retype Password");
		k = 1;
		placement.pass1.focus();
		return false;
	}

	Item = placement.date.selectedIndex; 
	Result = placement.date.options[Item].text; 
	if (Result=="-- Select --")
	{
		alert("Please Select your Birth Date");
		placement.date.focus();
		k = 1;
		return false;
	}

	Item = placement.month.selectedIndex; 
	Result = placement.month.options[Item].text; 
	if (Result=="-- Select --")
	{
		alert("Please Select your Birth Month");
		placement.month.focus();
		k = 1;
		return false;
	}

	Item = placement.year.selectedIndex; 
	Result = placement.year.options[Item].text; 
	if (Result=="-- Select --")
	{
		alert("Please Select your Birth Year");
		placement.year.focus();
		k = 1;
		return false;
	}

	Item = placement.gender.selectedIndex; 
	Result = placement.gender.options[Item].text; 
	if (Result=="-- Select --")
	{
		alert("Please specify your Gender...");
		placement.gender.focus();
		k = 1;
		return false;
	}

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
		placement.email.focus();
        return false;
      }
	
	Item = placement.marital.selectedIndex; 
	Result = placement.marital.options[Item].text; 

	if (Result=="-- Select --")
	{
		alert("Please Select your Marital Status");
		placement.marital.focus();
		k = 1;
		return false;
	}

	if (placement.languages.value =="")
	{
		alert("Please Key in Languages you know... atleast One");
		placement.languages.focus();
		k = 1;
		return false;
	}

	if (placement.hobbies.value =="")
	{
		alert("Hobbies is not a blank Field");
		placement.hobbies.focus();
		k = 1;
		return false;
	}
	
	if (placement.objective.value =="")
	{
		alert("Please Specify your Objective for Resume...");
		k = 1;
		placement.objective.focus();
		return false;
	}

	if (placement.areaofspecialise.value =="")
	{
		alert("Please specify your Area of Specialisation...");
		k = 1;
		placement.areaofspecialise.focus();
		return false;
	}
	if (placement.resume.value =="")
	{
		alert("Its Important! Please paste your Text Format Resume here...");
		k = 1;
		placement.resume.focus();
		return false;
	}	

	
	placement.submit();
	return true;
}

//used in placement cell/search.asp
function chkfrmpcellsrch()
{
	var k=0;
	tx = window.document.searchform.searchtext.value;
	arsp = window.document.searchform.areaofsp.value;
	if (tx=="" && arsp=="")
	{
		k = 1;
		alert("Please specify either text to search for or Area of Specialisation to Search!");
		return false;
	}

	window.document.searchform.action="search2.asp";
	window.document.searchform.submit();
	return true;
}

//used in html/contactus.asp
function validatefrmcont()
{
	if (window.document.frmcontact.name.value == "")
	{
		alert("Name is not a blank field");
		window.document.frmcontact.name.focus();
		return false;
	}
	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.frmcontact.email.value.match(emailpat);

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
		window.document.frmcontact.email.focus();
        return false;
      }
	if (window.document.frmcontact.comments.value == "")
	{
		alert("Please type your message to be sent...");
		window.document.frmcontact.comments.focus();
		return false;
	}
		window.document.frmcontact.action="contactuscoet.asp";
		window.document.frmcontact.submit();
		return true;
}

//used in alumni/search.asp
function chkfrm(f1)
{
	x=f1.yearsearch.value;
	y=f1.namesearch.value
	if ((x=="") && (y==""))
	{
		alert("Please specify atleast one search criteria");
		f1.namesearch.focus();
		return false;
	}
	else
	{
		if (f1.yearsearch.value!="")
		{
		str = f1.yearsearch.value;
	    for (var i = 0; i < str.length; i++) 
	    {
	        var ch = str.substring(i, i + 1)
        	if ((ch < "0" || "9" < ch) && ch != '.') 
			{
				f1.yearsearch.value=""
		        alert("Please Enter Numeric Value ...");
				f1.yearsearch.focus();
		   		return false;
    		}
		}
		}
	}
	f1.submit();
	return 1;
}

function chkfrm2(f1)
{
	
	x=f1.yearsearch.value;
	y=f1.namesearch.value;
	
	if ((x=="") && (y=="0"))
	{
		alert("Please specify atleast one search criteria");
		f1.namesearch.focus();
		return false;
	}
	else
	{
		if (f1.yearsearch.value!="")
		{
		str = f1.yearsearch.value;
	    for (var i = 0; i < str.length; i++) 
	    {
	        var ch = str.substring(i, i + 1)
        	if ((ch < "0" || "9" < ch) && ch != '.') 
			{
				f1.yearsearch.value=""
		        alert("Please Enter Numeric Value ...");
				f1.yearsearch.focus();
		   		return false;
    		}
		}
		}
	}
	f1.submit();
	return 1;
}

//used in manager/delplace.asp
function validatedelplace()
{
if(window.document.delform.tno.value=="")
{
alert ("please input Registration number to delete...");
window.document.delform.tno.focus();
return 0;
}
delform.submit();
return 1;
}

//used in asp/contactform.asp
function validatefrmcont()
{
	if (window.document.frmcontact.name.value == "")
	{
		alert("Name is not a blank field");
		window.document.frmcontact.name.focus();
		return false;
	}
	var emailpat =/^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9]\w*(\.[A-Za-z0-9]\w*)+)$/;
	var matcharray = window.document.frmcontact.email.value.match(emailpat);

    if (matcharray == null)
      { k=1;
        alert("Invalid E-mail Id");
		window.document.frmcontact.email.focus();
        return false;
      }
	if (window.document.frmcontact.comments.value == "")
	{
		alert("Please type your message to be sent...");
		window.document.frmcontact.comments.focus();
		return false;
	}
		window.document.frmcontact.action="mailform.asp";
		window.document.frmcontact.submit();
		return true;
}

function CheckNumber(input)
{
	var str = input.value;
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if ((ch < "0" || "9" < ch) && ch != '.'  && ch!=",") 
			{
       	      	alert("Please Enter Numeric Value...");
				input.focus();
		        return false;
	    	}
	}
	return true;
}

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.indexOf(at,(lat+1))!=-1){
		    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
		 }

 		 return true					
	}

//Blank textfield validation
function chkblank(t,msg)
{
	if (t.value=="")
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

//validation for selection list
function chkselect(t,msg)
{
	selno = t.selectedIndex; 
	//alert(selno);
	selvalue = t.options[selno].value; 
	if (selvalue==0)
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

function chkradio(r,msg)
{
myOption = -1;
	
	for (i=r.length-1; i > -1; i--) {
	if (r[i].checked) {
		myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert(msg);
	return 0;
	}
}

//validation for phone/mobile
function phnocheck(input)
{
	var str = input.value;
	if (str!="")
	{
		for (var i = 0; i < str.length; i++) 
		{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return 0;
	    	}
		}
	}
	return 1;
}

function mobcheck(input)
{
	var str = input.value;
	if (str.length!=10)
	{
		alert("Invalid Phone number...");
		input.focus();
	    return 0;
	}
	if (str.substring(1,0)!="9")
	{
		alert("Invalid Phone number...");
		input.focus();
	    return 0;
	}
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return 0;
	    	}
	}
	return 1;
}

function chkseldate(dy,mth,yrs,msg)
{
	td=dy.selectedIndex;
	td=dy.options[td].value;
	if (td==0)
	{
		alert("Please specify date!");
		dy.focus();
		return 0;
	}
	tm=mth.selectedIndex;
	tm=mth.options[tm].value;
	if (tm==0)
	{
		alert("Please specify Month!");
		mth.focus();
		return 0;
	}
	ty=yrs.selectedIndex;
	ty=yrs.options[ty].value;
	if (ty==0)
	{
		alert("Please specify Year!");
		yrs.focus();
		return 0;
	}
	md=monthdays(tm,ty);
	if (td>md)
	{
		alert(msg);
		dy.focus();	
		return 0;
	}
	else
	
		return 1;
}

function monthdays(mon1,yr)
{
	switch (mon1){	
	case "2":
		if (yr==0)
			mdays=29;
		else
		{
			lp1=yr % 400;
			if (lp1==0)
				mdays=29;
			else
			{
				lp2=yr % 4;
				lp3=yr % 100;
				if ((lp2==0) && (lp3>0))
					mdays=29;
				else
					mdays=28;
			}
		}
		break;
	case "4":	
	case "6":
	case "9":	
	case "11":
		mdays=30;
		break;
	default:
		mdays=31;
		break;
	}
	return mdays;
}


//function for date validation
//he function returns true if the date is valid and false if it is not.
function isValidDate(dateStr, format) {
   if (format == null) { format = "MDY"; }
   format = format.toUpperCase();
   if (format.length != 3) { format = "MDY"; }
   if ( (format.indexOf("M") == -1) || (format.indexOf("D") == -1) || (format.indexOf("Y") == -1) ) { format = "MDY"; }
   if (format.substring(0, 1) == "Y") { // If the year is first
      var reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
      var reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
   } else if (format.substring(1, 2) == "Y") { // If the year is second
      var reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/
      var reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/
   } else { // The year must be third
      var reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/
      var reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
   }
   // If it doesn't conform to the right format (with either a 2 digit year or 4 digit year), fail
   if ( (reg1.test(dateStr) == false) && (reg2.test(dateStr) == false) ) { return false; }
   var parts = dateStr.split(RegExp.$1); // Split into 3 parts based on what the divider was
   // Check to see if the 3 parts end up making a valid date
   if (format.substring(0, 1) == "M") { var mm = parts[0]; } else 
      if (format.substring(1, 2) == "M") { var mm = parts[1]; } else { var mm = parts[2]; }
   if (format.substring(0, 1) == "D") { var dd = parts[0]; } else 
      if (format.substring(1, 2) == "D") { var dd = parts[1]; } else { var dd = parts[2]; }
   if (format.substring(0, 1) == "Y") { var yy = parts[0]; } else 
      if (format.substring(1, 2) == "Y") { var yy = parts[1]; } else { var yy = parts[2]; }
   if (parseFloat(yy) <= 50) { yy = (parseFloat(yy) + 2000).toString(); }
   if (parseFloat(yy) <= 99) { yy = (parseFloat(yy) + 1900).toString(); }
   var dt = new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
   if (parseFloat(dd) != dt.getDate()) { return false; }
   if (parseFloat(mm)-1 != dt.getMonth()) { return false; }
   return true;
}

function cdt(dt)
{	
	mydatestring =dt.value;	
	if (!isValidDate(mydatestring, "DMY")) 
	{ 
		alert("The date is not in the correct format."); 	
		dt.focus();
		return 0;
	}
	return 1;
}
 
function valpersonaldet(f)
{
	if (chkblank(f.surname,"Surname is not a blank field. Please specify it!")==0)
		return 0;
	if (chkblank(f.firstname,"First name is not a blank field. Please specify it!")==0)
		return 0;
	//if (chkblank(f.middlename,"Middle Name is not a blank field. Please specify it!")==0)
	//	return 0;
	if (chkblank(f.fathername,"Father's name is not a blank field. Please specify it!")==0)
		return 0;
	if (chkblank(f.birthdate,"Please specify your birthdate!")==0)
		return 0;
	else
		if (cdt(f.birthdate)==0)
			return 0;
	if (chkradio(f.gender,"Please select your gender!")==0)
		return 0;
	if (chkselect(f.category,"Please select the categroy!")==0)
		return 0;
	if (chkselect(f.post,"Please select the post you are applying for!")==0)
		return 0;
	if (chkselect(f.dept,"Please select the department you are applying for!")==0)
		return 0;
	if (chkblank(f.email,"Please specify your email id!")==0)
		return 0;
		if (echeck(f.email.value)==0)
			{
			f.email.focus();
			return 0;
			}
	tel=f.teleno.value;
	mob=f.mobile.value;
	if ((tel=="")&& (mob==""))
	{
		alert("Please specify atleast one of the contact numbers!");
		f.teleno.focus();
		return 0;
	}
	if (tel!="")
		if (phnocheck(f.teleno)==0)
			return 0;
	if (mob!="")
		if (mobcheck(f.mobile)==0)
			return 0;	
			
		f.submit();
		return 1;
}	

function showimg(mmid)
{
	
	window.open(mmid,"Geneology","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=200,top=220,left=250,width=430,,scrollbars=0");	
}

function getimg(cntt,ipath)
{
	window.open("dispimg.asp?i=" + cntt + "&folder=" + ipath,"viewimage","resizable=yes,toolbar=0,location=0,menubar=0,status=0,height=700,top=14,left=62,width=900,,scrollbars=1");	
	//window.open("dispimg.asp?i=" + ipath,"viewimage","resizable=yes,toolbar=0,location=0,menubar=0,status=0,height=700,top=14,left=62,width=900,,scrollbars=1");	
	//window.document.getElementById('image').innerHTML="<img src='" + ipath + "' border=0>";
}
