/*
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Personal Bio Utilities
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   These are the routines used on the Gavora Studio
   web-site to display and hide the divs for the girls'
   biographies, and to display fly-over tips.

   Note that these routines are here because they are
   generic, but they depend on a "hideAll" function that
   isn't, and it's defined in the index.php file.

   Likewise, the fly-over routines depend on the
   existence of a "divTipBox" div that defines, through
   its style settings, a small box.

   Collected together, tweaked, mashed, and polished by
   TGE Software.
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

function hideDiv( divname ) {
  window.status="hiding " + divname;
  page = document.getElementById( 'div' + divname );
  page.style.visibility="hidden";
}

function showDiv( divname ) {
  hideAll();
  window.status="showing " + divname;
  obj = document.getElementById( 'div' + divname );
  obj.style.visibility="visible";
}

var TipBoxID = "divTipBox";
var tip_box_id;

function findPosX( obj )
{
  var curleft = 0;
  if ( obj.offsetParent )
  while( 1 )
  {
    curleft += obj.offsetLeft;
    if ( !obj.offsetParent )
      break;
    obj = obj.offsetParent;
  }
  else if ( obj.x )
    curleft += obj.x;
  return curleft;
}

function findPosY( obj )
{
  var curtop = 0;
  if ( obj.offsetParent )
  while( 1 )
  {
    curtop += obj.offsetTop;
    if ( !obj.offsetParent )
      break;
    obj = obj.offsetParent;
  }
  else if ( obj.y )
    curtop += obj.y;
  return curtop;
}

function DisplayTip( me, offX, offY, content )
{
   var tipO = me;
   tip_box_id = document.getElementById( TipBoxID );
   var x = findPosX( me );
   var y = findPosY( me );
   tip_box_id.style.left = String( parseInt( x + offX ) + 'px' );
   tip_box_id.style.top = String( parseInt( y + offY ) + 'px' );
   tip_box_id.innerHTML = content;
   tip_box_id.style.display = "block";
   tipO.onmouseout = HideTip;
}

function HideTip()
{
  tip_box_id.style.display = "none";
}
