

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(name,"Error ! You must type your Full Name !")==false) {name.focus(); return false;}
if (emptyvalidation(phone,"Error ! You must type your Phone !")==false) {phone.focus(); return false;}
if (emptyvalidation(booking,"Error ! You must type Booking date !")==false) {booking.focus(); return false;}
if (emptyvalidation(comment,"Error ! You must type your Comments !")==false) {comments.focus(); return false;}
if (emptyvalidation(email,"Error ! You must type your Email Address !")==false || emailvalidation(email,"Error ! Please provide with your valid Email Address !")==false) {email.focus(); return false;}
if (emptyvalidation(security_code,"Error ! You must type the code shown !")==false) {security_code.focus(); return false;}
//if (emailvalidation(email,"Error ! Please provide with your valid Email Address !")==false) {email.focus(); return false;}


else
{
	document.thisform.mail_sent();
}

}
} 





