﻿

    var bgImages = new Array();
    for (x=0; x<=10; x++){
        bgImages[x] = new Image();
        bgImages[x].src = '/Templates/Images/BodyBg'+x+'.gif';
    }
    
    var bgImagesCount = 10;

    function effect(){
      
        if(bgImagesCount>0)
        {
            bgImagesCount--;
            $(document.body).css('backgroundImage', 'url(' + bgImages[bgImagesCount].src + ')');

            setTimeout(effect, bgImagesCount*4);
        }else{
        //showObjInline('MainCol');
            $('#MainCol').show();
            positionBottomSections()

            $(window).resize(function() {
                positionBottomSections();
            });

        }
    }

    function positionBottomSections() {

        //alert($('#BottomLeftSection').offset().top + ':' + ($('#LeftSection').offset().top + $('#LeftSection').height() + 60))

        if ($(window).height() <= ($('#LeftSection').offset().top + $('#LeftSection').height() + 190 	)) {
            $("#BottomLeftSection").css({ "top": ($('#LeftSection').offset().top + $('#LeftSection').height() + 60) + "px", "bottom": "auto" }); ;
        } else {
            $("#BottomLeftSection").css({ "top": "auto", "bottom": "20px" }); ;
        }

        if ($(window).height() <= ($('#MainSection').offset().top + $('#MainSection').height() +  $('#IntroTop1').height() + 0)) {
            $("#BottomMiddleSection").css({ "top": ($('#MainSection').offset().top + $('#MainSection').height() + 70) + "px", "bottom": "auto" }); ;
        } else {
            $("#BottomMiddleSection").css({ "top": "auto", "bottom": "20px" });
        }
    }
    $(document).ready(function() {
        effect()
    });
    


