if(!window.console){window.console={}}if(!window.console.log){window.console.log=function(){}}var Loading=new Class({initialize:function(){this.opacity=0.9},setup:function(){this.layer=$("ajax-load").fade(0)},show:function(a){var b=a.getCoordinates();this.setup();this.layer.setStyle("display","block");this.layer.fade(this.opacity);this.layer.setStyles({width:b.width,height:Math.max(b.height,200),top:b.top,left:b.left});this.layer.addClass("loading")},hide:function(){this.layer.fade(0)}});var GetModels=new Class({initialize:function(a){if(a=="byBrand"){this.url="/"+wontConflictLang+"/index/searchbybrand/brand/"}else{if(a=="byModel"){this.url="/"+wontConflictLang+"/index/searchbymodel/model/"}else{if(a=="byPage"){this.url=""}}}this.mbsLoading=new Loading()},fetch:function(b){resource=this.url+b;try{new Request.HTML({url:resource,update:$("content"),method:"get",onRequest:function(){this.mbsLoading.show($("content"))}.bind(this),onComplete:function(){this.mbsLoading.hide()}.bind(this)}).send()}catch(a){console.log(a)}}});window.addEvent("domready",function(){if($("search-tabs")){var d=$("search-by-model-form"),a=$("search-by-brand-form"),e=$("search-by-model"),c=$("search-by-brand");c.addEvent("click",function(h){h.stop();this.addClass("active");e.removeClass("active");a.setStyle("display","block");d.setStyle("display","none")});e.addEvent("click",function(h){h.stop();this.addClass("active");c.removeClass("active");a.setStyle("display","none");d.setStyle("display","block")});var b=$("q");new Autocompleter.Local(b,wontConflictModels,{minLength:2,postVar:"q",indicatorClass:"autocompleter-loading",onSelection:function(i,h,k,j){tmpGetModels=new GetModels("byModel");tmpGetModels.fetch(j)}});a.getElements("input[name=radio]").addEvent("click",function(h){tmpGetModels=new GetModels("byBrand");tmpGetModels.fetch(h.target.value)});$("paging").getElements("a").addEvent("click",function(h){h.stop();tmpGetModels=new GetModels("byPage");tmpGetModels.fetch(h.target.href)});$("generic-version").getElements("a.generic").addEvent("click",function(h){h.stop();tmpGetModels=new GetModels("byPage");tmpGetModels.fetch(h.target.href)});cfe.spacer="/img/spacer.gif";myCfe=new cfe.replace();myCfe.init({scope:$(document.body)})}if($("bug-report-form")){var b=$("model");new Autocompleter.Local(b,wontConflictModels,{minLength:2,postVar:"q",indicatorClass:"autocompleter-loading"})}if($("manual-pages")){$("manual-pages").getElements("a").addEvent("click",function(h){h.stop();$$("#manual-pages li").setStyles({"background-repeat":"no-repeat","font-weight":"normal"});h.target.getParent("li").setStyles({"background-repeat":"repeat-y","font-weight":"bold"});try{new Request.HTML({url:h.target.href,update:$("manual-section"),method:"get",onRequest:function(){h.target.setStyle("background","url(/img/manual-loading.gif) left center no-repeat")},onComplete:function(){h.target.setStyle("background","")}}).send()}catch(h){console.log(h)}})}$$("li.parent").each(function(h){var j=h.getFirst();var k=h.getElement("ul.dropdown");if(k!=null){var i=new Fx.Tween(k,{property:"opacity",duration:150,wait:false});k.setStyle("display","block");i.set(0);h.addEvent("mouseover",function(l){j.addClass("over");i.start(1)});h.addEvent("mouseout",function(l){j.removeClass("over");i.start(0)})}});if($("news")!=null){var g=$("news").getCoordinates();var f=new Roar({position:"upperLeft",margin:{x:g.left,y:g.top}});$$(".news-item").each(function(h){h.getElement("a").addEvent("click",function(i){i.stop();f.alert(this.get("html"),h.getElement("div").get("html"))})})}});

