/*
Plugin by Geoffrey Crofte
http://www.creativejuiz.fr
Free for personal use (cc)
*/

(function (a)
{
    a.fn.juizDropDownMenu = function (b)
    {
        jz = a.extend(
        {
        }, c, b);
        a(this).css(
        {
        	width: "960px",
        	paddingLeft: "10px",
        	paddingRight: "10px",
        	marginLeft: "10px",
            background: jz.menuBgMain
        });
        a(this).find("li[rel='secteur-hover']").css(
        {
        	margin: "0 0 0 0",
        	paddingRight: "0px",
        	width: "140px"
		});
     	a(this).find("li[rel='type-hover']").css(
     	{
     		margin: "0 0 0 0",
     		padding: "0 0 0 0",
     		marginLeft: "-14px",
     		width: "140px"
		});
		a(this).find("li[rel='prix-hover']").css(
		{
        	margin: "0 0 0 0",
     		padding: "0 0 0 0", 
			marginLeft: "-14px",
			width: "170px",
     		backgroundRepeat: "no-repeat"
		});
        a(this).find("ul").css(
        {
            position: "relative",
            height: jz.menuHeight,
            "font-size": jz.menuFontSize,
            "line-height": jz.menuLineHeight,
            "text-align": jz.menuMainTextAlign,
            background: jz.menuBgRight 
        });
        a(this).find("li").css(
        {
            position: "relative",
            display: "inline",
            zoom: "1",
            display: "inline-block",
            "list-style": "none"
        });
        a(this).find("li a").css(
        {
            display: "inline-block",
            padding: jz.menuPaddingFirstA,
            color: jz.menuColorFirstA,
            border: "0 none",
            "text-decoration": "none",
            background: jz.menuBgFirstA
        });
        a(this).find("li li a").css(
        {
            display: "block",    
            padding: jz.menuPadddingSecondA,
            background: jz.menuBgSecondA,
            "line-height": jz.menuLineHeightSub,
            color: "#384753",
            width: "auto"
        });
        a(this).find("li ul").css(
        {
            position: "absolute",
            zIndex : "600",
            display: "none",
            width: "180px",
            height: "auto",
            background: jz.menuBgSubMenu
            
        });
        a(this).find("li li").css(
        {
            display: "block",
            width: "auto",
            "float": "none",
            padding: jz.menuPaddingSub,
            "line-height": jz.menuLineHeightSub,
            "text-align": "left",
            background: "none"
        });
        a(this).after('<div style="clear: left;">&nbsp;</div>');
        a(this).children("ul").children("li").hover(function ()
        {
        	var Png='url(/laforetSkel/images/'+a(this).attr("rel")+'.png)';
     		a(this).css( {
     			background: Png,
     			backgroundRepeat: "no-repeat"
     		});
            a(this).find("ul a").css("width", "140px");
            a(this).find("ul").slideDown(jz.slidedownSpeed);
            a(this).addClass("drop_active");
        }, function ()
        {
            a(this).find("ul").stop(true, true).fadeOut(jz.fadeoutSpeed);
            a(this).removeClass("drop_active")
            a(this).css( {
     			background: "none"
       		});
            
        });
        a(this).children("li").children("a").focus(function ()
        {
            a(this).closest("li").find("ul").slideDown(jz.slidedownSpeed)
        });
        a(this).children("li").children("a").blur(function ()
        {
            a(this).closest("li").find("ul").fadeOut(jz.fadeoutSpeed)
        });
        a(this).find("li li a").hover(function ()
        {
            a(this).animate(
            {
                backgroundPosition: jz.menuBgSecondAgoTo
            }, jz.slideinBgSpeed)
        }, function ()
        {
            a(this).animate(
            {
                backgroundPosition: jz.menuBgSecondAgoBack
            }, jz.slideoutBgSpeed)
        });
        a(this).find("li li").hover(function ()
        {
        	a(this).css({
        		backgroundColor:"#384753",
        		color: "#97CADC"
        	});
        	a(this).children("a").css({
        		backgroundColor:"#384753",
        		color: "#97CADC"
        	});

        }, function ()
        {
        	a(this).children("a").css({
        		backgroundColor:"#97CADC",
        		color: "#384753"
        	});
        	a(this).css({
        		backgroundColor:"#97CADC",
        		color: "#384753"
        	});
        });

        a.browser.msie && a.browser.version == "6.0" && a(this).children("li").hover(function ()
        {
            a("select").hide(150)
        }, function ()
        {
            a("select").show(150)
        })
    };
    var d = document.location.href;
    var c =
    {
        menuHeight: "29px",
        menuBgMain: "url(/laforetSkel/images/fond-menu.png) 10px center no-repeat",
        menuBgRight: "",
        menuFontSize: "14px",
        menuLineHeight: "29px",
        menuMainTextAlign: "left",
        menuPaddingFirstA: "0 0px 0 15px",
        menuColorFirstA: "white",
        menuBgFirstA: "none",
        menuSeparatorFirstA: "none",
        menuPadddingSecondA: "0 14px",
        menuColorSecondA: "#yellow",
        menuBgSecondA: "#97CADC",
        menuBgSecondAgoTo: '0px 0px',
        menuBgSecondAgoBack: '-150px 0px',
        menuBgSubMenu: "#97CADC",
        menuBoxShadowSub: "0 0 1px #fff inset, 0 3px 4px #999",
        menuBorderRadiusSub: "0 0 15px 15px",
        menuPaddingSub: "0.4em 0",
        menuLineHeightSub: "1.3em",
        menuBorderSeparatorSub: "0px solid #eee",
        slidedownSpeed: 400,
        fadeoutSpeed: 400,
        slideinBgSpeed: 200,
        slideoutBgSpeed: 200
    }
})(jQuery);

