// Set-up to use getMouseXY function onMouseMove
var IE = document.all?true:false
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0


function getBrowser() {
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1) return 'Opera';
    if (agt.indexOf("staroffice") != -1) return 'Star Office';
    if (agt.indexOf("webtv") != -1) return 'WebTV';
    if (agt.indexOf("beonex") != -1) return 'Beonex';
    if (agt.indexOf("chimera") != -1) return 'Chimera';
    if (agt.indexOf("netpositive") != -1) return 'NetPositive';
    if (agt.indexOf("phoenix") != -1) return 'Phoenix';
    if (agt.indexOf("firefox") != -1) return 'Firefox';
    if (agt.indexOf("safari") != -1) return 'Safari';
    if (agt.indexOf("skipstone") != -1) return 'SkipStone';
    if (agt.indexOf("msie") != -1) return 'Internet Explorer';
    if (agt.indexOf("netscape") != -1) return 'Netscape';
    if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
    if (agt.indexOf('\/') != -1) {
        if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
            return navigator.userAgent.substr(0,agt.indexOf('\/'));
        }
        else return 'Netscape';
    } else if (agt.indexOf(' ') != -1)
        return navigator.userAgent.substr(0,agt.indexOf(' '));
    else return navigator.userAgent;
}


function getMouseXY(e) {

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + document.body.scrollLeft
        tempY = event.clientY + document.body.scrollTop
    } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX
        tempY = e.pageY
    }
    // catch possible negative values in NS4
    if (tempX < 0){
        tempX = 0
        }
    if (tempY < 0){
        tempY = 0
        }
    // show the position values in the form named Show
    // in the text fields named MouseX and MouseY
    //document.Show.MouseX.value = tempX
    //document.Show.MouseY.value = tempY
    return true
}

function hidepopup()
{
    var popupBox = document.getElementById("popupbox");

    popupBox.style.visibility = "hidden";
    popupBox.style.display = "none";
}

function popup(msg)
{
    var popupBox = document.getElementById("popupbox");
    var popupBoxText = document.getElementById("popupbox_text");
    var height = popupBox.clientHeight;
    var myoffset = 0;
    var posY = tempY;
    var posX = tempX;

    if(height == 0) height = popupHeight;
    else popupHeight = height;

    myoffset = height / 2;
    myoffset += 30;
    posY -= myoffset;

    popupBoxText.innerHTML = msg;



    posX = posX + 20;
    if(posY < 0) posY = 0;

    if(getBrowser() == "Internet Explorer")
    {
        popupBox.style.pixelTop = posY;
        popupBox.style.pixelLeft = posX;
        popupBox.style.position = 'fixed';
    } else
    {
        popupBox.style.top = posY;
        popupBox.style.left = posX;
        popupBox.style.position = 'absolute';
    }
    

    popupBox.style.visibility = "visible";
    popupBox.style.display = "";
}


