function submitIt(fcastform) {
//	alert ("In the javascript");
	
	if ((fcastform.fname.value == "") || (fcastform.lname.value == "")) {
		alert ("You must enter your first and last names");
		return false;
	}
	if  (fcastform.org.value == "")  {
		alert ("You must enter your organization");
		return false;
	}
	if  (fcastform.addr1.value == "")  {
		alert ("You must enter your address");
		return false;
	}
	if  (fcastform.city.value == "")  {
		alert ("You must enter your city");
		return false;
	}
	if  (fcastform.stateprov.value == "")  {
		alert ("You must enter your state or province");
		return false;
	}
	if  (fcastform.pcode.value == "")  {
		alert ("You must enter your postal code");
		return false;
	}
			
	if  (fcastform.email.value == "")  {
		alert ("You must enter a valid Email Address");
		return false;
	}
	//validEmail(fcastform.email);


// verify member id is filled in if member box is checked.

	for (i=0; i<fcastform.reg_type.length; i++) {
			if (fcastform.reg_type[i].checked) {
				whichReg = fcastform.reg_type[i].value;
			} // if
	} // for
		
	if ((whichReg == "M")||(whichReg == "S")) { 
		 if (fcastform.membid.value.length == 0) {
			alert ("You must enter a Member ID");
			fcastform.membid.focus();
			return false;
		 }
	}

// verify memberid is NOT filled in for non-member	
//	if ((whichReg == "R")||(whichReg == "N") || (whichReg == "SR")||(whichReg == "SN")) { 
//		 if (fcastform.membid.value.length != 0) {
//			alert ("The Member ID must not be filled in for non-members");
//			fcastform.membid.focus();
//			return false;
//		 }
//	}
// Gala event must be numeric
   var strValidChars = "0123456789";
   var strChar;


   //  test strString consists of valid characters listed above
   for (i = 0; i < fcastform.galatix.value.length; i++)
      {
      strChar = fcastform.galatix.value.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 alert ("Number of Gala Tickets must be numeric");
         return false;
         }
      }
	  

	 // alert (fcastform.galatix.value);
	  if (fcastform.galatix.value > 1) 
	  {
		  alert ("You cannot purchase more than 1 ticket at the $25 price");
          return false;
	  }
	  
	     //  test strString consists of valid characters listed above
   	for (i = 0; i < fcastform.galatix100.value.length; i++)
      {
      strChar = fcastform.galatix100.value.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 alert ("Number of $100 Gala Tickets must be numeric");
         return false;
         }
      }
	  
	  for (i = 0; i < fcastform.veg.value.length; i++)
      {
      strChar = fcastform.veg.value.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 alert ("Number of vegetarian dinners must be numeric");
         return false;
         }
      }
	  	  
	  if (fcastform.veg.value > fcastform.galatix100.value  + fcastform.galatix.value) 
	  {
		  alert ("Too many vegetarian dinners for order");
		  return false;
	  }

	  
// Student accommodations must be numeric if entered
   var strValidChars = "0123456789";
   var strChar;

      //  test strString consists of valid characters listed above
   for (i = 0; i < fcastform.studacc.value.length; i++)
      {
      strChar = fcastform.studacc.value.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 alert ("Number of nights must be numeric");
         return false;
         }
      }
   	
	if (fcastform.studacc.value > 5) {
		alert ("Number of nights must be < 6");
         return false;
	}
	return true;
}


function validEmail(eml) {
	invalidChars = " /;,:"
	//alert(eml.value);
	
	if  (eml.value == "")  {
		alert ("You must enter a valid Email Address");
		eml.focus();
		return false;
	}
	 for (i=0; i<invalidChars.length; i++) {
	 	badChar = invalidChars.charAt(i)
		if (eml.value.indexOf(badChar,0) > -1) { 
			alert ("You must enter a valid Email Address");
			eml.focus();
			return false
		}
	 } // end for
	atPos = eml.value.indexOf("@",1)
	if (atPos == -1) {
		alert ("You must enter a valid Email Address");
		eml.focus();
		return false;
	}
	if (eml.value.indexOf("@",atPos+1) > -1)  {
		alert ("You must enter a valid Email Address");
		eml.focus();
		return false;
	}
	periodPos = eml.value.indexOf(".",atPos)
	if (periodPos == -1) {
		alert ("You must enter a valid Email Address");
		eml.focus();
		return false;
	}
	if (periodPos+3 > eml.value.length) {
		alert ("You must enter a valid Email Address");
		eml.focus();
		return false;
	}
	return true;
}

function validMember(form2) {
	// verify member id is filled in if member box is checked.
//
	whichReg = -1;
	
	for (i=0; i<form2.reg_type.length; i++) {
			if (form2.reg_type[i].checked) {
				whichReg = form2.reg_type[i].value;
			} // if
	} // for

	if ((whichReg == "M")||(whichReg == "S")) { 
		if (form2.membid.value.length == 0) {
			alert ("You must enter a Member ID");
			form2.membid.focus();
			return false;
		}
	}
	
	return true;
}

