var win=null;


function newwin(id,w,h,what) {
    pos = "center";
    page = what + ".php";
    if(pos=="random")
    {
        myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
    }
    
    if(pos=="center")
    {
        myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;
    }else if((pos!='center' && pos!="random") || pos==null)
    {
        myleft=0;
        mytop=20
    }
    
    settings="width="+w+",height="+h+",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes";win=window.open(page,"details",settings);
  win.focus();
}

var initialize = 0;
var Ex, Ey, topColor, subColor, ContentInfo;
var ns = document.layers ? 1 : 0;
var ie = document.all ? 1 : 0;
if (!ie)
  var ot = document.getElementById ? 1 : 0;

if (ns) {
  doc = "document."; 
  sty = "";
}
if (ie){
  doc = "document.all."; 
  sty = ".style";
}
if (ot){
  doc = "document.getElementById('"; 
  sty = "').style";
}

if (ie) {
  Ex = "event.x";
  Ey = "event.y";
}

if (ns || ot) {
  Ex = "e.pageX";
  Ey = "e.pageY";
  window.addEventListener('mousemve',overhere,false)
  //window.captureEvents(Event.MOUSEMOVE);
  window.onmousemove = overhere;
}

function MoveToolTip(layerName, FromTop, FromLeft, e) {
  if (ie) {
    //eval(doc + layerName + sty + ".top = "  + (eval(FromTop) + document.body.scrollTop));
  }
  if (ns || ot) {
  /* eval(doc + layerName + sty + ".top = "  +  eval(FromTop));
  eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 15));*/
  }
}

function ReplaceToolTip(layerName){
  if (ie)
    document.all[layerName].innerHTML = ContentInfo;
  if (ns) {
    with(document.layers[layerName].document) { 
      open(); 
      write(ContentInfo); 
      close(); 
    }
  }
  if (ot)
    document.getElementById(layerName).innerHTML = ContentInfo;
}

function Activate() { 
  initialize=1;
}
function deActivate() {
  initialize=0;
}

function overhere(e) {
  if (initialize) {
    MoveToolTip("ToolTip", Ey, Ex, e);
    eval(doc + "ToolTip" + sty + ".visibility = 'visible'");
 } else {
    MoveToolTip("ToolTip", 0, 0);
    eval(doc + "ToolTip" + sty + ".visibility = 'hidden'");
  }
}

function EnterToolTip(layerName, TTitle, TContent) {
  if (TTitle != "" && TContent != "")
    ContentInfo = '<table width="200" cellspacing="0" cellpadding="4" style="border:1px solid #000000">'+
                  '<tr><td width="100%" class="headline" style="border-bottom:1px solid #000000"><b>'+
                  TTitle+
                  '</b></td></tr>'+
                  '<tr><td width="100%"  class="small2">'+
                  TContent+
                  '</td></tr>'+
                  '</table>';
  else 
    ContentInfo = "";
  ReplaceToolTip(layerName);
}
