// JavaScript Document
whitespace = "\t \n\r";
function isEmptyString(s)
   {
   	var i;
  	if((s == null) || (s.length == 0)) return true;
  	for(i=0;i < s.length;i++)
  	{
  		var currchar = s.charAt(i);
  		if(whitespace.indexOf(currchar) == -1) return false;
  	}
      return true;
   }
   
function isEmail(n)
{
		if ((n==null) || (n.length==0))
		{
			return true;
		}
		if (isEmptyString(n)) return false;
		var i=1;
		var nLength=n.length;
		while((parseInt(i) < parseInt(nLength)) && (n.charAt(parseInt(i)) != '@'))
		{
			i++;
		}
		if ((parseInt(i) >= parseInt(nLength)) || (n.charAt(i)!="@"))
		{
			return false;	
		}	
		else i+=2;
		while((i<nLength) && (n.charAt(i)!="."))
		{
			i++;
		}
		if ((i>=nLength-1) || (n.charAt(i)!="."))
		{
			return false;	
		}	
		else return true;		
}

function checkForm()
{
	 
	if (isEmptyString(document.send.parentsname.value))
{
alert("Parents Name should not be blank");
document.send.parentsname.value="";
document.send.parentsname.focus();
return false;
}
	if (isEmptyString(document.send.address.value))
{
alert("Address should not be blank");
document.send.address.value="";
document.send.address.focus();
return false;
}
	if (isEmptyString(document.send.city.value))
{
alert("City should not blank");
document.send.city.value="";
document.send.city.focus();
return false;
}
	if (isEmptyString(document.send.state.value))
{
alert("State and/or Country should not be blank");
document.send.state.value="";
document.send.state.focus();
return false;
}
	if (isEmptyString(document.send.zip.value))
{
alert("Zip Code should not be blank");
document.send.zip.value="";
document.send.zip.focus();
return false;
}
	if (isEmptyString(document.send.homephone.value))
{
alert("Home Phone should not be blank");
document.send.homephone.value="";
document.send.homephone.focus();
return false;
}
if (isEmptyString(document.send.email.value))
{
alert("Email Address should not be blank");
document.send.email.value="";
document.send.email.focus();
return false;
}
if (!isEmail(document.send.email.value))
{
alert("Please enter the e-mail in correct format");
//document.form1.txt_email.value="";
document.send.email.focus();
return false;
}
	if (isEmptyString(document.send.childname.value))
{
alert("Child's Name Should not be blank");
document.send.childname.value="";
document.send.childname.focus();
return false;
}
	if (isEmptyString(document.send.birth.value))
{
alert("Date of Birth should not be blank");
document.send.birth.value="";
document.send.birth.focus();
return false;
}
	if (isEmptyString(document.send.age.value))
{
alert("Age should not be blank");
document.send.age.value="";
document.send.age.focus();
return false;
}
	 
 
if (send.gender[0].checked ==true || send.gender[1].checked==true )

send.action='thankyou.php';
else{
alert("Please select Gender");
return false;
}
 
 
	if (isEmptyString(document.send.grade.value))
{
alert("Current Grade should not be blank");
document.send.grade.value="";
document.send.grade.focus();
return false;
}
	if (isEmptyString(document.send.experience.value))
{
alert("Previous Camp Experience should not be blank");
document.send.experience.value="";
document.send.experience.focus();
return false;
}
	if (isEmptyString(document.send.childneeds.value))
{
alert("Tell Us Your Child's Needs should not be blank");
document.send.childneeds.value="";
document.send.childneeds.focus();
return false;
}
}