function removeClass(ele, cls) { if (hasClass(ele, cls)) { var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); ele.className = ele.className.replace(reg, ' '); } } function ShowHidePlaceOrderButton() { if ($.trim($('#ctl01_uxPlaceHolder_uxCheckOutShipping_uxMessage_uxMessageLabel').html()).length > 0) $(".checkoutbtn").css("display", "none"); else $(".checkoutbtn").css("display", ""); } $(document).ready(function () { $("#gs-checkout-accordion").accordion({ autoHeight: false, collapsible: false, heightStyle: "content", active: false, beforeActivate: function (event, ui) { return false; }, animate: 100 // collapse will take 300ms }); $('#gs-checkout-accordion .ui-accordion-content').show(); $('#gs-checkout-accordion .ui-icon').css("background-image", "none"); //if (window.location.href.indexOf("petwants") > -1) // $("#ctl01_uxPlaceHolder_dvShipping").css("display", "none") $("#uxContinueImageButton").click(function (e) { e.preventDefault(); if ($('input[name="ctl01$uxPlaceHolder$uxCheckOutPayment$pay"]:checked').val() == "uxSqaurePayment") { sqPaymentForm.requestCardNonce(); } else { $("#uxPlaceOrder").trigger("click"); } }); function isEmpty(obj) { if (typeof obj == 'undefined' || obj === null || obj === '') return true; if (typeof obj == 'number' && isNaN(obj)) return true; if (obj instanceof Date && isNaN(Number(obj))) return true; return false; } //ShowHidePlaceOrderButton(); if ($.trim($("span[id*=uxNoShipping]").html()).length > 0) { $("#dvNoShippingPopup").css("display", "block"); $("#dvNoShippingMessage").html($("span[id*=uxNoShipping]").html()); $("#dvNoShippingPopup").dialog(); $("span[id*=uxMessageLiteral]").html(""); } if ($.trim($("span[id*=uxDescriptionLiteral]").html()).length > 0) { $(".isa_validation").css("display", "block"); $(".isa_mobile_validation").css("display", "block"); } if ($.trim($("span[id*=uxMessageLiteral]").html()).length > 0) { $(".isa_validation").css("display", "block"); $(".isa_mobile_validation").css("display", "block"); $(".errormsg").css("display", "none"); } $("input[id*=uxContinueImageButton]").click(function () { if ($.trim($('span[id*=uxValidationSummary]').html()).length > 0) { $(".isa_validation").css("display", "block"); $(".isa_mobile_validation").css("display", "block"); $("input[id*=uxValidationSummary]").html("Please complete all the required fields to continue."); $(".errormsg").css("display", "none"); $("span[id*=uxMessageLiteral]").html(''); } }); $("input[id*=uxRegisterImageButton]").click(function () { if ($.trim($('span[id*=uxValidationSummary]').html()).length > 0) { $(".isa_validation").css("display", "block"); $(".isa_mobile_validation").css("display", "block"); $("span[id*=uxValidationSummary]").html("Please complete all the required fields to continue."); $(".errormsg").css("display", "none"); $("span[id*=uxMessageLiteral]").html(''); } }); $('body').on('change', 'select[id*=uxCountryDrop]', function () { if ($(this).parents('[id*=dvCreditPaymentBilling]').length != 1) { CalculateTax(); GetCustomInternationalShipping(); } }); $('body').on('change', 'select[id*=uxStateDrop]', function () { if ($(this).parents('[id*=dvCreditPaymentBilling]').length != 1) { CalculateTax(); } }); $('body').on('change', 'input[id*=uxStateText]', function () { if ($(this).parents('[id*=dvCreditPaymentBilling]').length != 1) { CalculateTax(); } }); $('body').on('change', 'input[id*=uxZip]', function () { if (!$(this).hasClass('dvCreditPaymentBillingZip')) { CalculateTax(); } }); // Added condition for PetwantsSpringField customer Mail Ref- Goshly website // Date - 23 Oct 2019 if (window.location.hostname.toLowerCase().includes("puneet") || window.location.hostname.toLowerCase().includes("petwantsspringfieldmo")) { $('body').on('change', 'input[id*=uxCity]', function () { CalculateTax(); }); $('body').on('change', 'input[id*=uxShippingCity]', function () { CalculateTax(); }); } //$('body').on('change', '#ctl01_uxPlaceHolder_uxCheckOutCustomerInformation_uxShippingCountryState_uxCountryDrop', function () { // CalculateTax(); // GetCustomInternationalShipping(); //}); //$('body').on('change', '#ctl01_uxPlaceHolder_uxCheckOutCustomerInformation_uxShippingCountryState_uxStateDrop', function () { // CalculateTax(); //}); $('body').on('change', 'input[id*=uxShippingZip]', function () { if (!$(this).hasClass('dvCreditPaymentBillingZip')) { CalculateTax(); } }); $('body').on('change', 'input[name="ctl01$uxPlaceHolder$uxCheckOutShipping$uxCustomShippingRadioList"]', function () { CalculateTax(); }); $('body').on('change', 'input[id*=uxUseBillingAsShipping]', function () { CalculateTax(); }); // $("#ctl01_uxPlaceHolder_uxGiftCouponDetail_uxCouponVertifyButton").live("click", function () { // CalculateTax(); // }); $(".dvNewsletter").html($(".newsLetter").html()); $(".dvNewsletter input:checkbox").click(function () { if ($(this).is(':checked')) { $("input[id*=uxSubscribeCheckBox]").attr("checked", true); } else { $("input[id*=uxSubscribeCheckBox]").attr("checked", false); } }); $("#dvNoShippingPopup").dialog({ bgiframe: true, height: 300, width: 350, modal: true, autoOpen: false, resizable: true, title: "Please correct the following errors" }); $("#dvNoShippingPopup").bind("dialogclose", function () { var link = '<%= Session["SDMMenuLinkCatalogPath"].ToString() %>'; //window.location.href = link + "shoppingcart.aspx"; //alert(link); window.location.href = "shoppingcart.aspx"; }); $('span[id*=uxDescriptionLiteral]').bind("dialogclose", function () { $("span[id*=uxDescriptionLiteral]").html(''); }); $("input[id*=uxUseBillingAsShipping]").on('change', function () { setTimeout(function () { var height = $("#sb-site1").height(); $("#sb-site1").parent(".gs-section").height(height); }, 500); }); }); function ShowUploader() { if ($("ctl01_uxPlaceHolder_ReviewCart1_uxPanel") != null) { $.blockUI({ message: '
Please wait...
', css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .5, color: '#fff', width: '19%' } }); setTimeout($.unblockUI, 2000); } } function HideUploader() { document.getElementById("reviewCartLoader").style.display = "none"; document.getElementById("ctl01_uxPlaceHolder_ReviewCart1_uxPanel").style.display = "inline"; // ShowHidePlaceOrderButton(); } function CalculateTax() { ShowUploader(); $("input[id*=uxCalculateTax]").trigger("click"); GetBillShippingMethod(); } var triggerUxRequestServiceClickInterval; function GetBillShippingMethod() { if ($("input[id*=uxRequestService]").length > 0) { if (($("select[id*=uxStateDrop]").val() != '0' || $("input[id*=uxStateText]").val() != '') && $("input[id*=uxZip]").val() != '') { triggerUxRequestServiceClickInterval = setInterval(triggerUxRequestServiceClick, 50); } } } function triggerUxRequestServiceClick() { if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) { ShowUploader(); $("input[id*=uxRequestService]").trigger("click"); clearInterval(triggerUxRequestServiceClickInterval); } } function GetShippingMethod() { if ($("select[id*=uxStateDrop]").val() != '0' && $("input[id*=uxZip]").val() != '') { $("input[id*=uxRequestService]").click(); ShowUploader(); } } function GetCustomInternationalShipping() { $("input[id*=uxCustomService]").click(); ShowUploader(); // setTimeout(function () { ShowHidePlaceOrderButton(); }, 1000); } function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); }