    
    function showLinks(links)
    {
        $("#inner-flash").html(links);
    }
	var themeOpen 	=	"";
	var questOpen	=	"";
	
    function switchLang(url)
    {
        window.document.location = url;
    }
    
    $(document).ready(function() {
        
        $("#language_selector").msDropDown();
        
        if ( $(".linkzoom-full").length > 0 )
										{
												$(".linkzoom-full").fancybox();
										}
    		if ( $('.menu-pads-accueil').length > 0 )
    		{
    			$('.menu-pads-accueil li:last').addClass('last-item');
    		}
			
			
            if($('input[name="youare"]').length > 0 && $('table#complementInfo').length > 0)
            {
                if($('input[name="youare"]:checked').attr('value') == 'pro')
                {
                    $('table#complementInfo').show();
                }
                else
                {
                    $('table#complementInfo').hide();
                }
            }

            if($('form#rdv-form').length > 0)
            {
                if($('input[name="youare"]:checked').attr('value') == 'pro')
                {
                    $('span.required').show();
                }
                else
                {
                    $('span.required').hide();
                }
            }
	
			/*$(".faq h4.title").click( function() {
				if (themeOpen != "")
				{
					$("#"+themeOpen).slideUp();
					$(".faq h4.theme-open").addClass('title');
					$(".faq h4.theme-open").removeClass('theme-open');
				}
				if (questOpen != "")
				{
					$("#"+questOpen).slideUp();
					questOpen	=	"";
				}
				
				$(this).removeClass('title');
				$(this).addClass('theme-open');
				var daID =	 $(this).attr('id');
				daID	=	daID.replace("open-", "");
				
				themeOpen = daID;
				$("#"+daID).slideDown();
			});*/
			
			$(".open-qu").click( function() {
				if (questOpen != "")
				{
					$("#"+questOpen).slideUp();
				}
				
				//$(this).removeClass('title');
				//$(this).addClass('theme-open');
				var daID =	 $(this).attr('id');
				daID	=	daID.replace("open-", "");
				
				questOpen = daID;
				$("#"+daID).slideDown();
			});
			
			
            $(".nav-infos").children("li").mouseover(function(){
                $(".first").removeClass('first');
                $(".pad-info-first").attr('class','pad-info');
                var tmpId   =   $(this).attr('id');
                $("#pad-"+tmpId).attr('class','pad-info-first');
                $(this).addClass('first');
            });
        
        // -> Formulaire LOGIN
            $(".login-button").mouseover(function(){
                $(".formLogin").css('display','block');
            });
			$("#login_panel").mouseleave(function(){
                $(".formLogin").css('display','none');
            });
            
        
        // -> Mini formulaire de recherche
            $(".keywords").focus(function(){
                $(this).attr('value', "");
            });
            $(".keywords").blur(function(){
                var searchTerm = "Rechercher";
                if ( $(this).attr('value') == "" )
                {
                    $(this).attr('value',searchTerm);
                }
            });

                $("a.paginationProduit").click(function(){
                    var searchTerm = $(this).attr("title");
                    var searchPage = $(this).attr("id").replace(/[\D]+/,"");
		    if ( $('.pagActive').length > 0 )
		    {
			$('.pagActive').removeClass('pagActive');
		    }
                    $.get(ajaxURL+"search/ajax_search.php",
                        {pagenu: searchPage, recherche: searchTerm/*, iso_lang: mainLang, id_lang: mainIdLang */},
                        function(data){
                            $("#productResearch").html(data);
                        }
                    );
                });

            if ( $(".sous_nav") )
            {
                $(".sous_nav").children("li").each(function() {
                    $(this).click(function(){
						
						if ( ( $(this).hasClass("actif") == false ) &&  ( $(this).parent("ul").hasClass("sous_nav_referencement") == false ) )
                        {
                            $(".actif").removeClass("actif");
                            $(this).addClass("actif");
                            var tmp = $(this).attr('id');
                            
                            $("."+currentTab).css('display', 'none');
                            $("."+tmp).fadeIn("slow");
                            currentTab  =   tmp;
                        }
                    });
                });
            }
            
            if ( $(".visuel_produit").length > 0 )
            {
                $(".visuel_produit").mouseover(function(){
                    $(this).addClass('visuel_produit_hover');
                });
                $(".visuel_produit").mouseleave(function(){
                    $(this).removeClass('visuel_produit_hover');
                });
            }
            if ( $(".box_finition").length > 0 )
            {
                $(".box_finition").mouseover(function(){
                    $(this).addClass('box_finition_hover');
                });
                $(".box_finition").mouseleave(function(){
                    $(this).removeClass('box_finition_hover');
                });
            }
            if ( $(".box_foyer").length > 0 )
            {
                $(".box_foyer").mouseover(function(){
                    $(this).addClass('box_foyer_hover');
                });
                $(".box_foyer").mouseleave(function(){
                    $(this).removeClass('box_foyer_hover');
                });
            }
            
             if ( $(".pathDiv").length > 0 )
            {
                $(".pathDiv").mouseover(function(){
                    $(this).addClass('pathDivActive');
                });
                 $(".pathDiv").mouseout(function(){
                    $(this).removeClass('pathDivActive');
                });
                /*$(".box_foyer").mouseleave(function(){
                    $(this).removeClass('box_foyer_hover');
                });*/
            }
            
            
          
		
    
        // -> Gestion des pads Erreur...
            if ( $("#errorPad") )
            {
              $("#errorPad").click(function(){
                $(this).css('display', 'none');
                $("#erlogPad").css('display', 'none');
              });
              $("#erlogPad").click(function(){
                $(this).css('display', 'none');
                $("#errorPad").css('display', 'none');
              });
            }
			
			
			
			if ( $(".one_carac").length > 0 )
			{
				if ( $('.post_it').length > 0 )
        {
					
            $('.one_carac').mousemove(function(e) {
                if ( $('.post_it').css('display','none') )
                {
                    picto   =   '';
                    if ( $(this).children("blockquote").html() != "" )
                    {
                        picto = $(this).children("blockquote").html();
                        
                        if ( picto == null )
                        {
                            picto = $(this).attr('src').replace("_picto", "_thumb");
                            //alert(picto);
                            text = "";
                        }
                        else
                        {
                            text = '<td>'+$(this).children("em").text()+'</td>';
                        }
                        picto = '<td class="pictoIllus"><img src="' + picto + '" /></td>';
                    }
                    else
                    {
                        text = '<td>'+$(this).children("em").text()+'</td>';
                    }
                    
                    //alert(text);
                    if ( $('.post_it').html() == '' )
                    {
                        var textExplication =   '<div class="arrow_top"></div><table class="tabInfo"><tr><td></td>' + text + '</tr></table><p class="bt">&nbsp;</p>';
                        //var textExplication =   '<div class="arrow_top"></div><table class="tabInfo"><tr><td></td>' + picto + text + '</tr></table><p class="bt">&nbsp;</p>';
                        $('.post_it').html(textExplication);
                    }

                    $('.post_it').css('display', 'block');
                    $('.post_it').css('z-index', '1000000'); 
                }
                if (e.pageX || e.pageY)
                {
                    posx = e.pageX;
                    posy = e.pageY;
                }
                else if (e.clientX || e.clientY)
                {
                    posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
                    posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
                }
                
                var hauteurPostIt = $('.post_it').height();
                hauteurPostIt	=	parseInt(hauteurPostIt);
		
                if($.browser.msie)
                {
                    marge = 12;
                }
                else
                {
                    marge = 7;
                }
		
                leftZoom = posx - ($('.post_it').width() / 2);
                topZoom = posy + 20; //- (hauteurPostIt / 2) + marge ;
                
                
                $('.post_it').css('left', leftZoom);//posx + 50);
                $('.post_it').css('top', topZoom);
            
            });
            
            $('.one_carac').mouseout(function(ev) {
                $('.post_it').html('');
                $('.post_it').css('display', 'none');
                $('.post_it').css('left', '0');
                $('.post_it').css('top', '0');
            });
	    
	    
            
        }
      
      }
    
	$(".label").each( function() {
	    $(this).html( $(this).html().replace('*','<span class="red">*</span>') );
		
	    });
	$(".labelMsg").each( function() {
	    $(this).html( $(this).html().replace('*','<span class="red">*</span>') );
		
	    });
	$("form > label").each( function() {
	    $(this).html( $(this).html().replace('*','<span class="red">*</span>') );
		
	    });
	
	
	
		
    });
    
    
    function displayPict(prodName)
    {
        
        
    }

    /*FUNCTION DE SELECTIONS */
        function changeNbArticle(nb)
        {
                $(".numberArticle").html(parseInt($(".numberArticle").html())+nb);
        }

        function addToSelection(id)
        {
            $.get(ajaxURL+'produits/ajaxSelection.php?id='+id);
            $("#selection").html("Retirer de ma selection");
            $("#selection").attr("href", "javascript:removeSelection('"+id+"')");
            changeNbArticle(1)
            displayMsg("Ce produit vient d'être ajouté à votre selection.",true)
        }
        function removeSelection(id)
        {
            $.get(ajaxURL+'produits/ajaxSelection.php?rid='+id);
            //page de selection
                changeNbArticle(-1)
                $("div[id$='"+id+"']").hide('slow')
            //Page de produit
                $("#selection").html("Ajouter à ma selection");
                $("#selection").attr("href", "javascript:addToSelection('"+id+"')");
        }
        function isSelected(id)
        {
            $.getJSON(ajaxURL+'produits/ajaxSelection.php?sid='+id, function(data) {
                if(data.sel)
                {
                    $("#selection").html("Retirer de ma selection");
                    $("#selection").attr("href", "javascript:removeSelection('"+id+"')");
                }
            });
        }

        function displayMsg(msg,display)
        {
            var winH = $(window).height();
            var winW = $(window).width();
            var centerDiv = $('.post_it');
            if(display)
            {
                centerDiv.html('<table class="tabInfo"><tr><td class="close"><a href="javascript:void(0);" onclick="displayMsg(\'\',false)">Fermer</a></td></tr><tr><td style="padding-left: 20px;">'+msg+'</td></tr></table><p class="bt">&nbsp;</p>');
                centerDiv.css('top', winH/2-centerDiv.height()/2);
                centerDiv.css('position', 'fixed');
                centerDiv.css('left', winW/2-centerDiv.width()/2);
                centerDiv.show('slow');
                centerDiv.css('z-index', '1000000');
            }
            else
            {
                centerDiv.css('display', 'none');
                centerDiv.css('left', '0');
                centerDiv.css('top', '0');
                centerDiv.css('position', 'absolute');
            }
        }

function disableError() {
	$(".errorBox").hide();
	$(".errorTextBox").hide();
}
    
