// JavaScript Document

// Validation
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)
{
	//alert("dfgfdg");
if (emptyvalidation(name,"Error! Please type in your Name!")==false) {name.focus(); return false;}
if (emptyvalidation(email,"Error! Please type in your Email Address!")==false) {email.focus(); return false;}
if (emailvalidation(email,"Error! Please provide with your valid Email Address!")==false) {email.focus(); return false;}
if (emptyvalidation(comments,"Error! Please type in your comments!")==false) {comments.focus(); return false;}
if (emptyvalidation(code_check,"Error! Please type in the code as in image!")==false) {code_check.focus(); return false;}
else
{
	document.contactus.submit();
}
}
}


function formvalidation2(thisform)
{
with (thisform)
{
	//alert("dfgfdg");
if (emptyvalidation(name,"Error! Please type in your Name!")==false) {name.focus(); return false;}
if (emptyvalidation(email,"Error! Please type in your Email Address!")==false) {email.focus(); return false;}
if (emailvalidation(email,"Error! Please provide with your valid Email Address!")==false) {email.focus(); return false;}
if (emptyvalidation(phone,"Error! Please type in Phone No.!")==false) {phone.focus(); return false;}
if (emptyvalidation(date,"Error! Please type in Date Of Event!")==false) {date.focus(); return false;}
if (emptyvalidation(people,"Error! Please type in No. Of People!")==false) {people.focus(); return false;}
if (emptyvalidation(budget,"Error! Please type in Budget!")==false) {budget.focus(); return false;}
if (emptyvalidation(menu,"Error! Please type in Menu Ideas!")==false) {menu.focus(); return false;}
if (emptyvalidation(comments,"Error! Please type in your comments!")==false) {comments.focus(); return false;}
if (emptyvalidation(code_check,"Error! Please type in the code as in image!")==false) {code_check.focus(); return false;}
else
{
	document.catering.submit();
}
}
}

