var VAT=1.2;var __eventListeners=[];var booLoadingProduct=false;var booBagging=false;var intClipWidth=null;var intClipLeft=0;var intLeft=0;var intScrollBySlow=2;var intScrollByFast=20;var intScrollDelay=50;var intMaxLeft=0;var intMinLeft=0;var intMinClipLeft=0;var intMaxClipLeft=0;var intOrigClipWidth=980;var scrolling=false;var strSpeed="slow";var voucher="";var strStockCode=null;var intProductID=0;var strProductType="";var strStockCode="";var strProductTitle="";var dblProductGBPValue="0";var dblProductUSDValue="0";var shoppingBag={products:[],count:0,totalGBPValue:0,totalGBPIncVATValue:0,totalUSDValue:0};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.testEmail=function(){var a=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return a.test(this)};function init(){initNav();initPopups();addListener(window,"unload",EventCache.flush);stopLoading()}function initSearchForm(){initNav();initPopups();initSearchFormSubmit();initSearchPriceOperator();addListener(window,"unload",EventCache.flush);stopLoading()}function initSearch(){initNav();initBag();initPopups();getFirstProduct();initAddToBag();initTellAFriend();initThumbs();initPaging();initProducts();initScrollArrows();addListener(window,"unload",EventCache.flush)}function initOrder(){initNav();initShoppingBagLinks();initCountry();initRelatedItems();initPopups();addListener(window,"unload",EventCache.flush);stopLoading()}function initPopups(){var c=getElementsByClass("popup",document,"a");for(var b=0,a=c.length;b<a;b++){addListener(c[b],"click",function(d){window.open(this.href);cancelEvent(d)})}}function cookieTest(){ajax("cookietest.asp","",cookieReturn)}function cookieReturn(a){if(String(a.getElementsByTagName("CE").item(0).firstChild.nodeValue)!="1"){elDiv=document.createElement("div");elDiv.className="browserproblem";elH2=document.createElement("h2");elH2Text=document.createTextNode("Warning");elP=document.createElement("p");elPText=document.createTextNode("This site makes use of Cookies, and will not function correctly with them disabled. Please enable Cookies and click ");elA=document.createElement("a");elA.setAttribute("href","/");elAText=document.createTextNode("here");elA.appendChild(elAText);elP2Text=document.createTextNode(" to try again.");elP.appendChild(elPText);elP.appendChild(elA);elP.appendChild(elP2Text);elH2.appendChild(elH2Text);elDiv.appendChild(elH2);elDiv.appendChild(elP);document.getElementById("rightContent").appendChild(elDiv)}}function initBag(){if(readCookie("shoppingBag")){shoppingBag=readCookie("shoppingBag").parseJSON();updateShoppingBag()}}function zoomIn(a){if(a.className!="active"){a.src=String(a.src).replace("/thumb/","/thumb/zoom/");a.style.width="10.4em";a.style.height="9.8em";a.style.borderWidth="0.1em";a.style.borderColor="#4D4F53";a.style.marginLeft="0.1em";a.style.marginRight="0.1em";elSales=getElementsByClass("sale",a.parentNode,"div");if(elSales.length>0){elSales[0].style.top="8.1em";elSales[0].style.borderWidth="1.2em";elSales[0].style.left="8.3em"}}}function zoomOut(a){if(a.className!="active"){a.src=a.src.replace("/thumb/zoom/","/thumb/");a.style.width="8.4em";a.style.height="8.4em";a.style.borderWidth="0.8em";a.style.borderColor="#C2B7B3";a.style.marginLeft="0.4em";a.style.marginRight="0.4em";elSales=getElementsByClass("sale",a.parentNode,"div");if(elSales.length>0){elSales[0].style.top="8.5em";elSales[0].style.borderWidth="1em";elSales[0].style.left="8.4em"}}}function startScroll(a){intScrollBy=intScrollBySlow;strSpeed="slow";intResultsWidth=parseInt(getStyle(document.getElementById("divResultsPane"),"width"),10);intAddOn=52;if(!intResultsWidth){intResultsWidth=document.getElementById("divResultsPane").offsetWidth;intAddOn-=20}intOrigClipWidth=document.getElementById("divResults").parentNode.clientWidth;if(intResultsWidth<intOrigClipWidth){return false}if(!intClipWidth){intClipWidth=intOrigClipWidth}intMinLeft=0-intResultsWidth+intOrigClipWidth-intAddOn;intMaxClipLeft=intResultsWidth-intOrigClipWidth;intMaxClipWidth=intResultsWidth+intAddOn;intMinClipWidth=intOrigClipWidth;scrolling=true;if(a=="Left"){scrollLeft()}else{scrollRight()}}function fastScroll(){strSpeed="fast";intScrollBy=intScrollByFast}function slowScroll(){strSpeed="slow";intScrollBy=intScrollBySlow}function stopScroll(){scrolling=false;elLeftArrow=document.getElementById("leftArrow");elRightArrow=document.getElementById("rightArrow");if(elLeftArrow.src.indexOf("leftarrowactive.png")>-1){elLeftArrow.src="/images/site/leftarrow.png"}if(elRightArrow.src.indexOf("rightarrowactive.png")>-1){elRightArrow.src="/images/site/rightarrow.png"}}function scrollLeft(){if(!scrolling){return false}elResults=document.getElementById("divResults");elLeftArrow=document.getElementById("leftArrow");elRightArrow=document.getElementById("rightArrow");if(strSpeed=="slow"){elLeftArrow.src="/images/site/leftarrowactive.png"}else{elLeftArrow.src="/images/site/leftarrowfast.png"}intLeft+=intScrollBy;intClipLeft-=intScrollBy;intClipWidth-=intScrollBy;if(intClipLeft<intMaxClipWidth){elRightArrow.src="/images/site/rightarrow.png"}if(intLeft>intMaxLeft){intLeft=intMaxLeft}if(intClipLeft<intMinClipLeft){intClipLeft=intMinClipLeft}if(intClipWidth<intMinClipWidth){intClipWidth=intMinClipWidth}elResults.style.left=intLeft+"px";strClip="rect(0px, "+intClipWidth+"px, 11em, "+intClipLeft+"px)";elResults.style.clip=strClip;if(intLeft==intMaxLeft){elLeftArrow.src="/images/site/leftarrowinactive.png";scrolling=false}setTimeout(scrollLeft,intScrollDelay)}function scrollRight(){if(!scrolling){return false}elResults=document.getElementById("divResults");elLeftArrow=document.getElementById("leftArrow");elRightArrow=document.getElementById("rightArrow");if(strSpeed=="slow"){elRightArrow.src="/images/site/rightarrowactive.png"}else{elRightArrow.src="/images/site/rightarrowfast.png"}intLeft-=intScrollBy;intClipLeft+=intScrollBy;intClipWidth+=intScrollBy;if(intClipLeft>intMinClipWidth){elLeftArrow.src="/images/site/leftarrow.png"}if(intLeft<intMinLeft){intLeft=intMinLeft}if(intClipLeft>intMaxClipLeft){intClipLeft=intMaxClipLeft}if(intClipWidth>intMaxClipWidth){intClipWidth=intMaxClipWidth}elResults.style.left=intLeft+"px";strClip="rect(0px, "+intClipWidth+"px, 11em, "+intClipLeft+"px)";elResults.style.clip=strClip;if(intLeft==intMinLeft){elRightArrow.src="/images/site/rightarrowinactive.png";scrolling=false}setTimeout(scrollRight,intScrollDelay)}function getStyle(a,b){var c="";if(document.defaultView&&document.defaultView.getComputedStyle){c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b)}else{if(a.currentStyle){b=b.replace(/-(w)/g,function(d,e){return e.toUpperCase()});c=a.currentStyle[b]}}return c}function getElementsByClass(g,e,a){var d=[];if(e===null){e=document}if(a===null){a="*"}var c=e.getElementsByTagName(a);var b=c.length;var f=new RegExp("(^|\\s)"+g+"(\\s|$)");for(i=0,j=0;i<b;i++){if(f.test(c[i].className)){d[j]=c[i];j++}}return d}function addListener(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false);EventCache.add(c,b,a)}else{if(c.attachEvent){c["e"+b+a]=a;c[b+a]=function(){c["e"+b+a](window.event)};c.attachEvent("on"+b,c[b+a]);EventCache.add(c,b,a)}else{c["on"+b]=c["e"+b+a]}}}var EventCache=function(){var a=[];return{listEvents:a,add:function(b,d,c){a.push(arguments)},flush:function(){var b,c;for(b=a.length-1;b>=0;b=b-1){c=a[b];if(c[0].removeEventListener){c[0].removeEventListener(c[1],c[2],c[3])}if(c[1].substring(0,2)!="on"){c[1]="on"+c[1]}if(c[0].detachEvent){c[0].detachEvent(c[1],c[2])}c[0][c[1]]=null}}}}();function initNav(){if(!window.XMLHttpRequest||navigator.userAgent.toLowerCase().indexOf("msie")!=-1){elMenu=getElementsByClass("lvl1",null,"ul")[0];if(getElementsByClass("lvl1",null,"ul")[0]&&getElementsByClass("lvl1",null,"ul")[0].childNodes&&getElementsByClass("lvl1",null,"ul")[0].childNodes[0]){elMenuNodes=elMenu.getElementsByTagName("li");for(i=0,j=elMenuNodes.length;i<j;i++){if(elMenuNodes[i].className!="active"){addListener(elMenuNodes[i],"mouseover",function(){this.style.backgroundColor="#D8D0CD"});addListener(elMenuNodes[i],"mouseout",function(){this.style.backgroundColor="#CDC4BF"})}if(elMenuNodes[i].getElementsByTagName("ul").length>0){addListener(elMenuNodes[i],"mouseover",function(){this.getElementsByTagName("ul")[0].style.display="block";this.childNodes[0].style.color="#532F91"});addListener(elMenuNodes[i],"mouseout",function(){this.getElementsByTagName("ul")[0].style.display="none";this.childNodes[0].style.color="#4D4F53"});elMenuSubNodes=elMenuNodes[i].getElementsByTagName("ul")[0].getElementsByTagName("li");for(k=0,l=elMenuSubNodes.length;k<l;k++){if(elMenuSubNodes[k].getElementsByTagName("ul").length>0){addListener(elMenuSubNodes[k],"mouseover",function(){this.getElementsByTagName("ul")[0].style.display="block";this.childNodes[0].style.color="#532F91"});addListener(elMenuSubNodes[k],"mouseout",function(){this.getElementsByTagName("ul")[0].style.display="none";this.childNodes[0].style.color="#4D4F53"})}}}}}}}function cancelEvent(a){if(!a){a=window.event}a.cancelBubble=true;if(typeof a.stopPropagation=="function"){a.stopPropagation()}a.returnValue=false;if(typeof a.preventDefault=="function"){a.preventDefault()}}function initAddToBag(){elAdd=document.getElementById("addToBag");addListener(elAdd,"click",function(a){addToBag(this);cancelEvent(a)})}function initScrollArrows(){intResultsWidth=parseInt(getStyle(document.getElementById("divResultsPane"),"width"),10);if(!intResultsWidth){intResultsWidth=document.getElementById("divResultsPane").offsetWidth}intOrigClipWidth=document.getElementById("divResults").parentNode.clientWidth;if(intResultsWidth<intOrigClipWidth){return false}document.getElementById("leftArrow").parentNode.style.display="block";document.getElementById("rightArrow").parentNode.style.display="block";anchor=document.getElementById("leftArrow").parentNode;addListener(anchor,"mouseover",function(){startScroll("Left")});addListener(anchor,"mouseout",stopScroll);addListener(anchor,"mousedown",function(a){fastScroll();cancelEvent(a);this.blur()});addListener(anchor,"mouseup",slowScroll);addListener(anchor,"click",function(a){cancelEvent(a);this.blur()});anchor=document.getElementById("rightArrow").parentNode;addListener(anchor,"mouseover",function(){startScroll("Right")});addListener(anchor,"mouseout",stopScroll);addListener(anchor,"mousedown",function(a){fastScroll();cancelEvent(a);this.blur()});addListener(anchor,"mouseup",slowScroll);addListener(anchor,"click",function(a){cancelEvent(a);this.blur()})}function initProducts(){arrProds=document.getElementById("divResultsPane").getElementsByTagName("a");for(i=0,j=arrProds.length;i<j;i++){addListener(arrProds[i],"click",function(a){getProduct(this);cancelEvent(a)});addListener(arrProds[i].childNodes[0],"mouseover",function(){zoomIn(this)});addListener(arrProds[i].childNodes[0],"mouseout",function(){zoomOut(this)})}}function initRelatedItems(){if(!document.getElementById("divRelatedItemsPane")){return false}arrRI=document.getElementById("divRelatedItemsPane").getElementsByTagName("a");for(i=0,j=arrRI.length;i<j;i++){addListener(arrRI[i].childNodes[0],"mouseover",function(){zoomIn(this)});addListener(arrRI[i].childNodes[0],"mouseout",function(){zoomOut(this)})}}function initThumbs(){arrThumbs=document.getElementById("thumbs").getElementsByTagName("a");for(i=0,j=arrThumbs.length;i<j;i++){addListener(arrThumbs[i],"click",function(a){getImage(this);cancelEvent(a)})}}function getFirstProduct(){getProduct(document.getElementById("divResultsPane").getElementsByTagName("a")[0])}function getImage(b,a){startLoading();arrThumbs=document.getElementById("thumbs").getElementsByTagName("a");for(i=0,j=arrThumbs.length;i<j;i++){arrThumbs[i].childNodes[0].className=""}document.getElementById("productimage").style.backgroundImage="url("+b.childNodes[0].src.replace("/thumb/","/")+")";b.childNodes[0].className="active";if(!a){stopLoading()}}function initShoppingBagLinks(){if(readCookie("shoppingBag")){shoppingBag=readCookie("shoppingBag").parseJSON()}if(document.getElementById("hdnVoucher")){strVoucher=unescape(document.getElementById("hdnVoucher").value);if(strVoucher!==""&&strVoucher!="undefined"&&strVoucher!="null"){voucher=strVoucher.parseJSON()}}if(document.getElementById("removeall")){addListener(document.getElementById("removeall"),"click",function(c){shoppingBagCheckoutUpdate("all");cancelEvent(c)})}var b=getElementsByClass("remove",null,"a");for(i=0,j=b.length;i<j;i++){addListener(b[i],"click",function(c){shoppingBagCheckoutUpdate(this);cancelEvent(c)})}var a=getElementsByClass("productQuantity",null,"input");for(i=0,j=a.length;i<j;i++){addListener(a[i],"keyup",function(c){updateShoppingBagQuantities(this);cancelEvent(c)});addListener(a[i],"paste",function(c){updateShoppingBagQuantities(this);cancelEvent(c)})}}function initCountry(){elCountry=document.getElementById("selCountry");if(!elCountry){return false}if(readCookie("country")){for(i=0,j=elCountry.length;i<j;i++){if(String(elCountry.options[i].value).replace("_EU","")==readCookie("country")){elCountry.options[i].selected=true;break}}}changeCountry(elCountry);addListener(elCountry,"change",function(a){changeCountry(this);cancelEvent(a)});addListener(document.getElementById("selDeliveryMethodUK"),"change",function(a){changeDeliveryMethod(this);cancelEvent(a)});addListener(document.getElementById("selDeliveryMethodInternational"),"change",function(a){changeDeliveryMethod(this);cancelEvent(a)})}function changeCountry(a){intCountryID=String(a.options[a.selectedIndex].value);if(intCountryID.indexOf("_EU")==-1){createCookie("VAT","0",365);document.getElementById("tblShoppingBag").getElementsByTagName("th")[2].firstChild.nodeValue="Price";elTR=document.getElementById("tblShoppingBag").getElementsByTagName("tbody")[0].getElementsByTagName("tr");for(i=0,j=elTR.length-1;i<j;i++){if(String(elTR[i].getElementsByTagName("td")[0].firstChild.nodeValue).length>2){index=findBagIndex(elTR[i].getElementsByTagName("td")[0].firstChild.nodeValue);elTR[i].getElementsByTagName("td")[2].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.products[index].GBPValue)}}document.getElementById("tblShoppingBag").getElementsByTagName("tfoot")[0].getElementsByTagName("tr")[0].getElementsByTagName("td")[1].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPValue)}else{createCookie("VAT","1",365);document.getElementById("tblShoppingBag").getElementsByTagName("th")[2].firstChild.nodeValue="Price (inc VAT)";elTR=document.getElementById("tblShoppingBag").getElementsByTagName("tbody")[0].getElementsByTagName("tr");if(String(readCookie("shoppingBag"))=="null"){alert("There has been a cookie error. Please refresh this page and try again.\n\nIf this problem persists please contact us at support@purple-label.com");return false}for(i=0,j=elTR.length-1;i<j;i++){if(String(elTR[i].getElementsByTagName("td")[0].firstChild.nodeValue).length>2){index=findBagIndex(elTR[i].getElementsByTagName("td")[0].firstChild.nodeValue);elTR[i].getElementsByTagName("td")[2].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.products[index].GBPIncVATValue)}}document.getElementById("tblShoppingBag").getElementsByTagName("tfoot")[0].getElementsByTagName("tr")[0].getElementsByTagName("td")[1].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue)}intCountryID=intCountryID.replace("_EU","");createCookie("country",intCountryID,365);if(intCountryID!="236"){document.getElementById("selDeliveryMethodInternational").style.display="block";document.getElementById("selDeliveryMethodUK").style.display="none";changeDeliveryMethod(document.getElementById("selDeliveryMethodInternational"))}else{document.getElementById("selDeliveryMethodInternational").style.display="none";document.getElementById("selDeliveryMethodUK").style.display="block";changeDeliveryMethod(document.getElementById("selDeliveryMethodUK"))}}function changeDeliveryMethod(a){strDeliveryMethod=a.options[a.selectedIndex].value;createCookie("deliverymethod",strDeliveryMethod,7);elTBody=document.getElementById("tblShoppingBag").getElementsByTagName("tbody")[0];elTR=elTBody.getElementsByTagName("tr")[elTBody.getElementsByTagName("tr").length-1];elDesc=elTR.getElementsByTagName("td")[1];elPRice=elTR.getElementsByTagName("td")[2].firstChild;voucherValue=0;if(voucher!==""){if(voucher.voucherType=="%"){if(readCookie("VAT")=="0"){voucherValue=formatCurrency((shoppingBag.totalGBPValue/100)*parseFloat(voucher.voucherValue)).replace(/,/gi,"")}else{voucherValue=formatCurrency((shoppingBag.totalGBPValue/100)*parseFloat(voucher.voucherValue)).replace(/,/gi,"");voucherValue=formatCurrency(voucherValue*VAT).replace(/,/gi,"")}document.getElementById("discountValue").firstChild.nodeValue="-\u00A3"+formatCurrency(voucherValue)}}elTD=document.getElementById("tdPrice").firstChild;booEnableButton=true;booDeliveryReminder=false;intDeliveryDifference=0;emptyElement(elDesc);switch(strDeliveryMethod){case"UKStandard":elText=document.createTextNode("UK Standard Delivery");elDesc.appendChild(elText);if((shoppingBag.totalGBPIncVATValue-voucherValue)<100){booDeliveryReminder=true;intDeliveryDifference=100-(shoppingBag.totalGBPIncVATValue-voucherValue);delCharge=4.95;elPRice.nodeValue="\u00A34.95";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue+4.95)}else{delCharge=0;elPRice.nodeValue="Free"}break;case"UKNextDay":delCharge=11.95;elText=document.createTextNode("UK Next Day Delivery");elDesc.appendChild(elText);elPRice.nodeValue="\u00A311.95";break;case"InternationalSignedFor":if(readCookie("VAT")=="0"){if((shoppingBag.totalGBPValue)>2100){delCharge=0;elDesc1=document.createTextNode("This purchase is too expensive for our standard international delivery insurance. Please split your order into orders that have a value of less than \u00A32,100 or ");elA=document.createElement("a");elA.setAttribute("href","mailto:enquiries@purple-label.com");elAText=document.createTextNode("contact us");elA.appendChild(elAText);elDesc2=document.createTextNode(" directly for this purchase.");elDesc.appendChild(elDesc1);elDesc.appendChild(elA);elDesc.appendChild(elDesc2);booEnableButton=false;elPRice.nodeValue="N/A"}else{elText=document.createTextNode("International Signed For Delivery");elDesc.appendChild(elText);if((shoppingBag.totalGBPValue)<=50){delCharge=20;elPRice.nodeValue="\u00A320.00";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPValue+20)}else{if((shoppingBag.totalGBPValue)>50&&(shoppingBag.totalGBPValue)<=500){delCharge=30;elPRice.nodeValue="\u00A330.00";elTD.parentNode.innerHTML="\u00A3"+formatCurrency(shoppingBag.totalGBPValue+30)}else{if((shoppingBag.totalGBPValue)>500&&(shoppingBag.totalGBPValue)<=2100){delCharge=60;elPRice.nodeValue="\u00A360.00";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPValue+60)}}}}}else{if((shoppingBag.totalGBPIncVATValue)>2100){delCharge=0;elDesc1=document.createTextNode("This purchase is too expensive for our standard international delivery insurance. Please split your order into orders that have a value of less than \u00A32,100 or ");elA=document.createElement("a");elA.setAttribute("href","mailto:enquiries@purple-label.com");elAText=document.createTextNode("contact us");elA.appendChild(elAText);elDesc2=document.createTextNode(" directly for this purchase.");elDesc.appendChild(elDesc1);elDesc.appendChild(elA);elDesc.appendChild(elDesc2);booEnableButton=false;elPRice.nodeValue="N/A"}else{elText=document.createTextNode("International Signed For Delivery");elDesc.appendChild(elText);if((shoppingBag.totalGBPIncVATValue)<=50){delCharge=20;elPRice.nodeValue="\u00A320.00";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue+20)}else{if((shoppingBag.totalGBPIncVATValue)>50&&(shoppingBag.totalGBPIncVATValue)<=500){delCharge=30;elPRice.nodeValue="\u00A330.00";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue+30)}else{if((shoppingBag.totalGBPIncVATValue)>500&&(shoppingBag.totalGBPIncVATValue)<=2100){delCharge=60;elPRice.nodeValue="\u00A360.00";elTD.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue+60)}}}}}break}if(booDeliveryReminder){if(document.getElementById("delDifference")){document.getElementById("delDifference").firstChild.nodeValue=formatCurrency(intDeliveryDifference)}elDR=document.getElementById("deliveryreminder");if(elDR.tagName=="p"){document.getElementById("deliveryreminder").style.display="block"}else{document.getElementById("deliveryreminder").style.display="inline"}}else{document.getElementById("deliveryreminder").style.display="none"}if(readCookie("VAT")=="0"){document.getElementById("tdPrice").innerHTML="\u00A3"+formatCurrency(shoppingBag.totalGBPValue+delCharge-voucherValue)}else{document.getElementById("tdPrice").innerHTML="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue+delCharge-voucherValue)}if(booEnableButton){document.getElementById("orderFwdNav").style.display="block"}else{document.getElementById("orderFwdNav").style.display="none"}}function initPaging(){addListener(document.getElementById("DetailsAnchor"),"click",function(a){getPage("Details");cancelEvent(a)});addListener(document.getElementById("MoreInfoAnchor"),"click",function(a){getPage("MoreInfo");cancelEvent(a)});addListener(document.getElementById("RelatedItemsAnchor"),"click",function(a){getPage("RelatedItems");cancelEvent(a)});addListener(document.getElementById("ColouredItemsAnchor"),"click",function(a){getPage("ColouredItems");cancelEvent(a)});addListener(document.getElementById("TellAFriendAnchor"),"click",function(a){getPage("TellAFriend");cancelEvent(a)});addListener(document.getElementById("ToldAFriendAnchor"),"click",function(a){getPage("TellAFriend");cancelEvent(a)})}function getPage(a){document.getElementById("DetailsAnchor").className="";document.getElementById("MoreInfoAnchor").className="";document.getElementById("RelatedItemsAnchor").className="";document.getElementById("ColouredItemsAnchor").className="";document.getElementById("TellAFriendAnchor").className="";document.getElementById(a+"Anchor").className="active";document.getElementById("MoreInfo").style.display="none";document.getElementById("RelatedItems").style.display="none";document.getElementById("ColouredItems").style.display="none";document.getElementById("Details").style.display="none";document.getElementById("TellAFriend").style.display="none";document.getElementById("ToldAFriend").style.display="none";document.getElementById("price").className="price";if(a=="RelatedItems"||a=="ColouredItems"||a=="TellAFriend"||a=="ToldAFriend"){document.getElementById("price").className="pricehdn"}document.getElementById(a).style.display="inline";return false}function getProduct(a){if(booLoadingProduct){return false}booLoadingProduct=true;document.getElementById("descriptionDiv").style.display="none";document.getElementById("addToBag").style.display="none";startLoading();arrProds=getElementsByClass("active",document.getElementById("divResultsPane"),"img");for(i=0,j=arrProds.length;i<j;i++){arrProds[i].className="";zoomOut(arrProds[i])}zoomOut(a.getElementsByTagName("img")[0]);a.getElementsByTagName("img")[0].className="active";a.getElementsByTagName("img")[0].style.borderColor="#4D4F53";dat=new Date();url="/details/web/type/"+a.id.split("_")[1]+"/id/"+a.id.split("_")[2]+"/decacher/"+escape(dat.toUTCString());ajax(url,"",updateProduct);return false}function ajax(b,e,c){var d=false;var a=this;if(window.XMLHttpRequest){a.xmlHttpReq=new XMLHttpRequest()}else{if(window.ActiveXObject){a.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP")}}a.xmlHttpReq.open("POST",b,true);a.xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");a.xmlHttpReq.setRequestHeader("Content-length",e.length);a.xmlHttpReq.setRequestHeader("Connection","close");a.xmlHttpReq.onreadystatechange=function(){if(a.xmlHttpReq.readyState==4){c(a.xmlHttpReq.responseXML)}};a.xmlHttpReq.send(e)}function updateProduct(a){if(a.getElementsByTagName("error")&&a.getElementsByTagName("error").length>0){alert(a.getElementsByTagName("error").item(0).firstChild.nodeValue);stopLoading();booLoadingProduct=false;return false}elProduct=a.getElementsByTagName("product").item(0);strProductType=elProduct.attributes.getNamedItem("type").nodeValue;intProductID=elProduct.attributes.getNamedItem("id").nodeValue;strStockCode=elProduct.attributes.getNamedItem("stockcode").nodeValue;strProductTitle=a.getElementsByTagName("title").item(0).firstChild.nodeValue;strDetails=a.getElementsByTagName("description").item(0).firstChild.nodeValue;strDesigner=a.getElementsByTagName("designer").item(0).firstChild.nodeValue;strDiscountType="";if(a.getElementsByTagName("discount").item(0).attributes.getNamedItem("active").nodeValue=="true"){strDiscountType=a.getElementsByTagName("discount").item(0).getElementsByTagName("type").item(0).firstChild.nodeValue;dblDiscountValue=a.getElementsByTagName("discount").item(0).getElementsByTagName("value").item(0).firstChild.nodeValue;dblUSDiscountValue=a.getElementsByTagName("discount").item(0).getElementsByTagName("usvalue").item(0).firstChild.nodeValue}strMoreInfoEarringsReturning="";if(a.getElementsByTagName("moreinfoearringsreturning").item(0).firstChild){strMoreInfoEarringsReturning=a.getElementsByTagName("moreinfoearringsreturning").item(0).firstChild.nodeValue}dblProductGBPValue=a.getElementsByTagName("gbp").item(0).firstChild.nodeValue;dblProductUSDValue=a.getElementsByTagName("usd").item(0).firstChild.nodeValue;intStockCount=parseInt(elProduct.attributes.getNamedItem("stockcount").nodeValue,10);document.getElementById("productdetails").style.backgroundImage="url(/images/"+strProductType+"/products/"+intProductID+".jpg)";elThumbs=document.getElementById("thumbs");emptyElement(elThumbs);for(i=1,j=a.getElementsByTagName("image").item(0).attributes.getNamedItem("count").nodeValue;i<=j;i++){elAnchor=document.createElement("a");elAnchor.setAttribute("href","#");elAnchor.setAttribute("title","Click here to see a larger version of this image");elImg=document.createElement("img");elImg.setAttribute("src","/images/"+strProductType+"/products/thumb/"+intProductID+"_"+i+".jpg");elImg.setAttribute("alt",strProductTitle+" - Thumb "+i);elImg.setAttribute("width","44");elImg.setAttribute("height","44");if(i==1){elImg.setAttribute("class","active")}elAnchor.appendChild(elImg);elThumbs.appendChild(elAnchor)}document.getElementById("productimage").style.backgroundImage="none";if(elThumbs.childNodes[0]){initThumbs();getImage(elThumbs.childNodes[0],true)}document.getElementById("producttitle").firstChild.nodeValue=String(strProductTitle).toUpperCase();document.getElementById("txtURLDescription").value=String(strProductTitle);document.getElementById("txtURL").value="http://www.purple-label.com/jewellery/web/type/"+strProductType+"/id/"+intProductID;document.getElementById("Details").firstChild.nodeValue=strDetails;elDesigner=document.getElementById("designertext");emptyElement(elDesigner);elText=document.createTextNode("Designed by ");elAnchor=document.createElement("a");elAnchor.setAttribute("href","/"+strDesigner.toLowerCase().replace(/ /gi,"-")+".asp");elText2=document.createTextNode(strDesigner);elDesigner.appendChild(elText);elAnchor.appendChild(elText2);elDesigner.appendChild(elAnchor);if(strMoreInfoEarringsReturning!==""){document.getElementById("earringsreturning").firstChild.nodeValue=strMoreInfoEarringsReturning;document.getElementById("earringsreturning").style.display="block"}else{document.getElementById("earringsreturning").style.display="none"}if((a.getElementsByTagName("stone").length>0)||(a.getElementsByTagName("metal").length>0)){elStoneUl=document.getElementById("stoneslinkslist");emptyElement(elStoneUl);for(i=0;i<a.getElementsByTagName("stone").length;i++){elStoneLi=document.createElement("li");elStoneAnchor=document.createElement("a");elStoneAnchor.setAttribute("href","/stones.asp#"+String(a.getElementsByTagName("stone")[i].firstChild.nodeValue).replace(/ /gi,"-").replace(/\//gi,"-or-").replace(/\'/gi,"").replace(/\(/gi,"").replace(/\)/gi,""));elStoneTxt=document.createTextNode(a.getElementsByTagName("stone")[i].firstChild.nodeValue);elStoneAnchor.appendChild(elStoneTxt);elStoneLi.appendChild(elStoneAnchor);elStoneUl.appendChild(elStoneLi)}for(i=0;i<a.getElementsByTagName("metal").length;i++){elStoneLi=document.createElement("li");elStoneAnchor=document.createElement("a");elStoneAnchor.setAttribute("href","/metals.asp#"+String(a.getElementsByTagName("metal")[i].firstChild.nodeValue).replace(/ /gi,"-").replace(/\//gi,"-or-").replace(/\'/gi,"").replace(/\(/gi,"").replace(/\)/gi,""));elStoneTxt=document.createTextNode(a.getElementsByTagName("metal")[i].firstChild.nodeValue);elStoneAnchor.appendChild(elStoneTxt);elStoneLi.appendChild(elStoneAnchor);elStoneUl.appendChild(elStoneLi)}document.getElementById("stoneslinks").style.display="block";document.getElementById("stoneslinkslist").style.display="block"}else{document.getElementById("stoneslinks").style.display="none";document.getElementById("stoneslinkslist").style.display="none"}document.getElementById("stockcode").getElementsByTagName("span")[0].firstChild.nodeValue=strStockCode;if(a.getElementsByTagName("relateditems").length>0){divRI=document.getElementById("RelatedItems");emptyElement(divRI);elP=document.createElement("p");elPText=document.createTextNode("Here are some suggestions for the perfect match.");elP.appendChild(elPText);divRI.appendChild(elP);for(i=0;i<a.getElementsByTagName("relateditem").length;i++){elRIimg=document.createElement("img");elRIimg.setAttribute("src","/images/"+a.getElementsByTagName("relateditem")[i].attributes.getNamedItem("type").nodeValue+"/products/thumb/"+a.getElementsByTagName("relateditem")[i].attributes.getNamedItem("id").nodeValue+".jpg");addListener(elRIimg,"mouseover",function(){zoomIn(this)});addListener(elRIimg,"mouseout",function(){zoomOut(this)});elA=document.createElement("a");elA.href="#";elA.className="relateditem";elA.id="anchorProductRI_"+a.getElementsByTagName("relateditem")[i].attributes.getNamedItem("type").nodeValue+"_"+a.getElementsByTagName("relateditem")[i].attributes.getNamedItem("id").nodeValue;addListener(elA,"click",function(b){getProduct(this);cancelEvent(b)});elA.appendChild(elRIimg);if(String(a.getElementsByTagName("relateditem")[i].attributes.getNamedItem("discount").nodeValue)=="1"){elDivSale=document.createElement("div");elDivSale.className="sale";elDivSaleText=document.createElement("div");elDivSaleText.className="saletext";elText=document.createTextNode("On sale");elDivSaleText.appendChild(elText);elDivSale.appendChild(elDivSaleText);elA.appendChild(elDivSale)}divRI.appendChild(elA)}document.getElementById("RelatedItemsSpan").style.display="inline"}else{divRI=document.getElementById("RelatedItems");emptyElement(divRI);document.getElementById("RelatedItemsSpan").style.display="none"}if(a.getElementsByTagName("coloureditems").length>0){divRI=document.getElementById("ColouredItems");emptyElement(divRI);elP=document.createElement("p");elPText=document.createTextNode("These other colours are also available.");elP.appendChild(elPText);divRI.appendChild(elP);for(i=0;i<a.getElementsByTagName("coloureditem").length;i++){elRIimg=document.createElement("img");elRIimg.setAttribute("src","/images/"+a.getElementsByTagName("coloureditem")[i].attributes.getNamedItem("type").nodeValue+"/products/thumb/"+a.getElementsByTagName("coloureditem")[i].attributes.getNamedItem("id").nodeValue+".jpg");addListener(elRIimg,"mouseover",function(){zoomIn(this)});addListener(elRIimg,"mouseout",function(){zoomOut(this)});elA=document.createElement("a");elA.href="#";elA.className="coloureditem";elA.id="anchorProductRI_"+a.getElementsByTagName("coloureditem")[i].attributes.getNamedItem("type").nodeValue+"_"+a.getElementsByTagName("coloureditem")[i].attributes.getNamedItem("id").nodeValue;addListener(elA,"click",function(b){getProduct(this);cancelEvent(b)});elA.appendChild(elRIimg);if(String(a.getElementsByTagName("coloureditem")[i].attributes.getNamedItem("discount").nodeValue)=="1"){elDivSale=document.createElement("div");elDivSale.className="sale";elDivSaleText=document.createElement("div");elDivSaleText.className="saletext";elText=document.createTextNode("ON SALE!");elDivSaleText.appendChild(elText);elDivSale.appendChild(elDivSaleText);elA.appendChild(elDivSale)}divRI.appendChild(elA)}document.getElementById("ColouredItemsSpan").style.display="inline"}else{divRI=document.getElementById("ColouredItems");emptyElement(divRI);document.getElementById("ColouredItemsSpan").style.display="none"}emptyElement(document.getElementById("price").getElementsByTagName("span")[0]);emptyElement(document.getElementById("sale"));if(strDiscountType===""){document.getElementById("sale").style.display="none";elText=document.createTextNode("\u00A3"+formatCurrency(dblProductGBPValue*VAT)+" (approx $"+dblProductUSDValue+")");document.getElementById("price").getElementsByTagName("span")[0].appendChild(elText)}else{if(strDiscountType=="%"){elText=document.createTextNode(dblDiscountValue+"% OFF")}else{if(strDiscountType=="GBP"){if(formatCurrency(dblDiscountValue*VAT).replace(/,/gi,"")<2){elText=document.createTextNode("ON SALE")}else{elText=document.createTextNode("\u00A3"+formatCurrency(dblDiscountValue*VAT)+" OFF")}}}elSaleText=document.createElement("div");elSaleText.className="saletext";elSaleText.appendChild(elText);document.getElementById("sale").appendChild(elSaleText);document.getElementById("sale").style.display="inline";elOldPrice=document.createElement("span");elText=document.createTextNode("\u00A3"+formatCurrency(dblProductGBPValue*VAT)+" (approx $"+dblProductUSDValue+")");elOldPrice.appendChild(elText);elOldPrice.className="oldprice";if(strDiscountType=="%"){dblProductGBPValue=formatCurrency(dblProductGBPValue-((dblProductGBPValue/100)*dblDiscountValue)).replace(/,/gi,"");dblProductUSDValue=formatCurrency(dblProductUSDValue-((dblProductUSDValue/100)*dblDiscountValue)).replace(/,/gi,"")}if(strDiscountType=="GBP"){dblProductGBPValue=formatCurrency(dblProductGBPValue-dblDiscountValue).replace(/,/gi,"");dblProductUSDValue=formatCurrency(dblProductUSDValue-dblUSDiscountValue).replace(/,/gi,"")}elText=document.createTextNode(" \u00A3"+formatCurrency(dblProductGBPValue*VAT)+" (approx $"+dblProductUSDValue+")");elNewPrice=document.createElement("span");elNewPrice.appendChild(elText);elNewPrice.className="newprice";document.getElementById("price").getElementsByTagName("span")[0].appendChild(elOldPrice);document.getElementById("price").getElementsByTagName("span")[0].appendChild(elNewPrice)}document.getElementById("descriptionDiv").style.display="inline";if(intStockCount>0){document.getElementById("outofstock").style.display="none";setTimeout(function(){document.getElementById("addToBag").style.display="block"},500)}else{document.getElementById("outofstock").style.display="block";document.getElementById("addToBag").style.display="none"}getPage("Details");stopLoading();setTimeout(function(){booLoadingProduct=false},100)}function startLoading(){document.getElementById("loading").style.display="block"}function stopLoading(){setTimeout(function(){document.getElementById("loading").style.display="none"},100)}function emptyElement(a){while(a.firstChild){elRemove=a.firstChild;a.removeChild(elRemove)}}function findBagIndex(a){index=-1;shoppingBag=shoppingBag.toJSONString().parseJSON();for(k=0;k<shoppingBag.products.length;k++){if(!shoppingBag.products[k]){alert("There was a problem adding this product to your shopping bag.\nWe apologise for the inconvenience.\nPlease refresh this page and try again.");return -2}if(String(shoppingBag.products[k].StockCode)==a){index=k;break}}return index}function addToBag(a){if(booBagging||booLoadingProduct||!strStockCode||document.getElementById("newAddToBag")){return false}startLoading();booBagging=true;productIndex=findBagIndex(strStockCode);if(productIndex==-2){booBagging=false;stopLoading();return false}if(productIndex==-1){newProduct={ID:0,Type:"",StockCode:"",GBPValue:0,GBPIncVATValue:0,USDValue:0,Count:0};newProduct.ID=intProductID;newProduct.Type=strProductType;newProduct.StockCode=strStockCode;newProduct.GBPValue=(dblProductGBPValue*100)/100;newProduct.GBPIncVATValue=formatCurrency(dblProductGBPValue*VAT).replace(/,/gi,"");newProduct.USDValue=dblProductUSDValue;newProduct.Count=1;shoppingBag.products[shoppingBag.count]=newProduct}else{shoppingBag.products[productIndex].Count++}shoppingBag.count++;shoppingBag.totalGBPValue+=parseFloat(dblProductGBPValue);shoppingBag.totalGBPIncVATValue+=parseFloat(formatCurrency(dblProductGBPValue*VAT).replace(/,/gi,""));shoppingBag.totalUSDValue+=parseFloat(dblProductUSDValue);createCookie("shoppingBag",shoppingBag.toJSONString(),7);updateShoppingBag();elNewAnchor=a.cloneNode(true);elNewAnchor.id="newAddToBag";elNewAnchor=a.parentNode.appendChild(elNewAnchor);fadeToTopRight(1)}function fadeToTopRight(a){el=document.getElementById("newAddToBag");if(a>10){completeAddToBag();return true}el.style.left=0+(a*0.8)+"em";el.style.bottom=(0+(a*0.8))+"em";opacity=100-(10*a);el.style.opacity=opacity/100;el.style.filter="alpha(opacity="+opacity+")";setTimeout("fadeToTopRight("+(a+1)+")",50)}function completeAddToBag(){if(readCookie("shoppingBag")!=shoppingBag.toJSONString()){setTimeout(completeAddToBag,500)}else{el=document.getElementById("newAddToBag");el.parentNode.removeChild(el);setTimeout(function(){booBagging=false;stopLoading()},100);return true}}function updateShoppingBag(){if(shoppingBag.count>0){document.getElementById("shoppingBag").style.display="block";if(shoppingBag.count==1){strItem=" item"}else{strItem=" items"}document.getElementById("shoppingBagCount").firstChild.nodeValue=shoppingBag.count+strItem;if(readCookie("VAT")=="0"){document.getElementById("shoppingBagValue").firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPValue)+" (approx. $"+formatCurrency(shoppingBag.totalUSDValue)+")"}else{document.getElementById("shoppingBagValue").firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue)+" inc VAT (approx. $"+formatCurrency(shoppingBag.totalUSDValue)+")"}}}function shoppingBagCheckoutUpdate(a){if(a=="all"){if(!confirm("This will empty all items from your shopping bag.\n\nAre you sure you want to do this?")){return false}eraseCookie("shoppingBag");document.getElementById("hdnVoucher").value="REMOVE";document.forms[0].submit();return false}else{strStockCode=a.parentNode.parentNode.getElementsByTagName("td")[0].firstChild.nodeValue;if(!confirm("This will empty all items of stock code "+strStockCode+" from your shopping bag.\n\nAre you sure you want to do this?")){return false}elTBody=document.getElementById("tblShoppingBag").getElementsByTagName("tbody")[0];elTR=a.parentNode.parentNode;elTBody.removeChild(elTR);a=findBagIndex(strStockCode);shoppingBag.count=shoppingBag.count-shoppingBag.products[a].Count;shoppingBag.totalGBPValue=shoppingBag.totalGBPValue-(shoppingBag.products[a].GBPValue*shoppingBag.products[a].Count);shoppingBag.totalGBPIncVATValue=shoppingBag.totalGBPIncVATValue-(shoppingBag.products[a].GBPIncVATValue*shoppingBag.products[a].Count);shoppingBag.totalUSDValue=shoppingBag.totalUSDValue-(shoppingBag.products[a].USDValue*shoppingBag.products[a].Count);shoppingBag.products.splice(a,1);elTable=document.getElementById("tblShoppingBag");if(shoppingBag.count===0){eraseCookie("shoppingBag");document.getElementById("hdnVoucher").value="REMOVE";document.forms[0].submit();return false}else{elTable.getElementsByTagName("tfoot")[0].getElementsByTagName("tr")[0].getElementsByTagName("td")[1].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue);elTable.getElementsByTagName("tfoot")[0].getElementsByTagName("tr")[0].getElementsByTagName("td")[2].firstChild.nodeValue=shoppingBag.count}createCookie("shoppingBag",shoppingBag.toJSONString(),7)}changeCountry(document.getElementById("selCountry"))}function updateShoppingBagQuantities(a){strStockCode=a.parentNode.parentNode.getElementsByTagName("td")[0].firstChild.nodeValue;var b=findBagIndex(strStockCode);if(a.value===""){return false}a.readonly=true;if(isNaN(a.value)){a.value=shoppingBag.products[b].Count}else{a.value=Math.round(a.value);shoppingBag.count=shoppingBag.count-shoppingBag.products[b].Count;shoppingBag.totalGBPValue=shoppingBag.totalGBPValue-(shoppingBag.products[b].GBPValue*shoppingBag.products[b].Count);shoppingBag.totalGBPIncVATValue=shoppingBag.totalGBPIncVATValue-(shoppingBag.products[b].GBPIncVATValue*shoppingBag.products[b].Count);shoppingBag.totalUSDValue=shoppingBag.totalUSDValue-(shoppingBag.products[b].USDValue*shoppingBag.products[b].Count);shoppingBag.products[b].Count=a.value;shoppingBag.count=parseInt(shoppingBag.count,10)+parseInt(shoppingBag.products[b].Count,10);shoppingBag.totalGBPValue=shoppingBag.totalGBPValue+(shoppingBag.products[b].GBPValue*shoppingBag.products[b].Count);shoppingBag.totalGBPIncVATValue=shoppingBag.totalGBPIncVATValue+(shoppingBag.products[b].GBPIncVATValue*shoppingBag.products[b].Count);shoppingBag.totalUSDValue=shoppingBag.totalUSDValue+(shoppingBag.products[b].USDValue*shoppingBag.products[b].Count);elTR=document.getElementById("tblShoppingBag").getElementsByTagName("tfoot")[0].getElementsByTagName("tr")[0];if(readCookie("VAT")=="1"){elTR.getElementsByTagName("td")[1].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPIncVATValue)}else{elTR.getElementsByTagName("td")[1].firstChild.nodeValue="\u00A3"+formatCurrency(shoppingBag.totalGBPValue)}elTR.getElementsByTagName("td")[2].firstChild.nodeValue=shoppingBag.count;changeCountry(document.getElementById("selCountry"));createCookie("shoppingBag",shoppingBag.toJSONString(),7)}a.readonly=false}function formatCurrency(f){var e=parseFloat(f);if(isNaN(e)){e=0}var g="";if(e<0){g="-"}e=Math.abs(e);e=e*100;e=e.toFixed(11);e=parseInt(Math.ceil(e),10);e=e/100;s=String(e);if(s.indexOf(".")<0){s+=".00"}if(s.indexOf(".")==(s.length-2)){s+="0"}f=g+s;var c=",";var b=f.split(".",2);var h=b[1];e=parseInt(b[0],10);if(isNaN(e)){return""}g="";if(e<0){g="-"}e=Math.abs(e);var o=String(e);b=[];while(o.length>3){var m=o.substr(o.length-3);b.unshift(m);o=o.substr(0,o.length-3)}if(o.length>0){b.unshift(o)}o=b.join(c);if(h.length<1){f=o}else{f=o+"."+h}f=g+f;return f}function createCookie(c,d,e){var a="";if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));a="; expires="+b.toGMTString()}document.cookie=c+"="+escape(d)+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)===0){return unescape(f.substring(e.length,f.length))}}return null}function eraseCookie(a){createCookie(a,"",-1)}function toggleDeliveryAddress(a){if(a){document.getElementById("txtDeliveryName").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddressStreet").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddress2").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddress3").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddressCity").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddressCounty").parentNode.parentNode.style.display="none";document.getElementById("txtDeliveryAddressPostCode").parentNode.parentNode.style.display="none";divs=getElementsByClass("row",document.getElementById("txtDeliveryAddressPostCode").parentNode.parentNode.parentNode,"div");divs[divs.length-1].style.display="none"}else{el=document.getElementById("txtDeliveryName");strName="";elTitle=document.getElementById("selTitle");strTitle=elTitle.options[elTitle.selectedIndex].text;if(strTitle!="Unspecified"){strName+=strTitle+" "}strName+=document.getElementById("txtForename").value+" ";strName+=document.getElementById("txtSurname").value;el.value=strName;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddressStreet");el.value=document.getElementById("txtInvoiceAddressStreet").value;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddress2");el.value=document.getElementById("txtInvoiceAddress2").value;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddress3");el.value=document.getElementById("txtInvoiceAddress3").value;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddressCity");el.value=document.getElementById("txtInvoiceAddressCity").value;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddressCounty");el.value=document.getElementById("txtInvoiceAddressCounty").value;el.parentNode.parentNode.style.display="block";el=document.getElementById("txtDeliveryAddressPostCode");el.value=document.getElementById("txtInvoiceAddressPostCode").value;el.parentNode.parentNode.style.display="block";divs=getElementsByClass("row",el.parentNode.parentNode.parentNode,"div");divs[divs.length-1].style.display="block"}}function checkShoppingBagForm(a,b){errFound=false;errMsg="The following problems were found:\n";if(a.txtForename.value===""){errFound=true;errMsg+="Please enter your forename.\n"}if(a.txtSurname.value===""){errFound=true;errMsg+="Please enter your surname.\n"}if(a.txtEmail.value===""){errFound=true;errMsg+="Please enter your email address.\n"}else{if(!String(a.txtEmail.value).trim().testEmail()){errFound=true;errMsg+="Please enter a valid email address.\n"}}if(a.txtInvoiceAddressStreet.value===""){errFound=true;errMsg+="Please enter the first line of the card registered address.\n"}if(a.txtInvoiceAddressCity.value===""){errFound=true;errMsg+="Please enter the city of your invoice address.\n"}if(a.txtInvoiceAddressPostCode.value===""){errFound=true;errMsg+="Please enter the postcode/ZIP code of the card registered address.\n"}if(!a.chkMatchingAddresses.checked){if(a.txtDeliveryAddressStreet.value===""){errFound=true;errMsg+="Please enter the first line of your delivery address.\n"}if(a.txtDeliveryAddressCity.value===""){errFound=true;errMsg+="Please enter the city of your delivery address.\n"}if(a.txtDeliveryAddressPostCode.value===""){errFound=true;errMsg+="Please enter the postcode/ZIP code of your delivery address.\n"}}if(errFound){alert(errMsg);return false}if(!b){a.submit()}return true}function initTellAFriend(){addListener(document.getElementById("frmtellafriend"),"submit",function(a){doTellAFriend(this);cancelEvent(a)})}function doTellAFriend(a){strRecipientEmail=String(document.getElementById("txtRecipientEmail").value);strSenderName=String(document.getElementById("txtSenderName").value);strMessage=String(document.getElementById("txtMessage").value);strURL=String(document.getElementById("txtURL").value);strURLDescription=String(document.getElementById("txtURLDescription").value);errFound=false;errMsg="The following problems were found:\n\n";if(strRecipientEmail===""){errFound=true;errMsg+="Please enter your friend's email address.\n"}else{if(!strRecipientEmail.trim().testEmail()){errFound=true;errMsg+="Please enter a valid email address for your friend.\n"}}if(strSenderName===""){errFound=true;errMsg+="Please enter your name.\n"}if(errFound){alert(errMsg)}else{startLoading();strAjaxParams="txtRecipientEmail="+escape(strRecipientEmail)+"&txtSenderName="+escape(strSenderName)+"&txtMessage="+escape(strMessage)+"&txtURL="+escape(strURL)+"&txtURLDescription="+escape(strURLDescription);strAjaxURL="/tellafriend.asp";ajax(strAjaxURL,strAjaxParams,doneTellAFriend)}}function doneTellAFriend(){getPage("ToldAFriend");setTimeout(stopLoading,100)}function initSearchFormSubmit(){addListener(document.forms[0],"submit",function(a){doSearch(this);cancelEvent(a)})}function doSearch(a){errFound=false;errMsg="The following problems were found:\n\n";switch(document.getElementById("Price").options[document.getElementById("Price").selectedIndex].value){case"gt":if(fixInt(document.getElementById("PriceFrom").value)===""){errFound=true;errMsg+="Please enter a valid minimum price\n"}break;case"lt":if(fixInt(document.getElementById("PriceTo").value)===""||fixInt(document.getElementById("PriceTo").value)<=0){errFound=true;errMsg+="Please enter a valid maximum price\n"}break;case"b":if(String(fixInt(document.getElementById("PriceFrom").value))===""){errFound=true;errMsg+="Please enter a valid minimum price\n"}if(fixInt(document.getElementById("PriceTo").value)===""||fixInt(document.getElementById("PriceTo").value)<=0){errFound=true;errMsg+="Please enter a valid maximum price\n"}break;default:document.getElementById("PriceFrom").value="0";document.getElementById("PriceTo").value="0";break}if(errFound){alert(errMsg)}else{a.submit()}}function initSearchPriceOperator(){el=document.getElementById("Price");addListener(el,"change",function(a){changeSearchPriceOperator(this.value);cancelEvent(a)});changeSearchPriceOperator(el.options[el.selectedIndex].value)}function changeSearchPriceOperator(a){document.getElementById("minprice").style.display="none";document.getElementById("maxprice").style.display="none";switch(a){case"lt":document.getElementById("PriceFrom").value="0";document.getElementById("maxprice").style.display="inline";break;case"gt":document.getElementById("PriceTo").value="0";document.getElementById("minprice").style.display="inline";break;case"b":document.getElementById("minprice").style.display="inline";document.getElementById("maxprice").style.display="inline";break}}function fixInt(a){if(String(a)==="undefined"||String(a)==="null"||String(a)===""||isNaN(a)){return""}else{return parseInt(a,10)}};
