window.addEvent('load', function() {
    if($(document).getScrollSize().y <= $(document).getSize().y) {
        moveFooter();
        var footInterval = moveFooter.periodical(200);
    }
});

function moveFooter() {
    if($('footer')) {
        var footer = $('footer');
        var footH = footer.getSize().y;
        var inAllH = $('page').getSize().y;
        
        if($(document).getSize().y > (footH + inAllH) ) {
            footer.setStyles({
                position: 'absolute',
                bottom: 0,
                width: '100%'
            });
        } else {
            footer.setStyles({
                position: 'relative',
                bottom: ''
            });
        }
    }
} 

