tPopWait=20;
showPopStep=45;
popOpacity=90;

findParentLevel = 20;

sPop=null;
curShow=null;
tFadeOut=null;

document.write("<div id='popLayer' style='position:absolute;z-index:1000;display:none'></div>");

function isChild(o, parentObj) {
    if (o == parentObj) return true;
    var obj = o;
    var i = 0;
    while (obj && i++ < findParentLevel) {
        if (obj == parentObj) {
            return true;
        }
        obj = obj.parentElement;
    }
    return false;
}

function calcAbsTop(o) {
    var top = 0;
    var obj = o;
    var i = 0;
    while (obj && i++ < findParentLevel) {
        top += obj.offsetTop;
        obj = obj.offsetParent;
    }
    return top;
}

function showPopupText(){
    var o=event.srcElement;
    if (isChild(o, popLayer)) return false;
    MouseX = event.x;
    MouseY = event.y;
    ClientY = calcAbsTop(o) + o.clientHeight;

    if(o.tip!=null && o.tip!="") { o.pop=o.tip;o.tip="" }
    if(o.pop!=sPop) {
        sPop=o.pop;
        clearTimeout(curShow);
        clearTimeout(tFadeOut);
        if(sPop==null || sPop=="") {
            popLayer.style.display = 'none';
        } else {
            curShow=setTimeout("showIt()",tPopWait);
        }
    }
}

function showIt() {
    popLayer.innerHTML=sPop;
    popLayer.style.display = 'block';
    popWidth=popLayer.clientWidth;
    popHeight=popLayer.clientHeight;

    var left = 0;
    var top = 0;

    if (document.body.clientWidth - MouseX > popWidth) left = MouseX + document.body.scrollLeft - 4;
    else if (MouseX >= popWidth) left = MouseX + document.body.scrollLeft - popWidth;
    else left = 0;
    if (document.body.clientHeight - MouseY > popHeight) top = MouseY + document.body.scrollTop - 4;
    else top = ClientY - 4;

    if (top < ClientY) {
        top = ClientY - 4;
    }

    popLayer.style.left = left;
    popLayer.style.top = top;

    //popLayer.style.filter="Alpha(Opacity=100)";
    //fadeOut();
}

function fadeOut(){
    if(popLayer.filters.Alpha.opacity<popOpacity) {
        popLayer.filters.Alpha.opacity+=showPopStep;
        tFadeOut=setTimeout("fadeOut()",1);
    }
}

if (document.all) {
	document.onmouseover=showPopupText;
}