Object.extend(Event,{_domReady:function(){if(arguments.callee.done)return;arguments.callee.done=true;if(this._timer)clearInterval(this._timer);this._readyCallbacks.each(function(f){f()});this._readyCallbacks=null;},onDOMReady:function(f){if(!this._readyCallbacks){var domReady=this._domReady.bind(this);if(document.addEventListener)document.addEventListener("DOMContentLoaded",domReady,false);if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState))domReady();},10);}Event.observe(window,'load',domReady);Event._readyCallbacks=[];}Event._readyCallbacks.push(f);}});function applyMenuFolding(menuId){var els=$$("#"+menuId+" li.level0");var lastElement;els.each(function(el){var a=el.firstDescendant();var ul=a.next('ul');if(ul!=undefined){ul.hide();a.href='#'+ul.firstChild.id;a.observe('click',function(event){var el=Event.element(event).next('ul');var others=$$("li.level0 ul");others.each(function(other){if(other!=this)Effect.BlindUp(other,{duration:0.25});},el);Effect.BlindDown(el,{duration:0.25});return true;});}});if($('jshider'))$('jshider').id='jshided';}function applyGuaranteeDetailHiding(){var o=document.getElementById('guarantees');if(o){var els=$$(".guaranteeDesc");els.each(function(el){el.hide();label=$(el.id.toString().replace('gid','gl'));label.observe('click',function(event){exp=$(this.id.replace('gl','gid'));Effect.toggle(exp,'blind',{duration:0.25});});el.observe('click',function(event){Effect.toggle(Event.element(event),'blind');});});$('guaranteeDesc').id='guaranteeDescd';}}applyGuaranteeDetailHiding();function getCookieValueByName(name){if(document.cookie.length>0){var cookie=document.cookie.split("; ");for(var i=0;i<cookie.length;i++){var value=String(cookie[i]).split("=");if(String(value[0]).match(name)!=null){return(unescape(value[1]));}}}return null;}function testCookieLen(name){var j=0;var cookie=document.cookie.split(" ;");for(var i=0;i<cookie.length;i++){var value=String(cookie[i]).split("=");if(String(value[0]).match(name)!=null){j++;}}return j;}function testCompareCookie(name){var j=0;var cookies=document.cookie.split(";");if(cookies.length<=1){j=0;return j;}for(var i=0;i<cookies.length;i++){if(cookies[i].match(name)){if(!cookies[i].match('=')){j=0;return j;}var cookie=cookies[i].split("=");var cookieLen=cookie[1].split("%2C");j=cookieLen.length;}}return j;}function appendCookieValueByName(name,valueToAppend,id){var newValue=getCookieValueByName(name);var thisTickBox=document.getElementById(id);var newCookieAr=new Array();if(thisTickBox.checked==false){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){if(cookies[i].match(name)){var cookie=cookies[i].split("=");var cookieItems=cookie[1].split("%2C");for(var n=0;n<cookieItems.length;n++){if(cookieItems.length==0){newCookie=' ';}else{if(cookieItems[n]!=valueToAppend&&cookieItems[n]!='undefined'){newCookieAr.push(cookieItems[n]);}}}var newCookie=newCookieAr.toString();}}document.cookie=name+"="+escape(newCookie)+"; path=/";}else{if(testCompareCookie(name)==3){alert('You can only Compare 3 products at a time');thisTickBox.checked=false;return false;}else{if(newValue==null){newValue=valueToAppend;}else{if(newValue.match(valueToAppend)){newValue2=newValue.replace(String(valueToAppend),"");newValue=newValue2;}else{newValue+=","+valueToAppend;}}document.cookie=name+"="+escape(newValue)+"; path=/";}}}function clearCompareList(){var name="comparelist";var date=new Date();date.setTime(date.getTime()+(64*24*60*60*-1000));var expires="; expires="+date.toGMTString();var values=getCookieValueByName(name);if(values!=null){if(values.indexOf(",")>-1){var comp_array=values.split(",");var part_num=0;while(part_num<comp_array.length){var id="compare"+comp_array[part_num];var thisTickBox=document.getElementById(id);if(thisTickBox!=null){thisTickBox.checked=false;}part_num+=1;}}else{var id="compare"+values;var thisTickBox=document.getElementById(id);if(thisTickBox!=null){thisTickBox.checked=false;}}}document.cookie=name+"=''"+expires+"; path=/";}function openWin(URL){window.open(URL,'ReservationPrint','scrollbars=no, resizable=yes, width=650 height=600,');}function ChangePostcode(obj){if(obj.value.length<5||obj.value.length>9){alert("Invalid Postcode. Please enter postcode correctly, i.e. AB12 3CD");if(obj.id=='txtBillingPostcode'){return false;}}else{if(obj.value.indexOf(' ')==-1){var postcodeset1=obj.value;var postcodeset2=obj.value;postcodeset1=obj.value.substring(0,obj.value.length-3);postcodeset2=obj.value.substring(obj.value.length-3,99);temppostcodestr=postcodeset1+" "+postcodeset2;obj.value=temppostcodestr.toUpperCase();}else{obj.value=obj.value.toUpperCase();}}}function ToUpperCase(obj){obj.value=obj.value.toUpperCase()}function ToProperCase(obj){var first,the_rest;first=obj.value.charAt(0);the_rest=obj.value.substring(1);obj.value=first.toUpperCase()+the_rest.toLowerCase();}function ToCapitalAfterSpace(obj){obj.value=obj.value.toLowerCase();obj.value=obj.value.substr(0,1).toUpperCase()+obj.value.substr(1,obj.value.length-1);for(i=0;i<obj.value.length;i++){if(obj.value.substr(i,1)==" "){obj.value=obj.value.substr(0,i+1)+obj.value.substr(i+1,1).toUpperCase()+obj.value.substr(i+2,obj.value.length-i);}}obj.value=RobsReplace(obj.value,'/');}function ToCapitalAfterSpaceOrHyphen(obj){obj.value=obj.value.toLowerCase();obj.value=obj.value.substr(0,1).toUpperCase()+obj.value.substr(1,obj.value.length-1);for(i=0;i<obj.value.length;i++){if(obj.value.substr(i,1)==" "||obj.value.substr(i,1)=="-"){obj.value=obj.value.substr(0,i+1)+obj.value.substr(i+1,1).toUpperCase()+obj.value.substr(i+2,obj.value.length-i);}}obj.value=RobsReplace(obj.value,'/');}function isDigit(c){return((c>='0')&&(c<='9'))}function RobsReplace(sStr,sStrToFilterOut){var s='';for(var i=0;i<sStr.length;i++){if(sStr.charAt(i)!=sStrToFilterOut)s+=sStr.charAt(i);}return s;}function ValidateTelephoneNumber(obj){for(i=0;i<obj.value.length;i++){if(obj.value.substr(i,1)!=" "&&isDigit(obj.value.substr(i,1))!=true){alert("Telephone Number must consist of digits 0 through 9, and spaces only.");obj.value='';}}}function ValidateTelephoneNumber2(obj,type){retvalue=0;for(i=0;i<obj.value.length;i++){if(!type){type='Telephone';}if(obj.value.substr(i,1)!=" "&&isDigit(obj.value.substr(i,1))!=true){retvalue=1;alert(type+" Number must consist of digits 0 through 9, and spaces only.");obj.value='';break;}if(type=='Home'){if(obj.value.substring(0,2)=='07'){retvalue=1;alert("Please do not enter Mobile number as Home Telephone Number.");break;}}}return retvalue;}function ValidateEmailAddress(obj){if(obj.value.indexOf('@')==-1){alert("Invalid Email Address entered.");}}function submitForm(theForm,theSubmitButton){SubmitBtn_PleaseWait(theSubmitButton,'Please wait..');test_personal=Validator_PersonalDetails(theForm);test_billing=Validator_BillingAddress(theForm);test_delivery=Validator_DeliveryAddress(theForm);if(test_personal==true&&test_billing==true&&test_delivery==true){theForm.submit();}else{SubmitBtn_Reset(theSubmitButton,'Next >');}}function submitForm2(theForm,theSubmitButton,value,DisallowMobileNumberAsHomeNumber,WorkTelephoneNotNeeded,BillingCountyNeeded,DeliveryCountyNeeded){SubmitBtn_PleaseWait(theSubmitButton,'Please wait..');test_personal=Validator_PersonalDetails(theForm,DisallowMobileNumberAsHomeNumber,WorkTelephoneNotNeeded);test_billing=Validator_BillingAddress(theForm,BillingCountyNeeded);test_delivery=Validator_DeliveryAddress(theForm,DeliveryCountyNeeded);if(test_personal==true&&test_billing==true&&test_delivery==true){theForm.submit();}else{SubmitBtn_Reset(theSubmitButton,value);}}function Validator_PersonalDetails(theForm,DisallowMobileNumberAsHomeNumber,WorkTelephoneNotNeeded){errorflag=false;errormsg="The following details were not supplied or were incorrect.\n";errormsg=errormsg+"Please enter: \n\n";for(var i=0;i<theForm.elements.length;i++){if(theForm.elements[i].name.indexOf("cboAnswerMandatory")==0){if(theForm.elements[i].value==""){errorflag=true;errormsg=errormsg+"Mandatory Delivery Question not answered.\n";}}}if(theForm.txtTitle){if(theForm.txtTitle.value.length==0&&theForm.txtTitle.type=='text'){errorflag=true;errormsg=errormsg+"Title not entered.\n";}}if(theForm.txtForenames){if(theForm.txtForenames.value.length==0){errorflag=true;errormsg=errormsg+"Forename(s) not entered.\n";}}if(theForm.txtSurname){if(theForm.txtSurname.value.length==0){errorflag=true;errormsg=errormsg+"Surname not entered.\n";}}if(theForm.txtTelephoneHome){if(theForm.txtTelephoneHome.value.length==0){errorflag=true;errormsg=errormsg+"Home Telephone Number not entered.\n";}if(DisallowMobileNumberAsHomeNumber==true){if(ValidateTelephoneNumber2(theForm.txtTelephoneHome,'Home')==1){errorflag=true;errormsg=errormsg+"Mobile number is used as a home number. Please use a non mobile number\n";}}}if(theForm.txtTelephoneWork){if(WorkTelephoneNotNeeded!=true){if(theForm.txtTelephoneWork.value.length==0){errorflag=true;errormsg=errormsg+"Work Telephone Number not entered.\n";}}}if(theForm.txtEmailAddress){if(theForm.txtEmailAddress.value.indexOf('@')==-1){errorflag=true;errormsg=errormsg+"Email Address invalid.\n";}}if(theForm.txtEmailAddress){if(theForm.txtEmailAddress.value.length==0){errorflag=true;errormsg=errormsg+"Email Address not entered.\n";}}if(theForm.txtEmailAddress_reenter){if(theForm.txtEmailAddress_reenter.value.length==0){errorflag=true;errormsg=errormsg+"Email Address (Re-enter) not entered.\n";}}if(theForm.txtPassword){if(theForm.txtPassword.value.length<4||theForm.txtPassword.value.length>12){errorflag=true;errormsg=errormsg+"Please enter a password of between 4 and 12 characters.\n";}}if(theForm.txtPassword_reenter){if(theForm.txtPassword_reenter.value.length<4||theForm.txtPassword_reenter.value.length>12){errorflag=true;errormsg=errormsg+"Please enter a password of between 4 and 12 characters.\n";}}if(theForm.txtPassword_reenter){if(theForm.txtPassword.value!=theForm.txtPassword_reenter.value){errorflag=true;errormsg=errormsg+"Passwords do not match.\n";}}if(theForm.txtEmailAddress_reenter){if(theForm.txtEmailAddress.value!=theForm.txtEmailAddress_reenter.value){errorflag=true;errormsg=errormsg+"Email Addresses do not match.\n";}}validatestandardfieldsflag=false;validatestandardfieldsproblemfields="";if(theForm.txtTitle){if(ValidateStandardFields(theForm.txtTitle)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Title, ";}}if(theForm.txtForenames){if(ValidateStandardFields(theForm.txtForenames)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Forename(s), ";}}if(theForm.txtSurname){if(ValidateStandardFields(theForm.txtSurname)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Surname, ";}}if(theForm.txtTelephoneWork){if(WorkTelephoneNotNeeded!=true){if(ValidateStandardFields(theForm.txtTelephoneWork)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Work Telephone, ";}}}if(theForm.txtTelephoneHome){if(ValidateStandardFields(theForm.txtTelephoneHome)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Home Telephone, ";}}if(theForm.txtTelephoneMobile){if(ValidateStandardFields(theForm.txtTelephoneMobile)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Mobile Telephone, ";}}if(theForm.txtTelephoneFax){if(ValidateStandardFields(theForm.txtTelephoneFax)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Fax Telephone, ";}}if(theForm.txtEmailAddress){if(ValidateStandardFields(theForm.txtEmailAddress)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Email Address, ";}}if(theForm.txtEmailAddress_reenter){if(ValidateStandardFields(theForm.txtEmailAddress_reenter)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Email (re-entry) Address, ";}}if(theForm.txtPassword){if(ValidateStandardFields(theForm.txtPassword)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Password, ";}}if(theForm.txtPassword_reenter){if(ValidateStandardFields(theForm.txtPassword_reenter)==false){validatestandardfieldsflag=true;validatestandardfieldsproblemfields=validatestandardfieldsproblemfields+"Password (re-entry), ";}}if(validatestandardfieldsflag==true){errorflag=true;errormsg=errormsg+"Sorry but you must not use any exclamation marks, ampersands, slashes, or other such keyboard characters.\r\nPlease check you have entered information using standard characters i.e. a-z,minus,comma and/or brackets.\r\nFields to alter: - "+validatestandardfieldsproblemfields;}if(errorflag){alert(errormsg);return false;}else{return true;}}function submitFormValueConcatAction(obj,form,escapeflag){if(escapeflag==true){var obj_value=escape(obj.value);obj_value=obj_value.replace('/',' ');}else{var obj_value=obj.value;}var form=document.getElementById(form);form.action=form.action+obj_value;form.submit();}function submitFormValueAsAction(obj,form,escapeflag){if(escapeflag==true){var obj_value=escape(obj.value);obj_value=obj_value.replace('/',' ');}else{var obj_value=obj.value;}var form=document.getElementById(form);form.action=obj_value;form.submit();}function SubmitBtn_PleaseWait(obj,ProcessingText){obj.value=ProcessingText;obj.disabled=true;}function SubmitBtn_Reset(obj,ProcessingText){obj.value=ProcessingText;obj.disabled=false;}function checkWarranty(strMsg){var frm=document.forms.frmGuarantees;if(frm==null){document.forms.frmaddtobasket.submit();}var j=0;for(var i=0;i<frm.elements.length;i++){if(frm.elements[i].type=='checkbox'){if(frm.elements[i].checked==true){j++;}}}if(j==0){if(strMsg==''){alert("Please select a warranty from below");}else{alert(strMsg);}addWarrantyBorder();return false;}else{document.forms.frmaddtobasket.submit();}}function addWarrantyBorder(){var tbl=document.getElementById('guaranteetable');tbl.style.border="5px solid red";return true;}function delWarrantyBorder(){var tbl=document.getElementById('guaranteetable');tbl.style.border="0px";return true;}function QueryString(){var oQuery=new Object();var sSearch=document.location.search.substring(1);if(sSearch.length>0){var asKeyValues=sSearch.split('&');var asKeyValue='';for(var i=0;i<asKeyValues.length;i++){asKeyValue=asKeyValues[i].split('=');oQuery[asKeyValue[0]]=asKeyValue[1];}}return oQuery;}var myQueryStuff=new QueryString();function AddWarrantyToFormActionToSubmitToBasket(warrantyid,AlwaysChecked,theObject,thePage,thePageWithWarranty){if(theObject!=null){objtheObject=theObject;}else{objtheObject=document.getElementById('frmaddtobasket');}if(objtheObject==null)objtheObject=cmdaddtobasket;if(objtheObject==null)objtheObject=document.forms['frmaddtobasket'];if(AlwaysChecked==true)document.frmGuarantees[warrantyid].checked=true;for(i=0;i<document.frmGuarantees.length;i++){if(document.frmGuarantees[i].type=="checkbox"&&document.frmGuarantees[i].name!=warrantyid){document.frmGuarantees[i].checked=false;}}if(warrantyid!='stdman'&&warrantyid!=''&&document.frmGuarantees[warrantyid].checked==true){var thisGa=document.getElementById('warrantyid');thisGa.value=warrantyid;}}function updateLinkedProducts(){var theForm=document.getElementById('frmlinkedproducts');var links=document.getElementById('frmaddtobasket').elements['pid'];var values=new Array();for(var i=0;i<theForm.elements.length;i++){if(theForm.elements[i].checked){values.push(theForm.elements[i].id);}}links.value=values.join(',');return true;}function CheckPostcode(){if(document.forms.formBasket.postcode.value!=''){document.forms.formBasket.postcode.value.toUpperCase();if(document.forms.formBasket.postcode.value.length<5){alert("Please enter your Full Postcode");document.forms.formBasket.postcode.value='';return false;}}return true;}function checkEnteredPostcode(){if(document.forms.formBasket.postcode.value==''){alert("Please enter your Full Postcode");document.forms.formBasket.postcode.focus();return false;}else{CheckPostcode();}}function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}function getURLParam(strParamName){var strReturn="";var strHref=window.location.href;if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")).toLowerCase();var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}}return strReturn;}function getStringURLParam(strParamName,$strURL){var strReturn="";var strHref=$strURL;if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")).toLowerCase();var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}}return strReturn;}function AddWarr(Warr){AddWarrantyToHrefToSubmitToBasket(Warr,false,document.getElementById('cmdaddtobasket'),'postcodecheck','postcodecheck');AddWarrantyToHrefToSubmitToBasket(Warr,false,document.getElementById('cmdaddtobasket2'),'postcodecheck','postcodecheck');return true;}function addBookmark(title,url){if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(document.all){window.external.AddFavorite(url,title);}else if(window.opera&&window.print){return true;}}function clearFieldValue(obj){obj.value='';return obj;}function loadManufacturersSelect(){var url='{/literal}{$nonssladdress}{literal}action.php?cdx=loadmanufacturersselectbox';var params='featureid='+$F('featureidselect');var ajax=new Ajax.Updater({success:'manufacturersdropdown'},url,{method:'get',parameters:params});}