(function(){window.qimiao={};var b=false;var a='<script type="text/javascript" src="http://static.qiyi.com/js/common/{0}"><\/script>';if(b){document.write('<script type="text/javascript" src="http://static.qiyi.com/js/common/kit/trace.js"><\/script>');lib.log=function(c){if(window.console){console.log(c)}else{if(lib.kit.$trace){lib.kit.$trace(""+c)}}};qimiao.$require=function(c){if(c.length<1){return}if(!b){return}else{document.write(a.format(c))}}}else{lib.log=function(){return}}window.dom=[];dom.isReady=false;dom.ready=function(c){dom.initReady();if(dom.isReady){c()}else{dom.push(c)}};dom.initReady=function(){if(arguments.callee.used){return}arguments.callee.used=true;if(document.readyState==="complete"){return dom.fireReady()}if(!+"\v1"){document.attachEvent("onreadystatechange",function(c){if(document.readyState=="complete"){document.detachEvent("onreadystatechange",arguments.callee);dom.fireReady()}});(function(){if(dom.isReady){return}var c=new Image;try{c.doScroll();c=null}catch(d){setTimeout(arguments.callee,64);return}dom.fireReady()})}else{document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);dom.fireReady()},false)}};dom.fireReady=function(){if(!dom.isReady){if(!document.body){return setTimeout(dom.fireReady,16)}dom.isReady=true;if(dom.length){for(var c=0,d;d=dom[c];c++){d()}}}}})();function Jobs(){this._jobTable=[];this._priorityJob=[]}Jobs.prototype={_registedJobTable:{},initialize:function(){},_registJob:function(b,a){this._registedJobTable[b]=a;return this},add:function(a,b){if(this._jobTable.index(a)==-1){if(typeof b=="undefined"||b!=0){this._jobTable.push(a)}else{this._priorityJob.push(a)}}else{lib.log("Error: Job <b>"+a+"</b> is existed now.")}return this},start:function(){var a=this._jobTable;var b=this._registedJobTable;var d=0;var c=this._jobTable.length;for(var d=0;d<c;d++){var h=a[d];var f=b[h];if(typeof f=="undefined"){lib.log("<b>Job["+h+"] is undefined!!!</b>");return}try{f.call()}catch(g){lib.log("Job["+h+"] failed!!!");_try=false;lib.log("job start "+g.message)}}},call:function(b,a){if(typeof this._registedJobTable[b]!="undefined"){this._registedJobTable[b].apply(this,a)}else{lib.log("Job["+b+"] is undefined!!!")}}};$newJob=lib.kit.newJob=function(b,a){Jobs.prototype._registJob(b,a)};lib.kit.$callJob=function(b){var a=[];if(arguments.length>1){arguments.foreach(function(c,d){a[d]=c});a.shift()}Jobs.prototype.call(b,a)};var Url=function(a){a=a||"";this.url=a;this.query={};this.hrParam={};this.parse()};(function(a){a.prototype={parse:function(b){if(b){this.url=b}this.parseAnchor();this.parseParam()},parseAnchor:function(){var b=this.url.match(/\#(.*)/);b=b?b[1]:null;this._anchor=b;if(b!=null){this.anchor=this.getNameValuePair(b);this.url=this.url.replace(/\#.*/,"")}},parseParam:function(){var b=this.url.match(/\?([^\?]*)/);b=b?b[1]:null;if(b!=null){this.query=this.getNameValuePair(b);this.hrParam=this.getNameValuePair(b,"-");this.url=this.url.replace(/\?([^\?]*)/,"")}},getNameValuePair:function(f,b){var e={};var c=b||"&";var d=new RegExp("([^"+c+"=]*)(?:=([^"+c+"]*))?","gim");f.replace(d,function(g,i,h){if(i==""){return e}e[i]=h||""});return e},getParam:function(b){return this.query[b]||""},getHrParam:function(b){return this.hrParam[b]||""},clearParam:function(){this.query={}},setParam:function(b,c){if(b==null||b==""||typeof(b)!="string"){throw new Error("no param name set")}this.query=this.query||{};this.query[b]=c},setParams:function(b){this.query=b},serialize:function(d){var b=[];for(var c in d){if(d[c]==null||d[c]==""){b.push(c+"=")}else{b.push(c+"="+d[c])}}return b.join("&")},toString:function(){var b=this.serialize(this.query);return this.url+(b.length>0?"?"+b:"")+(this.anchor?"#"+this.serialize(this.anchor):"")},getHashStr:function(b){return this.anchor?"#"+this.serialize(this.anchor):(b?"#":"")}}})(Url);$reg("lib.kit.Url",(function(){lib.kit.Url=Url}));var Ijax={arrTaskLists:[],createLoadingIframe:function(){var a=this;if(this.loadFrames!=null){return false}var d="loadingIframe_thread"+Math.ceil(Math.random()*10000);this.loadFrames=d;var c=['<iframe id="'+d+'" name="'+d+'" class="invisible"',' scrolling="no" src=""',' allowTransparency="true" style="display:none;" frameborder="0"'," ></iframe>"].join("");var b=document.createElement("div");b.id="ijax_iframes";b.innerHTML=c;document.body.appendChild(b);if(document.getElementById(a.loadFrames)!=null){loadTimer=null;a.loadingIframe={container:document.getElementById(a.loadFrames),isBusy:false};a.loadByList()}},isIjaxReady:function(){if(typeof this.loadingIframe=="undefined"){return false}if(this.loadingIframe.isBusy==false){this.loadingIframe.isBusy=true;return this.loadingIframe}return false},request:function(a,c){var b={};b.url=a;b.option=c||{};this.arrTaskLists.push(b);if(this.loadFrames==null){this.createLoadingIframe()}else{this.loadByList()}},loadByList:function(){if(this.arrTaskLists.length==0){return false}var b=this.isIjaxReady();if(b==false){return false}var c=this.arrTaskLists[0];var a=this;setTimeout(function(){a.loadData(c.url,c.option,b)},10);this.arrTaskLists.shift()},destory:function(){if(this.arrTaskLists.length>0){return}document.getElementById(this.loadFrames).callback=null;document.body.removeChild(document.getElementById("ijax_iframes"));if(document.getElementById("IjaxForm")){document.getElementById("IjaxForm").action="";document.getElementById("IjaxForm").target="";document.body.removeChild(document.getElementById("IjaxForm"))}this.loadFrames=null},loadData:function(url,option,loader){var ifm=loader.container;var _self=this,_url="";ifm.callback=function(res){res=(typeof res=="string"&&(/\s*{/.test(res)))?eval("("+res+")"):res;if(res.code=="A00000"&&option.onSuccess){option.onSuccess(res.data);_self.destory()}else{option.onError(res)}loader.isBusy=false;_self.loadByList()};if(option.CACHE){_url=url;for(var key in option.CACHE){_url+=option.CACHE[key]+"/"}}else{_url=new lib.kit.Url(url);if(option.GET){for(var key in option.GET){_url.setParam(key,encodeURIComponent(option.GET[key]))}}if(option.POST){if(!document.getElementById("IjaxForm")){var oIjaxForm=document.createElement("form");document.body.appendChild(oIjaxForm);oIjaxForm.id="IjaxForm";oIjaxForm.method="post";oIjaxForm.target=ifm.id}else{document.getElementById("IjaxForm").innerHTML=""}document.getElementById("IjaxForm").action=_url;for(var oItem in option.POST){var oInput=document.createElement("input");oInput.type="hidden";oInput.name=oItem;oInput.value=option.POST[oItem];document.getElementById("IjaxForm").appendChild(oInput)}document.getElementById("IjaxForm").submit()}}if(!option.POST){ifm.contentWindow.location.replace(_url)}}};var JsLoad={};(function(){function c(f,e){var g;try{if(typeof e!="undefined"){for(g in f){if(e[g]){f[g]=e[g]}}}}finally{g=null;return f}}function a(h,e){b(h,e);var g=h.urls;var f=document.createElement("script");f.src=g.url;f.charset=g.charset;f.onload=f.onerror=f.onreadystatechange=function(){if(f&&f.readyState&&f.readyState!="loaded"&&f.readyState!="complete"){return}e.script_loaded_num++;f.onload=f.onreadystatechange=f.onerror=null;f.src="";f.parentNode.removeChild(f);f=null};document.getElementsByTagName("head")[0].appendChild(f)}function b(k,i){var j=k.urls;var h=k.CACHE;var g,l,e,f;l=j.url;for(g in h){if(g=="varname"){e=h[g];continue}l+=h[g]+"/"}i.script_var_arr.push(e);j.url=l.toString();j.charset=k.charset||"utf-8"}function d(g,h){var f={urls:[],charset:"utf-8",timeout:-1,CACHE:{},onSuccess:null,onError:null};var e={script_loaded_num:0,is_timeout:false,is_loadcomplete:false,script_var_arr:[]};f.urls=typeof g=="string"?{url:g}:g;c(f,h);a(f,e);(function(){if(f.noreturn==true&&f.onComplete==null){return}var j,k=[];if(e.script_loaded_num==1){e.is_loadcomplete=true;if(f.onSuccess!=null){for(j=0;j<e.script_var_arr.length;j++){k.push(window[e.script_var_arr[j]])}if(e.script_var_arr.length<2){if(typeof k[0]!="undefined"&&k[0].code=="A00000"){f.onSuccess(k[0].data)}else{f.onError(k[0])}}else{if(k.code=="A00000"){f.onSuccess(k.data)}else{f.onError(k)}}}return}if(e.is_timeout==true){return}setTimeout(arguments.callee,50)})();if(f.timeout>0){setTimeout(function(){if(!e.is_loadcomplete){if(f.onError){f.onError()}e.is_timeout=true}},f.timeout)}}JsLoad.request=function(e,f){new d(e,f)}})();var Interface=function(a,b){this.url=a;this.type=b||"ijax"};Interface.prototype={url:null,request:function(b){var d=b.onError;var a=b.onSuccess;var c=this.url.toString();switch(this.type){case"jsload":JsLoad.request(c,b);break;case"ijax":default:Ijax.request(c,b);break}}};var Tween={};(function(){var k={simple:function(p,m,n,o){return n*p/o+m},backEaseIn:function(n,m,q,p){var o=1.70158;return q*(n/=p)*n*((o+1)*n-o)+m},backEaseOut:function(o,m,v,u,n,r){var q=1.70158;return v*((o=o/u-1)*o*((q+1)*o+q)+1)+m},backEaseInOut:function(o,m,v,u,n,r){var q=1.70158;if((o/=u/2)<1){return v/2*(o*o*(((q*=(1.525))+1)*o-q))+m}return v/2*((o-=2)*o*(((q*=(1.525))+1)*o+q)+2)+m},bounceEaseOut:function(n,m,p,o){if((n/=o)<(1/2.75)){return p*(7.5625*n*n)+m}else{if(n<(2/2.75)){return p*(7.5625*(n-=(1.5/2.75))*n+0.75)+m}else{if(n<(2.5/2.75)){return p*(7.5625*(n-=(2.25/2.75))*n+0.9375)+m}else{return p*(7.5625*(n-=(2.625/2.75))*n+0.984375)+m}}}},bounceEaseIn:function(n,m,p,o){return p-k.bounceEaseOut(o-n,0,p,o)+m},bounceEaseInOut:function(n,m,p,o){if(n<o/2){return k.bounceEaseIn(n*2,0,p,o)*0.5+m}else{return k.bounceEaseOut(n*2-o,0,p,o)*0.5+p*0.5+m}},strongEaseInOut:function(n,m,p,o){return p*(n/=o)*n*n*n*n+m},regularEaseIn:function(n,m,p,o){return p*(n/=o)*n+m},regularEaseOut:function(n,m,p,o){return -p*(n/=o)*(n-2)+m},regularEaseInOut:function(n,m,p,o){if((n/=o/2)<1){return p/2*n*n+m}return -p/2*((--n)*(n-2)-1)+m},strongEaseIn:function(n,m,p,o){return p*(n/=o)*n*n*n*n+m},strongEaseOut:function(n,m,p,o){return p*((n=n/o-1)*n*n*n*n+1)+m},strongEaseInOut:function(n,m,p,o){if((n/=o/2)<1){return p/2*n*n*n*n*n+m}return p/2*((n-=2)*n*n*n*n+2)+m},elasticEaseIn:function(o,m,v,u,n,r){if(o==0){return m}if((o/=u)==1){return m+v}if(!r){r=u*0.3}if(!n||n<Math.abs(v)){n=v;var q=r/4}else{var q=r/(2*Math.PI)*Math.asin(v/n)}return -(n*Math.pow(2,10*(o-=1))*Math.sin((o*u-q)*(2*Math.PI)/r))+m},elasticEaseOut:function(o,m,v,u,n,r){if(o==0){return m}if((o/=u)==1){return m+v}if(!r){r=u*0.3}if(!n||n<Math.abs(v)){n=v;var q=r/4}else{var q=r/(2*Math.PI)*Math.asin(v/n)}return(n*Math.pow(2,-10*o)*Math.sin((o*u-q)*(2*Math.PI)/r)+v+m)},elasticEaseInOut:function(o,m,v,u,n,r){if(o==0){return m}if((o/=u/2)==2){return m+v}if(!r){var r=u*(0.3*1.5)}if(!n||n<Math.abs(v)){var n=v;var q=r/4}else{var q=r/(2*Math.PI)*Math.asin(v/n)}if(o<1){return -0.5*(n*Math.pow(2,10*(o-=1))*Math.sin((o*u-q)*(2*Math.PI)/r))+m}return n*Math.pow(2,-10*(o-=1))*Math.sin((o*u-q)*(2*Math.PI)/r)*0.5+v+m},expoEaseIn:function(n,m,p,o){return(n==0)?m:p*Math.pow(2,10*(n/o-1))+m}};var g=function(m){return m.uniqueID};if(!lib.IE){g=function(n){try{var m;if(n.getAttribute("uniqueID")==null){m="moz__id"+parseInt(Math.random()*100)+"_"+new Date().getTime();n.setAttribute("uniqueID",m);return m}return n.getAttribute("uniqueID")}finally{m=null}}}function i(n){try{var m=n.constructor.toString().toLowerCase();return m.slice(m.indexOf("function")+9,m.indexOf("()"))}finally{m=null}}function h(r,q){var p,n,m=[];n=q.length;var o=0;for(p=0;p<n;p++){if("rotate"==q[p]){q[p]="-webkit-transform";if(r.style[q[p]]){o=r.style[q[p]].replace(/[^0-9-]/ig,"");o=o==""?0:o}else{o=0}}else{if("-webkit-transform"==q[p]){o=r.style[q[p]].replace(/[^0-9-]/ig,"");o=o==""?0:o}else{if(r.style[q[p]]){o=r.style[q[p]]}else{o=0}}}m[m.length]=parseFloat(o)}return m}function j(m){return i(m)!="array"?[m]:m}function c(m,s){try{var p=i(m);var t=[],r=[],q,o,n;if(p!="array"){n=f(m);n[1]=s=="opacity"?"":n[1];t=[n[0]];r=[n[1]]}else{o=m.length;for(q=0;q<o;q++){n=f(m[q]);n[1]=s[q]=="opacity"?"":n[1];t[t.length]=n[0];r[r.length]=n[1]}}return[t,r]}finally{p=t=r=q=o=n=null}}function f(n){try{var m=/(-?\d.?\d*)([a-z%]*)/i.exec(n);return[m[1],m[2]?m[2]:"px"]}finally{m=null}}var a={};var e={};function b(o){try{var n=g(o);var m;if(a[n]!=true){m=new d();e[n]={node:o,func:m};a[n]=true;return m}else{return e[n].func}}finally{n=m=null}}function d(){this._timer=null}d.prototype.start=function(u,t,p,s,q,v){this.reset();v=v||{};if(v.end){this._func.end=v.end}if(v.tween){this._func.tween=v.tween}var n=j(t);var m=h(u,n);var o=c(p,n);this._node=u;this._property=n;this._endingvalue=o[0];this._suffixvalue=o[1];this._startvalue=m;this._end=false;this._fps=0;if(s!=null){this._seconds=s}if(k[q]!=null){this._animation=k[q]}this._starttime=new Date().getTime();var r=this;this._timer=setInterval(function(){r.play()},10)};d.prototype.play=function(){var m=this;var r=(new Date().getTime()-this._starttime)/1000;var p,o,n=this._property.length;if(r>this._seconds){r=this._seconds}for(p=0;p<n;p++){o=this._animation(r,this._startvalue[p],this._endingvalue[p]-this._startvalue[p],this._seconds);var q={};q[m._property[p]]=isNaN(o)?"1":o+m._suffixvalue[p];if("-webkit-transform"==m._property[p]){q[m._property[p]]="rotate("+o+"deg)"}$(m._node).css(m._property[p],q[m._property[p]])}this._fps++;this._func.tween();if(r==this._seconds){this.stop()}};d.prototype.stop=function(){clearInterval(this._timer);this._end=true;this._func.end()};d.prototype.reset=function(){clearInterval(this._timer);this._end=false;this._node=null;this._property=[];this._startvalue=[];this._endingvalue=[];this._suffixvalue=[];this._fps=0;this._seconds=0.5;this._animation=k.simple;this._func={end:function(){},tween:function(){}}};function l(r,s,n,q,o,p){var m=b(r);m.start.apply(m,arguments)}l.stop=function(m){b(m).stop()};l.isTween=function(m){return !b(m)._end};Tween=l})();var ReqUrl={mark:"http://score.video.qiyi.com/v/",initMark:"http://score.video.qiyi.com/f/",playList:"http://cache.video.qiyi.com/l",ctgInfo:"http://cache.video.qiyi.com/a",keySearch:"http://search.video.qiyi.com",relevanceSearch:"http://search.video.qiyi.com",search:"http://search.video.qiyi.com",rank:"http://top.qiyi.com/"};var Search=function(){var a="http://search.video.qiyi.com/searchRelevance/1";this.url=new Interface(a)};Search.prototype={relevance:function(b){var a=this;this.url.request({CACHE:b,onSuccess:function(c){a.success(c)},onError:function(c){a.error(c)}})},suggest:function(c){var a=this;var b=new Interface("http://search.video.qiyi.com");b.request({CACHE:c,onSuccess:function(d){a.suggestSuccess(d)},onError:function(d){a.suggestError(d)}})}};(function(c,a,d){function b(f,e){lib.eventTarget.call(this);this.defaultConfig={tag:"li",selectClass:"select"};this.option=Object.extend(this.defaultConfig,e);this.ele=typeof f=="string"?a.getElementById(f):f;this.tabs=[];this.tabsList={};this.curTab=null}b.inherits(lib.eventTarget);Object.extend(b.prototype,{init:function(){if(this.tabs.length==0){this.initTabNavs(this.ele)}var j=this;var g=this.tabs;var h=function(l,k){return function(i){lib.Event.preventDefault(c.event||i);if(j.curTab){j._cancelSelect()}j.fire({type:"beforeselect",target:l,index:k,eventObj:i});j.curTab=l;j._select();j.fire({type:"select",target:l,index:k,eventObj:i})}};for(var f=0,e=g.length;f<e;f++){$(g[f]).on("click",h(g[f],f))}},initTabNavs:function(m){tag=this.option.tag;var j=this.option.selectClass;var g=m.getElementsByTagName(tag);var l=[];for(var h=0,f=g.length;h<f;h++){var k=g[h],e=k.getAttribute("j-tab");if(k.className.indexOf(j)!=-1){this.curTab=k}if(e){l.push(k);this.tabsList[e]=k}}this.tabs=l},select:function(f){if(this.tabs.length==0){this.initTabNavs(this.ele)}var e=this.tabsList;var g=e[f]?e[f]:this.tabs[0];if(this.curTab){this._cancelSelect()}this.fire({type:"beforeselect",target:g});this.curTab=g;this._select();this.fire({type:"select",target:g})},_select:function(){this.curTab.className+=" "+this.option.selectClass},_cancelSelect:function(){this.curTab.className=this.curTab.className.replace(this.option.selectClass,"")}});c.lib=c.lib||{};lib.kit=lib.kit||{};lib.kit.Tab=b})(window,document);(function(c,a,d){function b(g,e,f){this.defaultConfig={tag:"div"};this.option=Object.extend(this.defaultConfig,f);this.wrapper=typeof g=="string"?a.getElementById(g):g;this.list=this._getNodeList();this.curTab=this.getCurTab(e);this.curTab.style.display=""}b.prototype._getNodeList=function(){if(!this.wrapper){return}var g=[];var f=this.wrapper.childNodes;for(var h=0,e=f.length;h<e;h++){if(f[h].nodeName==this.option.tag.toUpperCase()&&f[h].getAttribute("j-tab-cnt")){g.push(f[h]);f[h].style.display="none"}}return g};b.prototype.show=function(g){this.curTab.style.display="none";for(var f=0,e=this.list.length;f<e;f++){if(this.list[f].getAttribute("j-tab-cnt")==g){this.list[f].style.display="";this.curTab=this.list[f]}}};b.prototype.getCurTab=function(f){var g=this.wrapper.childNodes;for(var h=0,e=g.length;h<e;h++){if(g[h].nodeName==this.option.tag.toUpperCase()&&g[h].getAttribute("j-tab-cnt")==f){return g[h]}}};c.lib=c.lib||{};lib.kit=lib.kit||{};lib.kit.tabContent=b})(window,document);(function(b,a,d){$reg("lib.kit",function(){});function c(e){this._defaultOption={selectClass:"selected",tag:"h2",cntTag:"div"};this.option=Object.extend(this._defaultOption,e);this.tabWrapper=this.option.tabWrapper;this.cntWrapper=this.option.cntWrapper;this.defaultView=this.option.defaultView;this.tab=null;this._initTabAction();this._setContentAction()}c.prototype._initTabAction=function(){this.tab=new lib.kit.Tab(this.tabWrapper,{selectClass:this.option.selectClass,tag:this.option.tag});this.tab.init()};c.prototype._setContentAction=function(){var e=new lib.kit.tabContent(this.cntWrapper,this.defaultView,{tag:this.option.cntTag});this.tab.on("select",function(f){var g=f.target.getAttribute("j-tab");e.show(g)})};c.prototype.init=function(){this.tab.select(this.defaultView)};lib.kit.renderTabs=c})(window,document);$reg("lib.component.PlayHistory",function(){var a=lib.component.PlayHistory;a.FLASHPATH="http://www.qiyi.com/player/20100829153224/clear.swf";a.KEY="Q00211";a.DOMAIN="www.qiyi.com";a.PATH="/";a.videoId=null;a.htmlView={init:function(b){a.EMPTY="暂无播放记录";a.LOADING='<p><span class="loading2"><img alt="loading..." src="http://www.qiyipic.com/common/images/load.gif"/> 播放记录加载中，请稍候...</span></p>';a.boxTpl=['<div class="topCBg">','<p class="pRight" style="text-align:right;padding-right:10px;">','<a data-key="clear" href="javascript:void(0)">清空记录</a> | <a href="javascript:void(0)" class="fOrange" data-key="close">关闭</a>',"</p>",'<ul class="topC_ulList"></ul>','</div><div class="topCBottomBg"></div>'].join("");a.listTpl='<li><a data-key="${vid}" class="shutdown" style="z-index:10" href="javascript:void(0)"></a> <a style="z-index:999;" href="${url}">${title}</a><br/>${info}</li>';b={data:[a.LOADING],bar:"#topT1",list:"#topC1"};document.getElementById("topT1").parentNode.style.display="";this.data=b.data||[a.EMPTY];this.bar=$(b.bar),this.list=$(b.list);this.initHistoryWrapper();this._initEvent();this.cname=window.info?info.title:"";this.list.css("display","");this.initView();this.list.css("visibility","hidden")},setData:function(b){this.data=b||[a.EMPTY]},refresh:function(){a.view.setData(a.model.getViewData());a.view.initView()},initView:function(){var h=[],d="",b={},g="",f=new lib.Template(a.listTpl);if(lib.Maxthon){d='<iframe style="width:223px;height:0;maring:0;padding:0;overflow:hidden;" frameBorder="0"></iframe>'+a.boxTpl}else{d=a.boxTpl}this.list.html(d);for(var c=0;c<=this.data.length-1;c++){var e=this.data[c];if(e&&e.vid&&e.title&&!b[e.title]){b[e.title]=true;e.info=this.getInfo(e);if(e.title==this.cname){g=f.evaluate(e)}else{if(e.time>=0){h.push(f.evaluate(e))}if(e.time<0){h.push(f.evaluate(e))}}}}if(g){h=[g].concat(h)}if(h.length>5){this.list.addClass("topC1")}else{if(h.length==0){h=[a.EMPTY]}this.list.removeClass("topC1")}this.list.down("ul").html(h.join(""));this.currentHeight=this.list.box().height;this.setMaxthon(h.length)},_initEvent:function(){this.list.on("click",this._listClick.bindEvent(this))},_listClick:function(d){d=d||window.event;var c=d.target||d.srcElement;var b=c.getAttribute("data-key");if(b=="close"){this.hide()}if(b=="clear"){this.clean()}if(/\d+/.test(b)){this.del(c)}},initHistoryWrapper:function(){var c=this.list=lib.Element.create("div");c[0].id="topC1";var b=this.bar.box();c.css("width","223px").css("position","absolute").css("top",b.bottom-2+"px").css("left",b.left+"px").css("zIndex",20).css("height",1);$(document.body).append(c)},setMaxthon:function(c,d){if(lib.Maxthon){var b=$("#topC1").elements()[0].offsetHeight;if(d>0){b=b-d}else{if(d<0){b=70}}if(c&&c>5){b+=20}this.list.down("div.topCBg").css("marginTop",-b+"px");this.list.down("iframe").css("height",b+"px");this.list.down("iframe").css("width","223px")}},getInfo:function(b){var e=parseInt(b.time)/3600,d=(e-Math.floor(e))*60,c=Math.floor(e),g=Math.floor(d),f="";if(b.title==this.cname){f="正在播放..."}else{if(b.time<0){f='观看时间少于1分钟 <a href="'+b.url+'" class="jixuLink">继续观看</a>'}else{if(b.time==0){f='已看完！ <a href="'+b.url+'" class="jixuLink">重新观看</a>'}else{f="观看至";if(c){f+=c+"小时"}if(g){f+=g+"分"}f+=' <a href="'+b.url+'" class="jixuLink">继续观看</a>'}}}return f},show:function(){this.bar.attr("class","a2");this.list.css("visibility","visible")},del:function(g){var c=$(g).parent(),j=c.box().height;c.remove();var f=this.list.down("li");if(!f){this.list.down("ul").html(a.EMPTY)}else{if(f.elements().length<=5){this.list.removeClass("topC1")}}var h=window.localStorage.playhistory||"[]";var d=window.JSON.parse(h);var b=d.length,e=0;for(;e<b;e++){if(d[e].title===c.down("a")[1].innerHTML){d.splice(e,1);break}}lib.kit.CrossdomainStorage.saveAll("playhistory",window.JSON.stringify(d));setTimeout(function(){this.setMaxthon(null,j)}.bind(this),100)},clean:function(){lib.kit.CrossdomainStorage.saveAll("playhistory","");this.list.down("ul").html(a.EMPTY);this.list.removeClass("topC1");this.setMaxthon(null,-1)},hide:function(){this.bar.attr("class","a1");this.list.css("visibility","hidden")}};a.flashView={init:function(b){a.historyFlashPath="http://www.qiyi.com/player/20110318194957/playhistory.swf";a.width=223;a.historyFlashHtml=lib.kit.video.render("width",a.width,"height",1,"src",a.historyFlashPath,"id","historyflash","movie",a.historyFlashPath,"align","middle","flashVars","historyWidth="+a.width,"isstr",true);b={bar:"#topT1"};this.bar=$(b.bar);this.cname=window.info?info.title:"";this.initHistoryFlash()},setData:function(b){this.data=b||[a.EMPTY]},initView:function(){$("#historyflash")[0].initView(this.data,this.cname)},refresh:function(){},show:function(){this.bar.attr("class","a2");this.list.css("left",this.bar.pos().left+"px")},hide:function(){this.bar.attr("class","a1");this.list.css("left","-1000px")},initHistoryFlash:function(){var c=this.list=lib.Element.create("div"),b=this.bar.box();c.css("width","223px").css("position","absolute").css("top",b.bottom-2+"px").css("zIndex",20).css("height",1);this.hide();$(document.body).append(c);c.html(a.historyFlashHtml)},setHistoryFlashHeight:function(b){var c=$("#historyflash");if(c){c[0].height=b}}};a.flashData={init:function(){this.initCatchSwf()},getCatchData:function(){var b=this.getFlash();return b.getListFlashCookie()},getStringData:function(){var e=this.getCatchData(),d=[];if(e&&e.length>0){for(var c=0;c<e.length;c++){var b=e[c];d.push([b.title,b.url,b.time,b.vid].join("*"))}return d.join("|")}else{return""}},formatData:function(f,c){var b=f.split("|"),e=[],d={};b.each(function(g){if(g){var h=g.split("*");if(c&&c.except!=h[0]){e.push({title:h[0],url:h[1],time:h[2],vid:h[3]})}else{if(!c){e.push({title:h[0],url:h[1],time:h[2],vid:h[3]})}}}});this.datalength=b.length;return e},getViewData:function(){var b=this.getCatchData();if(!b||!b.length){b=[]}return b},del:function(b){this.getFlash().deleteFlashCookie(b)},clean:function(){this.getFlash().clearFlashCookie()},initCatchSwf:function(){if(!$("#qiyi_catch")){var b=document.createElement("div");document.body.appendChild(b);b.setAttribute("id","qiyi_catch");b.innerHTML=lib.kit.video.render("width",1,"height",1,"src",a.FLASHPATH,"id","qiyi_catche_flash","bgcolor","#A4B6C8","movie",a.FLASHPATH,"align","middle","isstr",true)}},getFlash:function(){var b=null;if(document.qiyi_catche_flash){b=document.qiyi_catche_flash}else{b=window.qiyi_catche_flash||document.getElementById("qiyi_catche_flash")}return b}};a.localStorageData={init:function(){},getCatchData:function(){return JSON.parse(localStorage.playhistory||"[]")},getStringData:function(){var e=this.getCatchData(),d=[];if(e&&e.length>0){for(var c=0;c<e.length;c++){var b=e[c];d.push([b.title,b.url,b.time,b.vid].join("*"))}return d.join("|")}else{return""}},getViewData:function(){var c=[],b=this.getCatchData();if(!b||!b.length){b=[]}if(window.info&&info.videoId){c=[{title:info.title,time:-1,vid:info.videoId-1,url:location.href}]}if(window.location.host==="yule.qiyi.com"){return c.concat(b)}return b},clean:function(){localStorage.playhistory=[]}};a.ctrl={init:function(){this.initView();this.initEvent();a.model.init()},initStartView:function(){a.view.setData(a.model.getViewData());a.view.initView()},initView:function(){a.view.init()},initEvent:function(){if(lib.ipad){this._initCSS();this.initIpadEvent();return}var c=a.view,b=this;c.bar.on("mouseover",this.barOver.bind(this));c.bar.on("mouseout",this.barOut.bind(this));c.list.on("mouseover",this.panelOver.bind(this));c.list.on("mouseout",this.panelOut.bind(this));$(window).on("DOMMouseScroll",function(d){if(b.isOver){lib.Event.preventDefault(d)}})},initIpadEvent:function(){if(!lib.ipad){return}var b=a.view;b.bar[0].addEventListener("click",this._bartouchstart.bindEvent(this),false);b.list[0].addEventListener("click",this._listtouchstart.bindEvent(this),false);document.addEventListener("click",this._docTouchStart.bind(this),false)},_initCSS:function(){if(document.styleSheets.length==0){var c=document.createElement("style");c.type="text/css";document.getElementsByTagName("head")[0].appendChild(c)}var b=document.styleSheets[0];b.addRule(".topC .pRight "," text-align:right;");b.addRule(".topC a.jixuLink "," color:#589c03; text-decoration:underline;");b.addRule(".topC a.jixuLink:hover "," color:#4a7f07;");b.addRule(".topC_ulList "," padding:0 5px; margin:0 5px;");b.addRule(".topC_ulList li "," border-bottom:1px solid #ece8d0; padding:5px 0; line-height:18px; padding-left:18px;");b.addRule(".topC1 "," height:auto;");b.addRule(".topC1 .topC_ulList "," overflow:visible; height:auto;");b.addRule(".shutdown "," background:url(http://www.qiyipic.com/common/images/shutdown.gif) 6px 4px no-repeat; width:18px; height:18px; display:inline-block; vertical-align:middle; margin-left:-21px; display:inline; float:left;");b.addRule(".shutdown:hover "," background-position:6px -67px;");b.addRule("#topC1 "," width:223px; right:115px;");b.addRule("#topC2 "," width:223px; right:0;")},_bartouchstart:function(b){b.stopPropagation();if(!this.isShow){this.barOver();this._hideVideo();this.isShow=true}else{this.panelOut();this._showVideo();this.isShow=false}},_listtouchstart:function(b){b.stopPropagation()},_docTouchStart:function(){if(!!this.isShow){this.panelOut();this._showVideo();this.isShow=false}},_hideVideo:function(){var c=this;var b=setInterval(function(){var d=document.getElementById("video");if(d&&d.parentNode.id=="flashbox"){if(!document.getElementById("j-ipadhistoryshowcover")){c._createCanvas()}else{document.getElementById("j-ipadhistoryshowcover").style.display=""}d.pause();document.getElementById("video").style.display="none";clearInterval(b)}},10)},_showVideo:function(){var c=this;var b=setInterval(function(){var d=document.getElementById("video");if(d&&d.parentNode.id=="flashbox"){if(document.getElementById("j-ipadhistoryshowcover")){document.getElementById("j-ipadhistoryshowcover").style.display="none"}d.play();document.getElementById("video").style.display="";clearInterval(b)}},10)},_createCanvas:function(){var c=document.getElementById("video");var b=document.createElement("img");b.id="j-ipadhistoryshowcover";b.width=c.width;b.height=c.height;b.src=c.width==640?"http://www.qiyipic.com/common/fix/ipadcovernormal.png":"http://www.qiyipic.com/common/fix/ipadcoverwide.png";document.getElementById("flashbox").appendChild(b)},barOut:function(){var b=this;this.barOutTimeOut=setTimeout(function(){b.hide()},50)},panelOut:function(){this.isOver=false;this.hide()},barOver:function(){clearTimeout(this.barOutTimeOut);lib.component&&lib.component.suggest&&lib.component.suggest.close();a.view.refresh();a.view.show()},panelOver:function(){this.isOver=true;clearTimeout(this.barOutTimeOut);a.view.show()},hide:function(){a.view.hide()},saveData:function(b,e,c,f,d){a.view.cname=f;a.view.setData([{vid:b,time:e,url:c,title:f,tvId:d}].concat(a.model.getCatchData()));a.view.initView()},clean:function(){a.model.clean()},setHistoryFlashHeight:function(b){a.view.setHistoryFlashHeight(b)},getFlash:function(){return a.model.getFlash()}};a.init=function(){a.ctrl.init()}});if(!lib.ipad){var playHistory=lib.component.PlayHistory,ctrl=playHistory.ctrl;playHistory.view=playHistory.flashView;playHistory.model=playHistory.flashData;window.flashLoadOK=function(){if(ctrl.getFlash()){ctrl.initStartView()}};window.postVideoId=function(a,e,b,f,d,c){if(ctrl.getFlash()){ctrl.saveData(a,e,b,f,c)}};if(lib.$("#topT1")){playHistory.init()}}else{var playHistory=lib.component.PlayHistory,ctrl=playHistory.ctrl;playHistory.view=playHistory.htmlView;playHistory.model=playHistory.localStorageData;if(lib.$("#topT1")){playHistory.init();ctrl.initStartView()}}(function(f,a,g){if(!lib.ipad){return}function c(i){this.player=h(i);this._history=new b();this.init()}c.prototype={newValue:0,oldValue:0,init:function(){this._initEvent()},_initEvent:function(){this.player.addEventListener("timeupdate",this._timeupdate.bind(this),false);this.player.addEventListener("loadeddata",this._loadeddata.bind(this),false);this.player.addEventListener("ended",this._ended.bind(this),false);this.player.addEventListener("timeupdate",this.continuePlay.bind(this),false)},_timeupdate:function(){var j=Math.round(this.player.currentTime);this.newValue=j;var i=j%60;if(this.newValue!=this.oldValue&&i==0){this.oldValue=j;this._recordHistory()}},continuePlay:function(){if(!!this.continued){return}var i=this._history.getItem(info.title),j="";if(i!==null){j=this._history.aHistory[i].time;if(j>0){try{this.player.currentTime=j;this.continued=true;this._history.update(j)}catch(k){}}}else{this._history.playStart();this.continued=true}},_ended:function(){this._history.playEnd()},_loadeddata:function(){this.continuePlay()},_recordHistory:function(){var i=Math.round(this.player.currentTime);this._history.update(i)}};function b(){this.title=info.title;this.tvId=info.tvId;this.videoId=info.videoId;this.videoUrl=location.href;this._sync();this.max=10}b.prototype={playStart:function(){this.addItem({time:"-1",vid:this.videoId,url:this.videoUrl,title:this.title})},playEnd:function(){this.update(0)},update:function(i){if(!!this.aHistory[0]&&(this.title!==this.aHistory[0].title)){this.playStart()}this._sync();this.aHistory[0]={time:i,vid:this.videoId,url:this.videoUrl,title:this.title,tvId:this.tvId};this.save()},addItem:function(j){this._sync();var i=this.getItem(j.title);if(i==null){this.aHistory.unshift(j)}else{this.aHistory.splice(i,1);this.aHistory.unshift(j)}this.save()},getItem:function(l){var j=this.aHistory.length,k=0;for(;k<j;k++){if(this.aHistory[k].title==l){return k}}return null},_sync:function(){var i=f.localStorage.playhistory||"[]";this.aHistory=f.JSON.parse(i)},save:function(){if(f.location.host==="yule.qiyi.com"){return}var i=this.aHistory.length;if(i>this.max){this.aHistory.splice(this.max,i-this.max)}var j=f.JSON.stringify(this.aHistory);lib.kit.CrossdomainStorage.saveAll("playhistory",j)}};function h(i){return typeof i=="string"?a.getElementById(i):i}var e=setInterval(function(){var i=a.getElementById("video");if(i&&i.parentNode.id=="flashbox"){new c("video");clearInterval(e)}},10);function d(j){var i=a.createElement("div");a.body.appendChild(i);i.innerHTML=i.innerHTML+("<p>"+j+"</p>")}})(window,document);$reg("lib.kit.CrossdomainStorage",function(){lib.kit.CrossdomainStorage=Class.create({initialize:function(d,c){this._destDomain=d;this._destKey=c},_createFrame:function(){},save:function(e){var f=this;var c=lib.kit.CrossdomainStorage._frames[this._destDomain];if(c){if(c.loaded===true){d(c,e)()}}else{c=lib.kit.CrossdomainStorage._frames[this._destDomain]=lib.Element.create("iframe");c.css("height","0px");c.css("width","0px");c.attr("frameBorder","0");c.attr("src",lib.kit.CrossdomainStorage.domains[this._destDomain]+"#"+this._destKey);c.on("load",function(){c.loaded=true;d(c,e)()});$(document.body).append(c)}function d(g,h){return function(){try{g[0].contentWindow.postMessage(h,"http://"+f._destDomain+".qiyi.com")}catch(i){}}}}});lib.kit.CrossdomainStorage.domains={www:"http://www.qiyi.com/common/across.html",yule:"http://yule.qiyi.com/across.html",list:"http://list.qiyi.com/across.html"};lib.kit.CrossdomainStorage._currDomain="www";lib.kit.CrossdomainStorage._frames={};var a=/^\w+:\/\/.*?([^\.]*)\.?qiyi\.com.*$/i;var b=window.location.href.toLowerCase().match(a);if(b&&b.length==2){lib.kit.CrossdomainStorage._currDomain=b[1]}lib.kit.CrossdomainStorage.saveAll=function(d,g){var f=lib.kit.CrossdomainStorage;for(var e in f.domains){if(e===f._currDomain){window.localStorage.removeItem(d);window.localStorage[d]=g;continue}var c=new f(e,d);c.save(g)}}});$reg("lib.res.DomainSet",function(){lib.res.DomainSet=["www","tj","tianyi","hd.tianyi","ln","henan"]});(function(b,a,c){$reg("lib.action",function(){});function d(){var e=a.location.href;for(var f=0;f<lib.res.DomainSet.length;f++){if(-1!=a.location.hostname.indexOf(lib.res.DomainSet[f])){return lib.res.DomainSet[f]}else{if(a.location.hostname.match(/list\.qiyi\.com/)){var g=/\/([a-z]+)\//i;e.match(g);return RegExp.$1}}if(f==lib.res.DomainSet.length-1){return lib.res.DomainSet[0]}}}lib.action.getDomainName=d})(window,document);(function(){$reg("lib.ui",function(){});lib.ui.viewCenter=function(e){if(!e){return}var d=e.offsetWidth,a=e.offsetHeight,c=lib.box.getViewportWidth(),b=lib.box.getViewportHeight();if(!d||!a){throw"zero width or height."}var f={left:(c-d)/2+lib.box.getPageScrollLeft(),top:(b-a)/2+lib.box.getPageScrollTop()};if(e.style.position!=="absolute"){e.style.position="absolute"}$(e).pos(f)}})();$reg("lib.kit.Draggable",function(){lib.kit.Draggable=Class.create({initialize:function(a){this.options=Object.extend({handle:null,helper:"original",containment:false,element:null,onDrag:null,onStop:null,onStart:null},a);if(!(this.element=$(this.options.element))){return}this._mouseInit()},_mouseInit:function(){var a=this;this._mouseDownDelegate=function(b){a._mouseDown(b)};lib.Event.on(this.element[0],"mousedown",this._mouseDownDelegate);a.handle=$(this.options.handle,this.element[0]);a.handle.css("cursor","move")},_mouseDown:function(b){var a=this;if(!b.target){b.target=b.srcElement||document}if(!b.which&&b.button!==undefined){b.which=(b.button&1?1:(b.button&2?3:(b.button&4?2:0)))}a._mouseStarted&&a._mouseUp(b);a._mouseDownEvent=b;if(b.which!=1||!a._getHandle(b)){return true}a._mouseStarted=(a._mouseStart(b)!==false);if(!a._mouseStarted){lib.Event.preventDefault(b);return true}a._mouseMoveDelegate=function(c){return a._mouseMove(c)};a._mouseUpDelegate=function(c){return a._mouseUp(c)};lib.Event.on(document,"mousemove",a._mouseMoveDelegate).on(document,"mouseup",a._mouseUpDelegate);lib.Event.preventDefault(b);return true},_mouseUp:function(a){lib.Event.un(document,"mousemove",this._mouseMoveDelegate);lib.Event.un(document,"mouseup",this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._mouseStop(a)}return false},_getHandle:function(b){var c=this.handle;if(!c){return false}var d=b.target,a=c[0];while(d&&d.nodeType!==9){if(d==a){return true}d=d.parentNode}return false},_mouseStart:function(c){var e=this.options,b=e.onStart;if(c.pageX==null&&c.clientX!=null){var d=document.documentElement,a=document.body;c.pageX=c.clientX+(d&&d.scrollLeft||a&&a.scrollLeft||0)-(d&&d.clientLeft||a&&a.clientLeft||0);c.pageY=c.clientY+(d&&d.scrollTop||a&&a.scrollTop||0)-(d&&d.clientTop||a&&a.clientTop||0)}this.helper=this._createHelper(c);this._cacheHelperProportions();this._cacheMargins();this.offset=this.element.pos();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};Object.extend(this.offset,{click:{left:c.pageX-this.offset.left,top:c.pageY-this.offset.top},parent:this._getParentOffset()});this.originalPosition=this.position=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=c.pageY;if(b&&b.call(this.element[0],c)===false){this._mouseUp({});return false}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";return true},_getParentOffset:function(){this.offsetParent=$(this.helper[0].offsetParent);var a=this.offsetParent.pos();if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&lib.IE)){a={top:0,left:0}}return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_mouseMove:function(a){if(lib.IE&&a.button===undefined){return this._mouseUp(a)}if(this._mouseStarted){this._mouseDrag(a);return lib.Event.preventDefault(a)}this._mouseStarted=(this._mouseStart(this._mouseDownEvent,a)!==false);(this._mouseStarted?this._mouseDrag(a):this._mouseUp(a));return !this._mouseStarted},_mouseStop:function(b){var a=this.options.onStop;if(a&&a.call(this.element[0],b)!==false){this._clear()}return false},_createHelper:function(a){return this.element},_cacheHelperProportions:function(){var a=this.helper.box;this.helperProportions={width:a.width,height:a.height}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_generatePosition:function(d){if(d.pageX==null&&d.clientX!=null){var e=document.documentElement,a=document.body;d.pageX=d.clientX+(e&&e.scrollLeft||a&&a.scrollLeft||0)-(e&&e.clientLeft||a&&a.clientLeft||0);d.pageY=d.clientY+(e&&e.scrollTop||a&&a.scrollTop||0)-(e&&e.clientTop||a&&a.clientTop||0)}var c=d.pageX;var b=d.pageY;var f=this.options.containment;if(f){if(d.pageX-this.offset.click.left<f[0]){c=f[0]+this.offset.click.left}if(d.pageY-this.offset.click.top<f[1]){b=f[1]+this.offset.click.top}if(d.pageX-this.offset.click.left>f[2]){c=f[2]+this.offset.click.left}if(d.pageY-this.offset.click.top>f[3]){b=f[3]+this.offset.click.top}}return{top:b-this.offset.click.top-this.offset.parent.top,left:c-this.offset.click.left-this.offset.parent.left}},_mouseDrag:function(b){this.position=this._generatePosition(b);var a=this.options.onDrag;if(a&&a.call(this.element[0],b)===false){this._mouseUp(b);return false}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";return false},_clear:function(){var a=this.helper[0];if(a!=this.element[0]&&!this.cancelHelperRemoval){a.parentNode.removeChild(a)}this.helper=null;this.cancelHelperRemoval=false},destroy:function(){if(!this.element.hasClass("j-draggable")){return}this.element.removeClass("j-draggable");this.handle.css("cursor","");this._mouseDestroy();return this},_mouseDestroy:function(){lib.Event.un(this.element[0],"mousedown",this._mouseDownDelegate)}})});$reg("lib.kit.Dialog",function(){lib.kit.Dialog=Class.create({template:'<div style="display: none;width:${width}px;height:${height}px;"class="j-dialog j-widget-content j-corner-all ${dialogClass}" tabindex="-1"><div class="j-dialog-titlebar j-widget-header j-corner-all j-helper-clearfix" unselectable="on"style="-moz-user-select: none;"><span class="j-dialog-title" unselectable="on" style="-moz-user-select: none;">${title}</span><a href="#" class="j-dialog-close j-corner-all" unselectable="on" style="-moz-user-select: none;"><span class="j-icon j-icon-closethick" unselectable="on" style="-moz-user-select: none;"></span></a></div><div class="j-dialog-content j-widget-content"></div><div class="j-dialog-buttonpane j-widget-content j-helper-clearfix"></div></div>',buttonTemplate:new lib.Template('<a href="#" class="inputBtn2" onclick="return false;">${text}</a>'),initialize:function(a){this.options=Object.extend({autoOpen:true,buttons:[],closeOnEscape:true,content:"",contentSelector:"",dialogClass:"",draggable:true,height:"auto",modal:true,onBeforeClose:null,onClose:null,onDrag:null,onDragStart:null,onDragStop:null,onOpen:null,overlay:{},pos:{},stack:true,title:"",zIndex:100,destroyOnClose:true},a);this._create()},_create:function(){var c=this,d=c.options,b,e,f=d.content,a=d.contentSelector;$(document.body).append(b=c.uiDialog=$(lib.Element.create("div").html(new lib.Template(d.template||c.template).evaluate(d))[0].firstChild).css("position","absolute").css("zIndex",d.zIndex).on("keydown",function(h){if(d.closeOnEscape&&h.keyCode&&h.keyCode===27){c.close(h);lib.Event.preventDefault(h)}}));e=c.content=b.down(".j-dialog-content");if(a){e.append($(a))}else{if(typeof f=="string"){e.html(f)}else{e.append($(f))}}var g=b.down(".j-dialog-close");g&&g.on("click",function(h){c.close(h);return false});c.uiDialogTitlebar=b.down(".j-dialog-titlebar");if(d.draggable&&lib.kit.Draggable){c._makeDraggable()}c._createButtons(d.buttons);lib.Event.on(window,"resize",c.onResize=function(){c._setPos(d.pos)});c._isOpen=false;if(!d.modal){lib.kit.BgIframe.create(b)}if(this.options.autoOpen){this.open()}},_createButtons:function(g){var d=this,f=d.options,b=false,c=d.uiDialog,a=c[0];d.uiDialogButtonPane=c.down(".j-dialog-buttonpane");if(typeof g==="object"&&g!==null){lib.each(g,function(){return !(b=true)})}if(b){var e=d.uiDialogButtonPane.down("*");e&&e.remove();if(g.constructor==Object){g=[g]}d.buttons=[];lib.each(g,function(i){var h=$(lib.Element.create("div").html((f.buttonTemplate||d.buttonTemplate).evaluate(i))[0].firstChild).on("click",function(k){var j=i.fn;if(j&&j.constructor==Function){j.apply(a,arguments)}if(i.close){d.close(k)}});d.buttons.push(h);d.uiDialogButtonPane.append(h)});d._initButtonEvents()}},open:function(){if(this._isOpen){return}var b=this,c=b.options,a=b.uiDialog;b.overlay=c.modal?lib.kit.Overlay.create(c.overlay):null;a.show();b._isOpen=true;this._setPos(c.pos);var d=b.buttons;(d||a)[0].focus();if(c.onOpen){c.onOpen.apply(a[0])}return b},close:function(f){if(!this._isOpen){return}var d=this,e=d.options,b=e.onBeforeClose,c=e.onClose,a=d.uiDialog[0];if(b&&false===b.call(a,f)){return}if(d.overlay){lib.kit.Overlay.destroy(d.overlay)}d._isOpen=false;if(e.destroyOnClose){d.destroy()}else{d.uiDialog.hide()}if(c){c.call(a,f)}return d},setContent:function(a){this.content.html(a)},_setPos:function(h){if(!this._isOpen){return}var i,d,a=this.uiDialog,f=a.box();if(h&&h.top){i=h.top}else{var e=f.height==0?180:f.height;var c=lib.box.getViewportHeight();var b=lib.box.getPageScrollTop();if(e<(c-30)){i=(c-e)/2+b}else{i=b+30}}if(h&&h.left){d=h.left}else{var g=f.width==0?180:f.width;var j=lib.box.getViewportWidth();d=(j-g)/2}a.css("top",i+"px");a.css("left",d+"px");lib.kit.BgIframe.setBox(a);return this},_initButtonEvents:function(){},isOpen:function(){return this._isOpen},destroy:function(){var a=this;if(a.overlay){lib.kit.Overlay.destroy(a.overlay)}lib.Event.un(window,"resize",a.onResize);document.body.removeChild(a.uiDialog[0]);return a},_makeDraggable:function(){var d=this.options,b=this.uiDialog,a=b[0],e=d.onDragStart,c=d.onDrag,g=d.onDragStop,f=this.uiDialogTitlebar;if(f){this.draggable=new lib.kit.Draggable({element:b,handle:f,onStart:function(h){if(typeof e=="function"){return e.call(a,h)}},onDrag:function(h){if(typeof c=="function"){return c.call(a,h)}},onStop:function(h){lib.kit.Overlay.resize();if(typeof g=="function"){return g.call(a,h)}}});b.addClass("j-draggable")}},widget:function(){return this.uiDialog},option:function(c,d){var b=c,a=this;if(arguments.length===0){return Object.extend({},a.options)}if(typeof c==="string"){if(d===undefined){return this.options[c]}b={};b[c]=d}lib.each(b,function(f,e){a._setOption(e,f)});return a},_setOption:function(d,e){var b=this,a=b.uiDialog,c=false;switch(d){case"buttons":b._createButtons(e);break;case"dialogClass":a.removeClass(b.options.dialogClass).addClass(e);break;case"draggable":if(e){b._makeDraggable()}else{this.draggable.destroy()}break;case"position":d="pos";b._setPos(e);break;case"title":$(".j-dialog-title",b.uiDialogTitlebar[0]).html(""+(e||"&#160;"));break}this.options[d]=e},setPos:function(b,a){this._setOption("position",{top:b,left:a})}})});$reg("lib.kit.Overlay",function(){lib.kit.Overlay={instances:[],oldInstances:[],create:function(b){b=Object.extend({color:"#666666",opacity:50},b);if(this.instances.length===0){lib.Event.on(window,"resize",this.resize)}var a=b.opacity;var c=(this.oldInstances.pop()||lib.Element.create("div").css("position","fixed").css("top","0px").css("left","0px")).css("width",this._getWidth()).css("height",this._getHeight()).css("backgroundColor",b.color).css("filter","alpha(opacity="+a+")").css("opacity",a/100).css("zIndex",10);if(lib.IE6){c.css("position","absolute")}$(document.body).append(c);lib.kit.BgIframe.create(c);this.instances.push(c);return c},resize:function(){var a=lib.kit.Overlay;lib.each(a.instances,function(b){b.css("width",0).css("height",0).css("width",a._getWidth()).css("height",a._getHeight());lib.kit.BgIframe.setBox(b)})},_getWidth:function(){var a,b;if(lib.IE6){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(a<b){return lib.box.getViewportWidth()+"px"}else{return a+"px"}}else{if(lib.IE7||lib.IE8){return(Math.max(document.documentElement.clientWidth,document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth)-1)+"px"}return Math.max(document.documentElement.clientWidth,document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth)+"px"}},_getHeight:function(){var b,a;if(lib.IE6){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);a=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(b<a){return lib.box.getViewportHeight()+"px"}else{return b+"px"}}else{return lib.box.getDocumentHeight()+"px"}},destroy:function(b){this.oldInstances.push(this.instances.splice(this.instances.index(b),1)[0]);if(this.instances.length===0){lib.Event.un(window,"resize",this.resize)}var c=b[0],a=c.parentNode;if(a){a.removeChild(c)}}}});$reg("lib.kit.BgIframe",function(){lib.kit.BgIframe={create:function(a){if(lib.IE6){a=$(a);if(!a.down("iframe.bgiframe")){this.setBox(a.append(lib.Element.create('<iframe class="bgiframe"frameborder="0" tabindex="-1"src="javascript:false;"style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');top:0px;left:0px;"/>')))}}},setBox:function(a){a=$(a);var c=a.down("iframe.bgiframe");if(c){var b=a.box();lib.each(["width","height"],function(d){c.css(d,b[d]+"px")})}}}});lib.cookie={};$reg("lib.cookie",function(){lib.cookie["delete"]=function(a,d,b,c){document.cookie=a+"=;expires=Fri, 31 Dec 1999 23:59:59 GMT;path="+(d||"/")+";domain="+b};lib.cookie.get=function(a){a=a.replace(/([\.\[\]\$])/g,"\\$1");var c=new RegExp(a+"=([^;]*)?;","i");var d=document.cookie+";";var b=d.match(c);if(b){return decodeURIComponent(b[1])||""}else{return""}};lib.cookie.set=function(b,f,c,i,e,a){var g=[];g.push(b+"="+encodeURIComponent(f));if(c){var h=new Date();var d=h.getTime()+c*3600000;h.setTime(d);g.push("expires="+h.toGMTString())}if(i){g.push("path="+i)}if(e){g.push("domain="+e)}if(a){g.push(a)}document.cookie=g.join(";")}});$reg("lib.kit.Monitor",function(){lib.kit.Monitor=Class.create({initialize:function(b,a){this._fn=b;this._opt={time:1000};Object.extend(this._opt,a)},start:function(){var a=this;this._timer=setTimeout(function(){if(a._fn.call()===false){a._timer=setTimeout(arguments.callee,a._opt.time);return}},this._opt.time)}})});$reg("lib.kit.UnderFrame",function(){lib.kit.UnderFrame={_frames:{},show:function(c){var b=lib.$("#"+c);if(!b){return}if(lib.IE6||lib.IE7||lib.Maxthon){if(!this._frames[c]){this._frames[c]=lib.Element.create("iframe");this._frames[c].attr("src","about:blank");this._frames[c].attr("frameBorder","0");this._frames[c].hide();lib.$(document.body).append(this._frames[c])}var a=b.box();this._frames[c].show();this._frames[c].css("position","absolute");this._frames[c].css("zIndex",(b.css("zIndex")-1).toString());this._frames[c].css("top",a.top+"px");this._frames[c].css("left",a.left+"px");this._frames[c].css("width",a.width+"px");this._frames[c].css("height",a.height+"px")}},hide:function(b){var a=lib.$("#"+b);if(!a){return}if(this._frames[b]){this._frames[b].hide()}}}});(function(a,b){lib.action.ipadPlayer={hideVideo:function(){var d=this;var c=setInterval(function(){var e=document.getElementById("video");if(e&&e.parentNode.id=="flashbox"){e.pause();e.style.display="none";clearInterval(c);if(!document.getElementById("j-ipadhistoryshowcover")){d._createCanvas()}else{document.getElementById("j-ipadhistoryshowcover").style.display=""}}},10)},showVideo:function(){var d=this;var c=setInterval(function(){var e=document.getElementById("video");if(e&&e.parentNode.id=="flashbox"){if(document.getElementById("j-ipadhistoryshowcover")){document.getElementById("j-ipadhistoryshowcover").style.display="none"}e.play();document.getElementById("video").style.display="";clearInterval(c)}},10)},_createCanvas:function(){var d=document.getElementById("video");var c=document.createElement("img");c.id="j-ipadhistoryshowcover";c.width=d.width;c.height=d.height;c.src=d.width==640?"http://www.qiyipic.com/common/fix/ipadcovernormal.png":"http://www.qiyipic.com/common/fix/ipadcoverwide.png";document.getElementById("flashbox").appendChild(c)}}})(window);(function(h,c){var a=false;var d=null;var f,i,k,g,e,j,b;lib.component.HeaderPopup={init:function(){var m=this;var l=new lib.kit.Monitor(function(){f=lib.$("#j-username"),i=lib.$("#j-user-popup"),k=lib.$("#j-header");if(!f||!i||!k){return false}f.on("click",m._clickHandler.bind(m));if(!lib.ipad){f.on("mouseover",m._userOver.bind(m));f.on("mouseout",m._userOut.bind(m));i.on("mouseover",m._popupOver.bind(m));i.on("mouseout",m._popupOut.bind(m))}},{time:100});l.start()},destroy:function(){f.un("click",this._clickHandler.bind(this));f.un("mouseover",this._userOver.bind(this));f.un("mouseout",this._userOut.bind(this));i.un("mouseover",this._popupOver.bind(this));i.un("mouseout",this._popupOut.bind(this))},_show:function(){g=f.box(),e=k.box(),j=e.top+e.height,b=g.left+g.width;i.show();i.css("top",j+"px");i.css("left",b-i.box().width+21+"px");lib.kit.UnderFrame.show("j-user-popup")},_hide:function(){i.hide();lib.kit.UnderFrame.hide("j-user-popup")},_clickHandler:function(l){lib.Event.preventDefault(l);if(lib.ipad){if(a){this._hide();a=false;if(lib.action.ipadPlayer){lib.action.ipadPlayer.showVideo()}}else{this._show();a=true;if(lib.action.ipadPlayer){lib.action.ipadPlayer.hideVideo()}}}},_userOver:function(l){if(d!==null){clearTimeout(d)}if(a!==true){this._show();a=true}},_userOut:function(l){var m=this;if(a===true){d=setTimeout(function(){m._hide();a=false},100)}},_popupOver:function(l){if(d!==null){clearTimeout(d)}},_popupOut:function(l){var m=this;if(a===true){d=setTimeout(function(){m._hide();a=false},100)}}}})(window);(function(a,b){var c=document.getElementById("j-login-wrapper");if(!c){return}$reg("lib.tpl",function(){});lib.tpl.menu=['<div class="head_popup" id="j-user-popup" style="width:92px;display:none;z-index:999;">','<ul class="head_ul qitan_UL">','<li class="" id="j-qtsns"><a href="http://t.qiyi.com/" target="_blank" j-delegate="startwatcher">奇谈社区</a></li>','<li class="qitan_msg" id="j-qtmsg-wrapper">','<p><a href="http://t.qiyi.com/${uid}/atme" target="_blank" j-delegate="startwatcher">-@我的(<em id="j-atme-num">0</em>)</a></p>','<p><a href="http://t.qiyi.com/${uid}/comment" target="_blank" j-delegate="startwatcher">-新回复(<em id="j-cmt-num">0</em>)</a></p>','<p><a href="http://t.qiyi.com/${uid}/fans" target="_blank" j-delegate="startwatcher">-新粉丝(<em id="j-fans-num">0</em>)</a></p>',"</li>",'<li><a href="http://passport.qiyi.com/user/setinfo.php" target="_blank">帐号设置</a></li>','<li class="liLast"><a j-delegate="logout" href="http://passport.qiyi.com/user/logout.php">安全退出</a></li>',"</ul>",'<span class="arraw"></span>',"</div>"].join("");$reg("lib.component",function(){});$reg("lib.__callbacks__",function(){});lib.component.login={};Object.extend(lib.component.login,{renderTopbar:function(){var d=this.getUserInfo(),e="";if(!this.isLogin()){if(document.getElementById("j-username")){$("#j-username").un("mouseover",this.createHTML);lib.component.HeaderPopup.destroy()}c.innerHTML='<a href="http://passport.qiyi.com/register/reg.php?url='+(lib.PROJECT_REG_URL||"")+'" target="_blank">注册</a> | <a j-delegate="login" href="http://passport.qiyi.com/user/login.php">登录</a> |';c.className="color55"}else{e=d.nickname||"";e=(e=="")?(d.uid||""):(e.getLen()>10?(e.trancate(10,"")+"..."):e);c.innerHTML='<a id="j-username" class="head_more" href="#"><span>'+e+"</span></a>&nbsp;";c.className="username";this._createMenuHTML(d)}},_createMenuHTML:function(d){if(!document.getElementById("j-user-popup")){var e=new lib.Template(lib.tpl.menu);$(document.body).html("beforeend",e.evaluate({uid:d.uid}));lib.component.HeaderPopup.init()}},removeUserMenu:function(){var d=$("#j-user-popup");if(d){d.remove()}}})})(window);(function(a,b){a.kit=a.kit||{};kit.dialog=function(c){lib.eventTarget.call(this);this._option={model:true,delegates:["ok","no"]};this.setOption(c)};kit.dialog.inherits(lib.eventTarget);Object.extend(kit.dialog.prototype,{show:function(c){if(this._option.model&&!this._cover){lib.kit.Overlay.create({color:"#000"});this._cover=lib.kit.Overlay.instances[0]}if(this.box){return}if(c.html){this.renderHTML(c.html);return}if(c.src){this.renderIfr(c)}this.fire({type:"show"})},setOption:function(c){Object.extend(this._option,c||{})},renderHTML:function(d){var c=this._tempId="j-"+(new Date()).getTime();$(document.body).html("beforeend","<div id="+c+">"+d+"</div>");this.box=$("#"+c)[0].firstChild;this._addDelegates()},_addDelegates:function(){var f=0,e=this._option.delegates,c=e.length;this.listDlg=[];var d=null;for(;f<c;f++){d=this._cbdlg.bind(this,e[f]);this.listDlg.push(d);$(this.box).delegate(e[f],d)}},_removeDelegates:function(){if(!this.listDlg){return}var f=0,e=this._option.delegates,c=e.length;var d=null;for(;f<c;f++){d=this.listDlg[f];$(this.box).undelegate(e[f],d)}this.listDlg=null},_cbdlg:function(c){this.fire({type:c})},setCenter:function(){lib.ui.viewCenter(this.box)},renderIfr:function(d){var f={src:"about:blank",width:415,height:339},e=document.getElementById("j-dialog");var c=this._tempId="j-"+(new Date()).getTime();$(document.body).html("beforeend","<div id="+c+"></div>");Object.extend(f,d);if(!!e){e.width=f.width;e.height=f.height;e.src=f.src}else{$(document.body).html("beforeend",'<iframe allowtransparency="true" id="j-dialog" src="'+f.src+'" frameborder="0" scrolling="no" width="'+f.width+'" height="'+f.height+'" style="z-index:9999;"></iframe>');e=document.getElementById("j-dialog")}this.box=e;lib.ui.viewCenter(this.box);this.__setCenter=this.setCenter.bind(this);$(a).on("resize",this.__setCenter);if(lib.IE6){$(a).on("scroll",this.__setCenter)}},close:function(){var c=document.getElementById(""+this._tempId);if(!c){return}lib.kit.Overlay.destroy(this._cover);$(this.box).remove();this._removeDelegates();this.fire({type:"close"});this.box=null;this._cover=null;if(c){$(c).remove()}if(this.__setCenter){$(a).un("resize",this.__setCenter)}if(lib.IE6){$(a).un("scroll",this.__setCenter)}}})})(window);(function(window,undefined){var wrapper=document.getElementById("j-login-wrapper");if(!wrapper){return}$reg("lib.component",function(){});$reg("lib.__callbacks__",function(){});var PACK=lib.component.login=lib.component.login||{};Object.extend(lib.component.login,{_loginList:[],_logoutList:[],dialog:null,show:function(fn,opt){var defaultOption={showClose:true,regUrl:""};Object.extend(defaultOption,opt||{});var url="",regUrl="";var nullCallback=function(){};nullCallback.isTemp=true;fn=fn||nullCallback;if(!this.isLogin()){this.clearTempCb();this.setCallback("login",fn);regUrl=defaultOption.regUrl||lib.PROJECT_REG_URL;url=regUrl?"?url="+regUrl+"&showclose=":"?showclose=";this.dialog.show({src:"http://passport.qiyi.com/user/loginiframe.php"+url+defaultOption.showClose})}else{fn()}},isLogin:function(){return lib.cookie.get("P00002")!==""&&lib.cookie.get("P00003")!==""},getUserInfo:function(){var userInfo=lib.cookie.get("P00002");return userInfo==""?"":window.JSON?window.JSON.parse(userInfo):eval("("+userInfo+")")},setCallback:function(type,cb){if(type=="login"){if(this._loginList.indexOf(cb)==-1){this._loginList.push(cb)}}else{this._logoutList.push(cb)}},runCallbacks:function(type){var checker={login:true,logout:true},userInfo=this.getUserInfo();if(!checker[type]){return}var len=this["_"+type+"List"].length,fn=null;for(var i=0;i<len;i++){fn=this["_"+type+"List"][i];fn(userInfo)}this.clearTempCb()},logout:function(e){$(document.body).html("beforeend",'<iframe id="j_logout_" src="http://passport.qiyi.com/user/logout.php?noredirect=1&logoutcb=lib.__callbacks__.logout_callback" style="display:none;"></iframe>')},_dlgLogout:function(e){lib.Event.preventDefault(e.event);if(lib.PROJECT_LOGOUT_ACTION){lib.go(lib.PROJECT_LOGOUT_ACTION)}else{this.logout()}},_dlgLogin:function(e){lib.Event.preventDefault(e.event);var target=e.target;if(!this.isLogin()){lib.component.login.show(null,{regUrl:(target.getAttribute("data-regurl")||"")})}else{this.runCallbacks("login")}},clearTempCb:function(){var len=this._loginList.length,fn=null;for(var i=0;i<len;i++){fn=this._loginList[i];if(fn.isTemp&&fn.isTemp===true){this._loginList.splice(i,1)}}},init:function(){this.dialog=new kit.dialog();lib.PROJECT_LOGIN_COMPONENT=lib.component.login;this.renderTopbar&&this.renderTopbar();$(document).delegate("login",this._dlgLogin.bind(this));$(document).delegate("logout",this._dlgLogout.bind(this))}});PACK.init();PACK.setCallback("login",function(){PACK.dialog.close();if(PACK.renderTopbar){PACK.renderTopbar()}});PACK.setCallback("logout",function(){if(PACK.renderTopbar){PACK.renderTopbar()}lib.kit.UnderFrame.hide("j-user-popup");setTimeout(function(){if($("#j_logout_")){$("#j_logout_").remove()}if(PACK.removeUserMenu){PACK.removeUserMenu()}},100)});var login_success=function(data){PACK.runCallbacks("login")};var login_error=function(data){};var logout_callback=function(){PACK.runCallbacks("logout")};lib.__callbacks__.login_success=login_success;lib.__callbacks__.login_error=login_error;lib.__callbacks__.logout_callback=logout_callback})(window);(function(){if(!lib.$("#j-chMore")||!lib.$("#j-ch-popup")){return}var a={init:function(){this._btn=lib.$("#j-chMore");this._list=lib.$("#j-ch-popup");this._list.show();this._listWidth=this._list.box().width;this._initPosition();this._list.hide();this._initEvent()},update:function(b){this._list.css("top",this._top+"px");this._list.css("left",this._left+"px")},_initPosition:function(){var d=this._btn.box(),b=lib.$("#j-header"),c=b.box();this._top=c.top+c.height;this._left=d.left+d.width-this._listWidth+21},_initEvent:function(){var c=this;var b=false;if(lib.ipad){this._btn.on("click",function(d){lib.Event.stop(d);if(c._list.css("display")=="none"){c._initPosition();c.update();c._list.show();lib.kit.UnderFrame.show("j-ch-popup")}else{c._list.hide();lib.kit.UnderFrame.hide("j-ch-popup")}})}else{this._btn.on("mouseover",function(){if(c._timer){clearTimeout(c._timer)}if(!b){c._initPosition();c.update();c._list.show();lib.kit.UnderFrame.show("j-ch-popup");b=true}});this._btn.on("mouseout",function(){if(b){c._timer=setTimeout(function(){c._list.hide();lib.kit.UnderFrame.hide("j-ch-popup");b=false},100)}});this._list.on("mouseover",function(){if(c._timer){clearTimeout(c._timer)}});this._list.on("mouseout",function(){if(b){c._timer=setTimeout(function(){c._list.hide();lib.kit.UnderFrame.hide("j-ch-popup");b=false},100)}})}lib.$(window).on("resize",function(){c._initPosition();c.update()})}};a.init()})();(function(c,b,f){function e(h,g){function i(){}i.prototype=g.prototype;h.superClass_=g.prototype;h.prototype=new i();h.prototype.constructor=h}lib.html2Nodes=function(h){var g=b.createElement("div");g.innerHTML=h;return g.childNodes};var a={len:2,delayTime:200,isswfWrapper:false,isJsSubmit:true};function d(i,g,h){lib.eventTarget.call(this);this.textInput=typeof i=="string"?b.getElementById(i):i;this.resultWrapper=null;this._dataApi=g;this.option=Object.extend(a,h);this._state=false;this._timer=null;this._query="";this.oldValue="";this.keyword="";this._dataCache={};this._isnaving=false;this._keySelecting=false;this._ifrCover=null}e(d,lib.eventTarget);Object.extend(d.prototype,{_onBlur:function(){lib.log("sugest blur");this.stop();if(!this.option.isswfWrapper){this.close()}},_initTextInput:function(){var g=this;this.textInput.setAttribute("autocomplete","off");$(this.textInput).on("blur",this._onBlur.bind(this));$(this.textInput).on("keydown",function(i){i=lib.fixEvent(i);var h=i.keyCode;if(h==27){g.stop();g.close()}if(h==40){if(g.isWrapperHidden()){return}g._keySelecting=true;if(g._state){g.stop()}g.fire({type:"down"})}if(h==38){if(g.isWrapperHidden()){return}g._keySelecting=true;if(g._state){g.stop()}g.fire({type:"up"})}if(h==13){if(g.option.isJsSubmit){g.textInput.blur();g._submitForm()}else{g._onBlur()}}if(h!=40&&h!=38){if(!g._state){g.start()}g._keySelecting=false}})},init:function(){var g=this;this._initTextInput();this._initDom();this._initDataApi();this.initWinEvent();if(this.option.isswfWrapper){$(b).on("click",function(h){h=lib.fixEvent(h);if(h.target!=g.textInput){g.close()}});$(b).on("keydown",function(h){h=lib.fixEvent(h);if(h.target!=g.textInput&&h.keyCode==9){g.close()}})}},_initDataApi:function(){var g=this;this._dataApi.on("receive",function(h){if(h.data&&h.data.length>0){g.open(g.cacheData(h.data,h.key))}else{g.stop();g.close()}})},_initDom:function(){var g=this;this.initIfr();this.resultWrapper=b.createElement("div");this.resultWrapper.style.width="500px";this.resultWrapper.style.height="500px";this.resultWrapper.style.position="absolute";this.resultWrapper.style.top="0px";this._hideWrapper();b.body.appendChild(this.resultWrapper);$(this.resultWrapper).on("mouseover",function(i){g._keySelecting=true;i=c.event||i;var h=i.target||i.srcElement;if(h.nodeName=="UL"){return}})},start:function(){this._state=true;var g=this;this._timer=setTimeout(function(){g.upadteContent();g._timer=setTimeout(arguments.callee,g.option.delayTime)},this.option.delayTime)},stop:function(){this._state=false;clearInterval(this._timer)},upadteContent:function(){var h=this;var g=this._query=this.textInput.value;if(this.oldValue===g){return}if(g.length<this.option.len){this.stop();this.close()}if(this._state&&this._dataCache[g]!==f&&!h._keySelecting){this.open(this._dataCache[g])}else{if(this._state&&g.length>=this.option.len&&!h._keySelecting){this._dataApi.request(g)}}this.oldValue=g},cacheData:function(g,h){this._dataCache[h]=g;return g},open:function(g){var h=this;this.setPos();this.fire({type:"show",data:g})},setText:function(g){this._keySelecting=true;this.textInput.value=this.keyword=g},setWrapperHtml:function(g){this.resultWrapper.innerHTML=g},reFocus:function(){this.textInput.focus();this.start()},setPos:function(){if(!this.resultWrapper||!this._state){return}var g=lib.box.getPosition(this.textInput);this.resultWrapper.style.zIndex=1001;this.resultWrapper.style.width=this.textInput.offsetWidth+"px";this.resultWrapper.style.left=g.left+"px";this.resultWrapper.style.top=(g.top+this.textInput.offsetHeight)+"px"},close:function(){this.stop();this.hideIfr();this._hideWrapper()},_submitForm:function(){var h=this.textInput.parentNode;if(!h||h.nodeName!=="FORM"){return}if(b.createEvent){var g=b.createEvent("MouseEvents");g.initEvent("submit",true,false);h.dispatchEvent(g)}else{if(b.createEventObject){h.fireEvent("onsubmit")}}var i=lib.Element.create("input");i.attr("type","hidden");i.attr("name","from");i.val("suggest");lib.$(h).append(i);h.submit()},submitForm:function(){this._submitForm()},iframeCover:function(){return lib.html2Nodes('<iframe id="j-suggest-iframe" border="0" frameBorder="0" style="display:none;" ></iframe>')[0]},initIfr:function(){if(!lib.Maxthon){return}this._ifrCover=this.iframeCover();b.body.appendChild(this._ifrCover)},coverIframe:function(h){var g=this._ifrCover.style;g.display="block";g.position="absolute";g.left=h.left+"px";g.top=h.top+"px";g.width=h.width+"px";g.height=h.height+"px";g.zIndex=999},showIfr:function(){if(!lib.Maxthon){return}var g=this.resultWrapper.getElementsByTagName("ul")[0];var i=lib.box.getPosition(g);var h={};h.left=i.left;h.top=i.top;h.width=g.offsetWidth;h.height=g.offsetHeight;this.coverIframe(h)},hideIfr:function(){if(!lib.Maxthon){return}this._ifrCover.style.display="none"},reSizeWin:function(){this.setPos();this.showIfr()},initWinEvent:function(){var h=this;var g=function(){h.reSizeWin()};$(c).on("resize",g)},_hideWrapper:function(){this.resultWrapper.style.left="-1000px"},isWrapperHidden:function(){return this.resultWrapper.style.left=="-1000px"},setWrapperCss:function(g){this.resultWrapper.style.cssText+=(";"+g)}});c.lib=c.lib||{};lib.kit=lib.kit||{};lib.kit.suggest=d})(window,document);(function(e,f){$reg("lib.action",function(){});$reg("lib.component",function(){});if(lib.ipad){return}var a=e.document,c=a.getElementById("suggestText");if(!c){return}function b(){lib.eventTarget.call(this);this._script=null}b.inherits(lib.eventTarget);Object.extend(b.prototype,{request:function(l){var i="http://search.video.qiyi.com/userSuggest/",m=/http\:\/\/(.*?)\./gi,g=/http\:\/\/(.*?)\/(.*?)\//gi,h=g.exec(location.href),k=m.exec(location.href)[1];k=(k=="list")?(h&&h[2]):k;var j=/\\|!|:|\^|\]|\[|\{|\}|\~|\*|\?|《|》|<|>/g;if(lib.IE){this.request=function(p){var q=this;var o=a.getElementsByTagName("head")[0];var n=null;if(!this._script){n=a.createElement("script");n.charset="utf-8";o.insertBefore(n,o.firstChild);this._script=n}this._script.onreadystatechange=function(){if(n&&n.readyState&&n.readyState!="loaded"&&n.readyState!="complete"){return}if(!e.suggestResult){return}q.fire({type:"receive",data:suggestResult.data,key:p})};this._script.src=i+encodeURIComponent(p.replace(j,"").toLowerCase()).replace(/\%/gi,"_")+"/10/suggestResult/"+k+"/"}}else{this.request=function(n){var o=this;JsLoad.request(i+encodeURIComponent(n.replace(j,"").toLowerCase()).replace(/\%/gi,"_")+"/10/suggestResult/"+k+"/",{CACHE:{varname:"suggestResult"},onSuccess:function(p){o.fire({type:"receive",data:p,key:n})},onError:function(){}})}}return this.request(l)}});lib.component.suggest={_targetitem:0,init:function(){this._cutRange=parseInt(c.getAttribute("j-cutrange")||"18");this.form=$("#j-search-form");this._suggest=new lib.kit.suggest(c,new b(),{len:1,isJsSubmit:false});this._suggest.init();this.initEvent()},initEvent:function(){this._suggest.on("down",this._keyDown.bind(this,"down"));this._suggest.on("up",this._keyDown.bind(this,"up"));this._suggest.on("show",this._renderSuggest.bind(this));this.form.on("submit",this._formSubmit.bind(this));lib.$(this._suggest.resultWrapper).on("mouseover",this._mouseOver.bind(this));lib.$(this._suggest.resultWrapper).on("mousedown",this._mouseDown.bind(this))},close:function(){this._suggest.close()},_formSubmit:function(g){if(this._curr==-1){return true}g=e.event||g;if(this._result[this._curr]["j-alias"]){location.href=this._result[this._curr]["j-link"];lib.Event.preventDefault(g)}else{this._setChannelParam(this._result[this._curr].cname)}},_keyDown:function(h){var i=lib.$("#j-suggestList");if(i){var g=i.down("a");if(g.length>0){if(h=="down"){this._curr=this._curr+1>g.length-1?0:this._curr+1}else{this._curr=this._curr-1<0?g.length-1:this._curr-1}this._setSelected(this._curr);this._suggest.setText(this._result[this._curr].name)}}},_mouseOver:function(i){var h=i.target||i.srcElement;h=lib.$(h);if(h.attr("_index")!==null){var g=parseInt(h.attr("_index"));this._setSelected(g)}},_mouseDown:function(k){k=e.event||k;var j=k.target||k.srcElement;j=d(j,"a");if(j.getAttribute("j-link")&&j.getAttribute("j-link")!==""){location.href=j.getAttribute("j-link")}else{var g=j.getElementsByTagName("span")[0];var h=j.getAttribute("title");this._suggest.textInput.value=(h!==""?h:g.innerHTML);var i=j.getAttribute("j_ctg");this._setChannelParam(i);this._suggest.submitForm()}},_renderSuggest:function(m){var j={tv:{first:"最新一集",suffix:"剧集页"},"var":{first:"最新一期",suffix:"专题"},art:{first:"最新一集",suffix:"专题"}};var o="",g=false,l=0;this._curr=-1;this._result=m.data;var n=[];for(var k=0;k<this._result.length;k++){g=!!this._result[k]["j-alias"];o=g?this._result[k]["j-alias"]:this._result[k].name;if(g){n.push("<a "+((k===this._curr)?'class="selected otherH"':'class="otherH"')+' _index="'+k+'" j-link="'+this._result[k]["j-link"]+'" style="cursor:pointer;" '+(this._result[k].cuted?'title="'+this._result[k].name+(j[this._result[k].type].suffix||"专题")+'"':"")+' j_ctg="'+this._result[k].cname+'">');n.push('<p _index="'+k+'" class="fL txtindex"><span _index="'+k+'" style="color:#000;">'+o+"</span></p>")}else{if(this._result[k].cname.length==2){l=((o.getLen()>=((this._cutRange-1)*2))?(this._cutRange*2-3):0);if(this._result[k].type=="en"){var p=this._result[k].count.length+5;l=((o.getLen()+p>=((this._cutRange-2)*2))?(((this._cutRange-2)*2)-2)-p:0)}}if(this._result[k].cname.length==3){l=((o.getLen()>=((this._cutRange-1)*2))?(((this._cutRange-1)*2)-3):0)}if(this._result[k].cname.length==4){var p=this._result[k].count.length+2;l=((o.getLen()>=((this._cutRange-2)*2))?(((this._cutRange-2)*2)-3)-p:0)}n.push("<a "+((k===this._curr)?'class="selected"':"")+' _index="'+k+'" style="cursor:default;" title="'+(l>0?o:"")+'" j_ctg="'+this._result[k].cname+'">');n.push('<p _index="'+k+'" class="fL"><span _index="'+k+'" style="color:#000;float:left">'+((l==0)?o:o.trancate(l,".."))+"</span>"+(!!this._result[k].cname?('<span _index="'+k+'" style="float:left">('+(this._result[k].cname=="娱乐"?"娱乐资讯":this._result[k].cname)+")</span>"):"")+(this._result[k].type=="en"?'<span _index="'+k+'" style="float:right; padding-right:6px">'+this._result[k].count+"个</span>":"")+"</p>")}n.push("</a>");if(k==0&&!this._result[0].added){this._addChildList(this._result[0].type)}}var h=lib.$(this._suggest.resultWrapper).box().width;if(h<200){this._suggest.resultWrapper.style.width=h+28+"px"}this._suggest.setWrapperHtml("<div id='j-suggestList' class='suggest_t' style='top:0px;left:0px;width:100%;'>"+n.join("")+"</div>")},_trancate:function(h,g){return h},_addChildList:function(j){var i={tv:{first:"最新一集",suffix:"剧集页"},"var":{first:"最新一期",suffix:"专题"},art:{first:"最新一集",suffix:"专题"}};if(this._result[0].link==""||!i[j]){return}var h=this._cloneObject(this._result[0]),k=null;var l=h.name;var g=((l.getLen()>=(this._cutRange*2))?(this._cutRange*2-3):0);h["j-alias"]="<span class='linec'>-</span>"+((g==0)?l:l.trancate(g,".."))+(i[j].suffix||"专题");h["j-link"]=this._result[0].link;h.cuted=g>0;this._result.splice(1,0,h);if(this._result[0].recentLink!==""){k=this._cloneObject(this._result[0]);k["j-alias"]="<span class='linec'>-</span>"+i[j].first+(!!this._result[0].update?"("+this._result[0].update+")":"");k["j-link"]=this._result[0].recentLink;this._result.splice(1,0,k)}if(this._result[0].recentLink===""&&this._result[0].firstLink!==""){k=this._cloneObject(this._result[0]);k["j-alias"]="<span class='linec'>-</span>观看第一集";k["j-link"]=this._result[0].firstLink;this._result.splice(1,0,k)}this._result[0].added=true},_cloneObject:function(h){var g={};Object.extend(g,h);return g},_setSelected:function(h){var g=a.getElementById("j-suggestList").getElementsByTagName("a");lib.$(g[this._targetitem]).removeClass("selected");this._targetitem=h;lib.$(g[h]).addClass("selected");this._curr=h},_setChannelParam:function(h){var g=lib.Element.create("input");g.attr("type","hidden");g.attr("name","category");this.form.append(g);g.val(h)}};lib.component.suggest.init();function d(h,g){if(!h){return null}if(h.nodeName.toLowerCase()==g){return h}else{return d(h.parentNode,g)}}})(window);(function(d,a,e){if(lib.ipad){return}var b=$("#suggestText");var c="";if(b){c=b.attr("suggestWord")||"";$reg("lib.jobs.suggest",function(){var g=Object.extend(lib.jobs.suggest,{testDefault:function(){var h=b.val();return(h==c||!h)&&!(d.sManager&&sManager.oldKey==c)},setDefault:function(){if(b.val()==""){b.css("color","#a9a9a9");b.val(c)}}});b.on("focus",function(){if(g.testDefault()){b.val("")}b.css("color","")}).on("blur",function(){if(g.testDefault()){g.setDefault()}});var f=new lib.kit.Url(d.location.href);if(f.getParam("key")===""){g.setDefault()}$("#j-search-form")[0].onsubmit=function(){var h=b.val().trim(),j=40;if(!h.length){b.val("");b.focus();return false}if(h.getLen()<=j){return}var i=h.replace(/\*/g," ").replace(/[^\x00-\xff]/g,"**");h=h.slice(0,i.slice(0,j).replace(/\*\*/g," ").replace(/\*/g,"").length);b.val(h)}})}})(window,document);lib.model.Bubble=lib.model({actions:{get:{method:"get",params:[],format:"json",encode:true,passport:false,url:"new_msg.php"},clear:{method:"get",params:[],format:"json",encode:true,passport:false,url:"clean_new_msg.php"}},url:"http://t.qiyi.com/api/common/"});(function(b,c){lib.action.watcher=a;function a(){this._timer=null;this.isRunning=false;this.delay=300000}Object.extend(a.prototype,{run:function(){throw"abstract method"},start:function(){if(this._timer||this.isRunning){this.stop()}this.isRunning=true;this._timer=setInterval(this.run.bind(this),this.delay)},stop:function(){clearInterval(this._timer);this.isRunning=false;this._timer=null}})})(this);(function(d,e){if(!(lib.component&&lib.component.login)){return}function a(){lib.action.watcher.call(this);$(document).delegate("startwatcher",this._startWatcher.bind(this));lib.component.login.setCallback("login",this._login.bind(this));lib.component.login.setCallback("logout",this.stop.bind(this))}a.inherits(lib.action.watcher);Object.extend(a.prototype,{run:function(){lib.model.Bubble.get(null,{success:this._success.bind(this),failure:this._error.bind(this)})},_login:function(){this.run();this.start()},_startWatcher:function(){if(!this.isRunning){this._resetState();this.start()}},_resetState:function(){var h=$("#j-username span");if(h[0].className.indexOf("newMessage")==-1){return}h[0].className="";var g=$("#j-atme-num"),i=$("#j-cmt-num"),f=$("#j-fans-num");g.html("0");i.html("0");f.html("0");$("#j-qtmsg-wrapper").css("display","none");document.getElementById("j-user-popup").getElementsByTagName("li")[0].className=""},_success:function(h){var g=$("#j-atme-num"),j=$("#j-cmt-num"),f=$("#j-fans-num"),i=$("#j-username span");if(h.comment||h.atme||h.attention){this.stop();if(i[0].className.indexOf("newMessage")==-1){i[0].className="newMessage"}else{return}j&&j.html(""+(parseInt(h.comment)>99?"99":h.comment));g&&g.html(""+(parseInt(h.atme)>99?"99":h.atme));f&&f.html(""+(parseInt(h.attention)>99?"99":h.attention));$("#j-qtmsg-wrapper").css("display","");$("#j-qtsns")[0].className="liLast"}else{$("#j-qtmsg-wrapper").css("display","none");$("#j-qtsns")[0].className="";return}if(h.comment=="0"){$("#j-cmt-num").parent("p").css("display","none")}else{$("#j-cmt-num").parent("p").css("display","")}if(h.atme=="0"){$("#j-atme-num").parent("p").css("display","none")}else{$("#j-atme-num").parent("p").css("display","")}if(h.attention=="0"){$("#j-fans-num").parent("p").css("display","none")}else{$("#j-fans-num").parent("p").css("display","")}},_error:function(f){if(this.isRunning){this.stop()}$("#j-qtmsg-wrapper").css("display","none");if(lib.msg){lib.log("newmsg"+(lib.msg[f.code]||""))}}});var c=new a();var b=lib.component.login.isLogin();if(b){c.run();c.start()}})(this);
