
/*--------------------------------- INITS ---------------------------------*/
jQuery.noConflict()(function() {
	
	checkClient();
	BBCart("check");
	BBTool_flash();
	initMenu();
	initQuickBuy();
	initBanner();
	initBBSlider();
	dspBasketDetail();
	//getLastSeenProducts();
	
	var BBTool_pageSizes 			= BBTool_getPageSize();
	var BBTool_pageScroll 			= BBTool_getPageScroll();
	
		BBVars.pageWidth 			= BBTool_pageSizes[0];
		BBVars.pageHeight 			= BBTool_pageSizes[1];
		BBVars.windowWidth 			= BBTool_pageSizes[2];
		BBVars.windowHeight 		= BBTool_pageSizes[3];
		BBVars.pageScrollX 			= BBTool_pageScroll[0];
		BBVars.pageScrollY 			= BBTool_pageScroll[1];
		
		BBVars.dataSendContentID	= (jQuery(".dataSend").length>0) ? jQuery(".dataSend").attr("id") : "";
	/* nav Credit*/
	var navStatus = 0;
	function loadNav(){
	    if(navStatus==0){
			jQuery(".box_credit").fadeIn("slow");
	        navStatus = 1;	        
	    }
	}
	function disableNave(){
	    if(navStatus==1){
	        jQuery(".box_credit").fadeOut("slow");
	        navStatus = 0;	        
	    }
	}	
	jQuery("body").bind("click", function(){
		disableNave();
	});	 
	jQuery(".link_credit").bind("click", function(){
		loadNav();
		return false;
	});
	if (jQuery("#" + BBSettings.defaultHintID).length == 0) {
		jQuery('body').append(
		jQuery('<div id="' + BBSettings.defaultHintID + '"></div>').css({
			"position": "absolute",
			"top": "0",
			"left": "0",
			"z-index": 10000,
			"display": "none"
		}));
	}
	var secureMsg = jQuery("#securePayement").html();
	var deliveryMsg = jQuery("#Delivery").html();
	
	jQuery(".securePayement").bind("mouseover", function (e) {TTip_hover(e, secureMsg);})
		.bind("mousemove", function (e) {TTip_hover(e, secureMsg);})
		.bind("mouseleave", function (e) {jQuery("#" + BBSettings.defaultHintID).css("display", "none")});	
	
	jQuery(".Delivery").bind("mouseover", function (e) {TTip_hover(e, deliveryMsg);})
		.bind("mousemove", function (e) {TTip_hover(e, deliveryMsg);})
		.bind("mouseleave", function (e) {jQuery("#" + BBSettings.defaultHintID).css("display", "none")});
		
	/* End Nav credit */
	switch(BBVars.currentPageName) {
		case "index":
			initHomepage();
			break;
		case "selection":
			if(jQuery("#lookDetails").length>0) {
				initBBSelect("#lookDetails");
				initBBCheckbox("#lookDetails");
				jQuery("#lookDetails .prodItem").each( function(i,el) {
					itemInfo = eval( "(" + jQuery(this).attr("data-BBParams") + ")" );
					jQuery.get(
						BBVars.pagesURL + "/ajax/attributs.cfm?produit_id=" + itemInfo.prodID + "&payssite=" + BBVars.currentCountry + "&attDetID=" + itemInfo.colorID,
						function(data){  setOptionDispo(data); }
					);	
				});
			} else initFilterOver();
			break;
		case "compte_perso":
			jQuery("#password1").val('');
			initBBSelect("#account_form");
			break;
		case "fiche":
			initBBSelect(".prodDetail_layer");
			initDspPicto();
			initScrollable(".cross_nav");
			jQuery("#bigPicto").data("colorID", BBVars.currentColorID);
			updateLastSeenProducts(ref_produitid_lastseen,ref_color_lastseen);
			jQuery.get(
				BBVars.pagesURL + "/ajax/attributs.cfm?produit_id="+BBVars.currentProdID + "&payssite=" + BBVars.currentCountry + "&attDetID=" + BBVars.currentColorID,
				function(data){  setOptionDispo(data); }
			);
			/*
			jQuery(".sizeList").bind("change", function(e) {
				selectedItem = jQuery(":selected", this).attr("id");
				BBCart('setAttrib', selectedItem);
			});*/
			jQuery(".mainImg").bind("load", function() {
				jQuery(this).animate({opacity: 1});
			});
			
			/*jQuery("#FBLayer").html( jQuery(".prodColor_layer .link_fb") );
			jQuery(".prodColor_layer .link_fb").remove()*/
			jQuery("#FBL"+BBVars.currentColorID).css("display", "block");
			//BBTool_toolTip();
			break;
		case "livraison":
			BBVars.tmpHTML = jQuery("#adrFact_layer").html();
			chooseAddress();
			initBBSelect("#frmUneAdresse");
			initBBRadio();
			initBBCheckbox("#giftMsg_layer");
		    /*jQuery(".BBCheckbox").bind("click", function(){
			   jQuery("#texte_message").attr("disabled","disabled");
			 });*/
			 jQuery(".BBCheckbox").toggle(function(){
			   jQuery("#texte_message").removeAttr('disabled');
			 },function(){
			   jQuery("#texte_message").attr("disabled","disabled");
			 });
			break;
		case "univers":
			jQuery('#mainBannerLayer').slideshow({
				timeout: 6000,
				fadetime: 3000,
				pauselink: 'pause1',
				pausecallback: function(self){
					self.html('Play')
				},
				playcallback: function(self){
					self.html('Pause');
				}
			});
			
			initFilterOver();
			break;
		case "panier":
			jQuery("#occultePanier").css({opacity:0});
			jQuery(".modifyBasket").bind("click", function() {
				var panier_id = jQuery(this).attr("id").replace("lien_","");
				jQuery(".modifyOptions_layer").css({height:0,width:0}).html("");
				BBChangePanier(panier_id);
			});	
			setTimeout("decompte()", 500);	
			break;
		case "contact":
			initBBSelect("#formContact");
			break;
		case "compte":
			initBBSelect("#adr_form");
			break;
		case "login":
			initBBSelect(".new_account_form");
			break;
		case "magasin":
			initBBSelect("#searchMap");
			break;
		case "nouveau_compte":
			initBBSelect(".new_account_form");
			break;
		case "histoire":
			jQuery(".history_home li").each( function(i,el) {
				jQuery(this).bind("mouseenter", function() {
					jQuery(".history_home li").css("opacity", 0.5);
					jQuery(this).css("opacity", 1);
				}).bind("mouseleave", function() {
					jQuery(".history_home li").css("opacity", 1);
				});
			});
			initScrollable(".box_historique");
			break;
		case "catalogue":
			initScrollable(".liste_catalogue");
			var items = jQuery(".box_catalogue p a");
			jQuery(".box_catalogue p a").css("opacity", 0.5);			
			items.bind("mouseenter", function() {
				if(jQuery(".box_catalogue :animated").length==0) jQuery(this).css("opacity", 1);
			}).bind("mouseleave", function() {
				if(jQuery(".box_catalogue :animated").length==0) jQuery(this).css("opacity", 0.5);
			});
			jQuery(".liste_catalogue:first").show();
			jQuery(".tt_cat:first").show();
			//jQuery(".box_catalogue p a:first").css("opacity", 1);
			jQuery('.box_catalogue p a').bind("click", function(e){
				e.preventDefault();
				jQuery(".liste_catalogue").hide();
				jQuery(".tt_cat").hide();
				jQuery(".box_catalogue p a").removeClass("selected");
				jQuery(this).addClass("selected");	
				var id_cat = jQuery(this).attr("id");
			    jQuery("#"+id_cat+"_big").show();
			    jQuery("#tt_"+id_cat).show();
			    
			    jQuery(".link_fb").css("display", "none");
			    jQuery(".link_fb").eq( jQuery(".box_catalogue p a").index( jQuery(".box_catalogue p a.selected")) ).css("display", "block");
			    
			 });
			 jQuery(".box_catalogue p a").eq( eval(jQuery("#mainTitle").attr("class")) ).trigger("click");
			 
			break;	
		case "lookbook":
			initScrollable(".lookbookDspLayer");
			var items = jQuery("#lookbookWrapper div.scrollable ul li");
			items.bind("mouseenter", function() {
				if(jQuery("#lookbookWrapper :animated").length==0) jQuery("#lookbookWrapper div.scrollable ul li").not(jQuery(this)).css("opacity", 0.5);
			}).bind("mouseleave", function() {
				if(jQuery("#lookbookWrapper :animated").length==0) jQuery("#lookbookWrapper div.scrollable ul li").css("opacity", 1);
			});
			break;
		case "partenaires":
			initPartners();
			initScrollable("#partners_content .partner_choice");
			break;
		case "actualite":
			initNewsPage();
			break;
		case "recrutement":
			initScrollable(".recruitment_layer");
			break;
		case "collections":
			initScrollable("#collectionsContainer");
			var items = jQuery("#collectionsContainer div.scrollable ul li");
			items.bind("mouseenter", function() {
				if(jQuery("#collectionsContainer :animated").length==0) jQuery("#collectionsContainer div.scrollable ul li").not(jQuery(this)).css("opacity", 0.5);
			}).bind("mouseleave", function() {
				if(jQuery("#collectionsContainer :animated").length==0) jQuery("#collectionsContainer div.scrollable ul li").css("opacity", 1);
			});
			break;
		case "recherche":
			initFilterOver();
			break;
		case "backstage":
			dspBackstage();
			break;
		case "faq":
				var Index = jQuery(".faqTxt").attr("sIndex");
				if(Index != null)
					jQuery('html,body').stop().animate({scrollTop: jQuery("#quest_" + Index).offset().top-35}, "slow");
			break;
	}
});

/*----------------------------------------------------------------------------------*/

/*--------------------------------- INIT FUNCTIONS ---------------------------------*/
var time_plus = 500;
function decompte()
	{
		time_plus = time_plus + 500;
		
		var dateaddtopanier = jQuery(".date_update").html();
		if(dateaddtopanier){
			jQuery(".hide_date").text(dateaddtopanier);
			jQuery(".hide").text(dateaddtopanier);
			jQuery(".box_compteur").text("2 H 0 MN");
		}else{
			var dateaddtopanier = jQuery(".hide_date").html();
		}
		
		var dates = jQuery(".hide").html();
		var aujourdhui = new Date(dates);
		aujourdhui = aujourdhui.getTime() + time_plus;
		
		var cible = new Date(dateaddtopanier);
		var time = parseInt(cible.getTime() / 1000, 10);
		
 		time_tmp = parseInt(aujourdhui / 1000, 10);
		
		restant = 3600*2 + 60 - (time_tmp - time);
	
		jour = parseInt((restant / (60 * 60 * 24)), 10);
		heure = parseInt((restant / (60 * 60) - jour * 24), 10);
		minute = parseInt((restant / 60 - jour * 24 * 60 - heure * 60), 10);
		seconde = parseInt((restant - jour * 24 * 60 * 60 - heure * 60 * 60 - minute * 60), 10);
		if (time_tmp >= time && restant > 0){
			setTimeout("decompte()", 500);
			jQuery(".box_compteur").text(heure+" H "+minute+" MN ");
		}else
		{
			jQuery(".box_compteur").text("00 H 00 MN");				
		}
	}
function checkClient() {
	jQuery.get(
		BBVars.pagesURL + "ajax/login.cfm?formAction=checkClient",
		function(data) {BBTool_openMsgBox(data, true)}
	);
}

function initMenu() {
	/* ailettes blanches menu header */
	jQuery("#menuList div a").hover(function(){
	   jQuery(this).parents("li").addClass("hover");
	 },function(){
	   jQuery(this).parents("li").removeClass("hover");
	 });
	
	/* menu prehome 
   jQuery("#HoverShop").bind("mouseenter", function(e) {
		jQuery(".sous_menu").stop().css({opacity: 0, display: "block"}).animate({opacity: 1}, function(){
			if(BBVars.isMsIE)
				this.style.removeAttribute("filter");
		});
		jQuery("#HoverShop").addClass('hover');
	});
	
	jQuery("#HoverShop").bind("mouseleave", function(e) {
		jQuery(".sous_menu").stop().animate({opacity: 0}, function() { jQuery(this).css("display", "none"); });
		jQuery("#HoverShop").removeClass('hover');
	});
	*/
	
	/* menu prehome */
	jQuery("li#HoverShop").hover(function(){
		jQuery(".sscat_menu").show();
		jQuery(this).addClass('hover');	   
	 },function(){
		jQuery(".sscat_menu").hide();
		jQuery(this).removeClass('hover');
	 });
	 
	jQuery("ul.sscat_menu").hover(function(){
	   jQuery("li#HoverShop").addClass("hover");
	 },function(){
	   jQuery("li#HoverShop").removeClass("hover");
	 });
	
	jQuery("#HoverShop .CatShop").each( function() {
		jQuery(this).bind("mouseenter", function(e) {
			jQuery(".TitleCat",this).css("display", "block");
		}).bind("mouseleave", function(e) {
			jQuery(".TitleCat",this).css("display", "none");
		});
		
	});

    /* footer */
    jQuery(".footer_arrow").bind("click", function(e) {
    	e.preventDefault();
    	var itemHeight = jQuery("#footerLayer .box_footer").height();
    	if(itemHeight == 0) {
	    	jQuery("#footerLayer .box_footer").animate({height: "160px"});
	    	jQuery("#footerLayer").addClass("active");
	    } else {
	    	jQuery("#footerLayer .box_footer").animate({height: "0px"});
	    	jQuery("#footerLayer").removeClass("active");
	    }
    });
}

function initQuickBuy() {
	jQuery("#products_list li").each( function() {

		jQuery("div.prodImg", this).bind("mouseenter", function(e) {
			jQuery(".add2cart_link", this)
					.stop()
					.css({ opacity: 0, display: "block"})
					.animate({opacity: 1}, "fast");
			
			if(jQuery(".visu_produit", this).attr("photo_back").length > 1) {
				var photo_back = jQuery(".visu_produit", this).attr("photo_back");
				jQuery(".visu_produit", this).attr({src: photo_back});
			}
			e.preventDefault();
		}).bind("mouseleave", function(e) {
			jQuery(".add2cart_link", this)
					.stop()
					.animate({opacity: 0}, "fast", function() {jQuery(this).css("display", "none"); });
			
			if(jQuery(".visu_produit", this).attr("photo_front").length > 1) {
				var photo_front = jQuery(".visu_produit", this).attr("photo_front");
				jQuery(".visu_produit", this).attr({src: photo_front});
			}
			e.preventDefault();
		});
	
	});
}

function initBanner() {
	var banners = jQuery("#BBBanner .banner");
	if(banners.length>1) {
		banners.css({opacity: 0, display: "none"}).attr("rel","false");
		var firstBanner = banners.eq(0);
		firstBanner.css("display","block").attr("dsp","true").animate({opacity: 1}, function() { setInterval("showBanner()",4000); });
	}
}

// Actions sur le block panier
function dspBasketDetail() {
	jQuery("#cartBtn").bind("mouseenter", function(event) {
			jQuery(".basketBlock_content").stop().css({opacity: 0, display: "block"}).animate({opacity: 1});
		}).bind("mouseleave", function(event) {
			jQuery(".basketBlock_content").stop().animate({opacity: 0}, function() { jQuery(this).css("display", "none"); });
		});
}

// Gestion des actions sur les images + menu de la HP
function initHomepage() {

	jQuery("#homepage_layer ul li").each( function() {
		var nbHPItem = jQuery(this).index();
			
		jQuery(this).css({opacity: 1});
		
		if(jQuery(this).hasClass("selected")) {
			jQuery("#left_menu_list dt.left_menu_title").eq(nbHPItem).trigger("click");
		} 
		jQuery(this).bind("click", function(e) {
			if(jQuery("#left_menu_list :animated").length == 0)
				jQuery("#left_menu_list dt.left_menu_title").eq(nbHPItem).trigger("click");
				jQuery("#homepage_layer ul li").removeClass("selected");
				jQuery(this).addClass("selected");
				jQuery("#homepage_layer ul li").stop().animate({opacity: 0.5});
				jQuery(this).stop().animate({opacity: 1});
		});
		
		
		jQuery(this).bind("mouseenter", function() {
			jQuery("#homepage_layer ul li").not(jQuery(this)).stop().animate({opacity: 0.5});
		});
		jQuery(this).bind("mouseleave", function() {
			jQuery("#homepage_layer ul li").stop().animate({opacity: 1});
		});

	});
	
	jQuery("#left_menu_list dt.left_menu_title").each( function() {
		jQuery(this).bind("click", function(e) {
			var nbMenuItem = jQuery(this).index("dt.left_menu_title");
			jQuery("#homepage_layer ul li").removeClass("selected");
			jQuery("#homepage_layer ul li").eq(nbMenuItem).addClass("selected");
			jQuery(".shadowLayer").addClass("shadow");
		});
	});
}


function initDspPicto() {
	jQuery(".prodColor_layer a").each( function() {
		var imgSrc = jQuery(this).attr("rel"),
			newImgSrc = imgSrc.replace("f_","e_"),
			imgName = jQuery(this).children().attr("title"),
			colorPicto = jQuery("#bigPicto");

		jQuery(this).bind("mouseenter", function() {
			if(jQuery(this).attr("colorID")!=colorPicto.data("colorID")) {
				colorPicto.html("<img src=" + newImgSrc + "><span>" + imgName + "</span>");
				colorPicto.stop().css({opacity: 0, display: "block"}).animate({opacity: 1});
			} else {
				colorPicto.html("<span>" + imgName + "</span>");
				colorPicto.stop().css({opacity: 0, display: "block"}).animate({opacity: 1});
			}
		}).bind("mouseleave", function() {
			//if(jQuery(this).attr("colorID")!=colorPicto.data("colorID"))
				colorPicto.stop().animate({opacity: 0}, function() { jQuery(this).css("display", "none"); });
		});
	});
}

/*----------------------------------------------------------------------------------*/

/*--------------------------------- CALLBACKS ---------------------------------*/
function checkClient_callback(data) {}

function login_callback(data) {setTimeout("BBTool_closeMsgBox()",2000);}

function sendPwd_callback(data) {setTimeout("BBTool_closeMsgBox()",2000);}

function sizeGuidCallback() {
	jQuery(".sizeGuid_menu li").each(function(i) {
		jQuery(this).bind("click", function(event) {
			if(jQuery(this).attr("class") != "selected") {
				jQuery(".sizeGuid_menu li").removeClass("selected");
				jQuery(this).addClass("selected");
				
				var layer = jQuery(this).attr("id");
				jQuery(".sizeGuid_content li").removeClass("selected");
				jQuery("#" + layer + "SizeGuid").addClass("selected");
				
				var newHeight = jQuery("#sizeGuid_popup").height();
				jQuery("#BBTool_msgBoxBody").height(newHeight);
			}
		});
	});
}

function QuickBuyCallback(getOptions,product_formID,ref_produitid_lastseen,ref_color_lastseen) {
	BBCart(getOptions,product_formID);
	initBBSelect(".quickBuy_popup");
	updateLastSeenProducts(ref_produitid_lastseen,ref_color_lastseen);
	//initDspPicto();
	//MagicZoom.refresh();
	//jQuery(".mainImg").bind("load", function() {
	//	jQuery(this).animate({opacity: 1});
	//});
	//jQuery("#FBLayer").html( jQuery(".prodColor_layer .link_fb") );
	//jQuery(".prodColor_layer .link_fb").remove()
	//jQuery("#FBL"+BBVars.currentColorID).css("display", "block");
}

function closeQbuyBox() {
	jQuery("#products_list li .quickBuy_layer").each(function(i) {
		jQuery(this).stop().animate({opacity: 0}, function() { jQuery(this).css("display", "none"); });
		jQuery(".content", this).remove();
	});
}

function lastSeen_callback() {
	initScrollable("#lastSeen_layer .lastSeen_content");
}

function mailing_callback(track) {
	if(track) {
		pageTracker._trackPageview('/newsletter-ok');
	}
	initBBSelect("#frmNewsletter");
}

// Ferme la fenetre de confirmation d'ajout au panier
function BBcart_Addcallback(data) {
	jQuery('html,body').stop().animate({scrollTop: jQuery("#headerLayer").offset().top-35}, "slow");
	BBTool_closeMsgBox();
	jQuery("#cartBtn").unbind("mouseenter");
	setTimeout("BBcart_closeBBcart_layer()",5500);
	closeQbuyBox();
}

/*----------------------------------------------------------------------------------*/

function BBLogin() {
	jQuery.get(
		BBVars.pagesURL + "ajax/login.cfm?formAction=prompt",
		function(data) {BBTool_openMsgBox(data, true)}
	);
}

function BBStock() {
	jQuery.get(
		BBVars.pagesURL + "ajax/retour_en_stock.cfm?formAction=prompt&code_ean="+ BBVars.currentProdEAN,
		function(data) {BBTool_openMsgBox(data, true)}
	);
}

function sendPwd() {
	jQuery.get(
		BBVars.pagesURL + "ajax/login.cfm?formAction=promptPwd",
		function(data) {BBTool_openMsgBox(data, true)}
	);
}

function sizeGuid(catNom) {
	BBSettings.BBPopup.elementsSettings.width = "975px";
	jQuery.get(
		BBVars.pagesURL + "ajax/guide_tailles.cfm?cat_nom=" + catNom,
		function(data) {
			BBTool_openMsgBox(data, true);
			BBSettings.BBPopup.elementsSettings.width = "600px";
		}
	);
}

function getFiche( prodID, catID, colorID, isCross ) {
	closeQbuyBox();
	jQuery("#QBuy_" + prodID + "_" + colorID).stop().css({opacity: 0, display: "block"}).animate({opacity: 1}, function() {
		if(BBVars.isMsIE)
			this.style.removeAttribute("filter");
	});
	jQuery.get(BBVars.pagesURL 		+ "fiche.cfm?isAjax=true"
			+"&produit_id="			+ prodID
			+"&cat_id="				+ catID
			+"&coul_att_detailID="	+ colorID,
			function(data) {
				BBTool_openMsgBox(data, true);
			}
		);
}

function getMyVisit() {
	jQuery.get(BBVars.pagesURL + "ajax/liste_produits_vus.cfm",
		function(data) {BBTool_openMsgBox(data, true);}
		);
}

function popMailing(mail) {
	if(typeof mail != "undefined") Email = mail;
	else Email = "";
	jQuery.get(BBVars.pagesURL + "mailing.cfm?mail=" + Email,
		function(data) {BBTool_openMsgBox(data, true);}
		);
}

function footMailing() {
	var mail = jQuery("#footer_frm_newsletter .input_newsletter").val();
	if((mail == BBLabels.label_mailFooter) || (mail == "")) {
		alert(BBLabels.label_errorFieldValue + " " + BBLabels.label_mailFooter);
	} else {
		popMailing(mail);
		jQuery("#footerLayer .footer_arrow").trigger("click");
	}
}

function popMire() {
	jQuery.get(BBVars.pagesURL + "ajax/mire_popup.cfm",
		function(data) {BBTool_openMsgBox(data, true);}
		);
}

function popGift() {
	jQuery.get(BBVars.pagesURL + "ajax/gift.cfm",
		function(data) {BBTool_openMsgBox(data, true);}
		);
}

function gift_img (nb) {
	jQuery("#picto_list li").each(function(i) {
		if(nb==i) {
			jQuery(this).removeClass();
			jQuery(this).fadeTo("fast",1,function(){
				jQuery("#gift_layer_"+jQuery(this).attr("tabId")).css("display","block").fadeTo("slow",1,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("opacity","1");
				//jQuery("#card_layer_"+jQuery(this).attr("tabId")).style.removeAttribute('filter');
			});
		} else {
			jQuery(this).removeClass();
			jQuery(this).fadeTo("fast",0.33,function(){
				jQuery("#gift_layer_"+jQuery(this).attr("tabId")).css("display","none").fadeTo("normal",0,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");});
			});
		}
	});
	
}

/* BACKSTAGE */
function dspBackstage() {
	
	/*var currentIndex = jQuery(".backstage_thumbnails li.selected").index(),
		nbItems = jQuery(".backstage_thumbnails li").length,
		timer = null;
	*/
	
	var controls = jQuery(".backstage_thumbnails li a");
	
	controls.each( function() {
	
		jQuery(this).bind("click", function(e) {
						
			controls.removeClass("selected");
			jQuery(this).addClass("selected");

		});

	});
	
	
	jQuery("a.next_btn").bind("click", function(e) {
		e.preventDefault();
		var currentIndex = controls.index( jQuery(".backstage_thumbnails li a.selected") ),
			nextIndex = eval(currentIndex) + 1,
			nextItem = (controls.length == nextIndex)? controls.eq(0) : controls.eq(nextIndex);
		nextItem.trigger("click");
		//flowPlayer.play(nextIndex);
	});
	
	jQuery("a.previous_btn").bind("click", function(e) {
		e.preventDefault();
		var currentIndex = controls.index( jQuery(".backstage_thumbnails li a.selected") ),
			prevIndex = eval(currentIndex) - 1,
			prevItem = (prevIndex < 0)? controls.eq( controls.length - 1) : controls.eq(prevIndex);
		prevItem.trigger("click");
		//flowPlayer.play(prevIndex);
	});
	
	var flowPlayer = $f("edenPlayer", {src: BBVars.pageURL + "ximg/flash/flowplayer-3.2.7.swf", wmode: 'opaque'}, {
		clip: {
			autoPlay: false,
			autoBuffering: true
		},
		play: {
			opacity: 0,
			label: null,
			replayLabel: 'Play again'
		},
		plugins: {controls: null}
	}).controls("eden", {duration: 25}).playlist("li.backstage_videosList", {loop: true});
	
		
}

function videoBackstage(link) {
	jQuery("#video").flash({
		src: BBVars.pagesURL + 'ximg/flash/player.swf',
		width: 636,
		height: 420,
		wmode: 'transparent',
		allowScriptAccess: 'always',
		salign: 'tl',
		align: 'top',
		flashvars: {
			base: BBVars.pagesURL + 'ximg/Flash/',
			flvwidth: 636,
			flvheight: 420,
			flvname: link
		}
	});
}
/*-------------------- LEFT MENU --------------------*/
function popup_left_col(id) { 
	var element = document.getElementById(id);
	var state = element.style.display;
	if (state == "block") element.style.display = "none";
	else element.style.display = "block";
}
/*---------------------------------------------------*/

/*-------------------- TRI PAR ATTRIBUT (UNIVERS) --------------------*/
function initFilterOver(menuID) {
	var menu = jQuery("#sizef_layer ul").attr("id");
	
	jQuery("#sizef_layer").bind("mouseenter", function(e) {
		e.preventDefault();
		jQuery("#" + menu).stop().css({opacity: 0, display: "block"}).animate({opacity: 1}, function() {
					if(BBVars.isMsIE)
						this.style.removeAttribute("filter");
				});
	
	}).bind("mouseleave", function(e) {
		jQuery("#" + menu).stop().animate({opacity: 0}, function() { jQuery(this).css("display", "none"); });
		
	});

}

function sortList(type, value){
	if(type =='price') {
		document.product_form.price_origine.value = value;
	} else if(type == 'number') {
		document.product_form.maxrows.value = parseInt(document.product_form.maxrows.value) + 12*value; 
	}
	else if(type == 'tri') {
		document.product_form.tri.value = value; 
	}
	document.product_form.submit();
}
/*---------------------------------------------------*/


function pictoHover(linkObj) {

	var label = jQuery('pictos_label');
	var label_layer = jQuery('pictos_label_layer');
	
	if(linkObj) {
		label.innerHTML = linkObj.title;
		label_layer.style.visibility = "visible";
	} else label_layer.style.visibility = "hidden";

}

var tmp_colorLabel = "";

function colorHover(label,DetID,attrib_id,sel_coul_id) {
	//alert(attrib_id);
	//alert(DetID);
	var label_layer = jQuery('color_label2');
	/*for(var i=0; i<Details.length; i++){
		var Detail = Details[i];
		if(DetID != Detail.DetailID)
			jQuery('OAttribut_a' +attrib_id + '_d' + Detail.DetailID ).style.display='none';
		else jQuery('OAttribut_a' +attrib_id + '_d' + Detail.DetailID ).style.display='block';
	}*/
	if(attrib_id){
		if(tab_coul){
		for(var i=0; i<tab_coul.length; i++){
			(tab_coul[i] == DetID)?	jQuery('OAttribut_a' +attrib_id + '_d' + tab_coul[i] ).style.display='block':jQuery('OAttribut_a' +attrib_id + '_d' + tab_coul[i] ).style.display='none';
			}
		}
	}
	if(label && label != "") {
		tmp_colorLabel = label_layer.innerHTML;
		label_layer.innerHTML = label;
	} else label_layer.innerHTML = tmp_colorLabel;

}

function setShippingMode() {

	if(document.forms['frmModeLivraison'].elements['mode_livraison'].length!=undefined) {
		for (i=0; i<document.forms['frmModeLivraison'].elements['mode_livraison'].length; i++) {
			if (document.forms['frmModeLivraison'].elements['mode_livraison'][i].checked == true) {
				shippingMode = document.forms['frmModeLivraison'].elements['mode_livraison'][i].value;
			}
		}
	} else {
		shippingMode = document.forms['frmModeLivraison'].elements['mode_livraison'].value;
	}
	
	document.forms["frmFacturation"].elements['mode_livraison1'].value	= shippingMode;
	document.forms["frmTravail"].elements['mode_livraison2'].value		= shippingMode;
	document.forms["frmUneAdresse"].elements['mode_livraison3'].value	= shippingMode;

}
/*
function BBChangeColor(colorSelected,listColor,item,photo,row){
	
	MagicMagnify_stopMagnifiers();
	jQuery("#cross_layer a").unbind("click");
	jQuery("#cross_layer ul[dsp=true]").attr("dsp","false");
	
	var lstColor=listColor.split(',');
	jQuery.each(lstColor,function(index, color){
		if(colorSelected != parseInt(color)){
			jQuery("#lienColor" + color).removeClass();
			jQuery("#lienColor" + color).addClass("colorGrey");
			jQuery("#liTaille" + color).hide();
			if(typeof jQuery("#cross_prod_layer" + color) != "undefined")
				jQuery("#cross_prod_layer" + color).hide();
			
	  	}
	  	else{
	  		//var row = eval(jQuery("#taille"+color).options[jQuery("#taille"+color).selectedIndex].value);
	  		// avec un select 
			BBVars.currentColorID = color;
	  		if(typeof photo != "undefined")
	  			jQuery("#imgQuickBuy").attr("src",photo);
	  		if(typeof row == "undefined")
	  			var row = jQuery("#taille"+color).val();

	  		BBCart('setAttrib', item + row, setAttrib_callBack,1);
	  		
	  		jQuery("#lienColor" + color).removeClass();
			jQuery("#lienColor" + color).addClass("colorSelect");
			jQuery("#liTaille" + color).show();
			
			if(typeof jQuery("#cross_prod_layer" + color) != "undefined")
				jQuery("#cross_prod_layer" + color).show().attr("dsp","true");
			jQuery.get(
				BBVars.pagesURL 	+"ajax/photo.cfm"
				+"?produit_id="			+BBVars.currentProdID
				+"&coul_att_detailID="		+color,
				function(data) {initCrossSelling(); BBTool_openMsgBox(data, true);}
			);
			//BBCart('setAttrib', 'item#BBAttrib_prodID#_' + this.options[this.selectedIndex].value', setAttrib_callBack,1);
	  	}
	});

}
*/

function getLastSeenProducts()
{
		jQuery.get(
			BBVars.pageURL+"ajax/liste_produits_vus.cfm",
			function(data) {BBTool_openMsgBox(data, true);},
			"html"
		)
		//only if the div exists on the current page 
		
}


/* Ajoute le produit aux 'produits vus' */
function updateLastSeenProducts(produit_id, colorid) {
	jQuery.get(
		BBVars.pageURL+"ajax/liste_produits_vus.cfm?produit_id="+produit_id+"&color_id="+colorid+"&action=add");
}


function showBanner() {

	jQuery("#BBBanner .banner[dsp='true']").animate({opacity:0}, function() {
		jQuery(this).css("display","none").attr("dsp","false");
		var nextLayer = (jQuery(this).next().hasClass("banner")) ? jQuery(this).next() : jQuery("#BBBanner .banner").eq(0);
		nextLayer.css("display","block").attr("dsp","true").animate({opacity: 1}, function() {});
	});

}

/*------------------- LAYER ADRESSE FACTURATION (LIVRAISON) -----------------------*/
function chooseAddress() {
	
	if(eval(jQuery("input[name='adrFact']").val()=="true")) {
		//jQuery("#adrFact_layer").html(BBVars.tmpHTML).slideDown();
		jQuery("#adrFact_layer").slideDown();
	} else {
		//jQuery("#adrFact_layer").slideUp(function() {jQuery(this).html("");});
		jQuery("#adrFact_layer").slideUp();
	}
}

/*---------------------------------------------------------------------------------*/

var selectHover = false;
var selectOpened = false;

function openSelect() {

	if(jQuery("#silBlock_list").attr("display") != "block") {
		jQuery("#silBlock_list").css("display","block");
		selectOpened = true;
	}
	

}

function closeSelect() {
	jQuery("#silBlock_list").css("display","none");
	selectOpened = false;
}

function showZoom(dsp) {
	if(dsp) jQuery("#silZoomLayer").fadeIn().css("display","block");
	else jQuery("#silZoomLayer").fadeOut().css("display","none");
}

function tab_sizeGuid (nb) {
	jQuery("#tab_list_ul li").each(function(i) {
		if(nb==i) {
			jQuery(this).removeClass();
			jQuery(this).addClass("li_actif");
			jQuery(this).fadeTo("fast",1,function(){
				jQuery("#tab_layer_"+jQuery(this).attr("tabId")).css("display","block").fadeTo("fast",1,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("opcaity", "1");
			});
		} else {
			jQuery(this).removeClass();
			jQuery(this).addClass("li_none");
			jQuery(this).fadeTo("fast",0.33,function(){
				jQuery("#tab_layer_"+jQuery(this).attr("tabId")).css("display","none").fadeTo("fast",0,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");});
			});
		}
	});
	
}



/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


function initDisplayCross() {
	
	jQuery(".DspCrossLink").bind("mouseenter", function( event ){
		jQuery("#cross_layer").css("display", "block").stop().animate({opacity: 1});
	});
	
	jQuery("#cross_layer").bind("mouseleave", function( event ){
		jQuery(this).stop().animate({opacity: 0}, function() {jQuery(this).css("display", "none");});
	});
}

function BBChangePanierContenu(dataJson) {
	var JsonAttr = jQuery.parseJSON(dataJson);
	
	jQuery("tr.trPanier").each( function(i) {
		present = false;
		
		for(n=0;n<JsonAttr.panier.length;n++){
			if(JsonAttr.panier[n].panier_id == jQuery(this).attr("id").replace("tr_","")) present = true;
		}
		if(present == false) delTR("#" + jQuery(this).attr("id"), "0px");
		
		//jQuery(this).hide().animate({height:'20px'}, 1000);
	});
	jQuery("#nb_panier").val(JsonAttr.panier.length);
	if(JsonAttr.panier.length < 1) {
		jQuery("#notEmptyBasket").animate({opacity:0}, 300, function() { jQuery(this).hide(); });
		jQuery("#emptyBasket").show().animate({opacity: 1},300);
		
	}
	for(i=0;i<JsonAttr.panier.length;i++){
		var panier_id =JsonAttr.panier[i].panier_id;
							
		jQuery("#attribut_" + panier_id).val(JsonAttr.panier[i].OptionID);
		jQuery("#attDetId_" + panier_id).val(JsonAttr.panier[i].attribut_detail_id);
		jQuery("#produit_" + panier_id).val(JsonAttr.panier[i].ProduitID);
		jQuery("#code_ean_" + panier_id).val(JsonAttr.panier[i].code_ean);
		jQuery("#stock_" + panier_id).val(JsonAttr.panier[i].stock_dispo);
		
		jQuery("#tr_" + panier_id +" .img_case").attr("src",JsonAttr.panier[i].img_path);
		jQuery("#quantite_" +panier_id ).val(JsonAttr.panier[i].quantite);
		if(JsonAttr.panier[i].qte_fixe == "true") jQuery("#tr_" + panier_id + " .qte_fixe").html(JsonAttr.panier[i].quantite);
			//alert(JsonAttr.panier[i].Nom);
			//alert(jQuery("#tr_" + panier_id +" .nomProduit").html());
		jQuery("#tr_" + panier_id +" .nomProduit").html(JsonAttr.panier[i].Nom);
		//alert(jQuery("#tr_" + panier_id +" .nomProduit").html());
		if(JsonAttr.panier[i].non_actif == "true" || JsonAttr.panier[i].non_qtedispo == "true") {
			jQuery("#tr_" + panier_id + " .price_case").css({display: "none"});
			jQuery("#tr_" + panier_id +" .total_case").css({display: "none"});
		}
			
		if(JsonAttr.panier[i].non_actif == "true") {
			jQuery("#tr_" + panier_id +" .offreNull").css({display: "tablecell"});
			jQuery("#balloonBtn").css({ display: "none"});
		}else 
		if(JsonAttr.panier[i].non_qtedispo == "true") {
			jQuery("#tr_" + panier_id +" .errQteDispo").css({ display: "tablecell"});
			jQuery("#balloonBtn").css({ display: "none"});
		}
		else {
			if(JsonAttr.panier[i].prix_avant_proc_coupon != JsonAttr.panier[i].prix_ht) {
				jQuery("#tr_" + panier_id +" .old_price").html(JsonAttr.panier[i].prix_avant_proc_coupon);
				jQuery("#tr_" + panier_id +" .old_price").css({ display: "block"});
			}
			else
				jQuery("#tr_" + panier_id +" .old_price").css({ display: "none"});
				
			jQuery("#tr_" + panier_id +" .prix_ht").html(JsonAttr.panier[i].prix_ht);
			jQuery("#tr_" + panier_id +" .total_case").html( JsonAttr.panier[i].prix_ttc)
			jQuery("#balloonBtn").css({ display: "block"});
			
		}
	}

	jQuery("#infoPrice_nb").html(JsonAttr.total_simple);
	if(JsonAttr.sstotal_simple == JsonAttr.sstotal_sans_remise_simple){
		jQuery("#infoStotPrice_txt").css({display:"none"});
		jQuery("#infoStotPrice_nb").css({display:"none"});
	}else {
		jQuery("#infoStotPrice_txt").css({display:"block"});
		jQuery("#infoStotPrice_nb").html(JsonAttr.sstotal_sans_remise_simple).css({display:"block"});
	}
		
}

function BBcart_AddPanierChangeCallback(data) {
	if(typeof jQuery("#qpanierJson", data) !="undefined")
		BBChangePanierContenu(jQuery("#qpanierJson", data).html());
	jQuery(".modifyOptions_layer").css({height:0,width:0}).html("");
	jQuery("#occultePanier").animate({opacity:0}, 300, function() { jQuery(this).hide(); });
}


function BBcart_closeBBcart_layer() {
	jQuery('#BBcart_layer').fadeOut(function(){
		jQuery('#BBcart_layer').remove();
		jQuery('#basket_infos').stop().animate({height: 0});
		dspBasketDetail();
	});
}




/* Init pour retour en haut de page fluide */
function initNavBtn() {
	jQuery(".navBtn").bind("click", function( e ) {
		jQuery('html,body').stop().animate({scrollTop: jQuery("#"+jQuery(this).attr("target")).offset().top-35}, "slow");
	});
}



/* PARTNERS (PARTENAIRES) */
function initPartners() {
	jQuery(".partner_choice ul li").each( function() {
		if(jQuery(this).attr("class") == "selected") {
			var partnerID = jQuery(this).attr("id");
			jQuery("#partner_list li .ContentWrap").css({display: "none"});
			jQuery("#Txt_" + partnerID + " .ContentWrap").css({display: "block"});
		}
		
		jQuery(this).bind("click", function(e) {
			e.preventDefault();
			var partnerID = jQuery(this).attr("id");
			if(jQuery(this).attr("class") != "selected") {
				jQuery(".partner_choice ul li").removeClass("selected");
				jQuery(this).addClass("selected");
				
				jQuery("#partner_list li .ContentWrap").css({display: "none"});
				jQuery("#Txt_" + partnerID + " .ContentWrap").stop().css({opacity: 0, display: "block"}).animate({opacity: 1});
			}
		});
	});
}

function NumberFormat(nStr){
	nStr += '';
	x = nStr.split(',');
	x1 = x[0];
	x2 = x.length > 1 ? ',' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ' ' + '$2');
	}
	var r = x1 + "" + x2;
	return r;
}

/* Add product to wishlist */
function addToWishlist(formulaire, salelist) {
	if (!salelist) salelist=0;
//	try {
		var the_form 				= jQuery("#"+formulaire);
		produit_id 	= the_form.attr("prodID");
		color_selected_id = the_form.attr("colorID");
		type_vente = jQuery("#"+formulaire+" input[name='type_vente']").val() ;
		//var the_form = document.forms[formulaire]; 
		var quantite_souhaitee = 1;
		if (salelist == 1)
		{
			quantite_souhaitee = jQuery("#"+formulaire+" input[name='quantite_souhaitee']").val() ;
			if ( quantite_souhaitee > 2)
			 {  
			 opaceIt($('popupWishlistError'), 1);
			 return;
			 }
		}
		jQuery("#"+formulaire+" input[name='salelist']").val(salelist);
		jQuery.get(
				BBVars.pagesURL	+ "ajax/addToWishlist.cfm?is_xml=true&frmaction=add_whishlist"
								+ "&produit_id=" + produit_id
								+ "&attribut_detail_id=" + color_selected_id
								+ "&type_vente=" + type_vente
								+ "&option_id="			+BBVars.currentOptionID
								+"&code_ean="			+BBVars.currentProdEAN,
				function(data) {BBTool_openMsgBox(data, true);}
			)
		
	/*}
	catch (e) {
		jQuery("#"+formulaire+" input[name='frmaction']").val('add_whishlist');
		jQuery("#"+formulaire).submit();
	} */
}

/* ANCIENNES FONCTIONS

function dspSCat( catID ) {

	var sMenu = jQuery("#left_menu_list ul").eq(catID);
	var sLink = sMenu.prev();
	var images = jQuery("img", sLink);
	
	if(images.length>0) {
		if(images.eq(1).css("opacity")==0) {
			images.eq(1).animate({opacity: 1});
			images.eq(0).animate({opacity: 0});
		} else {
			images.eq(1).animate({opacity: 0});
			images.eq(0).animate({opacity: 1});
		}
	} else sLink.toggleClass("selected");
	
	(sMenu.css("display")=="none") 
			? sMenu.css("display","block")
			: sMenu.css("display","none");

	//jQuery("a", sMenu).attr("style","border: 1px solid red;");

}

*/
function setProdList(data) {

	jQuery("#products_list").hide();
	var JsonProd = jQuery.parseJSON(data);
	jQuery("#products_list li.liProd").hide();
	for(i=0;i<JsonProd.prodListTailles.length;i++){

		jQuery("#products_list li#item" + JsonProd.prodListTailles[i].ProduitID + "_" + JsonProd.prodListTailles[i].Couleur).show();
	}
	jQuery("#occulteSize").animate({opacity:0}, 300, function() { jQuery(this).hide(); });
	/*var height_out = jQuery("#products_list").outerHeight();
	var width_out = jQuery("#products_list").outerWidth();
	//alert(height_out);
	jQuery("#products_list").css({height:"0px",width:"0px"}).show();
	jQuery("#products_list").css({height:"0px",width:"0px"}).animate({
									height: 	height_out,width: width_out},1500, function() {
							});*/
	jQuery("#products_list").toggle(700);
	//jQuery("#products_list").animate({height: height_out},4000);
}
