var xMousePos = 0;
var yMousePos = 0;
var myWidth = 0;
var myHeight = 0;
var scrOfY = 0;
var scrOfX = 0;

function display(id){
	var IE = document.all?true:false;

	if (!IE) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = captureMousePosition;
	if (xMousePos != 0){
		document.getElementById(id).style.display = 'block';
	}
	
	if (xMousePos < (myWidth/2)){
		document.getElementById(id).style.left = (xMousePos+15)+'px';
	} else {
		document.getElementById(id).style.left = (xMousePos-475)+'px';
	}
	if (yMousePos < (myHeight + scrOfY - 415)){
		document.getElementById(id).style.top = (yMousePos+15)+'px';
	} else {
		document.getElementById(id).style.top = (yMousePos-395)+'px';
	}
}

function hideAll(id) {

    	document.getElementById(id).style.display = 'none';

}

function captureMousePosition(e) {
	var IE = document.all?true:false;
	if (IE) {// grab the x-y pos.s if browser is IE
		xMousePos = window.event.clientX + document.body.scrollLeft;
		yMousePos = window.event.clientY + document.body.scrollTop;
	} else { // grab the x-y pos.s if browser is NS
		xMousePos = e.pageX;
		yMousePos = e.pageY;
	} 

	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		//alert("inner");
  	} else if( document.body ) {
    	//IE 4 compatible
    	myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
		scrOfY = document.body.scrollTop;
	    scrOfX = document.body.scrollLeft;
		//alert("body");
	} else if( document.documentElement ) {
		//IE 6+ in 'standards compliant mode'
   	 	myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
		scrOfY = document.documentElement.scrollTop;
	    scrOfX = document.documentElement.scrollLeft;
		//alert("element");
	}

	if( typeof( window.pageYOffset ) == 'number' ) {
    	//Netscape compliant
	    scrOfY = window.pageYOffset;
   		scrOfX = window.pageXOffset;   
	}
}
