function submitform(frm)
{
if((frm.name.value=="")||(frm.name.value=="Name")||!isNaN(frm.name.value))
{
alert("Kindly fill in your Name!");
frm.name.focus();
return false;
}
else if(containsdigit(frm.name.value)==true)
{
alert("Name should not contain numbers!");
frm.name.focus();
return false;
}
else if(specialchar(frm.name.value)==true)
{
alert("Name should not contain special characters!")
frm.name.focus();
return false;
}

if((frm.surname.value=="")||(frm.surname.value=="surname")||!isNaN(frm.surname.value))
{
alert("Kindly fill in your Surname!");
frm.surname.focus();
return false;
}
else if(containsdigit(frm.surname.value)==true)
{
alert("Surname should not contain numbers!");
frm.surname.focus();
return false;
}
else if(specialchar(frm.surname.value)==true)
{
alert("Surname should not contain special characters!")
frm.surname.focus();
return false;
}

else if((frm.phoneno.value=='')||(frm.phoneno.value=='Res/Off Tel No.'))
{
alert("Kindly fill in your Mobile or Office Number(Numeric Only)!");
frm.phoneno.focus();
return false;
}
else if(containsalph(frm.phoneno.value)==true)
{
alert("Mobile or Office Tel should not contain characters!");
frm.phoneno.focus();
return false;
}

else if(frm.emailid.value=='')
{
alert("Kindly fill in your Email Id!");
frm.emailid.focus();
return false;
}
else if((frm.emailid.value!='') && (validateemailv2(frm.emailid.value)==false))
{
alert("Kindly fill in a valid Email Id!");
frm.emailid.focus();
return false;
}

else if(frm.conemailid.value=='')
{
alert("Kindly fill in your Confirm-Email Id!");
frm.conemailid.focus();
return false;
}
else if((frm.conemailid.value!='') && (validateemailv2(frm.conemailid.value)==false))
{
alert("Kindly fill in a valid Confirm-Email-Id!");
frm.conemailid.focus();
return false;
}
else if(frm['emailid'].value != frm['conemailid'].value) 
{
alert('Your Email-Id and Confirm-Email-Id do not match. Please check the email addresses provided.');
return false;
}

else if(frm.password.value=='')
{
alert("Kindly fill in your Password!");
frm.password.focus();
return false;
}
else if(frm.conpassword.value=='')
{
alert("Kindly fill in your Confirm-Password!");
frm.conpassword.focus();
return false;
}
else if(frm['password'].value != frm['conpassword'].value) 
{
alert('Your Password and Confirm-Password do not match. Please check the passwords provided.');
return false;
}

else if(frm.dd.value=="0")
{
alert("Kindly select your Date!");
frm.dd.focus();
return false;
}
else if(frm.mm.value=="0")
{
alert("Kindly select your Month!");
frm.mm.focus();
return false;
}
else if(frm.yyyy.value=="0")
{
alert("Kindly select your Year!");
frm.yyyy.focus();
return false;
}

else if((frm.live[0].checked==false)&&(frm.live[1].checked==false)&&(frm.live[2].checked==false)&&(frm.live[3].checked==false)&&(frm.live[4].checked==false)&&(frm.live[5].checked==false))
{
	alert("Kindly select your current location");
	frm.live[0].focus();
	return false;
}

else if(frm.prefcity.value=="")
{
alert("Kindly select your Preferred placement city with Teach For India!");
frm.prefcity.focus();
return false;
}
else if(frm.strtdate.value=="")
{
alert("Kindly select your Earliest possible start-date with Teach For India!");
frm.strtdate.focus();
return false;
}

else if((frm.final1.checked==false)&&(frm.final2.checked==false)&&(frm.final3.checked==false)&&(frm.final5.checked==false))
{
alert("Kindly select your Professional Status!");
frm.final1.focus();
return false;
}

else if(frm.curinscollege.value=="nil")
{
alert("Kindly select your Current Institution.");
frm.curinscollege.focus();
return false;
}
else if(frm.curinscollege.value=="other" && ((frm.othercurrinst.value=="")))
{
		alert("Kindly fill in your Other Current Institution!");
		frm.othercurrinst.focus();
		return false;

}
else if(frm.curinscollege.value=="other" && (containsdigit(frm.othercurrinst.value)==true))
{
		alert("Other Current Institution should not contain numbers!");
		frm.othercurrinst.focus();
		return false;
}
else if(frm.curinscollege.value=="other" && (specialchar(frm.othercurrinst.value)==true))
{
		alert("Other Current Institution should not contain special characters!")
		frm.othercurrinst.focus();
		return false;
}
else if(frm.currcity.value=="")
{
alert("Kindly select your Current City.");
frm.currcity.focus();
return false;
}



else if(frm.currcity.value=="other" && ((frm.othercurrcity.value=="")))
{
		alert("Kindly fill in your Other Current City!");
		frm.othercurrcity.focus();
		return false;

}
else if(frm.currcity.value=="other" && (containsdigit(frm.othercurrcity.value)==true))
{
		alert("Other Current City should not contain numbers!");
		frm.othercurrcity.focus();
		return false;
}
else if(frm.currcity.value=="other" && (specialchar(frm.othercurrcity.value)==true))
{
		alert("Other Current City should not contain special characters!")
		frm.othercurrcity.focus();
		return false;
}







else if((frm.curjob[0].checked==false)&&(frm.curjob[1].checked==false)&&(frm.curjob[2].checked==false))
{
	alert("Kindly check the field I manage others at my current job");
	frm.curjob[0].focus();
	return false;
}

else if((frm.ledstudent[0].checked==false)&&(frm.ledstudent[1].checked==false))
{
	alert("Kindly check I am a leader at a student, extra-curricular or volunteer organization");
	frm.ledstudent[0].focus();
	return false;
}

else if((frm.percent[0].checked==false)&&(frm.percent[1].checked==false)&&(frm.percent[2].checked==false)&&(frm.percent[3].checked==false)&&(frm.percent[4].checked==false))
{
	alert("Kindly check Marks on 12th Board exam(if I studied in India) or cumulative GPA for 10th through 12th grade");
	frm.percent[0].focus();
	return false;
}

else if((frm.contactdetails[0].checked==false)&&(frm.contactdetails[1].checked==false))
{
	alert("Kindly check I have already submitted my contact details to Teach For India at a campus/corporate presentation/event/other location");
	frm.contactdetails[0].focus();
	return false;
}
else if(frm.intersted.checked==false)
{
//	var dd=frm.intersted.checked

alert("Kindly check I am interested in applying to the two-year, full-time Teach For India Fellowship");
return false;
}

else {
frm.submit();
}
}

function foundstdcode(param)
{temp = new String(param);phone = temp.substr(0,1);
if(phone==9) // || phone==9)
{return true;}
else{return false;
}
}
function check(obj)
{
//alert(Form.live[0].checked);
	document.frmsubmit.live[0].checked=false;
	document.frmsubmit.live[1].checked=false;
	document.frmsubmit.live[2].checked=false;
	document.frmsubmit.live[3].checked=false;
	document.frmsubmit.live[4].checked=false;
	document.frmsubmit.live[5].checked=false;
						
	obj.checked=true;
						
}

function professinalstatus()
{
//alert(Form.live[0].checked);
	//alert("hi");
	//if(document.frmsubmit.final3.checked==true && document.frmsubmit.final1.checked==false&&document.frmsubmit.final2.checked==false&& document.frmsubmit.final4.checked==false )
	if(document.frmsubmit.final4.checked==true)
	{
		
		alert("To be eligible to join Teach For India in 2010, you must finish all of the coursework required for your undergraduate degree. You may not be eligible to join Teach For India!");
		document.frmsubmit.final4.checked=false; 
		
	}
						
}

function currentjob(obj)
{
//alert(Form.live[0].checked);
	document.frmsubmit.curjob[0].checked=false;
	document.frmsubmit.curjob[1].checked=false;
	document.frmsubmit.curjob[2].checked=false;
							
	obj.checked=true;
						
}

function leaderstudent(obj)
{
//alert(Form.live[0].checked);
	document.frmsubmit.ledstudent[0].checked=false;
	document.frmsubmit.ledstudent[1].checked=false;
							
	obj.checked=true;
						
}

function percentage(obj)
{
//alert(Form.live[0].checked);
	document.frmsubmit.percent[0].checked=false;
	document.frmsubmit.percent[1].checked=false;
	document.frmsubmit.percent[2].checked=false;
	document.frmsubmit.percent[3].checked=false;
	document.frmsubmit.percent[4].checked=false;	
						
	obj.checked=true;
						
}

function contact(obj)
{
//alert(Form.live[0].checked);
	document.frmsubmit.contactdetails[0].checked=false;
	document.frmsubmit.contactdetails[1].checked=false;
							
	obj.checked=true;
						
}
function Otherstextbox(val)
{
	//alert(val);
	if(val=="Other")
	{
		if(document.getElementById("tt").style.display =="none")
		{
			document.getElementById("tt").style.display =""
		}
		
	}
	else
	{
		document.getElementById("tt").style.display ="none";
	}
	
}
function containsdigit(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)=="0") || (param.charAt(i)=="1") || (param.charAt(i)=="2") || (param.charAt(i)=="3") || (param.charAt(i)=="4") || (param.charAt(i)=="5") || (param.charAt(i)=="6") || (param.charAt(i)=="7") || (param.charAt(i)=="8") || (param.charAt(i)=="9"))
{
return true;
}
}
return false;
}

function specialchar(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)==".") || (param.charAt(i)=="'")||(param.charAt(i)=="/")||(param.charAt(i)=="*")||(param.charAt(i)=="#")||(param.charAt(i)=="$")||(param.charAt(i)=="%")||(param.charAt(i)=="@")||(param.charAt(i)=="!"))
{return true;}
}return false;}

function validateemailv2(email)
{
// a very simple email validation checking.
// you can add more complex email checking if it helps
var splitted = email.match("^(.+)@(.+)$");
if(splitted == null) return false;
if(splitted[1] != null )
{
var regexp_user=/^\"?[\w-_\.]*\"?$/;
if(splitted[1].match(regexp_user) == null) return false;
}
if(splitted[2] != null)
{
var regexp_domain=/^[\w-\.]*\.[a-za-z]{2,4}$/;
if(splitted[2].match(regexp_domain) == null)
{
var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
if(splitted[2].match(regexp_ip) == null) return false;
}
return true;
}
return false;
}
function containsalph(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)<"0")||(param.charAt(i)>"9"))
{
return true;
}
}
return false;
}
function Trim(strValue) {
var j=strValue.length-1;i=0;
while(strValue.charAt(i++)==' ');
while(strValue.charAt(j--)==' ');
return strValue.substr(--i,++j-i+1);
}

