jQuery.createNs("adobe.ecomm.view.store.cart");adobe.ecomm.view.store.cart.StoreCartView={initComplete:false,promoCodePending:false,nextEvent:"",refreshCookieName:"refreshCartView",unsavedChangesWarnDlg:null,init:function(b,a){var c=adobe.ecomm.cart.ShoppingCart;this.localizedLabels=a;this.main=jQuery("#ecomm-cart-view");this.carPageTile=jQuery("#ecomm-sel-cart-pagetitle").text(localizedLabels.STORE_CART.YOUR_CART);this.mainContainer=jQuery("#cart-main-container");this.itemContainer=jQuery("#cart-item-container");this.itemViewTemplate=jQuery("#item-view-template");this.itemEditLink=jQuery("#ecomm-sel-cart-itemedit-button").text(localizedLabels.STORE_CART.CART_EDIT_LINK);this.itemRemoveLink=jQuery("#ecomm-sel-cart-itemremove-button").text(localizedLabels.STORE_CART.REMOVE_ITEM_LINK);this.itemCancelBtn=jQuery("#ecomm-cancel-btn").text(localizedLabels.STORE_CONFIGURATOR.BUTTON_CANCEL);this.itemUpdateBtn=jQuery("#ecomm-update-btn").text(localizedLabels.STORE_CART.UPDATE);this.cartFooter=jQuery("#ecomm-cart-footer");this.subtotalLabel=jQuery("#ecomm-sel-cart-subtotallabel");this.subtotal=jQuery("#ecomm-sel-cart-subtotal");this.taxContainer=jQuery("#ecomm-sel-tax-container");if(localizedLabels.STORE_CART.ESTIMATED_TAX_TEXT.indexOf(":")==-1){localizedLabels.STORE_CART.ESTIMATED_TAX_TEXT=localizedLabels.STORE_CART.ESTIMATED_TAX_TEXT+":"}this.taxLabel=jQuery("#ecomm-sel-cart-taxlabel").text(localizedLabels.STORE_CART.ESTIMATED_TAX_TEXT);this.taxLabel.attr("title",localizedLabels.TAX_EXEMPT_TOOLTIP);this.tax=jQuery("#ecomm-sel-cart-estimatedtax");this.shippingContainer=jQuery("#ecomm-sel-cart-shipping-container");this.shippingLabel=jQuery("#ecomm-sel-cart-shippinglabel").text(localizedLabels.STORE_CART.SHIPPING_TEXT);this.shippingTotal=jQuery("#ecomm-sel-cart-shipping-total");this.discountTotal=jQuery("#ecomm-sel-cart-discount");this.orderTotalLabel=jQuery("#ecomm-sel-cart-totallabel");this.orderTotal=jQuery("#ecomm-sel-cart-total");if(localizedLabels.STORE_CART.STORE_PROMOTIONS_FIELD.indexOf(":")==-1){localizedLabels.STORE_CART.STORE_PROMOTIONS_FIELD=localizedLabels.STORE_CART.STORE_PROMOTIONS_FIELD+":"}this.promoCodeLabel=jQuery("#ecomm-sel-cart-promotionlabel").text(localizedLabels.STORE_CART.STORE_PROMOTIONS_FIELD);this.promoCodeFieldLabel=jQuery("#ecomm-promocode-fieldlabel").text(localizedLabels.STORE_CART.BUTTON_PROMO_CODE);this.promoCodeInput=jQuery("#ecomm-promo-code-input");this.promoCodeBtn=jQuery("#ecomm-promo-apply-btn").attr("disabled",true).text(localizedLabels.STORE_CART.BUTTON_APPLY);this.crossSellContainer=jQuery("#ecomm-sel-xsell-area");this.crossSellTemplate=jQuery("");this.promoContainer=jQuery("#ecomm-promo-container");this.mainViewCurtain=jQuery("#main-view-curtain");this.cartButtons=jQuery("#cart-control-bar");this.rightCol=jQuery("#ecomm-right-column");this.promoLine=jQuery("#ecomm-promo-line");this.continueShoppingBtn=jQuery("#ecomm-sel-continue-shopping").text(localizedLabels.STORE_CART_LANDING.CL_BTN_CONTINUE_SHOPPING);this.checkoutBtn=jQuery("#ecomm-sel-checkout-button").text(localizedLabels.STORE_CROSS_SELL.BUTTON_SECURE_CHECKOUT);this.customerServiceTile=jQuery("#ecomm-sel-customerservice-title").text(localizedLabels.STORE_CART.TITLE_CUSTOMER_SERVICE);this.customerServiceText=jQuery("#ecomm-sel-customerservice-text").text(localizedLabels.STORE_CART.TEXT_CUSTOMER_SERVICE);this.xsellTitle=jQuery("#ecomm-sel-xsell-title").text(localizedLabels.STORE_CART.YOU_MIGHT_ALSO_LIKE);this.xsellbuybtn=jQuery("#ecomm-sel-xsell-buybtn").text(localizedLabels.STORE_CART.XSELL_BUY_BUTTON);this.crossSellList=new adobe.ecomm.view.store.cart.RelatedContentPodList({xsellArea:"#ecomm-sel-xsell-area",itemTemplate:"#xsell-item-template",container:"#ecomm-sel-xsell-container",itemBoxshot:".EcommSelXsellBoxshot",itemTitle:".EcommSelXsellTitle",itemTitleLink:".EcommSelXsellTitleLink",itemTitleImgLink:".EcommSelXsellImgLink",itemDesc:".EcommSelXsellDesc",itemAddButton:".EcommAddtocartButton",itemPricePreLabel:".EcommSelPricePreLabel",itemPriceLabel:".EcommSelPrice",itemOrigPriceLabel:".EcommSelXsellOrigPrice",itemPricePostLabel:".EcommSelPricePostLabel"});c.subscribe("showMainViewCurtain",this.showMainViewCurtain,this);c.subscribe("hideMainViewCurtain",this.hideMainViewCurtain,this);c.subscribe("cartModelChanged",function(){this.updateView(c);adobe.Cookie.set(this.refreshCookieName,true)},this);c.subscribe("cartItemAdded",function(g){this.addItem(g);if(this.initComplete){this.getCrossSells(g.sku)}},this);c.subscribe("cartItemRemoved",function(g){this.removeItem(g)},this);c.subscribe("cartInitComplete",function(h){this.initComplete=true;if(this.itemContainer.length!=0){var g=this.itemContainer.children().eq(0).data().model.sku;this.getCrossSells(g)}},this);c.subscribe("promoCodeAdded",function(){this.promoCodePending=false;this.promoCodeInput.val("");c.fire("hideMainViewCurtain");var g=this.itemContainer.children().eq(0).data().model.sku;this.getCrossSells(g)},this);c.subscribe("promoCodeError",function(g,h){this.promoCodePending=false;c.fire("hideMainViewCurtain");this.promoCodeInput.css("border-color","red");this.promoContainer.append("<p id='ecomm-invalid-promo-message'><span style='color:red; font-weight : bold; font-size: smaller'>"+h.localizedMsg+"</span></p>")},this);this.crossSellList.subscribe("addItemClicked",function(g){adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.CROSS_SELL_BUY_CLICK,[g.index]);this.addItemByCategory(g.categoryPath);this.showMainViewCurtain()},this);var e=adobe.ecomm.view.store.analytics.AnalyticsListener;e.init(this);this.promoCodeBtn.click(function(h){var g=adobe.ecomm.view.store.cart.StoreCartView;if(g.promoCodePending){return}else{g.promoCodePending=true}promoInputVal=jQuery("#ecomm-promo-code-input").val();adobe.ecomm.cart.ShoppingCart.addPromotionCode(promoInputVal);c.fire("showMainViewCurtain");jQuery("#ecomm-invalid-promo-message").remove();jQuery("#ecomm-promo-code-input").css("border-color","")});this.promoCodeInput.keyup(function(g){if(g.target.value!==""){jQuery("#ecomm-promo-apply-btn").attr("disabled",false);if(g.keyCode=="13"){jQuery("#ecomm-promo-apply-btn").click()}}else{jQuery("#ecomm-promo-apply-btn").attr("disabled",true);jQuery("#ecomm-invalid-promo-message").remove();jQuery("#ecomm-promo-code-input").css("border-color","")}});this.continueShoppingBtn.click(function(h){var g=adobe.ecomm.view.store.cart.StoreCartView;if(g.hasItemsInEditMode()){g.nextEvent=g.keepShopping;g.showIncompleteEditWarning()}else{g.keepShopping()}});this.checkoutBtn.click(function(h){var g=adobe.ecomm.view.store.cart.StoreCartView;if(g.hasItemsInEditMode()){g.nextEvent=g.beginCheckout;g.showIncompleteEditWarning()}else{g.beginCheckout()}});var d=this.localizedLabels.STORE_CONFIGURATOR.OK;var f=this.localizedLabels.STORE_CONFIGURATOR.BUTTON_CANCEL.toUpperCase();this.unsavedChangesWarnDlg=jQuery('<div id="ecomm-sel-errormsg"></div>').html("<p>"+this.localizedLabels.STORE_CART.CHANGES_NOT_SAVED+"</p><p>"+this.localizedLabels.STORE_CART.CONTINUE_WITHOUT_SAVE+'</p><p><button type="submit" id="ecomm-sel-error-okbtn" class="button">'+d+'</button>&nbsp;<button type="submit" id="ecomm-sel-error-cancelbtn" class="button">'+f+"</button></p>").dialog({autoOpen:false,modal:true,resizable:false});jQuery("#ecomm-sel-error-okbtn").click(function(h){jQuery("#ecomm-sel-errormsg").dialog("close");var g=adobe.ecomm.view.store.cart.StoreCartView;g.nextEvent.apply(g)});jQuery("#ecomm-sel-error-cancelbtn").click(function(g){jQuery("#ecomm-sel-errormsg").dialog("close")});if(adobe.Cookie.get(this.refreshCookieName)=="true"){c.init()}else{c.init(b)}adobe.Cookie.set(this.refreshCookieName,null)},showMainViewCurtain:function(){var b=jQuery("#ecomm-cart-view");var a=this.mainViewCurtain.find("#main-curtain-spinner");var d=b.height();var c=jQuery("#ecomm-sel-xsell-container");if(jQuery.isValue(c)){d=c.height()>b.height()?c.height():b.height()}d+=50;a.attr("vspace",b.height()/2);this.mainViewCurtain.css({opacity:parseFloat(".4")});this.mainViewCurtain.height(d);this.mainViewCurtain.width("100%");this.mainViewCurtain.css("top",b.css("top"));this.mainViewCurtain.css("left","0");this.mainViewCurtain.css("visibility","visible");this.mainViewCurtain.fadeIn("slow")},hideMainViewCurtain:function(){this.mainViewCurtain.fadeOut("slow")},hasItemsInEditMode:function(){var a=false;this.itemContainer.find(".EcommCartItem").each(function(b,c){if(!jQuery(c).find(".EcommSelCartitemEditor").hasClass("EcommHidden")||jQuery(c).data().specialCaseQtyEdit){a=true}});return a},redirectURL:function(){window.location=this.getFullStoreUrlhttps()+"&event=checkout"},beginCheckout:function(){this.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.CHECKOUT_CLICK);if(jQuery.browser.mozilla){setTimeout(function(a){a.redirectURL()},3000,this)}else{this.redirectURL()}},keepShopping:function(){this.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.CONTINUE_SHOPPING_CLICK);window.location=this.getFullStoreUrl()},getFullStoreUrl:function(){var a=adobe.ecomm.store.Store;return window.location.protocol+"//"+a.getServiceDomain()+a.storePath+"index.cfm?store="+a.storeName},getFullStoreUrlhttps:function(){var a=adobe.ecomm.store.Store;return"https://"+a.getServiceDomain()+a.storePath+"index.cfm?store="+a.storeName},showIncompleteEditWarning:function(){if(this.dialogWorksWithSelect()){this.unsavedChangesWarnDlg.dialog("open")}else{var b=this.localizedLabels.STORE_CART.CHANGES_NOT_SAVED+"\n\n"+this.localizedLabels.STORE_CART.CONTINUE_WITHOUT_SAVE;var a=window.confirm(b);if(a){this.nextEvent.apply(this)}}},dialogWorksWithSelect:function(){return !(jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<7)},getCrossSells:function(a){adobe.ecomm.browse.BrowseFacade.getRelatedContent(a,function(b){this.displayCrossSells(b)},this)},displayCrossSells:function(a){this.crossSellList.displayItems(a)},updateView:function(){var b=adobe.ecomm.cart.ShoppingCart;var a=adobe.ecomm.store.Store;if(this.itemContainer.length!=0){this.cartFooter.toggleClass("EcommHidden",true);this.mainContainer.toggleClass("EcommHidden",true);this.cartButtons.toggleClass("EcommHidden",true);this.shippingContainer.toggleClass("EcommHidden",!b.hasHardGoods);if(b.discountTotal&&b.discountTotal.length===0){this.promoLine.hide()}else{this.promoLine.show()}this.subtotalLabel.html(a.cartPriceDisplay==="TAX_INCLUSIVE_DETAILS"?localizedLabels.STORE_CART.SUBTOTAL_EX_VAT_TEXT:localizedLabels.STORE_CART.SUBTOTAL_TEXT);if(jQuery.isValue(b.discountTotal)&&b.discountTotal!==""){this.subtotal.text(b.preDiscountSubtotal)}else{this.subtotal.text(b.subTotal)}this.discountTotal.text(b.discountTotal);if(!b.shippingCalculated&&a.hasMultipleShipCountries()){this.shippingTotal.toggleClass("EcommStyLargeTxt",false);this.shippingTotal.text(localizedLabels.STORE_CART.CALCULATED_AT_CHECKOUT)}else{this.shippingTotal.toggleClass("EcommStyLargeTxt",true);this.shippingTotal.text(b.shippingTotal)}if(!b.taxCalculated&&a.showCalculatedMsg()&&a.storeName.toUpperCase()!="OLS-AP"){this.tax.toggleClass("EcommStyLargeTxt",false);this.tax.text(localizedLabels.STORE_CART.CALCULATED_AT_CHECKOUT)}else{this.tax.toggleClass("EcommStyLargeTxt",true);this.tax.text(b.taxTotal)}this.taxContainer.toggleClass("EcommHidden",a.storeName.indexOf("JP")!=-1);this.orderTotalLabel.html(a.cartPriceDisplay==="TAX_INCLUSIVE_DETAILS"?localizedLabels.STORE_CART.ORDER_TOTAL_TAX_INC_VAT:localizedLabels.STORE_CART.ORDER_TOTAL_TAX);this.orderTotal.text(b.orderTotal);this.cartFooter.show();this.mainContainer.show();this.cartButtons.show()}},addItem:function(b){var a=this.createCartItem(b);if(b.parentSku!==""&&jQuery("#"+b.parentSku).length){jQuery("#"+b.parentSku).after(a)}else{this.itemContainer.prepend(a)}if(b.editable){a.getConfigData()}},addItemByCategory:function(c){var b=new adobe.ecomm.cart.CartItem({categoryPath:c,language:adobe.ecomm.store.Store.defaultLanguage,fulfillmentMethod:adobe.ecomm.store.Store.defaultFulfillmentMethodType,maxQuantity:9});var a=this.createCartItem(b,true);a.css("border-bottom-style","none");a.css("margin-top","10px");a.find(".left-72").removeClass("left-72").addClass("left-90");a.find(".ItemEditSaveButton").text(this.localizedLabels.STORE_CART.BUTTON_ADD_TO_CART);a.find(".ItemEditSaveButton").css("padding","0.2em 0.4ex");if(jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<7){a.find("label").addClass("EcommStyExSmallTxt")}a.getConfigData(function(d){this.hideMainViewCurtain();a.attr("id","config-dialog");a.dialog({modal:true,width:740,height:390,resizable:false,title:d.initialConfigData.productName});a.css("width","700px");a.css("height","350px");jQuery("#config-dialog").find(".cart-item-boxshot").find("img").attr("src",d.initialConfigData.boxshot).removeClass("EcommHidden");a.bind("dialogclose",function(f){a.remove();a.dialog("close")})},this)},removeItem:function(b){jQuery(("#"+b.sku)).remove();var a=adobe.ecomm.cart.ShoppingCart.items.length;if(a==0){this.mainContainer.html(this.localizedLabels.STORE_CART.ZERO_ITEM_CART);this.main.hide();this.cartButtons.hide();this.crossSellContainer.hide()}},createCartItem:function(b,c){var a=jQuery("#item-view-template").clone();a.attr("id",b.sku);a.data({model:b,currentState:{sku:"",quantity:0},initialConfigData:null,configReady:false,configDataPending:false,configurator:null,editViewPending:false,specialCaseQtyEdit:false,addItemMode:jQuery.isValue(c)?c:false,configNeedsPromoRefresh:false,itemUpdateButtons:a.find(".EcommItemUpdateButtons"),itemView:{view:a.find(".EcommSelCartitemView"),standardView:a.find(".EcommSelCartitemStandard"),subscriptionView:a.find(".EcommSelCartitemSub"),editView:a.find(".EcommSelCartitemEditor"),configContainer:a.find(".EcommSelConfigTarget"),boxshot:a.find("#ecomm-sel-cartitem-boxshot"),title:a.find(".EcommSelCartProdname"),price:a.find(".EcommSelCartitemPrice"),originalPrice:a.find(".EcommSelCartitemOriginalPrice"),taxInclusiveDetails:a.find(".EcommSelCartItemTaxInclusiveDetails"),termTypeNote:a.find(".EcommSelCartItemTermTypeStr"),itemButtons:a.find(".CartItemButtons"),itemEditButton:a.find(".CartItemEditButton"),itemRemoveButton:a.find(".CartItemRemoveButton"),itemButtonSeparator:a.find(".ecomm-sel-cart-item-button-separator"),itemCurtain:a.find(".EcommCartItemCurtain"),termType:{container:a.find(".EcommSelCartitemTerm"),displaylabel:a.find(".EcommSelCartitemTermLab"),value:a.find(".EcommSelCartitemTermVal")},type:{container:a.find(".EcommSelCartitemDist"),displaylabel:a.find(".EcommSelCartitemDistLab"),value:a.find(".EcommSelCartitemDistVal")},upgrade:{container:a.find(".EcommSelCartitemUpgrade"),displaylabel:a.find(".EcommSelCartitemUpgradeLab"),value:a.find(".EcommSelCartitemUpgradeVal")},serviceCommitment:{container:a.find(".EcommSelCartitemServiceCommitment"),displaylabel:a.find(".EcommSelCartitemServiceCommitmentLab"),value:a.find(".EcommSelCartitemServiceCommitmentVal")},platform:{container:a.find(".EcommSelCartitemPlatform"),displaylabel:a.find(".EcommSelCartitemPlatformLab"),value:a.find(".EcommSelCartitemPlatformVal")},language:{container:a.find(".EcommSelCartitemLang"),displaylabel:a.find(".EcommSelCartitemLangLab"),value:a.find(".EcommSelCartitemLangVal")},fulfillment:{container:a.find(".EcommSelCartitemFulfill"),displaylabel:a.find(".EcommSelCartitemFulfillLab"),value:a.find(".EcommSelCartitemFulfillVal")},qty:{container:a.find(".EcommSelCartitemQty"),displaylabel:a.find(".EcommSelCartitemQtyLab"),value:a.find(".EcommSelCartitemQtyVal")}}});a.handleItemUpdated=function(g){if(this.data().currentState.sku===g.sku&&this.data().currentState.quantity===g.quantity){return}this.data().currentState.sku=g.sku;this.data().currentState.quantity=g.quantity;this.attr("id",g.sku);this.data().model=g;var e=this.data().itemView;var h=jQuery.mix(adobe.ecomm.view.store.cart.StoreCartView.localizedLabels.STORE_CONFIGURATOR,adobe.ecomm.view.store.cart.StoreCartView.localizedLabels.STORE_CART,false);if(this.data().specialCaseQtyEdit){this.hideQuantityEdit()}var d=g.name;if(g.isPreOrderItem){d+=" ("+h.PRE_ORDER+")"}e.title.html(d);if(jQuery.isValue(g.boxShotLarge)&&g.boxShotLarge!==""){e.boxshot.attr("src",g.boxShotLarge);e.boxshot.toggleClass("EcommHidden",false)}else{if(jQuery.isValue(g.boxShot)&&g.boxShot!==""){e.boxshot.attr("src",g.boxShot);e.boxshot.toggleClass("EcommHidden",false)}else{e.boxshot.toggleClass("EcommHidden",true)}}if(g.termType=="YEAR"){e.termType.value.text(h.OLS_TERM_TYPE_YEARS)}if(g.termType=="MONTH"){e.termType.value.text(h.OLS_TERM_TYPE_MONTHS)}if(g.serviceCommitment=="YEAR"){e.serviceCommitment.value.text(h.SERVICE_COMMITMENT_YEAR)}if(g.serviceCommitment=="MONTH"){e.serviceCommitment.value.text(h.SERVICE_COMMITMENT_MONTH)}e.type.value.text(g.distributionMethodLocalized);e.platform.value.text(g.platform);e.language.value.text(g.language);e.fulfillment.value.text(g.fulfillmentCartLabel);e.qty.value.text(g.quantity);e.price.text(g.adjustedPrice);if(jQuery.isValue(g.originalPrice)){e.originalPrice.text(g.originalPrice)}var f=g.upgradeFromCategory===""?g.version:g.upgradeFromCategory;e.upgrade.value.text(f);this.attr("id",g.sku);e.type.displaylabel.text(h.TITLE_VERSION_SELECTION+":");e.termType.displaylabel.text(h.TITLE_SUBSCRIPTION_TYPE+":");e.upgrade.displaylabel.text(h.CONFIG_UPGRADE_FROM_LABEL+":");e.serviceCommitment.displaylabel.text(h.TITLE_SERVICE_COMMITMENT+":");e.platform.displaylabel.text(h.TITLE_PLATFORM+":");e.language.displaylabel.text(h.TITLE_LANGUAGE+":");e.fulfillment.displaylabel.text(h.TITLE_DELIVERY_METHOD+":");e.qty.displaylabel.text(h.TITLE_QUANTITY+":");e.taxInclusiveDetails.text("("+h.CART_INC_VAT+" "+g.taxRate+"% "+g.totalTax+")");if((jQuery.isValue(g.termType)&&g.termType!=="")&&(!jQuery.isValue(g.parentSku)||g.parentSku=="")){if(g.termType==="YEAR"){e.termTypeNote.text(h.TERM_TYPE_PER_YEAR);e.termTypeNote.toggleClass("EcommHidden",false)}else{if((g.termType==="MONTH")&&(g.fulfillmentMethod!="AFCS")){e.termTypeNote.text(h.TERM_TYPE_PER_MONTH);e.termTypeNote.toggleClass("EcommHidden",false)}else{e.termTypeNote.toggleClass("EcommHidden",true)}}}else{e.termTypeNote.toggleClass("EcommHidden",true)}e.standardView.toggleClass("EcommHidden",g.isServiceSubscription);e.subscriptionView.toggleClass("EcommHidden",!g.isServiceSubscription);e.serviceCommitment.container.toggleClass("EcommHidden",!g.isDesktopSubscription);e.originalPrice.toggleClass("EcommHidden",g.originalPrice===g.adjustedPrice);e.taxInclusiveDetails.toggleClass("EcommHidden",adobe.ecomm.store.Store.cartPriceDisplay!=="TAX_INCLUSIVE_DETAILS");e.type.container.find("*").toggleClass("EcommHidden",g.distributionMethod==="N/A");e.upgrade.container.find("*").toggleClass("EcommHidden",(g.version===""||g.isDesktopSubscription));e.upgrade.displaylabel.toggleClass("EcommHidden",g.upgradeFromCategoryPath==="");e.editView.addClass("EcommHidden");e.view.removeClass("EcommHidden");e.itemButtons.removeClass("EcommHidden");e.itemRemoveButton.toggleClass("EcommHidden",!g.removable);e.itemButtonSeparator.toggleClass("EcommHidden",!g.removable);e.fulfillment.container.toggleClass("EcommHidden",g.fulfillmentCartLabel===""||g.fulfillmentCartLabel==="N/A");if(!g.editable){if(g.maxQuantity===1||g.quantityRule.indexOf("_PARENT")!==-1){e.itemEditButton.addClass("EcommHidden");e.itemButtonSeparator.toggleClass("EcommHidden",true)}e.type.container.remove()}if(g.quantityChanged){g.quantityChanged=false;this.resetItemView()}e.itemCurtain.fadeOut("slow")};a.hideQuantityEdit=function(){this.find(".EcommSelConfigQty").remove();this.data().itemUpdateButtons.remove();this.data().itemView.qty.container.find("*").toggleClass("EcommHidden",false);this.data().specialCaseQtyEdit=false;this.data().itemView.taxInclusiveDetails.toggleClass("EcommHidden",adobe.ecomm.store.Store.cartPriceDisplay!=="TAX_INCLUSIVE_DETAILS");if(jQuery.isValue(this.data().model.termType)&&this.data().model.termType!==""){this.data().itemView.termTypeNote.toggleClass("EcommHidden",false)}else{this.data().itemView.termTypeNote.toggleClass("EcommHidden",true)}this.data().itemView.itemButtons.toggleClass("EcommHidden",false);if(this.data().model){if(jQuery.isValue(this.data().model.originalPrice)){this.data().itemView.originalPrice.toggleClass("EcommHidden",this.data().model.originalPrice===this.data().model.adjustedPrice)}}};a.getConfigData=function(f,e){var d=this.data();if(d.configDataPending){return}d.configDataPending=true;adobe.ecomm.browse.BrowseFacade.getProductData(d.model.categoryPath,function(g){this.initConfigurator(g);this.data().initialConfigData=g;d.configReady=true;d.configDataPending=false;d.configNeedsPromoRefresh=false;if(d.editViewPending){this.editItem()}else{if(d.addItemMode){this.handleItemUpdated(new adobe.ecomm.cart.CartItem({name:g.productName,boxShot:g.boxshot}));this.editItem();if(jQuery.isValue(f)){f.apply(e,[d])}}}},this)};a.editItem=function(){var d=this.data();var e=a.find(".ItemEditSaveButton");if(!d.addItemMode){jQuery.UI.setControlEnabled(e,false)}if(!d.configNeedsPromoRefresh&&d.configReady){this.hideCurtain(jQuery("#"+d.model.sku));this.showEditView(true);return}else{this.showCurtain(jQuery("#"+d.model.sku));d.editViewPending=true;this.getConfigData()}};a.editQuantityOnly=function(q){var g=adobe.ecomm.view.store.cart.StoreCartView.localizedLabels.STORE_CONFIGURATOR.TITLE_QUANTITY;var r='<div class="EcommStyFormItem EcommSelConfigQty" style="clear:both;">';r+='<div class="EcommStyFormLabel">';r+='<label id="QuantityLable" for="Quantity" class="EcommSelConfigQtyLab" >'+g+":</label>";r+="</div>";r+='<div class="EcommStyFormElement">';r+='<select id="Quantity" class="EcommSelConfigQtyVal" name="Quantity" style="width:40px;font-size:0.97em"> </select>';r+="</div>";r+='<br style="clear:both;" />';r+="</div>";var o=jQuery(r);var p=o.find(".EcommSelConfigQtyVal");var l=a.data().itemUpdateButtons;var d=a.data().itemView.qty.container;var n=a.data().itemView.language.container;var m=jQuery.isValue(a.data().itemView.fulfillment.container)?a.data().itemView.fulfillment.container:null;var f="";var h=0;a.data().itemView.taxInclusiveDetails.toggleClass("EcommHidden",true);a.data().itemView.itemButtons.toggleClass("EcommHidden",true);a.data().itemView.originalPrice.toggleClass("EcommHidden",true);a.data().specialCaseQtyEdit=true;d.find("*").toggleClass("EcommHidden",true);if(m!=null){m.after(l);m.after(o)}else{n.after(l);n.after(o)}p.empty();for(var j=1;j<=q.maxQuantity;j++){if(j==q.quantity){h=(j-1)}f+="<option value='"+j.toString()+"'>"+j.toString()+"</option>"}p.append(f);p.attr("selectedIndex",h);var k=l.find(".ItemEditSaveButton");var e=l.find(".ItemEditCancelButton");jQuery.UI.setControlEnabled(k,false);k.unbind("click");e.unbind("click");p.change(function(s){var i=false;if(this.value!=q.quantity){i=true}jQuery.UI.setControlEnabled(k,i)});k.click(function(s){var i=jQuery("#"+q.sku);a.showCurtain(i);adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.EDIT_ITEM_QUANTITY,[{reportingProduct:q,newQuantity:p.val(),oldQuantity:q.quantity}]);adobe.ecomm.cart.ShoppingCart.editCartItem(q.sku,p.val(),q.upgradeFromCategoryPath)});e.click(function(i){a.hideQuantityEdit()})};a.showEditView=function(e){var d=this.data().itemView;var f=this.data().configurator;if(jQuery.browser.msie){d.editView.css("visibility","visible")}d.editView.toggleClass("EcommHidden");d.view.toggleClass("EcommHidden");d.itemButtons.toggleClass("EcommHidden",e);var g="";if(f.getSelectedProduct()!=null){g=f.getSelectedProduct().FORMATTED_PRICE;if(jQuery.isValue(f.getSelectedProduct().TERM_TYPE)&&f.getSelectedProduct().TERM_TYPE==="YEAR"){d.termTypeNote.text(f.localizedLabels.TERM_TYPE_PER_YEAR)}else{if(jQuery.isValue(f.getSelectedProduct().TERM_TYPE)&&f.getSelectedProduct().TERM_TYPE==="MONTH"){d.termTypeNote.text(f.localizedLabels.TERM_TYPE_PER_MONTH)}else{d.termTypeNote.toggleClass("EcommHidden",true)}}}else{d.termTypeNote.toggleClass("EcommHidden",true)}d.price.text(g);if(!d.originalPrice.hasClass("EcommHidden")){d.originalPrice.addClass("EcommHidden")}d.taxInclusiveDetails.toggleClass("EcommHidden",true)};a.initConfigurator=function(e){var d=adobe.ecomm.view.store.cart.StoreCartView;var g=this.data();var i={productData:e,categoryPath:g.model.categoryPath,defaultVals:g.model.getDefaultConfigVals(),configContainer:g.itemView.configContainer,cartMode:!g.addItemMode,localizedLabels:d.localizedLabels.STORE_CONFIGURATOR,truncateControlLabels:false};var h=this.find(".ItemEditSaveButton");var f=new adobe.ecomm.configurator.ComponentProductConfigurator(i);f.subscribe("modelChanged",function(j){var k=(j.getLength()==1);jQuery.UI.setControlEnabled(h,k);g.itemView.price.toggleClass("EcommHidden",!k);g.itemView.termTypeNote.toggleClass("EcommHidden",!k);if(k){g.itemView.price.text(j.getSelectedProduct().FORMATTED_PRICE);if(jQuery.isValue(j.getSelectedProduct().TERM_TYPE)&&j.getSelectedProduct().TERM_TYPE!==""){}if(j.getSelectedProduct().TERM_TYPE==="YEAR"){g.itemView.termTypeNote.text(j.localizedLabels.TERM_TYPE_PER_YEAR);g.itemView.termTypeNote.toggleClass("EcommHidden",false)}else{if(j.getSelectedProduct().TERM_TYPE==="MONTH"){g.itemView.termTypeNote.text(j.localizedLabels.TERM_TYPE_PER_MONTH);g.itemView.termTypeNote.toggleClass("EcommHidden",false)}else{g.itemView.termTypeNote.toggleClass("EcommHidden",true)}}}},this);f.subscribe("configPromptSelected",function(j){jQuery.UI.setControlEnabled(h,false);g.itemView.price.toggleClass("EcommHidden",true);g.itemView.termTypeNote.toggleClass("EcommHidden",true)},this);f.subscribe("configQuantityChanged",function(j){if(!j.anyPromptIsSelected()){jQuery.UI.setControlEnabled(h,true)}},this);if(f.getLength()>1){jQuery.UI.setControlEnabled(h,false)}else{if(g.addItemMode){g.itemView.price.text(f.getSelectedProduct().FORMATTED_PRICE)}}g.configurator=f};a.handleItemRemoved=function(d){d.unsubscribe("cartItemUpdated",this.handleItemUpdated);d.unsubscribe("cartItemRemoved",this.handleItemRemoved);this.removeData()};a.resetItemView=function(){var f=this.data();var d=f.itemView;var g=f.model;var h=adobe.ecomm.view.store.cart.StoreCartView.localizedLabels;f.configurator=null;try{if(f.specialCaseQtyEdit){this.hideQuantityEdit();d.taxInclusiveDetails.toggleClass("EcommHidden",adobe.ecomm.store.Store.cartPriceDisplay!=="TAX_INCLUSIVE_DETAILS")}else{d.editView.toggleClass("EcommHidden",true);d.view.toggleClass("EcommHidden",false);d.itemButtons.toggleClass("EcommHidden",false);d.originalPrice.toggleClass("EcommHidden",g.originalPrice===g.adjustedPrice);d.price.text(g.adjustedPrice);d.taxInclusiveDetails.toggleClass("EcommHidden",adobe.ecomm.store.Store.cartPriceDisplay!=="TAX_INCLUSIVE_DETAILS");if(jQuery.isValue(g.termType)&&g.termType!==""&&(!jQuery.isValue(g.parentSku)||g.parentSku==="")){if(g.termType==="YEAR"){d.termTypeNote.text(h.STORE_CONFIGURATOR.TERM_TYPE_PER_YEAR);d.termTypeNote.toggleClass("EcommHidden",false)}else{if((g.termType==="MONTH")&&(g.fulfillmentMethod!="AFCS")){d.termTypeNote.text(h.STORE_CONFIGURATOR.TERM_TYPE_PER_MONTH);d.termTypeNote.toggleClass("EcommHidden",false)}else{d.termTypeNote.toggleClass("EcommHidden",true)}}}else{d.termTypeNote.toggleClass("EcommHidden",true)}this.initConfigurator(f.initialConfigData)}}catch(i){}};a.handleAddItemClicked=function(){if(!adobe.ecomm.view.store.cart.StoreCartView.dialogWorksWithSelect()){this.resetItemView()}};a.showCurtain=function(e){var d=e.find(".EcommCartItemCurtain");if(jQuery.isValue(d)){d.height(e.height());d.width(e.width());if(jQuery.browser.msie){e.find(".EcommSelCartitemEditor").css({visibility:"hidden"})}d.css({top:e.css("top"),left:e.offset().left});d.fadeIn("slow");d.find("#curtain-spinner").attr("vspace",d.height()/2-20)}};a.hideCurtain=function(){this.data().itemView.itemCurtain.fadeOut("slow")};a.handlePromoCodeAdded=function(){var d=this.data();d.configNeedsPromoRefresh=true;this.resetItemView()};b.subscribe("cartItemUpdated",a.handleItemUpdated,a);b.subscribe("cartItemRemoved",a.handleItemRemoved,a);adobe.ecomm.cart.ShoppingCart.subscribe("promoCodeAdded",a.handlePromoCodeAdded,a);this.crossSellList.subscribe("addItemClicked",a.handleAddItemClicked,a);a.find(".CartItemEditButton").click(function(f){var d=a.data().model;f.preventDefault();if(d.editable){a.editItem()}else{a.editQuantityOnly(d)}adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.EDIT_ITEM_CLICK)});a.find(".CartItemRemoveButton").bind("click",{model:b},function(d){d.preventDefault();adobe.ecomm.cart.ShoppingCart.removeCartItem(d.data.model.sku);adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.ITEM_REMOVE_CLICK,[d.data.model])});a.find(".ItemEditSaveButton").click(function(k){k.preventDefault();var h=a.data();var g=h.configurator;var f=g.getSelectedProduct();var d=h.model;var j=jQuery("#"+d.sku);if(h.addItemMode){h.addItemMode=false;var i=jQuery("#config-dialog");i.dialog("close");if(f.QUANTITY===0){f.QUANTITY=1}adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.CROSS_SELL_ADD_TO_CART_CLICK,[f]);adobe.ecomm.cart.ShoppingCart.addCartItem(f.SKU,f.QUANTITY,f.CATEGORY_PATH,f.UPGRADE_PATH)}else{if(f===null){return}var j=jQuery("#"+h.model.sku);a.showCurtain(j);if(d.sku===f.SKU){adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.EDIT_ITEM_QUANTITY,[{reportingProduct:f,newQuantity:f.QUANTITY,oldQuantity:d.quantity,reportProdIsConfigItem:true}]);adobe.ecomm.cart.ShoppingCart.editCartItem(f.SKU,f.QUANTITY,f.UPGRADE_PATH)}else{adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.EDIT_ITEM_SKU,[{configProduct:f,cartProduct:d}]);adobe.ecomm.cart.ShoppingCart.swapCartItem(d.sku,f.SKU,f.QUANTITY,f.UPGRADE_PATH)}}});a.find(".ItemEditCancelButton").click(function(f){f.preventDefault();if(a.data("addItemMode")){var d=jQuery("#config-dialog");d.dialog("close");adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.CROSS_SELL_CANCEL_CLICK)}else{a.resetItemView();adobe.ecomm.view.store.cart.StoreCartView.fire(adobe.ecomm.view.store.analytics.AnalyticsListener.EDIT_ITEM_CANCEL)}});a.handleItemUpdated.apply(a,[b]);a.css("display","block");a.find(".EcommCartItemCurtain").toggleClass("EcommHidden",true);return a}};jQuery.extend(adobe.ecomm.view.store.cart.StoreCartView,adobe.event.EventDispatcher);jQuery.createNs("adobe.ecomm.view.store.cart");adobe.ecomm.view.store.cart.RelatedContentPodList=function(a){for(prop in this.selectors){this.selectors[prop]=a[prop]}};adobe.ecomm.view.store.cart.RelatedContentPodList.prototype={selectors:{xsellArea:"",itemTemplate:"",container:"",itemBoxshot:"",itemTitle:"",itemTitleLink:"",itemTitleImgLink:"",itemDesc:"",itemAddButton:"",itemPricePreLabel:"",itemPriceLabel:"",itemOrigPriceLabel:"",itemPricePostLabel:""},displayItems:function(c){this._clearAllItems();for(var d in c){if(c[d].length>0){for(var a=0;a<c[d].length;a++){var b=this._createItemView(c[d][a],a==c[d].length-1,a);jQuery(this.selectors.container).append(b)}}else{jQuery(this.selectors.xsellArea).toggleClass("EcommHidden",true)}}},_clearAllItems:function(){jQuery(this.selectors.container).children(":visible").remove()},_createItemView:function(c,d,g){var j=this.selectors;var h=jQuery(j.itemTemplate).clone();h.removeClass("EcommHidden");h.attr("id",c.categoryPath);jQuery(j.xsellArea).toggleClass("EcommHidden",false);h.find(j.itemBoxshot).attr("src",c.boxshot);h.find(j.itemTitle).text(c.name);var f=this._getFullStoreUrl()+"&event=displayProduct&category="+c.categoryPath+"&categoryOid="+c.categoryOid;h.find(j.itemDesc).html(c.description);var e=null;var b=null;var a="";var i="";if(jQuery.isValue(c.prices.FULL)){if(jQuery.isValue(c.prices.FULL.PRICE[0].TERMTYPE)){switch(c.prices.FULL.PRICE[0].TERMTYPE){case"NONE":f=f+"&distributionMethodOID="+c.prices.FULL.OID;break;default:f=f+"&termType="+c.prices.FULL.PRICE[0].TERMTYPE}}a=c.prices.FULL.PRICE[0].PRICELABEL;e=c.prices.FULL.PRICE[0].PRICEWITHOUTTAX;b=c.prices.FULL.PRICE[0].ORIGINALPRICEWITHOUTTAX;i=c.prices.FULL.PRICE[0].PRICELABELPOST}if(!jQuery.isValue(e)&&jQuery.isValue(c.prices["N/A"])){if(jQuery.isValue(c.prices["N/A"].PRICE[0].TERMTYPE)){switch(c.prices["N/A"].PRICE[0].TERMTYPE){case"NONE":f=f+"&distributionMethodOID="+c.prices["N/A"].OID;break;default:f=f+"&termType="+c.prices["N/A"].PRICE[0].TERMTYPE}}a=c.prices["N/A"].PRICE[0].PRICELABEL;e=c.prices["N/A"].PRICE[0].PRICEWITHOUTTAX;b=c.prices["N/A"].PRICE[0].ORIGINALPRICEWITHOUTTAX;i=c.prices["N/A"].PRICE[0].PRICELABELPOST}h.find(j.itemTitleLink).attr("href",f);h.find(j.itemTitleImgLink).attr("href",f);if(a==""){h.find(j.itemPricePreLabel).toggleClass("EcommHidden",true);h.find(j.itemPricePreLabel).css("display","none")}else{h.find(j.itemPricePreLabel).toggleClass("EcommHidden",false);h.find(j.itemPricePreLabel).css("display","block");h.find(j.itemPricePreLabel).html(a+"<br / >")}h.find(j.itemPriceLabel).text(e);if(i==""){h.find(j.itemPricePostLabel).toggleClass("EcommHidden",true);h.find(j.itemPricePostLabel).css("display","none")}else{h.find(j.itemPricePostLabel).toggleClass("EcommHidden",false);h.find(j.itemPricePostLabel).css("display","block");h.find(j.itemPricePostLabel).html(i+"<br / >")}if(b==""){h.find(j.itemOrigPriceLabel).toggleClass("EcommHidden",true);h.find(j.itemOrigPriceLabel).css("display","none")}else{h.find(j.itemOrigPriceLabel).text(b);h.find(j.itemOrigPriceLabel).toggleClass("EcommHidden",false);h.find(j.itemOrigPriceLabel).css("display","block")}h.find(j.itemAddButton).bind("click",{data:c,scope:this},function(k){k.data.data.index=g+1;k.data.scope.fire("addItemClicked",[k.data.data])});if(!d){h.append("<hr />")}h.css("display","none");h.fadeIn("slow");return h},_getFullStoreUrl:function(){var a=adobe.ecomm.store.Store;return window.location.protocol+"//"+a.getServiceDomain()+a.storePath+"index.cfm?store="+a.storeName}};jQuery.extend(adobe.ecomm.view.store.cart.RelatedContentPodList.prototype,adobe.event.EventDispatcher);
