$(window).load(function () {

    var theWindow = $(window),
            $bg = $("#bg"),
            aspectRatio = $bg.width() / $bg.height();

    function resizeBg() {

        if ((theWindow.width() / theWindow.height()) < aspectRatio) {
            $bg
                        .removeClass()
                        .addClass('bgheight');
        } else {
            $bg
                        .removeClass()
                        .addClass('bgwidth');
        }

    }


    theWindow.resize(function () {
        resizeBg();
    }).trigger("resize");

});

function escondeBg() {
    $("#bg-1").fadeOut(1000);
    $("#bg-2").fadeOut(1000);
    $("#bg-3").fadeOut(1000);
    $("#bg-4").fadeOut(1000);
    $("#bg-5").fadeOut(1000);
}


function mensagem(msg) {
    alert(msg);
}


$(document).ready(function () {

    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
        $(window.document.location).attr('href', "naoSuporta.html");
    }


    $('#Menu li a')
		.css({ backgroundPosition: "0 0" })
		.mouseover(function () {
		    $(this).stop().animate({ backgroundPosition: "(0px -51px)" }, { duration: 500 })
		})
		.mouseout(function () {
		    $(this).stop().animate({ backgroundPosition: "(0px 0px)" }, { duration: 200, complete: function () {
		        $(this).css({ backgroundPosition: "0 0" })
		    } 
		    })
		})

$("#bg img").css("min-height", $(document).height());
$("#bg img").css("min-width", $(document).width());


    var Altura = $(window).height() / 1.2;
    $("#Colecao .carousel-images img ").css("max-height", Altura);
    $("#Colecao .carousel-images img ").css("max-width", (Altura * 0.66));

    $("#LookBook .carousel-images img ").css("max-height", Altura);
    $("#LookBook .carousel-images img ").css("max-width", (Altura * 0.66));

    var numero = 1;
    setInterval(function () {
        escondeBg();
        if (numero <= 5) {
            $("#bg-" + numero).fadeIn(1000);
        }
        else {
            numero = 1;
            $("#bg-" + numero).fadeIn(1000);
        }
        
        numero++;
    }, 10000);

    $("#Home").fadeIn(1000);

    $("#waterwheel-carousel-default").waterwheelCarousel();
    $("#waterwheel-carousel-default2").waterwheelCarousel();


});



