

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 




function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 





function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(full_name,"Error ! Please type in your Name !")==false) {full_name.focus(); return false;}
if (emptyvalidation(email,"Error ! Please type in your Email Address !")==false || emailvalidation(email,"Error ! Please provide with your valid Email Address !")==false) {email.focus(); return false;}
if (emptyvalidation(phone,"Error ! Please type in your phone number !")==false) {phone.focus(); return false;}


if (emptyvalidation(comments,"Error ! Please type in Your Comments !")==false) {comments.focus(); return false;}




else
{
	document.contact.submit();
}

}
} 

function formvalidation2(thisform)
{
with (thisform)
{
if (emptyvalidation(surname,"Error ! Please type in your child's surname !")==false) {surname.focus(); return false;}
if (emptyvalidation(first_name,"Error ! Please type in your child's first name !")==false) {first_name.focus(); return false;}
if (emptyvalidation(dob,"Error ! Please type in your child's date of birth !")==false) {dob.focus(); return false;}
if (emptyvalidation(age_year,"Error ! Please type your child's age in year !")==false) {age_year.focus(); return false;}
if (emptyvalidation(address,"Error ! Please type in your Address !")==false) {address.focus(); return false;}
if (emptyvalidation(phone,"Error ! Please type in your phone number !")==false) {phone.focus(); return false;}
if (emptyvalidation(Sex,"Error ! Please type in your child's sex !")==false) {Sex.focus(); return false;}
if(document.application.monday.checked==false && document.application.tuesday.checked==false && document.application.wednesday.checked==false && document.application.thursday.checked==false && document.application.friday.checked==false) {alert("Please select the day/s"); return false;}
if (emptyvalidation(date_req,"Error ! Please type staring date of required care !")==false) {date_req.focus(); return false;}
if (emptyvalidation(mother_name,"Error ! Please type in child's mother name !")==false) {mother_name.focus(); return false;}
if (emptyvalidation(mother_occu,"Error ! Please type in mother's occupation !")==false) {mother_occu.focus(); return false;}
if (emptyvalidation(mother_no,"Error ! Please type in mother's contact no. !")==false) {mother_no.focus(); return false;}
if (emptyvalidation(father_name,"Error ! Please type in child's father name !")==false) {father_name.focus(); return false;}
if (emptyvalidation(father_occu,"Error ! Please type in father's occupation !")==false) {father_occu.focus(); return false;}
if (emptyvalidation(father_no,"Error ! Please type in father's contact no. !")==false) {father_no.focus(); return false;}
if (emptyvalidation(add_needs,"Error ! Please type in additional needs !")==false) {add_needs.focus(); return false;}




else
{
	document.contact.submit();
}

}
} 




