$(function () {
    InitGlobal();
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(InitGlobal);
});

function InitGlobal() {
    $('#divBackground').cycle({
        fx: 'fade'
    });

    //try { $('.divTabs').tabs(); } catch (e) { }
    doResize();
    $(window).resize(function () {doResize();});
    //$(window).scroll(function () {doResize();});
}
//window.onscroll = function () { doResize(); }
//window.onresize = function () { doResize(); }

function doResize() {
    try {
        var origWidth = 1500;
        var origHeight = 800;
        var winWidth = $(window).width();
        var winHeight = $(window).height();
        var newWidth = parseInt(winHeight * (origWidth / origHeight));
        var newHeight = winHeight;

        var xoffset = 0;
        if (winWidth > newWidth) {
            newWidth = winWidth
            newHeight = parseInt(winWidth * (origHeight / origWidth)); ;
        }

        //$("#divBackground").css("top", $(window).scrollTop());
        $(".imgBackground").css("width", newWidth);
        $(".imgBackground").css("height", newHeight);

        //alert($(document).height());
        //alert($(".imgBackground").height());
        if ($(document).height() < $(".imgBackground").height()+200) {
            // alert(1);
             $("#divFooter").css("top", $(window).height() - 87);
             $("#divFooter").css("position", "absolute");
        }
    } catch (e) {
    }
}




















