﻿// Preload Image

(function ($) {
    var cache = [];
    // Arguments are image paths relative to the current page.
    $.preLoadImages = function () {
        var args_len = arguments.length;
        for (var i = args_len; i--; ) {
            var cacheImage = document.createElement('img');
            cacheImage.src = arguments[i];
            cache.push(cacheImage);
        }
    }
})(jQuery)


// Rollover Page Histoire

$(document).ready(function () {
    $("#link1887").addClass("on");
    $(".bloc-detail-date").not("#date1887").hide();

    $("#link1887").click(function () {
        $(".bloc-detail-date").not("#date1887").hide();
        $("#date1887").show();
        $("a").not("#link1887").removeAttr("class");
        $("#link1887").addClass("on");    
    })
    $("#link1930").click(function () {
        $(".bloc-detail-date").not("#date1930").hide();
        $("#date1930").show();
        $("a").not("#link1930").removeAttr("class");
        $("#link1930").addClass("on");
    })
    $("#link1963").click(function () {
        $(".bloc-detail-date").not("#date1963").hide();
        $("#date1963").show();
        $("a").not("#link1963").removeAttr("class");
        $("#link1963").addClass("on");
    })
    $("#link1979").click(function () {
        $(".bloc-detail-date").not("#date1979").hide();
        $("#date1979").show();
        $("a").not("#link1979").removeAttr("class");
        $("#link1979").addClass("on");
    })
    $("#link2009").click(function () {
        $(".bloc-detail-date").not("#date2009").hide();
        $("#date2009").show();
        $("a").not("#link2009").removeAttr("class");
        $("#link2009").addClass("on");
    })
})

/* Jeu */

$(document).ready(function () {

    $(".selection-image li").click(function () {
        $(this).addClass("on");
        $(".selection-image li").not(this).removeAttr("class");
    })
})

/* Menu page Steeler */

$(document).ready(function () {
    $(".menu-steeler li").click(function () {
        $(this).addClass("on");
        $(".menu-steeler li").not(this).removeAttr("class");
    })

    $("#linkvideo").addClass("on");
    $(".bloc-detail").not("#video").hide();

    $("#linkvideo").click(function () {
        $(".bloc-detail").not("#video").hide();
        $("#video").show();
        $("#linkdesign").removeAttr("class");
        $("#linkdegustation").removeAttr("class");
        $("#linkcoffret").removeAttr("class");
        $("#linkvideo").addClass("on");
    })
    $("#linkdesign").click(function () {
        $(".bloc-detail").not("#design").hide();
        $("#design").show();
        $("#linkvideo").removeAttr("class");
        $("#linkdegustation").removeAttr("class");
        $("#linkcoffret").removeAttr("class");
        $("#linkdesign").addClass("on");
    })
    $("#linkdegustation").click(function () {
        $(".bloc-detail").not("#degustation").hide();
        $("#degustation").show();
        $("#linkvideo").removeAttr("class");
        $("#linkdesign").removeAttr("class");
        $("#linkcoffret").removeAttr("class");
        $("#linkdegustation").addClass("on");
    })
    $("#linkcoffret").click(function () {
        $(".bloc-detail").not("#coffret").hide();
        $("#coffret").show();
        $("#linkvideo").removeAttr("class");
        $("#linkdesign").removeAttr("class");
        $("#linkdegustation").removeAttr("class");
        $("#linkcoffret").addClass("on");
    })

})

/* Page Home */ *

$(document).ready(function () {

    /*imgURL = $(".bloc-content img").attr("src")
    imgURL_HOVER = imgURL.replace("-on", "-hover");
    imgURL_OFF = imgURL.replace("-on", "-off");*/

    $(".bloc-content img").hover(
            function () {
                imgURL = $(this).attr("src").replace("-on", "-hover");
                $(this).attr("src", imgURL);                          
            },
            function () {
                imgURL = $(this).attr("src").replace("-hover", "-on");
                $(this).attr("src", imgURL);
            }
     );

    $("#bloc1").hover(
        function () {
            imgOFF1 = $("#bloc2 img").attr("src").replace("-on", "-off");
            $("#bloc2 img").attr("src", imgOFF1)
            imgOFF2 = $("#bloc3 img").attr("src").replace("-on", "-off");
            $("#bloc3 img").attr("src", imgOFF2)
            imgOFF3 = $("#bloc4 img").attr("src").replace("-on", "-off");
            $("#bloc4 img").attr("src", imgOFF3)
            imgOFF4 = $("#bloc5 img").attr("src").replace("-on", "-off");
            $("#bloc5 img").attr("src", imgOFF4)
        },
         function () {
             imgOFF1 = $("#bloc2 img").attr("src").replace("-off", "-on");
             $("#bloc2 img").attr("src", imgOFF1)
             imgOFF2 = $("#bloc3 img").attr("src").replace("-off", "-on");
             $("#bloc3 img").attr("src", imgOFF2)
             imgOFF3 = $("#bloc4 img").attr("src").replace("-off", "-on");
             $("#bloc4 img").attr("src", imgOFF3)
             imgOFF4 = $("#bloc5 img").attr("src").replace("-off", "-on");
             $("#bloc5 img").attr("src", imgOFF4)
         }
    );
    $("#bloc2").hover(
        function () {
            imgOFF1 = $("#bloc1 img").attr("src").replace("-on", "-off");
            $("#bloc1 img").attr("src", imgOFF1)
            imgOFF2 = $("#bloc3 img").attr("src").replace("-on", "-off");
            $("#bloc3 img").attr("src", imgOFF2)
            imgOFF3 = $("#bloc4 img").attr("src").replace("-on", "-off");
            $("#bloc4 img").attr("src", imgOFF3)
            imgOFF4 = $("#bloc5 img").attr("src").replace("-on", "-off");
            $("#bloc5 img").attr("src", imgOFF4)
        },
         function () {
             imgOFF1 = $("#bloc1 img").attr("src").replace("-off", "-on");
             $("#bloc1 img").attr("src", imgOFF1)
             imgOFF2 = $("#bloc3 img").attr("src").replace("-off", "-on");
             $("#bloc3 img").attr("src", imgOFF2)
             imgOFF3 = $("#bloc4 img").attr("src").replace("-off", "-on");
             $("#bloc4 img").attr("src", imgOFF3)
             imgOFF4 = $("#bloc5 img").attr("src").replace("-off", "-on");
             $("#bloc5 img").attr("src", imgOFF4)
         }
    );
    $("#bloc3").hover(
        function () {
            imgOFF1 = $("#bloc1 img").attr("src").replace("-on", "-off");
            $("#bloc1 img").attr("src", imgOFF1)
            imgOFF2 = $("#bloc2 img").attr("src").replace("-on", "-off");
            $("#bloc2 img").attr("src", imgOFF2)
            imgOFF3 = $("#bloc4 img").attr("src").replace("-on", "-off");
            $("#bloc4 img").attr("src", imgOFF3)
            imgOFF4 = $("#bloc5 img").attr("src").replace("-on", "-off");
            $("#bloc5 img").attr("src", imgOFF4)
        },
         function () {
             imgOFF1 = $("#bloc1 img").attr("src").replace("-off", "-on");
             $("#bloc1 img").attr("src", imgOFF1)
             imgOFF2 = $("#bloc2 img").attr("src").replace("-off", "-on");
             $("#bloc2 img").attr("src", imgOFF2)
             imgOFF3 = $("#bloc4 img").attr("src").replace("-off", "-on");
             $("#bloc4 img").attr("src", imgOFF3)
             imgOFF4 = $("#bloc5 img").attr("src").replace("-off", "-on");
             $("#bloc5 img").attr("src", imgOFF4)
         }
    );
    $("#bloc4").hover(
        function () {
            imgOFF1 = $("#bloc1 img").attr("src").replace("-on", "-off");
            $("#bloc1 img").attr("src", imgOFF1)
            imgOFF2 = $("#bloc2 img").attr("src").replace("-on", "-off");
            $("#bloc2 img").attr("src", imgOFF2)
            imgOFF3 = $("#bloc3 img").attr("src").replace("-on", "-off");
            $("#bloc3 img").attr("src", imgOFF3)
            imgOFF4 = $("#bloc5 img").attr("src").replace("-on", "-off");
            $("#bloc5 img").attr("src", imgOFF4)
        },
         function () {
             imgOFF1 = $("#bloc1 img").attr("src").replace("-off", "-on");
             $("#bloc1 img").attr("src", imgOFF1)
             imgOFF2 = $("#bloc2 img").attr("src").replace("-off", "-on");
             $("#bloc2 img").attr("src", imgOFF2)
             imgOFF3 = $("#bloc3 img").attr("src").replace("-off", "-on");
             $("#bloc3 img").attr("src", imgOFF3)
             imgOFF4 = $("#bloc5 img").attr("src").replace("-off", "-on");
             $("#bloc5 img").attr("src", imgOFF4)
         }
    );
    $("#bloc5").hover(
        function () {
            imgOFF1 = $("#bloc1 img").attr("src").replace("-on", "-off");
            $("#bloc1 img").attr("src", imgOFF1)
            imgOFF2 = $("#bloc2 img").attr("src").replace("-on", "-off");
            $("#bloc2 img").attr("src", imgOFF2)
            imgOFF3 = $("#bloc3 img").attr("src").replace("-on", "-off");
            $("#bloc3 img").attr("src", imgOFF3)
            imgOFF4 = $("#bloc4 img").attr("src").replace("-on", "-off");
            $("#bloc4 img").attr("src", imgOFF4)
        },
         function () {
             imgOFF1 = $("#bloc1 img").attr("src").replace("-off", "-on");
             $("#bloc1 img").attr("src", imgOFF1)
             imgOFF2 = $("#bloc2 img").attr("src").replace("-off", "-on");
             $("#bloc2 img").attr("src", imgOFF2)
             imgOFF3 = $("#bloc3 img").attr("src").replace("-off", "-on");
             $("#bloc3 img").attr("src", imgOFF3)
             imgOFF4 = $("#bloc4 img").attr("src").replace("-off", "-on");
             $("#bloc4 img").attr("src", imgOFF4)
         }
    );
})
