var	_top=0
var	_left=0
var	_eventopen=false

var	distancecursorX=0 //Customize x	offset of tooltip
var	distancecursorY=0 //Customize y	offset of tooltip

var	offsetdivfrompointerX=5	//Customize	x offset of	tooltip	DIV	relative to	pointer	image
var	offsetdivfrompointerY=5	//Customize	y offset of	tooltip	DIV	relative to	pointer	image. Tip:	Set	it to (height_of_pointer_image-1).


var	ie=document.all
var	ns6=document.getElementById	&& !document.all

function _show(_object)	{

    if (document.getElementById){
        subobj=document.getElementById(_object)
        _eventopen=true
        //subobj.style.width = 200
        //subobj.style.height =	100

        subobj.style.left=_left
        subobj.style.top=_top

        subobj.style.display="block"
        return false
    }
    else { 
        return true 
    }
}

function _close(subobj){
    document.getElementById(subobj).style.display="none";
    _eventopen=false;
}

function ietruebody(){
	return (document.compatMode	&& document.compatMode!="BackCompat")? document.documentElement	: document.body
}


function mousepos(e) {
    if (_eventopen) {
        var nondefaultpos = false;
        var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
        var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
        var winwidth = ie && !window.opera ? ietruebody().clientWidth : window.innerWidth - 20;
        var winheight = ie && !window.opera ? ietruebody().clientHeight : window.innerHeight - 20;
        var rightedge = ie && !window.opera ? winwidth - event.clientX - distancecursorX : winwidth - e.clientX - distancecursorX;
        var bottomedge = ie && !window.opera ? winheight - event.clientY - distancecursorY : winheight - e.clientY - distancecursorY;
        var leftedge = (distancecursorX < 0) ? distancecursorX * (-1) : -1000;
        if (rightedge < subobj.offsetWidth) {
            subobj.style.left = curX - subobj.offsetWidth + "px";
            nondefaultpos = true;
        } else {
            if (curX < leftedge) {
                subobj.style.left = curX - distancecursorX - offsetdivfrompointerX + "px";
            } else {
                subobj.style.left = curX + distancecursorX - offsetdivfrompointerX + "px";
            }
        }
        if (bottomedge < subobj.offsetHeight) {
            subobj.style.top = curY - subobj.offsetHeight - distancecursorY + "px";
            nondefaultpos = true;
        } else {
            subobj.style.top = curY + distancecursorY + offsetdivfrompointerY + "px";
        }
        subobj.style.visibility = "visible";
    } else {
        var nondefaultpos = false;
        var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
        var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
        var winwidth = ie && !window.opera ? ietruebody().clientWidth : window.innerWidth - 20;
        var winheight = ie && !window.opera ? ietruebody().clientHeight : window.innerHeight - 20;
        var rightedge = ie && !window.opera ? winwidth - event.clientX - distancecursorX : winwidth - e.clientX - distancecursorX;
        var bottomedge = ie && !window.opera ? winheight - event.clientY - distancecursorY : winheight - e.clientY - distancecursorY;
        var leftedge = (distancecursorX < 0) ? distancecursorX * (-1) : -1000;
        if (rightedge < 200) {
                subobj.style.left = curX - distancecursorX - offsetdivfrompointerX + "px";
            nondefaultpos = true;
        } else {
            if (curX < leftedge) {
                subobj.style.left = curX - distancecursorX - offsetdivfrompointerX + "px";
            } else {
                _left = curX + distancecursorX - offsetdivfrompointerX + "px";
            }
        }
        if (bottomedge < 100) {
            _top = curY - distancecursorY + "px";
            nondefaultpos = true;
        } else {
            _top = curY + distancecursorY + offsetdivfrompointerY + "px";
        }
    }
}


document.onmousemove=mousepos