function setFooter()
{
    var footerHeight = 27;
    var windowSize   = getWindowSize();
    var scrollXY     = getScrollXY();
    var margin       = 0;
    var isFirefox    = navigator.userAgent.indexOf("Firefox") != -1;

    if (isFirefox && windowSize[0] < 1000)
    {
        footerHeight += 15;
    }

    if (document.getElementById && document.getElementById('footer'))
    {
        document.getElementById('footer').style.margin = scrollXY[1] - footerHeight + 'px 0px 0px 0px';
    }


    return false;
}


function getWindowSize()
{
    var w = 0;
    var h = 0;

    if (typeof(window.innerWidth) == 'number')
    {
        w = window.innerWidth;
        h = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
    {
        w = document.documentElement.clientWidth;
        h = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight))
    {
        w = document.body.clientWidth;
        h = document.body.clientHeight;
    }


    return [w, h];
}


function getScrollXY()
{
    var x = 0;
    var y = 0;

    if (typeof(window.pageYOffset) == 'number')
    {
        x = window.pageXOffset;
        y = window.pageYOffset;
    }
    else if (document.body && (document.body.scrollLeft || document.body.scrollTop))
    {
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    }
    else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
    {
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }


    return [x, y];
}


window.onload = function()
{
    setFooter();
}

window.onscroll = function()
{
    setFooter();
}

window.onresize = function()
{
    setFooter();
}

