/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_form(thisform)
{
	with (thisform)
	  {
		  if (validate_required(fname,"First Name must be filled out!")==false)
		  {fname.focus();return false;}	

		
		  if (validate_required(lname,"Last Name must be filled out!")==false)
		  {lname.focus();return false;}	
		  
		  if (validate_required(address,"Address must be filled out!")==false)
		  {address.focus();return false;}	
		  
		  if (validate_required(city,"City must be filled out!")==false)
		  {city.focus();return false;}	

		  if (validate_required(email,"Email must be filled out!")==false)
		  {email.focus();return false;}	

		  if (validate_email(email,"Not a valid e-mail address!!")==false)
		  {email.focus();return false;}

				 
		  if (validate_required(comment,"Your Message must be filled out!")==false)
		  {comment.focus();return false;}

		 // if (validate_required(phone,"Phone must be filled out!")==false)
//		  {phone.focus();return false;}
	  }
}

function validate_email(field,alerttxt)
{
	with (field)
	  {
	  apos=value.indexOf("@");
	  dotpos=value.lastIndexOf(".");
	  if (apos<1||dotpos-apos<2)
	    {alert(alerttxt);return false;}
	  else {return true;}
	  }
}

