var cart={AddToCartFromProductSpace:function(B,C,A){if(C==0){quantityId=$F("merchant_products_option");new Ajax.Updater("popup_cart","/AddToCart2.ashx",{method:"post",parameters:{prodId:B,optionId:quantityId,tabsId:A},onComplete:function(D){Header.LoadMiniCart();$("popup_cart").show();},onFailure:function(D){$("popup_cart").show();}});}else{new Ajax.Updater("popup_cart","/AddToCart2.ashx",{method:"post",parameters:{prodId:B,tabsId:A},onComplete:function(D){Header.LoadMiniCart();$("popup_cart").show();},onFailure:function(D){$("popup_cart").show();}});}},AddToCartFromPopupIntermediate:function(C,A){var B=$F("ProductsOptionSelected");new Ajax.Updater("popup_cart","/AddToCart2.ashx",{method:"post",parameters:{prodId:C,optionId:B,tabsId:A},onComplete:function(D){$("AddToCartExtern").hide();Header.LoadMiniCart();$("popup_cart").show();new Effect.ScrollTo("gotocart",{duration:0});},onFailure:function(D){$("AddToCartExtern").hide();$("popup_cart").show();}});},AddToCartOutOfProductSpace:function(B,C,A){if(C==0){new Ajax.Updater("AddToCartExtern","/AddToCartExterne.ashx",{method:"post",parameters:{prodId:B,tabsId:A},onComplete:function(D){$("AddToCartExtern").show();}});}else{new Ajax.Updater("popup_cart","/AddToCart2.ashx",{method:"post",parameters:{prodId:B,tabsId:A},onComplete:function(D){Header.LoadMiniCart();$("popup_cart").show();new Effect.ScrollTo("gotocart",{duration:0});},onFailure:function(D){$("popup_cart").show();}});}},Close:function(){$("AddToCartExtern").hide();},CloseMiniCartPopup:function(){$("popup_cart").hide();},RedirectToCartPageDetail:function(){$("popup_cart").hide();var A=config.portalUrl+"/Cart1.aspx";window.location=A;},DeleteProductFromMiniCart:function(A){new Ajax.Updater("header_minicart","/HeaderMiniCartContent.ashx",{method:"get",parameters:{prodId:A},onComplete:function(B){Header.LoadMiniCart();$("header_minicart").show();}});},HeaderMiniCartRefresh:function(){new Ajax.Updater("header_mini_cart_preview","/HeaderMiniCart.ashx",{method:"get",onComplete:function(A){}});},showCardIdea:function(){var A=new SPopup(400,"Card idea",{contentUrl:"/cardidea.ashx"});A.show();},initCard:function(){},messageCardShowCount:function(A){var B=parseInt(A.readAttribute("maxlength"))-$F(A).length;var C=this.templateCardCount.evaluate({count:B});A.next("span.messagecardcount-focus").update(C);},messageCardCountFocus:function(A){l_lastFocused=A.up(".messagecard").select("span.messagecardcount-focus").last();if(l_lastFocused){l_lastFocused.remove();}Element.insert(A,{after:new Element("span",{"class":"messagecardcount-focus"})});this.messageCardShowCount(A);},messageCardCountKeyup:function(A){this.messageCardShowCount(A);},templateCardCount:new Template('<span class="cardmessagecount">#{count} caratère(s) restant(s)</span>')};