$(document).ready(function() {
    $('#logo').flash({
        src: '/images/proteina/animacionLogoPequena.swf',
        width: 340,
        height: 165
    });

    $('#banner-cabecera').flash({
        src: '/images/proteina/bannerCarrusel.swf',
        width: 467,
        height: 256
    });

    var rn1=Math.floor(Math.random()*2)
    if(rn1 == 0) {
        $('#banner-pie').flash({
            src: '/images/proteina/bannerpedidos.swf',
            width: 467,
            height: 200
        });
    } else {
        $('#banner-pie').flash({
            src: '/images/proteina/bannerNitroTech.swf',
            width: 467,
            height: 250
        });
    }
    
    $('#small-banner').flash({
        src: '/images/proteina/BannerPequeno.swf',
        width: 140,
        height: 140
    });

    $('#banner-enlaces').flash({
        src: '/images/proteina/IconosFlash.swf',
        width: 205,
        height: 920
    });

    $('#banner-fabricantes').flash({
        src: '/images/proteina/bannerLogos.swf',
        width: 205,
        height: 500
    });

    var rn2=Math.floor(Math.random()*3);
    var $banner = "";
    switch(rn2)
    {
        case 0:
            $banner = "bannerGasppari"
            break;
        case 1:
            $banner = "BannerGoldNutrition"
            break;
        case 2:
            $banner = "banner1"
            break;
    }
    $('#bannerGasppari').flash({
        src: '/images/proteina/' + $banner + '.swf',
        width: 160,
        height: 600
    });


    $(".subcategory").mouseover(function() {
        $(this).css("background-color", "#1C1C1C");
        $(this).css("font-weight", "bold");
    });
    $(".subcategory").mouseout(function() {
        $(this).css("background-color", "black");
        $(this).css("font-weight", "normal");
    });
    $(".category").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/botonCategorias.gif')");
        $(this).css("border-left", "3px solid #F9E720");
        $(this).css("width", "200px");
    });
    $(".category").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/boton0.jpg')");
        $(this).css("border-left", "none");
        $(this).css("width", "203px");
    });
    $("#inicio").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/inicio2.jpg')");
    });
    $("#inicio").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/inicio1.jpg')");
    });
    $("#categorias").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/tienda2.png')");
    });
    $("#categorias").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/tienda1.png')");
    });
    $("#micompra").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/MICOMPRA2.jpg')");
    });
    $("#micompra").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/MICOMPRA1.jpg')");
    });
    $("#contacto").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/CONTACTO2.jpg')");
    });
    $("#contacto").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/CONTACTO1.jpg')");
    });
    $("#envios").mouseover(function() {
        $(this).css("background-image", "url('/images/proteina/envios2.png')");
    });
    $("#envios").mouseout(function() {
        $(this).css("background-image", "url('/images/proteina/envios1.png')");
    });
    $(".ok").mouseover(function() {
        $(this).attr("src", "includes/languages/espanol/images/buttons/ok2.jpg");
    });
    $(".ok").mouseout(function() {
        $(this).attr("src", "includes/languages/espanol/images/buttons/ok1.jpg");
    });

    $("input[name=cart_quantity]").change(function () {
        if( confirm("Ha realizado cambios en las cantidades, Desea actualizar el contenido de la cesta?") ) {
            $("#update_cart").click();
        }
    });
});

