﻿function GetElement(a){if(document.getElementById)return(document.getElementById(a));else if(document.all)return(eval("document.all."+a));else if(document.layers)return(eval("document."+a));else return(null)}var boolNS4=navigator.appVersion.indexOf("Nav")>0&&parseInt(navigator.appVersion)==4;function Toggle(a){if(boolNS4)return false;elObj=GetElement(a);if(elObj!=null){elObj.style.display=(elObj.style.display=="none"?"block":"none")}}function FocusSelect(a){if(a){a.focus();a.select()}}function Focus(a){if(a)a.focus()}function OpenForm(a){window.open(a,'','scrollbars=yes,resizable=yes,status=yes,width=582,height=550')}function OpenPromt(a){window.open(a,'','scrollbars=no,resizable=yes,status=no,width=322,height=250')}function OpenPromtReturn(a){return window.open(a,'','scrollbars=no,resizable=yes,status=no,width=322,height=250')}function bPicklist(a,b){return window.open(a+"&f="+b,'','scrollbars=no,resizable=no,status=no,width=180,height=150')}function RandomString(a){var b="";if(a>0){var e=0;var d=0;while(e<a){d=Math.round(Math.random()*150);if((d>=48&&d<=57)||(d>=66&&d<=90)||(d>=97&&d<=122)){b+=String.fromCharCode(d);e++}}}return b}function popupinfo(a){var b;b=window.open('ProductsDetailExt.aspx?ProductID='+a,'','toolbar=0,location=0,directories=0,status=no,menubar=0,scrollbars=yes,resizable=0,width=645,height=500');b.focus()}function pupdateorderOLD(a,b){var e='scrollbars=no,resizable=no,status=no,width=10,height=10';var d="BasketAdd.aspx?ProductID="+a+"&Qty="+b;window.open(d,'',e);window.focus()}function pupdateorder(a,b){var e="BasketAddPing.gif.aspx?ProductID="+a+"&Qty="+b+"&nocache="+RandomString(10);var d=GetElement("puporder");d.src=e}function addtofavlst(a){if(a!=null){var b=a.checked;var e=a.value;var d="FavoritesUpdateListPing.gif.aspx?ProductID="+e+"&Use="+b+"&nocache="+RandomString(10);var f=GetElement("puporder");f.src=d}}function cntDn(a,b,e){if(b==0)b=1;qtyfield=e.parentElement.parentElement.firstChild.firstChild;qtyordered=tonum(qtyfield.value);if((qtyordered>0)&&(b>1)&&(qtyordered%b!=0))qtyordered=Math.floor(qtyordered/b)*b;else qtyordered=qtyordered-b;if(qtyordered<0)qtyordered=0;qtyfield.value=qtyordered;setstatus(qtyfield,true);pupdateorder(a,qtyordered)}function cntUp(a,b,e){if(b==0)b=1;qtyfield=e.parentElement.parentElement.firstChild.firstChild;qtyordered=tonum(qtyfield.value);if((qtyordered>0)&&(b>1)&&(qtyordered%b!=0))qtyordered=Math.ceil(qtyordered/b)*b;else qtyordered=qtyordered+b;qtyfield.value=qtyordered;setstatus(qtyfield,true);pupdateorder(a,qtyordered)}function setstatus(a,b){a.className=b?"num":"numwarn"}function tonum(a){p1=tousa(a);r1=parseFloat(p1);r1=r1.fix();res=0;if((isNaN(r1))||(r1==0))res=0;else res=r1;return res}function tousa(a){bs=a+"";c=bs.lastIndexOf(",");if((c>-1)&&(c>=bs.length-3)){p=bs.length-c-1;while(bs.indexOf(".")>0)bs=bs.substring(0,bs.indexOf("."))+bs.substring(bs.indexOf(".")+1);while(bs.indexOf(",")>0)bs=bs.substring(0,bs.indexOf(","))+bs.substring(bs.indexOf(",")+1);bs=bs.substring(0,bs.length-p)+"."+bs.substring(bs.length-p)}else if(c>-1)while(bs.indexOf(",")>0)bs=bs.substring(0,bs.indexOf(","))+"."+bs.substring(bs.indexOf(",")+1);if(bs=="")bs="0";return(bs)}function _0(a){if((a>0)||(a==null)||(isNaN(a)))a=0;return Math.round(this.valueOf()*100)/100}Number.prototype.fix=_0;