function upWinXY(winName,whatWin,winX,winY,scrollB,resizable,useMinWin) {
   var strS = 'no'

   if (scrollB) { strS = 'yes' }
   strR = resizable? 'yes' : 'no'

   if (useMinWin) whatWin = '/include/minwin.asp?pg=' + whatWin;

   eval("if (("+winName+") && (!"+winName+".closed)) { "+winName+".close() }")

   if (navigator.appName == "Microsoft Internet Explorer") {
      eval(winName+" = window.open(whatWin,'','left=10,top=10,status=no,toolbar=no,location=no,resizable="+strR+",copyhistory=no,menubar=no,scrollbars="+strS+",width="+winX+",height="+winY+"')")
   }
   else {
      eval(winName+" = window.open(whatWin,'"+winName+"','screenX=10,screenY=10,status=no,toolbar=no,location=no,resizable="+strR+",copyhistory=no,menubar=no,scrollbars="+strS+",width="+winX+",height="+winY+"')")
   }
}

function gotosite(site) {
	if (site != '') { window.parent.location.href = site; }
}

function openHelp(intMsg) {
   upWinXY('xWin', '/tips/default.asp?num=' + intMsg, 300, 250, false, false, true)
}


function trackClientEvent(strMsg) {
   if (document.getElementById) {
      if (document.getElementById("eventTrackIFrame")) {
         document.getElementById("eventTrackIFrame").src = "/Include/ClientSideEvent.asp?EVENT=" + strMsg + "&VERSION=" + Math.random();
      }
   }
}


function getIndexInList(list, item) {
   var blnFound = false;
   for (i = 0; i < list.length; i++) {
      if (list.options[i].value == item) {
         blnFound = true;
         break;
      }
   }
   if (!blnFound) {i = 0};

   return i;
}

// updates the combo boxes when a new city is selected
function UpdateCityZipSt(city, state, zip, cityZipRec) {
   if ((cityZipRec != 'NONE') && (cityZipRec != '')) {
      city.value  = cityZipRec.substring(0, (cityZipRec.indexOf('{')));
      var st = cityZipRec.substring((cityZipRec.indexOf('{')+1), cityZipRec.indexOf('}'));
      for (i = 0; i < state.options.length; i++) {
         if (st == state.options[i].value.substr(0, 2)) {
            break;
         }
      }
      state.options.selectedIndex = i;
      zip.value   = cityZipRec.substring(cityZipRec.indexOf('}')+1);
   }
}

function validateReloLogon(action) {
   var objForm = document.frmCorpRelo;
   if (action == 'ON') {
      if (isWhitespace(trimWhiteSpace(objForm.txtAccount.value))) {
         return warnInvalid(objForm.txtAccount, 'Please enter a valid ABF U-Pack User ID.')
      }
      if (isWhitespace(trimWhiteSpace(objForm.txtPassword.value))) {
         return warnInvalid(objForm.txtPassword, 'Please enter a valid ABF U-Pack password.')
      }
      objForm.hidAction.value = 'LOGON';
   }
   else {
      objForm.hidAction.value = 'LOGOFF';
   }
   objForm.submit();
}

function URLDecode(strVal) {
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef";
   var encoded = strVal;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2)
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   strVal = plaintext;
   return strVal;
}

function clsOmnitureData()
{
	/* You may give each page an identifying name, server, and channel on
		 the next lines. */
	this.pageName = "";
	this.server=""
	this.channel=""
	this.pageType=""
	this.prop1=""
	this.prop2=""
	this.prop3=""
	this.prop4=""
	this.prop5=""
	/* E-commerce Variables */
	this.campaign=""
	this.state=""
	this.zip=""
	this.events=""
	this.products=""
	this.purchaseID=""
	this.eVar1=""
	this.eVar2=""
	this.eVar3=""
	this.eVar4=""
	this.eVar5=""
	/* Hierarchy Variables */
	this.hier1=""
}

function trackWebEvent(msg)
{
}

function showWAdiags(mEvent) {
	if (document.getElementById("divWAdiags"))
	{
		document.getElementById("divWAdiags").innerHTML = mEvent;
		document.getElementById("divWAdiags").className = "WAdiags";
	}
}

function hideWAdiags() {
	if (document.getElementById("divWAdiags"))
	{
		document.getElementById("divWAdiags").innerHTML = "";
		document.getElementById("divWAdiags").className = "hidden";
	}
}
