var nCols=8;function SetCookie(a,b){date=new Date;date.setTime(date.getTime()+31536000000);document.cookie=a+"="+b+"; expires="+date.toGMTString()+"; path=/";}function GetCookie(a){a+="=";var b=document.cookie.split(";");for(i=0;i<b.length;i++){var c=TrimStart(b[i]);if(c.indexOf(a)==0){return c.substring(a.length,c.length);}}return"";}function TrimStart(a){for(j=0;j<a.length;j++){if(a.substring(j,j+1)!=" "){return a.substring(j,a.length);}}return"";}function GetItemString(c,b){var d="";for(var a=0;a<nCols;a++){d+=c[a+b]+"|";}return d;}function AddItem(a,k,f,b,e,l,g,h){var d=GetCookie("mhbasket");var c="";var m=false;split=d.split("|");for(i=0;i+nCols<=split.length;i+=nCols){if(split[i]==a){c+=a+"|"+(parseInt(k)+parseInt(split[i+1]))+"|"+f+"|"+b+"|"+e+"|"+l+"|"+g+"|"+h+"|";m=true;}else{c+=GetItemString(split,i);}}if(!m){c+=a+"|"+k+"|"+f+"|"+b+"|"+e+"|"+l+"|"+g+"|"+h+"|";}SetCookie("mhbasket",c);}function ClearCookie(){SetCookie("mhbasket","");GetCookie("mhbasket");}function DelCookie(a){date=new Date;date.setTime(date.getTime()-172800000);document.cookie=a+"=; expires=Mon, 01-Jan-2001 00:00:01 GMT; path=/";}function DeleteItem(b){var a=GetCookie("mhbasket");if(a==""){return"";}split=a.split("|");newVal="";for(i=0;i+nCols<=split.length;i+=nCols){if(split[i]!=b){newVal+=GetItemString(split,i);}}SetCookie("mhbasket",newVal);window.location=window.location;}function EmptyBasket(){if(!confirm("Remove all items from your shopping basket?")){return;}SetCookie("mhbasket","");window.location=window.location;}function SetCookie(a,b){date=new Date;date.setTime(date.getTime()+31536000000);document.cookie=a+"="+b+"; expires="+date.toGMTString()+"; path=/";}function UpdateItem(id){qty=eval("document.FormBasket.txtQty"+id).value;if(qty==""){qty="0";}wrap=eval("document.FormBasket.chkWrap"+id).checked?"1":"0";var val=GetCookie("mhbasket");newVal="";price="";split=val.split("|");for(i=0;i+nCols<=split.length;i+=nCols){if(split[i]==id){newVal+=id+"|"+qty+"|"+split[i+2]+"|"+wrap+"|"+split[i+4]+"|"+split[i+5]+"|"+split[i+6]+"|"+split[i+7]+"|";}else{newVal+=GetItemString(split,i);}}SetCookie("mhbasket",newVal);RefreshBasket();}function UpdateItemQty(id){qty=eval("document.FormBasket.txtQty"+id).value;if(qty==""){qty="0";}var val=GetCookie("mhbasket");newVal="";price="";split=val.split("|");for(i=0;i+nCols<=split.length;i+=nCols){if(split[i]==id){newVal+=id+"|"+qty+"|"+split[i+2]+"|"+split[i+3]+"|"+split[i+4]+"|"+split[i+5]+"|"+split[i+6]+"|"+split[i+7]+"|";}else{newVal+=GetItemString(split,i);}}SetCookie("mhbasket",newVal);}function FormatPrice(b){var c=parseFloat(b).toFixed(2);var d="";var a=0;for(i=c.length-4;i>=0;i--){a++;d=c.substring(i,i+1)+d;if(a%3==0&&a>0&&i!=0){d=","+d;}}return"&pound;"+d+c.substring(c.length-3,c.length);}function RefreshBasket(){var delIndex=0;var incVat=true;if(eval("document.FormBasket.cboDel")!=null){delIndex=document.FormBasket.cboDel.selectedIndex;incVat=(document.FormBasket.cboDel.options[delIndex].value!="WORLD");}var VAT=1.175;var val=GetCookie("mhbasket");var SubTotal=0;var NonDelTotal=0;split=val.split("|");for(var i=0;i+nCols<=split.length;i+=nCols){var id=split[i];var price=parseFloat(split[i+2]);if(!incVat&&split[i+5]=="1"&&split[i+6]=="0"){price=parseFloat(parseInt(100*price/VAT))/100;}var lineTotal=parseFloat(split[i+1])*price;SubTotal+=lineTotal;if(split[i+5]=="0"){NonDelTotal+=lineTotal;}if(document.getElementById("lblPrice"+id)==null){continue;}document.getElementById("lblPrice"+id).innerHTML=FormatPrice(price);document.getElementById("lblTotal"+id).innerHTML=FormatPrice(lineTotal);}document.getElementById("lblSubTotal").innerHTML=FormatPrice(SubTotal);var delivery=0;if(eval("document.FormBasket.cboDel")==null){document.getElementById("lblOrderTotal").innerHTML=FormatPrice(SubTotal);ShowCurrencyConversion(SubTotal);}else{delivery=parseFloat(CalculateDelivery(SubTotal-NonDelTotal));document.getElementById("lblDelivery").innerHTML=(delIndex==0)?"&nbsp;":(delivery==0)?"FREE":FormatPrice(delivery);document.FormBasket.hidDelType.value=document.FormBasket.cboDel.selectedIndex;document.getElementById("lblOrderTotal").innerHTML=(delIndex==0)?"&nbsp;":FormatPrice(SubTotal+delivery);ShowCurrencyConversion(SubTotal+delivery);}}function ShowCurrencyConversion(b){var c="";for(var a=0;a<curDescs.length;a++){if(c!=""){c+=",";}c+="&nbsp;&nbsp;"+curDescs[a]+"<b>"+parseFloat(b*curMults[a]).toFixed(2)+"</b>";}document.getElementById("lblCurConv").innerHTML="<b>"+FormatPrice(b)+'</b>&nbsp;&nbsp;<img src="/static_images/arrow.gif" />'+c;}function RefreshGiftList(){var val=GetCookie("mhbasket");split=val.split("|");for(i=0;i+nCols<=split.length;i+=nCols){if(split[i+1]=="0"){continue;}txtQty=eval("document.FormBasket.txtQty"+split[i]);if(txtQty!=null){txtQty.value=split[i+1];}}}orderValuesEU=new Array(2000,1800,1600,1400,1200,1000,900,800,700,600,525,475,425,375,325,275,225,175,150,125,100,75,50,0);orderValuesWorld=new Array(3000,2500,2200,2000,1800,1600,1400,1200,1000,900,800,700,600,500,450,400,350,300,250,200,175,150,125,100,75,50,0);ppEU=new Array(225,195,175,155,139,129,119,109,99,95,85,79,75,65,58,49,43,37,33,29,23,19,16,14);ppWorld=new Array(355,325,285,265,245,215,195,179,165,145,125,115,105,98,92,87,77,66,55,49,43,38,32,27,21,19,17);function CalculateDelivery(c){var a=0;var d=document.FormBasket.cboDel.options[document.FormBasket.cboDel.selectedIndex].value;if(d=="NONE"){a=0;}else{if(d=="UK"){if(c>350){a=0;}else{a=c/10;if(a<6.5){a=6.5;}else{if(a>15){a=15;}}}}else{if(d=="EU"){for(var b=0;b<orderValuesEU.length;b++){if(c>=orderValuesEU[b]){a=ppEU[b];break;}}}else{for(var b=0;b<orderValuesWorld.length;b++){if(c>=orderValuesWorld[b]){a=ppWorld[b];break;}}}}}return a;}function ValidateQty(a){var b="";for(var d=0;d<a.value.length;d++){var e=a.value.substring(d,d+1);if(e>="0"&&e<="9"){b+=e;}}a.value=b;}function LimitQty(b,a){ValidateQty(b);if(b.value!=""&&parseInt(b.value)>a){b.value=a;}}function LimitLength(b,a){if(b.value.length>=a){b.value=b.value.substring(0,a);}}function ToCheckout(){if(eval("document.FormBasket.cboDel")!=null&&document.FormBasket.hidDelType.value==0){alert("Please select a delivery location");}else{document.FormBasket.submit();}}function ToConfirmation(stage){var reqr;var desc;if(stage==1){reqr=["txtName","txtEmail","txtAddr1","txtPostcode","txtPhone"];desc=["Name","Email address","Address","Postcode","Phone number"];}else{if(stage==3){reqr=["txtCardNo","txtCardName","txtCardExpiry","txtCardCode"];desc=["Card Number","Name On Card","Expiry Date","Security Code"];}else{var reqr=new Array(0);var desc=new Array(0);}}var err="";for(var i=0;i<reqr.length;i++){txt=eval("document.FormBasket."+reqr[i]);if(txt==null){continue;}if(txt.value==""){err+="\n"+desc[i];}}if(err!=""){alert("Your order cannot be processed until all of\nthe following fields have been filled in:\n__________________________________\n"+err);}document.FormBasket.submit();}function ShowImage(c,d,a,b){iw=a;ih=b;a+=50;b+=100;if(d==""){b-=12;}tw=d.length*8;while(a<tw){tw-=a;b+=12;}imgwin=window.open("","","width="+a+",height="+b+",left=0,top=0,toolbar=0,location=0,status=0,directories=0,menubar=0,resizable=1,scrollbars=0");imgwin.document.writeln("<html>");imgwin.document.writeln("<head>");imgwin.document.writeln("<title>View Large Image</title>");imgwin.document.writeln('<STYLE type="text/css"><!--');imgwin.document.writeln("p { font: 11px/14px verdana, arial, helvetica, sans-serif; color: #666; text-align: center; }");imgwin.document.writeln("a { text-decoration: none; color: #0033ff;}");imgwin.document.writeln("a:hover { text-decoration: underline; color: #0033ff;}");imgwin.document.writeln("--> </STYLE>");imgwin.document.writeln("</head>");imgwin.document.writeln("<body>");imgwin.document.writeln('<p align="center"><img src="'+c+'" border=0 width='+iw+" height="+ih+"></p>");if(d!=""){imgwin.document.writeln('<p align="center"><b>'+d.replace("|","'")+"</b></p>");}imgwin.document.writeln('<p align="center"><a href="javascript:window.close()">Close Window</a></p>');imgwin.document.writeln("</body>");imgwin.document.writeln("</html>");imgwin.document.close();}function AddToBasket(){qty=document.FormItem.txtQty.value;if(qty==""||parseInt(qty)==0){alert("Invalid quantity");}else{AddItem(myId,qty,myPrice,document.FormItem.chkWrap.checked?"1":"0",myWws,1,0,myPromo);document.FormItem.txtQty.value="";document.FormItem.chkWrap.checked=false;alert("Item added to shopping basket");$("#divCheckout").not(":visible").fadeIn("slow");}}function SetPrinterFriendly(){tdPF=document.getElementById("tdPFDetails");if(tdPF==null){return;}pfData=tdPF.innerHTML;tdPF.innerHTML='<IMG src="/static_images/packing.jpg">';}function PrinterFriendly(){pfwin=window.open("","","width=600,height=800,left=0,top=0,toolbar=0,location=0,status=0,directories=0,menubar=1,resizable=1,scrollbars=1");pfwin.document.writeln("<html>");pfwin.document.writeln("<head>");pfwin.document.writeln("<title>Printer Friendly View</title>");pfwin.document.writeln("<LINK media='all' href='MulberryHallPrint.css' type='text/css' rel='stylesheet'>");pfwin.document.writeln("</head>");pfwin.document.writeln("<body>");pfwin.document.writeln(pfData);pfwin.document.writeln('<p align="center"><a href="javascript:window.print()">Print</a>');pfwin.document.writeln("<span style='padding-right: 30px'>&nbsp;</span><a href=\"javascript:window.close()\">Close Window</a></p>");pfwin.document.writeln("</body>");pfwin.document.writeln("</html>");pfwin.document.close();}function _SendToFriend(a){var b=window.open("/SendToFriend.aspx?url="+a,"SendToFriend","width=450,height=420,left=0,top=0,toolbar=0,location=0,status=0,directories=0,menubar=0,resizable=0,scrollbars=0");b.focus();}var blankSearchText="Search the shop...";function SetSearchBox(b){var a=$("#"+b);a.focus(function(){var c=$(this);c.css("color","#000");if(c.val()==blankSearchText){c.val("");}});a.blur(function(){var c=$(this);c.css("color","#666");if(c.val()==""){c.val(blankSearchText);}});a.keypress(function(c){if(c.keyCode==13){DoSearch(this.id);return false;}});a.blur();}function DoSearch(c){var a=$("#"+c);var b=a.val();if(b!=""&&b!=blankSearchText){window.location="/Search/"+b.replace(/"/g,"");}else{alert("Please enter search keywords");a.focus();}}function SetNavImage(c,a){var b=c.replace("aNav","");$("#img"+b).attr("src","/static_images/Nav/"+a+"/"+b+".gif");}