var g_elm = 0;

function show(e, info) {
    if (g_elm == 0) {
        g_elm = document.getElementById('info');
        g_elm.innerHTML = info;
        var cursor = getPosition(e);
        g_elm.style.left = ( Number(cursor.x) + 20 ) + 'px';
        g_elm.style.top = ( Number(cursor.y) + 30 ) + 'px';
        g_elm.style.display = 'block';
    }
}

function hide() {
    if (g_elm != 0) {
        g_elm.style.display = 'none';
        g_elm = 0;
    }
}

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}
