
jQuery(document).ready(function() 
{
    /*Customisation Scroll Bar */
    jQuery(function() {
        //on teste l'existence de div avec la classe de scroll perso
        if (jQuery(".scroll-pane").length > 0)
            jQuery('.scroll-pane').jScrollPane({ showArrows: true, scrollbarWidth: 11, scrollbarMargin: 5, wheelSpeed :30 });
    });


    //Ajout des flash par swfObject
    var flashvars = {};
    var params =
    {
        autostart: true,
        menu: "false",
        scale: "noscale",
        wmode: "transparent",
        AllowScriptAccess : "Always"
        
    };
    var attributes = {};

    //flash evenementiel
    if (jQuery("#FlashEvenementiel").length > 0)
        swfobject.embedSWF("/Content/Flash/evenementiel.swf", "FlashEvenementiel", "80%", "80%", "9.0.0", "expressinstall.swf", flashvars, params, attributes);

    //flash home
    if (jQuery("#FlashHome").length > 0)
        swfobject.embedSWF(jQuery("#FlashHome input:hidden").val(), "FlashHome", "796", "400", "9.0.0", "expressinstall.swf", flashvars, params, attributes);	
   
    //flash Carte interactive
    if (jQuery("#FlashCarte").length > 0)
        swfobject.embedSWF("/Content/Flash/FabioCarte2.swf", "FlashCarte", "375", "370", "9.0.0", "expressinstall.swf", flashvars, params, attributes);	

        
   jQuery("input.autoclear:text").each(function() 
   {
        var item = jQuery(this);

        item
        .focus(function() 
        {
            if (this.defaultValue == item.val())
                item.val("");
        })
        .blur(function() 
        {
            if (item.val() == "")
                item.val(this.defaultValue);
        });
    });

    //Nos magasins

    //Masquage de la liste des magasins
    if (jQuery(".SaisieZipCode").length > 0) {
        jQuery(".ListeMagasin > div").css({ 'display': 'none' });

        //Masquage ou affichage de liste des magasins en fonction de son etat
        jQuery(".BtnListeMagasin").toggle(
        function() {
            jQuery(".ListeMagasin").addClass("actif");
            jQuery(".ListeMagasin > div").css({ 'display': 'block' });
        }, function() {
            jQuery(".ListeMagasin > div").css({ 'display': 'none' });
            jQuery(".ListeMagasin").removeClass("actif");

        });
    };


    jQuery("#btTest").click(function(e)
    {
        e.preventDefault();
        ShowPlayer();
    });

    //Menu avec rollover nous rejoindre
    if (jQuery(".menujob").length > 0) {
        jQuery(function(){
	        jQuery(".menujob a").hover(function(){
		        jQuery(this).children("span").fadeOut();
	        }, function(){
		        jQuery(this).children("span").fadeIn();
	        })		
        });
    };
});


/* Ajout aux favoris */
function favoris() 
{
	if ( navigator.appName != 'Microsoft Internet Explorer' )
		window.sidebar.addPanel("Fabio Lucci",document.URL,"");
	else
	    window.external.AddFavorite(document.URL, "Fabio Lucci");
}

function goback() 
{
    window.history.back();
}

function ShowPlayer()
{
    jQuery.get('/Popup/Player-Home.html', function(data) 
    {
        var data = jQuery(data);
        if (data.length > 0)
        {
            jQuery(data).modal(
		    {
		        autoPosition : true,
		        overlayClose : true,
		        closeClass :"close",
			    onOpen: function(dialog)
			    {
			        jQuery("#simplemodal-overlay").css("background-color", "#FFF").css("z-index", "9999998");
			        jQuery("#simplemodal-container").css("z-index", "9999999");
			        dialog.overlay.fadeIn("fast", function()
				    {
					    dialog.container.fadeIn("fast", function()
					    {
					    	dialog.data.fadeIn("fast", function()
					        {
		        			    jQuery("#simplemodal-container").css("z-index", "9999999");
						        //dialog.data.find(".close").css("float","right").css("clear", "both");
						        dialog.data.find(".close").css("clear", "both");
                            });
					    });
				    });
			    },
			
		        onClose : function(dialog)
		        {
			        dialog.container.fadeOut("fast", function()
			        {
				        dialog.overlay.fadeOut("fast", function()
				        {
					        jQuery.modal.close();
				        });
			        });
		        }
		    });
		    
		}
    });
}
