wmtt = null;

document.onmousemove = updateWMTT;

function updateWMTT(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
		var dim = ViewportScrollDimensions();
		offset = 25;
				
		if ((x + wmtt.offsetWidth + offset)  < dim.w) {   } else {  x = dim.w - wmtt.offsetWidth - offset;   }
		if ((y + wmtt.offsetHeight + offset) < dim.h) {   } else { 	y = dim.h - wmtt.offsetHeight - offset;  }
		wmtt.style.left = (x + offset) + "px";
		wmtt.style.top  = (y + offset) + "px";
	}
}

function showWMTT(id) {
	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}

function ViewportScrollDimensions(){
	var dim ={w:0,h:0}
	
	var dimViewport = ViewportDimensions();
	var dimScroll = ScrollDimensions();
	
	dim.w = dimViewport.w + dimScroll.w;
	dim.h = dimViewport.h + dimScroll.h;
		
	return(dim);
}

function ViewportDimensions(){
	var dim={w:0,h:0}
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    dim.w = window.innerWidth;
    dim.h = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    dim.w = document.documentElement.clientWidth;
    dim.h = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    dim.w = document.body.clientWidth;
    dim.h = document.body.clientHeight;
  }
	return(dim);
}

function ScrollDimensions() {
  var dim={w:0,h:0}
  
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    dim.h = window.pageYOffset;
    dim.w = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    dim.h = document.body.scrollTop;
    dim.w = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    dim.h = document.documentElement.scrollTop;
    dim.w = document.documentElement.scrollLeft;
  }
  return(dim);
}