//+++++++++++++ LIST OF FUNCTIONS +++++++++++++++
//+ buildCallShipperOptions                     +
//+ buildTimeOptions                            +
//+ CancelDefault                               +
//+ checkCube                                   +
//+ checkDimension                              +
//+ checkEmailRequired                          +
//+ ClearDefault                                +
//+ convertComma                                +
//+ EditAdditionalServices                      +
//+ EditCommodityInformation                    +
//+ EditCustInfo                                +
//+ EditOtherOptions                            +
//+ EditReferenceNumbers                        +
//+ EditRequesterInfo                           +
//+ EditShipmentSpecifics                       +
//+ EditTemplates                               +
//+ FormatOtherOptions                          +
//+ FormatSummary                               +
//+ hideElementsIE                              +
//+ initCallShipperOptions                      +
//+ initTimesList                               +
//+ objCallShipper                              +
//+ objTime                                     +
//+ openLocationWin                             +
//+ resyncEmail                                 +
//+ SetFocus                                    +
//+ showElementsIE                              +
//+ showUnitHelp                                +
//+ SubmitForm                                  +
//+ ValidateAdditionalServices                  +
//+ ValidateCommodityInformation                +
//+ ValidateCustInfo                            +
//+ ValidateOtherOptions                        +
//+ ValidateReferenceNumbers                    +
//+ ValidateRequesterInfo                       +
//+ ValidateShipmentSpecifics                   +
//+ ValidCommodities                            +
//+ ValidCommodityInfo                          +
//+ ValidContactInfo                            +
//+ ValidPartyInfo                              +
//+ ValidPronumber                              +
//+ ValidRefnos                                 +
//+ ValidRequesterAffiliation                   +
//+ ValidRequesterContactInfo                   +
//+ ValidShipDate                               +
//+ ValidTruckPackNumber                        +
//+++++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++ Global ++++++++++++++++++++
var shp = 0;
var con = 1;
var tpb = 2;
var objForm = null;
var frm;
var intMaxSteps = 7
var intTotalWeight;
var arrCallShipper = new Array();
var arrTimes = new Array();
var reInvalidChars = /[<>",\(\)\[\]\\;@]+/


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ buildCallShipperOptions                                             +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function buildCallShipperOptions(def)
{ for (var z = 0; z < arrCallShipper.length; z++)
   { if (arrCallShipper[z].opt == def)
      { document.writeln("<OPTION SELECTED=SELECTED VALUE='"+arrCallShipper[z].opt+"'>"+arrCallShipper[z].yesorno+"</OPTION>")
      }
      else
      { document.writeln("<OPTION VALUE='"+arrCallShipper[z].opt+"'>"+arrCallShipper[z].yesorno+"</OPTION>")
      }
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ buildTimeOptions                                                    +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function buildTimeOptions(def)
{ for (var z = 0; z < arrTimes.length; z++)
   { if (arrTimes[z].militaryTime == def)
      { document.writeln("<OPTION SELECTED=SELECTED VALUE='"+arrTimes[z].militaryTime+"'>"+arrTimes[z].civilianTime+"</OPTION>")
      }
      else
      { document.writeln("<OPTION VALUE='"+arrTimes[z].militaryTime+"'>"+arrTimes[z].civilianTime+"</OPTION>")
      }
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ CancelDefault                                                       +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function CancelDefault(frm)
{
   frm.FormAction.value = "CN";
   frm.submit();
   alert("Your default setting has been Canceled.");
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Check Cube                                                          +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkCube() {
   if ((objForm.txtCuft.value.length > 0) &&
       (isInteger(objForm.txtCuft.value)) &&
       (objForm.txtCuft.value > 0)) {
      objForm.txtLength.value = ""
      objForm.txtWidth.value = ""
      objForm.txtHeight.value = ""
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Check Dimension                                                     +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkDimension() {
   var intCubicFeet
   if ((objForm.txtLength.value.length > 0) &&
      (isInteger(objForm.txtLength.value))  &&
      (objForm.txtLength.value > 0)         &&
      (objForm.txtWidth.value.length > 0)   &&
      (isInteger(objForm.txtWidth.value))   &&
      (objForm.txtWidth.value > 0)          &&
      (objForm.txtHeight.value.length > 0)  &&
      (isInteger(objForm.txtHeight.value))  &&
      (objForm.txtHeight.value > 0))   {
      intCubicFeet = (objForm.txtLength.value) * (objForm.txtWidth.value) * (objForm.txtHeight.value)
      objForm.txtCuft.value = intCubicFeet }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Check Email Required                                                +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkEmailRequired(blnRequire,intSub) {
   var strNotRequired = "E-mail Address:&nbsp;"
   var strRequired = "E-mail Address*:&nbsp;"

   if (blnRequire) {
      eval('document.getElementById("txtCopyEmailLabel'+intSub+'")').innerHTML = '<FONT CLASS="pgTxtT">' + strRequired + '</FONT>'
   }
   else {
      eval('document.getElementById("txtCopyEmailLabel'+intSub+'")').innerHTML = '<FONT CLASS="pgTxtT">' + strNotRequired + '</FONT>'
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ClearDefault                                                        +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ClearDefault(frm)
{
   frm.FormAction.value = "CL";
   frm.submit();
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ convertComma                                                        +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function convertComma()
{
   //Convert commas in text boxes to ASCII character 255 ("ÿ") to
   //prevent problems with comma-delimited fields.  Convert back
   //to commas prior to saving information.
   var intCtr
   var objFormField
   var objRegExp = new RegExp(",","g")
   var strReplaced

   for (intCtr = 0; intCtr <= 2; intCtr++)
   {
      objFormField = new String(objForm.txtAcctName[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctName[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctNamePlus[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctNamePlus[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctAddr[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctAddr[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctCity[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctCity[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctZip[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctZip[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctContact[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctContact[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctPhone[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctPhone[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctPhoneExt[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctPhoneExt[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctFax[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctFax[intCtr].value = strReplaced

      objFormField = new String(objForm.txtAcctEMail[intCtr].value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtAcctEMail[intCtr].value = strReplaced
   }

   if (!document.getElementById("txtWeight1"))
   {
      objFormField = new String(document.getElementById("txtHandled0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtHandled0").value = strReplaced

      objFormField = new String(document.getElementById("txtPackages0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtPackages0").value = strReplaced

      objFormField = new String(document.getElementById("txtWeight0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtWeight0").value = strReplaced

      objFormField = new String(document.getElementById("txtItem0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtItem0").value = strReplaced

      objFormField = new String(document.getElementById("txtSub0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtSub0").value = strReplaced

      objFormField = new String(document.getElementById("txtCube0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtCube0").value = strReplaced

      objFormField = new String(document.getElementById("txtDescription0").value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      document.getElementById("txtDescription0").value = strReplaced
   }
   else
   {
      for (var intCtr = 0; intCtr < intCurItems; intCtr++)
      {
         objFormField = new String(eval('document.getElementById("txtHandled'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtHandled'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtPackages'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtPackages'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtWeight'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtWeight'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtItem'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtItem'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtSub'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtSub'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtCube'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtCube'+(intCtr)+'")').value = strReplaced

         objFormField = new String(eval('document.getElementById("txtDescription'+(intCtr)+'")').value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         eval('document.getElementById("txtDescription'+(intCtr)+'")').value = strReplaced
      }
   }

   objFormField = new String(objForm.txtSpecialInstructions.value)
   strReplaced = objFormField.replace(objRegExp, "ÿ")
   objForm.txtSpecialInstructions.value = strReplaced

   objFormField = new String(objForm.txtLinearFeet.value)
   strReplaced = objFormField.replace(objRegExp, "ÿ")
   objForm.txtLinearFeet.value = strReplaced

   objFormField = new String(objForm.txtBOLNumber.value)
   strReplaced = objFormField.replace(objRegExp, "ÿ")
   objForm.txtBOLNumber.value = strReplaced

   if (objForm.txtPONumber.length == null)
   {
      objFormField = new String(objForm.txtPONumber.value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtPONumber.value = strReplaced
   }
   else
   {
      for (var intCtr = 0; intCtr < objForm.txtPONumber.length; intCtr++)
      {
         objFormField = new String(objForm.txtPONumber[intCtr].value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         objForm.txtPONumber[intCtr].value = strReplaced
      }
   }

   if (objForm.txtCustRefNumber.length == null)
   {
      objFormField = new String(objForm.txtCustRefNumber.value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtCustRefNumber.value = strReplaced
   }
   else
   {
      for (var intCtr = 0; intCtr < objForm.txtCustRefNumber.length; intCtr++)
      {
         objFormField = new String(objForm.txtCustRefNumber[intCtr].value)
         strReplaced = objFormField.replace(objRegExp, "ÿ")
         objForm.txtCustRefNumber[intCtr].value = strReplaced
      }
   }

   objFormField = new String(objForm.txtCopyAddEmail.value)
   strReplaced = objFormField.replace(objRegExp, "ÿ")
   objForm.txtCopyAddEmail.value = strReplaced

   objFormField = new String(objForm.txtConfirmAddEmail.value)
   strReplaced = objFormField.replace(objRegExp, "ÿ")
   objForm.txtConfirmAddEmail.value = strReplaced

   if ((gblnCustWebAccess == "True") && (gstrAccessType != constMICRO_SHIPPER))
   {
      objFormField = new String(objForm.txtTemplateName.value)
      strReplaced = objFormField.replace(objRegExp, "ÿ")
      objForm.txtTemplateName.value = strReplaced
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditAdditionalServices                                              +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditAdditionalServices() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(5,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditCommodityInformation                                            +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditCommodityInformation() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(3,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditCustInfo                                                        +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditCustInfo() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(1,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditOtherOptions                                                    +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditOtherOptions() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(6,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditReferenceNumbers                                                +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditReferenceNumbers() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(4,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditRequesterInfo                                                   +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditRequesterInfo() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(0,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditShipmentSpecifics                                               +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditShipmentSpecifics() {
   // Display the quote basis section again to edit or review.
   SummarizeThisAndEditNext(2,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ EditTemplates                                                       +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function EditTemplates()
{ var intSub = 0
  var objTemplateName = new String(objForm.txtTemplateName.value)
  var confirmMsg
  objTemplateName = objTemplateName.toUpperCase()
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ FormatSummary                                                       +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function FormatSummary(intCur) {
   switch(intCur) {
      case 1:
         document.getElementById("RequesterInfo").innerHTML = FormatRequesterInfo()
         break;
      case 2:
         document.getElementById("CustInfo").innerHTML = FormatCustInfo(0,"Origin") + FormatCustInfo(1,"Destination")
         RequireClass()
         break;
      case 3:
         document.getElementById("ShipmentSpecifics").innerHTML = FormatShipmentSpecifics()
         break;
      case 4:
         document.getElementById("CommodityInformation").innerHTML = FormatCommodityInfo("CLASS")
         break;
      case 5:
         document.getElementById("ReferenceNumbers").innerHTML = FormatReferenceNumbers()
         break;
      case 6:
         document.getElementById("AdditionalServices").innerHTML = FormatAdditionalServices(false)
         break;
      case 7:
         document.getElementById("OtherOptions").innerHTML = FormatOtherOptions('Pickup',2,2)
         break;
      default:
         break;
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ hideElementsIE                                                      +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hideElementsIE()
{
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ initCallShipperOptions                                              +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function initCallShipperOptions()
{
  arrCallShipper[0]  = new objCallShipper(' ','Yes')
  arrCallShipper[1]  = new objCallShipper('N','No')
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ initTimesList                                                       +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function initTimesList()
{ arrTimes[0]  = new objTime('     ','- - : - -')
  arrTimes[1]  = new objTime('00:00','Midnight')
  arrTimes[2]  = new objTime('00:30','12:30 AM')
  arrTimes[3]  = new objTime('01:00',' 1:00 AM')
  arrTimes[4]  = new objTime('01:30',' 1:30 AM')
  arrTimes[5]  = new objTime('02:00',' 2:00 AM')
  arrTimes[6]  = new objTime('02:30',' 2:30 AM')
  arrTimes[7]  = new objTime('03:00',' 3:00 AM')
  arrTimes[8]  = new objTime('03:30',' 3:30 AM')
  arrTimes[9]  = new objTime('04:00',' 4:00 AM')
  arrTimes[10] = new objTime('04:30',' 4:30 AM')
  arrTimes[11] = new objTime('05:00',' 5:00 AM')
  arrTimes[12] = new objTime('05:30',' 5:30 AM')
  arrTimes[13] = new objTime('06:00',' 6:00 AM')
  arrTimes[14] = new objTime('06:30',' 6:30 AM')
  arrTimes[15] = new objTime('07:00',' 7:00 AM')
  arrTimes[16] = new objTime('07:30',' 7:30 AM')
  arrTimes[17] = new objTime('08:00',' 8:00 AM')
  arrTimes[18] = new objTime('08:30',' 8:30 AM')
  arrTimes[19] = new objTime('09:00',' 9:00 AM')
  arrTimes[20] = new objTime('09:30',' 9:30 AM')
  arrTimes[21] = new objTime('10:00','10:00 AM')
  arrTimes[22] = new objTime('10:30','10:30 AM')
  arrTimes[23] = new objTime('11:00','11:00 AM')
  arrTimes[24] = new objTime('11:30','11:30 AM')
  arrTimes[25] = new objTime('12:00','Noon')
  arrTimes[26] = new objTime('12:30','12:30 PM')
  arrTimes[27] = new objTime('13:00',' 1:00 PM')
  arrTimes[28] = new objTime('13:30',' 1:30 PM')
  arrTimes[29] = new objTime('14:00',' 2:00 PM')
  arrTimes[30] = new objTime('14:30',' 2:30 PM')
  arrTimes[31] = new objTime('15:00',' 3:00 PM')
  arrTimes[32] = new objTime('15:30',' 3:30 PM')
  arrTimes[33] = new objTime('16:00',' 4:00 PM')
  arrTimes[34] = new objTime('16:30',' 4:30 PM')
  arrTimes[35] = new objTime('17:00',' 5:00 PM')
  arrTimes[36] = new objTime('17:30',' 5:30 PM')
  arrTimes[37] = new objTime('18:00',' 6:00 PM')
  arrTimes[38] = new objTime('18:30',' 6:30 PM')
  arrTimes[39] = new objTime('19:00',' 7:00 PM')
  arrTimes[40] = new objTime('19:30',' 7:30 PM')
  arrTimes[41] = new objTime('20:00',' 8:00 PM')
  arrTimes[42] = new objTime('20:30',' 8:30 PM')
  arrTimes[43] = new objTime('21:00',' 9:00 PM')
  arrTimes[44] = new objTime('21:30',' 9:30 PM')
  arrTimes[45] = new objTime('22:00','10:00 PM')
  arrTimes[46] = new objTime('22:30','10:30 PM')
  arrTimes[47] = new objTime('23:00','11:00 PM')
  arrTimes[48] = new objTime('23:30','11:30 PM')
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ objCallShipper                                                      +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function objCallShipper(opt, yesorno)
{ this.opt      = opt
  this.yesorno = yesorno
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ objTime                                                             +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function objTime(militaryTime, civilianTime)
{ this.militaryTime   = militaryTime
  this.civilianTime   = civilianTime
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ openLocationWin                                                     +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function openLocationWin(seq,ShowNamePlus,ShowContactName,ShowContactPhone,ShowContactFax,ShowContactEmail,OpenDatabase)
{  jsblnShowNamePlus     = ShowNamePlus;
   jsblnShowContactName  = ShowContactName;
   jsblnShowContactPhone = ShowContactPhone;
   jsblnShowContactFax   = ShowContactFax;
   jsblnShowContactEmail = ShowContactEmail;
   jsOpenDatabase        = OpenDatabase;

   if (seq == 0)
   {  if (objForm.chkAffShp.checked == true)
      {  upWinXY('xWin','/tools/shared/locationswindow.asp?PickupContact=Y&FormName=frmPickup&FormMulti=Y&FormNum=0',550,320,false) }
      else
      {  if (jsOpenDatabase)
         {  openLocationListWin(seq)   }
         else
         {  jsRSCallRSLocations(seq)   }
      }
   }
   if (seq == 1)
   {  if (objForm.chkAffCon.checked == true)
      {  upWinXY('xWin','/tools/shared/locationswindow.asp?PickupContact=Y&FormName=frmPickup&FormMulti=Y&FormNum=1',550,320,false) }
      else
      {  if (jsOpenDatabase)
         {  openLocationListWin(seq)   }
         else
         {  jsRSCallRSLocations(seq)   }
      }
   }
   if (seq == 2)
   {  if (objForm.chkAffTpb.checked == true)
      {  upWinXY('xWin','/tools/shared/locationswindow.asp?PickupContact=Y&FormName=frmPickup&FormMulti=Y&FormNum=2',550,320,false) }
      else
      {  if (jsOpenDatabase)
         {  openLocationListWin(seq)   }
         else
         {  jsRSCallRSLocations(seq)   }
      }
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ resyncEmail - syncronizes custinfo and copy/confirm email addresses +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function resyncEmail(objUpdatedField,intSub) {
   var blnUpdateCustInfo = false
   var blnUpdateCopy = false
   var blnUpdateConfirm = false
   var strUpdatedField = objUpdatedField.name
   var strRECopy = /Copy/
   var strREConfirm = /Confirm/
   var strRECustInfo = /Acct/

   // Updated the CustInfo email address if Copy or Confirm Email has changed.
   blnUpdateCustInfo = ((strRECopy.test(strUpdatedField)) || (strREConfirm.test(strUpdatedField)))
   // Updated the Copy email address if CustInfo or Confirm Email has changed.
   blnUpdateCopy     = ((strRECustInfo.test(strUpdatedField)) || (strREConfirm.test(strUpdatedField)))
   // Updated the Confirm email address if CustInfo or Copy Email has changed.
   blnUpdateConfirm  = ((strRECustInfo.test(strUpdatedField)) || (strRECopy.test(strUpdatedField)))

   if (blnUpdateCustInfo) {
      if (objForm.txtAcctEMail[intSub]) {
         objForm.txtAcctEMail[intSub].value = objUpdatedField.value
      }
   }

   if (blnUpdateCopy) {
      if (eval('objForm.txtCopyEmail'+intSub)) {
         eval('objForm.txtCopyEmail'+intSub).value = objUpdatedField.value
      }
   }

   if (blnUpdateConfirm) {
      if (eval('objForm.txtConfirmEmail'+intSub)) {
         eval('objForm.txtConfirmEmail'+intSub).value = objUpdatedField.value
      }
   }

}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ SetFocus                                                            +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function SetFocus(intCur) {
   // This function sets the focus to the first item of the section to be edited.
   switch(intCur) {
      case 0:
         if (objForm.txtContactName) {
            objForm.txtContactName.focus()
         }
         break;
      case 1:
         if (objForm.txtAcctName[0]) {
            objForm.txtAcctName[0].focus()
         }
         else if (objForm.txtAcctName) {
            objForm.txtAcctName.focus()
         }
         break;
      case 2:
         if (objForm.cboYear) {
            objForm.cboYear.focus()
         }
         else if (objForm.txtLength) {
            objForm.txtLength.focus()
         }
         else if (objForm.txtLinearFeet) {
            objForm.txtLinearFeet.focus()
         }
         else if (objForm.txtDeclaredValueAmount) {
            objForm.txtDeclaredValueAmount.focus()
         }
         else if (objForm.txtCODAmt) {
            objForm.txtCODAmt.focus()
         }
         else if (objForm.txtPronumber) {
            objForm.txtPronumber.focus()
         }
         else if (objForm.cboShipperLoad) {
            objForm.cboShipperLoad.focus()
         }
         else if (objForm.cboConsigneeUnload) {
            objForm.cboConsigneeUnload.focus()
         }
         else if (objForm.cboHazardousMaterial) {
            objForm.cboHazardousMaterial.focus()
         }
         else if (objForm.txtSpecialInstructions) {
            objForm.txtSpecialInstructions.focus()
         }
         break;
      case 3:
         if (document.getElementById("txtHandled0")) {
            document.getElementById("txtHandled0").focus()
         }
         break;
      case 4:
         if (objForm.txtBOLNumber) {
            objForm.txtBOLNumber.focus()
         }
         break;
      case 5:
         if (objForm.chkARR) {
            objForm.chkARR.focus()
         }
         break;
      case 6:
         if (objForm.chkCopyEmail0) {
            objForm.chkCopyEmail0.focus()
         }
         else if (objForm.chkCopyEmail1) {
            objForm.chkCopyEmail1.focus()
         }
         else if (objForm.chkConfirmEmail0) {
            objForm.chkConfirmEmail0.focus()
         }
         else {
            objForm.chkConfirmEmail1.focus()
         }
         break;
      case 7:
         if (document.getElementById("cmdSubmit2")) {
            document.getElementById("cmdSubmit2").focus()
         }
         else if (document.getElementById("cmdSubmit1")) {
            document.getElementById("cmdSubmit1").focus()
         }
         break;
      default:
         break;
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ showElementsIE                                                      +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function showElementsIE()
{
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ showUnitHelp                                                        +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function showUnitHelp() {
  upWinXY("xWin","/units.asp",320,500,true)
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ SubmitForm                                                          +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function SubmitForm() {
   var blnValid = false
   var blnEditFound = false

   for (var i=1;i<=intMaxSteps;i++) {
      if (eval('document.getElementById("Edit'+i+'")').className == 'visibleRow')
      {
         blnEditFound = true
         switch (i) {
            case 1:
               blnValid = ValidateRequesterInfo(i)
               break;
            case 2:
               blnValid = ValidateCustInfo(i)
               break;
            case 3:
               blnValid = ValidateCommodityInformation(i)
               break;
            case 4:
               blnValid = ValidateShipmentSpecifics(i)
               break;
            case 5:
               blnValid = ValidateReferenceNumbers(i)
               break;
            case 6:
               blnValid = ValidateAdditionalServices(i)
               break;
            case 7:
               blnValid = ValidateOtherOptions(i)
               break;
            default:
               blnValid = true
               break;
         }
      }
      if (blnValid)
      {
         break
      }
   }

   if ((blnValid) || (!blnEditFound))
   {
      objForm.FormAction.value = "K";
      objForm.action = "pickup.asp";

      objForm.submit();
      DisplayWait("Your pickup request is processing.\nPlease stand by.");
   }
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateAdditionalServices                                          +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateAdditionalServices(StepNum) {
   // Validate The Additional Service Options
   if (!ValidAdditionalServiceOptions(objForm))
   {
   	return false
   }

   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateCommodityInformation                                        +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateCommodityInformation(StepNum) {
   if (!ValidCommodities())
   {
      return false
   }

   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateCustInfo                                                    +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateCustInfo(StepNum) {
   // Validate The Customer Information.
   if (!ValidPartyInfo(0)) { return false }
   if ((!isWhitespace(objForm.txtAcctCity[1].value)) || (objForm.cboAcctState[1].selectedIndex > 0) || (!isWhitespace(objForm.txtAcctZip[1].value)) || (objForm.chkAffCon.checked)) {
      if (!ValidPartyInfo(1)) { return false }
   }

   if (document.getElementById("Summary7").className == 'visibleRow') {
      SummarizeThisAndEditNext(7,intMaxSteps)
   }
   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateOtherOptions                                                +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateOtherOptions(StepNum) {
   // Validate Send Copy To Email Address
   if (objForm.txtCopyAddEmail) {
      if ((!isWhitespace(objForm.txtCopyAddEmail.value)) && (!ValidEMail(objForm.txtCopyAddEmail.value))) {
         return warnInvalid(objForm.txtCopyAddEmail,'Please enter a valid "Send Copy To" E-mail Address.')
      }
   }

   // Validate Send Confirmation To Email Address
   if (objForm.txtConfirmAddEmail) {
      if ((!isWhitespace(objForm.txtConfirmAddEmail.value)) && (!ValidEMail(objForm.txtConfirmAddEmail.value))) {
         return warnInvalid(objForm.txtConfirmAddEmail,'Please enter a valid "Send Confirmation To" E-mail Address.')
      }
   }

   // See if # of Labels field exists
   if (objForm.txtSLMaxNum) {
      // Valid Ship Lab Number is required if Create Shipping Labels checked
      if (!(objForm.txtSLMaxNum.value == '') && (!ValidSLNum(objForm.txtSLMaxNum.value))) {
         return warnInvalid(objForm.txtSLMaxNum,"Please enter the number of labels you want to create.")
      }

      // See if start Postions field exists
      if (objForm.txtSLStartNum) {
         // Valid ShipLab Start Number is required if Create Shipping Labels checked
         if (!(objForm.txtSLMaxNum.value == '') && (!ValidSLStartNum(objForm.txtSLStartNum.value))) {
            return warnInvalid(objForm.txtSLStartNum,"Please enter a number between 1 and 6.")
         }

         // Valid ShipLab Start and Max Numbers combination is required if Create Shipping Labels checked
         if (!(objForm.txtSLMaxNum.value == '') && (!ValidSLNums(objForm.txtSLMaxNum.value, objForm.txtSLStartNum.value))) {
            return warnInvalid(objForm.txtSLStartNum,"The selected combination does not fit on one page. Please start with label 1 if printing more than one page.")
         }
      }
   }

   // Do this last so we don't have to return to the validation for this section after user is prompted to enter email address (if needed)
   // Shipper email required if Send Copy or Confirmation to shipper email checked
   if (objForm.chkCopyEmail0) {
      if ((objForm.chkCopyEmail0.checked == true) &&
         (isWhitespace(objForm.txtAcctEMail[0].value)))
      { return warnInvalid(objForm.txtAcctEMail[0],"Valid Origin E-mail is required to Send Copy.") }
   }
   if (objForm.chkCopyEmail1) {
      if ((objForm.chkCopyEmail1.checked == true) &&
         (isWhitespace(objForm.txtAcctEMail[1].value)))
      { return warnInvalid(objForm.txtAcctEMail[1],"Valid Destination E-mail is required to Send Copy.") }
   }

   if (objForm.chkConfirmEmail0) {
      if ((objForm.chkConfirmEmail0.checked == true) &&
         (isWhitespace(objForm.txtAcctEMail[0].value)))
      { return warnInvalid(objForm.txtAcctEMail[0],"Valid Origin E-mail is required to Send Confirmation.") }
   }
   if (objForm.chkConfirmEmail1) {
      if ((objForm.chkConfirmEmail1.checked == true) &&
         (isWhitespace(objForm.txtAcctEMail[1].value)))
      { return warnInvalid(objForm.txtAcctEMail[1],"Valid Origin E-mail is required to Send Confirmation.") }
   }

   if (document.getElementById("Summary2").className == 'visibleRow') {
      SummarizeThisAndEditNext(2,intMaxSteps)
   }
   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateReferenceNumbers                                            +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateReferenceNumbers(StepNum) {
   // Edit Reference Numbers
   if (!ValidRefnos()) {
      return false
   }

   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateRequesterInfo                                               +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateRequesterInfo(StepNum) {
   if (!ValidRequesterAffiliation()) { return false }
   if (!ValidRequesterContactInfo()) { return false }

   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidateShipmentSpecifics                                           +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidateShipmentSpecifics(StepNum) {
   //Edit Ship Date
   if (!ValidShipDate()) {
      return false
   }

   // Edit Available By
   if ((objForm.chkAffShp.checked == true) &&
       (objForm.cboReadyByTime.selectedIndex < 1))
   { return warnInvalid(objForm.cboReadyByTime,"Please enter time freight will be available for pickup.") }

   //Edit Linear Feet
   if ((!isEmpty(objForm.txtLinearFeet.value)) && (!isInteger(objForm.txtLinearFeet.value)))
   {
      return warnInvalid(objForm.txtLinearFeet,"Linear Feet must be a whole number.")
   }

/*	 Removed the pronumber from Pickup Request per Michael 03/24/2003 UNSANDL.
	//Edit Pronumber
	if (!ValidPronumber()) {
		return false
	}
*/

   //Edit Special Instructions
   if (objForm.txtInstructions.value.length > 370) {
      return warnInvalid(objForm.txtInstructions,"Special Instructions limited to 10 lines.")
   }

   SummarizeThisAndEditNext(StepNum,intMaxSteps)
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidCommodities                                                    +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidCommodities()
{
   //Edit The Commodity Information
   intTotalWeight = 0;

   if (!document.getElementById("txtWeight1")) {
      if (!ValidCommodityInfo(0,
         document.getElementById("txtHandled0"),
         document.getElementById("cboHandledType0"),
         document.getElementById("txtPackages0"),
         document.getElementById("cboPackagesType0"),
         document.getElementById("txtWeight0"),
         document.getElementById("txtItem0"),
         document.getElementById("txtSub0"),
         document.getElementById("cboClass0"),
         document.getElementById("txtDescription0"),
         document.getElementById("txtCube0")))
      { return false }
   }
   else {
      for (var i = 0; i < intCurItems; i++) {
         if (!ValidCommodityInfo(i,
            eval('document.getElementById("txtHandled'+i+'")'),
            eval('document.getElementById("cboHandledType'+i+'")'),
            eval('document.getElementById("txtPackages'+i+'")'),
            eval('document.getElementById("cboPackagesType'+i+'")'),
            eval('document.getElementById("txtWeight'+i+'")'),
            eval('document.getElementById("txtItem'+i+'")'),
            eval('document.getElementById("txtSub'+i+'")'),
            eval('document.getElementById("cboClass'+i+'")'),
            eval('document.getElementById("txtDescription'+i+'")'),
            eval('document.getElementById("txtCube'+i+'")')))
         { return false }
      }
   }
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidCommodityInfo                                                  +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidCommodityInfo(i,txtHandled,cboHandledType,txtPackages,cboPackagesType,txtWeight,txtItem,txtSub,cboClass,txtDescription,txtCube)
{
   /*
   // After the first commodity, it is ok when all the fields are empty for the other commodities.  (For Netscape)
      if ((i > 0) &&
         ((isWhitespace(txtItem.value))&&(isWhitespace(txtSub.value))) &&
         ((cboClass.selectedIndex < 1)&&(isWhitespace(txtDescription.value))))
      {  return true }
   */

   //Validate Handled Units and Type
   if ((!isWhitespace(txtHandled.value))&&(!isInteger(txtHandled.value)))
   {
      return warnInvalid(txtHandled,"Please enter a valid handling units amount for this commodity.")
   }

   if ((cboHandledType.selectedIndex < 1)&&(!isWhitespace(txtHandled.value)))
   {
      return warnInvalid(cboHandledType,"Please enter a valid handling units type for this commodity.")
   }

   //Validate Package Units and Type
   if (((!isWhitespace(txtPackages.value))&&(!isInteger(txtPackages.value))) ||
      ((isWhitespace(txtPackages.value))&&(cboPackagesType.selectedIndex > 0)))
   {
      return warnInvalid(txtPackages,"Please enter a valid number of packages for this commodity.")
   }

   if ((!isWhitespace(txtPackages.value))&&(cboPackagesType.selectedIndex < 1))
   {
      return warnInvalid(cboPackagesType,"Please enter a valid package type for this commodity.")
   }

   //Validate shipment weight
   if ((!isEmpty(txtWeight.value) && !isInteger(txtWeight.value)) || txtWeight.value == "0")
   {
      return warnInvalid(txtWeight,"Shipment weight must be numeric.")
   }

   // for TruckPack boxes
   if (isInteger(txtWeight.value))
   {
      intTotalWeight = intTotalWeight + parseInt(txtWeight.value,10);
   }

   //NMFC item must be 6 numbers (if entered)
   if ((!isWhitespace(txtItem.value))&&
      ((txtItem.value.length < 6)||(!isInteger(txtItem.value))))
   {
      return warnInvalid(txtItem,"NMFC item must be 6 digits.")
   }

   //NMFC sub must be 2 numbers (if entered)
   if ((!isWhitespace(txtSub.value))&&
      ((txtSub.value.length < 2)||(!isInteger(txtSub.value))))
   {
      return warnInvalid(txtSub,"NMFC sub must be 2 digits.")
   }

   //Validate cube (if entered)
   if ((!isWhitespace(txtCube.value))&&(!isInteger(txtCube.value)))
   {
      return warnInvalid(txtCube,"Cube must be numeric.")
   }

   //Validate cube (if entered)
   if ((!isWhitespace(txtCube.value))&&(txtCube.value > 99999))
   {
      return warnInvalid(txtCube,"Cube cannot be over 99999.")
   }

   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidContactInfo                                                    +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidContactInfo(i)
{
//  var reInvalidChars = /[<>",\(\)\[\]\\;@]+/
  var txtParty = " "
  if (i==0)
  { txtParty = "Origin"}
  if (i==1)
  { txtParty = "Destination"}

   //  validate the Requester Contact Name field
  if ((!isWhitespace(objForm.txtContactName.value)) &&
      (reInvalidChars.test(objForm.txtContactName.value)))
  { return warnInvalid(objForm.txtContactName,"Please enter a valid Contact Name for the Requestor. The following characters are invalid:\n<,>," + '",(,),[,],/\,@,comma, and semicolon.') }

   //  validate the Party Contact Name field
   if ((!isWhitespace(objForm.txtAcctContact[i].value)) &&
      (reInvalidChars.test(objForm.txtAcctContact[i].value)))
  { return warnInvalid(objForm.txtAcctContact[i],"Please enter a valid Contact Name for the " + txtParty + ". The following characters are invalid:\n<,>," + '",(,),[,],/\,@,comma, and semicolon.') }

   //  Validate the Contact Phone Number
  if ((!isWhitespace(objForm.txtAcctPhone[i].value)) &&
      (!checkUSPhone (objForm.txtAcctPhone[i], "Contact Phone", "false")))
  { return false }

   //  Contact phone required if extension entered
  if ((isWhitespace(objForm.txtAcctPhone[i].value)) &&
      (!isWhitespace(objForm.txtAcctPhoneExt[i].value)))
  { return warnInvalid(objForm.txtAcctPhone[i],"Phone number required with extension.") }

   //  Validate the Contact Phone Extension
  if ((!isWhitespace(objForm.txtAcctPhoneExt[i].value)) &&
      (!isInteger(objForm.txtAcctPhoneExt[i].value)))
  { return warnInvalid(objForm.txtAcctPhoneExt[i],"Please enter a valid phone extension.") }

   //  Validate the Contact Fax Number
  if ((!isWhitespace(objForm.txtAcctFax[i].value)) &&
      (!checkUSPhone (objForm.txtAcctFax[i], "Contact Fax", "false")))
  { return false }


   // Email must be valid if entered
  if ((!isWhitespace(objForm.txtAcctEMail[i].value)) &&
      (!ValidEMail(objForm.txtAcctEMail[i].value)))
  { return warnInvalid(objForm.txtAcctEMail[i],"Valid " + txtParty + " E-mail is required...") }

  return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidPartyInfo                                                      +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidPartyInfo(i) {
   var txtParty = " "
   var objParty
   var strEmptyOK = "true"

   if (i==0) {
      objParty = objForm.chkAffShp
      txtParty = "Origin"
   }
   if (i==1) {
      objParty = objForm.chkAffCon
      txtParty = "Destination"
   }

   if (objParty.checked) {
      strEmptyOK = "false"
   }

   // Validate Origin Party Name
   if (isWhitespace(objForm.txtAcctName[0].value)){
      return warnInvalid(objForm.txtAcctName[0],"Company Name is required for the Origin")
   }
   if ((!isWhitespace(objForm.txtAcctName[i].value)) && (reInvalidChars.test(objForm.txtAcctName[i].value))) {
      return warnInvalid(objForm.txtAcctName[i],"Please enter a valid Company Name for the " + txtParty + ". The following characters are invalid:\n<,>," + '",(,),[,],/\,@,comma, and semicolon.')
   }

   // Shipper address required
   if (isWhitespace(objForm.txtAcctAddr[0].value)) {
      return warnInvalid(objForm.txtAcctAddr[0],"Address is required for the Origin.")
   }

   // Validate customer city(s), state(s) & zip(s) (Required)
   if ((!isEmpty(objForm.txtAcctCity[i].value) && objForm.cboAcctState[i].selectedIndex == 0) ||
        (isEmpty(objForm.txtAcctCity[i].value) && objForm.cboAcctState[i].selectedIndex > 0) ||
        (isEmpty(objForm.txtAcctCity[i].value) && objForm.cboAcctState[i].selectedIndex == 0 && isEmpty(objForm.txtAcctZip[i].value)))
   {
      return warnInvalid(objForm.txtAcctZip[i],"A city and state OR zip/postal code is required for the "+txtParty+".")
   }

   // Validate zip codes
   if (!isEmpty(objForm.txtAcctZip[i].value))
   {
      if ((eval('objForm.radAcctCountry'+i+'[0]').checked) && (!ValidUSZip(objForm.txtAcctZip[i])))
      {  return warnInvalid(objForm.txtAcctZip[i],"An invalid United States zip code was entered for the "+txtParty+"."); }

      if ((eval('objForm.radAcctCountry'+i+'[1]').checked) && (!ValidCAZip(objForm.txtAcctZip[i])))
      {  return warnInvalid(objForm.txtAcctZip[i],"An invalid Canadian postal code was entered for the "+txtParty+"."); }

      if ((eval('objForm.radAcctCountry'+i+'[2]').checked) && (!ValidMXZip(objForm.txtAcctZip[i])))
      {  return warnInvalid(objForm.txtAcctZip[i],"An invalid Mexican postal code was entered for the "+txtParty+"."); }
   }

   // Validate the Party Contact Name field
   if (isWhitespace(objForm.txtAcctContact[0].value)) {
      return warnInvalid(objForm.txtAcctContact[0],"Contact Name is required for the Origin.")
   }
   if (objForm.chkAffCon.checked) {
      if (objForm.txtAcctContact[1]) {
         if (isWhitespace(objForm.txtAcctContact[1].value)) {
            return warnInvalid(objForm.txtAcctContact[1],"Contact Name is required for the Destination.")
         }
      }
   }
   if ((!isWhitespace(objForm.txtAcctContact[i].value)) &&
      (reInvalidChars.test(objForm.txtAcctContact[i].value)))
   { return warnInvalid(objForm.txtAcctContact[i],"Please enter a valid Contact Name for the " + txtParty + ". The following characters are invalid:\n<,>," + '",(,),[,],/\,@,comma, and semicolon.') }

   // Validate the Origin Contact Phone Number - Required
   if (isWhitespace(objForm.txtAcctPhone[0].value)) {
      return warnInvalid(objForm.txtAcctPhone[0],"Phone number required for the Origin.")
   }
   else {
      if (!checkUSPhone(objForm.txtAcctPhone[0], "Contact Phone", "false"))
      { return false }
   }

   // Validate the Other Party Contact Phone Number(s)
   if ((!isWhitespace(objForm.txtAcctPhone[i].value)) &&
      (!checkUSPhone(objForm.txtAcctPhone[i], "Contact Phone", strEmptyOK)))
   { return false }

   //  Contact phone required if extension entered
   if ((isWhitespace(objForm.txtAcctPhone[i].value)) &&
      (!isWhitespace(objForm.txtAcctPhoneExt[i].value)))
   { return warnInvalid(objForm.txtAcctPhone[i],"Phone number required with extension.") }

   //  Validate the Contact Phone Extension
   if ((!isWhitespace(objForm.txtAcctPhoneExt[i].value)) &&
      (!isInteger(objForm.txtAcctPhoneExt[i].value)))
   { return warnInvalid(objForm.txtAcctPhoneExt[i],"Please enter a valid phone extension.") }

   //  Validate the Contact Fax Number
   if ((!isWhitespace(objForm.txtAcctFax[i].value)) &&
      (!checkUSPhone (objForm.txtAcctFax[i], "Contact Fax", "false")))
   { return false }


   // Email must be valid if entered
   if ((!isWhitespace(objForm.txtAcctEMail[i].value)) &&
      (!ValidEMail(objForm.txtAcctEMail[i].value)))
   { return warnInvalid(objForm.txtAcctEMail[i],"Valid " + txtParty + " E-mail is required...") }

/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RemoteCityCoding goes here.................
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   SetValuesForRemoteCityCoding()
   jsValidateCityCodeRS('nspquotes.asp',true,objForm.txtAcctCity[0],objForm.cboAcctState[0],objForm.txtAcctZip[0],objForm.radAcctCountry0,true,objForm.txtAcctCity[1],objForm.cboAcctState[1],objForm.txtAcctZip[1],objForm.radAcctCountry1,false,'','','','',true);
   return false
*/
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidPronumber                                                      +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidPronumber()
{ if ((!isWhitespace(objForm.txtPronumber.value)) &&
      (!ValidABFPro(objForm.txtPronumber)))
  { return warnInvalid(objForm.txtPronumber,'Valid ABF Pronumber is 9 digits (plus 1 or 2 letters).')
  }
  return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidRefnos                                                         +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidRefnos()
{
   var intCtr = 0;
   var intDupCtr = 0;
   var txtRefno;
   var CustRefNum;
   var intTotHandled = 0;
   var intTotPackages = 0;
   var intTotWeight = 0;
   var intTotPOPieces = 0;
   var intTotPOWeight = 0;

   CustRefNum = document.getElementById("txtCustRefNumber0").value
   txtRefno = document.getElementById("txtBOLNumber").value
   txtRefno = txtRefno.toUpperCase()
   document.getElementById("txtBOLNumber").value = txtRefno

   if ((txtRefno == '?')       ||
       (txtRefno == 'UNK')     ||
       (txtRefno == 'UNKNOWN') ||
       (txtRefno == 'N/A')     ||
       (txtRefno == 'NA')      ||
       (txtRefno == 'N/S')     ||
       (txtRefno == 'NS')      ||
       (txtRefno == 'X')       ||
       (txtRefno == 'XX')      ||
       (txtRefno == 'XXX')     ||
       (txtRefno == 'XXXX')    ||
       (txtRefno == 'NONE'))
   {
      return warnInvalid(document.getElementById("txtBOLNumber"),"Invalid BOL Number; leave blank if not available.")
   }

   if ((!document.getElementById("txtWeight1")) &&
      (!document.getElementById("txtHandled1")) &&
      (!document.getElementById("txtHandled1")))
   {
      if (isInteger(document.getElementById("txtHandled0").value))
      {
         intTotHandled = intTotHandled + parseInt(document.getElementById("txtHandled0").value)
      }
      if (isInteger(document.getElementById("txtPackages0").value))
      {
         intTotPackages = intTotPackages + parseInt(document.getElementById("txtPackages0").value)
      }
      if (isInteger(document.getElementById("txtWeight0").value))
      {
         intTotWeight = intTotWeight + parseInt(document.getElementById("txtWeight0").value)
      }
   }
   else
   {
      for (var i = 0; i < intCurItems; i++)
      {
         if (isInteger(eval('document.getElementById("txtWeight'+i+'")').value))
         {
            intTotHandled = intTotHandled + parseInt(eval('document.getElementById("txtHandled'+i+'")').value)
         }
         if (isInteger(eval('document.getElementById("txtPackages'+i+'")').value))
         {
            intTotPackages = intTotPackages + parseInt(eval('document.getElementById("txtPackages'+i+'")').value)
         }
         if (isInteger(eval('document.getElementById("txtWeight'+i+'")').value))
         {
            intTotWeight = intTotWeight + parseInt(eval('document.getElementById("txtWeight'+i+'")').value)
         }
      }
   }

   if (!document.getElementById("txtPONumber1"))
   {
      txtRefno = document.getElementById("txtPONumber0").value
      txtRefno = txtRefno.toUpperCase()
      document.getElementById("txtPONumber0").value = txtRefno
      if ((txtRefno == '?')       ||
          (txtRefno == 'UNK')     ||
          (txtRefno == 'UNKNOWN') ||
          (txtRefno == 'N/A')     ||
          (txtRefno == 'NA')      ||
          (txtRefno == 'N/S')     ||
          (txtRefno == 'NS')      ||
          (txtRefno == 'X')       ||
          (txtRefno == 'XX')      ||
          (txtRefno == 'XXX')     ||
          (txtRefno == 'XXXX')    ||
          (txtRefno == 'NONE'))
      {
         return warnInvalid(document.getElementById("txtPONumber0"),"Invalid PO Number; leave blank if not available.")
      }
      if ((isWhitespace(document.getElementById("txtPONumber0").value))&&
       ( (!isWhitespace(document.getElementById("txtPOPieces0").value))||
         (!isWhitespace(document.getElementById("txtPOWeight0").value))||
         (!isWhitespace(document.getElementById("txtPODept0").value))))
      {
         return warnInvalid(document.getElementById("txtPONumber0"),"PO Number required with Pcs, Wt, or Dept.")
      }
      if ((!isWhitespace(document.getElementById("txtPOPieces0").value))&&(!isInteger(document.getElementById("txtPOPieces0").value)))
      {
         return warnInvalid(document.getElementById("txtPOPieces0"),"PO Pcs must be numeric.")
      }
      if ((!isWhitespace(document.getElementById("txtPOWeight0").value))&&(!isInteger(document.getElementById("txtPOWeight0").value)))
      {
         return warnInvalid(document.getElementById("txtPOWeight0"),"PO Wt must be numeric.")
      }
      if ((intTotHandled != 0)&&(intTotPackages != 0)&&(document.getElementById("txtPOPieces0").value != 0)&&
          (parseInt(document.getElementById("txtPOPieces0").value) != intTotHandled)&&
          (parseInt(document.getElementById("txtPOPieces0").value) != intTotPackages))
      {
         return warnInvalid(document.getElementById("txtPOPieces0")," PO Pcs does not equal total Handling Units or total Packages.")
      }
      if ((intTotWeight != 0)&&(document.getElementById("txtPOWeight0").value != 0)&&
          (parseInt(document.getElementById("txtPOWeight0").value) != intTotWeight))
      {
         return warnInvalid(document.getElementById("txtPOWeight0"),"PO Wt does not equal total Commodities Weight.")
      }
   }
   else
   {
      for (var intCtr = 0; intCtr < intCurrentRefno; intCtr++)
      {
         txtRefno = eval('document.getElementById("txtPONumber'+intCtr+'")').value
         txtRefno = txtRefno.toUpperCase()
         eval('document.getElementById("txtPONumber'+intCtr+'")').value = txtRefno
         if ((txtRefno == '?')       ||
             (txtRefno == 'UNK')     ||
             (txtRefno == 'UNKNOWN') ||
             (txtRefno == 'N/A')     ||
             (txtRefno == 'NA')      ||
             (txtRefno == 'N/S')     ||
             (txtRefno == 'NS')      ||
             (txtRefno == 'X')       ||
             (txtRefno == 'XX')      ||
             (txtRefno == 'XXX')     ||
             (txtRefno == 'XXXX')    ||
             (txtRefno == 'NONE'))
         {
            return warnInvalid(eval('document.getElementById("txtPONumber'+intCtr+'")'),"Invalid PO Number; leave blank if not available.")
         }
         else
         {
            for (var intDupCtr = intCtr + 1; intDupCtr < intCurrentRefno; intDupCtr++)
            {
               txtRefno = eval('document.getElementById("txtPONumber'+intDupCtr+'")').value
               txtRefno = txtRefno.toUpperCase()
               eval('document.getElementById("txtPONumber'+intDupCtr+'")').value = txtRefno
               if ((eval('document.getElementById("txtPONumber'+intCtr+'")').value == eval('document.getElementById("txtPONumber'+intDupCtr+'")').value) &&
                   (eval('document.getElementById("txtPONumber'+intCtr+'")').value > " "))
               {
                  return warnInvalid(eval('document.getElementById("txtPONumber'+intCtr+'")'),"Duplicate PO Number.")
               }
            }
         }
         if ((isWhitespace(eval('document.getElementById("txtPONumber'+intCtr+'")').value))&&
          ( (!isWhitespace(eval('document.getElementById("txtPOPieces'+intCtr+'")').value))||
            (!isWhitespace(eval('document.getElementById("txtPOWeight'+intCtr+'")').value))||
            (!isWhitespace(eval('document.getElementById("txtPODept'+intCtr+'")').value))))
         {
            return warnInvalid(eval('document.getElementById("txtPONumber'+intCtr+'")'),"PO Number required with Pcs, Wt, or Dept.")
         }
         if ((!isWhitespace(eval('document.getElementById("txtPOPieces'+intCtr+'")').value))&&(!isInteger(eval('document.getElementById("txtPOPieces'+intCtr+'")').value)))
         {
            return warnInvalid(eval('document.getElementById("txtPOPieces'+intCtr+'")'),"PO Pcs must be numeric.")
         }
         if ((!isWhitespace(eval('document.getElementById("txtPOWeight'+intCtr+'")').value))&&(!isInteger(eval('document.getElementById("txtPOWeight'+intCtr+'")').value)))
         {
            return warnInvalid(eval('document.getElementById("txtPOWeight'+intCtr+'")'),"PO Wt must be numeric.")
         }
         if (isInteger(eval('document.getElementById("txtPOPieces'+intCtr+'")').value))
         {
            intTotPOPieces = intTotPOPieces + parseInt(eval('document.getElementById("txtPOPieces'+intCtr+'")').value)
         }
         if (isInteger(eval('document.getElementById("txtPOWeight'+intCtr+'")').value))
         {
            intTotPOWeight = intTotPOWeight + parseInt(eval('document.getElementById("txtPOWeight'+intCtr+'")').value)
         }
      }
      if ((intTotHandled != 0)&&(intTotPackages != 0)&&(intTotPOPieces != 0)&&
          (intTotPOPieces != intTotHandled)&&(intTotPOPieces != intTotPackages))
      {
         return warnInvalid(document.getElementById("txtPOPieces0"),"Total PO Pcs does not equal total Handling Units or total Packages.")
      }
      if ((intTotWeight != 0)&&(intTotPOWeight != 0)&&(intTotPOWeight != intTotWeight))
      {
         return warnInvalid(document.getElementById("txtPOWeight0"),"Total PO Wt does not equal total Commodities Weight.")
      }
   }

   if (!document.getElementById("txtCustRefNumber1"))
   {
      txtRefno = CustRefNum
      txtRefno = txtRefno.toUpperCase()
      document.getElementById("txtCustRefNumber0").value = txtRefno
      if ((txtRefno == '?')       ||
          (txtRefno == 'UNK')     ||
          (txtRefno == 'UNKNOWN') ||
          (txtRefno == 'N/A')     ||
          (txtRefno == 'NA')      ||
          (txtRefno == 'N/S')     ||
          (txtRefno == 'NS')      ||
          (txtRefno == 'X')       ||
          (txtRefno == 'XX')      ||
          (txtRefno == 'XXX')     ||
          (txtRefno == 'XXXX')    ||
          (txtRefno == 'NONE'))
      {
         return warnInvalid(document.getElementById("txtCustRefNumber0"),"Invalid Cust Ref Number; leave blank if not available.")
      }
   }
   else
   {
      for (var intCtr = 0; intCtr < intCurrentRefno; intCtr++)
      {
         txtRefno = eval('document.getElementById("txtCustRefNumber'+intCtr+'")').value
         txtRefno = txtRefno.toUpperCase()
         eval('document.getElementById("txtCustRefNumber'+intCtr+'")').value = txtRefno
         if ((txtRefno == '?')        ||
             (txtRefno == 'UNK')      ||
             (txtRefno == 'UNKNOWN')  ||
             (txtRefno == 'N/A')      ||
             (txtRefno == 'NA')       ||
             (txtRefno == 'N/S')      ||
             (txtRefno == 'NS')       ||
             (txtRefno == 'X')        ||
             (txtRefno == 'XX')       ||
             (txtRefno == 'XXX')      ||
             (txtRefno == 'XXXX')     ||
             (txtRefno == 'NONE'))
         {
            return warnInvalid(eval('document.getElementById("txtCustRefNumber'+intCtr+'")'),"Invalid Cust Ref Number; leave blank if not available.")
         }
         else
         {
            for (var intDupCtr = intCtr + 1; intDupCtr < intCurrentRefno; intDupCtr++)
            {
               txtRefno = eval('document.getElementById("txtCustRefNumber'+intDupCtr+'")').value
               txtRefno = txtRefno.toUpperCase()
               eval('document.getElementById("txtCustRefNumber'+intDupCtr+'")').value = txtRefno
               if ((eval('document.getElementById("txtCustRefNumber'+intCtr+'").value == document.getElementById("txtCustRefNumber'+intDupCtr+'").value')) &&
                   (eval('document.getElementById("txtCustRefNumber'+intCtr+'")').value > " "))
               {
                  return warnInvalid(eval('document.getElementById("txtCustRefNumber'+intCtr+'")'),"Duplicate Cust Ref Number.")
               }
            }
         }
      }
   }
   return true;
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidRequesterAffiliation                                           +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidRequesterAffiliation() {
   // Validate Payment Terms
   if (objForm.optPay) {
      if ((!objForm.optPay[0].checked) && (!objForm.optPay[1].checked)) {
         return warnInvalid(objForm.optPay[0],'Please select the payment terms to complete your Bill of Lading.')
      }
   }

   if (objForm.optPay) {
      if ((objForm.chkAffShp.checked == true) &&
         (objForm.chkAffCon.checked == false) &&
         (objForm.optPay[1].checked == true))
      {
         return warnInvalid(objForm.optPay[0],'The payment terms must be PREPAID if only the shipper is checked.')
      }
      if ((objForm.chkAffShp.checked == false) &&
         (objForm.chkAffCon.checked == true)   &&
         (objForm.optPay[0].checked == true))
      {
         return warnInvalid(objForm.optPay[1],'The payment terms must be COLLECT if only the consignee is checked.')
      }
   }
   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidRequesterContactInfo                                           +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidRequesterContactInfo()
{
   //  validate the Requester Contact Name field
   if ((!objForm.chkAffShp.checked) && (!objForm.chkAffCon.checked)) {
      if (isWhitespace(objForm.txtContactName.value)) {
         return warnInvalid(objForm.txtContactName,"Requester Contact Name is required to request a pickup.")
      }
   }
   if ((!isWhitespace(objForm.txtContactName.value)) &&
      (reInvalidChars.test(objForm.txtContactName.value)))
   { return warnInvalid(objForm.txtContactName,"Please enter a valid Contact Name for the Requestor. The following characters are invalid:\n<,>," + '",(,),[,],/\,@,comma, and semicolon.') }

   // Validate the Requester Contact Email Address
   if ((!isWhitespace(objForm.txtContactEmail.value)) &&
       (!ValidEMail(objForm.txtContactEmail.value))) {
      errmsg = 'Invalid Requester Contact E-mail Address'
      return warnInvalid(objForm.txtContactEmail,errmsg) }

   // Validate the Requester Contact Phone Number / Fax Number
   if ((!objForm.chkAffShp.checked) && (!objForm.chkAffCon.checked)) {
      if (isEmpty(objForm.txtContactPhone.value)) {
         errmsg = 'Phone number required for pickup request.'
         return warnInvalid(objForm.txtContactPhone,errmsg)
      }
   }
   if (!isEmpty(objForm.txtContactPhone.value)) {
      if (!isWhitespace(objForm.txtContactPhone.value))
      { if (!checkUSPhone(objForm.txtContactPhone,"Requester Contact Phone","false"))
         { return false }
      }
      if ((isWhitespace(objForm.txtContactPhone.value)) &&
          (!isWhitespace(objForm.txtContactPhoneExt.value)))
      { errmsg = "Phone number required with extension."
         return warnInvalid(objForm.txtContactPhone,errmsg)
      }
      if ((!isWhitespace(objForm.txtContactPhoneExt.value)) &&
          (!isInteger(objForm.txtContactPhoneExt.value)))
      { errmsg = "Please enter a valid phone extension."
         return warnInvalid(objForm.txtContactPhoneExt,errmsg)
      }
   }

   //change numbers to the (nnn)nnn-nnnn format even if they are not required
   if ((objForm.txtContactPhone.value.length > 0) && (!checkUSPhone (objForm.txtContactPhone, "Contact Phone", "false")))
   {  return false }

   return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidShipDate                                                       +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidShipDate() {
  if ((objForm.cboYear.length == 0)  ||
      (objForm.cboMonth.length == 0) ||
      (objForm.cboDay.length == 0)) {
    errmsg = "Pickup date is required"
    return warnInvalid("",errmsg)
  }
  return true
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ ValidTruckPackNumber                                                +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ValidTruckPackNumber(objForm)
{
   if (objForm.chkTRPACK)
   {
      if ((objForm.chkTRPACK.checked==true) && (!isInteger(objForm.txtTRPACK.value)))
      {
         return warnInvalid(objForm.txtTRPACK,"Valid number of TruckPack boxes is required.");
      }

      if (!document.getElementById("txtWeight1"))
      {
         intTotalWeight = parseInt(document.getElementById("txtWeight0").value,10);
      }

      if ((objForm.chkTRPACK.checked==true) && (intTotalWeight/(parseInt(objForm.txtTRPACK.value,10))>1500))
      {
         return warnInvalid(objForm.txtTRPACK,"One TruckPack box can hold a maximum of 1500 lbs. Please enter a number of TruckPack boxes for this shipment.");
      }
   }

   return true;
}