function validate(frm)
{
if(frm.apply.value=="")

{

alert("Applied for Post field is empty !");

frm.apply.focus();

return false;

}


if(frm.Name.value=="")

{

alert("Name field is empty !");

frm.Name.focus();

return false;

}

if(frm.Country.value=="")

{

alert("Country field is empty !");

frm.Country.focus();

return false;

}

var emailID=frm.Email



if ((emailID.value==null)||(emailID.value=="")){

alert("Please Enter your Email ID")

emailID.focus()

return false

}

if (echeck(emailID.value)==false){

emailID.value=""

emailID.focus()

return false

}

if((frm.Month.value=="")||(frm.Day.value=="")||(frm.Year.value==""))

{

alert("Date of Birth is not valid !");

frm.Month.focus();

return false;

}

if(frm.WorkExperience.value=="")

{

alert("Work Experience field is empty !");

frm.WorkExperience.focus();

return false;

}

if(frm.Qualification.value=="")

{

alert("Qualification field is empty !");

frm.Qualification.focus();

return false;

}


if(frm.attachresume.value=="")

{

alert("Please Attach your Resume !");

frm.attachresume.focus();

return false;

}

var x=frm.attachresume.value;
len = x.length
rs = 0
for (i = len; i > 0; i--) {
vb = x.substring(i,i+1)
if (vb == "." && rs == 0) {
p=x.substring(i+1,len)

if((p=="doc") || (p=="txt") || (p=="odt") || (p=="rtf") || (p=="Doc") || (p=="Txt") || (p=="Tdt") || (p=="Rtf") || (p=="DOC") || (p=="TXT") || (p=="ODT") || (p=="RTF"))
{
return true;
}
else
{
alert("Please uploads a file having extension of.doc, .txt, .rtf or .odt only!");
frm.attachresume.focus();
return false;
}
rs = 1
}
}
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
}
