/*
Javascript popup hint window
Replaces missing "Title" tag rendering in Netscape
Copyright (c) 2000 Soccerbot
www.soccerbot.com
*/

var FontFace =   "\"Arial,Helvetica\"";
var FontSize = "\"-2\"";
var PopupWidth = "150";
var Margin = "1";
var BorderColour = "#333399";
var PopupColour = "#ffffe0";
var FontColour = "#000000";
var CursorOffsetX = 8;
var CursorOffsetY = 12;
var PageX = 0;
var PageY = 0;
var LeftOffset=0;
var PopupVisible = false;
var ns4,ie4,ie5 = false;
var sbw;
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;

if (ie4) {
  ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)? true:false;
}

if ( (ns4) || (ie4) ) {
  if (ns4) sbw = document.sbWin;
  if (ie4) sbw = sbWin.style;
  document.onmousemove = mouseMove;
  if (ns4) document.captureEvents(Event.MOUSEMOVE);
}

// Popup to left of cursor
function wr(text,twidth) {
  PopupWidth = twidth;
  LeftOffset = CursorOffsetX;
  popup(text);
}

// Popup to left of cursor
function wl(text,twidth) {
  PopupWidth = twidth;
  LeftOffset = 0-CursorOffsetX-PopupWidth;
  popup(text);
}

// Popup to centre of cursor
function wc(text,twidth) {
  PopupWidth = twidth;
  LeftOffset=CursorOffsetX-(PopupWidth/2)
  popup(text);
}

function popup(text) {	
  var ltext = "<table width="+PopupWidth+" border=0 cellpadding="+Margin+" cellspacing=0 bgcolor=\""+BorderColour+"\"><tr><td><table width=100% border=0 cellpadding=2 cellspacing=0 bgcolor=\""+PopupColour+"\"><tr><td><font face="+FontFace+" color=\""+FontColour+"\" size=" +FontSize +">"+text+"</font></td></tr></table></td></tr></table>"
  LayerWrite(ltext);
  pdisplay();
}

//hide the popup 
function h() {
  if ( (ns4) || (ie4) ) {
    PopupVisible = false;
    ObjectHide(sbw);
  }
}

//display the popup
function pdisplay() {
  if ((ns4) || (ie4)) {
    if (!PopupVisible) {
      moveTo(sbw,PageX+LeftOffset,PageY+CursorOffsetY);
      ObjectShow(sbw);
      PopupVisible = true;
    }
  }
}

function mouseMove(e) {
  if (ns4) {PageX=e.pageX; PageY=e.pageY;}
  if (ie4) {PageX=event.x; PageY=event.y;}
  if (ie5) {PageX=event.x+document.body.scrollLeft; PageY=event.y+document.body.scrollTop;}
  if (PopupVisible) {
    //moveTo(sbw,PageX+LeftOffset,PageY+CursorOffsetY);
  }
}

function LayerWrite(lText) {
  if (ns4) {
    var lyr = document.sbWin.document;
    lyr.write(lText);
    lyr.close();
  }
  else if (ie4) document.all["sbWin"].innerHTML = lText;
}

function ObjectShow(obj) {
  if (ns4) obj.visibility = "show";
  else if (ie4) obj.visibility = "visible";
}

function ObjectHide(obj) {
  if (ns4) obj.visibility = "hide";
  else if (ie4) obj.visibility = "hidden";
}

function moveTo(obj,l,t) {
  obj.left = l;
  obj.top = t;
}

