	function isEmail(str) {
			
		var filter=/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
		
		str = trim(str);

		if (!(filter.test(str)))
		{
			return (false); 
		}

		return (true);

	}
											
	function ValidateDemoForm(theForm)
	{
	
	if (trim(theForm.first_name.value) == "")
		{
		alert("Please enter your first name.");
		theForm.first_name.focus();
		return (false);
		}
							
	if (trim(theForm.last_name.value) == "")
		{
		alert("Please enter your last name.");
		theForm.last_name.focus();
		return (false);
		}
		

	if (!(isEmail(theForm.email.value)))
	{
		alert("Please enter a valid email address.");
		theForm.email.focus();
		return (false);
	}

	if (trim(theForm.commment.value) == "")
		{
		alert("Please enter your Story.");
		theForm.last_name.focus();
		return (false);
		}
		

	/**** 4/26/07 - gms - removed to accomodate international zip codes that have varying lengths
	
	if ((theForm.zip.value.length != 5) && (theForm.zip.value.length != 10)){
		alert("Please use a 5 or 10 digit zip code. (eg. 53703 or 53703-4208)");
		theForm.zip.focus();
		return (false);
		}
	*/
	  					  		
	
	
		return (true);
	}
	
	/***** 10/5/07 - gms - functions to trim input values ********************/
	
	function ltrim(str) { 
		for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
		return str.substring(k, str.length);
	}
	
	function rtrim(str) {
		for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
		return str.substring(0,j+1);
	}
	
	function trim(str) {
		return ltrim(rtrim(str));
	}
	
	function isWhitespace(charToCheck) {
		var whitespaceChars = " \t\n\r\f";
		return (whitespaceChars.indexOf(charToCheck) != -1);
	}