// ActionScript Document if(document.all && !document.getElementById) { document.getElementById = function(id) { return document.all[id]; } } var lo = true; function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } var checkflag = "false"; function checkAll(field) { if (checkflag == "false") { if(!field.length){ field.checked = true; } else { for (i = 0; i < field.length; i++) { field[i].checked = true; } } checkflag = "true"; } else { if(!field.length){ field.checked = false; }else{ for (i = 0; i < field.length; i++) { field[i].checked = false; } } checkflag = "false"; } } function calcWBN(nmbr,wgt,xby,from) { vn=parseInt(nmbr.value); vw=parseFloat(wgt.value); vx=parseFloat(xby.value); if (from=="N"){ vw = vn*vx; vw = vw.toFixed(2); if(isNaN(vw)){vw='';} fwgt=wgt.id; document.getElementById(fwgt).value = vw; return vn; }else{ vn = Math.round(vw/vx); if(vn==0){vn=1;} vw = vn*vx; vw = vw.toFixed(2); if(isNaN(vn)){vn='';} fnmbr=nmbr.id; document.getElementById(fnmbr).value = vn; return vw; } } function checkDel(tick) { var kill = 0; if(!tick.length){ if (tick.checked == true){ kill = 1; } } else { for (i = 0; i < tick.length; i++) { if (tick[i].checked == true){ kill++; } } } if (kill > 0){ if (confirm("Deleting items cannot be undone. Are you sure?")){ return true; } else { return false; } } else { alert('Nothing to Remove!'); return false; } } /*function checkDel(tick,backto) { var kill = 0; if(!tick.length){ if (tick.checked == true){ kill = 1; } } else { for (i = 0; i < tick.length; i++) { if (tick[i].checked == true){ kill++; } } } if (kill > 0){ if (confirm("Deleting items cannot be undone. Are you sure?")){ document.viewBasket.action = backto; return true; } else { return false; } } else { alert('Nothing to Remove!'); return false; } }*/ function checkAddLast(tick) { var kill = 0; if(!tick.length){ if (tick.checked == true){ kill = 1; } } else { for (i = 0; i < tick.length; i++) { if (tick[i].checked == true){ if (eval("cqty"+i+".value")==0){ kill = -100;} kill++; } } } if (kill > 0){ return true; } else if (kill < 0){ alert('One or more of the items you have chosen to reOrder has a zero quantity!\nPlease either change the quantity or deselect the item before ReOrdering. Thanks!'); return false; } else { alert('Nothing Chosen to ReOrder!'); return false; } } /*function checkAddLast(tick) { var kill = 0; if(!tick.length){ if (tick.checked == true){ kill = 1; } } else { for (i = 0; i < tick.length; i++) { if (tick[i].checked == true){ kill++; } } } if (kill > 0){ return true; } else { alert('Nothing to Add!'); return false; } }*/ function checkQty(it) { it = it.value; if(it == 0 ){ return ''; }else if(parseInt (it, 10)!== parseFloat(it)){ vw = Math.ceil(it); alert('This item is only sold in whole quantities.\n {Adjusting to: '+vw+' } Please revise your order if required.'); }else{ return it; } return vw; } function checkMT(qtyin) { var mt = false; if(!qtyin.length){ if ( parseFloat(qtyin.value) > 0 ){ mt = true; } } else { for (i = 0; i < qtyin.length; i++) { if ( parseFloat(qtyin[i].value) > 0 ){ mt = true; } } } if (mt){ return true; } else { alert('Nothing to Add to Basket!'); return false; } } function skipEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } function loseOrder(qtyin){ var kilt = getCookie('noWarn'); if(!kilt){ if (lo){ var mt = false; if(!qtyin.length){ if ( parseFloat(qtyin.value) > 0 ){ mt = true; } } else { for (i = 0; i < qtyin.length; i++) { if ( parseFloat(qtyin[i].value) > 0 ){ mt = true; } } } if (mt){ lo = confirm('You have chosen items but not yet placed them in your basket!\nClicking Next, Last or Changing the Number of Products to Display\nat this point will put them back on the shelf.\nClick Add to Basket first if you wish to buy them.\n(You can still change your mind later)\n\nClick OK to see this warning next time. Click Cancel to never be warned again (this visit).'); if (!lo){setCookie('noWarn',1);} } } } } function lateOrder(){ var kilt = getCookie('noLate'); if(!kilt){ if (lo){ lo = confirm('Orders must be placed at least 24 hours before delivery.\nIf Placed now this order will be delivered NEXT week.\nYou may phone during office hours to check if delivery tomorrow is possible!'); /* lo = confirm('If confirmed now by clicking OK this order will be delivered\nAFTER CHRISTMAS\nIf you want it before Christmas call the\nOFFICE IMMEDIATELY on 01292 541369');*/ if (!lo){setCookie('noLate',1);} } } } /* name - name of the cookie value - value of the cookie [expires] - expiration date of the cookie (defaults to end of current session) [path] - path for which the cookie is valid (defaults to path of calling document) [domain] - domain for which the cookie is valid (defaults to domain of calling document) [secure] - Boolean value indicating if the cookie transmission requires a secure transmission * an argument defaults when it is assigned null as a placeholder * a null placeholder is not required for trailing omitted arguments */ function setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } /* name - name of the desired cookie return string containing value of specified cookie or null if cookie does not exist */ function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } /* name - name of the cookie [path] - path of the cookie (must be same as path used to create cookie) [domain] - domain of the cookie (must be same as domain used to create cookie) path and domain default if assigned null or omitted if no explicit argument proceeds */ function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // date - any instance of the Date object // * hand all instances of the Date object to this function for "repairs" function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); }