(function(c){var d=function(a,b){this.scrollWrapperId=a;this.$scrollerUnit=this.$scroller=this.$scrollWrapper=null;this.init();typeof b==="function"&&b()};d.prototype={constructor:d,init:function(){this.setScrollWrapperObject();if(this.$scrollWrapper.length===0||this.$scrollWrapper.children().length===0)return false;this.setScrollerWidth();this.orientationEvent();this.resize();this.scrollInit()},setScrollWrapperObject:function(){this.$scrollWrapper=c("#"+this.scrollWrapperId);this.$scroller=this.$scrollWrapper.children();
this.$scrollerUnit=this.$scroller.children()},showDebugMsg:function(a){if(window.location.href.indexOf("debug")!=-1){var b=document.getElementsByTagName("h2")[1].innerHTML;document.getElementsByTagName("h2")[1].innerHTML=b+a+"</br>"}},setScrollerWidth:function(){if(this.$scrollWrapper.is(":hidden"))return false;var a=parseFloat(this.$scrollerUnit.eq(1).css("margin-right")+this.$scrollerUnit.eq(0).css("margin-right")+this.$scrollerUnit.eq(0).css("margin-left"))*this.$scrollerUnit.length;this.$scrollerUnit.each(function(){a+=
parseFloat(document.defaultView.getComputedStyle(this,null).width)});this.$scroller[0].style.width=a+"px";if(this.scrollInstance){this.$scroller.css("transform","translate(0px, 0px) translateZ(0px)");this.$scroller.css("-webkit-transform","translate(0px, 0px) translateZ(0px)");this.$scroller.css("-moz-transform","translate(0px, 0px) translateZ(0px)");this.$scroller.css("-o-transform","translate(0px, 0px) translateZ(0px)");this.scrollInstance.refresh()}},orientationEvent:function(){function a(){if("orientation"in
window){var e=Math.abs(window.orientation);switch(e){case 0:case 180:e="portrait";break;case 90:case -90:e="landscape"}return e}else return"unknow"}window.addEventListener("orientationchange",function(){setTimeout(function(){b._NowOrientation=a();if(b._NowOrientation!=b._lastOrientation){b._lastOrientation=b._NowOrientation;setTimeout(function(){b.showDebugMsg("----change-----");b.setScrollerWidth()},700)}},10)},false);this._NowOrientation=this._lastOrientation="unknow";this._lastOrientation=a();
var b=this},resize:function(){if("orientation"in window)return false;this.resizeOrientaion=window.screen.width/Math.max(window.screen.height,320)<1.1?"portrait":"landscape";var a=this;setInterval(function(){a.resizeHandler(a)},1E3)},resizeHandler:function(a){var b=window.screen.width/Math.max(window.screen.height,320)<1.1?"portrait":"landscape";if(b!=a.resizeOrientaion){a.resizeOrientaion=b;a.showDebugMsg("----rezise-----");setTimeout(function(){a.setScrollerWidth()},700)}},scrollInit:function(){var a=
this;setTimeout(function(){a.scrollInstance=new IScroll("#"+a.scrollWrapperId,{scrollX:true,scrollY:false,momentum:true,keyBindings:true,eventPassthrough:true})},0)},refreshScrollInstance:function(){this.scrollInstance.refresh()}};var g=function(){c("#scrollTapWrapper").delegate("li","click",function(){c(this).index();c(this).siblings().removeClass("on").end().addClass("on")})},h=function(){var a=G_MOVIE_TYPE;a=a=="video"?G_CHANNEL_ID==22?c("#m_navList").find(".yule").parent().siblings().removeClass("on").end().addClass("on"):
c("#m_navList").find(".news").parent().siblings().removeClass("on").end().addClass("on"):window.G_ISTRAILER?c("#m_navList").find(".trailer").parent().siblings().removeClass("on").end().addClass("on"):c("#m_navList").find("."+a).parent().siblings().removeClass("on").end().addClass("on");window.scrollInstance.navListScrollerNowObj=c(a)[0];c("#showNavBtn").click(function(){setTimeout(function(){if(c("#nav").is(":visible")){window.scrollInstance.navListScroller.setScrollerWidth();window.scrollInstance.navListScroller.refreshScrollInstance();
window.scrollInstance.navListScrollerNowObj&&window.scrollInstance.navListScroller.scrollInstance.scrollToElement(window.scrollInstance.navListScrollerNowObj,0)}},0)})},f=function(){if(window.G_ISTRAILER){if(c("#recommend:visible").length==0&&scrollInstance.instanceGuessYouLikeTimes<=20){if(scrollInstance.instanceGuessYouLikeT==0)scrollInstance.instanceGuessYouLikeT=setInterval(function(){f()},200)}else{clearInterval(scrollInstance.instanceGuessYouLikeT);window.scrollInstance.guessYouLike=new d("guess_you_like_wrapper")}scrollInstance.instanceGuessYouLikeTimes++}else window.scrollInstance.guessYouLike=
new d("guess_you_like_wrapper")};c(function(){window.scrollInstance={};window.scrollInstance.tapScroller=new d("scrollTapWrapper",g);window.scrollInstance.navListScroller=new d("m_navList",h);window.scrollInstance.instanceGuessYouLikeTimes=0;window.scrollInstance.instanceGuessYouLikeT=0;f()})})(jQuery);window.timers=0;