if(typeof prodList==="undefined"){var prodList=[];}if(typeof qtyList==="undefined"){var qtyList=[];}if(typeof s_account==="undefined"){var s_account="";}if(typeof certonaPageId==="undefined"){var certonaPageId="";}function _D(){if(s_account.indexOf("comdev")>-1){console.log(arguments);}}(function($){_ctoClass=function(Config){this.init=function(){if(typeof window.console=="undefined"){console={log:function(){}};}$('<style type="text/css"> #canvas { visibility: hidden; } form.asyncForm { display: none; } </style>').appendTo("head");if(Config.tealeaf.enabled){Req(true,"/web_assets/js/tealeaf/TealeafSDKConfig.js","/web_assets/js/tealeaf/TealeafSDK.js");}$(document).ready(function(){var scriptName=_cto.scriptName();var agentIE6=($.browser.msie&&$.browser.version.substr(0,1)<7)?true:false;var agentIpad=(navigator.userAgent.match(/iPad/i)!=null)?true:false;_cto.statics={stageLock:false,showCreditCardUpdateForm:false,isIE6:agentIE6,isIpad:agentIpad,lastRequestTime:new Date().getTime(),sessionExpired:false,checkoutStageInfogram:{},isShopPage:_cto.isShopPage(scriptName),isCartPage:_cto.isCartPage(scriptName),isOrderPage:_cto.isOrderPage(scriptName),isConfirmationPage:_cto.isConfirmationPage(scriptName)};setTimeout(function(){if(typeof s.pageName!="undefined"){_cto.statics.pageName=s.pageName;}},1600);_cto.RequestHandler.readyForms();_cto.previouslyVisited();_cto.createLoginModal();if(!_cto.statics.isCartPage&&!_cto.statics.isOrderPage&&!_cto.statics.isConfirmationPage){$("#canvas").css("visibility","visible");_ctoMiniCart.triggers();if(!_cto.statics.isConfirmationPage){_ctoMiniCart.populate();}}else{setTimeout(function(){$("body").addClass("is-checkout-page");},200);if(_cto.statics.isConfirmationPage){$("#canvas").css("visibility","visible");}}if(_cto.statics.isOrderPage&&!_cto.statics.isConfirmationPage){setTimeout(function(){$("body").addClass("is-order-page");},200);$("#pc-overflow:first").remove();_cto.ajax({url:"/store/common/json/checkout.jsp?task=checkoutOnLoadCart",dataType:"json",success:function(data){if(_cto.isCartOrCheckoutObject(data)){_cto.stopChecks(data);if(data.cart.bagCount==0){_cto.goHomeUnsecure();}else{$("#canvas").css("visibility","visible");_cto.initOrderPage(data);_cto.initPhoneNumberBoxes();}}}});}if(_cto.statics.isCartPage){setTimeout(function(){$("body").addClass("is-cart-page");},200);$("#pc-overflow:first").remove();_cto.ajax({url:"/store/common/json/cart.jsp?task=shoppingBagOnLoadCart&isCartPage="+_cto.statics.isCartPage+"&isOrderPage="+_cto.statics.isOrderPage+"&isShopPage="+_cto.statics.isShopPage,dataType:"json",success:function(data){if(_cto.isCartOrCheckoutObject(data)){$("#canvas").css("visibility","visible");_cto.createCheckoutModals();_cto.updateCart(data,true);}}});}});}();this.Lang={global:{general:"There was a problem while processing your request. Please click OK and try again. "},itemLevel:{inventoryError:"We're sorry, but that item is no longer available."},formErrors:{global:"Please review the highlighted areas below to continue.",login:{email:"Please enter a valid email address.",password:"Please enter your password."},freezeOrder:"We could not process your order at this time. If you feel you received this in error, please call customer service at "}};this.getSessionIdFromCookie=function(){if(document.cookie==""){return null;}var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var pair=cookies[i].split("=");if(pair[0]=="JSESSIONID"){return unescape(pair[1]);}}};this.heDecode=function(encodedString){return $("<span/>").html(encodedString).text();};this.animScrollTop=function(duration,callback,formName){var runOnce=0;if($('form[name="'+formName+'"]').offset().top-$(document).scrollTop()<100){$("html, body").animate({scrollTop:$('form[name="'+formName+'"]').offset().top-300},duration,function(){if(runOnce<1){callback();}runOnce++;});}else{callback();}};this.closeModals=function(){try{$(".modalWindow").jqmHide();}catch(e){$(".modalWindow .qvClose").trigger("click");}};this.goHomeUnsecure=function(){document.location=_cto.getHomeUnsecure();};this.getHomeUnsecure=function(){return document.location.href.split("/store")[0].replace("https:","http:")+"/store/home.jsp";};this.sessionTimeoutModal=function(){_cto.closeModals();$("#modalSessionTimedOut").trigger("click");$(".jqmOverlay").unbind();};this.getTaskFromUrl=function(url){var q=url.split("?")[1];if(!q){return false;}q=q.split("&");for(var i=0;i<q.length;i++){var o=q[i].split("=");if(o[0]=="task"){return o[1];}}};this.ajaxBeforeSerializeUrl=function(form,url){var formName=form.attr("name");if(_cto.statics.isOrderPage&&(formName=="qvFrmAddToBag"||formName=="couponForm")){form.find('input[name*="SuccessURL"], input[name*="ErrorURL"]').val("/store/common/json/checkout.jsp");url=url.replace("/json/cart.jsp","/json/checkout.jsp");}return _cto.RequestHandler.urlReprice(url,formName);};this.ajax=function(o){$.ajax($.extend(o,{url:_cto.RequestHandler.urlReprice(o.url),beforeSend:function(xhr){if(_cto.RequestHandler.handleSessionRedirect()){return false;}},complete:function(xhr){_cto.RequestHandler.responseRedirect(xhr);}}));};this.ajaxForm=function(r,o){$(r).ajaxForm($.extend(o,{beforeSerialize:function(form){this.url=_cto.ajaxBeforeSerializeUrl(form,this.url);},beforeSend:function(xhr){if(_cto.RequestHandler.handleSessionRedirect()){return false;}},complete:function(xhr){_cto.RequestHandler.responseRedirect(xhr);}}));};this.ajaxSubmit=function(r,o){$(r).ajaxSubmit($.extend(o,{beforeSerialize:function(form){this.url=_cto.ajaxBeforeSerializeUrl(form,this.url);},beforeSend:function(xhr){if(_cto.RequestHandler.handleSessionRedirect()){return false;}},complete:function(xhr){_cto.RequestHandler.responseRedirect(xhr);}}));};this.isCartOrCheckoutObject=function(data){var isModalLogin;if(typeof data=="object"){if(data.modalLogin){if(data.modalLogin=="true"){isModalLogin=true;}}else{isModalLogin=false;}if(isModalLogin||data.items||data.checkout){return -1;}}return 0;};this.clearSessionLaunchModal=function(){_cto.statics.sessionExpired=true;$.cookie("JSESSIONID",null,{path:"/",secure:((document.location.protocol=="https:")?true:false)});_cto.sessionTimeoutModal();};this.RequestHandler=this.FormHandler=this.FormUtils={handleSessionRedirect:function(){if(_cto.statics.isOrderPage||_cto.statics.isCartPage){var currentEpochTime=new Date().getTime();var secondsSinceLastRequest=(currentEpochTime-_cto.statics.lastRequestTime)/1000;_cto.statics.lastRequestTime=currentEpochTime;if(secondsSinceLastRequest>Config.sessionTimeout.seconds||_cto.statics.sessionExpired){_cto.clearSessionLaunchModal();return -1;}else{return 0;}}return 0;},responseRedirect:function(xhr){if(xhr.readyState==4&&(_cto.statics.isOrderPage||_cto.statics.isCartPage)){var data=xhr.responseText;if(typeof data!="object"){if(/<\/head>/i.test(data)){_cto.clearSessionLaunchModal();return -1;}else{if(trim(data).substring(0,1)!="<"){data=eval("("+data+")");}else{return 0;}}}if(data.modalLogin=="false"&&data.location){if(data.location.indexOf("/store/home.jsp")>-1){_cto.clearSessionLaunchModal();}else{document.location=data.location;}return -1;}else{return 0;}}return 0;},readyForms:function(){$("form.asyncForm").show();$(".co-global-error").html(_cto.Lang.formErrors.global);if(window.HTMLElement){HTMLFormElement.prototype._submit=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(event){target=event?event.target:this;if($(target).attr("class").indexOf("asyncForm")!=-1){$(target).submit();}else{target._submit();}};}else{for(i=0;i<document.forms.length;i++){document.forms[i]._submit=document.forms[i].submit;document.forms[i].submit=function(event){target=event?event.target:this;if($(target).attr("class").indexOf("asyncForm")!=-1){$(target).submit();}else{target._submit();}};}}_cto.ajaxForm(".asyncForm",{dataType:"json",showLoader:true,timeout:Config.ajaxTimeout.duration,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var formName=$(xhr).attr("name");if(data.cart){data.formErrors=data.cart.formErrors;}if(_cto.isAddToBag()&&data.formErrors.cart.length>0){$("#alert.modalWindow").jqmHide();var m="";$(data.formErrors.cart).each(function(){m+=" "+this.message;});$("#zone-error").html(m).show();}else{if(data.modalLogin=="true"){_cto.closeModals();$("#pc-btn-checkout2").trigger("click");}else{_ctoTagging.doTracking(data,formName);if(((data.cart)?data.cart.wishlist:data.wishlist)=="false"){if(_cto.statics.isCartPage){_cto.updateCart(data);}else{if(_cto.statics.isOrderPage){_cto.animScrollTop(Config.scrollTop.duration,function(){_ctoMiniCart.update(data,formName);_cto.updateOrder(data,formName);},formName);}else{$(document).scrollTop(0);_ctoMiniCart.update(data,formName);}}_cto.closeModals();}else{successOverlay='<div class="large_message"><center>Your item has been added to your wish list!<br/></center></div><div class="product-detail-divider"></div><div id="mb_buttons"><a href="/store/wish_list/wish_list_items.jsp"><img src="/store/images/buttons/btn_view_wishlist.gif" border="0" class="button" alt="view your wish list"/></a>';if($("#quickViewWindow:visible").length>0){successOverlay+='<a class="continueBtn"><img src="/store/images/buttons/btn_continue_shopping.gif" border="0" class="button" alt="continue shopping" /></a></div>';}else{successOverlay+='<a href="'+redirectURL+'" class="close"><img src="/store/images/buttons/btn_continue_shopping.gif" border="0" class="button" alt="Continue Shopping" /></a></div>';}$("#alert").jqmHide().jqmShow(this,{width:"240",height:"180"}).removeClass("ajax-loading").find("div.modalContent").html(successOverlay);}}}}},error:function(jqXHR,textStatus,errorThrown){alert(_cto.Lang.global.general+" ("+textStatus+")");_cto.closeModals();}});},urlReprice:function(url,formName){var task=((typeof formName=="string")?formName:null)||_cto.getTaskFromUrl(url);if((_cto.statics.isCartPage&&$.inArray(task,$.merge(Config.repriceRequests.asyncFormNames.cartPage,Config.repriceRequests.ajaxTaskParams.cartPage))>-1)||(_cto.statics.isOrderPage&&$.inArray(task,$.merge(Config.repriceRequests.asyncFormNames.checkoutPage,Config.repriceRequests.ajaxTaskParams.checkoutPage))>-1)){return url+((url.indexOf("?")<0)?"?":"&")+"reprice=true";}else{return url;}},validateLogin:function(parent){parent=(parent)?parent:"body";$(parent+" .validateFormLogin").submit(function(){values={};errors=[];$.each($(this).serializeArray(),function(i,field){values[field.name]=field.value;});if(!/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(values.login)){errors.push({login:_cto.Lang.formErrors.login.email});}if(!values.password){errors.push({password:_cto.Lang.formErrors.login.password});}if(errors.length){$(".form-error").removeClass("form-error");$(".form-error-msg").remove();$.each(errors,function(index,error){$.each(error,function(index,error){index=(index=="email")?"login":index;if($(parent+" .validateFormLogin input[name="+index+"] + .form-error-msg").length<1){e=$(parent+" .validateFormLogin input[name="+index+"]");e.addClass("form-error");$('<div class="form-error-msg">'+error+"</div>").insertAfter(e);}});});return false;}return true;});},phoneNumberBoxes:function(){$(".phoneNumberBoxes").each(function(){var phone=$(this).find(".coFormPhone").val().split("-").join("");var parent=$(this);if($(parent).find(".frmPhone1").attr("maxlength")==3){$(parent).find(".frmPhone1").val(phone.substring(0,3));$(parent).find(".frmPhone2").val(phone.substring(3,6));$(parent).find(".frmPhone3").val(phone.substring(6,10));}else{$(parent).find(".frmPhone1").val(phone);}$(parent).find(".co-formPhone").bind("keyup blur",function(){var inputClass=$(this).attr("class");var charCount=$(this).val().length;if(inputClass!="frmPhone3"&&charCount==3){$(this).next().next().focus();}$(parent).find(".coFormPhone").val($(parent).find(".frmPhone1").val()+$(parent).find(".frmPhone2").val()+$(parent).find(".frmPhone3").val());});});}};this.validateLoginForm=this.FormUtils.validateLogin;this.initPhoneNumberBoxes=this.FormUtils.phoneNumberBoxes;this.clearObjDataTimeouts=function(obj,tids){$.each(tids,function(index,tid){if(typeof obj.data(tid)!="undefined"&&obj.data(tid)!=""){clearTimeout(obj.data(tid));obj.data(tid,"");}});};this.createLoginModal=function(){$('<div class="modalWindow" id="modalLogin"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td><td align="right"><a class="modalClose"></a></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalLogin").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalLoginTrigger",onLoad:function(){$("#modalLogin .coModalContent").removeClass("loading");$("#modalLogin").prev("div").unbind("click");_cto.validateLoginForm("#modalLogin");}});};this.createCheckoutModals=function(){$('<div class="modalWindow" id="modalCheckoutOption"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td><td align="right"><a class="modalClose"></a></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalCheckoutOption").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalCheckoutOptionTrigger",timeout:Config.ajaxTimeout.duration,onLoad:function(){$("#modalCheckoutOption .coModalContent").css("height","auto").removeClass("loading");_cto.ajaxForm('form[name="addEditGift"], form[name="frmCreateGiftcardModal"], form[name="frmCreateGiftcard4"], form[name="editShipTo"], form[name="editShipMethod"]',{dataType:"json",showLoader:false,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var formName=$(xhr).attr("name");if(_cto.statics.isCartPage){_cto.updateCart(data.cart);}else{_ctoMiniCart.update(data.cart);_cto.updateOrder(data,formName);}if(!_cto.containsErrors($.merge(data.checkout.formErrors,data.cart.formErrors))){if(formName=="frmCreateGiftcardModal"){if(data.checkout.billing.giftCard.applyToOrder=="false"){_cto.clearFormErrors('form[name="frmCreateGiftcardModal"]');$("#modal-add-giftCard #co-billing-gift-result-number").html(billing.giftCard.giftCardNumber.replace(/\X/g,"&#8226;"));$("#modal-add-giftCard #co-billing-gift-result-balance").html("$"+fasMoneyAbs(billing.giftCard.balanceAmount));$("#modal-add-giftCard #co-billing-gift-form").stop().fadeOut(function(){$("#modal-add-giftCard #co-billing-gift-result").stop().fadeIn();});}else{_cto.closeModals();}}else{_cto.closeModals();}if(formName=="editShipTo"){$(".editShipMethodUpdateAlert .modalCheckoutOptionTrigger").click();}}}},error:function(jqXHR,textStatus,errorThrown){alert(_cto.Lang.global.general+" ("+textStatus+")");_cto.closeModals();}});}});$('<div class="modalWindow" id="modalCheckoutOptionLocked"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalCheckoutOptionLocked").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalCheckoutOptionLockedTrigger",timeout:Config.ajaxTimeout.duration,onLoad:function(){$(".jqmOverlay").unbind();$("#modalCheckoutOptionLocked .coModalContent").css("height","auto").removeClass("loading");_cto.ajaxForm('form[name="removeHazMatForm"], form[name="editShipTo"]',{dataType:"json",showLoader:false,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var formName=$(xhr).attr("name");if(_cto.statics.isCartPage){_cto.updateCart(data.cart);}else{_ctoMiniCart.update(data.cart);_cto.updateOrder(data,formName);}if(!_cto.containsErrors($.merge(data.checkout.formErrors,data.cart.formErrors))){_cto.closeModals();if(formName=="editShipTo"){$(".editShipMethodUpdateAlert .modalCheckoutOptionTrigger").click();}}}},error:function(jqXHR,textStatus,errorThrown){alert(_cto.Lang.global.general+" ("+textStatus+")");_cto.closeModals();}});}});$('<div class="modalWindow" id="modalEmailCart"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td><td align="right"><a class="modalClose"></a></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalEmailCart").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalEmailCartTrigger",onLoad:function(){_cto.RequestHandler.readyForms();$("#modalEmailCart .coModalContent").css("height","auto").removeClass("loading");_cto.ajaxForm('form[name="checkEmailCart"]',{dataType:"json",showLoader:false,beforeSubmit:function(){$('input[name="emailShoppingBag"]').attr("disabled","true");$(".sb-email-cart-response div").hide();$('<div class="sb-email-ajax-status waitMessage">Please wait...</div>').appendTo(".sb-email-cart-response");},success:function(data){if(_cto.isCartOrCheckoutObject(data)){$('input[name="emailShoppingBag"]').removeAttr("disabled");$(".sb-email-ajax-status").remove();if(!data.formErrors||data.formErrors.length<1){$(".sb-email-cart-success").fasToggle(function(){setTimeout(function(){$("#sb-modal-emailWrapper").fasToggle(function(){_cto.closeModals();});},2600);});}else{$(".sb-email-cart-fail").html(data.formErrors[0].message);$(".sb-email-cart-fail").fasToggle();}}},error:function(jqXHR,textStatus,errorThrown){$('input[name="emailShoppingBag"]').removeAttr("disabled");$(".sb-email-ajax-status").remove();$(".sb-email-cart-fail").fasToggle();}});}});$('<div class="modalWindow" id="modalCheckoutCreateCreditCard"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td><td align="right"><a class="modalClose"></a></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalCheckoutCreateCreditCard").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalCheckoutCreateCreditCardTrigger",onLoad:function(){$("#modalCheckoutCreateCreditCard").css("position","absolute");$(document).scrollTop(0);$("#modalCheckoutCreateCreditCard .coModalContent").removeClass("loading");_cto.ajaxSubmit('form[name="frmCreateCreditCardLinkModal"]',{dataType:"html",showLoader:false,success:function(data){$("#modalCheckoutCreateCreditCard .coModalContent").html(data).css("height","auto");}});}});$('<div class="modalWindow" id="modalCheckoutUpdateCreditCard"><table border="0" cellspacing="0" cellpadding="0"><tr class="modalControls"><td class="modalCaption"></td><td align="right"><a class="modalClose"></a></td></tr><tr><td colspan="2"><div class="coModalContent loading"></div></td></tr></table></div>').appendTo("body");$("#modalCheckoutUpdateCreditCard").jqm({target:"div.coModalContent",ajax:"@href",title:"@title",trigger:"a.modalCheckoutUpdateCreditCardTrigger",onLoad:function(){$("#modalCheckoutUpdateCreditCard").css("position","absolute");$(document).scrollTop(0);$("#modalCheckoutUpdateCreditCard .coModalContent").removeClass("loading");_cto.ajaxSubmit('form[name="frmUpdateCreditCardLink"]',{dataType:"html",showLoader:false,success:function(data){$("#modalCheckoutUpdateCreditCard .coModalContent").html(data).css("height","auto");}});}});};this.submitCreateCreditCardModal=function(){_cto.ajaxForm('form[name="frmCreateCreditCardModal"]',{dataType:"json",showLoader:false,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var formName=$(xhr).attr("name");_ctoMiniCart.update(data.cart);_cto.updateOrder(data,formName);if(!_cto.containsErrors($.merge(data.checkout.formErrors,data.cart.formErrors))){_cto.closeModals();}}}});};this.submitSelectCreditCardJSON=function(){_cto.ajaxSubmit('form[name="frmSelectCreditCard"]',{dataType:"json",showLoader:false,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var billing=(typeof data.checkout.billing!="undefined")?data.checkout.billing:false;if(billing.workingCreditCard){$("#coBillingUpdateCreditCardNumber").val(_cto.heDecode(billing.workingCreditCard.creditCardNumber.replace(/\X/g,"&#8226;")));$("#coBillingUpdateCreditCardName").val(billing.workingCreditCardName);$("#coBillingUpdateCreditCardType option").removeAttr("selected").parent().find('[value="'+billing.workingCreditCard.creditCardType+'"]').attr("selected","selected");$("#co-billing-credit-card-exp-month option").removeAttr("selected").parent().find('[value="'+billing.workingCreditCard.expirationMonth+'"]').attr("selected","selected");$("#co-billing-credit-card-exp-year option").removeAttr("selected").parent().find('[value="'+billing.workingCreditCard.expirationYear+'"]').attr("selected","selected");$("#coCreditCardNameLink, #coCreditCardNameUpdate").val(billing.creditCardName);if(billing.workingCreditCard.securityCode=="false"){$("#frmUpdateCreditCard_wrapper #co-ccard-form .co-cvv-field").show();}else{$("#frmUpdateCreditCard_wrapper #co-ccard-form .co-cvv-field").hide();}$('#frmUpdateCreditCard_wrapper input[id^="billingForm_fName"]').val(billing.workingCreditCard.address.firstName);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_lName"]').val(billing.workingCreditCard.address.lastName);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_add1"]').val(billing.workingCreditCard.address.address1);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_add2"]').val(billing.workingCreditCard.address.address2);_cto.initCityStateCountry({preSelect:{city:billing.workingCreditCard.address.city,state:billing.workingCreditCard.address.state,country:billing.workingCreditCard.address.countryCode},countryTarget:'#frmUpdateCreditCard_wrapper select[id^="billingForm_country"]',stateTarget:'#frmUpdateCreditCard_wrapper div[id^="coBillingState"]',cityTarget:'#frmUpdateCreditCard_wrapper div[id^="coBillingCity"]',stateHiddenInput:'#frmUpdateCreditCard_wrapper input[id^="billingForm_state_hidden"]',cityHiddenInput:'#frmUpdateCreditCard_wrapper input[id^="billingForm_city_hidden"]',phoneTarget:'#frmUpdateCreditCard_wrapper input[id^="co-billing-phone"]'});$('#frmUpdateCreditCard_wrapper input[id^="billingForm_zip"]').val(billing.workingCreditCard.address.postalCode);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_phone"]').val(billing.workingCreditCard.address.phoneNumber);_cto.initPhoneNumberBoxes();}}}});};this.submitSelectCreditCardModal=function(){_cto.ajaxSubmit('form[name="frmSelectCreditCard"]',{dataType:"html",showLoader:false,success:function(data,status,xhr){$("#modalCheckoutUpdateCreditCard .coModalContent").html(data);}});};this.submitCreateCreditCardLinkModal=function(){_cto.ajaxSubmit('form[name="frmCreateCreditCardLinkModal"]',{dataType:"html",showLoader:false,success:function(data){$("#modalCheckoutUpdateCreditCard .coModalContent .modal-update").animate({opacity:0},"slow","fasEaseOut",function(){$(this).animate({height:"+=22px"},"slow","fasEaseOut",function(){$(this).parent().html(data);$(this).animate({opacity:1},"slow","fasEaseOut");});});}});};this.submitUpdateCreditCardModal=function(){_cto.ajaxForm('form[name="frmUpdateCreditCardModal"]',{dataType:"json",showLoader:false,success:function(data,status,xhr){if(_cto.isCartOrCheckoutObject(data)){var formName=$(xhr).attr("name");_ctoMiniCart.update(data.cart);_cto.updateOrder(data,formName);if(!_cto.containsErrors($.merge(data.checkout.formErrors,data.cart.formErrors))){_cto.closeModals();}}}});};this.scrapeProductIdFromUrl=function(url){if(url.indexOf("productId=")>-1){return url.split("productId=")[1].split("&")[0].replace("#","");}else{return"";}};this.scrapeCatIdFromUrl=function(url){if(url.indexOf("catId=")>-1){return url.split("catId=")[1].split("&")[0].replace("#","");}else{return"";}};this.scriptName=function(){var path=window.location.pathname.split("store/");return path[path.length-1].split(".")[0];};this.isCartPage=function(scriptName){if(!scriptName){scriptName=_cto.scriptName();}if(scriptName=="checkout/cart"){return -1;}else{return 0;}};this.isOrderPage=function(scriptName){if(!scriptName){scriptName=_cto.scriptName();}if(scriptName=="checkout/checkout2"){return -1;}else{return 0;}};this.isShopPage=function(scriptName){if(!scriptName){scriptName=_cto.scriptName();}var nonShopLocs=["checkout","account","wish_list"];if($.inArray(scriptName.split("/")[0],nonShopLocs)==-1){return -1;}else{return 0;}};this.isConfirmationPage=function(scriptName){if(!scriptName){scriptName=_cto.scriptName();}if(scriptName=="checkout/orderConfirmation"){return -1;}else{return 0;}};this.isAddToBag=function(){if($("#product-actions").length){return -1;}else{return 0;}};this.previouslyVisited=function(){if(!_cto.statics.isShopPage){previousUrl=$.cookie("previousUrl");if(window.location.href==previousUrl||!previousUrl){$(".sb-contShop-link").attr("href",_cto.getHomeUnsecure());}else{$(".sb-contShop-link").attr("href",previousUrl);}}else{$.cookie("previousUrl",window.location.href,{path:"/"});}};this.containsErrors=function(errors){if(!isEmptyObject(errors.cart)||!isEmptyObject(errors.coupon)||!isEmptyObject(errors.shipping)||!isEmptyObject(errors.giftOptions)||!isEmptyObject(errors.creditCard)||!isEmptyObject(errors.billing)||!isEmptyObject(errors.giftCard)||!isEmptyObject(errors.commitOrder)){return -1;}else{return 0;}};this.mergeErrors=function(errors){var merged=[];if(!isEmptyObject(errors.cart)){$.merge(merged,errors.cart);}if(!isEmptyObject(errors.coupon)){$.merge(merged,errors.coupon);}if(!isEmptyObject(errors.shipping)){$.merge(merged,errors.shipping);}if(!isEmptyObject(errors.giftOptions)){$.merge(merged,errors.giftOptions);}if(!isEmptyObject(errors.creditCard)){$.merge(merged,errors.creditCard);}if(!isEmptyObject(errors.billing)){$.merge(merged,errors.billing);}if(!isEmptyObject(errors.giftCard)){$.merge(merged,errors.giftCard);}if(!isEmptyObject(errors.commitOrder)){$.merge(merged,errors.commitOrder);}return merged;};this.updateBagCount=function(count,cartContainsInventoryError){if(cartContainsInventoryError){$("#bag-count").html(' (<span class="pc-alert-error-text">Item Alert</span>)');}else{$("#pc-bag-count, #bag-count").html(" ("+(count|0)+" Item"+((count==1)?"":"s")+")");}};this.updateMbox=function(data){var mboxParams=[];if(data.isCommonMboxParams){$(data.mboxParameters).each(function(){mboxParams.push(this.mboxParameterName+"="+this.mboxParameterValue);});}if(data.mboxes){$(data.mboxes).each(function(){if(this.mboxName.indexOf("persistentCart")==-1){if(!data.isCommonMboxParams){mboxParams=[];$(this.mboxParameters).each(function(){mboxParams.push(this.mboxParameterName+"="+this.mboxParameterValue);});}try{mboxFactoryDefault.update(this.mboxName,mboxParams);}catch(e){}}});}};this.updateCart=function(data,suppressMbox){$("#sb-cart-errors .sb-error-message").remove();$.each(data.formErrors.cart,function(){$('<div class="sb-error-message" style="display: none;">'+_cto.heDecode(this.message)+"</div>").appendTo("#sb-cart-errors").fasToggle();});$("#sb-promo-errors .sb-error-message").remove();$.each(data.formErrors.coupon,function(){$('<div class="sb-error-message" style="display: none;">'+_cto.heDecode(this.message)+"</div>").appendTo("#sb-promo-errors").fasToggle();});if(data.bagCount<1){$(".sb-cart-empty-promo").show();$("#sb-sum-shipping").hide();if($("#sb-send-cart-wrapper:visible").length){$(".sb-checkoutBtn, #sb-send-cart-wrapper").fasToggle();}}else{$(".sb-cart-empty-promo").hide();$("#sb-sum-shipping").show();if($("#sb-send-cart-wrapper:visible").length<1){$(".sb-checkoutBtn, #sb-send-cart-wrapper").fasToggle();}}var curItems=[];$(".sb-product").each(function(){curItems.push($(this).attr("id").split("sb-item")[1]);});$(".sb-product .sb-error-message").remove();var retItems=[];$.each(data.items,function(index,item){retItems.push(this.itemId);});var remItems=[];$(curItems).each(function(index,item){if($.inArray(item,retItems)==-1){remItems.push(item);}});var itemsHtml="";var newItems=[];var itemInventoryError;var itemShortInvAlert;var cartContainsInventoryError=false;$.each(data.items,function(index,item){itemInventoryError="";itemShortInvAlert="";this.unitItemPrice=(this.unitItemPrice=="$0.00")?"FREE":this.unitItemPrice;this.rawItemPrice=(this.rawItemPrice=="$0.00")?"FREE":this.rawItemPrice;this.finalItemPrice=(this.finalItemPrice=="$0.00")?"FREE":this.finalItemPrice;var rawItemPrice=(this.rawItemPrice==this.finalItemPrice)?"":this.rawItemPrice;if(this.isGiftCard=="true"){$("#sb-item"+this.itemId+" .sb-price-after-discount").html(this.finalItemPrice);}else{if(this.gwp=="true"){$("#sb-item"+this.itemId+" .sb-price-before-discount").html("");$("#sb-item"+this.itemId+" .sb-price-after-discount").html("FREE");}else{$("#sb-item"+this.itemId+" .sb-price-before-discount").html(rawItemPrice);$("#sb-item"+this.itemId+" .sb-price-after-discount").html(this.finalItemPrice);}}var qty=this.qty;$("#"+this.itemId+" option").each(function(){if($(this).val()==qty){$(this).attr("selected","selected");}else{$(this).removeAttr("selected");}});if(this.itemNotAvailable){itemInventoryError='<div class="sb-error-message">'+_cto.Lang.itemLevel.inventoryError+"</div>";$(itemInventoryError).prependTo("#sb-item"+this.itemId+" .sb-modify");if(!cartContainsInventoryError){cartContainsInventoryError=true;}}if(this.shortInvAlert){itemShortInvAlert='<div class="sb-error-message">'+this.shortInvAlert+"</div>";$(itemShortInvAlert).prependTo("#sb-item"+this.itemId+" .sb-modify");if(!cartContainsInventoryError){cartContainsInventoryError=true;}}$(".sb-product").removeClass("sb-is-first");if($.inArray(this.itemId,curItems)==-1){var gwpImage=(this.gwp=="true")?'<img class="sb-gwp" src="/store/images/checkout_redesign/chs_gwp_freeGift.gif" style="margin: 89px 0 0 -95px;"/>':"";var qtySel="";for(i=1;i<=10;i++){if(this.qty==i){qtySel+='<option value="'+i+'" selected>'+i+"</option>";}else{qtySel+='<option value="'+i+'">'+i+"</option>";}}prodList.push(this.style+",");var row='<div class="sb-product'+((index==0)?" sb-is-first":"")+((itemInventoryError)?" sb-product-has-error":"")+'" id="sb-item'+this.itemId+'" style="display: none;">';row+='<div class="sb-product-image"><a href="'+this.link+'" class="bluelink"><img border="0" src="'+this.image+'" alt="'+this.name+'">'+gwpImage+"</a></div>";row+='<div class="sb-product-container"><div class="sb-order-info"><div class="sb-item">';row+='<div class="sb-title">';row+='<a href="'+this.link+'" class="bluelink">'+this.name.replace(/&amp;/g,"&")+"</a>";row+="</div>";row+='<div class="sb-attrs">';if(this.designName){row+='<div class="sb-attr">';row+='<div class="sb-label">Design:</div>';row+='<div class="sb-value">'+this.designName+"</div>";row+="</div>";}if(this.style&&!this.isGiftCard){row+='<div class="sb-attr">';row+='<div class="sb-label">Style:</div>';row+='<div class="sb-value">'+this.style+"</div>";row+="</div>";}if(this.sku){row+='<div class="sb-attr">';row+='<div class="sb-label">SKU:</div>';row+='<div class="sb-value">'+this.sku+"</div>";row+="</div>";}if(this.color){row+='<div class="sb-attr">';row+='<div class="sb-label">Color:</div>';row+='<div class="sb-value">'+this.color+"</div>";row+="</div>";}if(this.size){row+='<div class="sb-attr">';row+='<div class="sb-label">Size:</div>';row+='<div class="sb-value">'+this.size+"</div>";row+="</div>";}row+="</div>";row+="</div>";row+='<div class="sb-price">'+this.unitItemPrice+"</div>";row+='<div class="sb-qty">';row+='<select onchange="_ctoTagging.asyncAction.changeQuantity();preUpdateTasks();" id="'+this.itemId+'" name="'+this.itemId+'" '+((this.gwp=="true"||itemInventoryError||this.isEGiftCard=="true")?"disabled":"")+">"+qtySel+"</select>";row+='<input type="hidden" value="1" size="4" name="'+this.itemId+'">';row+="</div>";if(gwpImage&&this.finalItemPrice=="$0.00"){row+='<div class="sb-total"><s><span class="sb-price-before-discount"></span></s><div class="sb-price-after-discount">FREE</div></div>';}else{row+='<div class="sb-total"><s><span class="sb-price-before-discount">'+rawItemPrice+'</span></s><div class="sb-price-after-discount">'+this.finalItemPrice+"</div></div>";}row+="</div>";if(this.gwp=="true"||(this.isGiftCard=="true"&&this.isEGiftCard=="false")){row+='<div class="sb-modify"><div class="sb-modify-remove">'+itemInventoryError+itemShortInvAlert+"<a onclick=\"_cto.removeLineItem('"+this.itemId+"','removeFromLink', true, {'categoryId': '"+this.categoryId+"', 'style': '"+this.style+'\'});" href="javascript: void(0);">Remove</a></div></div></div><div class="clear"></div></div>';}else{row+='<div class="sb-modify">'+itemInventoryError+itemShortInvAlert+"<a onclick=\"quickView.quickLaunch('"+_cto.scrapeProductIdFromUrl(this.link)+"','"+this.colorCode+"','','"+this.itemId+"', '"+((this.size)?this.size:"")+"', '"+this.designSku+'\');return false;" href="javascript: void(0);">Edit</a> <span class="sb-modify-remove"><a onclick="_cto.removeLineItem(\''+this.itemId+"','removeFromLink', true, {'categoryId': '"+this.categoryId+"', 'style': '"+this.style+'\'});" href="javascript: void(0);">Remove</a></span></div></div><div class="clear"></div></div>';}itemsHtml+=row;newItems.push(this.itemId);}});if(typeof certonaCHObject=="object"){certonaCHObject.initAndRunWithRecommendation(prodList,customerId,null,null,"shopping+cart",host,prodList,null,null,certonaPageId);}$("#sb-items .sb-cart-unavailable-promo").after(itemsHtml);if(data.closenessQualifierMsgs){$("#pc-close-qualif").html(data.closenessQualifierMsgs);}else{$("#pc-close-qualif").html("");}if(remItems.length){var remItemCount=0;$(remItems).each(function(index,item){remItemCount++;$("#sb-item"+item).fasToggle(function(){$("#sb-item"+item).remove();if(remItemCount==remItems.length){$(newItems).each(function(index,item){$("#sb-item"+item).fasToggle(function(){$("#sb-item"+item).removeAttr("style");});});}});});}else{$(newItems).each(function(index,item){$("#sb-item"+item).fasToggle(function(){$("#sb-item"+item).removeAttr("style");});});}_cto.updateBagCount(data.bagCount,cartContainsInventoryError);$.merge(data.promoDiscounts,data.conditionalMessages);var curClaimed=[];$(".sb-discount").each(function(){couponId=$(this).attr("id").split("promo")[1];curClaimed.push(couponId);});var retClaimed=[];$(data.promoDiscounts).each(function(index,obj){retClaimed.push(this.couponId);});var remClaimed=[];$(curClaimed).each(function(index,couponId){if($.inArray(couponId,retClaimed)==-1){remClaimed.push(couponId);}});var newClaimed=[];$(data.promoDiscounts).each(function(index,obj){if($.inArray(this.couponId,curClaimed)==-1){if(this.message){this.discountMessage=this.message;this.discountAmount="";this.isClaimed=false;}else{this.isClaimed=true;}if(this.isClaimed==false&&$("#sb-discounts-pending").length<1){$('<div id="sb-discounts-pending"></div>').insertBefore("#sb-promo-errors");}$('<div id="promo'+this.couponId+'" class="sb-discount sb-promo-is-'+this.type+((this.isClaimed==false)?" sb-error-message":"")+'" style="display: none;"><div class="sb-label"><span class="sb-promo-msg">'+_cto.heDecode(this.discountMessage)+'</span> <span class="sb-promo-rem">'+promoRemoveLinkTemplate.replace("_DAV=","_DAV="+this.couponId.replace("_unclaimed","").split("-")[0])+'</span></div><div class="sb-price">'+this.discountAmount+'</div><div class="clear"></div></div>').appendTo((this.isClaimed)?"#sb-discounts":"#sb-discounts-pending");newClaimed.push(this.couponId);}});if(remClaimed.length){var cpnAnimCount=0;$(remClaimed).each(function(index,couponId){$("#promo"+couponId).fasToggle(function(){cpnAnimCount++;$("#promo"+couponId).remove();if(cpnAnimCount==remClaimed.length){$(newClaimed).each(function(index,couponId){$("#promo"+couponId).fasToggle();});}});});}else{$(newClaimed).each(function(index,couponId){$("#promo"+couponId).fasToggle();});}if(data.itemsSubtotal){$("#sb-sum-subtotal .sb-price").html(data.itemsSubtotal);}if(data.shippingCost){$("#sb-sum-shipping .sb-price").html((data.shippingCost=="$0.00")?"FREE":data.shippingCost);}else{$("#sb-sum-shipping").hide();data.itemsTotal=data.itemsTotalNoShipping;}if(data.GiftOptions){$("#sb-sum-gift .sb-price").html(data.GiftOptions);}if(data.itemsTotal){$("#sb-sum-total .sb-price").html(data.itemsTotal);}if(!_cto.isOrderPage()){if(!suppressMbox){_cto.updateMbox(data);}}};this.stopChecks=function(data){if(data.checkout){setTimeout(function(){if(data.checkout.freezeOrder=="true"){$("#co-order-commit-actions input").remove();$("#co-order-commit-actions-top").removeAttr("onclick");$('<input type="image" value="COMPLETE ORDER" src="/store/images/checkout_redesign/co_btn_placeOrder.gif">').appendTo("#co-order-commit-actions");$("#co-order-commit-actions-top, #co-order-commit-actions input").unbind("click").bind("click",function(){if(!$.cookie("freezeMsg")&&data.checkout.formErrors.commitOrder.length>0){$.cookie("freezeMsg",data.checkout.formErrors.commitOrder[0].message,{path:"/"});}alert($.cookie("freezeMsg")||_cto.Lang.formErrors.freezeOrder+trim($("#phone").html().split("or Call")[1]));});}if(data.checkout.hazMatError=="true"&&_cto.mergeErrors(data.checkout.formErrors).length<1){if($("#modal-hazmat").length<1){_cto.closeModals();$("#modalHazMatError").trigger("click");}}},200);}};this.updateOrder=function(data,formName,suppressMbox){var shipInfo=(typeof data.checkout.shipInfo!="undefined")?data.checkout.shipInfo[0]:false;var shipMethod=(typeof data.checkout.shipMethod!="undefined")?data.checkout.shipMethod[0]:false;var giftOption=(typeof data.checkout.giftOption!="undefined")?data.checkout.giftOption[0]:false;var billing=(typeof data.checkout.billing!="undefined")?data.checkout.billing:false;if(typeof billing.giftCard=="undefined"){billing.giftCard={};}if(!_cto.containsErrors(data.checkout.formErrors)){_cto.statics.stageLock=false;_cto.stopChecks(data);_cto.clearFormErrors("form");if(shipInfo){if($("#co-shipping-review-city").next("#co-comma").length==0){$('<span id="co-comma">,&nbsp;</span>').insertAfter("#co-shipping-review-city");}$("#co-shipping-review-firstName").html(shipInfo.firstName);$("#co-shipping-review-lastName").html(shipInfo.lastName);$("#co-shipping-review-address1").html(shipInfo.address1);$("#co-shipping-review-address2").html(shipInfo.address2);$("#co-shipping-review-city").html(shipInfo.city);$("#co-shipping-review-state").html(shipInfo.state);$("#co-shipping-review-zip").html(shipInfo.zip);$("#co-shipping-review-country").html(shipInfo.country);$("#co-shipping-review-countryCode").val(shipInfo.countryCode);if(shipInfo.countryCode=="USA"||shipInfo.countryCode=="CAN"){$("#co-shipping-review-phoneFormatted").html(shipInfo.phoneFormatted);}else{$("#co-shipping-review-phoneFormatted").html(shipInfo.phone);}$("#co-shipping-review-phone").val(shipInfo.phone);}else{$("#co-shipping-review-firstName").html("");$("#co-shipping-review-lastName").html("");$("#co-shipping-review-address1").html("");$("#co-shipping-review-address2").html("");$("#co-shipping-review-city").html("");$("#co-shipping-review-state").html("");$("#co-shipping-review-zip").html("");$("#co-shipping-review-country").html("");$("#co-shipping-review-countryCode").val("");$("#co-shipping-review-phoneFormatted").html("");$("#co-shipping-review-phone").val("");}if(shipMethod){shipMethod.amount=(shipMethod.amount=="0.0")?"FREE":"$"+fasMoneyAbs(shipMethod.amount);$("#co-ship-method-type").html(shipMethod.type);$("#co-ship-method-amount").html(shipMethod.amount);$("#co-ship-method-eta").html(shipMethod.eta);}else{$("#co-ship-method-type").html("");$("#co-ship-method-amount").html("");$("#co-ship-method-eta").html("");}if(giftOption){_cto.orderStageHeight(false);if(giftOption.giftReceipt=="true"){$("#co-gift-option-giftReceipt").show();}else{$("#co-gift-option-giftReceipt").hide();}if(giftOption.giftBox=="true"){$("#co-gift-option-giftBox").show();}else{$("#co-gift-option-giftBox").hide();}if(giftOption.userText){$("#co-gift-option-userText").html('"'+_cto.heDecode(giftOption.userText).replace(/<br>/g,"")+'"');}else{$("#co-gift-option-userText").html("");}$("#co-gift-option-description").hide();$("#coRemoveGiftOption").show();$("#coEditGiftOption").show();$("#coAddGiftOption").hide();}else{$("#co-gift-option-userText").html("");$("#co-gift-option-description").show();$("#co-gift-option-giftBox").hide();$("#co-gift-option-giftReceipt").hide();$("#coRemoveGiftOption").hide();$("#coEditGiftOption").hide();$("#coAddGiftOption").show();}billing.amountOnGC=(billing.amountOnGC=="$0.00")?false:billing.amountOnGC;if(billing.amountOnGC){if($("#pc-amountOnGC .pc-value").text()!=billing.amountOnGC){$("#pc-amountOnGC").remove();$('<div id="pc-amountOnGC" class="pc-totals-row" style="display: none; padding-top: 10px"><div class="pc-label">Applied Gift Card</div><div class="pc-value">$'+fasMoneyAbs(billing.amountOnGC)+'</div><div class="clear"></div></div>').insertAfter("#pc-grandtotal").fasToggle();}else{if($("#pc-amountOnGC").css("display")=="none"){$("#pc-amountOnGC").fasToggle();}}}else{if($("#pc-amountOnGC").css("display")!="none"){$("#pc-amountOnGC").fasToggle();}}billing.amountOnCC=(billing.amountOnCC=="$0.00")?false:billing.amountOnCC;if(billing.amountOnGC&&billing.amountOnCC){if($("#pc-amountOnCC .pc-value").text()!=billing.amountOnCC){$("#pc-amountOnCC").remove();$('<div id="pc-amountOnCC" class="pc-totals-row" style="display: none"><div class="pc-label">Balance Due on Credit Card</div><div class="pc-value">$'+fasMoneyAbs(billing.amountOnCC)+'</div><div class="clear"></div></div>').insertAfter("#pc-amountOnGC").fasToggle();}else{if($("#pc-amountOnCC").css("display")=="none"){$("#pc-amountOnCC").fasToggle();}}}else{if($("#pc-amountOnCC").css("display")!="none"){$("#pc-amountOnCC").fasToggle();}}if(billing.isCreditCardPresent=="true"){$(".modalCheckoutCreateCreditCardTrigger").hide();$(".modalCheckoutUpdateCreditCardTrigger").show();}else{$(".modalCheckoutCreateCreditCardTrigger").show();$(".modalCheckoutUpdateCreditCardTrigger").hide();}if(data.checkout.ElectronicOnlyOrder=="true"){$("#co-message-eGift-only").html('<div id="co-message-eGift-title">PLEASE NOTE:</div><div>Right now our systems still ask for a shipping address, even for eCards &ndash; so simply enter your billing address. Then finish checking out.</div>').show();}else{$("#co-message-eGift-only").hide();}if(billing.isGiftCardPresent=="true"){if(billing.giftCard.applyToOrder=="false"){$("#co-billing-review-giftcard, #coGiftCardRemove").hide();_cto.clearFormErrors('form[name="frmCreateGiftcard"]');$("#co-billing-gift-result-number").html(billing.giftCard.giftCardNumber.replace(/\X/g,"&#8226;"));$("#co-billing-gift-result-balance").html("$"+fasMoneyAbs(billing.giftCard.balanceAmount));$("#co-billing-gift-form").stop().fadeOut(function(){$("#co-billing-gift-result").stop().fadeIn().animate({opacity:1});});}else{var cartTotal=data.cart.itemsTotal.split("$")[1].replace(",","");var appliedGC=(billing.giftCard.balanceAmount-cartTotal<0)?billing.giftCard.balanceAmount:cartTotal;var remainBal=billing.giftCard.balanceAmount-appliedGC;if(cartTotal-appliedGC==0){data.checkout.GiftCardOnly="true";}else{data.checkout.GiftCardOnly="false";if(window.location.hash=="#review"&&billing.isCreditCardPresent=="false"){if($(".modalWindow:visible").length==0){$("#modalOrderTotalChanged").trigger("click");}}}$("#co-billing-review-gcNumber, #co-billing-gift-result-remove-number").html(billing.giftCard.giftCardNumber.replace(/\X/g,"&#8226;"));$("#co-billing-review-gcApplied, #co-billing-gift-result-remove-amount").html("$"+fasMoneyAbs(appliedGC));$("#co-billing-review-gcBalance").html("$"+fasMoneyAbs(remainBal));$("#coGiftCardNameRemove").val(billing.giftCardName);$("#coGiftCardCreate").hide();$("#co-billing-review-giftcard, #coGiftCardRemove").show();}}else{$("#co-billing-review-giftcard, #coGiftCardRemove").hide();$("#coGiftCardCreate").show();}if(billing.creditCard){if($("#co-billing-review-city").next("#co-comma").length==0){$('<span id="co-comma">,&nbsp;</span>').insertAfter("#co-billing-review-city");}$('#coBillingUpdateCreditCardName, #frmSelectCreditCard select[name*="UpdateCreditCardFormHandler.creditCardName"]').val(billing.creditCardName);$("#coCreditCardNameLink, #coCreditCardNameUpdate").val(billing.creditCardName);if(_cto.mergeErrors(data.checkout.formErrors).length<1){$("#coBillingUpdateCreditCardNumber").val(_cto.heDecode(billing.creditCard.creditCardNumber.replace(/\X/g,"&#8226;")));$("#coBillingUpdateCreditCardType option").removeAttr("selected").parent().find('[value="'+billing.creditCard.creditCardType+'"]').attr("selected","selected");$("#co-billing-credit-card-exp-month option").removeAttr("selected").parent().find('[value="'+billing.creditCard.expirationMonth+'"]').attr("selected","selected");$("#co-billing-credit-card-exp-year option").removeAttr("selected").parent().find('[value="'+billing.creditCard.expirationYear+'"]').attr("selected","selected");$("#co-billing-review-ctype").html(billing.creditCard.creditCardType);$("#co-billing-review-cnum").html(billing.creditCard.creditCardNumber.replace(/\X/g,"&#8226;"));$("#co-billing-review-cexp").html("Expires "+billing.creditCard.expirationMonth+"/"+billing.creditCard.expirationYear);}if(billing.workingCreditCard.creditCardNumber!=""){billing.creditCard=billing.workingCreditCard;}if(billing.creditCard.securityCode=="false"){$("#frmUpdateCreditCard_wrapper #co-ccard-form .co-cvv-field").show();}else{$("#frmUpdateCreditCard_wrapper #co-ccard-form .co-cvv-field").hide();}$("#co-billing-review-firstName").html(billing.creditCard.address.firstName);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_fName"]').val(billing.creditCard.address.firstName);$("#co-billing-review-lastName").html(billing.creditCard.address.lastName);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_lName"]').val(billing.creditCard.address.lastName);$("#co-billing-review-address1").html(billing.creditCard.address.address1);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_add1"]').val(billing.creditCard.address.address1);$("#co-billing-review-address2").html(billing.creditCard.address.address2);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_add2"]').val(billing.creditCard.address.address2);$("#co-billing-review-city").html(billing.creditCard.address.city);$("#co-billing-review-state").html(billing.creditCard.address.state);$("#co-billing-review-country").html(billing.creditCard.address.country);setTimeout(function(){_cto.initCityStateCountry({preSelect:{city:billing.creditCard.address.city,state:billing.creditCard.address.state,country:billing.creditCard.address.countryCode},countryTarget:'#frmUpdateCreditCard_wrapper select[id^="billingForm_country"]',stateTarget:'#frmUpdateCreditCard_wrapper div[id^="coBillingState"]',cityTarget:'#frmUpdateCreditCard_wrapper div[id^="coBillingCity"]',stateHiddenInput:'#frmUpdateCreditCard_wrapper input[id^="billingForm_state_hidden"]',cityHiddenInput:'#frmUpdateCreditCard_wrapper input[id^="billingForm_city_hidden"]',phoneTarget:'#frmUpdateCreditCard_wrapper input[id^="co-billing-phone"]'});},2000);$("#co-billing-review-zip").html(billing.creditCard.address.postalCode);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_zip"]').val(billing.creditCard.address.postalCode);$("#co-billing-review-phone").html(billing.creditCard.address.phoneFormatted);$('#frmUpdateCreditCard_wrapper input[id^="billingForm_phone"]').val(billing.creditCard.address.phoneNumber);_cto.initPhoneNumberBoxes();}else{$("#co-billing-review-ctype").html("");$("#co-billing-review-cnum").html("");$("#co-billing-review-cexp").html("");$("#co-billing-review-firstName").html("");$("#co-billing-review-lastName").html("");$("#co-billing-review-address1").html("");$("#co-billing-review-address2").html("");$("#co-billing-review-city").html("");$("#co-billing-review-state").html("");$("#co-billing-review-zip").html("");$("#co-billing-review-country").html("");$("#co-billing-review-phone").html("");}if($("#coShipToState select").length){$("#coShipToState select").trigger("change");}if(formName=="editShipTo"){updateShipping=1;}if(typeof updateShipping!="undefined"&&formName=="editShipMethod"){updateBox=".co-review-box.shippingUpdateAlert";delete updateShipping;}else{updateBox=".co-review-box."+formName+"UpdateAlert";}if(formName!="editShipTo"){$(updateBox).addClass("co-updated").animate({backgroundColor:"#ffffff"},Config.OrderPage.duration1,function(){$(this).removeClass("co-updated").removeAttr("style");});}if(_cto.isOrderPage()){if(!suppressMbox){_cto.updateMbox(data.checkout);}}}else{var formEl='form[name="'+formName+'"]';var errors=_cto.mergeErrors(data.checkout.formErrors);_cto.clearFormErrors(formEl);if($(formEl+" .co-info-errors").length<1){$('<div class="co-info-errors"></div>').insertAfter(formEl+" .co-global-error");}else{$(formEl+" .co-info-errors").html("");}var hasGlobalFormError;var hasInfoFormError;$(errors).each(function(){inputEl=(this.propertyName=="password")?$(formEl+' [name*="ssword"]:not([name*="passwordHint"]):not([name*="_D:/"]):visible'):$(formEl+' [name*=".'+this.propertyName+'"]:not([name*="_D:/"]):last');if(inputEl.length>0&&this.propertyName!=""){hasGlobalFormError=true;if($(".co-formError-"+formName+"_"+this.propertyName).length<1){$('<div class="co-formError co-formError-'+formName+"_"+this.propertyName+'" style="display: none;"><table cellpadding="0" cellspacing="0" class="co-error_wrapper"><tr><td class="co-left_shadow">&nbsp;</td><td><table cellpadding="0" cellspacing="0"><tr><td class="co-top_shadow">&nbsp;</td></tr><tr><td class="co-errorMsg-content"><div class="co-formError-c2">'+_cto.heDecode(this.message)+'</div></td></tr></table></td><td class="co-right_shadow">&nbsp;</td></tr><tr><td class="co-left_corner_shadow"></td><td class="co-bottom_shadow">&nbsp;</td><td class="co-right_corner_shadow">&nbsp;</td></tr></tr></table></div>').insertAfter(inputEl);}else{$(".co-formError-"+formName+"_"+this.propertyName+" .co-formError-c2").html($(".co-formError-"+formName+"_"+this.propertyName+" .co-formError-c2").html()+" "+_cto.heDecode(this.message));}if(inputEl.is(":hidden")){if(this.propertyName=="state"){$(inputEl).prevAll(":visible").find("select option").removeAttr("selected").parent().find('[value=""]').attr("selected","selected");}if(this.propertyName=="phoneNumber"){$(formEl+" .phoneNumberBoxes input").addClass("co-formField-alert");}else{firstVisible=inputEl.prevAll(":visible").find(":input:first");if(firstVisible.is("select")){firstVisible.parent().addClass("co-formField-alert");}else{firstVisible.addClass("co-formField-alert");}}}else{inputEl.addClass("co-formField-alert");if(this.propertyName=="creditCardNumber"){$(formEl+' [name*=".creditCardType"]').addClass("co-formField-alert");}}}else{hasInfoFormError=true;$('<div class="co-info-error" style="display: none;">'+_cto.heDecode(_cto.heDecode(this.message))+"</div>").appendTo(formEl+" .co-info-errors");}});if(hasInfoFormError){_cto.orderStageHeight(false);$(formEl+" .co-info-error").fasToggle(function(){_cto.orderStageHeight(true);});}if(hasGlobalFormError){$(formEl).addClass("co-form-has-errors");setTimeout(function(){_cto.orderStageHeight(false);$(formEl+" .co-global-error").hide().fasToggle(function(){_cto.orderStageHeight(true);});},200);}$(formEl+" .co-formField-alert, "+formEl+" .co-formField-alert select").unbind("focus").focus(function(){if($(this).parent().is(".phoneNumberBoxes")){$(formEl+' div[class*="_phoneNumber"]').fadeIn();}else{thisEl=($(this).is('select:not([name*="/atg/"])')||$(this).nextAll(".co-formError").length==0)?$(this).parent().nextAll(".co-formError"):$(this).next(".co-formError");thisEl.fadeIn();}}).unbind("keydown").keydown(function(){if($(this).parent().is(".phoneNumberBoxes")){$(formEl+" .co-formError-frmCreateCreditCard_phoneNumber").fadeOut();$(formEl+" .co-formError-shipping_phoneNumber").fadeOut();$(formEl+" .co-formError-editShipTo_phoneNumber").fadeOut();}else{thisEl=($(this).is('select:not([name*="/atg/"])')||$(this).nextAll(".co-formError").length==0)?$(this).parent().nextAll(".co-formError"):$(this).next(".co-formError");thisEl.fadeOut();}}).unbind("blur").blur(function(){$(this).trigger("keydown");});$(formEl+" .co-formField-alert:first").trigger("focus");}if(_cto.statics.stageLock==false){if(billing.isCreditCardPresent=="true"){_cto.statics.showCreditCardUpdateForm=true;}else{_cto.statics.showCreditCardUpdateForm=false;}if(data.checkout.RegistrationInfoCompleted=="true"){$("#co-email-form, #co-password-form").hide();}else{$("#co-email-form, #co-password-form").show().css("opacity",1);}_cto.statics.checkoutStageInfogram={BillingInfoCompleted:(data.checkout.BillingInfoCompleted)?data.checkout.BillingInfoCompleted:"false",ShippingInfoComplete:(data.checkout.ShippingInfoComplete)?data.checkout.ShippingInfoComplete:"false",creditCardSecurityCode:(data.checkout.billing.creditCard)?data.checkout.billing.creditCard.securityCode:"false",RegistrationInfoCompleted:(data.checkout.RegistrationInfoCompleted)?data.checkout.RegistrationInfoCompleted:"false",isGiftCardPresent:(data.checkout.isGiftCardPresent)?data.checkout.isGiftCardPresent:"false",isGiftCardPresent:(billing.isGiftCardPresent)?billing.isGiftCardPresent:"false",giftCardAppliedToOrder:(billing.giftCard.applyToOrder)?billing.giftCard.applyToOrder:"false",GiftCardOnly:(billing.GiftCardOnly)?billing.GiftCardOnly:"false"};if(data.checkout.RegistrationInfoCompleted=="false"&&billing.isGiftCardPresent=="true"&&billing.giftCard.applyToOrder=="true"&&data.checkout.GiftCardOnly=="true"&&data.checkout.ShippingInfoComplete=="true"){window.location="#giftCardRegister";return;}if(billing.isGiftCardPresent=="true"&&billing.giftCard.applyToOrder=="true"&&data.checkout.GiftCardOnly=="false"&&data.checkout.BillingInfoCompleted=="false"&&data.checkout.ShippingInfoComplete=="true"){window.location="#giftCardAdditionalPayment";return;}if(window.location.hash!="#review"&&data.checkout.GiftCardOnly=="false"&&data.checkout.BillingInfoCompleted=="false"&&data.checkout.ShippingInfoComplete=="true"){window.location="#payment";return;}if(data.checkout.ShippingInfoComplete=="false"&&data.checkout.BillingInfoCompleted=="true"){window.location="#shipping";return;}if(data.checkout.BillingInfoCompleted=="true"&&data.checkout.ShippingInfoComplete=="true"&&data.checkout.RegistrationInfoCompleted=="true"){window.location="#review";return;}if(data.checkout.BillingInfoCompleted=="false"&&data.checkout.ShippingInfoComplete=="false"){window.location="#start";return;}}};this.clearFormErrors=function(formEl){$(".co-formError, .co-info-error").remove();$(formEl).removeClass("co-form-has-errors");$(formEl+" .co-global-error").hide();$(formEl).find("input, select, div").removeClass("co-formField-alert");};this.remPromo=function(promo){var url=$(promo).attr("href");url+=((url.indexOf("?")<0)?"?":"&")+"task=remPromo";_cto.ajax({url:(_cto.statics.isOrderPage)?url.replace("/json/cart.jsp","/json/checkout.jsp"):url,dataType:"json",success:function(data){if(_cto.isCartOrCheckoutObject(data)){if(_cto.statics.isCartPage){_cto.updateCart(data);}else{_ctoMiniCart.update(data.cart);_cto.updateOrder(data);}}}});};this.removeLineItem=function(commId,hiddenRemoveId,confirm,tag){if(confirm){$("#sb-item"+commId+" .sb-modify-remove").html("<span class=\"removeAlert\">Are you sure you want to remove this item? <a onclick=\"_ctoTagging.asyncAction.removeFromBag({'categoryId': '"+tag.categoryId+"', 'style': '"+tag.style+"'});_cto.removeLineItem('"+commId+"','removeFromLink', false, {'categoryId': '"+tag.categoryId+"', 'style': '"+tag.style+'\'});" href="javascript: void(0);">Yes</a> or <a onclick="_cto.removeLineItemReset(\''+commId+"','removeFromLink', {'categoryId': '"+tag.categoryId+"', 'style': '"+tag.style+'\'});" href="javascript: void(0);">No</a></span>');}else{if(document.forms.couponForm.elements.loyalityNumber){if(document.getElementById("loyalityNumber").checked){document.getElementById("loyaltyInRemove").value=true;}else{document.getElementById("loyaltyInRemove").value=false;}}document.getElementById(hiddenRemoveId).value=commId;document.checkout2.submit();}};this.removeLineItemReset=function(commId,hiddenRemoveId,tag){$("#sb-item"+commId+" .sb-modify-remove").html("<a onclick=\"_cto.removeLineItem('"+commId+"','removeFromLink', true, {'categoryId': '"+tag.categoryId+"', 'style': '"+tag.style+'\'});" href="javascript: void(0);">Remove</a>');};this.initShippingMethods=function(parent){$(parent+" .co-shipping-selects:last").addClass("last");$(parent+" .co-shipping-selects").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});var smPrevSel;$(parent+" .co-shipping-selects").mousedown(function(){var smCurType=$(this).find(".co-shipping-type").val();if($(this).hasClass("selected")==false){if(smPrevSel!=null){$(smPrevSel).removeClass("selected");}$(this).addClass("selected");var smPrevType=smCurType;$(parent+" #co-selectedShippingMethod").val(smCurType);}smPrevSel=$(this);});var smDefault=$(parent+" #co-selectedShippingMethod").val();var setDefaultMethod=false;if(smDefault){$(parent+" .co-shipping-selects").each(function(){if($(this).find(".co-shipping-type").val()==smDefault){setDefaultMethod=true;$(this).trigger("mousedown");}});}if(!setDefaultMethod){$(parent+" .co-shipping-selects:first").trigger("mousedown");}};this.deployShippingMethods=function(data,statics){if(statics.shippingMethodsContainer&&$(".modalContent").not(":visible")){var methodHtml="";if(data.shippingMethods.length>0){$.each(data.shippingMethods,function(){this.amount=(this.amount=="0.0")?"FREE":"$"+fasMoneyAbs(this.amount);methodHtml+='<div class="co-shipping-selects"><div class="co-shipping-selects-wrapper"><input type="hidden" class="co-shipping-type" value="'+this.shippingMethod+'" /><div class="co-shipping-method-type">'+this.type+'</div><div class="co-shipping-method-cost">'+this.amount+'</div><div class="co-shipping-method-info"><div>'+this.description+'</div><div class="co-shipping-method-eta-class">Estimated Arrival:<div>'+this.eta+"</div></div><div>"+this.shipMethodPromoMsg+"</div></div></div></div>";});}$(statics.shippingMethodsContainer).find("#co-shipping-method-options-container").html(methodHtml);_cto.initShippingMethods(statics.shippingMethodsContainer);}};this.initCityStateCountry=function(statics){$(statics.countryTarget).unbind("change").change(function(){if(!selectHiddenInputValue){$(statics.cityHiddenInput).val("");$(statics.stateHiddenInput).val("");}if(statics.shippingMethodsContainer){var lisStateEvent=setInterval(function(){if($(statics.stateTarget+" select").length>0){$(statics.stateTarget+" select").unbind("mousedown change click blur keyup").bind("mousedown change click blur keyup",function(){if(!_cto.statics.sessionExpired){_cto.ajax({url:"/store/common/json/addressStateList.jsp?task=shipMethods&needShipMethods="+((statics.shippingMethodsContainer)?"true":"false")+"&country="+$(statics.countryTarget).val()+"&state="+$(this).val(),dataType:"json",success:function(data){if(!data.location){_cto.deployShippingMethods(data,statics);}}});}});clearInterval(lisStateEvent);}},200);}var url="/store/common/json/addressStateList.jsp?needShipMethods="+((statics.shippingMethodsContainer)?"true":"false")+"&country=";if(typeof statics.preSelect!="undefined"){url+=statics.preSelect.country;$(statics.countryTarget+" option").each(function(){if($(this).val()==statics.preSelect.country){$(this).attr("selected","selected");}});}else{url+=$(statics.countryTarget).val();}if($(statics.phoneTarget!=""&&statics.countryTarget).val()!="USA"&&$(statics.countryTarget).val()!="CAN"){$(statics.phoneTarget+" .dash, "+statics.phoneTarget+" .frmPhone2, "+statics.phoneTarget+" .frmPhone3").hide().val("");$(statics.phoneTarget+" .frmPhone1").attr("maxlength","15").addClass("co-formFields-small").removeClass("co-formFields").val($(statics.phoneTarget+" .coFormPhone").val());}else{$(statics.phoneTarget+" .dash, "+statics.phoneTarget+" .frmPhone2, "+statics.phoneTarget+" .frmPhone3").show();$(statics.phoneTarget+" .frmPhone1").attr("maxlength","3").removeClass("co-formFields-small").addClass("co-formFields");_cto.initPhoneNumberBoxes();}_cto.ajax({url:url,dataType:"json",success:function(data){var selectedState=(statics.preSelect)?statics.preSelect.state:$(statics.stateHiddenInput).val();var selectedCity=(statics.preSelect)?statics.preSelect.city:$(statics.cityHiddenInput).val();var stateOptions;if(data.stateList.length<1){stateOptions='<input id="'+$(statics.stateHiddenInput).attr("id")+'" class="co-formFields-small" type="text" maxlength="30" name="'+$(statics.stateHiddenInput).attr("name")+'"/>';}else{stateOptions='<option class="co-formFields-select" value=""></option>';$(data.stateList).each(function(){stateOptions+='<option class="co-formFields-select" value="'+this.key+'">'+this.value+"</option>";});stateOptions='<select id="'+$(statics.stateHiddenInput).attr("id")+'" class="co-formFields-small co-formField-select" name="'+$(statics.stateHiddenInput).attr("name")+'">'+stateOptions+"</select>";}$(statics.stateTarget).html(stateOptions);var cityOptions;if(data.cityList.length<1){cityOptions='<input id="'+$(statics.cityHiddenInput).attr("id")+'" class="co-formFields" type="text" maxlength="30" name="'+$(statics.cityHiddenInput).attr("name")+'"/>';}else{cityOptions='<option class="co-formFields-select" value=""></option>';$(data.cityList).each(function(){cityOptions+='<option class="co-formFields-select" value="'+this.key+'">'+this.value+"</option>";});cityOptions='<select id="'+$(statics.cityHiddenInput).attr("id")+'" class="co-formFields co-formField-select" name="'+$(statics.cityHiddenInput).attr("name")+'">'+cityOptions+"</select>";}$(statics.cityTarget).html(cityOptions);if(selectHiddenInputValue){if(selectedState){$(statics.stateHiddenInput).val(selectedState);if($(statics.stateTarget+" select").length){$(statics.stateTarget+" option").each(function(){if($(this).val()==selectedState){$(this).attr("selected","selected");}});}else{$(statics.stateTarget+" input").val(statics.selectedState);}}if(selectedCity){$(statics.cityHiddenInput).val(selectedCity);if($(statics.cityTarget+" select").length){$(statics.cityTarget+" option").each(function(){if($(this).val()==selectedCity){$(this).attr("selected","selected");}});}else{$(statics.cityTarget+" input").val(statics.selectedCity);}}}_cto.deployShippingMethods(data,statics);selectHiddenInputValue=false;delete statics.preSelect;}});});var selectHiddenInputValue=true;$(statics.countryTarget).change();};this.showCreditCardForm=function(cscParams){if(_cto.statics.showCreditCardUpdateForm==true){$("#frmUpdateCreditCard_wrapper, #co-modal-savedCC, #co-ccard-form-header-wrapper").show();$("#frmCreateCreditCard_wrapper").hide();if($('#frmUpdateCreditCard_wrapper div[id^="coBillingCity"] input').length<1){_cto.initCityStateCountry(cscParams.billingUpdate);}}else{$("#frmUpdateCreditCard_wrapper, #co-modal-savedCC, #co-ccard-form-header-wrapper").hide();$("#frmCreateCreditCard_wrapper").show();if($('#frmCreateCreditCard_wrapper div[id^="coBillingCity"] input').length<1){_cto.initCityStateCountry(cscParams.billingCreate);}}};this.helpToolTip=function(statics){$(statics.container).css({opacity:0,display:"none"});$(statics.triggers).mouseover(function(){$(statics.container).css("display","block").stop(true).animate({opacity:1},"slow");}).mouseout(function(){$(statics.container).stop(true).animate({opacity:0},"slow",function(){$(this).css("display","none");});});};this.helpToolTipCvv=function(statics){var ccSelected="";var ccType="";var ccImages=[];var ccDefault="Visa";var urlTemplate="/store/images/checkout_redesign/cvv_*.png";$(statics.form+" .co-billing-credit-card-type:first option").each(function(){ccSelected=$(this).val();if(ccSelected&&ccSelected!=ccDefault){ccImages.push(urlTemplate.replace("*",ccSelected));}});preloadArray(ccImages);$(statics.container).css({opacity:0,display:"none"});$(statics.triggers).mouseover(function(){if(_cto.statics.isIE6){$(statics.form+" #co-billing-credit-card-exp-month, "+statics.form+" #co-billing-credit-card-exp-year").css("visibility","hidden");}ccType=$(statics.form+" .co-billing-credit-card-type").val();$(statics.imageContainer).attr("class","co-cvv-"+((ccType)?ccType:ccDefault)).parent().css("display","block").stop(true).animate({opacity:1},"slow");}).mouseout(function(){$(statics.container).stop(true).animate({opacity:0},"slow",function(){$(this).css("display","none");if(_cto.statics.isIE6){$(statics.form+" #co-billing-credit-card-exp-month, "+statics.form+" #co-billing-credit-card-exp-year").css("visibility","visible");}});});};this.giftMessageLimiter=function(el){var charLimit=30;var lineLimit=4;var cleanList=[];var tempList=el.value.split("\n");for(var i=0;i<tempList.length;i++){if(/\S/.test(tempList[i])){cleanList.push(tempList[i].substring(0,charLimit));}}for(var j=0;j<tempList.length;j++){if(tempList[j].length>charLimit&&!/[\n\r]/.test(tempList[j].charAt(charLimit))){el.value=cleanList.join("\n")+"\n"+((cleanList.length<lineLimit)?tempList[j].charAt(charLimit):"");}}if(cleanList.length>lineLimit){cleanList.pop();el.value=cleanList.join("\n");}el.onblur=function(){this.value=cleanList.join("\n");};};this.orderStageHeight=function(op){$("#co-shipping").css("height",((op)?$("#co-shipping").height():""));$("#co-billing").css("height",((op)?$("#co-billing").height():""));};this.initOrderPage=function(orderData){var prevHash;_ctoMiniCart.build(orderData.cart,false);_cto.updateOrder(orderData,"",true);_cto.createCheckoutModals();var cscParams={shipping:{countryTarget:"#co-shipping-content-container #shipEdit_country",stateTarget:"#co-shipping-content-container #coShipToState",cityTarget:"#co-shipping-content-container #coShipToCity",stateHiddenInput:"#co-shipping-content-container #shipEdit_state_hidden",cityHiddenInput:"#co-shipping-content-container #shipEdit_city_hidden",shippingMethodsContainer:"#co-shipping-method-inline",phoneTarget:"#co-shipping-content-container #co-shipping-phone"},billingUpdate:{countryTarget:"#frmUpdateCreditCard_wrapper #billingForm_country",stateTarget:"#frmUpdateCreditCard_wrapper #coBillingState",cityTarget:"#frmUpdateCreditCard_wrapper #coBillingCity",stateHiddenInput:"#frmUpdateCreditCard_wrapper #billingForm_state_hidden",cityHiddenInput:"#frmUpdateCreditCard_wrapper #billingForm_city_hidden",phoneTarget:"#frmUpdateCreditCard_wrapper #co-billing-phone"},billingCreate:{countryTarget:"#frmCreateCreditCard_wrapper #billingForm_country",stateTarget:"#frmCreateCreditCard_wrapper #coBillingState",cityTarget:"#frmCreateCreditCard_wrapper #coBillingCity",stateHiddenInput:"#frmCreateCreditCard_wrapper #billingForm_state_hidden",cityHiddenInput:"#frmCreateCreditCard_wrapper #billingForm_city_hidden",phoneTarget:"#frmCreateCreditCard_wrapper #co-billing-phone"}};$.history.init(function(){setInterval(function(){switch(window.location.hash){case"#start":if(prevHash==window.location.hash){break;}else{if(prevHash=="#payment"||prevHash=="#review"){_cto.statics.stageLock=true;}prevHash=window.location.hash;set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":shipping",siteCatalyst_loginStatus);$("#co-shipping").removeClass("co-review-stage");$("#co-billing-header").addClass("co-inactive-default-section");$("#co-main-header img").attr({alt:"Checkout: Shipping Information",src:"../images/checkout_redesign/co_review_header_shippingInfo.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-options, #co-billing-options").show().css("opacity",1);$("#co-shipping-options").css("zIndex",1);$("#co-shipping-review, #co-billing-review, #co-billing-content, #co-order-review-actions, #co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);$("#co-shipping").css("height",$("#co-shipping-content").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()-1);if($("#coShipToCity input").length<1){_cto.initCityStateCountry(cscParams.shipping);}$("#co-content").css("visibility","visible");}break;case"#shipping":if(prevHash==window.location.hash){break;}else{if(prevHash=="#review"){_cto.statics.stageLock=true;}prevHash=window.location.hash;set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":shipping",siteCatalyst_loginStatus);$("#co-shipping").removeClass("co-review-stage");$("#co-billing-header").addClass("co-inactive-default-section");$("#co-main-header img").attr({alt:"Checkout: Shipping Information",src:"../images/checkout_redesign/co_review_header_shippingInfo.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-options, #co-billing-review, #co-billing-content, #co-order-review-actions").show().css("opacity",1);$("#co-shipping-options").css("zIndex",1);$("#co-shipping-review, #co-billing-options, #co-order-commit-actions, #co-order-commit-actions-top").hide().css("opacity",0);$("#co-shipping-proceed").css({height:"20px",opacity:0,padding:0,left:-1000});$("#co-shipping").css("height",$("#co-shipping-content").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()+$("#co-billing-review").outerHeight());if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}if($("#coShipToCity input").length<1){_cto.initCityStateCountry(cscParams.shipping);}$("#co-content").css("visibility","visible");}break;case"#payment":if(prevHash==window.location.hash){break;}else{if(!prevHash){prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-proceed").css({height:"20px",opacity:0,padding:0,left:-1000});$("#co-billing-options").show().css("opacity",1);$("#co-billing-gift-result").removeAttr("style").hide();$("#co-billing-gift-form").removeAttr("style").show();$("#co-billing-gift-result-remove, #co-billing-review, #co-shipping-options, #co-order-commit-actions, #co-order-commit-actions-top").hide().css("opacity",0);$("#co-billing-header").css("zIndex",1);$("#co-shipping").css("height",$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()+$("#co-billing-content").outerHeight());$("#co-content").css("visibility","visible");break;}else{if(prevHash=="#giftCardRegister"){prevHash=window.location.hash;document.frmRemoveGiftcard.submit();_cto.showCreditCardForm(cscParams);$('#co-billing-gift-form input[type="text"]').val("");_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-order-review-actions, #co-shipping-proceed, #co-shipping, #co-shipping-options").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",1);var runOnce=0;_cto.orderStageHeight(false);$("#co-billing-gift-result-remove, #frmRegisterInline_wrapper").animate({opacity:0},Config.OrderPage.duration2,"fasEaseIn",function(){if(runOnce<1){$("#co-billing-gift-result-remove, #frmRegisterInline_wrapper, #creditCardForm_container, #co-billing-gift-form").fasToggle({duration:Config.OrderPage.duration2,callback:function(){_cto.orderStageHeight(true);if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}}});}runOnce++;});}else{if(prevHash=="#giftCardAdditionalPayment"){prevHash=window.location.hash;document.frmRemoveGiftcard.submit();_cto.showCreditCardForm(cscParams);$('#co-billing-gift-form input[type="text"]').val("");_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-order-review-actions, #co-shipping-proceed, #co-shipping, #co-shipping-options").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",1);var runOnce=0;_cto.orderStageHeight(false);$("#co-billing-gift-result-remove").animate({opacity:0},Config.OrderPage.duration2,"fasEaseIn",function(){if(runOnce<1){$("#co-billing-gift-result-remove, #co-billing-gift-form").fasToggle({duration:Config.OrderPage.duration2,callback:function(){_cto.orderStageHeight(true);}});}runOnce++;});}else{if(prevHash=="#shipping"){prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-shipping, #co-shipping-options, #co-shipping-proceed").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-commit-actions, #co-order-commit-actions-top").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coShippingHeight=$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight();coBillingHeight=$("#co-billing-content").outerHeight();$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",2);$("#co-shipping-options, #co-order-review-actions").animate({opacity:0},Config.OrderPage.duration1,function(){$(this).hide();$("#co-shipping-proceed").animate({height:"20px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-shipping").animate({height:coShippingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-header").removeClass("co-inactive-default-section");$("#co-shipping-review").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-billing").animate({height:coBillingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-options").css("zIndex",1);$("#co-billing-content, #co-order-commit-actions,  #co-order-commit-actions-top").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-options, #co-billing-options, #co-billing-content").css("position","");$("#co-billing-header").css("zIndex","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});});}else{if(prevHash!="#review"){prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-shipping, #co-shipping-options").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-review-actions, #co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coShippingHeight=$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight();coBillingHeight=$("#co-billing-content").outerHeight();$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",2);$("#co-shipping-options, #co-shipping-proceed").animate({opacity:0},Config.OrderPage.duration1,function(){$(this).hide();$("#co-shipping-proceed").animate({height:"20px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-shipping").animate({height:coShippingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-header").removeClass("co-inactive-default-section");$("#co-shipping-review").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-billing").animate({height:coBillingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-options").css("zIndex",1);$("#co-billing-content, #co-order-review-actions").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-options, #co-billing-options, #co-billing-content").css("position","");$("#co-billing-header").css("zIndex","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});});}else{prevHash=window.location.hash;$("#modalEditAll").trigger("click");_cto.statics.stageLock=true;window.location="#review";}}}}}}break;case"#giftCardRegister":if(prevHash==window.location.hash){break;}else{if(!prevHash||prevHash=="#giftCardAdditionalPayment"){if(prevHash=="#review"){_cto.statics.stageLock=true;}prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-proceed").css({height:"20px",opacity:0,padding:0,left:-1000});$("#frmRegisterInline_wrapper, #co-billing-gift-result-remove, #co-billing-gift-collapsed, #co-billing-options").show().css("opacity",1);$("#co-billing-gift-result").removeAttr("style").hide();$("#co-billing-gift-form").removeAttr("style").hide();$("#co-billing-gift-uncollapsed, #creditCardForm_container, #co-billing-review, #co-shipping-options, #co-order-commit-actions, #co-order-commit-actions-top").hide().css("opacity",0);$("#co-billing-header").css("zIndex",1);$("#co-shipping").css("height",$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()+$("#co-billing-options").outerHeight());$("#co-content").css("visibility","visible");break;}else{if(prevHash=="#payment"){prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);_cto.clearFormErrors("form");if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}var runOnce=0;_cto.orderStageHeight(false);$("#co-billing-gift-result-remove, #frmRegisterInline_wrapper, #creditCardForm_container, #co-billing-gift-form:visible, #co-billing-gift-result:visible").fasToggle({duration:Config.OrderPage.duration2,callback:function(){if(runOnce<1){$("#co-billing-gift-result-remove, #frmRegisterInline_wrapper").animate({opacity:1},Config.OrderPage.duration2,"fasEaseIn",function(){_cto.orderStageHeight(true);if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});}runOnce++;}});break;}else{if(prevHash=="#review"){prevHash=window.location.hash;$("#modalEditAll").trigger("click");_cto.statics.stageLock=true;window.location="#review";}else{prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-shipping, #co-shipping-options").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-review-actions, #co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coShippingHeight=$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight();coBillingHeight=$("#co-billing-content").outerHeight();$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",2);$("#co-shipping-options, #co-shipping-proceed").animate({opacity:0},Config.OrderPage.duration1,function(){$(this).hide();$("#co-shipping-proceed").animate({height:"20px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-shipping").animate({height:coShippingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-header").removeClass("co-inactive-default-section");$("#co-shipping-review").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-billing").animate({height:coBillingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-options").css("zIndex",1);$("#co-billing-content, #co-order-review-actions").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-options, #co-billing-options, #co-billing-content").css("position","");$("#co-billing-header").css("zIndex","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});});}}}}break;case"#giftCardAdditionalPayment":if(prevHash==window.location.hash){break;}else{if(!prevHash||prevHash=="#giftCardRegister"){if(prevHash=="#review"){_cto.statics.stageLock=true;}prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-proceed").css({height:"20px",opacity:0,padding:0,left:-1000});$("#creditCardForm_container, #co-billing-gift-result-remove, #co-billing-gift-collapsed, #co-billing-options").show().css("opacity",1);$("#co-billing-gift-result").removeAttr("style").hide();$("#co-billing-gift-form").removeAttr("style").hide();$("#frmRegisterInline_wrapper, #co-billing-gift-uncollapsed, #co-billing-review, #co-shipping-options, #co-order-commit-actions, #co-order-commit-actions-top").hide().css("opacity",0);$("#co-billing-header").css("zIndex",1);$("#co-shipping").css("height",$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()+$("#co-billing-content").outerHeight());$("#co-content").css("visibility","visible");break;}else{if(prevHash=="#payment"){prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);var runOnce=0;_cto.orderStageHeight(false);$("#co-billing-gift-result-remove, #co-billing-gift-form:visible, #co-billing-gift-result:visible").fasToggle({duration:Config.OrderPage.duration2,callback:function(){if(runOnce<1){$("#co-billing-gift-result-remove").animate({opacity:1},Config.OrderPage.duration2,"fasEaseIn",function(){_cto.orderStageHeight(true);});}runOnce++;}});break;}else{if(prevHash=="#review"){prevHash=window.location.hash;$("#modalEditAll").trigger("click");_cto.statics.stageLock=true;window.location="#review";}else{prevHash=window.location.hash;_cto.showCreditCardForm(cscParams);set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":billing",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$("#co-billing").removeClass("co-review-stage");$("#co-shipping").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Payment Information",src:"../images/checkout_redesign/co_review_header_paymentInfo.gif"});$("#co-content").children().not(".asyncForm, #co-shipping, #co-shipping-options").removeAttr("style");$("#co-shipping-review").css("zIndex",2);$("#co-order-review-actions, #co-order-commit-actions,#co-order-commit-actions-top").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coShippingHeight=$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight();coBillingHeight=$("#co-billing-content").outerHeight();$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",2);$("#co-shipping-options, #co-shipping-proceed").animate({opacity:0},Config.OrderPage.duration1,function(){$(this).hide();$("#co-shipping-proceed").animate({height:"20px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-shipping").animate({height:coShippingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-header").removeClass("co-inactive-default-section");$("#co-shipping-review").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-billing").animate({height:coBillingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-options").css("zIndex",1);$("#co-billing-content, #co-order-review-actions").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-options, #co-billing-options, #co-billing-content").css("position","");$("#co-billing-header").css("zIndex","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});});}}}}break;case"#review":if(prevHash==window.location.hash){break;}else{if(prevHash=="#start"||!prevHash){prevHash=window.location.hash;set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":orderReview",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$(".co-review-box").addClass("activeCopyState");$("#co-shipping, #co-billing").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Order Review",src:"../images/checkout_redesign/co_review_header_orderReview.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm").removeAttr("style");$("#co-shipping-proceed").css({height:"20px",opacity:0,padding:0,left:-1000});$("#co-billing-content, #co-order-review-actions, #co-shipping-review, #co-billing-review, #co-order-commit-actions,#co-order-commit-actions-top").show().css("opacity",1);$("#co-shipping-options, #co-billing-options, #co-order-review-actions").hide().css("opacity",0);$("#co-shipping").css("height",$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight());$("#co-billing").css("height",$("#co-billing-header").outerHeight()+$("#co-billing-review").outerHeight());$("#co-content").css("visibility","visible");break;}else{if(prevHash=="#shipping"){prevHash=window.location.hash;set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":orderReview",siteCatalyst_loginStatus);_cto.clearFormErrors("form");$(".co-review-box").addClass("activeCopyState");$("#co-shipping, #co-billing").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Order Review",src:"../images/checkout_redesign/co_review_header_orderReview.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm, #co-shipping-proceed, #co-shipping, #co-shipping-options, #co-billing, #co-billing-options").removeAttr("style");$("#co-order-commit-actions").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coShippingHeight=$("#co-shipping-header").outerHeight()+$("#co-shipping-review").outerHeight();$("#co-content").css("visibility","visible");$("#co-shipping-options, #co-order-review-actions").animate({opacity:0},Config.OrderPage.duration1,"fasEaseIn",function(){$(this).hide();$("#co-order-review-actions").animate({height:"0px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-shipping").animate({height:coShippingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-shipping-review, #co-order-commit-actions,#co-order-commit-actions-top").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-review").css("zIndex",1);$("#co-shipping-content").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-shipping-review").css("zIndex",2);$("#co-shipping-options").css("position","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});}else{prevHash=window.location.hash;set_page_send_tag(siteCatalyst_brand,"checkout",siteCatalyst_checkoutType+":orderReview",siteCatalyst_loginStatus);if(_cto.statics.stageLock==false){_cto.clearFormErrors("form");$(".co-review-box").addClass("activeCopyState");$("#co-shipping, #co-billing").addClass("co-review-stage");$("#co-main-header img").attr({alt:"Checkout: Order Review",src:"../images/checkout_redesign/co_review_header_orderReview.gif"});$("#co-content").children().stop(true);$("#co-content").children().not(".asyncForm, #co-shipping-proceed, #co-shipping, #co-shipping-options, #co-billing, #co-billing-options").removeAttr("style");$("#co-order-commit-actions").hide().css("opacity",0);if(_cto.statics.isIE6){$("#co-content select").hide().css("opacity",0);}coBillingHeight=$("#co-billing-header").outerHeight()+$("#co-billing-review").outerHeight();$("#co-content").css("visibility","visible");$("#co-billing-header").css("zIndex",2);$("#co-billing-options, #co-order-review-actions").animate({opacity:0},Config.OrderPage.duration1,"fasEaseIn",function(){$(this).hide();$("#co-order-review-actions").animate({height:"0px",paddingTop:0,paddingBottom:0},Config.OrderPage.duration2,"fasEaseIn",function(){$(this).css("left",-1000);});$("#co-billing").animate({height:coBillingHeight},Config.OrderPage.duration2,"fasEaseIn",function(){$("#co-billing-review, #co-order-commit-actions,#co-order-commit-actions-top").show().animate({opacity:1},Config.OrderPage.duration1,function(){$("#co-billing-review").css("zIndex",1);$("#co-billing-content").show().animate({opacity:1},Config.OrderPage.duration1,function(){_cto.orderStageHeight(false);$("#co-billing-review").css("zIndex",2);$("#co-billing-header").css("zIndex","");$("#co-billing-options, #co-billing-content").css("position","");if(_cto.statics.isIE6){$("#co-content select").show().css("opacity",1);}});});});});}}}}break;}},200);},{unescape:",/"});};};_ctoTaggingClass=function(Config){this.doTracking=function(data,formName){if($.inArray(formName,Config.asyncFormNames)>-1||formName===true){data=(data.cart)?data.cart:data;if(!_ctoTagging.asyncAction.addToBag(data)&&data.trackingVars){var trkVars=data.trackingVars.siteCatalyst;s.pageName=_cto.statics.pageName;if(trkVars.CI_PageType){var CI_PageType=trkVars.CI_PageType;}if(trkVars["s.server"]){s.server=trkVars["s.server"];}if(trkVars["s.channel"]){s.channel=trkVars["s.channel"];}if(trkVars["s.prop1"]){s.prop1=trkVars["s.prop1"];}if(trkVars["s.prop2"]){s.prop2=trkVars["s.prop2"];}if(trkVars["s.prop3"]){s.prop3=trkVars["s.prop3"];}if(trkVars["s.prop4"]){s.prop4=trkVars["s.prop4"];}if(trkVars["s.prop5"]){s.prop5=trkVars["s.prop5"];}if(trkVars["s.prop11"]){s.prop11=trkVars["s.prop11"];}if(trkVars["s.prop12"]){s.prop12=trkVars["s.prop12"];}if(trkVars["s.prop2"]){s.pageType=trkVars["s.prop2"];}if(trkVars["s.eVar1"]){s.eVar1=trkVars["s.eVar1"];}if(trkVars["s.eVar7"]){s.eVar7=trkVars["s.eVar7"];}if(trkVars["s.eVar8"]){s.eVar8=trkVars["s.eVar8"];}if(trkVars["s.eVar9"]){s.eVar9=trkVars["s.eVar9"];}if(trkVars["s.eVar10"]){s.eVar10=trkVars["s.eVar10"];}if(trkVars["s.eVar25"]){s.eVar25=trkVars["s.eVar25"];}if(trkVars["s.eVar26"]){s.eVar26=trkVars["s.eVar26"];}if(trkVars["s.eVar27"]){s.eVar27=trkVars["s.eVar27"];}if(trkVars["s.eVar28"]){s.eVar28=trkVars["s.eVar28"];}if(trkVars["s.eVar29"]){s.eVar29=trkVars["s.eVar29"];}if(trkVars["s.eVar30"]){s.eVar30=trkVars["s.eVar30"];}if(trkVars["s.eVar31"]){s.eVar31=trkVars["s.eVar31"];}if(trkVars["s.eVar2"]){s.eVar2=trkVars["s.eVar2"];}if(trkVars["s.eVar3"]){s.eVar3=trkVars["s.eVar3"];}if(trkVars["s.eVar5"]){s.eVar5=trkVars["s.eVar5"];}if(trkVars["s.eVar6"]){s.eVar6=trkVars["s.eVar6"];}if(trkVars["s.eVar11"]){s.eVar11=trkVars["s.eVar11"];}if(trkVars["s.eVar12"]){s.eVar12=trkVars["s.eVar12"];}if(trkVars["s.eVar13"]){s.eVar13=trkVars["s.eVar13"];}if(trkVars["s.eVar14"]){s.eVar14=trkVars["s.eVar14"];}if(trkVars["s.eVar15"]){s.eVar15=trkVars["s.eVar15"];}if(trkVars["s.eVar16"]){s.eVar16=trkVars["s.eVar16"];}if(trkVars["s.state"]){s.state=trkVars["s.state"];}if(trkVars["s.purchaseID"]){s.purchaseID=trkVars["s.purchaseID"];}if(trkVars["s.eVar17"]){s.eVar17=trkVars["s.eVar17"];}if(trkVars["s.eVar18"]){s.eVar18=trkVars["s.eVar18"];}if(!s.eVar17){var customerType=""+readCookie("TRACK_LOYALTY_STATUS");if(customerType!=""&&customerType!="null"){s.eVar17=customerType;}}if(!s.eVar18){var customerId=""+readCookie("TRACK_LOYALTY_ID");if(customerId!=""&&customerId!="null"){s.eVar18=customerId;}}_D("_ctoTagging.doTracking|Omniture Tags",{pageName:s.pageName,events:s.events,products:s.products});var s_code=s.t();if(s_code){document.write(s_code);}if(data.trackingVars.cheetahMail.reqCheetahMail){_D("_ctoTagging.doTracking|CheetahMail Tags",data.trackingVars.cheetahMail);Req("/web_assets/js/cheetah_mail/sc_tracking.js",function(){eval(_cto.heDecode(data.trackingVars.cheetahMail.reqCheetahMail));},function(){sc_send_data();});}if(data.trackingVars.searchIgniteAcerno=="true"){_D("_ctoTagging.doTracking|Search Ignite Tags",ReqAcerno);if(_cto.statics.isCartPage){if(document.location.protocol.indexOf("https")>-1){Req(true,"https://track.searchignite.com/si/CM/Tracking/ClickTracking.aspx?siclientid=3599&jscript=1","https://chic.netmng.com/?aid=152",function(){$("body").append('<iframe frameborder="0" scrolling="NO" width="0" height="0" src="'+ReqAcerno+'"></iframe>');});}else{Req(true,"http://track.searchignite.com/si/CM/Tracking/ClickTracking.aspx?siclientid=3599&jscript=1","http://chic.netmng.com/?aid=152",function(){$("body").append('<iframe frameborder="0" scrolling="NO" width="0" height="0" src="'+ReqAcerno+'"></iframe>');});}}}return -1;}else{return 0;}}};this.asyncAction={addToBag:function(data){if(data.recentlyAdded){var imageTag="",prodList=[],merchCat=(typeof merchandisingCategory!="undefined")?merchandisingCategory:"",addCatId=(typeof catId!="undefined")?catId:"",ra=data.recentlyAdded;for(i=0;i<ra.products.length;i++){if(i<1){s.products="";}if(/GIFTCERT/i.test(ra.products[i])){ra.color[i]=$.trim($('select#skuIdSelect option[value="'+ra.skus[i]+'"]').text());ra.price[i]=$.map(ra.price[i].split(".0"),function(val,index){if(val){return val+".0";}}).reverse()[0];}s.products+=";"+ra.products[i]+";"+ra.qty[i]+";"+ra.price[i]+";;evar4="+merchCat+"|evar19="+ra.skus[i]+"|evar20="+ra.size[i]+"|evar21="+ra.color[i]+",";imageTag="1012~"+ra.skus[i]+"~131~"+data.items[i].name+"~1113~"+addCatId+"~1112~"+merchCat;_D("_ctoTagging.addToBagTagging|Omniture Tags",{firstInCart:data.firstInCart,recentlyAdded:data.recentlyAdded,skuIdAdded:ra.skus[i],imageTag:imageTag});prodList.push(data.items[i].style+",");if(typeof SC_Sku!="undefined"){SC_Sku.addToCart(""+ra.skus[i],imageTag,ra.qty[i],ra.price[i]);}}if(prodList.length>0){if(data.firstInCart=="true"){s.events="scAdd,scOpen";}else{s.events="scAdd";}if(s.products.length>0&&s.products.charAt(s.products.length-1)==","){s.products=s.products.substring(0,s.products.length-1);}void (s.t());sc_send_data();Req(true,"/web_assets/js/certona/resxclsx.js","/web_assets/js/certona/Recommendation.js",function(){_D("_ctoTagging.addToBagTagging|Certona Tags",{host:host,prodList:prodList});certonaCHObject.initAndRunWithRecommendation(prodList,customerId,null,null,"shopping+cart",host,prodList,null,null,certonaPageId);});return -1;}else{return 0;}}},removeFromBag:function(tag){s.pageName=_cto.statics.pageName;s.events="scRemove";s.products=tag.categoryId+";"+tag.style;return;},changeQuantity:function(){return;},couponFormSubmit:function(){return;}};};_ctoMiniCartClass=function(Config){this.Lang={global:{inventoryError:"The availability of one or more items has changed"},itemLevel:{inventoryError:'Availability has changed <a href="/store/checkout/cart.jsp"><u>View details</u></a>'}};this.triggers=function(){var collapsedState=false;var forceCloseFlag=false;var flyOutEngaged=false;var lastMouseoverEl="";$("#pc-main").mouseover(function(e,noAnimDuration,invokedFromUpdate,mouseleaveTimeout){if($("#pc-wrapper:animated").length<1){duration=(noAnimDuration)?0:Config.flyIn.duration;if(invokedFromUpdate){_cto.clearObjDataTimeouts($("#pc-container"),["tidML"]);$("#pc-overflow").show();$("#pc-wrapper").animate({marginTop:"0"},duration,"fasEaseIn",function(){$("#pc-container").trigger("mouseleave",[false,mouseleaveTimeout]);collapsedState=true;});}else{if(lastMouseoverEl=="#pc-container"){_cto.clearObjDataTimeouts($("#pc-container"),["tidML"]);}if(!$(this).data("tidMO")||$(this).data("tidMO")==""){var tidMO=setTimeout(function(){$("#pc-overflow").show();$("#pc-wrapper").stop(true).animate({marginTop:"0"},duration,"fasEaseIn",function(){if(collapsedState==false){_D("_ctoMiniCart.triggers|Omniture Tagging|persistentCart");set_page_send_tag(s.brandName,"persistentCart");collapsedState=true;}_ctoMiniCart.snapOverflowContainer();});},Config.delayBeforeFlyIn.duration);$(this).data("tidMO",tidMO);}}}lastMouseoverEl="#pc-main";}).mouseleave(function(){_cto.clearObjDataTimeouts($("#pc-main"),["tidMO"]);_cto.clearObjDataTimeouts($("#pc-container"),["tidMO2"]);}).find("a:last").attr("href","#").mouseover(function(){$("#pc-container").trigger("mouseover");}).mouseleave(function(){_cto.clearObjDataTimeouts($("#pc-main"),["tidMO"]);_cto.clearObjDataTimeouts($("#pc-container"),["tidMO2"]);});$("#pc-container").mouseover(function(){if($("#pc-wrapper:animated").length<1){if(lastMouseoverEl=="#pc-main"){_cto.clearObjDataTimeouts($("#pc-container"),["tidML"]);}if(!$(this).data("tidMO2")||$(this).data("tidMO2")==""){var tidMO2=setTimeout(function(){$("#pc-wrapper").stop(true).animate({marginTop:"0"},Config.flyIn.duration,"fasEaseIn",function(){if(collapsedState==false){_D("_ctoMiniCart.triggers|Omniture Tagging|persistentCart");set_page_send_tag(s.brandName,"persistentCart");collapsedState=true;}});},Config.delayBeforeFlyIn.duration);$(this).data("tidMO2",tidMO2);}}else{if(!forceCloseFlag&&(flyOutEngaged||collapsedState)){if(lastMouseoverEl=="#pc-main"){_cto.clearObjDataTimeouts($("#pc-container"),["tidML","tidMO2"]);}else{_cto.clearObjDataTimeouts($("#pc-main"),["tidMO"]);}_ctoMiniCart.snapOverflowContainer();$("#pc-wrapper").stop(true).animate({marginTop:"0"},Config.flyIn.duration,"fasEaseIn",function(){collapsedState=true;});}}lastMouseoverEl="#pc-container";}).mouseleave(function(e,noTimeoutDuration,mouseleaveTimeout){_cto.clearObjDataTimeouts($("#pc-main"),["tidMO"]);_cto.clearObjDataTimeouts($("#pc-container"),["tidMO2"]);if(!$(this).data("tidML")||$(this).data("tidML")==""){var tidML=setTimeout(function(){flyOutEngaged=true;$("#pc-wrapper").stop(true).animate({marginTop:$("#pc-wrapper").outerHeight()*-1},Config.flyOut.duration,"fasEaseOut",function(){$("#pc-items").scrollTop(0);$("#pc-overflow").removeAttr("style").hide();collapsedState=false;forceCloseFlag=false;flyOutEngaged=false;});},(noTimeoutDuration)?0:mouseleaveTimeout||Config.timeOut.duration1);$(this).data("tidML",tidML);}});$("#pc-close, #pc-continue a").bind("mousedown",function(){forceCloseFlag=true;_cto.clearObjDataTimeouts($("#pc-main"),["tidMO"]);_cto.clearObjDataTimeouts($("#pc-container"),["tidMO2"]);if($("#pc-wrapper:animated").length>0){$("#pc-wrapper").stop(true,true);}$("#pc-container").trigger("mouseleave",true);});};this.snapOverflowContainer=function(){$("#pc-overflow").height($("#pc-wrapper").outerHeight());};this.populate=function(){$("#pc-items").addClass("loading");_cto.ajax({url:"/store/common/json/cart.jsp?task=onLoadCart&isCartPage="+_cto.statics.isCartPage+"&isOrderPage="+_cto.statics.isOrderPage+"&isShopPage="+_cto.statics.isShopPage,dataType:"json",success:function(data){if(_cto.isCartOrCheckoutObject(data)){_ctoMiniCart.build(data,false);if($("#pc-items").hasClass("loading")&&_ctoMiniCart.isCollapsed()){_ctoMiniCart.snapOverflowContainer();}$("#pc-items").removeClass("loading");if(_cto.statics.isIpad){$("#pc-items").css("maxHeight","10000px");}}}});};this.build=function(data,animateItems,formName){var curItems=[];$('#pc-items .pc-product[id^="pc-item-"]').each(function(){curItems.push($(this).attr("id").split("pc-item-")[1]);});var retItems=[];var newItems=[];var itemHtml="";var cartContainsInventoryError=false;$.each(data.items,function(index,item){var uid=item.itemId+"_"+item.qty;var title=($(item.name).length>32)?$(item.name).substring(0,32)+"&#8230;":item.name;title=title.replace(/&amp;/g,"&");item.unitItemPrice=(item.unitItemPrice=="$0.00")?"FREE":item.unitItemPrice;item.rawItemPrice=(item.rawItemPrice=="$0.00")?"FREE":item.rawItemPrice;item.finalItemPrice=(item.finalItemPrice=="$0.00")?"FREE":item.finalItemPrice;if($("#pc-item-"+uid+" .pc-price").length){if(item.rawItemPrice==item.finalItemPrice){$("#pc-item-"+uid+" .pc-price").html(item.rawItemPrice);}else{rawItemPrice=(item.rawItemPrice==item.finalItemPrice)?"":item.rawItemPrice;$("#pc-item-"+uid+" .pc-price").html('<s><span class="sb-price-before-discount">'+rawItemPrice+'</span></s><div class="sb-price-after-discount">'+item.finalItemPrice+"</div>");}}retItems.push(uid);if($.inArray(uid,curItems)<0){var row='<div id="pc-item-'+uid+'" class="pc-product"'+((animateItems)?' style="display: none;"':"")+">";row+='<div class="pc-product-divider"></div>';row+='<div class="pc-product-image">';row+='<img src="'+item.image.replace("_shelf2","_thumb2")+'" height="65" width="52" />';if(item.gwp=="true"){row+='<img class="pc-gwp" src="/store/images/checkout_redesign/chs_perCart_gift.gif"/>';}row+="</div>";row+='<div class="pc-product-info-container">';row+='<div class="pc-product-info-row1">';row+='<div class="pc-title" >'+title+"</div>";if(item.rawItemPrice==item.finalItemPrice){row+='<div class="pc-price">'+item.finalItemPrice+"</div>";}else{rawItemPrice=(item.rawItemPrice==item.finalItemPrice)?"":item.rawItemPrice;row+='<div class="pc-price"><s><span class="sb-price-before-discount">'+rawItemPrice+'</span></s><div class="sb-price-after-discount">'+item.finalItemPrice+"</div></div>";}row+="</div>";row+='<div class="pc-product-info-row2">';row+='<table class="pc-details" cellpadding="0" cellspacing="0">';if(item.itemNotAvailable||item.shortInvAlert){if(!cartContainsInventoryError){cartContainsInventoryError=true;}row+='<tr><td class="pc-value" colspan="3">'+_ctoMiniCart.Lang.itemLevel.inventoryError+"</td></tr>";}else{if(item.color){row+='<tr class="pc-color"><td class="pc-label">Color:</td><td class="pc-value" colspan="2">'+item.color+"</td></tr>";}if(item.designName){row+='<tr class="pc-design"><td class="pc-label">Design:</td><td class="pc-value" colspan="2">'+item.designName+"</td></tr>";}if(item.size){row+='<tr class="pc-size"><td class="pc-label">Size:</td><td class="pc-value" colspan="2">'+item.size+"</td></tr>";}}row+='<tr class="pc-qty"><td class="pc-label" style="'+((item.itemNotAvailable||item.shortInvAlert)?"visibility:hidden":"")+'">Qty:</td><td class="pc-value" style="'+((item.itemNotAvailable||item.shortInvAlert)?"visibility:hidden":"")+'">'+item.qty+'</td><td class="pc-controls-wrapper">';row+='<div class="pc-controls">';if(_cto.statics.isOrderPage){if(item.gwp=="true"||item.isGiftCard=="true"){row+='<a class="pcItemRemove" href="javascript:void(0);" onclick="_ctoMiniCart.remItem(\''+item.itemId+'\', true);">Remove</a><span class="removeAlert" style="display: none;">Are you sure? <a onclick="_ctoTagging.asyncAction.removeFromBag({\'categoryId\': \''+item.categoryId+"', 'style': '"+item.style+"'});_ctoMiniCart.remItem('"+item.itemId+'\', false);" href="javascript: void(0);">Yes</a> or <a onclick="_ctoMiniCart.remItemReset(\''+item.itemId+'\');" href="javascript: void(0);">No</a></span>';}else{row+='<a class="pcItemEdit" href="javascript: void(0);" onclick="quickView.quickLaunch(\''+_cto.scrapeProductIdFromUrl(item.link)+"','"+item.colorCode+"','CHECKOUT_EDIT','"+item.itemId+"', '"+((item.size)?item.size:"")+"', '"+item.designSku+'\');return false;">Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="pcItemRemove" href="javascript:void(0);" onclick="_ctoMiniCart.remItem(\''+item.itemId+'\', true);">Remove</a><span class="removeAlert" style="display: none;">Are you sure? <a onclick="_ctoTagging.asyncAction.removeFromBag({\'categoryId\': \''+item.categoryId+"', 'style': '"+item.style+"'});_ctoMiniCart.remItem('"+item.itemId+'\', false);" href="javascript: void(0);">Yes</a> or <a onclick="_ctoMiniCart.remItemReset(\''+item.itemId+'\');" href="javascript: void(0);">No</a></span>';}}else{if(item.gwp=="true"||item.isGiftCard=="true"){row+="";}else{row+='<a class="pcItemEdit" href="/store/checkout/cart.jsp" rel="'+item.itemId+'">edit</a>';}}row+="</div>";row+="</td></tr>";row+="</table>";row+='<div class="clear"></div>';row+="</div>";row+="</div>";row+="</div>";itemHtml+=row;newItems.push(uid);}});var remItems=[];$.each(curItems,function(index,item){if($.inArray(item,retItems)<0){remItems.push(item);}});if(data.closenessQualifierMsgs){$("#pc-close-qualif").html(data.closenessQualifierMsgs);}else{$("#pc-close-qualif").html("");}itemHtml+=$("#pc-items").html();$("#pc-items").html(itemHtml);$("#pc-items .pc-errors").remove();$('<div class="pc-errors"></div>').prependTo("#pc-items");if(cartContainsInventoryError){data.formErrors.cart.push({message:_ctoMiniCart.Lang.global.inventoryError});}$.each(data.formErrors.cart,function(){$('<div class="pc-error">'+_cto.heDecode(this.message)+"</div>").prependTo("#pc-items .pc-errors");});$(".pc-product-divider").each(function(index,obj){if(index==0){$(this).addClass("pc-product-divider-first");}else{$(this).removeClass("pc-product-divider-first");}});$(".pc-product").each(function(index,obj){if(index>0){$(this).addClass("pc-product-fix");}else{$(this).removeClass("pc-product-fix");}});$.merge(data.promoDiscounts,data.conditionalMessages);var curClaimed=[];$(".sb-discount").each(function(){couponId=$(this).attr("id").split("promo")[1];curClaimed.push(couponId);});var retClaimed=[];$(data.promoDiscounts).each(function(){retClaimed.push(this.couponId);});var remClaimed=[];$(curClaimed).each(function(index,couponId){if($.inArray(couponId,retClaimed)==-1){remClaimed.push(couponId);}});var newClaimed=[];$(data.promoDiscounts).each(function(index,obj){if($.inArray(this.couponId,curClaimed)==-1){if(this.message){this.discountMessage=this.message;this.discountAmount="";this.isClaimed=false;}else{this.isClaimed=true;}if(this.isClaimed==false&&$("#pc-promos-pending").length<1){$('<div id="pc-promos-pending"></div>').insertBefore("#sb-promo-errors");}$('<div id="promo'+this.couponId+'" class="pc-totals-row sb-discount sb-promo-is-'+this.type+((this.isClaimed==false)?" sb-error-message":"")+'"'+((animateItems)?' style="display: none;"':"")+'><div class="pc-label"><span class="sb-promo-msg">'+_cto.heDecode(this.discountMessage)+'</span></div><div class="pc-price"><span class="sb-promo-rem">'+promoRemoveLinkTemplate.replace("_DAV=","_DAV="+this.couponId.replace("_unclaimed","").split("-")[0])+'</span><span class="sb-promo-dis-price">'+this.discountAmount+'</span></div><div class="clear"></div></div>').appendTo((this.isClaimed)?"#pc-promos":"#pc-promos-pending");if($("#promo"+this.couponId+".sb-error-message").length){$("#promo"+this.couponId+".sb-error-message").css("paddingLeft","0px");}newClaimed.push(this.couponId);}});if(data.bagCount>0){$("#pc-items-empty").hide();if(data.itemsSubtotal){$("#pc-subtotal .pc-value").html(data.itemsSubtotal);}if(data.shippingCost){var shipCost=(data.shippingCost=="$0.00")?"FREE":data.shippingCost;if(!_cto.statics.isOrderPage&&!_cto.statics.isCartPage){if(shipCost=="FREE"){$("#pc-shipping .pc-value").html(shipCost);}else{$("#pc-shipping").hide();data.itemsTotal=data.itemsTotalNoShipping;}}else{$("#pc-shipping .pc-value").html(shipCost);}}else{$("#pc-shipping").hide();data.itemsTotal=data.itemsTotalNoShipping;}data.salesTax=(data.salesTax=="$0.00")?false:data.salesTax;if(data.salesTax){if($("#pc-tax .pc-value").text()!=data.salesTax){$("#pc-tax").remove();$('<div id="pc-tax" class="pc-totals-row" style="display: none"><div class="pc-label">Sales Tax</div><div class="pc-value">'+data.salesTax+'</div><div class="clear"></div></div>').insertAfter("#pc-shipping").fasToggle();}else{if($("#pc-tax").css("display")=="none"){$("#pc-tax").fasToggle();}}}else{if($("#pc-tax").css("display")!="none"){$("#pc-tax").fasToggle();}}data.GiftOptions=(data.GiftOptions=="$0.00")?false:data.GiftOptions;if(data.GiftOptions){if($("#pc-gift .pc-value").text()!=data.GiftOptions){$("#pc-gift").remove();$('<div id="pc-gift" class="pc-totals-row" style="display: none"><div class="pc-label">Gift Options</div><div class="pc-value">'+data.GiftOptions+'</div><div class="clear"></div></div>').insertAfter("#pc-shipping").fasToggle();}else{if($("#pc-gift").css("display")=="none"){$("#pc-gift").fasToggle();}}}else{if($("#pc-gift").css("display")!="none"){$("#pc-gift").fasToggle();}}if(data.itemsTotal){$("#pc-grandtotal .pc-value").html(data.itemsTotal);}$("#pc-totals").show();if(!_cto.statics.isOrderPage||!_cto.statics.isCartPage){$("#pc-btn-checkout-disabled").hide();$("#pc-btn-checkout").show();}}else{if(data.bagCount==0&&_cto.statics.isOrderPage){_cto.goHomeUnsecure();}else{$("#pc-items-empty").show();if(!_cto.statics.isOrderPage||!_cto.statics.isCartPage){$("#pc-btn-checkout").hide();$("#pc-btn-checkout-disabled").show();}}}_cto.updateBagCount(data.bagCount,cartContainsInventoryError);return{items:{applied:newItems,removed:remItems},coupons:{applied:newClaimed,removed:remClaimed}};};this.remItem=function(itemId,confirm){if(confirm){$('div[id^="pc-item-'+itemId+'"] .pcItemRemove').hide().next(".removeAlert").show();}else{$("#removeFromLink").val(itemId);document.checkoutEditOrder.submit();}};this.remItemReset=function(itemId){$('div[id^="pc-item-'+itemId+'"] .pcItemRemove').show().next().hide();};this.isCollapsed=function(){if($("#pc-wrapper:visible").length){return -1;}else{return 0;}};this.updateMboxMini=function(data){var mboxParams=[];if(data.isCommonMboxParams){$(data.mboxParameters).each(function(){mboxParams.push(this.mboxParameterName+"="+this.mboxParameterValue);});}if(data.mboxes){$(data.mboxes).each(function(){if(this.mboxName.indexOf("persistentCart")!=-1){if(!data.isCommonMboxParams){mboxParams=[];$(this.mboxParameters).each(function(){mboxParams.push(this.mboxParameterName+"="+this.mboxParameterValue);});}try{mboxDefine("pc-cond-msg",this.mboxName);mboxFactoryDefault.update(this.mboxName,mboxParams);}catch(e){}}});}};this.update=function(data,formName){if(data.cart){data=data.cart;}obj=_ctoMiniCart.build(data,true,formName);if(!_ctoMiniCart.isCollapsed()&&!_cto.statics.isOrderPage){$("#pc-main").trigger("mouseover",[true,true,Config.timeOut.duration2]);}else{$("#pc-overflow").removeAttr("style").show();}$("#sb-promo-errors .sb-error-message").remove();$.each(data.formErrors.coupon,function(){$('<div class="sb-error-message" style="display: none;">'+_cto.heDecode(this.message)+"</div>").appendTo("#sb-promo-errors").fasToggle();});if(obj.coupons.removed.length){var cpnAnimCount=0;$(obj.coupons.removed).each(function(index,couponId){$("#promo"+couponId).fasToggle(function(){cpnAnimCount++;$("#promo"+couponId).remove();if(cpnAnimCount==obj.coupons.removed.length){$(obj.coupons.applied).each(function(index,couponId){$("#promo"+couponId).fasToggle();});}});});}else{$(obj.coupons.applied).each(function(index,couponId){$("#promo"+couponId).fasToggle();});}if(obj.items.removed.length){var itmAnimCount=0;$(obj.items.removed).each(function(index,item){$("#pc-item-"+item).fasToggle(function(){$("#pc-item-"+item).remove();itmAnimCount++;if(itmAnimCount==obj.items.removed.length){$.each(obj.items.applied,function(index,item){$("#pc-item-"+item).addClass("pc-added").css("opacity",0.2).fasToggle({duration:Config.items.duration,callback:function(){_ctoMiniCart.snapOverflowContainer();$("#pc-item-"+item).animate({backgroundColor:"#ffffff"},Config.items.duration,function(){$("#pc-item-"+item).removeClass("pc-added").attr("style","");});}});});}});});}else{$.each(obj.items.applied,function(index,item){$("#pc-item-"+item).addClass("pc-added").css("opacity",0.2).fasToggle({duration:Config.items.duration,callback:function(){_ctoMiniCart.snapOverflowContainer();$("#pc-item-"+item).animate({backgroundColor:"#ffffff"},Config.items.duration,function(){$("#pc-item-"+item).removeClass("pc-added").attr("style","");});}});});}if(!_cto.statics.isOrderPage){}};};})(jQuery);if(typeof _cto=="undefined"){_cto=new _ctoClass({repriceRequests:{asyncFormNames:{cartPage:["qvFrmAddToBag","checkoutEditOrder","couponForm"],checkoutPage:["qvFrmAddToBag","checkoutEditOrder","couponForm"]},ajaxTaskParams:{cartPage:["remPromo"],checkoutPage:["remPromo","checkoutOnLoadCart"]}},tealeaf:{enabled:false},sessionTimeout:{seconds:1680},ajaxTimeout:{duration:60000},scrollTop:{duration:1000},OrderPage:{duration1:300,duration2:600}});}if(typeof _ctoTagging=="undefined"){_ctoTagging=new _ctoTaggingClass({asyncFormNames:["checkout2","frmAddToBag","qvFrmAddToBag","checkoutEditOrder"]});}if(typeof _ctoMiniCart=="undefined"){_ctoMiniCart=new _ctoMiniCartClass({timeOut:{duration1:600,duration2:3000},delayBeforeFlyIn:{duration:450},errors:{duration:600},items:{duration:600},flyIn:{duration:1000},flyOut:{duration:1000}});}
