var CoverFlow=function(){var a,b=!!(window.attachEvent&&!window.opera);return{get:function(){return a},isLoaded:function(){return isLoad},init:function(){a=b?window.vIE__:document.vFF__},search:function(c){a.search(c||"")},stop:function(){a.stopVideo()},close:function(){}}}();var TPopular=Ext.extend(Ext.util.Observable,{previous:null,childs:undefined,_isFx:false,constructor:function(){this.addEvents("selected");this.addEvents("playvideo");TPopular.constructor.call(this)},initComponent:function(a){this.addEventListener();this.childs=Ext.fly("popular").query("a");for(var b in this.childs)Ext.isObject(this.childs[b])&&this.childs[b].setAttribute("index",b);this.previous=this.childs[a||3];Ext.fly(this.previous).addClass("selected")},select:function(a){if(a>=this.childs.length)a%=
this.childs.length;this.animate(this.childs[a])},getIndex:function(a){for(var b in this.childs)if(a==this.childs[b])return Number(b)},getChildText:function(a){return(Ext.isEmpty(a)?this.previous:this.childs[a]).childNodes[0].nodeValue},onClickHandler:function(a){a.stopEvent();a=a.getTarget();if(!(a.tagName.toUpperCase()!="A"||a===this.previous))if(!this._isFx){this._isFx=true;this.animate(a);this.fireEvent("selected",this,a.childNodes[0].nodeValue,this.getIndex(a))}},animate:function(a){var b=Ext.fly(this.previous);
b.stopFx();b.removeClass("selected");this.highlight(a);this.previous=a},highlight:function(a){var b=Ext.get(a);b.highlight("656565",{attr:"color",endColor:"60b7d0",easing:"easeOut",duration:0.3,scope:this,stopFx:true,callback:function(){this._isFx=false;b.addClass("selected");this.fireEvent("playvideo",this,a.childNodes[0].nodeValue)}})},addEventListener:function(){Ext.fly("popular").on("click",this.onClickHandler.createDelegate(this))}}),TCover=Ext.extend(Ext.util.Observable,{stateX:0,stateI:0,guideX:0,
childs:undefined,_isFx:false,constructor:function(){this.addEvents("selected");TCover.constructor.call(this)},initComponent:function(a){this.addEventListener();this.stateX=Ext.fly("coverStage").getLeft(true);this.guideX=Ext.fly("coverGuide").getLeft(true);this.stateI=a||3;this.childs=this.getChild();for(var b in this.childs)b>=this.stateI-1&&b<=this.stateI+1&&Ext.isObject(this.childs[b])&&this.setSrc(b)},setSrc:function(a){var b=this.childs[a]&&this.childs[a].getAttribute("_src");if(b){this.childs[a].setAttribute("src",
b);this.childs[a].removeAttribute("_src")}},getChild:function(){return Ext.fly("coverStage").query("img")},getIndex:function(a){for(var b in this.childs)if(a==this.childs[b])return Number(b)},getPosX:function(){return this.stateX-(this.stateI-3)*204},animate:function(){var a=Ext.fly("coverStage");a.animate({left:{to:this.getPosX(),from:a.getLeft(true)}},0.5,this.callbackAnimate.createDelegate(this),"easeOutStrong","motion")},animateGuide:function(a){Ext.fly("coverGuide").animate({left:{to:this.guideX,
from:this.guideX+a}},0.5)},callbackAnimate:function(){if(this.stateI<=0)Ext.fly("iBtnL").addClass("leftOff");else if(this.stateI>=6)Ext.fly("iBtnR").addClass("rightOff");else{Ext.fly("iBtnL").removeClass("leftOff");Ext.fly("iBtnR").removeClass("rightOff")}this._isFx=false},select:function(a){if(a>=this.childs.length)a%=this.childs.length;var b=a>this.stateI?50:-50;this.stateI=a;a>0&&this.setSrc(a-1);this.setSrc(a);a<6&&this.setSrc(a+1);this.animateGuide(b);this.animate()},clickHandler:function(a){a=
a.getTarget();var b=this.stateI;if(!this._isFx){this._isFx=true;switch(a.id){case "iBtnL":if(this.stateI<=0){this._isFx=false;return}b--;break;case "iBtnR":if(this.stateI>=6){this._isFx=false;return}b++;break;default:b=this.getIndex(a);if(Ext.isEmpty(b)){this._isFx=false;return}break}this.select(b);this.fireEvent("afterselected",this,b)}},addEventListener:function(){Ext.fly("iBtnL").on("click",this.clickHandler.createDelegate(this));Ext.fly("iBtnR").on("click",this.clickHandler.createDelegate(this));
Ext.fly("coverStage").on("click",this.clickHandler.createDelegate(this))}});var _d=document,itovi={},listen=function(a,b,c){if(a.attachEvent)a.attachEvent("on"+b,c);else if(a.addEventListener)a.addEventListener(b,c,false);else a["on"+b]=c};itovi.reset=function(){_d.f.reset();_d.f.q.focus()};itovi.getEl=function(a){return _d.getElementById(a)};itovi.init=function(){_d.f.q.focus();listen(_d.f,"submit",submit);listen(this.getEl("iBtnClear"),"click",this.reset)};
function submit(a){if(_d.f.q.value.replace(" ","")==""){if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true;if(a.preventDefault)a.preventDefault();else a.returnValue=false;location.href="/"}}
Ext.onReady(function(){var a=new TPopular;a.initComponent(3);var b=new TCover;b.initComponent(3);CoverFlow.close=function(){var d=a.getIndex(a.previous)+1;a.select(d);b.select(d)};a.on("selected",function(d,e,f){Ext.fly("iCoverFlow").hide();CoverFlow.stop();b.select(f);c.cancel()});a.on("playvideo",function(d,e){CoverFlow.search(e);Ext.fly("iCoverFlow").show();Ext.fly("q").dom.value=e});b.on("afterselected",function(d,e){Ext.fly("iCoverFlow").hide();CoverFlow.stop();a.select(e);c.cancel()});var c=
new Ext.util.DelayedTask(function(){CoverFlow.search(a.getChildText(3))});c.delay(6E3);Ext.fly("coverGuide").on("click",function(d){d.stopEvent();location.href="/result.htm?q="+encodeURIComponent(a.getChildText())})});