var dom=document.getElementById?true:false;var ie=document.all?true:false;var saf=(navigator.userAgent.toLowerCase().indexOf("safari")!=-1);var opr=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var itemName;var quantity;var regionNameArray=new Array();var regionCodeArray=new Array();function findPosX(a){var b=0;if(a.offsetParent){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}}else{if(a.x){b+=a.x}}return b}function findPosY(b){var a=0;if(b.offsetParent){while(b.offsetParent){a+=b.offsetTop;b=b.offsetParent}}else{if(b.y){a+=b.y}}return a}function showTip(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}var c;c=a.nextSibling;while(c.innerHTML==null){c=c.nextSibling}if(!ie){c.style.marginLeft=a.parentNode.scrollWidth-240+"px"}else{c.style.marginLeft=a.parentNode.scrollWidth-470+"px"}c.style.display="block"}function showTip(d,c){var b=d;var f=document.getElementById(c);var a=findPosX(b);var e=findPosY(b);f.style.left=a+20+"px";f.style.top=e+30+"px";f.style.display="block"}function hideTip(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}var c;c=a.nextSibling;while(c.innerHTML==null){c=c.nextSibling}c.style.display="none"}function hideTip(a){var b=document.getElementById(a);b.style.display="none"}function showPriceInfo(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}if(document.getElementById(a.id+"-c")){document.getElementById(a.id+"-c").style.left=findPosX(a)-310+"px";document.getElementById(a.id+"-c").style.display="block";document.getElementById(a.id+"-c").style.top=findPosY(a)-document.getElementById(a.id+"-c").scrollHeight+"px"}}function hidePriceInfo(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}if(document.getElementById(a.id+"-c")){document.getElementById(a.id+"-c").style.display="none"}}function showTab(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}for(i=1;document.getElementById("tab"+i+"c");i++){document.getElementById("tab"+i+"c").style.display="none"}for(i=1;document.getElementById("tab"+i);i++){document.getElementById("tab"+i).className=""}document.getElementById(a.id).className="on";document.getElementById(a.id+"c").style.display="block";return false}function openPopup(f){var c=504;var a=0;var e=0;a=screen.availWidth;var b=460;var d=0;var g=0;d=screen.availHeight;if(a>c){e=(a-c)/2}if(d>b){g=(d-b)/2}viewer=window.open(f,"viewer","top="+g+",left="+e+",status=yes,scrollbars=yes,menubar=no,resizable=yes,width="+c+",height="+b);viewer.focus()}function swapForgotten(){myObject=document.getElementById("forgotten");if(myObject){myObject.style.display=myObject.style.display=="none"?"block":"none"}}function eventInit(){for(i=1;document.getElementById("pi"+i);i++){document.getElementById("pi"+i).onmouseover=showPriceInfo;document.getElementById("pi"+i).onmouseout=hidePriceInfo}if(document.getElementById("forgotten")){document.getElementById("forgotten").style.display="none"}}window.onload=eventInit;function submitContactForm(d){resetErrors("contact");var c=document.contactForm;checkString(c.ContactUsEnquiryForm_name,"nameText","Name",true);if(getErrors()){if(c.ContactUsEnquiryForm_email.value.length<1){setErrorMsg("* Please enter your email address");document.getElementById("emailText").style.color="#cc0000";focusOnInput(c.ContactUsEnquiryForm_email)}else{if(!checkEmail(c.ContactUsEnquiryForm_email.value)){setErrorMsg("* Please enter a vaild email address e.g yourname@hotmail.com");document.getElementById("emailText").style.color="#cc0000";focusOnInput(c.ContactUsEnquiryForm_email)}}}if(getErrors()){var a='Enquiry/problem is: <fmt:message bundle="${storeText}" key="${WCParam.msg}"/>  ';a=a+"Notes: "+document.contactForm.ContactUsEnquiryForm_notes.value+" ";if(document.contactForm.ContactUsEnquiryForm_email.value.length>1){a=a+"Email is: "+document.contactForm.ContactUsEnquiryForm_email.value}var b=new Date();a=a+" Submitted at: "+b.toLocaleString();a=a+"\nAppCodeName: "+navigator.appCodeName;a=a+"\nAppName: "+navigator.appName;a=a+"\nAppVersion: "+navigator.appVersion;a=a+"\nUserAgent: "+navigator.userAgent;a=a+"\nPlatform: "+navigator.platform;a=encodeURIComponent(a);c.ContactUsEnquiryForm_notes.value=a}if(c.ContactUsEnquiryForm_sendCopy.checked==true){c.sendCustomerEmail.value="true"}else{c.sendCustomerEmail.value="false"}if(getErrors()&&getBusy()){setBusy(true);removeErrorMsg();document.contactForm.submit()}}function addItem(a,b){itemName=a;quantity=b}function getItem(){return itemName}function successMessage(){var a=itemName;alert("Your item has been successfully added to your Wish List. View your Wish List in the 'My Account Area'.")}function basketSuccessMessage(){var a=" have";if(quantity==1){a=" has"}alert(quantity+" x "+itemName+a+" been added to your Basket")}function add2Basket(c,e,b){var d=e.value;if(e!=null&&d!=""){var a=/^[0-9]+$/;if(!a.test(d)){document.getElementById("errors"+b).innerHTML="Quantity must only contain numbers<br /><br />";document.getElementById("errors"+b).style.color="red";setErrors()}else{errors=0}}if(getErrors()&&getBusy()){setBusy(true);c.submit()}}function ammendOrderUrl(b,c){var a=b.URL.value;a=a+"&quant="+b.quantity.value;b.URL.value=a;addItem(c,b.quantity.value);b.submit()}function quickAddToBasket(b){var c=document.getElementById("quickShop");var e=c.elements.productCode.value;var a=b;var f=a.split("&amp;");var d="";for(x=0;x<f.length;x++){if((x+1)==f.length){d=d+f[x]}else{d=d+f[x]+"&"}}window.location=d+"&partNumber="+e}function UpdateQuantity(j,k,e){var b="updateItemQuantity"+e;var h=document.getElementById(b);var g="qty"+e;var d=h.elements[g].value;var f=k;var c=f.split("&amp;");var a="";for(x=0;x<c.length;x++){if((x+1)==c.length){a=a+c[x]}else{a=a+c[x]+"&"}}c=a.split("?");a="";a=a+c[0]+"?";a=a+"quantity="+d+"&orderItemId="+j+"&";a=a+c[1];if(c.length>2){for(x=2;x<c.length;x++){a=a+"?"+c[x]}}window.location=a}function setRegionArray(c,a,b){regionNameArray[b]=c;regionCodeArray[b]=a}function getRegionArray(b){var a="";for(x=0;x<regionNameArray.length;x++){if(regionNameArray[x]==b){a=regionCodeArray[x]}}return"region"+a}function checkForBlanks(j,d,g){var a=false;var h;var c=d.split("|");var f=g.split("|");if(c.length>1){for(x=0;x<c.length;x++){if(document.getElementById(c[x]).value==""){a=true;h=x}}}else{var b=document.getElementById(d).value;if(b==""){a=true}}if(c.length!=f.length){throw ("Function call is wrong, you have not specified the same number of input boxes as input names")}if(a){if(c.length>1){var e=c[h]+"Text";document.getElementById("errors").innerHTML="<div class='errorBox'>\n<h2>There has been an error</h2>\n<p>Please check that you have filled out all fields marked *</p>\n<br />\n<li>* "+f[h]+" cannot be blank";"</li></div>";document.getElementById(e).style.color="#cc0000"}else{var e=d+"Text";document.getElementById("errors").innerHTML="<div class='errorBox'>\n<h2>There has been an error</h2>\n<p>Please check that you have filled out all fields marked *</p>\n<br />\n<li>* "+g+" cannot be blank";"</li></div>";document.getElementById(e).style.color="#cc0000"}}else{removeErrorMsg();document.getElementById(j).submit()}}function moveToTop(){var a=""+window.location;if(a.indexOf("#")==-1){window.location=a+"#"}else{a.substring(0,a.length-2);window.location=a}}function resetSearchResults(c){var a=new Array("countryfilter","regionfilter","colourfilter","pricefilter","percentagefilter","bodyfilter","grapefilter","maturityfilter","bottlesizefilter");var b="";switch(c){case"Jeroboams":b="Wine";break;case"Milroys":b="Whisky";break}document.getElementById("searchTermResultsBox").value=b+" Search";for(x=0;x<a.length;x++){document.getElementById(a[x]).value=""}document.getElementById("numberResults").value="8";document.getElementById("sortBySelect").value="false"};