
// Common helpers

function getAbsoluteY(oElement)
{
    var iReturnValue = 0;
    while (oElement != null)
    {
        iReturnValue += oElement.offsetTop;
        oElement = oElement.offsetParent;
    }
    return iReturnValue;
}

function getAbsoluteX(oElement)
{
    var iReturnValue = 0;
    while (oElement != null)
    {
        iReturnValue += oElement.offsetLeft;
        oElement = oElement.offsetParent;
    }
    return iReturnValue;
}

function popupInfo(divElem, l, t)
{
    with (divElem.style)
    {
        display = "block";
        position = "absolute";
        left = l;
        top = t;
    }
}

function unpopInfo(divElem)
{
    divElem.style.display = "none";
}

function rand(n)
{
    return (Math.floor(Math.random() * n + 1));
}

function getKey(e)
{
    if (window.event)
        return window.event.keyCode;
    else if (e)
        return e.which;
    else
        return null;
}

function gTableAlternate(gurtObject, even, odd)
{
    div = document.getElementById(gurtObject.containerID);
    span = div.firstChild;
    table = span.firstChild;
    rows = table.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++)
    {
        if (i % 2 == 0)
            rows[i].className = even;
        else
            rows[i].className = odd;
    }
}