var xpos = 0 ;
var ypos = 0 ;

var url = false ;

var body_height = 0 ;
var body_width = 0 ;

if (navigator.appName == 'Netscape') {
    document.captureEvents(Event.MOUSEMOVE) ;
}

document.onmousemove = mauspos ;

function mauspos(e) {
    if (navigator.appName == 'Netscape') {
        xpos = e.pageX ;
        ypos = e.pageY ;
    }
    else {
        xpos = window.event.x ;
        ypos = window.event.y ;
    }

    yscroll = (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') == -1) ? document.body.scrollTop : window.pageYOffset ;
    if (navigator.userAgent.indexOf('Firefox') == -1) {
		ypos += yscroll ;
	}
}

function load_body_size() {

	if (self.innerHeight) // all except Explorer
	{
		body_width = self.innerWidth;
		body_height = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		body_width = document.documentElement.clientWidth;
		body_height = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		body_width = document.body.clientWidth;
		body_height = document.body.clientHeight;
	}
//    alert(body_width+'x'+body_height) ;
}

var divIDref = 'genuineTooltip' ;

function ShowToolTip(imgname, imgwidth, imgheight)
{
	if (!imgname) {
		HideToolTip() ;
	}
	document.getElementById('tooltippic').src = imgname ;

  divCode = (document.getElementById(divIDref)).style;

/*  divCode.width = (imgwidth+20)+'px' ;
  divCode.height = (imgheight+20)+'px' ;*/

		var x = xpos + 10 ;
		if (x + imgwidth + 30 > body_width) x = (body_width - imgwidth - 30) ;
      divCode.left = x + "px";
      var yscroll = navigator.appName == "Microsoft Internet Explorer" ? document.body.scrollTop : window.pageYOffset;
		var y = ypos + 15 ;
		if (y + imgheight + 30 > body_height + yscroll) y = body_height + yscroll - imgheight - 30 ;
      divCode.top = y + "px";
  divCode.display = "block";
}

function HideToolTip()
{
  divCode = (document.getElementById(divIDref)).style;
  divCode.display = "none";
}

window.onresize = load_body_size ;
