// JavaScript Document

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;}
  }
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function validate_form(thisform)
{
with (thisform)
  {
	if (name.value == "" )
    {
        alert ( "Please fill in the 'Name' box." );
		name.focus();
        return false;
    }
	if (last_name.value == "" )
    {
        alert ( "Please fill in the 'Last Name' box." );
		last_name.focus();
        return false;
    }
	if (validate_email(email,"Not a valid e-mail address!")==false)
	{
		email.focus();
		return false;
	}
	if (month.value == 0 )
	{
		alert ("Please select your Date of Birth");
		month.focus();
		return false;
	}
	if (day.value == 0 )
	{
		alert ("Please select your Date of Birth");
		day.focus();
		return false;
	}
	if (year.value == 0 )
	{
		alert ("Please select your Date of Birth");
		year.focus();
		return false;
	}
	if (question_message.value == "" )
    {
        alert ( "Please enter your Question or Message" );
		question_message.focus();
        return false;
    }
	if (agree.checked == false ){
		alert ( "You have to agree 'Terms of Use'" );
		agree.focus();
		return false;
	}
	
	}
}
