document.observe('dom:loaded', function() {
    setTimeout(setFooter, 50);
});
function setFooter() {
    var footerPosition = Position.positionedOffset($('gg_footerPosition')).top;
    var contentLeftHeight = $('gg_contentLeft').getHeight() + 55;
    var toMove = contentLeftHeight - footerPosition;
    if (toMove > 0) { $("gg_footer").setStyle({ paddingTop: toMove + "px" }); }
}


jQuery(document).ready(function(){

    // adjust width of page container
    if (jQuery.browser.safari) {
        adjustPageWidth(980);
        jQuery(window).resize(function(){
            adjustPageWidth(980);
        });
    }
    
    
    // handle skyscraper banner
    jQuery.getScript('./skin/frontend/default/blank/js/swfobject.js', function() {
        var flashvars = {};
        flashvars.wmode = 'transparent';

        var params    = {};
        params.wmode = 'transparent';

        swfobject.embedSWF('./skin/frontend/default/blank/flash/10152_3_10_Banner.swf',
                           'banner-skyscraper',
                           '160',
                           '600',
                           '9.0.0',
                           'expressInstall.swf',
                           flashvars,
                           params
                          );
    });

    if (typeof _gaq != "undefined") {
        jQuery('#banner-skyscraper-container').bind('mousedown',  function() {
            _gaq.push(['_trackPageview', '/obl/skyscraper']);
        }); 
    }

});

/**
 * adjusts the width of html body
 * if value falls below given value
 * @param width int
 */
function adjustPageWidth(width) {
    jQuery('body').width(jQuery('body').width() < width ? width : '100%');
}


function popupOpen(target, name) {
    if (!name) {
        name = 'gg_popup';
    }
    var myWindow = window.open(target, name, "width=400,height=400,status=0,location=0");
    myWindow.focus();
    return false;
}

