Function.prototype.bind=function(context){var _event=this;return function(){return _event.apply(context,arguments);};};var Utils={SetCookie:function(name,value,iExpires,sPath,sDomain,bSecure){var dtToday=new Date();dtToday.setTime(dtToday.getTime());if(iExpires)var iExpireTicks=iExpires*1000*60*60*24;var dtExpires=new Date(dtToday.getTime()+iExpireTicks);document.cookie=name+"="+escape(value)+(iExpires?";expires="+dtExpires.toGMTString():"")+(sPath?";path="+sPath:"")+(sDomain?";domain="+sDomain:"")+(bSecure?";secure":"");},GetCookie:function(name){var arg=name+"=";var argLength=arg.length;var length=document.cookie.length;var i=0;while(i<length){var j=i+argLength;if(document.cookie.substring(i,j)==arg)return this.GetCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}return null;},GetCookieVal:function(offset){var strEnd=document.cookie.indexOf(";",offset);if(strEnd==-1)strEnd=document.cookie.length;return unescape(document.cookie.substring(offset,strEnd));},AttachEvent:function(name,object,hWnd){if(object.addEventListener)object.addEventListener(name,hWnd,false);else if(object.attachEvent)object.attachEvent("on"+name,hWnd);else object["on"+name]=hWnd;},PopupMap:function(win,id){Utils.Popup(win,"/Popup/Map.aspx?Id="+id,"width=640,height=550,status=no,toolbar=no,menubar=no,scrollbars=no");},Popup:function(win,url,params){win=window.open(url,0,params)},NavigateForum:function(sender){var ddl=this.GetObjectFromId(sender);location.href="/Forum/"+ddl.options[ddl.selectedIndex].value;},Sample:function(a,name){name=name||"search";var f=document.forms[0];if(!f.nl){var z=document.createElement("input");z.name="nl";z.type="hidden";z.value=1;a.appendChild(z)}f[name].value=(a.innerText?a.innerText:a.firstChild.nodeValue).replace(/&amp;/g,"&").replace(/&quot;/g,'"');f[name].focus();},ExpandNews:function(sender){var e=sender.previousSibling;e.style.maxHeight=e.style.maxHeight==""?"100%":"";},Clear:function(sender){if(typeof(sender)=="string")sender=document.getElementById(sender);if(sender.type=="text")sender.value="";},AddFavorites:function(){var title="TechHome.ru - Супермаркет электроники";var url="http://techhome.ru/";if(window.sidebar)window.sidebar.addPanel(title,url,"");else if(window.external)window.external.AddFavorite(url,title);else if(window.opera&&window.print)return true;},Search:function(e,sender){var code;if(!e)e=window.event;if(e.keyCode)code=e.keyCode;else if(e.which)code=e.which;if(sender.id=="go"){e.returnValue=false;e.cancelBubble=true;var srch=document.getElementById("ctl00_ctl00_ucSearch_txt");if(srch!=null&&srch.value!=srch.title){srch=escape(encodeURI(srch.value));if(srch.length>2)location.href="/Catalog/?Search="+srch;else alert("Необходимо указать больше 2х символов для поиска");}return false;}},ToggleProduct:function(target,sProductId,isOnlyAdd){target=this.GetObjectFromId(target);var arrPid=target.value;if(arrPid=='')arrPid=','+arrPid;iIndex=arrPid.indexOf(','+sProductId+',');if(iIndex >-1){if(!isOnlyAdd)arrPid=arrPid.substring(0,iIndex+1)+arrPid.substring(iIndex+sProductId.length+2,arrPid.length);}else arrPid=arrPid+sProductId+',';target.value=arrPid;},GetProductImage:function(imageId){return "/Image.axd?MethodType=1&ImageType=5&Image="+imageId;},ShowImageTip:function(e,imageId){ImageTip.ShowToolTip(e,this.GetProductImage(""),imageId);},ShowImageProductTip:function(e,method,image,variant){if(variant)ImageTip.ShowToolTip(e,"/Image.axd?MethodType="+method+"&ImageType=5&Variant="+variant+"&Image=",image);else ImageTip.ShowToolTip(e,"/Image.axd?MethodType="+method+"&ImageType=5&Image=",image);},GetObjectFromId:function(element){if(element!=null&&(typeof(element)=="string"||element.constructor==String))element=document.getElementById(element);return element;},EnforceMaxLength:function(element,nLength,objLiteral){element=this.GetObjectFromId(element);if(element){var remaining=nLength-parseInt(element.value.length);if(remaining<0){remaining=0;element.value=element.value.substring(0,nLength);}objLiteral=this.GetObjectFromId(objLiteral);if(objLiteral&&objLiteral.tagName=="INPUT")objLiteral.setAttribute('value',remaining);}},QuestionRemove:function(){return this.QuestionRemoveMsg("Вы действительно хотите удалить выбранные позиции?");},QuestionRemoveMsg:function(s){return confirm(s);},IncrementProductInBasket:function(e){ToolTip.FadeIn(e,'pBasket',3000);document.getElementById("cBasket").style.display="";var el=document.getElementById("iBasket");el.innerHTML=parseInt(el.innerHTML,10)+1;},DecrementProductInBasket:function(e){var el=document.getElementById("iBasket");var count=parseInt(el.innerHTML,10)-1;el.innerHTML=count;document.getElementById("cBasket").style.display=count>0?"":"none";}};
