defaultTime = 200;

var timerID;



/* Function that swaps images. */

	

function di20(id, newSrc) {

   var theImage = FWFindImage(document, id, 0);

   if (theImage) {

       theImage.src = newSrc;

   }

}

/* Functions that track and set toggle group button states. */

	

function FWFindImage(doc, name, j) {

   var theImage = false;

   if (doc.images) {

       theImage = doc.images[name];

   }

   if (theImage) {

       return theImage;

   }

   if (doc.layers) {

       for (j = 0; j < doc.layers.length; j++) {

           theImage = FWFindImage(doc.layers[j].document, name, 0);

           if (theImage) {

               return (theImage);

           }

       }

   }

   return (false);

}



function getElemRoot(elemId)  {

  isComp = true;

  if (document.layers)  {

    isComp = false;

    }

  else if (document.all)  {

    elemRoot = document.all[elemId];

    }

  else if (document.getElementById) {

    elemRoot = document.getElementById(elemId);

    }

  else  {

    isComp = false;

    }

  }



function doItNow(elemId,styleObj,styleVal)  {

  getElemRoot(elemId);

  if (isComp) {

    elemRoot.style[styleObj] = styleVal;

    }

  }



function doItLater(elemId,styleObj,styleVal,timerVal) {

  if (timerVal) {

    thisTimeout = timerVal;

    }

  else  {

    thisTimeout = defaultTime;

    }

  timerID = setTimeout("doItNow('" + elemId + "','" + styleObj + "','" + styleVal + "')",thisTimeout);

  }



openLayers = new Array();



function showLayers(layerID) {

  clearTimeout(timerID);

  deleteAt = 1; 



  newLength = layerID.length;

  if (openLayers.length > 0) {

    lenMark = openLayers.length - 1;

    oldLength = openLayers[lenMark].length;

  } else  {

    oldLength = 0;

  }

  

  if (oldLength > newLength)  {

    tempArray = openLayers;

    openLayers = new Array();

    

    for (var i = 0; i < tempArray.length; i++)  {

      openLayers[i] = tempArray[i];

      doItNow(openLayers[i],'visibility','visible');

      if (tempArray[i]==layerID)  {

        deleteAt = i + 1;  

        break;

        }

      }

    

    for (var i = deleteAt; i < tempArray.length; i++) {

      doItNow(tempArray[i],'visibility','hidden');

      }

    } 

    else if (newLength > oldLength) {

      openLayers[openLayers.length] = layerID

      doItNow(layerID,'visibility','visible');

    }

    else  { 

			doItNow(openLayers[lenMark],'visibility','hidden');

			openLayers[lenMark] = layerID;

			doItNow(layerID,'visibility','visible');

	  }

    

  }

  

function closeAll() {

  for(var j = 0; j < openLayers.length; j++)  {

    doItNow(openLayers[j],'visibility','hidden');

    }

  openLayers = new Array();

  }



function delayCloseAll()  {

  timerID = setTimeout("closeAll()",200);

  }

  



function formSubmit(elemId) {

  getElemRoot(elemId);

  elemRoot.submit();

  }

  

function buttonAction(address)  {

  document.location.href=address;

  }

  

function goToParentFrame(address)  {

  parent.location.href=address;

  }



function adminSelectAction(address,elemId)  {

  getElemRoot(elemId);

  elemVal = elemRoot.value;

  document.location.href=address + elemVal;

  }



function pop_up(target,itemid)  {

  if(window.popup)  {

    popup.close();

  }

  popup = window.open(target+'.cfm?objectid='+itemid,'popup','width=660,height=560,scrollbars=yes');

  popup.focus();

}




