var ajaxService=function(){this.url="",this.type="GET",this.async="true",this.cache="true",this.dataType="text"};function fnCheckIntegerKey(e,t,n){var l=e.keyCode?e.keyCode:e.which?e.which:e.charCode;if((l<=47||l>=58)&&46!=l&&8!=l&&9!=l&&37!=l&&39!=l)return!1;if(null!=t&&null!=n){var d=document.getElementById(t),a=document.getElementById(n),u=e.srcElement?e.srcElement:e.target;if(9!=l&&u&&!u.readOnly){d.value="",a.value="";var i=document.getElementById("message");null!=i&&(i.value="")}}return!0}function fnCheckSpaceKey(e){return 32!=(e.keyCode?e.keyCode:e.which?e.which:e.charCode)}function checkZipCodeCompliance(){}function fnCheckItemQty(e){return 0!=e.value||(alert("You must specify a quantity for this item. Please use the drag option to remove this wine from the preview section and place it in the alternative wine section."),e.value="",e.trigger("focus"),!1)}function empty(e){return"undefined"===e||(null==e||(""==e||0==e.length))}function trim(e){return e.replace(/^\s+|\s+$/g,"")}function fnTrimEmail(e){var t=document.getElementById(e);null!=t&&(t.value=trim(t.value))}function containsElement(e){e=e||[];for(var t=!1,n=0;!t&&nl)n=!0,t=!0;else if(null!=e)for(var d=0;d").html(e).find(".unlimited-container").html();null!=$(".unlimited-ship-bill-container")&&$(".unlimited-ship-bill-container").html(t)},error:function(){}}))}function emailValidation(){null!=document.getElementById("email")&&null!=document.getElementById("emailId")&&(document.getElementById("emailId").value=document.getElementById("email").value,validateEmail(),document.getElementById("loginId").value=document.getElementById("emailId").value)}function fnONLoadGiftMsg(){null!=document.getElementById("onloadVal")?"true"==document.getElementById("onloadVal").value&&(document.getElementsByName("giftRadio_guest")[0].checked=!0,document.getElementById("giftMessage_guest").style.display="block",null!=document.getElementById("gift_msg_value")&&(document.getElementById("giftMsg_guest").value=document.getElementById("gift_msg_value").value),null!=document.getElementById("giftEmail_guest")&&(document.getElementById("giftEmail_guest").style.display="block",null!=document.getElementById("gift_msgTo_value")&&(document.getElementById("giftMail_guest").value=document.getElementById("gift_msgTo_value").value))):null!=document.getElementById("onloadValMailTo")&&"true"==document.getElementById("onloadValMailTo").value&&(document.getElementsByName("giftRadio_guest")[0].checked=!0,document.getElementById("giftMessage_guest").style.display="block",document.getElementById("giftMsg_guest").value=document.getElementById("gift_msg_value").value,document.getElementById("giftEmail_guest").style.display="block",document.getElementById("giftMail_guest").value=document.getElementById("gift_msgTo_value").value)}function fnDisplayGiftMsg_Reg(){document.getElementById("giftMsg").value="",document.getElementsByName("giftRadio")[0].checked?(document.getElementById("giftMessage").style.display="block",null!=document.getElementById("giftEmail")&&(document.getElementById("giftEmail").style.display="block")):(document.getElementById("giftMessage").style.display="none",null!=document.getElementById("giftEmail")&&(document.getElementById("giftMail").value="",document.getElementById("giftEmail").style.display="none"))}function fnValidateGiftMessage_Reg(){if(null!=document.getElementsByName("giftRadio")[0]&&null!=document.getElementById("giftMsg")){if(document.getElementsByName("giftRadio")[0].checked&&""==trim(document.getElementById("giftMsg").value))return alert("Please enter a message"),!1}else if(null!=document.getElementsByName("giftRadio_guest")[0]&&null!=document.getElementById("giftMsg_guest")&&document.getElementsByName("giftRadio_guest")[0].checked&&""==trim(document.getElementById("giftMsg_guest").value))return alert("Please enter a message"),!1}function fnDisplayGiftMsgOnload(){null!=document.getElementById("giftMsg")&&""!=document.getElementById("giftMsg").value?(document.getElementById("giftMessage").style.display="block",document.getElementsByName("giftRadio")[0].checked=!0,null!=document.getElementById("giftEmail")&&(document.getElementById("giftEmail").style.display="block")):null!=document.getElementById("giftMail")&&""!=document.getElementById("giftMail").value&&(document.getElementById("giftMessage").style.display="block",document.getElementsByName("giftRadio")[0].checked=!0,document.getElementById("giftEmail").style.display="block")}function fnDisplayLabelMsg(){var e,t=$("#displayLabelParam").val(),n=$("input:radio[name=labelRadio]:checked");"yes"==t&&!n.val()||"Y"==n.val()||"false"==n.val()?($("input:radio[name=labelRadio]")[0].checked=!0,e=!0):$("input:radio[name=labelRadio]")[1].checked=!0,e?(document.getElementById("labelMessage").style.display="block",null!=document.getElementById("viewLabelMessage")&&(document.getElementById("viewLabelMessage").value="true")):(document.getElementById("labelMessage").style.display="none",null!=document.getElementById("viewLabelMessage")&&(document.getElementById("viewLabelMessage").value="false"))}function fnDisplayData(e,t){var n,l=document.getElementById("salutation_"+e);void 0!==l&&null!=l&&(document.getElementById("editShippingPrefix").value=document.getElementById("salutation_"+e).value),document.getElementById("editShippingFirstName").value=document.getElementById("firstName_"+e).value,document.getElementById("editShippingLastName").value=document.getElementById("lastName_"+e).value,null!=document.getElementById("houseNumber_"+e)&&(document.getElementById("editShippingHouseNumber").value=document.getElementById("houseNumber_"+e).value),null!=document.getElementById("flatNumber_"+e)&&(document.getElementById("editShippingFlatNumber").value=document.getElementById("flatNumber_"+e).value),null!=document.getElementById("houseName_"+e)&&(document.getElementById("editShippingHouseName").value=document.getElementById("houseName_"+e).value),!0===t?($("#edit-shipping-address #input-company").val($("#companyName_"+e).val()),$("#edit-shipping-address #input-addr1").val($("#address1_"+e).val()),$("#edit-shipping-address #input-addr2").val($("#address2_"+e).val()),$("#edit-shipping-address #input-zip").val($("#postalCode_"+e).val()),$("#edit-shipping-address #input-city").val($("#city_"+e).val()),null!=document.getElementById("state_"+e)&&null!=document.getElementById("state_"+e).value&&$("#edit-shipping-address #input-state").val($("#state_"+e).val()),$("#edit-shipping-address #editShippingDayPhone").val($("#shippingPhoneDay_"+e).val()),"Residential"==(n=$("#addressType_"+e).val())?(document.getElementById("input-residential").value=n,document.getElementsByName("addrsType")[0].checked=!0):"Commercial"==n?(document.getElementById("input-commercial").value=n,document.getElementsByName("addrsType")[1].checked=!0):(document.getElementById("input-residential").value="Residential",document.getElementsByName("addrsType")[0].checked=!0)):(document.getElementById("editShippingCompanyName").value=document.getElementById("companyName_"+e).value,document.getElementById("editShippingAddress1").value=document.getElementById("address1_"+e).value,document.getElementById("editShippingAddress2").value=document.getElementById("address2_"+e).value,document.getElementById("editShippingZipCode").value=document.getElementById("postalCode_"+e).value,document.getElementById("editShippingCity").value=document.getElementById("city_"+e).value,null!=document.getElementById("state_"+e)&&null!=document.getElementById("state_"+e).value&&(document.getElementById("editShippingState").value=document.getElementById("state_"+e).value),document.getElementById("editShippingDayPhone").value=document.getElementById("shippingPhoneDay_"+e).value,"Residential"==(n=document.getElementById("addressType_"+e).value)?(document.getElementById("addressType_resi").value=n,document.getElementsByName("addrsType")[0].checked=!0):"Commercial"==n?(document.getElementById("addressType_comm").value=n,document.getElementsByName("addrsType")[1].checked=!0):(document.getElementById("addressType_resi").value="Residential",document.getElementsByName("addrsType")[0].checked=!0)),document.getElementById("info_id").value=document.getElementById("id_"+e).value}function fnDisplayDataForEdit(e){if(document.getElementById("editShippingPrefix").value=getFirstCharUpper(document.getElementById("prefix_"+e).value),document.getElementById("editShippingFirstName").value=document.getElementById("firstName_"+e).value,document.getElementById("editShippingLastName").value=document.getElementById("lastName_"+e).value,document.getElementById("editShippingCompanyName").value=document.getElementById("companyName_"+e).value,document.getElementById("editShippingHouseNumber").value=document.getElementById("houseNumber_"+e).value,document.getElementById("editShippingFlatNumber").value=document.getElementById("flatNumber_"+e).value,document.getElementById("editShippingAddress1").value=document.getElementById("address1_"+e).value,document.getElementById("editShippingAddress2").value=document.getElementById("address2_"+e).value,document.getElementById("editShippingHouseName").value=document.getElementById("houseName_"+e).value,document.getElementById("editShippingZipCode").value=document.getElementById("postalCode_"+e).value,document.getElementById("editShippingCity").value=document.getElementById("city_"+e).value,document.getElementById("editShippingCounty").value=document.getElementById("county_"+e).value,document.getElementById("editShippingDayPhone").value=document.getElementById("shippingPhoneDay_"+e).value,document.getElementById("editShippingDeliveryInstructions").value="",null!=document.getElementById("deliveryInstructions_1_"+e)&&(document.getElementById("editShippingDeliveryInstructions").value=document.getElementById("deliveryInstructions_1_"+e).value),""!=document.getElementById("editShippingDeliveryInstructions").value&&"-1"==document.getElementById("editShippingDeliveryInstructions").value){var t=document.getElementById("deliveryInstructions_1_"+e);void 0!==t&&null!=t&&(document.getElementById("editShippingDeliveryInstructionsTxt1").value=document.getElementById("deliveryInstructions_1_"+e).value,document.getElementById("editShippingDeliveryInstructionsTxt2").value=document.getElementById("deliveryInstructions_2_"+e).value,document.getElementById("editShippingDeliveryInstructionsTxt3").value=document.getElementById("deliveryInstructions_3_"+e).value,document.getElementById("editShippingDeliveryInstructionsTxt4").value=document.getElementById("deliveryInstructions_4_"+e).value),document.getElementById("optionotheredit").style.display="block"}else document.getElementById("optionotheredit").style.display="none";var n=document.getElementById("addressType_"+e).value;"Residential"==n?$("#addressType_resi").length>0&&(document.getElementById("addressType_resi").value=n,document.getElementsByName("addrsType")[0].checked=!0):"Commercial"==n?$("#addressType_comm").length>0&&(document.getElementById("addressType_comm").value=n,document.getElementsByName("addrsType")[1].checked=!0):$("#addressType_resi").length>0&&(document.getElementById("addressType_resi").value="Residential",document.getElementsByName("addrsType")[0].checked=!0),document.getElementById("info_id").value=document.getElementById("id_"+e).value}function getFirstCharUpper(e){if(null!=e&&""!=e){for(var t="",n=0;n").html(e).find(".unlimited-container").html();null!=$("#checkout-unlimited-shipping")&&$("#checkout-unlimited-shipping").html(t)},error:function(){}})}function getCityStatehttp(e,t,n,l,d){var a=new ajaxService,u={url:"/jsp/checkout/common/citystatefinderhttp.jsp",data:"zipCode="+encodeURI(e.value),successCallback:function(a,u){successgetCityStatehttp(a,u,e,t,n,l,d)}};a.processAJAXRequest(u)}function successgetCityStatehttp(e,t,n,l,d,a,u){if(":"==trim(e))alert("Please enter a valid zipcode"),n.value="",l.value="",d.value="",n.trigger("focus");else{var i=trim(e).split(":");l.value=i[0],d.value=i[1],null!=a&&"true"==a&&null!=u&&fnCheckCompliance(u)}}function validateEmailhttp(){var e=new ajaxService,t=document.getElementById("email").value,n={url:"/jsp/checkout/common/validateemailhttp.jsp",data:"email="+encodeURI(t),successCallback:function(e,t){successvalidateEmailhttp(e,t)}};e.processAJAXRequest(n)}function successvalidateEmailhttp(e,t){1==e?null!=document.getElementById("messageForValidEmail")?(document.getElementById("messageForValidEmail").style.display="block",null!=document.getElementById("customerNo")&&null!=document.getElementById("zip")&&(document.getElementById("customerNo").style.display="none",document.getElementById("zip").style.display="none")):(null!=document.getElementById("customerNo")&&(document.getElementById("customerNo").style.display="none"),document.getElementById("zip").style.display="none"):null!=document.getElementById("messageForValidEmail")?(document.getElementById("messageForValidEmail").style.display="none",null!=document.getElementById("customerNo")&&null!=document.getElementById("zip")&&(document.getElementById("customerNo").style.display="block",document.getElementById("zip").style.display="block")):""==document.getElementById("brandAccount").value?null!=document.getElementById("customerNo")&&null!=document.getElementById("zip")&&(document.getElementById("customerNo").style.display="block",document.getElementById("zip").style.display="block"):null!=document.getElementById("zip")&&null!=document.getElementById("zip-verify")&&(document.getElementById("zip").style.display="block",document.getElementById("zip-verify").disabled=!1)}ajaxService.prototype.processAJAXRequest=function(e){var t=this;jQuery.extend(t,e),jQuery.ajax({url:t.url,async:t.async,type:t.type,cache:t.cache,data:t.data,success:function(e,n,l){"function"==typeof t.successCallback&&t.successCallback(e.trim(),l)},error:function(e,n){"function"==typeof t.errorCallback&&t.errorCallback(e,n)}})},$("#labelMsg").on("keyup",function(){var e=parseInt($(this).attr("maxlength")),t=$(this).val();if(t.length>e){var n=t.substr(0,e);$(this).val(n)}});var triggerOverlay=null;function getBillingAddress(e,t,n,l,d,a,u,i){var o=!1;if(window.XMLHttpRequest?o=new XMLHttpRequest:window.ActiveXObject&&(o=new ActiveXObject("Microsoft.XMLHTTP")),o){var m="/jsp/checkout/common/billingaddresslookup.jsp",c=!1;m=(m=(m=(m=(m=(m=m+"?lastName="+n.value)+"&zipCode="+d.value)+"&brandAccountNumber="+l.value)+"&email="+e.value)+"&firstName="+t.value)+"&brand="+u,o.open("GET",m,!0),o.onreadystatechange=function(){try{4==o.readyState?200==o.status?("Virgin"==u&&"AU"==i&&(c=!0),parseMessages(o.responseXML,c)):204!=o.status&&1223!=o.status||("registration"==a?fnNewRegAlert():($("#txtHidBrandAccLookup").val("0"),"Virgin"===u?($("#brandacclookup").show(),$.colorbox({width:"600px",inline:!0,href:"#brandacclookup",onClosed:function(){clearValues()}})):(null===triggerOverlay&&(triggerOverlay=$("#brandacclookup").overlay({expose:{color:"#333",loadSpeed:200,opacity:.9},onClose:function(){clearValues()}})),triggerOverlay.data("overlay").on("load")))):2==o.readyState&&500==o.status&&("registration"==a?(alert("Sorry, service currently unavailable — please try again later"),n.value="",d.value="","block"==document.getElementById("customerNo").style.display&&(l.value="",d.disabled="true",null!=document.getElementById("messageForZip")&&(document.getElementById("messageForZip").style.display="none")),null!=document.getElementById("isBrandAcctValidated")&&(document.getElementById("isBrandAcctValidated").value="false")):null!=document.getElementById("isBrandAcctValidated")&&(document.getElementById("isBrandAcctValidated").value="false"))}catch(e){}},o.send(null)}}function clearValues(){var e=$("#txtHidBrandAccLookup");e.length>0&&("1"===e.val()?onClickYes():onClickNo()),$("#brandacclookup").hide()}function onClickYes(){var e=$("#zip-verify"),t=$("#customerNo"),n=null,l=$("#lastName");$("#brandAccount").length>0?n=$("#brandAccount"):$("#brandAccNum").length>0&&(n=$("#brandAccNum")),e.length>0&&e.attr("disabled",!0).val(""),l.length>0&&l.val(""),t.length>0&&t.is(":visible")&&null!=n&&n.val("")}function onClickNo(){var e=$("#zip-verify");e.length>0&&e.attr("disabled",!0).val("")}function getProductViewDetails(e){var t={url:"/jsp/account/common/wpviewdetails.jsp",data:"currItemId="+e,successCallback:function(e,t){successgetProductViewDetails(e,t)}};(new ajaxService).processAJAXRequest(t)}function successgetProductViewDetails(e,t){new Map;var n=e.replace(/^\s+|\s+$/g,"");"EMPTY"==n?(alert("No product information is available"),request.send(null)):alert(n)}function parseMessages(e,t){var n=e.getElementsByTagName("billingaddress")[0].childNodes[0],l=(n.getElementsByTagName("firstName")[0],n.getElementsByTagName("lastName")[0],n.getElementsByTagName("address1")[0]),d=n.getElementsByTagName("address2")[0],a=n.getElementsByTagName("zipCode")[0],u=n.getElementsByTagName("city")[0],i=n.getElementsByTagName("state")[0],o=n.getElementsByTagName("dayPhoneNumber")[0],m=n.getElementsByTagName("eveningPhoneNumber")[0],c=n.getElementsByTagName("isWinePlanCust")[0],s=n.getElementsByTagName("companyName")[0],r=n.getElementsByTagName("axCustomerNumber")[0],g=n.getElementsByTagName("salutation")[0],y=n.getElementsByTagName("county")[0],p=n.getElementsByTagName("country")[0],v=n.getElementsByTagName("houseNumber")[0],E=n.getElementsByTagName("flatNumber")[0],I=n.getElementsByTagName("houseName")[0];if(null!=document.getElementById("salutation")&&null!=g&&null!=g.childNodes[0]&&(document.getElementById("salutation").value=g.childNodes[0].nodeValue),null!=document.getElementById("county")&&null!=y&&null!=y.childNodes[0]&&(document.getElementById("county").value=y.childNodes[0].nodeValue),null!=document.getElementById("country")&&null!=p&&null!=p.childNodes[0]&&(document.getElementById("country").value=p.childNodes[0].nodeValue),null!=document.getElementById("houseNumber")&&null!=v&&null!=v.childNodes[0]&&(document.getElementById("houseNumber").value=v.childNodes[0].nodeValue),null!=document.getElementById("flatNumber")&&null!=E&&null!=E.childNodes[0]&&(document.getElementById("flatNumber").value=E.childNodes[0].nodeValue),null!=document.getElementById("houseName")&&null!=I&&null!=I.childNodes[0]&&(document.getElementById("houseName").value=I.childNodes[0].nodeValue),null!=document.getElementById("wineplanFlag")&&(document.getElementById("wineplanFlag").value=c.childNodes[0].nodeValue),document.getElementById("billingAdrs1").value=l.childNodes[0].nodeValue,null!=d.childNodes[0]&&(document.getElementById("billingAdrs2").value=d.childNodes[0].nodeValue),document.getElementById("billZipCode").value=a.childNodes[0].nodeValue,document.getElementById("city").value=u.childNodes[0].nodeValue,null!=document.getElementById("statecode")&&null!=i.childNodes[0]&&(document.getElementById("statecode").value=i.childNodes[0].nodeValue),t){var B=u.childNodes[0].nodeValue;getMultiCitySelect(document.getElementById("billZipCode"),document.getElementById("city"),document.getElementById("statecode"),B),document.getElementById("city").disabled=!0}if(null!=o.childNodes[0]){var h=o.childNodes[0].nodeValue,f=document.getElementById("billingDay");""!==h?(f.value=h.replace(/-/g,""),f.readOnly=!0):f.readOnly=!1}if(null!=m.childNodes[0]){var b=m.childNodes[0].nodeValue;document.getElementById("billingEvening").value=b.replace(/-/g,"")}null!=s.childNodes[0]&&(document.getElementById("billingAdrsCompany").value=s.childNodes[0].nodeValue),null!=document.getElementById("axCustomerNumber")&&null!=r&&null!=r.childNodes[0]&&(document.getElementById("axCustomerNumber").value=r.childNodes[0].nodeValue),document.getElementById("billingAdrs1").readOnly=!0,document.getElementById("billingAdrs2").readOnly=!0,document.getElementById("billZipCode").readOnly=!0,document.getElementById("city").readOnly=!0,document.getElementById("statecode").readOnly=!0,document.getElementById("billingEvening").readOnly=!0,document.getElementById("billingAdrsCompany").readOnly=!0,null!=document.getElementById("isBrandAcctValidated")&&(document.getElementById("isBrandAcctValidated").value="true")}function fnNewRegAlert(){alert("Sorry your surname or postcode do not match the details on that account. Please check and reenter, or go type your address below."),zipcodeObj.value="",lNameObj.value="","block"==document.getElementById("customerNo").style.display&&(brandAccountObj.value="",zipcodeObj.disabled="true",null!=document.getElementById("messageForZip")&&(document.getElementById("messageForZip").style.display="none"))}function checkBilling(e,t){var n;"true"==t&&(n=window.confirm("You've indicated that your shipping and billing addresses are the same. Please click OK if this is correct. Hit Cancel to enter a different address")),n&&(document.getElementById("createBillingAddrflag").value=n)}function fnDisplayCreditCardSelected(e){var t=document.getElementsByName(e);null!=t&&1==t.length&&(t[0].checked=!0)}function updateOptIn(e,t){var n=new ajaxService,l={url:"/jsp/updateOptIn.jsp",data:"email="+encodeURI(e),successCallback:function(e,n){successupdateOptIn(e,n,t)}};n.processAJAXRequest(l)}function successupdateOptIn(e,t,n){"true"==e.replace(/^\s+|\s+$/g,"")?null!=document.getElementById("optin")&&(document.getElementById("optin").value="true"):null!=document.getElementById("optin")&&(document.getElementById("optin").value="false");$("#optin").val()}function checkButton(){var e=document.getElementsByName("skuselector");if(null!=e)for(var t=0;t');var e=document.getElementById("wineType").value,t=document.getElementById("appellation").value,n=document.getElementById("region").value;n=n.replace("'","'");var l=document.getElementById("country").value,d=document.getElementById("grape").value,a=document.getElementById("vintage").value,u=document.getElementById("productId").value,i=document.getElementById("stateId").value,o=document.getElementById("priceList").value,m=document.getElementById("colourCode").value,c=new ajaxService,s={url:"/jsp/product/common/productStraightTabsnew.jsp",data:"wineType="+encodeURI(e)+"&appellation="+encodeURI(t)+"®ion="+encodeURI(n)+"&country="+encodeURI(l)+"&grape="+encodeURI(d)+"&vintage="+encodeURI(a)+"&id="+encodeURI(u)+"&stateId="+encodeURI(i)+"&priceList="+encodeURI(o)+"&colourCode="+encodeURI(m),successCallback:function(e,t){successshowRelated(e,t)}};c.processAJAXRequest(s)}function successshowRelated(e,t){document.getElementById("related")&&(document.getElementById("related").innerHTML=null!=e&&""!=e?trim(e):"")}function showMixedTab(){var e=new ajaxService,t=document.getElementById("wineType").value,n=document.getElementById("appellation").value,l=document.getElementById("region").value;l=l.replace("'","'");var d=document.getElementById("country").value,a=document.getElementById("grape").value,u=document.getElementById("vintage").value,i=document.getElementById("productId").value,o=document.getElementById("stateId").value,m=document.getElementById("priceList").value,c=document.getElementById("colourCode").value,s={url:"/jsp/product/common/productstraightmixedrelated.jsp",data:"wineType="+encodeURI(t)+"&appellation="+encodeURI(n)+"®ion="+encodeURI(l)+"&country="+encodeURI(d)+"&grape="+encodeURI(a)+"&vintage="+encodeURI(u)+"&productId="+encodeURI(i)+"&stateId="+encodeURI(o)+"&priceList="+encodeURI(m)+"&colourCode="+encodeURI(c),successCallback:function(e,t){successshowMixedTab(e,t)}};e.processAJAXRequest(s)}function successshowMixedTab(e,t){null!=e&&""!=e&&$("#t-mixed").show()}function showMixedStraightRelated(){$("#mixedCases").html('
');var e=$("#mixedCases").data("url");empty(e)&&(e="/jsp/product/common/productstraightmixedrelated.jsp");var t=document.getElementById("wineType").value,n=document.getElementById("appellation").value;n=replaceToASCII(n);var l=document.getElementById("region").value;l=replaceToASCII(l);var d=document.getElementById("country").value,a=document.getElementById("grape").value,u=document.getElementById("vintage").value,i=document.getElementById("productId").value,o=document.getElementById("stateId").value,m=document.getElementById("priceList").value,c=document.getElementById("colourCode").value,s=new ajaxService,r={url:e,data:"wineType="+encodeURI(t)+"&country="+encodeURI(d)+"&grape="+encodeURI(a)+"&vintage="+encodeURI(u)+"&productId="+encodeURI(i)+"&stateId="+encodeURI(o)+"&priceList="+encodeURI(m)+"&colourCode="+encodeURI(c)+"&appellation="+encodeURI(n)+"®ion="+encodeURI(l),successCallback:function(e,t){successshowMixedStraightRelated(e,t),$(".carousel-contents").carousel({itemsPerPage:3,itemsPerTransition:3,speed:800}),$("#mixedCases .carousel-contents").carousel({itemsPerPage:3,itemsPerTransition:3,speed:800}),$(".carousel-contents").css("visibility","visible")}};s.processAJAXRequest(r)}function replaceToASCII(e){for(var t=e.length,n=[];t--;){var l=e[t].charCodeAt();n[t]=32!=l&&(l<65||l>127||l>90&&l<97)?"&#"+l+";":e[t]}return n.join("")}function successshowMixedStraightRelated(e,t){null!=e&&""!=e?($("#t-mixed").show(),document.getElementById("mixedCases").innerHTML=trim(e),document.getElementById("mixedCases").style.display="block"):document.getElementById("mixedCases").innerHTML=""}function showMixedRelated(){$("#related").html('
');var e=document.getElementById("wineType").value,t=document.getElementById("appellation").value,n=document.getElementById("region").value;n=n.replace("'","'");var l=document.getElementById("country").value,d=document.getElementById("grape").value,a=document.getElementById("vintage").value,u=document.getElementById("productId").value,i=document.getElementById("stateId").value,o=document.getElementById("priceList").value,m=document.getElementById("colourCode").value,c=new ajaxService,s={url:"/jsp/product/common/productMixedTabsnew.jsp",data:"wineType="+encodeURI(e)+"&appellation="+encodeURI(t)+"®ion="+encodeURI(n)+"&country="+encodeURI(l)+"&grape="+encodeURI(d)+"&vintage="+encodeURI(a)+"&id="+encodeURI(u)+"&stateId="+encodeURI(i)+"&priceList="+encodeURI(o)+"&colourCode="+encodeURI(m),successCallback:function(e,t){successshowMixedRelated(e,t)}};c.processAJAXRequest(s)}function successshowMixedRelated(e,t){document.getElementById("Mixed-Related").innerHTML=null!=e&&""!=e?trim(e):""}function fnSkuValue(){var e="",t=document.getElementsByName("skuselector");if(null!=t)for(var n=0;n9;)d=d%10+Math.floor(d/10);l+=d,a++}for(var u=1;u<9;u++)n+=1*e.charAt(u),u++;return t==10-(l+n)%10}function validateJetBlue(e){var t=!0,n=document.getElementById("txtthirdPartyNo");return e.length<9&&0!=e.length&&(alert("Please enter a valid True Blue Number."),null!=n&&(n.value=""),t=!1),t}function fnSetOptIn(){"0.0"===$("input:radio[name='gift-radio']:checked").val()?$("#optInValue").val("true"):$("#optInValue").val("false")}function fnSetCheckOptIn(){null!=document.getElementById("emailable")?document.getElementById("emailable").checked?$("#optInValue").val("false"):$("#optInValue").val("true"):fnSetOptIn()}function fnSetPreference(){null!=document.getElementById("update-unlimited-preference")&&(document.getElementById("update-unlimited-preference").checked?($("#update-unlimited-preference").val("true"),$("#update-preference").val("true")):($("#update-unlimited-preference").val("false"),$("#update-preference").val("false")))}function addValuetoSelect(e,t,n){var l=document.createElement("OPTION");l.text=trim(t),l.value=trim(n),e.options.add(l)}function copyFieldDetails(e){document.getElementById("billingAdrsChkBox").checked&&(document.getElementById("shippingFirstName1").value=document.getElementById("firstName").value,document.getElementById("shippingLastName1").value=document.getElementById("lastName").value,document.getElementById("shippingCompanyName1").value=document.getElementById("billingAdrsCompany").value,document.getElementById("shippingAddress11").value=document.getElementById("billingAdrs1").value,document.getElementById("shippingAddress12").value=document.getElementById("billingAdrs2").value,document.getElementById("shippingZipCode1").value=document.getElementById("billZipCode").value,fnDisplayComplianceMsg(e,document.getElementById("statecode").value),document.getElementById("shippingCity1").value=document.getElementById("city").value,document.getElementById("shippingState1").value=document.getElementById("statecode").value,document.getElementById("shippingDay1").value=document.getElementById("billingDay").value,document.getElementById("shippingEvening1").value=document.getElementById("billingEvening").value)}function fnSetShippingId(){$("#tagId").val($("#countId").val())}function getParam(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))}$(function(){$("#frequentflyernumber, #myform, #login_form, #registation-form, #registration-form").off("submit"),$("#frequentflyernumber, #myform, #login_form, #registation-form, #registration-form").on("submit",function(){var e=$("#thirdpartyselector"),t=!0;if(e.length>0)if(""!==e.val()){var n=$("#txtthirdPartyNo").val();switch(strObj[e.val()].DISP){case"Virgin America Elevate Number":t=validatenum(n);break;case"Virgin Atlantic Flying Club Number":t=validateatlantic(n);break;case"Velocity Membership Number":t=validateVirginBlue(n);break;case"Jet Blue":t=validateJetBlue(n)}}else"myform"===this.id||"login_form"===this.id||"registation-form"===this.id||"registration-form"===this.id?t=!0:(alert("Please select the value"),t=!1);return t})}),$(function(){null!=$("#isError")&&$("#isError").val()&&emailValidation()}),$(function(){$("#frmcheckout").on("submit",function(){if($("#voucherCodeLP").length>0&&$("#voucherCodeLP").val().length>0)return alert("Please click on Apply Code button to claim your voucher"),!1;var e=$(this).find("input:radio.recrRadiobx:checked");if(e.length>0){var t=e.parent("li").find("input:text.recrQtyCls");""!=t.val().trim()&&$("#quantity").val(t.val())}})}),$(function(){$("#voucherApplyCode").on("click",function(){var e=$("#voucherCodeLP").val();if(0==e.length)return alert("Please enter Voucher Code"),!1;var t="";0!=$("#voucherPinLP").length&&0!=$("#voucherPinLP").val()&&(t=$("#voucherPinLP").val());var n={url:"/jsp/checkout/common/makeVoucherMine.jsp",data:"voucherCode="+e+"&pinPassword="+t,type:"GET",successCallback:function(e,t){!function(e,t){var n=trim(e).split("|"),l=n[0],d=n[1];alert(l),$("#voucherCodeLP").val().length>0&&$("#voucherCodeLP").val("");d&&$("#cashVoucherCheck").on("load","/jsp/offer/recr/common/fetchVoucher.jsp",function(){$("#payThroughCashVoucherFlag").val(Boolean($("#cashVoucherFlag").val())),$("#remainingVoucherAmt").val(parseFloat($("#voucherAmount").val()))})}(e)}};return(new ajaxService).processAJAXRequest(n),!1}),0!=$("#cashVoucherFlag").length&&0!=$("#voucherAmount").length&&0!=$("#payThroughCashVoucherFlag").length&&0!=$("#remainingVoucherAmt").length&&($("#payThroughCashVoucherFlag").val(Boolean($("#cashVoucherFlag").val())),$("#remainingVoucherAmt").val(parseFloat($("#voucherAmount").val())))}),jQuery(document).ready(function(){function e(e){var t=$(this),n=t.closest("tr"),l=t.closest(".js-choice-of-one"),d=t.prop("checked");if(l.find("tr").each(function(){$(this).data("counter")||$(this).data("counter",1)}),d){var a=1;l.find("tr").each(function(){$(this).data("counter")>a&&(a=$(this).data("counter"))}),n.data("counter",a+1);var u=a;l.find("tr").each(function(){$(this).data("counter")==u&&($(this).data("counter",1),$(this).find("input[type=radio]").prop("checked",!1))})}else n.data("counter",1)}function t(e){var t=$(this),n=t.closest("tr"),l=t.closest(".js-choice-of-two"),d=t.prop("checked");if(l.find("tr").each(function(){$(this).data("counter")||$(this).data("counter",1)}),d){var a=1;l.find("tr").each(function(){$(this).data("counter")>a&&(a=$(this).data("counter"))}),n.data("counter",a+1);var u=a-1;l.find("tr").each(function(){$(this).data("counter")==u&&($(this).data("counter",1),$(this).find("input[type=checkbox]").prop("checked",!1))})}else n.data("counter",1)}$(function(){$(".js-choice-of-one input[type=radio]").on("change",e),$(".js-choice-of-two input[type=checkbox]").on("change",t)})}),$(document).ready(function(){$(".modal .close").on("click",function(){$("#state-compliance-modal").hide()}),"true"!=getParam("dw_stateOverride")||$.cookie("dw_stateOverride")||($.cookie("dw_stateOverride","true"),$("#stateSelectorSubmit").trigger("click"))});