/* 08/02/2005; to open a hyperlink in a new browser window */
function popupLink(hyperLink) {
   if (! window.focus)return true;
   var href;
   if (typeof(hyperLink) == 'string')
      href=hyperLink;
   else
      href=hyperLink.href;
   window.open(href, '', 'width=' + window.width + ',height=' + window.height + ',scrollbars=yes');
}

/* 02/19/2006; to assign years to a <SELECT> (or dropdown) control */
function assignYearsToDropDown(selectList) {

   var aYear;

   /* to get the current 4-digit (or 2000-compliant) Year */
   var d = new Date();
   var currYear = d.getFullYear();

   /* replace existing text and values with Years */
   for (i = 0; i<10; i++) {
     aYear = currYear + i;
     selectList.options[i].text = aYear;
     selectList.options[i].value = aYear;
   }
}

/* 02/28/2006; to validate the user entry on the Request A Quote page */
function validateRequestAQuote(raqForm) {
   
   var fldName = "";
   var fld;
   
   if (raqForm.GroupName.value == "" || raqForm.GroupName.value == null) {
      fldName = "Group Name";
      fld = raqForm.GroupName;
   }
   else if (raqForm.Name.value == "" || raqForm.Name.value == null) {
      fldName = "Contact Name";
      fld = raqForm.Name;
   }
   else if (raqForm.Address.value == "" || raqForm.Address.value == null) {
      fldName = "Address";
      fld = raqForm.Address;
   }
   else if (raqForm.City.value == "" || raqForm.City.value == null) {
      fldName = "City";
      fld = raqForm.City;
   }
   else if (raqForm.State.value == "" || raqForm.State.value == null) {
      fldName = "State / Province";
      fld = raqForm.State;
   }
   else if (raqForm.Zip.value == "" || raqForm.Zip.value == null) {
      fldName = "Postal Code";
      fld = raqForm.Zip;
   }
   else if (raqForm.Phone.value == "" || raqForm.Phone.value == null) {
      fldName = "Phone #1";
      fld = raqForm.Phone;
   }
   else if (raqForm.Email.value == "" || raqForm.Email.value == null) {
      fldName = "Email #1";
      fld = raqForm.Email;
   }
   else if (raqForm.GroupSize.value == "" || raqForm.GroupSize.value == null) {
      fldName = "Group Size";
      fld = raqForm.GroupSize;
   }
   
   if (fldName != "") {
      alert(fldName + " is a required field.");
      fld.focus();
      return false;
   }
   
   return true;
   
}

/* 03/17/2006; to validate the user entry on the Contact Us page */
function validateContactUs(cuForm) {
   
   var fldName = "";
   var fld;
   
   if (cuForm.Name.value == "" || cuForm.Name.value == null) {
      fldName = "Name";
      fld = cuForm.Name;
   }
   else if (cuForm.Email.value == "" || cuForm.Email.value == null) {
      fldName = "Email";
      fld = cuForm.Email;
   }
   
   if (fldName != "") {
      alert(fldName + " is a required field.");
      fld.focus();
      return false;
   }
   
   return true;
   
}

/* 11/15/2008; to validate the user entry on the Charter Bus Registration Form page */
function validateCharterBusRegForm(cbrForm) {
   
   var fldName = "";
   var fld;
   
   if (cbrForm.CompanyName.value == "" || cbrForm.CompanyName.value == null) {
      fldName = "Company Name";
      fld = cbrForm.CompanyName;
   }
   else if (cbrForm.Name.value == "" || cbrForm.Name.value == null) {
      fldName = "Contact Name";
      fld = cbrForm.Name;
   }
   else if (cbrForm.Address.value == "" || cbrForm.Address.value == null) {
      fldName = "Address";
      fld = cbrForm.Address;
   }
   else if (cbrForm.City.value == "" || cbrForm.City.value == null) {
      fldName = "City";
      fld = cbrForm.City;
   }
   else if (cbrForm.State.value == "" || cbrForm.State.value == null) {
      fldName = "State / Province";
      fld = cbrForm.State;
   }
   else if (cbrForm.Zip.value == "" || cbrForm.Zip.value == null) {
      fldName = "Postal Code";
      fld = cbrForm.Zip;
   }
   else if (cbrForm.Phone.value == "" || cbrForm.Phone.value == null) {
      fldName = "Phone #1";
      fld = cbrForm.Phone;
   }
   else if (cbrForm.Email.value == "" || cbrForm.Email.value == null) {
      fldName = "Email #1";
      fld = cbrForm.Email;
   }
   else if (cbrForm.EIN.value == "" || cbrForm.EIN.value == null) {
      fldName = "EIN";
      fld = cbrForm.EIN;
   }
   else if (cbrForm.NbrOfBuses.value == "" || cbrForm.NbrOfBuses.value == null) {
      fldName = "Nbr of Buses";
      fld = cbrForm.NbrOfBuses;
   }
   else if (cbrForm.InsuranceProvider.value == "" || cbrForm.InsuranceProvider.value == null) {
      fldName = "Insurance Provider";
      fld = cbrForm.InsuranceProvider;
   }
   
   if (fldName != "") {
      alert(fldName + " is a required field.");
      fld.focus();
      return false;
   }
   
   return true;
   
}

