var config = {
    sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
    interval: 200, // number = milliseconds for onMouseOver polling interval
    over: function() {
        var cible = $(this).attr('id');
        var chaine_1 = cible.split("_");
        $("#info_" + chaine_1[1]).css('display', 'block');
        return false;
    },
    timeout: 100, // number = milliseconds delay before onMouseOut    
    out: function() {
        var cible = $(this).attr('id');
        var chaine_1 = cible.split("_");
        $("#info_" + chaine_1[1]).css('display', 'none');
        return false;
    }
};



// fonction pour charger jqzoom
function loadJqZoom(smallImg, bigImg) {
    $("#apercu").attr("src", smallImg);
    $("#apercu").attr("jqimg", bigImg);
    $("#zoomimg").attr("href", bigImg);
    $(".jqzoom").jqueryzoom();
}

$(document).ready(function() {


    // formulaires
    $("input.autoreset").focus(function() {
        if ($(this).val() == $(this).attr("title")) {
            $(this).val("");
        }
    });
    $("input.autoreset").blur(function() {
        if ($(this).val() == "") {
            $(this).val($(this).attr("title"));
        }
    });

    $("input.saisie").focus(function() {
        $(this).addClass("focus");
    });
    $("input.saisie").blur(function() {
        $(this).removeClass("focus");
    });

    $(".produit").hover(function() {
        $(this).addClass("produit-roll");
    }, function() {
        $(this).removeClass("produit-roll");
    });


    $(".produit-recherche").hover(function() {
        $(this).addClass("produit-recherche-hover");
    }, function() {
        $(this).removeClass("produit-recherche-hover");
    });


    $(".categorie").hover(function() {
        $(this).removeClass("categorie");
        $(this).addClass("categorie-roll");
    }, function() {
        $(this).removeClass("categorie-roll");
        $(this).addClass("categorie");
    });

    $(".categorie").click(function() {
        var lienCat = $(this).children("p").children("a").attr("href");
        document.location.href = lienCat;
    });

    $(".minature img").click(function() {

        $(".minature img").removeClass("hover");
        $(this).addClass("hover");
        var smallImg = $(this).attr("src");
        var bigImg = $(this).attr("src").replace("TN", "SD");

        loadJqZoom(smallImg, bigImg);
    });

    $(".minature").hover(function() {

    }, function() {
        $(".jqzoom").jqueryzoom();
    });



    /* info bulle */
    $(".info_bulle").css('display', 'none');



    $(".bloc").mousemove(function(e) {
        var coorY = (e.pageY + 15) + "px";
        var coorX = (e.pageX - 100) + "px";
        $(".info_bulle").css('left', coorX);
        $(".info_bulle").css('top', coorY);
    });

   // $(".bloc").hover(function() {
   // $(".bloc").hoverIntent(config);

    /* CAROUSSEL */
    imgs = $('.caroussel').caroussel({ W: 125, H: 1, iH: 73, iW: 163, cp: 2, p: 2, s: 800, osL: 40 });
    //imgs = $('.caroussel').blockImage({W:125,H:1,iH:73, iW:163, cp:2,p:2, s:800, osL:40}); 
    // w=>width bloc/2 (rayon cercle)   H=> height/2 (1 pour tout sur une ligne)   iH iW=>taille images    cp=> champ profondeur gere opacite   p=> profondeur gere taille image et z-index   s=>speed   osL osT=>left top  btnL=>name btn gauche (si diff) : $('name')   btnR=>name btn droite (si diff) : $('name')

    // Scrollbar panier
    $('#panier_infos').jScrollPane({ scrollbarWidth: 9 });


});