var wap_pageAction={initDom:function(){document.getElementById("down_app").addEventListener("click",function(){wap_pageAction.goDownLoad(this)});document.getElementById("downAppBtn").addEventListener("click",function(){wap_pageAction.goDownLoad(this);wap_pageAction.hideShareBox("funcDown")});document.getElementById("close_app_tip").addEventListener("click",function(){wap_pageAction.hideTitlebar()});G_CORE_CONTROL.attachEvent(this,"error",wap_pageAction.showTitlebar);document.getElementById("showNavBtn").onclick=
function(){wap_pageAction.showMenuBar("nav")};document.getElementById("funcShare").addEventListener("click",function(){wap_pageAction.showShareBox("funcShare","funcDown")});document.getElementById("funcDown").addEventListener("click",function(){wap_pageAction.showShareBox("funcDown","funcShare")});document.getElementById("open_app").addEventListener("click",function(){wap_pageAction.openApp(this)});this.showDescription();this.getMovieScore();this.getGuessYouLike();this.getGuessYouLikeTimes=0;wap_pageAction.IS_TITLE_BAR_CLOSE=
false;wap_pageAction.IS_NAV_LIST_CLOSE=true;this.initShare()},goDownLoad:function(b){var c="",a=navigator.userAgent;if(/iPhone.*Mac|iPhone.*Opera/.test(a)){c="https://itunes.apple.com/cn/app/id466321750?mt=8";if(a.indexOf("CriOS")<0)b.target="_blank"}else if(/iPad.*Mac/.test(a)){c=/7_.*_.*/.test(a)?"itms-apps://itunes.apple.com/app/id396120024":"https://itunes.apple.com/cn/app/id396120024?mt=8";if(a.indexOf("CriOS")<0)b.target="_blank"}else{c="http://m.down.sandai.net/partner/XunleiKankan_Android_WAPguanwang.apk";
b.target="_blank"}if(/.*Mobile.*FireFox.*/i.test(a))window.open(c);else b.href=c;return true},hideTitlebar:function(){document.getElementById("m_down").style.display="none";window.wap_pageAction.IS_TITLE_BAR_CLOSE=true},showTitlebar:function(){document.getElementById("m_down").style.display="";window.wap_pageAction.IS_TITLE_BAR_CLOSE=false},showMenuBar:function(b){b=document.getElementById(b);if(b.style.display=="none"){b.style.display="block";window.wap_pageAction.IS_NAV_LIST_CLOSE=false}else{b.style.display=
"none";window.wap_pageAction.IS_NAV_LIST_CLOSE=true}},showShareBox:function(b,c){var a=document.getElementById(b).parentNode,d=document.getElementById(c).parentNode;a.getAttribute("class").indexOf("func_on")!=-1?a.setAttribute("class",a.getAttribute("class").replace(" func_on","")):a.setAttribute("class",a.getAttribute("class")+" func_on");d.getAttribute("class").indexOf("func_on")!=-1&&d.setAttribute("class",d.getAttribute("class").replace(" func_on",""))},hideShareBox:function(b){b=document.getElementById(b).parentNode;
b.getAttribute("class").indexOf("func_on")!=-1&&b.setAttribute("class",b.getAttribute("class").replace(" func_on",""))},initShare:function(){var b=document.getElementById("weiboShare"),c=document.getElementById("qzoneShare"),a=wap_pageAction.getShareContent();b.setAttribute("href",encodeURI(a.weiboShareLink));c.setAttribute("href",encodeURI(a.qzoneShareLInk));b.addEventListener("click",function(){a=wap_pageAction.getShareContent();b.setAttribute("href",encodeURI(a.weiboShareLink));wap_pageAction.hideShareBox("funcShare")});
c.addEventListener("click",function(){a=wap_pageAction.getShareContent();c.setAttribute("href",encodeURI(a.qzoneShareLInk));wap_pageAction.hideShareBox("funcShare")})},getShareContent:function(){var b,c=G_MOVIE_INFO.title,a="",d="",f="";if(!(!window.G_CORE_CONTROL||!window.G_CORE_CONTROL.currentIndex&&window.G_CORE_CONTROL.currentIndex!=0))switch(G_MOVIE_TYPE){case "video":if(G_CHANNEL_ID==21)b="http://video.kankan.com/news/vod/";else if(G_CHANNEL_ID==22)b="http://yule.kankan.com/vod/";break;case "MTV":b=
"http://yinyue.kankan.com/vod/";break;default:b="http://vod.kankan.com/v/";a=G_MOVIE_DATA.subnames[G_CORE_CONTROL.currentIndex]}d=G_MOVIE_TYPE=="MTV"||G_MOVIE_TYPE=="video"?b+Math.floor(G_MOVIE_INFO.id/1E3)+"/"+G_MOVIE_INFO.id+".shtml":b+Math.floor(G_MOVIE_INFO.id/1E3)+"/"+G_MOVIE_INFO.id+"/"+G_MOVIE_DATA.subids[G_CORE_CONTROL.currentIndex]+".shtml";f="我在迅雷看看上观看了视频《"+c+"》"+a+"，非常精彩，你也快来看看吧！地址：";return{weiboShareLink:"http://service.weibo.com/share/share.php?url="+d+"?id=4158&appkey=4280623899&title="+
f,qzoneShareLInk:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+d+"?id=4157&desc=&title="+f+"&summary="+f+"&site=迅雷看看"}},showDescription:function(){var b=document.getElementById("sec_info_more");if(!b)return false;b.onclick=function(){var c=document.getElementById("sec_info_intro_all");if(c.style.display=="none"){document.getElementById("sec_info_intro").style.display="none";c.style.display="block";this.innerHTML='收起<b class="tri"></b>';this.className="close"}else{document.getElementById("sec_info_intro").style.display=
"block";c.style.display="none";this.innerHTML='展开<b class="tri"></b>';this.className="open"}return false}},getMovieScore:function(){if(window.G_ISTRAILER||G_MOVIE_TYPE=="video"||G_MOVIE_TYPE=="MTV")return false;var b=new Wap_kkCommunity("","wap_mark_script");b.beforeScriptLoaded=function(){};b.afterScriptLoaded=function(){var c=xunlei_movie_data.rating;if(c.toString().length>3)c=c.toString().slice(0,2);var a=document.getElementById("_score");if(a){a.innerHTML=c;a.style.display="block"}};b.getScriptUrl=
function(){this.getMovieid();return"http://app11.kankan.com/movie_rating/data/"+parseInt(this.movieid/1E3)+"/"+this.movieid+".js?id="+this.movieid};b.loadJsData(b.scriptId,b.getScriptUrl())},getGuessYouLike:function(){window.G_ISTRAILER&&loadJSData("http://api.pad.kankan.com/api.php?type=movie&mod=relate&os=wap&jsobj=RELATE_MOVIES&perpage=15&movieid="+G_MOVIEID,this.printGuessYouLike,[],false)},printGuessYouLike:function(){if(typeof RELATE_MOVIES!="undefined"){if(RELATE_MOVIES.total_count==0)return false;
for(var b=RELATE_MOVIES.data.items.length,c="<ul>",a=0;a<b;a++){var d=RELATE_MOVIES.data.items[a].id;d="http://m.kankan.com/v/"+Math.floor(d/1E3)+"/"+d+".shtml";var f="http://images.movie.xunlei.com/100x140/"+RELATE_MOVIES.data.items[a].v_poster,i=RELATE_MOVIES.data.items[a].attract,g=RELATE_MOVIES.data.items[a].score,h=RELATE_MOVIES.data.items[a].title;c+="<li>";c+='<a href="'+d+'">';c+='<img src="'+f+'">';c+=i.indexOf("预告")!=-1?"<p><span>"+i+"</span><span>"+g+"</span></p></a>":'<p class="bg_none"><span></span><span>'+
g+"</span></p></a>";c+='<a href="'+d+'">'+h+"</a>";c+="</li>"}c+="</ul>";$("guess_you_like_wrapper").innerHTML=c;$("recommend").style.display="block"}else if(wap_pageAction.getGuessYouLikeTimes<=5){wap_pageAction.getGuessYouLikeTimes++;setTimeout(wap_pageAction.getGuessYouLike,50)}},openApp:function(b){function c(){var e=-1;switch(G_MOVIE_TYPE){case "movie":e=1;break;case "teleplay":e=2;break;case "tv":e=3;break;case "anime":e=4;break;case "video":e=G_CHANNEL_ID==22?101:102;break;case "documentary":e=
5;break;case "MTV":e=103;break;case "lesson":e=6;break;case "vmovie":e=7;break;default:e=-1}return e}var a=navigator.userAgent.toLowerCase();if(/android/.test(a)){var d=c(),f=G_MOVIE_INFO.id,i=encodeURIComponent(G_MOVIE_INFO.title),g;if(G_MOVIE_TYPE=="video"||G_MOVIE_TYPE=="MTV")g=undefined;else if(window.G_CORE_CONTROL)g=G_MOVIE_DATA.subids[G_CORE_CONTROL.currentIndex];if(/chrome/.test(a)){a="intent://com.xunlei.kankan/movies/"+d+"/"+f+"/0/"+i;if(g>=0)a+="/"+g;a+="?source=wap#Intent;scheme=kankan;package=com.xunlei.kankan;end";
b.href=a}else{a="kankan://com.xunlei.kankan/movies/"+d+"/"+f+"/0/"+i;if(g>=0)a+="/"+g;a+="?source=wap";var h=document.createElement("iframe");h.style.display="none";h.src=a;h.onload=function(){h.src="market://details?id=com.xunlei.kankan"};document.body.appendChild(h)}}}};wap_pageAction.initDom();