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.replace(".", ",");
}

/*-------------------- TRI PAR ATTRIBUT (UNIVERS) --------------------*/

function filterOver(menuID) {

    var menu = document.getElementById(menuID + '_layer').getElementsByTagName("ul")[0];
    if (!menu.style.display || menu.style.display == "none") menu.style.display = "block";
    else menu.style.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 setSize(sizeID) {
	
	jQuery("#size_id").val(sizeID);

}

/*---------------------------------------------------*/


function newUserBack() {
    jQuery("#billingInfoLayer").animate({height: 0}, 1500);
    jQuery("#frmLoginSection").animate({height: jQuery("#loginSectionLayer").height()}, 1500, function () {
        $(this).css("height", "auto");
    });
}

function validateAdr() {
	if(!BBTool_checkForm(jQuery("#frmUneAdresse :input[check]"), false, BBSettings.checkFormErrorDsp)) {
	    jQuery("#frmUneAdresse").submit();
	    /*
	    jQuery("#shipAddrInfoLayer").animate({height: 0}, 1500);
	    jQuery("#shipModeLayer").animate({height: jQuery("#shipInfoLayer").height()}, 1500, function () {
	        jQuery(this).css("height", "auto");
	        jQuery("#adrInfoTitle").removeClass().addClass("processOK_title");
	    });
	    */
	}
}

function backAdr() {
    jQuery("#adrInfoTitle").removeClass().addClass("process_title");
    jQuery("#shipModeLayer").animate({height: 0}, 1500);
    jQuery("#shipAddrInfoLayer").animate({height: jQuery("#addrInfoLayer").height()}, 1500, function () {
        $(this).css("height", "auto");
    })
}

/*--------------------------------- CALLBACKS ---------------------------------*/

function account_callback() {
	if(!BBVars.isAjaxRunning) {
		jQuery.get(
	    	BBVars.pagesURL + "compte_perso.cfm?isCheckout=true&target=livraison.cfm",
			function (data) {BBTool_openMsgBox(data, true)}
		);
		jQuery("#shipAddrInfoLayer").animate({height: 0}, 1500);
		BBVars.isAjaxRunning = true;
	}
}

function createdAccount_callback(data) {
	window.location = BBVars.pagesURL + "livraison.cfm?adr="+jQuery("#accountResponse", data).attr("sameAdr");
}

function newUser_callback() {
    jQuery("#billingInfoLayer").animate({height: jQuery("#new_account_form").height()}, 1500, function () {
        $(this).css("height", "auto");
    });
    jQuery("#frmLoginSection").css("overflow", "hidden").animate({height: 0}, 1500);

}

function checkClient_callback(data) {}

function checkClient() {
    $.get(
		BBVars.pagesURL + "ajax/login.cfm?formAction=checkClient",
		function (data) {BBTool_openMsgBox(data, true)}
	);
}

function login_callback(data) {
    setTimeout("BBTool_closeMsgBox()", 2000);
}

function BBLogin() {
    $.get(
 	   BBVars.pagesURL + "ajax/login.cfm?formAction=prompt",
	   function (data) {BBTool_openMsgBox(data, true)}
	);
}

function sendPwd_callback(data) {
    setTimeout("BBTool_closeMsgBox()", 2000);
}

function sendPwd() {
    $.get(
   		BBVars.pagesURL + "ajax/login.cfm?formAction=promptPwd", function (data) {
        BBTool_openMsgBox(data, true)
    });
}

function sizeGuid() {
    $.get(
    	BBVars.pagesURL + "ajax/guide_tailles.cfm", function (data) {
        BBTool_openMsgBox(data, true)
    });
}

function pathBarInit() {
    var totalWidth = 0;
    jQuery("#pathBarList li").each(function () {
        totalWidth += jQuery(this).width() + 5;
    });
    jQuery("#pathBarList").width(totalWidth + "px");
    jQuery("#pathBar").css("opacity", 0).animate({width: totalWidth + 10 + "px", opacity: 1}, 2000);

}

function colorSelect(colorID) {
    jQuery("#colorID").val(colorID);
    jQuery("#product_form").submit();
}

function initCartBlock() {

	jQuery("#basketPop_layer").css({display: "none", opacity: 0});

	jQuery("#pink_btn.cartBlockItem").bind("mouseenter", function() {
		jQuery("#basketPop_layer").stop().css({display: "block", opacity: 0}).animate({opacity: 1});
	}).bind("mouseleave", function() {
		jQuery("#basketPop_layer").stop().animate({opacity: 0}, function() {jQuery(this).css("display","none");});
	});

}

function chgColor_callback() {

	getOptions_callback();
	MagicZoom.start(document.getElementById('imageProduit'));
	
	jQuery("#prodInfos_layer #products_list a").each( function( index ) {
		jQuery(this).bind("click", function(e) {
			e.preventDefault();
			var prodInfos = jQuery(this).attr("rel").split(";");
			var colorID = prodInfos[2];
			var prodID = prodInfos[0];
			var catID = prodInfos[1];
			var cartLineID = prodInfos[3];
			
			BBVars.currentProdID = prodID;
			BBVars.currentColorID = colorID;
			
			jQuery.get(
					BBVars.pagesURL + "fiche.cfm?cartLineID=" + cartLineID + "&prodID=" + prodID + "&cat_id="  + catID + "&produit_id=" + prodID + "&attDetID=" + colorID + "&coul_att_DetailID=" + colorID + "&isAjax=true",
					function (data) {BBTool_openMsgBox(data, true);}
				);
		});
	});
	
	//BBCart("getOptions", "product_form");
	

}

function GandS_display() {
	
	jQuery(".cat_choice").css({display: "none", opacity: 0});

	jQuery(".display_layer").bind("click", function() {
		var ul_id = jQuery(this).attr('id');
		jQuery("#" + ul_id + " .cat_choice").stop().css({display: "block", opacity: 0}).animate({opacity: 1});
	}).bind("mouseleave", function() {
		jQuery(".cat_choice").stop().animate({opacity: 0}, function() {jQuery(this).css("display","none");});
	});

}

/*--------------------------------- INIT FUNCTIONS ---------------------------------*/

$(document).ready(function () {

    if (BBVars.currentPageName != "paiement") {
        checkClient();
        BBCart("check");
        BBTool_flash();
		initCartBlock();
		initRainboots();
    }

    pathBarInit();

    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 = ($(".dataSend").length > 0) ? $(".dataSend").attr("id") : "";

    if (BBVars.currentPageName == "fiche") {
        var options = {
            showEffect: 'fadein',
            hideEffect: 'fadeout',
            fadeinSpeed: 'medium',
            fadeoutSpeed: 'medium',
            preloadText: 'Chargement'
        }

        $('.expand').click(function () {
            var href = jQuery(this).attr('href');
            var elclass = href.match('#([a-zA-Z]+)([0-9]+)');

            if (elclass[1] == 'html') {
                jQuery('.html' + elclass[2] + 'div').show();
                jQuery('.js' + elclass[2] + 'div').hide();
            } else {
                jQuery('.html' + elclass[2] + 'div').hide();
                jQuery('.js' + elclass[2] + 'div').show();
            }
            jQuery(this).addClass('alert').siblings('a').removeClass('alert');
            return false;
        });

        BBCart("getOptions");
        jQuery.get(
				BBVars.pagesURL + "ajax/avis.cfm?prodID="+BBVars.currentProdID,
				function (data) {
						BBTool_openMsgBox(data, true);
						tab_dyn_fiche(jQuery("#tab_list_ul li").eq(0).attr("tabId"));
					}
			);
			
		jQuery("#imageProduit").bind("mouseenter", function(e) {
			e.preventDefault();
			jQuery("#prodImg_layer .picto").stop().animate({opacity: 0}, function() {
				jQuery(this).css("display", "none");
			})
		});
		
		jQuery("#imageProduit").bind("mouseleave", function(e) {
			e.preventDefault();
			jQuery("#prodImg_layer .picto").css({display: "block", opacity: 0}).stop().animate({opacity: 1}, function() {
					if(BBVars.isMsIE)
						this.style.removeAttribute("filter");
						});
		}); 
        
    } else if (BBVars.currentPageName == "contact") {
    
    	jQuery(".retour_area").css({height: 0 + "px", display: "none"});
    	jQuery("#order").css({opacity: 0, display: "block"});
    	jQuery("#topic").val("1");
    	jQuery("#order_number").attr("mandatory", "false");

    	jQuery("#topic").bind("change", function() {
    	
    		var value = jQuery(this).val();
    		if(value == 4) {
    			jQuery("#order").stop().animate({opacity: 1});
    			jQuery("#order_number").attr("mandatory", "true");
    			jQuery(".retour_area").stop().animate({height: 0 + "px"}, function() {jQuery(this).css("display","none")});
    		} else if(value == 5) {
    			jQuery("#order").stop().animate({opacity: 1});
    			jQuery("#order_number").attr("mandatory", "true");
    			jQuery(".retour_area").stop().animate({height: 50 + "px"}, function() {jQuery(this).css("display","block")});
    		} else {
    			jQuery("#order").stop().animate({opacity: 0});
    			jQuery("#order_number").attr("mandatory", "false");
    			jQuery(".retour_area").stop().animate({height: 0 + "px"}, function() {jQuery(this).css("display","none")});
    		}
    	
    	});
    	
    	if(!BBVars.isChrome) {
	    	jQuery("#fileInput").bind("change", function() {
	    		jQuery("#filenameLayer").html( jQuery(this).val() );
	    	});
	    } else {
	    	jQuery("ul#contact_list li div.position_btn").css("width", "auto");
	    	//jQuery("#fileInput").css("position", "relative");
	    	jQuery("#filenameLayer").css("display", "none");
	    }
    	jQuery("#fileInput").val("");
    
} else if (BBVars.currentPageName == "univers" || BBVars.currentPageName == "recherche") {
		var listWidth = jQuery("#sizeFilter_list").width();
		var itemNb = jQuery("#sizeFilter_list li").length;
		var sizeWidth = Math.round(listWidth/itemNb-1);
		var selector = jQuery("#sizeFilter_list li#selector");
		var sizeLabel = jQuery("#sizeLabel");
		var xOffset = Math.round((160-(itemNb-1)*sizeWidth)/2);
		
		jQuery("#sizeFilter_list li").each( function( i, el) {
			if(i==0) {
				jQuery(this).css("margin-left", xOffset);
				sizeLabel.html(jQuery("a",this).attr("title"));
			}
			jQuery(this).width(sizeWidth);
			var xPos = jQuery(this).width()*i+xOffset+"px";
			jQuery("a", this)
					.bind("mouseenter", function(e) {
						if(eval(selector.attr("drag"))) {
							selector.css("left", xPos);
							jQuery("#sizeFilter_list li a").removeClass("selected");
							jQuery(this).addClass("selected");
							sizeLabel.html(jQuery(this).attr("title"));
							jQuery("#sizeID").val(jQuery(this).attr("rel"));
						}
						e.preventDefault();
					}).bind("mouseup", function(e) {
						selector.attr("drag","false");
						e.preventDefault();
					}).bind("click", function(e) {
						selector.css("left", xPos);
						jQuery("#sizeFilter_list li a").removeClass("selected");
						jQuery(this).addClass("selected");
						sizeLabel.html(jQuery(this).attr("title"));
						jQuery("#sizeID").val(jQuery(this).attr("rel"));
						e.preventDefault();
					});
		});
		
		selector.bind("mousedown", function(e) {
					jQuery(this).attr("drag","true");
					e.preventDefault();
				}).bind("mouseup", function(e) {
					jQuery(this).attr("drag","false");
					e.preventDefault();
				}).css("left", xOffset+"px");
				
					if(BBVars.SizeSelected != 0)
					{
						var xPos = jQuery("#sizeFilter_list li:first").width()*jQuery("#sizeFilter_list li a[rel="+BBVars.SizeSelected+"]").attr("index")+xOffset+"px";
						selector.css("left", xPos);
						sizeLabel.html(jQuery("#sizeFilter_list li a[rel="+BBVars.SizeSelected+"]").attr("title"));
					}
				

    } else if (BBVars.currentPageName == "paiement") {
        if ($("#" + BBSettings.defaultHintID).length == 0) {
            $('body').append(
            $('<div id="' + BBSettings.defaultHintID + '"></div>').css({
                "position": "absolute",
                "top": "0",
                "left": "0",
                "z-index": 10000,
                "display": "none"
                
            }));
        }
        var cryptoMsg = $("#crypto_popup").html();
        $("#show_crypto").bind("mouseover", function (e) {TTip_hover(e, cryptoMsg);})
			.bind("mousemove", function (e) {TTip_hover(e, cryptoMsg);})
			.bind("mouseleave", function (e) {$("#" + BBSettings.defaultHintID).css("display", "none")});
    
    } else if (BBVars.currentPageName == "panier") {
    	if ($("#" + BBSettings.defaultHintID).length == 0) {
            $('body').append(
            $('<div id="' + BBSettings.defaultHintID + '"></div>').css({
                "position": "absolute",
                "top": "0",
                "left": "0",
                "z-index": 10000,
                "display": "none"
            }));
        }
        var vipMsg = $("#vip_popup").html();
        $("#vip_help").bind("mouseover", function (e) {TTip_hover(e, vipMsg);})
			.bind("mousemove", function (e) {TTip_hover(e, vipMsg);})
			.bind("mouseleave", function (e) {$("#" + BBSettings.defaultHintID).css("display", "none")});
			
		jQuery("#cartCrossSelling_list a.prodLink img").each( function() {
					jQuery(this).css("opacity", 0)
								.animate({opacity: 1}, function() {
									jQuery(this).bind("load", function(e) {
										jQuery(this).animate({opacity: 1});
									});
								})
				});
		
		/*$(document).ajaxError(function(e, xhr, settings, exception) {
alert('error in: ' + settings.url + ' \\n'+'error:\\n' + exception);
}); */
		
		jQuery("a.chgColorBtn").bind("click", function(e) {
			
			e.preventDefault();
			var prodInfos = jQuery(this).attr("rel").split(";");
			var colorID = prodInfos[2];
			var prodID = prodInfos[0];
			var catID = prodInfos[1];
			var cartLineID = prodInfos[3];
			
			BBVars.currentProdID = prodID;
			BBVars.currentColorID = colorID;
			BBVars.currentCartLineID = cartLineID;
			
			BBSettings.BBPopup.elementsSettings.width = "650px";
			
			//alert(BBVars.pagesURL + "fiche.cfm?cartLineID=" + cartLineID + "&prodID=" + prodID + "&cat_id="  + catID + "&produit_id=" + prodID + "&attDetID=" + colorID + "&coul_att_DetailID=" + colorID + "&isAjax=true");
			
			jQuery.get(
					BBVars.pagesURL + "fiche.cfm?cartLineID=" + cartLineID + "&prodID=" + prodID + "&cat_id="  + catID + "&produit_id=" + prodID + "&attDetID=" + colorID + "&coul_att_DetailID=" + colorID + "&isAjax=true",
					function (data) {
						BBTool_openMsgBox(data, true);
						jQuery("#BBTool_msgBoxCloseBtn").bind("click", function() {
							BBSettings.BBPopup.elementsSettings.width = "555px";
						});
					}
				);
		
		});
			
	} else if (BBVars.currentPageName == "livraison") {
		if(eval(BBVars.sameAddress)) jQuery("#frmUneAdresse").submit();
		
	} else if (BBVars.currentPageName == "GymAndSwim") {
		
		GandS_display();
			
    }


    var options = {
        header: 'dt.accordion_header',
        autoheight: false,
        alwaysOpen: false,
        collapsible: true,
        active: false
    }
    
    var initTab = (BBVars.currentPageName=="index") ? 0 : false;
    
    $("#leftMenu_list").accordion(options).activate(initTab);
    $("#leftSousMenu_list").accordion(options).activate(false);
    $("#quickMenu_list").accordion(options).activate(false);
    
});

/*----------------------------------------------------------------------------------*/


function chgColor(a,z,e,r) {

	BBVars.currentProdID = a;
			BBVars.currentColorID = e;
			BBVars.currentCartLineID = r;
			
			BBSettings.BBPopup.elementsSettings.width = "650px";
			
			//alert(BBVars.pagesURL + "fiche.cfm?cartLineID=" + cartLineID + "&prodID=" + prodID + "&cat_id="  + catID + "&produit_id=" + prodID + "&attDetID=" + colorID + "&coul_att_DetailID=" + colorID + "&isAjax=true");
			
			jQuery.get(
					BBVars.pagesURL + "fiche.cfm?cartLineID=" + r + "&prodID=" + a + "&cat_id="  + z + "&produit_id=" + a + "&attDetID=" + e + "&coul_att_DetailID=" + e + "&isAjax=true",
					function (data) {
						BBTool_openMsgBox(data, true);
						
					}
				);

}

function initComment() {

	jQuery("ul.ratingsList li img").css("opacity", 0);

	jQuery("ul.ratingsList li").each( function(index) {
		jQuery(this).bind("mouseenter", function(e) {
			jQuery("ul.ratingsList li img:lt("+eval(index+1)+")").stop().animate({opacity: 1});
		}).bind("mouseleave", function(e) {
			if(eval(jQuery("#cote").val())==-1)
				jQuery("ul.ratingsList li img:lt("+eval(index+1)+")").stop().animate({opacity: 0});
			else 
				jQuery("ul.ratingsList li img:gt("+eval(jQuery("#cote").val())+")").stop().animate({opacity: 0});
		}).bind("click", function(e) {
			jQuery("#cote").val(eval(index));
			jQuery("ul.ratingsList li img:lt("+eval(index+1)+")").css("opacity", 1);
			jQuery("ul.ratingsList li img:gt("+eval(jQuery("#cote").val())+")").stop().animate({opacity: 0});
		});
	});

	jQuery("#cmtList_layer").css({width: (jQuery("#cmtList_layer .page").length*jQuery("#cmtList_layer .cmtItem").eq(0).width()) + "px"});

	jQuery(".pageNav_list li").each( function( index ) {
		jQuery(this).bind("click", function( e ) {
			jQuery("#cmtList_layer").stop().animate({left: (-(index)*jQuery("#cmtList_layer .cmtItem").eq(0).width()) + "px"})
		});
	});
	
	jQuery("#opinion_form ul li a").bind("click", function( e ) {
	
		//jQuery("#opinion_form input").attr("disabled", "true");
		if(jQuery("#opinion_form .error").length>0) jQuery("#opinion_form").animate({opacity: 0.5});
	
	});

}

function initCmtMsg() {

	jQuery("#opinion_form").animate({opacity: 1}, function() {
		setTimeout( 'jQuery("#cmtMsgLayer").animate({height: 0})', 3000);
	});

}

/*-------------------- ONGLETS FICHE PRODUIT --------------------*/

function tab_dyn_fiche(nb) {
    $("#tab_list_ul li").each(function (i) {
         $(this).removeClass();
         if (nb == jQuery(this).attr("tabId")) {
            $(this).addClass("li_actif");
            $(this).animate({opacity: 1}, function () {
                $("#tab_layer_" + $(this).attr("tabId")).css("display", "block").animate({opacity: 1}, function () {
                    if (BBVars.isMsIE) this.style.removeAttribute("filter");
                    if(nb==2) {
                    	var backPos = Math.round(eval(jQuery("#mainRatingLayer img.ratingBar").attr("alt"))*124/5)-124 + "px";
                    	if(backPos!=jQuery("#mainRatingLayer img.ratingBar").css("left")) {
							jQuery("#mainRatingLayer img.ratingBar")
									.css("opacity", 0)
									.animate({opacity:1, left: backPos}, "slow");
						}
					}
                }).css("opcaity", "1");
            });
        } else {
            $(this).addClass("li_none");
            $(this).animate({opacity: 0.33}, function () {
                $("#tab_layer_" + $(this).attr("tabId")).css("display", "none").animate({opacity: 0}, function () {
                    if (BBVars.isMsIE) this.style.removeAttribute("filter");
                });
            });
        }
    });

}

/*------------------------------------------------------------*/


function setCrossColor( prodID, index ) {
	
	var prod = jQuery("#prod"+prodID);
	var color = jQuery("#color"+prodID+index);
	var currentSize = jQuery("#size"+prodID+color.attr("colorid"));
	var sizeList = jQuery(".sizeItem",prod);
	var size = jQuery(color).attr("size");
	var addToCartLink = jQuery(".noAddToCart", prod);
	
	if(size == "true") {
	
		sizeList.css("display", "none");
		currentSize.stop().css({opacity: 0, display: "block"}).animate({opacity: 1});
		prod.removeAttr("ref");
		prod.removeAttr("optionID");
		prod.attr("size","true");
		addToCartLink.animate({opacity: 1}, function() {jQuery(this).css("display","block");});
		
	} else {
		prod.attr("ref", color.attr("ref"))
			.attr("optionID", color.attr("optionID"));

		if(addToCartLink.css("opacity")==1) {
			addToCartLink.animate({opacity: 0}, function() {jQuery(this).css("display","none");});
		}
	}
	
	jQuery("#prodImg"+prodID)
		.animate({opacity: 0}, function(e) {
				jQuery(this).attr("src", jQuery("a",color).attr("rel"));
		});
		
	jQuery("li", color.parent()).css("borderColor", "#acacac");
	color.css("borderColor", "#e31a65");
	
}

function setCrossSize(prodID,index) {

	var prod = jQuery("#prod"+prodID);
	var item =  jQuery("#item"+prodID+index);
	var addToCartLink = jQuery(".noAddToCart", prod);

	prod.attr("ref", item.attr("ref"))
		.attr("optionID", item.attr("optionID"));
		
	jQuery("li", item.parent()).css("borderColor", "#acacac");
	item.css("borderColor", "#e31a65");
	if(addToCartLink.css("opacity")==1) {
			addToCartLink.animate({opacity: 0}, function() {jQuery(this).css("display","none");});
		}
}

function addToCartCross(prodID) {

	var prod = jQuery("#prod"+prodID);
	var isSize = prod.attr("size");
	var ref = (typeof(prod.attr("ref"))=="undefined") ? "" : prod.attr("ref");
	var optionID = (typeof(prod.attr("optionID"))=="undefined") ? "" : prod.attr("optionID");
	
	if(ref==""||optionID=="") {
		if(isSize == "true") {
			alert(BBLabels.label_errorChooseSize);
		} else {
			alert(BBLabels.label_errorChooseColor);
		}
	} else {
		var addURL = BBVars.pagesURL + 'panier.cfm?formAction=add&attribs=1&produit_id='+prodID+'&code_ean='+ref+'&type_vente=0&option_id='+optionID+'&quantite_souhaitee=1&crossselling=1';
		window.location = addURL;
	}

}

function initSizeBar() {

	var listWidth = jQuery("#sizeFilter_list").width();
	var itemNb = jQuery("#sizeFilter_list li").length;
	var sizeWidth = Math.round(listWidth/itemNb-1);
	var selector = jQuery("#sizeFilter_list li#selector");
	var sizeLabel = jQuery("#sizeLabel");
	var xOffset = Math.round((290-(itemNb-1)*sizeWidth)/2);
	
	jQuery("#sizeFilter_list").css({opacity: 0, vibility: "visible"});
	
	jQuery("#sizeFilter_list li").each( function( i, el) {
		jQuery(this).width(sizeWidth);
		var xPos = jQuery(this).width()*i+xOffset+"px";
		if(i==0) {
			jQuery(this).css("margin-left", xOffset);
			sizeLabel.html(jQuery("a",this).attr("title"));
			jQuery("#sizeTTip_layer div").css({"background-position": jQuery(this).width()*i+xOffset+20+"px bottom"});
			jQuery("#sizeTTip_layer").css({display: "none", opacity: 0});
		}
		jQuery("a", this)
				.bind("mouseenter", function(e) {
					if(eval(selector.attr("drag"))) {
						selector.css("left", xPos);
						jQuery("#sizeFilter_list li a").removeClass("selected");
						jQuery(this).addClass("selected");
						sizeLabel.html(jQuery(this).attr("title"));
						jQuery("#size_id").val(jQuery("a").attr("rel"));
						eval(jQuery(this).attr("rev"));
						jQuery("#sizeTTip_layer div").css("background-position", jQuery(this).width()*i+xOffset+20+"px bottom")
						if(jQuery("#sizeTTip_layer").css("opacity")==0) 
							jQuery("#sizeTTip_layer").css("display","block").animate({opacity: 1});
					}
					e.preventDefault();
				}).bind("mouseup", function(e) {
					selector.attr("drag","false");
					eval(jQuery(this).attr("rev"));
					e.preventDefault();
				}).bind("click", function(e) {
					selector.css("left", xPos);
					jQuery("#sizeFilter_list li a").removeClass("selected");
					jQuery(this).addClass("selected");
					sizeLabel.html(jQuery(this).attr("title"));
					jQuery("#size_id").val(jQuery("a").attr("rel"));
					eval(jQuery(this).attr("rev"));
						jQuery("#sizeTTip_layer div").css("background-position", jQuery(this).width()*i+xOffset+20+"px bottom")
						if(jQuery("#sizeTTip_layer").css("opacity")==0) 
							jQuery("#sizeTTip_layer").css("display","block").animate({opacity: 1}, function() {setTimeout("hideSizeTip()", 2000)});
					e.preventDefault();
				});
	});
	
	selector.bind("mousedown", function(e) {
				jQuery(this).attr("drag","true");
				e.preventDefault();
			}).bind("mouseup", function(e) {
				jQuery(this).attr("drag","false");
				jQuery("#sizeTTip_layer").animate({opacity: 0}, function() {jQuery(this).css("display","none");});
				e.preventDefault();
			}).css("left", xOffset+"px");

	jQuery("#sizeFilter_list").css("visibility","visible").animate({opacity: 1});

}

function hideSizeTip() {
	if(jQuery("#sizeTTip_layer:animated").length==0) {
		jQuery("#sizeTTip_layer").animate({opacity: 0}, function() {jQuery(this).css("display","none");});
	}
}

function delete_panier() {
	jQuery("#frmWishlist input[name='action']").val("delete");
	jQuery("#frmWishlist").submit();
}
	
function DelWishlist( action ,panier_save_id ) {

	jQuery.get(BBVars.pagesURL+"compte_panier.cfm?action="+action+"&panier_save_id=" + panier_save_id);
	if(jQuery("#wishlist_table tr").length<=2) {
		jQuery("#wishlist_layer").animate({height: 0}, function() {
			jQuery(this).remove();
		});
		jQuery("#emptyWhishListLayer").css({opacity: 0, display: "block"}).animate({opacity: 1});
	} else
		delTR("#ligne"+panier_save_id, "55px");

}
	
function addtocartlist() {
	var listelignes = "";
	var oForm = document.forms.wishlist_form; 
	//boucler sur les cases ? cocher
	for ( i = 0 ; i < oForm.elements.length ; i++ ) {
		if ( oForm.elements[i].name.substring(0,3 ) == "cb_" ) 
		{
			if (oForm.elements[i].checked)
    			listelignes = listelignes+ oForm.elements[i].value+",";
		}
	
	} 
	if(listelignes == "")
		alert("#label_aucune_ligne_choisie#");
	else
	{
		listelignes = listelignes+ "-1";
		oForm.selectedlines.value = listelignes;
		oForm.submit();
	}
}

/*----------------------------------------------------------------------------------*/

/*----------------------------------------------------------------*/

function show_siteMap (nb) {
	if(nb==1) {
		jQuery("#collection_sandales").fadeTo("slow",1,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("display","block")
		jQuery("#collection_accessoires").fadeTo("slow",0,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("display","none")
	} else if(nb==2) {
		jQuery("#collection_sandales").fadeTo("slow",0,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("display","none")
		jQuery("#collection_accessoires").fadeTo("slow",1,function(){if(BBVars.isMsIE) this.style.removeAttribute("filter");}).css("display","block")
	}
}

function showBasket(nb) {

	

	if(nb==1) {
		jQuery("#basketPop_layer").css({display: "block", opacity: 0}).animate({opacity: 1});
	} else {
		jQuery("#basketPop_layer").animate({opacity: 0}, function() {jQuery(this).css("display","none");});
	}
}


//tracker des clics sur banniere homepage Ebr 07/12/10
function track_banner(banner_id,paysid,produit_id)
{
	if (window.XMLHttpRequest)
	{
	  xmlhttp=new XMLHttpRequest(); 
	}
	else
	{
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.open("GET",BBVars.pagesURL+"ajax/tracker_banner.cfm?bannerid="+banner_id+"&pays_id="+paysid+"&produit_id="+produit_id,true);
	xmlhttp.onreadystatechange = track_banner_callback;
	xmlhttp.send(null);

}

function track_banner_callback() {}

function initRainboots() {
	if(isRainboots) {
		BBSettings.BBPopup.elementsSettings.width = "676px";
		jQuery.get(
			BBVars.pagesURL + "ajax/rainBoots_video.cfm",
			function (data) {
				BBTool_openMsgBox(data, true);
				BBSettings.BBPopup.elementsSettings.width = "555px";
			}
		);
	}
}
function rainBootsVideo_callback() {
	jQuery("#BBTool_msgBoxContent").addClass("rainBoots_video");
}
