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<2 || lastpos-dotpos<2)
	{
		if (alertbox) 
			{
			 alert(alertbox);
			 } 
			return false;
		}
else {
	return true;
	}
}
}

function valuevalidation(entered, min, max, alertbox, datatype)
{
// Value 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)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
}
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function digitvalidation(entered, min, max, alertbox, datatype)
{
// Digit 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)
{
checkvalue=parseFloat(value);
if (datatype)
{
	smalldatatype=datatype.toLowerCase();
	if (smalldatatype.charAt(0)=="i")
	{
		checkvalue=parseInt(value); 
		if (value.indexOf(".")!=-1) 
			{
				checkvalue=checkvalue+1
			}
	};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function emptyvalidation(entered, alertbox)
{
// Emptyfield 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)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function formvalidation2(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
	
	with (thisform)
	{
		
		
	if (emptyvalidation(name,"Name field must not be empty.")==false)
		{
			name.focus();
			return false;
		};
		
	if (emailvalidation	(email,"Not a valid email.")==false) 
		{
			email.focus(); 
			return false;
		};
		
	if (emptyvalidation(comments,"Please put a service.")==false)
		{
			comments.focus();
			return false;
		};
		
		if (emptyvalidation(timeframe,"Please put a timeframe.")==false)
		{
			timeframe.focus();
			return false;
		};
	
	
	}
	
	
}

function formvalidation(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	with (thisform)
	{
		
		
	if (emptyvalidation(name,"Name field must not be empty.")==false)
		{
			name.focus();
			return false;
		};
		
	if (emailvalidation	(email,"Not a valid email.")==false) 
		{
			email.focus(); 
			return false;
		};
		
	if (emptyvalidation(comments,"Don't leave the comments box blank.")==false)
		{
			comments.focus();
			return false;
		};
		
			
	
	}
	
	
}
//place an order form validation
function formvalidation3(thisform){
	
	with (thisform)
	{
	
	
	if (emailvalidation	(email,"Not a valid email.")==false) 
		{
			email.focus(); 
			return false;
		};
		
	if (emptyvalidation(numofguests,"Please enter a value for the number of guests.")==false)
		{
			numofguests.focus();
			return false;
		};
	}
	
}

function validate_radiobox (entered, alertbox)
{
	course=false;
	
	with (entered)
	{
		i=0;
		for (i=0;i<entered.length;i++) 
		{
		if (entered[i].checked) 
			course=true;
			
		}
		if (!course) {
				if (alertbox) 
				{
				 alert(alertbox);
				 } 
				return false;
			}
		else {
		return true;
		}
	}


}