var OpenPopup=null;
var TimerPop=null;
var PageWidth=729;

function clearTimerPop()
  {
   if (TimerPop)
     {
      clearTimeout (TimerPop);
      TimerPop = null;
     }
  }

function setTimerPop()
  {
   TimerPop = window.setTimeout('CloseAllPop(0)', 300);
  }

function ShowPopup(id,event)
  {
   CloseAllPop(0);
   clearTimerPop();
   if (IExplorer4)
     return ShowPopupE(id,event);
   if (Netscape6)
     return ShowPopupN(id,event);
   return true;
  }

function ShowPopupE(id,event)
  {
   elem = eval(id);
   if (document.all.item(id) == null)  return true;

   pwidth=document.body.clientWidth;
   if (document.body.clientWidth<PageWidth) pwidth=PageWidth;
   elem.style.pixelLeft = event.clientX+10;
   elem.style.pixelTop = event.clientY+document.body.scrollTop+5;
   if (elem.style.pixelLeft+elem.style.pixelWidth > document.body.clientWidth ) elem.style.pixelLeft=document.body.clientWidth-elem.style.pixelWidth-2;

   elem.style.visibility = "visible";
   elem.style.display = "block";
   OpenPopup=elem;
   return false;
  }

function ShowPopupN(id,event)
  {
   elem = document.getElementById(id);
   if (elem == undefined) return true;

   pwidth=window.innerWidth;
   if (window.innerWidth<PageWidth) pwidth=PageWidth;
   elem.style.left = event.clientX+10;
   elem.style.top = event.clientY+window.scrollY+5;
   if (elem.style.pixelLeft+elem.style.pixelWidth > window.innerWidth ) elem.style.pixelLeft=window.innerWidth-elem.style.pixelWidth-2;

   elem.style.visibility = "visible";
   elem.style.display = "block";
   OpenPopup=id;
   return false;
  }

function ClosePopup()
  {
   if (IExplorer4)
     return ClosePopupE();
   if (Netscape6)
     return ClosePopupN();
   return true;
  }

function ClosePopupE()
  {
   if (OpenPopup)
     {
      OpenPopup.style.display = "none";
      OpenPopup.style.visibility = "hidden";
     }
   OpenPopup=null;
  }

function ClosePopupN()
  {
   if (OpenPopup)
     {
      document.getElementById(OpenPopup).style.visibility = "hidden";
      document.getElementById(OpenPopup).style.display = "none";
     }
   OpenPopup=null;
    }

function CloseAllPop()
  {
   clearTimerPop();
   ClosePopup();
  }


