/* DO NOT EDIT THIS FILE!
		The contents of this file are dynamically generated. In order to make changes, update the
		respective source files.*/

// /xtv3.0/components/fc.scrollable.js from default
if(typeof FC==="undefined"||!FC){var FC={}}FC.Scrollable=(function(d,c,b){b.template("bumperTemplate",['<div class="scrollable-bumper ${directionClass}">',"{{if isWide !== true }}",'<b class="shadow"></b>',"{{/if}}",'<b class="arrow"></b>',"</div>"].join("\n"));var a=function(f){if(!f){return false}var g,h,e=this;this.$scrollable=b(f);this.$inner=this.$scrollable.find(".scrollable-inner");this.$list=this.$scrollable.find("ul");if(!this.$list.is(".wide")){this.$list.css("overflow","visible")}this.$items=this.$list.find("li:not(.hidden)");this.$collectionWidth=this.getCollectionWidth();this.$inner.bind("scroll",function(){e.scroll()});g=b.tmpl("bumperTemplate",{directionClass:"scrollable-left",isWide:this.$list.is(".wide")});h=b.tmpl("bumperTemplate",{directionClass:"scrollable-right",isWide:this.$list.is(".wide")});this.$bumpers=g.add(h);this.$bumpers.height(this.$items.height());this.$bumpers.click(function(i){i.preventDefault();if(!b(this).hasClass("inactive")){e.incrementalScroll(this)}});this.$scrollable.append(g).append(h);if(!FC.Scrollable.instances.length){b(d).resize(function(){var k=0,j=FC.Scrollable.instances.length;for(;k<j;k++){FC.Scrollable.instances[k].update()}})}FC.Scrollable.instances.push(this);this.update()};a.instances=[];a.prototype={$scrollable:null,$bumpers:[],isScrollable:null,$inner:null,$list:null,$items:[],collectionWidth:0,getCollectionWidth:function(){if(this.$items.length){var e=0;this.$items.each(function(){e+=b(this).outerWidth(true)});return e}},update:function(){var e=0;this.$items=this.$list.find("li:not(.hidden)");e=this.getCollectionWidth();this.$list.css({width:e});if((e>this.$scrollable.width())===this.isScrollable){return false}this.isScrollable=e>this.$scrollable.width();this.$scrollable.toggleClass("scrollable-circular",this.isScrollable);this.$inner.scrollLeft(0);this.$scrollable.find(".scrollable-left").addClass("inactive");this.$bumpers.toggle(this.isScrollable);this.collectionWidth=e},scroll:function(){this.$bumpers.removeClass("inactive");var e=this.$inner.scrollLeft();if(e===0){this.$bumpers.eq(0).addClass("inactive")}if(e>=this.$list.outerWidth()-this.$inner.outerWidth()){this.$bumpers.eq(1).addClass("inactive")}},getNewPosition:function(h,l,n,i,j){var g=Math.floor(h/n),p=Math.floor(i/2),k=g*n,f=l+(k*j),m=Math.ceil(f/n),e=m*n,o=e-p;return o},incrementalScroll:function(j){if(!b(j).is(".inactive")){var h=this.$scrollable.outerWidth(),e=this.$inner.scrollLeft(),l=this.$items.outerWidth(true),g=parseInt(this.$items.css("margin-right"),10),i,k=this.$scrollable.find(".inactive"),f;if(k){k.removeClass("inactive")}f=b(j).hasClass("scrollable-right")?1:-1;i=this.getNewPosition(h,e,l,g,f);this.$inner.animate({scrollLeft:i},1000,"linear")}}};return a})(window,document,jQuery);$(function(){var a="createTouch" in document;var b=function(){var c=window.pageYOffset;$(".scrollable-inner").each(function(){var d=($(this).offset()).top;if(d>=c-130&&d<c+window.innerHeight+50){$(this).addClass("native-scroll")}else{$(this).removeClass("native-scroll")}})};if(window.location.hash=="#rainbow"){$("body").addClass("rainbow")}if(a||$("body").hasClass("rainbow")){$(document).bind("scroll",b);b()}$(".scrollable").each(function(c,d){new FC.Scrollable(d)})});
// /xtv3.0/pages/fc.home.js from default
if(typeof FC==="undefined"||!FC){var FC={}}FC.home=(function(c){var b,a="";b={attrRedirect:function(e,d){c(e).each(function(){var f=c(this).attr(d);if(f){c(this).attr("href",f)}})},omnitureTracking:function(d){var i=User.signed_in?"authenticated":"anonymous",k=c(this),f=k.parents("div.video-gallery"),e=f.attr("data-cim-module"),j=f.attr("data-cim-row-index"),m=k.attr("data-cim-entity-name"),g=k.attr("data-cim-entity-index"),l=s_gi(settings.s_account),h=(c("body").attr("id")=="home")?"homepage":"ondemand";l.linkTrackVars="events,hier2,prop30,eVar30,eVar57,eVar50,prop57,prop58,eVar58";if(h=="homepage"){l.linkTrackEvents="event18";l.events="event18"}else{l.linkTrackEvents="event65";l.events="event65"}l.prop57=e+"–row"+j;l.prop58=m;l.eVar58=m;l.hier2=i+" "+h+":"+e+":row"+j+":pos"+g+":"+m;l.prop30=l.hier2;l.eVar30=l.hier2;l.eVar50=e;l.eVar57=a;l.tl(this,"o","XTV "+h+" Cover Link Click")},unlockContent:function(e,d){c(e).each(function(){var f=c(this),g=f.attr(d);if(g){g=(g.indexOf(",")>0)?g.split(","):g.split(" ");if(User.providers.has(g)){f.removeClass("protected");return}}})},initHistory:function(d,e){var f=c(d);f.each(function(){var i=c(this),h=new Date(i.attr("data-cim-date-watched")),j=Math.ceil(parseFloat(i.attr(e),10)||0),k=i.find("b.progressbar"),g=i.find("b.xbutton");if(isNaN(j)||(h<new Date(10/5/11)&&j===0)){j=100}if(j<=5){k.find("b.value").css("width","5px")}else{k.find("b.value").css("width",j+"%")}k.find("span.access_aid").html(j+"% Watched");k.attr("title",j+"% Watched");g.click(function(o){var l=i.parents("div.video-gallery"),n=c(i).find("a").attr("data-cim-video-id"),m=l.find("li.hidden:first"),p=l.find("li.last:first");o.stopImmediatePropagation();o.preventDefault();i.remove();CIM.services.history.del(n);if(l.find(d).length===0){l.css("display","none")}m.removeClass("hidden");p.removeClass("last");if(!m.is(".entity")){m=l.find("li.hidden:first");m.removeClass("hidden");l.find(".inactive").removeClass("inactive")}l.find(".scrollable").trigger("update.CIM.widgets.scrollable")})})},getPosterArt:function(d){var e=c(d);e.each(function(){var f=c(this),h=f.find("img.thumb"),g=h.attr("id")||"",i=0;h.error(function(){f.find("a.thumbnail").addClass("imageError");i+=1;if(i==1){c(this).attr("src","/api/entity/thumbnail/"+g+"/147/106")}else{if(g.toLowerCase().contains("tvseries")){c(this).attr("src","/images/silhouette/tv_147_106.png")}else{c(this).attr("src","/images/silhouette/movies_147_106.png")}}});h.attr("src","/api/entity/thumbnail/"+g+"/180/240?noRedir=true")})},loadNetworkLogos:function(e,d){var g=c(e),f=[];g.each(function(){var h=c(this),i=h.attr(d);h.bind("networkLogoSrcLoaded",function(){var j;for(j in f){if(f.hasOwnProperty(j)){if(i===f[j]){h.removeClass("loaded");return}}}h.addClass("loaded")});h.parent().mouseenter(function(){if(!h.attr("src").match("/api/entity/thumbnail/")&&h.attr(d)&&typeof i!=="undefined"){h.attr("src","/api/entity/thumbnail/"+i+"/120/46");h.trigger("networkLogoSrcLoaded");h.error(function(){f.push(i);h.trigger("networkLogoSrcLoaded")})}})})},getModuleNames:function(){if(a.length>0){return a}c("div.video-gallery").each(function(){a+=c(this).attr("data-cim-module")+":"});return a=a.substring(0,a.length-1)},getModuleNamesWithRows:function(){var d="";c("div.video-gallery").each(function(){d+=c(this).attr("data-cim-module")+"-row"+c(this).attr("data-cim-row-index")+","});return d.substring(0,d.length-1)},hideRecommendations:function(){c(".recommendations").hide()}};return b})(jQuery);$(function(){if($("body").attr("id")!="home"){return false}if(User.signed_in){$("div.top-promo-bar").addClass("top-promo-bar-auth");if(!User.settings.personal_recs){FC.home.hideRecommendations()}}$("a.thumbnail").live("click",FC.home.omnitureTracking);FC.home.getModuleNames();FC.home.loadNetworkLogos("li.entity a.thumbnail img.net_logo","data-cim-network-id");FC.home.attrRedirect("a.thumbnail","data-cim-video-url");FC.home.unlockContent("li.protected","data-cim-provider-codes");FC.home.initHistory("li.history","data-cim-watched");FC.home.getPosterArt("li.queue");FC.home.getPosterArt("li.trending");FC.home.getPosterArt("li.history");if(settings.displayLaunchPromo==="true"){var a="skip_launch_promo";if(!CIM.cookie.permBinaryValue(a)){window.setTimeout(function(){FC.module.hints.launchPromo();CIM.cookie.permBinaryValue(a,true)},4000)}}});
