// JavaScript Document

function emptyvalidation(entered, alertbox) {

with (entered)
{
if (value==null || value=="0")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 

function emptytextvalidation(entered, alertbox) {

with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 

function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
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 (emptytextvalidation(name,"Please enter your name")==false) {name.focus(); return false;};
if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
if (emptytextvalidation(subject,"Please enter your subject")==false) {message.focus(); return false;};
if (emptytextvalidation(message,"Please enter your message")==false) {message.focus(); return false;};

/*if (emptytextvalidation(arrival_date,"Please enter an Arrival Date")==false) {arrival_date.focus(); return false;};
if (emptytextvalidation(departure_date,"Please enter a Departure Date")==false) {name.focus(); return false;};
if (emptyvalidation(room_type,"Please choose a Room Type")==false) {room_type.focus(); return false;};
if (emptyvalidation(including,"Please choose Including")==false) {including.focus(); return false;};*/

}
}