var cTabIdx=-1,loadHandlers=[];function HandleLoaded(){var a;for(a=0;a\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t \t\t\t\t\t\t\t\t \t'+ c+'\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t
';d.appendChild(h);return FindDialogContent(d.lastChild)}return null} function FindDialogContent(a){var b;for(b=0;b=0;b--){var c=a.childNodes[b];if(c.tagName=="DIV")return c}}return null} function CancelDialog(){var a=GetElem("GUILayer");if(a)if(a.hasChildNodes()){var b=null,c=null,d;for(d=a.childNodes.length-1;d>=0;d--){var e=a.childNodes[d];if(e.tagName=="DIV")if(c==null)c=e;else{b=e;break}}if(c){DestroyChildren(c);a.removeChild(c)}if(!b){DestroyChildren(a);a.style.visibility="hidden"}}}function DestroyChildren(a){for(;a&&a.hasChildNodes();)a.removeChild(a.firstChild)} var isIE=/*@cc_on!@*/false,xmlhttp=null,requestOutBlock=null,requestCallback=null,EventType={Completed:0,URLRequest:1,URLProcessing:3,Error:4,Refresh:5},currentEventType=0;function Request(a,b,c,d){this.m_url=a;this.m_sendBlock=b;this.m_receiveBlock=c;this.m_requestCallback=d}var pendingRequests=[];function HandleError(a){alert(a);HandleEvent(EventType.Error)} function HandleEvent(a){if(a==EventType.Refresh)a=currentEventType;currentEventType=a;var b=a==EventType.Completed?"event_completed":a==EventType.URLRequest?"event_processUrl":a==EventType.URLProcessing?"event_processUrl":"event_error";a=a==EventType.Completed?"Completed":a==EventType.URLRequest?"Transmitting data...":a==EventType.URLProcessing?"Processing data":"Error!";var c="";if(pendingRequests.length)c=" (+ "+pendingRequests.length+" pending requests...)";b="planning/prototype/"+b+".png";var d= GetElem("eventImg");if(d)d.src=b;if(b=GetElem("statusTxt"))b.innerHTML="Status: "+a+c}function InitXMLHttp(){xmlhttp=null;if(window.XMLHttpRequest)xmlhttp=new XMLHttpRequest;else if(window.ActiveXObject)xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")} function RequestURL(a,b,c,d){HandleEvent(EventType.URLRequest);if(requestOutBlock!=null){d=new Request(a,b,c,d);pendingRequests.push(d);HandleEvent(EventType.Refresh)}else{a=a;var e="";b=GetElem(b);requestOutBlock=c=GetElem(c);requestCallback=d;if(b)e="block="+SmartEscape(b.innerHTML);if(c){InitXMLHttp();if(xmlhttp!=null){if(a){d=a.indexOf("?");if(d>=0){if(e!="")e+="&";e+=a.substr(d+1);a=a.substr(0,d)}}xmlhttp.open("POST",a,true);xmlhttp.onreadystatechange=RequestURLResponse;xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");xmlhttp.send(e)}else HandleError("Could not get URL! (Error 0x1000; Browser incompatibility)")}else HandleError("Could not get URL into non-existant element!")}}function ProcessNextPendingRequest(){var a=pendingRequests.shift();a&&RequestURL(a.m_url,a.m_sendBlock,a.m_receiveBlock,a.m_requestCallback)} function RequestURLResponse(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){HandleEvent(EventType.URLProcessing);if(requestOutBlock){requestOutBlock.innerHTML=xmlhttp.responseText;if(requestOutBlock.hasChildNodes()){var a=requestOutBlock.firstChild;a.getAttribute&&a.getAttribute("err")&&HandleError(a.getAttribute("errDesc"))}requestOutBlock=null;a=requestCallback;requestCallback=null;a&&a();HandleEvent(EventType.Completed)}else HandleError("Received data not set to be inserted anywhere!")}ProcessNextPendingRequest()}} function SmartEscape(a){return encodeURIComponent(a)}function RemoveHTML(a){if(isIE)return a.replace(/
/g,"\n").replace(/<[^>]*>/g,"");var b=document.createElement("div");b.innerHTML=a;return b.textContent?b.textContent:b.innerText?b.innerText:""} FU={index:1,makeFrame:function(a){var b=document.createElement("DIV"),c="uploadFrame_"+FU.index++;b.innerHTML='";document.body.appendChild(b);b=GetElem(c);if(a&&typeof a.onComplete=="function")b.onComplete=a.onComplete;return c},form:function(a,b){a.setAttribute("target",b)},submit:function(a,b){FU.form(a,FU.makeFrame(b));return b&&typeof b.onStart=="function"?b.onStart():true},loaded:function(a){var b= document.getElementById(a);a=b.contentDocument?b.contentDocument:b.contentWindow?b.contentWindow.document:window.frames[a].document;a.location.href!="about:blank"&&typeof b.onComplete=="function"&&b.onComplete(a.body.innerHTML)}};function writeCookie(a,b,c){var d="";if(c){d=new Date;d.setTime(d.getTime()+c*24*60*60*1E3);d="; expires="+d.toGMTString()}document.cookie=a+"="+b+d+"; path=/"} function readCookie(a){a=a+"=";for(var b=document.cookie.split(";"),c=0;c1)b[c+1]--;else confirm("Really remove this item from your basket?")&&b.splice(c,2);break}}writeCookie("mbnCart",b.join(":"),1)}CartUpdateBasketTotals()}function CartBuyNow(a){CartAddToCard(a)} function CartUpdateBasketTotals(){if(g_pageIdx=="Basket"&&typeof mbn_immediateRefresh!="undefined"){var a=GetElem("deliveryChoice");a&&writeCookie("mbnDeliveryOption",a.value,1);if((a=GetElem("promoCode"))&&a.value!=""){writeCookie("mbnPromo",a.value,1);alert("Promotion has been applied to the basket.")}mbn_immediateRefresh()}RequestURL("cartItems.php?f=sumBasket",null,"receiveBlock",CartDoUpdateBasketTotals)} function CartDoUpdateBasketTotals(){var a=GetElem("basketSummary");if(a){var b=GetElem("receiveBlock").innerHTML.split(":");if(b.length==2)a.innerHTML=b[0]+" items = "+PrettyPrintPrice(b[1])}}function CartDoCheckout(){GetElem("cartSubmitForm").submit()} function PayInvoice(){var a=GetElem("invoiceNumber").value;if(a==""){alert("Please enter an invoice number!");return false}var b=parseInt(parseFloat(GetElem("invoiceAmount").value)*100),c=PrettyPrintPrice(b).substr(7);if(b<=0){alert("Please enter the invoice amount!");return false}if(confirm("Proceed to PayPal to pay securely for 'Invoice #"+a+"' of value \u00a3"+c+"?")){GetElem("invoiceFrm_invoiceNumber").value="Invoice #"+a;GetElem("invoiceFrm_invoiceAmount").value=c;GetElem("invoiceSubmitForm").submit(); return true}return false}function PrettyPrintPrice(a){for(a=""+a;a.length<3;)a="0"+a;return a="£"+a.substr(0,a.length-2)+"."+a.substr(a.length-2)}function mbn_navigate(a){location.href="?idx="+a;return false}function RedirectEnterKey(a){a=ReconcileEvent(a);if(a.target)if(a.keyCode==13&&(a.target.type=="text"||a.target.type=="password")){GetTopDialog()||GetDefaultBtn()&&GetDefaultBtn().onclick();return false}return true}document.onkeypress=RedirectEnterKey;loadHandlers.push(CartUpdateBasketTotals);