// <![CDATA[
function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.
if(WithoutContent(document.askTheChef.name.value))
	{ errormessage += "\n\nYou must enter your name."; }
if(WithoutContent(document.askTheChef.email.value))
	{ errormessage += "\n\nYou must enter a valid email."; }
if(WithoutContent(document.askTheChef.city.value))
	{ errormessage += "\n\nYou must enter your city."; }
if(WithoutContent(document.askTheChef.state.value))
	{ errormessage += "\n\nYou must enter your state."; }
if(WithoutContent(document.askTheChef.question.value))
	{ errormessage += "\n\nYou must type a question to ask the chef!"; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()

function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}
function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) { 	if(ss[i].length > 0) { return false; }
	}
return true;
}
function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}
function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {

for(var i = 0; i < ss.length; i++) { 	if(ss[i].selected) { 		if(ss[i].length) { return false; } 		} 	} return true; } function ValidateAll() { 	if(CheckEmail(document.askTheChef.email) == false) return false; 	return true; } function CheckEmail(s_email) { 	// developed by www.willmaster.com 	s_email = IsItPresent(s_email,'your email address'); 	if(! s_email) return false; 	var i = s_email.indexOf(' ',0); 	while(i> -1)

	{

		s_email = s_email.substring(0,i) +

			s_email.substring((i + 1),s_email.length);

		i = s_email.indexOf(' ',0);

	}

	document.askTheChef.email = s_email;

	if((s_email.length <6) ||

	   (s_email.indexOf('@',0) <1) || 	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) || 	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||

// Because domain name extensions now have varying lengths,

// the code to check for maximum of 3 characters after the final dot is disabled..//	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||

	   (s_email.lastIndexOf('.') < (s_email.length - 4)) || 	   (s_email.indexOf('..',0)> -1) ||

	   (s_email.indexOf('@.',0)> -1) ||

	   (s_email.indexOf('.@',0)> -1) ||

	   (s_email.indexOf(',',0)> -1))

	{

		alert('The email address "' + s_email + '" is not valid.');

		return false;

	}

	return true;

}
// ]]>
