<!--
//
// popup divs
//   
   
// Turn it on   
function PopupDivOn()
{
   if (this.timerID != 0)
   {
      clearTimeout(this.timerID);
      this.timerID = 0;
   }

   if (this.isBkg)
   	  layer = 2;
   else 
      layer = 5;
   
   this.onCount++;
   
   div = GetElementById(this.divName);
   
   if (div)
   {
     div.style.visibility = "visible";  
     div.style.zIndex = layer;  	 
   }
}

// Turn it on, but other popupdivs should go in front
function PopupDivBkg()
{
   this.isBkg = 1;
   this.On();
}

// turn it off
function PopupDivForceOff()
{
   this.onCount = 0;
   div = GetElementById(this.divName);   
   div.style.visibility = "hidden";  
}

function PopupDivCloseCB(popupDiv)
{	
   popupDiv.ForceOff();
}

function PopupDivScheduleClose()
{
   if (this.timerID != 0)
   {
      clearTimeout(this.timerID);
      this.timerID = 0;
   }
   
   if (this.onCount > 0)
   {
      this.onCount--;
   }
   
   if (this.onCount == 0)
   {   
      this.timerID = setTimeout("PopupDivCloseCB("+this.name+")", 30);//thousandths of a sec	
	
      div = GetElementById(this.divName);
      div.style.zIndex = "3";  	 // so new ones pop up in fron of this
   }   
}

function PopupDiv(popupName, divName)
{
   this.name = popupName;
   this.divName = divName;
   this.timerID = 0;
   this.onCount = 0;
   this.isBkg = 0;
   this.ForceOff = PopupDivForceOff;   
   
   // API
   this.On = PopupDivOn;
   this.Off = PopupDivScheduleClose;
   this.OnAsBkg = PopupDivBkg;

}

// -->