var EventCache=function(){var listEvents=[];return{listEvents:listEvents,add:function(node,sEventName,fHandler){listEvents.push(arguments);},flush:function(){var i,item;for(i=listEvents.length-1;i>=0;i--){item=listEvents[i];if(item[0].removeEventListener){item[0].removeEventListener(item[1],item[2],false);};if(item[1].substring(0,2)!="on"){item[1]="on"+item[1];};if(item[0].detachEvent){item[0].detachEvent(item[1],item[2]);};item[0][item[1]]=null;};}};}();var pers=null;var lv=null;var mi=null;var gv=null;var tf=null;var gp=null;
function addEvent(obj,evType,fn){if(typeof fn!='function')return false;var result;if(obj.addEventListener){obj.addEventListener(evType,fn,false);result=true;}else if(obj.attachEvent){result=obj.attachEvent("on"+evType,fn);}else{return false;}EventCache.add(obj,evType,fn,false);return result;}
function toggleField(field,showField,reset){var title=document.getElementById(field);if(title){title.style.display=showField?'block':'none';if(reset&&reset==true)title.value='';}}
function bAction(field,page,qst,dval,cid){var tField=document.getElementById(field);var sQS='';if(tField&&tField.value!=''&&(dval&&tField.value!=dval)){sQS=escape(tField.value).replace(/\+/g,'%2B').replace(/\"/g,'%22').replace(/\'/g,'%27');if(sQS)document.location.href=page+'?'+qst+'='+sQS+(cid?'&cid='+cid:'');}}
function kEnter(e){var keyNum;if(window.event)keyNum=e.keyCode;else if(e.which)keyNum=e.which;if(keyNum==13)return true;return false;}
function bClick(e,buttonid){if(kEnter(e)){var bt=document.getElementById(buttonid);if(bt&&typeof bt=='object'){bt.click();return false;}}return true;}
function externalLinks(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external")anchor.target="_blank";}}
function checkQuantities(fName){var rc=false;if(document.getElementById){var frm=document.getElementById(fName);for(i=0;i<frm.elements.length;i++){var em=frm.elements[i];if(em.type=='text'&&em.id.indexOf('qty_')==0){if(em.value.length>0){var va=parseInt(em.value);if(!isNaN(va)&&va>0){rc=true;break;}}}}}if(!rc)alert('Please enter a valid quantity for one or more products.');return rc;}
function tellFriend(pcat,cat,id){var url='TellAFriend.aspx?ParentCategoryID='+pcat+'&CategoryID='+cat+'&ProductID='+id;var width=550;var height=550;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=yes,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(tf==null||tf.closed)tf=window.open(url,'TellAFriend',options);tf.focus();}
function catTellFriend(cat,pg){var url='TellAFriend.aspx?Catalogue='+cat;if(pg)url+='&page='+pg;var width=550;var height=600;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=yes,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(tf==null||tf.closed)tf=window.open(url,'TellAFriend',options);tf.focus();return false;}
function moreInfo(id){var url='PopupMoreInformation.aspx?ProductID='+id;var width=350;var height=350;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=yes,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(mi==null||mi.closed)mi=window.open(url,'MoreInfoPopup',options);mi.focus();}
function largeView(id){var url='PopupImage.aspx?ProductID='+id;var width=420;var height=490;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=no,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(lv==null||lv.closed)lv=window.open(url,'LargeViewPopup',options);lv.focus();}
function galleryView(id){var url='PopupGallery.aspx?ProductID='+id;var width=420;var height=530;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=no,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(gv==null||gv.closed)gv=window.open(url,'GalleryPopup',options);gv.focus();}
function personalise(id){var url='PopupPersonaliseProd.aspx?ProductID='+id;var width=600;var height=600;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=yes,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(pers==null||pers.closed)pers=window.open(url,'PersonalisePopup',options);pers.focus();}
function genPop(sHRef,w,h){var width=w?w:400;var height=h?h:400;var left=((screen.width-width)/2);var top=((screen.height-height)/2);var options='status=no,scrollbars=no,resizable=no,menubar=no,left='+left+',top='+top+',width='+width+',height='+height;if(gp==null||gp.closed)gp=window.open(sHRef,'genPopup',options);gp.focus();}
function closePopup(){var popup=document.getElementById('prodPopup');if(popup)popup.style.display='none';}
function closePopups(){if(pers!=null)pers.close();if(lv!=null)lv.close();if(mi!=null)mi.close();if(gv!=null)gv.close();if(tf!=null)tf.close();if(gp!=null)gp.close();}addEvent(window,'unload',closePopups,false);addEvent(window,'load',externalLinks);