var numberRows

function otherStateCheck() {
   vState = document.request.StateProvince;
   if ( vState.selectedIndex != -1 && vState.options[vState.selectedIndex].value == 'OTHER' ) {
		toggleLayer('otherStateDiv');
      return false;
   }
	return true;
}
function toggleLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function DataValidation() {
   if (document.request.ProdKey.value == "1" && !document.request.WhichProduct[0].checked && !document.request.WhichProduct[1].checked && !document.request.WhichProduct[2].checked) {
      alert("Please specify which BIP product you would like training for.");
      return false;
   }
   if (document.request.ProdKey.value == "2" && !document.request.WhichProduct[0].checked && !document.request.WhichProduct[1].checked && !document.request.WhichProduct[2].checked) {
      alert("Please specify which BBAS product you would like training for.");
      return false;
   }
   if (document.request.ProdKey.value == "5" && !document.request.WhichProduct[0].checked && !document.request.WhichProduct[1].checked) {
      alert("Please specify which RCL product you would like training for.");
      return false;
   }
   attCount = 0;
   for ( i = 0; i <=9; i++ ) {
     firstNameValue = document.request.attFirstName[i].value;
     lastNameValue = document.request.attLastName[i].value;
	  mailValue = document.request.attMail[i].value;
	  jobValue = document.request.attJob[i].value;
	  if ( firstNameValue != "" && lastNameValue != "" && mailValue != "" && jobValue != "" ) {
	     attCount = attCount + 1;
	  }
      if ( firstNameValue != "" && ( lastNameValue == "" || mailValue == "" || jobValue == "" ) ) {
         alert("Please supply full information for each attendee.");
         return false;
	  }
   }
   if ( attCount < 1 ) {
      alert("Please supply at least one attendee.");
      return false;
   }
   if (document.request.FirstName.value == "") {
      alert("Please supply your first name.");
      return false;
   }
   if (document.request.LastName.value == "") {
      alert("Please supply your last name.");
      return false;
   }
   if (document.request.Title.value == "") {
      alert("Please supply your job title.");
      return false;
   }
   if (document.request.CompanyName.value == "") {
      alert("Please supply your institution name.");
      return false;
   }
   vInstType = document.request.CompanyType;
   if ( vInstType.selectedIndex != -1 && vInstType.options[vInstType.selectedIndex].value == '' ) {
      alert("Please supply your institution type.");
      return false;
   }
   if (document.request.Street1.value == "") {
      alert("Please supply your street address.");
      return false;
   }
   if (document.request.City.value == "") {
      alert("Please supply a city.");
      return false;
   }
   if (document.request.StateProvince.value == "") {
      alert("Please supply a state/province.");
      return false;
   }
   if (document.request.PostalCode.value == "") {
      alert("Please supply a zip/postal code.");
      return false;
   }
   vCountry = document.request.CountryName;
   if ( vCountry.selectedIndex != -1 && vCountry.options[vCountry.selectedIndex].value == '' ) {
      alert("Please supply a country/region.");
      return false;
   }
   if (document.request.PhoneVoiceNumber.value == "") {
      alert("Please supply your phone number.");
      return false;
   }
   if (document.request.EmailAddress.value == "") {
      alert("Please supply your valid email address.");
      return false;
   }
   return true;
}

function buildAttend(numRows) {
	if ( numRows == 0 ) { numRows = 5; }
	for ( i = 1; i <= numRows; i++ ) {
		var attRow = "<TR ALIGN=left VALIGN=middle>";
		attRow = attRow + "<TD NOWRAP>";
		attRow = attRow + i + ". &nbsp;</TD>";
		attRow = attRow + "<TD HEIGHT=35 NOWRAP><INPUT NAME='attFirstName' TYPE=text SIZE=15>&nbsp;</TD>";
		attRow = attRow + "<TD HEIGHT=35 NOWRAP><INPUT NAME='attLastName' TYPE=text SIZE=15>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>";
		attRow = attRow + "<TD HEIGHT=35 NOWRAP><INPUT NAME='attMail' TYPE=text SIZE=25>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>";
		attRow = attRow + "<TD HEIGHT=35 NOWRAP><INPUT NAME='attJob' TYPE=text SIZE=25></TD></TR>";
		document.write(attRow);
	}
}

function howlongAction(prod) {
	subVar = eval('window.document.request.' + prod + '_sub');
	howlongVar = eval('window.document.request.' + prod + '_howlong');
	staffVar = eval('window.document.request.' + prod + '_staff');
	if ( howlongVar.value > 0 ) {
		subVar.checked = true;
	} else if (staffVar.value < 1 ) {
		subVar.checked = false;
	}
}

function staffAction(prod) {
	subVar = eval('window.document.request.' + prod + '_sub');
	howlongVar = eval('window.document.request.' + prod + '_howlong');
	staffVar = eval('window.document.request.' + prod + '_staff');
	if ( staffVar.value > 0 ) {
		subVar.checked = true;
	} else if (howlongVar.value < 1 ) {
		subVar.checked = false;
	}
}
