
function showPopupOnce(popupTitle, wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable) {

	if (GetCookie("seenpopup" + popupTitle) == 'true') return true;

	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);

   SetCookie("seenpopup" + popupTitle, true, expires, "");
   openAnyWinTwo(wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable);

	return true;
}

function showPopup(wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable) {

   openAnyWinTwo(wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable);
	return true;
}

function selectOption(text, value)
{
    this.text=text;
    this.value=value;
}

function img_act(imgName)
{
        if (document.images)
        {
        imgOn = eval(imgName + "on.src");
        document [imgName].src = imgOn;
        }
}

function img_inact(imgName)
{
        if (document.images)
        {
        imgOff = eval(imgName + "off.src");
        document [imgName].src = imgOff;
        }
}

function ReloadPage(pageString)
{
	var amp = "/&";
	var equals = "/=";

	// Add a double ampersand at the end so that all parameters have ampersands
	pageString = pageString + amp;

	// Use the ampersand to work out how many parameters there are
	var numOfPages = 0;

	for (i = 0; i < pageString.length; i++)
	{
		var ch = pageString.substring(i, i+2);
		if (ch == amp)
		{
			numOfPages = numOfPages + 1;
		}
	}

	var ampIndex1 = 0;
	var ampIndex2 = pageString.indexOf(amp, 0);

	// For each parameter, cut it out as a substring, then work out which frame it is asking to be
	// replaced and set the correspoding hidden field to that value
	for (j = 0; j < numOfPages; j++)
	{
		var paramSubstring = pageString.substring(ampIndex1, ampIndex2);
		var equalsIndex = paramSubstring.indexOf(equals, 0);
		var frameNum = paramSubstring.substring(0, equalsIndex);
		var fullFramePath = paramSubstring.substring(equalsIndex + 2, paramSubstring.length);

		if (fullFramePath.indexOf("home") == 1)
		{
			var slashIndex = fullFramePath.indexOf("/", 1)
			var fullFramePath = fullFramePath.substring(slashIndex, fullFramePath.length);
		}

		if ((fullFramePath != null) && (fullFramePath.length > 0))
                {
			field = eval("document.theForm.FC" + frameNum);
			field.value = fullFramePath;
                }

		ampIndex1 = ampIndex2 + 2;
		ampIndex2 = pageString.indexOf(amp, ampIndex1);
	}

	document.theForm.submit();
}


function SetChildOpenerNull(win)
{
  wind = eval(win);
  wind.opener = null;
}

function setContentHeight() {
  if (document.all) {
		contentHeight = 1;
	} else {
		contentHeight = screen.availHeight;
	}
  return contentHeight
}

function openAnyWinTwo (wUrl, wWindowName, wWidth, wHeight, wTop, wLeft, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable)
{
var features= 'width='        + wWidth +
              ',height='      + wHeight +
              ',top='        + wTop +
              ',left='      + wLeft +
              ',directories=' + wDirectories +
              ',location='    + wLocation +
              ',menubar='     + wMenubar +
              ',scrollbars='  + wScrollbars +
              ',status='      + wStatus +
              ',toolbar='     + wToolbar +
              ',resizable='   + wResizable;
window.open (wUrl, wWindowName, features);
}

function openAnyWin (wUrl, wWindowName, wWidth, wHeight, wDirectories, wLocation, wMenubar, wScrollbars, wStatus, wToolbar, wResizable)
{
var features= 'width='        + wWidth +
              ',height='      + wHeight +
              ',directories=' + wDirectories +
              ',location='    + wLocation +
              ',menubar='     + wMenubar +
              ',scrollbars='  + wScrollbars +
              ',status='      + wStatus +
              ',toolbar='     + wToolbar +
              ',resizable='   + wResizable;
window.open (wUrl, wWindowName, features);
}

function SubmitContent(path)
{
  window.document.theForm.FC3.value=path;
  window.document.theForm.action="/home/Framework";
  window.document.theForm.submit();
}

function getsitetype(searchstr, strprefix, offset){
   start = searchstr.lastIndexOf(strprefix);
   if (start != -1){
     return searchstr.substring(start-offset,start);
     }
   else
     {
     return "err";
     }
}

function writebannerimage(sitetype){
 if(sitetype != "rex")
 {
  bannerurl = "/home/global/images/" + sitetype + "_banner_37by306.gif";
  document.write("<IMG SRC='");
  document.write(bannerurl);
  document.write("' border=0 width=306 height=37 >");
 }
}

function LHNquickFindHelper()
{
  firstOption=escape(window.document.lhnform.firstField.value)-1
  if (firstOption>-1)
  {
    querystring="/help/QuickFind?listBox1=" + firstOption
    ReloadPage("3/=" + querystring)
  }
}

function LHNprintQFSelect(){
	document.write("<SELECT NAME='quickFindCategory' class='headerData1' onChange='window.document.lhnform.firstField.value=this.selectedIndex;this.selectedIndex=0;LHNquickFindHelper()'>");
	//  Insert Quick Find Options Below
	document.write("<OPTION>Select a Category</OPTION>");

	for (i=0; i<qfarray.length; i++){
		document.write("<OPTION value=" + i + ">" + qfarray[i].text + "</OPTION>");
	}
	document.write("</SELECT>");
}

function SubmitImpulse(path) {
  window.document.theForm.FC3.value=path;
  window.document.theForm.action="/home/Framework";
  window.document.theForm.submit();
}

function linkjumpto(){

	if (document.country.countryBox.options[document.country.countryBox.selectedIndex].value != "no_jump") {
		// window.parent.window.parent.location = document.country.countryBox.options[document.country.countryBox.selectedIndex].value
		redirect=document.country.countryBox.options[document.country.countryBox.selectedIndex].value
		top.location = redirect

	}
}

function quickFindHelper(siteId)
{
		firstOption=escape(window.document.quickFind.firstField.value)-1
		if (firstOption>-1)
		{
			xPos=(screen.width/2)-280
			yPos=(screen.height/2)-190
			specs="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,left="+xPos+",top="+yPos+",width=580,height=380"
			querystring="/home/QuickFind?siteId=" + siteId + "&listBox1=" + firstOption
			theWindow=window.open(querystring, "theWindow", specs);
			theWindow.focus();
		}

}

function printQFSelect(siteId){
        document.write("<SELECT NAME='quickFindCategory' class='headerData1' onChange='window.document.quickFind.firstField.value=this.selectedIndex;this.selectedIndex=0;quickFindHelper(\"" + siteId + "\")'>");
	//  Insert Quick Find Options Below
	document.write("<OPTION>Select a Category</OPTION>");

	for (i=0; i<qfarray.length; i++){
		document.write("<OPTION value=" + i + ">" + qfarray[i].text + "</OPTION>");
	}
	document.write("</SELECT>");
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}