// Web Browser Sniffer
var isIE = ((navigator.userAgent.indexOf("MSIE") > 0)&&(parseInt(navigator.appVersion) >= 4)) ? 1 : 0;
var isIE4 = (navigator.userAgent.indexOf("MSIE 4") > 0) ? 1 : 0;
var isIE5 = (navigator.userAgent.indexOf("MSIE 5") > 0) ? 1 : 0;
var isIE55 = (navigator.userAgent.indexOf("MSIE 5.5") > 0) ? 1 : 0;
var isIE6 = (navigator.userAgent.indexOf("MSIE 6") > 0) ? 1 : 0;
var isDT = (document.compatMode == "CSS1Compat") ? 1 : 0;
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var isNS4 = ((parseInt(navigator.appVersion) == 4)&&(isNS)) ? 1 : 0;
var isNS6 = (navigator.userAgent.indexOf("Gecko") > 0) ? 1 : 0;
var isDOM = (document.getElementById) ? 1 : 0;
var isOP = (navigator.userAgent.indexOf("Opera") > 0) ? 1 : 0;
var isOP4 = ((parseInt(navigator.appVersion) >= 4)&&(isOP)) ? 1 : 0;
if (isOP){
  var isIE4 = 0;
  var isIE5 = 0;
  var isIE55 = 0;
  var isIE6 = 0;
  var isNS6 = 0;
  var isNS4 = 0;
}


function getobject(obj){
  // Find the object
  var tempdiv;
  if (isNS4) { tempdiv = eval('document.' + obj); }
  else if (isDOM) { tempdiv = document.getElementById(obj); }
  else if (isIE) { tempdiv = document.all[obj]; }
  return tempdiv;
}

function hideobject(obj){
  var tempdiv = getobject(obj);
  if (isNS4){ tempdiv.visibility = "hide"; }
  else if (isDOM) { tempdiv.style.visibility = "hidden"; }
  else if (isIE) { tempdiv.style.visibility = "hidden"; }
  return;
}

function showobject(obj){
  var tempdiv = getobject(obj);
  if (isNS4) { tempdiv.visibility = "show"; }
  else if (isDOM) { tempdiv.style.visibility = "visible"; }
  else if (isIE) { tempdiv.style.visibility = "visible"; }
  return;
}

function getobjectWidth(obj){
  var tempdiv = getobject(obj);
  var divWidth = 0;
  if (isNS4) { divWidth = tempdiv.clip.width; }
  else if (isDOM) { divWidth = tempdiv.offsetWidth; }
  else if (isIE4) { divWidth = tempdiv.style.pixelWidth; }
  return divWidth;
}

function getobjectHeight(obj){
  var tempdiv = getobject(obj);
  var divHeight = 0;
  if (isNS4) { divHeight = tempdiv.clip.height; }
  else if (isDOM) { divHeight = tempdiv.offsetHeight; }
  else if (isIE4) { divHeight = tempdiv.style.pixelHeight; }
  return divHeight;
}

function moveobjectTo(obj, x, y){
  var tempdiv = getobject(obj);
  if (isNS4) {
    tempdiv.top = y;
    tempdiv.left = x;
  }
  else if (isDOM) {
    tempdiv.style.top = y + "px";
    tempdiv.style.left = x + "px";
  }
  else if (isIE) {
    tempdiv.style.pixelTop = y;
    tempdiv.style.pixelLeft = x;
  }
  return;
}

// Set up NS event capturing.
if (isNS)
  document.captureEvents(Event.MOUSEMOVE);

// These variables will hold the current mouse pointer position.

var mouseX = 0;
var mouseY = 0;

function getMousePosition(e) {
  var myevent = (isNS) ? e : event;
  if (isIE){
    var bodyobject = (isDT) ? document.documentElement : document.body;
    var myclientX = bodyobject.scrollLeft+myevent.clientX;
    var myclientY = bodyobject.scrollTop+myevent.clientY;
  }
  else {
    var myclientX = myevent.pageX;
    var myclientY = myevent.pageY;
  }
  mouseX = myclientX;
  mouseY = myclientY;
  moveobjectTo("tooltip", mouseX-(getobjectWidth("tooltip")/2)+50, mouseY+10)
  return;
}

document.onmousemove = getMousePosition;

function popuptooltip(message){
  var tempdiv = getobject("tooltip");
  var content='<table class=\"tooltip\"><tr><td>'+message+'<\/td><\/tr><\/table>';

  if(isNS4){
   tempdiv.document.open();
   tempdiv.document.write(content);
   tempdiv.document.close();
  }
  if(isIE||(isDOM)){
   tempdiv.innerHTML=content;
  }
  showobject("tooltip");
  return;
}

function killtooltip(){
  hideobject("tooltip");
}

