//Copyright (c) GeoCities 1998.  All Rights Reserved.
//Modified by PBU on Apr.1999

if(document.all)
{
var IW= 0;
var IH= 0;
var PX= 0;
var PY= 0;
var PBULogo= null;
//image width
var IMGW= 150;
//image height
var IMGH= 90;
var LSAFETY= 1;
var TSAFETY= 5;
//cccccc : grey background
var normal_backgroundColor= "cccccc";
//cccccc : special background remains grey
var special_backgroundColor= "cccccc";
var linkText= "";
var textLength= 0;
var letterSize= 8;
var defaultTextLength= 20;
var ourWidth= 0;
var ourSum=5;
var ourLeft= 5;
var smallSum= 0;
var gandalf= 0;
//will pile up the different menu items (other than GEDLogo and GEDMenu)
var ourLays= new Array();
//create a set with all the <DIV> found in the main page
var alldivs= new Array();
alldivs= document.all.tags("DIV");

//================
function PBULogoInit()
//================
//(re-)initialise our menu
{
if (PBULogo!= null) return;
else
  { 
  ID_CHECK:  
  for (i=0; i<alldivs.length; i++)
    {
    if ((gandalf==0)&&(alldivs(i).id == "GEDLogo"))
      {
      gandalf=1;
      PBULogo= alldivs(i);
      continue ID_CHECK;
      }
//    if(gandalf==1)
//      {
//      if(alldivs(i).id== "GEDMenu")
//        {
//        PBUmenu= alldivs(i);
//        continue ID_CHECK;
//        }
//      //pile up the different items (other than GEDLogo and GEDMenu)
//      ourLays[ourLays.length]= alldivs(i);
//      }
    }
  }
//define procedure to launch when different events occur
//PBULogo.onclick= PositionMenu;  //pop-up menu appears
PBULogo.onmouseover= neat_mouseover; //message in the status bar
PBULogo.onmouseout= neat_mouseout; //clean status bar
}

//=================
function neat_mouseover()
//=================
//this message appears when the mouse is over the logo
{
window.status= "back to top of page";
return true;
}

//=================
function neat_mouseout()
//=================
//clean the status bas when the mouse is no more over the logo
{
window.status= "";
return true;
}

//=================
function PBULogoPosition()
//=================
//computes where to display the pop-up image
{
if(PBULogo!= null)
  {
  IH= document.body.clientHeight;
  IW= document.body.clientWidth;
  PX= document.body.scrollLeft;
  PY= document.body.scrollTop;
  PBULogo.style.top= (IH+PY-(IMGH+TSAFETY));
  PBULogo.style.left=(IW+PX-(IMGW+LSAFETY));
  for (i=0; i<alldivs.length; i++)
    {
    if (alldivs(i).style.zIndex > PBULogo.style.zindex)
      PBULogo.style.zindex= (alldivs(i).style.zIndex + 1);
    }
  }
}

//===============
function PBULogoShow(toggle)
//===============
{
if(PBULogo!= null) PBULogo.style.display= toggle;
}

//===============
function PBU_pooling()
//===============
//pooling at constant frequency to check whether there are action to take
{
//if our browser is able to display our POP-UP menu ...
if (navigator.appVersion.indexOf("Mac") == -1)
  {
  oldIW= IW;
  oldIH= IH;
  oldPX= PX;
  oldPY= PY;
  //if the windows has been scrolled ...
  if ((document.body.clientHeight != oldIH)||(document.body.clientWidth != oldIW)||(document.body.scrollLeft != oldPX)||(document.body.scrollTop != oldPY))
    {
    PBULogoInit();
//remove those comments if GED will have one day frames ...
//    if(window != window.top)
//      {
//      PBUmenuSafety= 0;
//      var window_checker= 1;
//      var frameToShow= "";
//      var frameToShowWidth= 0;
//      var frameToShowHeight= 0;
//      var frameToShowTest= 0;
//      var frameToShowTemp= 0;
//      var frameToShowFull= "";
//      var allFrames= window.top.document.all.tags('frame');
//      if(allFrames.length==0) allFrames= window.top.document.all.tags('FRAME')
//      for(i=0;i<allFrames.length; i++)
//        {
//        var tempLoc= allFrames(i).src;
//        if(tempLoc.indexOf("http") == -1)
//          {
//          frameToShowTemp= allFrames(i).width * allFrames(i).height;
//          if(frameToShowTemp>frameToShowTest)
//            {
//            frameToShow= allFrames(i);
//            frameToShowTest= frameToShowTemp;
//            }
//          frame_search= window.top.location.href;
//          var tailURL= frameToShow.src;
//          frameIndex= frame_search.substring(0,frame_search.lastIndexOf("/"));
//          frameToShowFull= frameIndex+"/"+tailURL;
//          }          
//        }
//      } 
//    if ( (PBULogo != null) && 
//         ( (frameToShowFull== window.location.href) || 
//           ((!frameToShowFull) && (!window_checker)))   )
    if (PBULogo != null)
      {
      //clean up last display
      //ShowMenu("none");
      PBULogoShow("none");
      //compute position of new display
      PBULogoPosition();
      //show new display
      PBULogoShow("");
      }
    else
      {
      if(PBULogo != null)
        {
        PBULogoShow("none");
        }
      }
    }
  }
}

//===================
//the pop-up menu is launched by the "setInterval" command
//===================
setInterval("PBU_pooling()",100);
}
