if(!window.ustream){window.ustream={}}if(!ustream.labels){ustream.labels={}}(function(l){l["js.v3.follow_user.following"]="Following";l["js.v3.follow_user.follow_tooltip"]="Follow this channel to be notified when it's live!";l["js.v3.follow_user.in_the_crowd"]="In this Crowd";l["js.v3.follow_user.join_crowd"]="Join Crowd";l["js.v3.follow_user.leave_crowd"]="Leave Crowd";l["js.v3.follow_user.login_text"]="Looks like you already have a Ustream account! Sign in below to join the Crowd.";l["js.v3.follow_user.login_title"]="Login to your account";l["js.v3.follow_user.nlb_submit_error"]="Error occured! Please try again later.";l["js.v3.follow_user.num_in_crowd"]="#n# in";l["js.v3.follow_user.stopfollow"]="Stop following";l["js.v3.channel_details.broadcast_started"]="Live broadcast started";l["js.v3.channel_details.channel_is_offline"]="Channel is offline";l["js.v3.channel_details.info_show_less"]="show less";l["js.v3.channel_details.info_show_more"]="show more";l["js.v3.channel_details.just_now"]="just now";l["js.v3.channel_details.no_highlighted_videos"]="No highlighted videos.";l["js.v3.add_more_less.less"]="less";l["js.v3.add_more_less.more"]="more";l["js.v3.dashboard_follow.join_date"]="Join date:";l["js.v3.dashboard_follow.live"]="live";l["js.v3.dashboard_follow.live_with_viewer"]="Live with #n# viewer";l["js.v3.dashboard_follow.live_with_viewers"]="Live with #n# viewers";l["js.v3.dashboard_follow.now_live"]="Now Live!";l["js.v3.dashboard_follow.people_in_crowd"]="People in Crowd:";l["js.v3.channel_events.subscriber_list_title"]="People attending this event";l["js.v3.channel_events.subscriber_list_title_past"]="People who attended this event";l["js.v3.channel_events_subscriber_list.emptymessaeg"]="None of your friends are following this event.";l["js.v3.channel_events_subscriber_list.titles"]="Everyone,Friends";l["js.v3.channel_events_subscriber_list.title_everyone"]="Everyone";l["js.v3.channel_events_subscriber_list.title_friends"]="Friends";l["www.channel_page.v3.videos_tab.title"]="Videos";l["www.channel_page.v3.highlights_tab.title"]="Highlights";l["js.v3.channel_videos.ppv_badge"]="PPV";l["js.v3.channel_videos.subscriptionfree_badge"]="NOW FREE";l["js.v3.channel_videos.viewers"]="#n# viewers";l["js.v3.channel_videos.views"]="#n# views";l["www.manageshow_videos_page.create_highlight"]="Create Highlight";l["www.manageshow_videos_page.delete"]="Delete";l["www.manageshow_videos_page.edit"]="Edit";l["www.manageshow_videos_page.highlights"]="Highlights";l["www.manageshow_videos_page.make_private"]="Make private";l["www.manageshow_videos_page.make_public"]="Make public";l["www.manageshow_videos_page.no_pending_videos"]="You have no pending uploaded videos.";l["www.manageshow_videos_page.no_videos"]="You have no videos.";l["www.manageshow_videos_page.only_subscribed_users_can_watch"]="Only subscribed users can watch";l["www.manageshow_videos_page.or"]="or";l["www.manageshow_videos_page.order_by"]="Order by:";l["www.manageshow_videos_page.order_date_recorded"]="Date recorded";l["www.manageshow_videos_page.order_title"]="Title";l["www.manageshow_videos_page.order_views"]="Views";l["www.manageshow_videos_page.play"]="Play";l["www.manageshow_videos_page.ppv_badge"]="PPV";l["www.manageshow_videos_page.privacy_friends"]="My Crowd Only";l["www.manageshow_videos_page.privacy_private"]="Only I can watch";l["www.manageshow_videos_page.privacy_public"]="Everyone can watch";l["www.manageshow_videos_page.search"]="Search";l["www.manageshow_videos_page.show_all"]="show all";l["www.manageshow_videos_page.subscription_free_badge"]="Now Free";l["www.manageshow_videos_page.subscription_only_badge"]="Subscription Only";l["www.manageshow_videos_page.upload_video_title"]="Upload video";l["www.manageshow_videos_page.videos"]="Videos";l["www.manageshow_videos_page.videos_text"]="Browse and manage videos you have recorded on this channel.";l["www.manageshow_videos_page.video_upload_list.created"]="Created at";l["www.manageshow_videos_page.video_upload_list.status"]="Status";l["www.manageshow_videos_page.video_upload_list.title"]="Title";l["www.manageshow_videos_page.views"]="Views:";l["www.manageshow_videos_page.your_recorded_videos"]="Your recorded videos on Ustream";l["www.manageshow_videos_page.your_videos"]="Your Videos";l["js.v3.pager.first"]="first";l["js.v3.pager.last"]="last";l["js.v3.pager.next"]="next";l["js.v3.pager.of"]="of";l["js.v3.pager.previous"]="previous";l["www.upcomingevents_widget.active_subscriptions"]="Active Subscriptions";l["www.upcomingevents_widget.active_subscriptions_resubscribe_button"]="Resubscribe";l["www.upcomingevents_widget.add_ticket"]="Redeem Ticket";l["www.upcomingevents_widget.attending_ticket"]="attending";l["www.upcomingevents_widget.attending_ticket_past"]="attended";l["www.upcomingevents_widget.buy_more_ticket"]="Buy More Tickets";l["www.upcomingevents_widget.buy_ticket"]="Buy Ticket";l["www.upcomingevents_widget.buy_ticket_button_title_already_have"]="You have already purchased access to this event.";l["www.upcomingevents_widget.homepage.subtitle"]="A snapshot of what\u2019s hot right now";l["www.upcomingevents_widget.homepage.title"]="Featured";l["www.upcomingevents_widget.inactive_subscriptions_resubscribe_button"]="Resubscribe";l["www.upcomingevents_widget.music.subtitle"]="Don\u2019t miss any of these exciting events";l["www.upcomingevents_widget.music.title"]="Featured music events";l["www.upcomingevents_widget.pay_per_view"]="Pay Per View";l["www.upcomingevents_widget.pay_per_view_badge"]="Pay-Per-View";l["www.upcomingevents_widget.pay_per_view_event"]="Pay Per View Event";l["www.upcomingevents_widget.rating_mature"]="This content is rated Mature";l["www.upcomingevents_widget.show_less_codes"]="show less";l["www.upcomingevents_widget.show_more_codes"]="show more";l["www.upcomingevents_widget.sport.subtitle"]="Don\u2019t miss any of these exciting events";l["www.upcomingevents_widget.sport.title"]="Featured sport events";l["www.upcomingevents_widget.transaction_id"]="Transaction ID";l["www.upcomingevents_widget.upcoming_shows"]="Upcoming Shows";l["www.upcomingevents_widget.validated_ticket"]="This ticket has been already validated";l["js.v3.flag_content.report_sent"]="Your request has been submitted.";l["js.v3.flag_content.select_an_event"]="Select an event";l["js.common_for_all.are_you_sure"]="Are you sure?";l["js.common_for_all.button_cancel"]="Cancel";l["js.common_for_all.button_close"]="Close";l["js.common_for_all.button_next_raquo"]="Next &raquo;";l["js.common_for_all.button_no"]="No";l["js.common_for_all.button_submit"]="Submit";l["js.common_for_all.button_yes"]="Yes";l["js.common_for_all.error_occured"]="An error occured!";l["js.common_for_all.form_sent"]="Form sent successfully!";l["js.common_for_all.request_submitted"]="Your request has been submitted.";l["js.common_for_all.unknown_error"]="Error!";l["js.ppv.itemdownloader.alert_close"]="OK";l["js.v3.ppv_item_downloader.event_selling_is_off"]="Ticket selling is disabled for this event.";l["js.v4.channel_details.info_less"]="Less";l["js.v4.channel_details.info_more"]="More";l["js.v3.login_signup_dialog.action_signup"]="Signup";l["js.v3.login_signup_dialog.cant_read_captcha"]="Can't read?";l["js.v3.login_signup_dialog.email"]="Email";l["js.v3.login_signup_dialog.intro_help"]="You're going to need a Ustream account to continue, but the good news is it's free! If you've already registered, login on the left; if not, signup for a new account on the right.";l["js.v3.login_signup_dialog.login_title"]="Login";l["js.v3.login_signup_dialog.login_viewer_terms"]="I agree to the <a href=\"#termsLink#\" id=\"Ppv_Login_Terms\" onclick=\"return false;\">Pay-Per-View Terms of Service<\/a> by <br \/> purchasing a ticket or accessing the content.";l["js.v3.login_signup_dialog.password"]="Password";l["js.v3.login_signup_dialog.refresh_captcha"]="Refresh";l["js.v3.login_signup_dialog.retype_password"]="Retype Password";l["js.v3.login_signup_dialog.retype_password_required"]="Type your password once more.";l["js.v3.login_signup_dialog.signup_subscription_terms"]="I agree to the <a href=\"#termsLink#\" id=\"Subscription_Signup_Terms\" onclick=\"return false;\">Subscription Terms of Service<\/a>.";l["js.v3.login_signup_dialog.signup_title"]="Signup";l["js.v3.login_signup_dialog.signup_viewer_terms"]="I agree to the <a href=\"#termsLink#\" id=\"Ppv_Signup_Terms\" onclick=\"return false;\">Pay-Per-ViewTerms of Service<\/a> by purchasing a ticket or accessing the content.";l["js.v3.login_signup_dialog.terms_agree"]="I agree to the <a href=\"#termsLink#\" id=\"Signup_Terms\" onclick=\"return false;\">Terms of Use<\/a> and <a href=\"#privacyLink#\" id=\"Signup_Privacy\" onclick=\"return false;\">Privacy Policy<\/a>";l["js.v3.login_signup_dialog.terms_agree_v2"]="I agree to the <a href=\"#termsLink#\" id=\"Signup_Terms\" onclick=\"return false;\">Terms of Service<\/a> and <a href=\"#privacyLink#\" id=\"Signup_Privacy\" onclick=\"return false;\">Privacy Policy<\/a>";l["js.v3.login_signup_dialog.terms_required"]="You have to accept our Terms of Use and Privacy Policy to use our service.";l["js.v3.login_signup_dialog.terms_required_v2"]="You have to accept our Terms of Service and Privacy Policy to use our service.";l["js.v3.login_signup_dialog.username"]="Username";l["js.v3.login_signup_dialog.verification_code"]="Verification Code";l["js.v3.login_signup_dialog.viewer_terms_required"]="You have to accept our Viewer Terms of Service to use our service.";l["www.js.premium_membership.overlay_title"]="Ustream Premium Membership";})(ustream.labels);
ustream.templates.followUserEventHeader='<% if(noFollow) { %><div class="rsvpV3Wraps wrapCold" data-template="followUserEventHeader"><a href="#" class="button doFollow followUserEvent" title="<%= _t_("js.v3.follow_user.follow_tooltip") %>"><span class="ui-icon ui-icon-circle-plus "></span> <span class="text"><%= _t_("js.v3.follow_user.join_crowd") %></span></a></div><% } %>';
(function(){eval(ustream.namespace);ustream.classes.PrettyDateUpdater=new Class({options:{selector:".prettyDate",interval:30000},initialize:function(options){this.options=merge(this.options,options||{});
this.process();this.timer=ustream.timer.add(this.options.interval,bind(this.process,this));captureEvent(ustream.events.PRETTYDATENOW,eBind(this.process,this))
},process:function(){$(this.options.selector).each(function(){var el=$(this),data=el.attr("data-timestamp");
if(data){el.text(stringUtils.prettyDate(data*1))}})}})})();
(function(){eval(ustream.namespace);ustream.classes.FlashViewerCore=ustream.classes.FlashBase.extend({initialize:function(id,options){this.parent(id,options);
if(typeof(ustream.flash.viewer)!=="object"){ustream.flash.viewer={}}ustream.flash.viewer[id]=this},ready:function(){this.parent();
if(this.options.flashvars.enablejsapi){this.addListener("ppv","initiateLogon","onInitiateLogon");this.addListener("ppv","buyTicket","onBuyTicket");
this.addListener("ppv","enterTicket","onEnterTicket");this.addListener("ppv","subscribe","onSubscribe");
this.addListener("viewermodulemanager","createPpv","onFlashCreatePpvReady");this.addListener("channel","videoAdPlay","onVideoAdPlay");
this.addListener("channel","videoAdStop","onVideoAdStop");captureEvent(ustream.events.USERSUBSCRIBED,eBind(this.onSubscribied,this));
captureEvent(ustream.events.USERNOTSUBSCRIBED,eBind(this.onNotSubscribed,this));captureEvent(ustream.events.TICKETBOUND,eBind(this.onTicketBound,this));
captureEvent(ustream.events.USERHASTICKET,eBind(this.onHasTicket,this));captureEvent(ustream.events.USERHASNOTICKET,eBind(this.onHasNoTicket,this))
}},pause:function(){this.callMethod("logic.media","pause")},stop:function(withSeekReset){this.callMethod("logic.media","pause");
if(withSeekReset){this.callMethod("logic.media","seek",0)}},play:function(){this.callMethod("logic.media","play")
},notifyFlashOfLogin:function(){var benefits=ustream.vars.userBenefits||{};this.parent();this.setProperty("logic","adFree",!!benefits.adfreeview)
},setAlreadySubscribed:function(){if(typeof this.getProperty("logic.media.modules.ppv","alreadySubscribed")==="boolean"){this.setProperty("logic.media.modules.ppv","alreadySubscribed",true)
}else{this.setProperty("logic.channel.modules.ppv","alreadySubscribed",true)}},setAlreadyNotSubscribed:function(){if(typeof this.getProperty("logic.media.modules.ppv","alreadySubscribed")==="boolean"){this.setProperty("logic.media.modules.ppv","alreadySubscribed",false)
}else{this.setProperty("logic.channel.modules.ppv","alreadySubscribed",false)}},setHasTicket:function(){this.setProperty("logic.media.modules.ppv","hasTicket",true)
},setHasNoTicket:function(){this.setProperty("logic.media.modules.ppv","hasTicket",false)},banRedirect:function(username){window.location.href=window.location.protocol+"//"+window.location.host+"/user-banned/"+username
},onStartPointSeek:function(value){dispatchEvent(ustream.events.HIGHLIGHTSTARTSEEK,{point:"from",percent:value})
},onEndPointSeek:function(value){dispatchEvent(ustream.events.HIGHLIGHTENDSEEK,{point:"to",percent:value})
},onSubscribe:function(){dispatchEvent(ustream.events.SUBSCRIPTIONINIT)},onFlashCreatePpvReady:function(){ustream.vars.flashPpvCreateReady=true;
dispatchEvent(ustream.events.FLASHPPVCREATEREADY)},onSubscribied:function(){this.setAlreadySubscribed()
},onNotSubscribed:function(){this.setAlreadyNotSubscribed()},onTicketBound:function(){this.callMethod("logic.media","destroy");
this.createMediaItem()},onHasTicket:function(){this.setHasTicket()},onHasNoTicket:function(){this.setHasNoTicket()
},onVideoAdPlay:function(){dispatchEvent(ustream.events.FLASHVIDEOADPLAY)},onVideoAdStop:function(){dispatchEvent(ustream.events.FLASHVIDEOADSTOP)
},createMediaItem:function(){}})}());
(function(){eval(ustream.namespace);ustream.classes.FlashViewer=ustream.classes.FlashViewerCore.extend({ready:function(){this.parent();
var cid=this.options.flashvars.cid;if(this.options.flashvars.enablejsapi){this.addListener("viewer","ready","onViewerReady");
this.addListener("meta","update","onTaglineUpdate");this.addListener("channel","online","onChannelOnline");
this.addListener("channel","offline","onChannelOffline");captureEvent(ustream.events.TICKETBOUND,eBind(this.onTicketBound,this));
captureEvent(ustream.events.USERHASTICKET,eBind(this.onHasTicket,this));captureEvent(ustream.events.USERHASNOTICKET,eBind(this.onHasNoTicket,this))
}},getViewerCount:function(){return this.getProperty("logic.media.modules.viewers.data","count")},onViewerReady:function(){dispatchEvent(ustream.events.FLASHVIEWERREADY,{id:this.id,instance:this.instance})
},onTaglineUpdate:function(){dispatchEvent(ustream.events.CHANNELTAGLINEUPDATE,{tagline:this.getProperty("logic.media.modules.meta.data","tagline")})
},onViewerNumberUpdate:function(){dispatchEvent(ustream.events.CHANNELVIEWERSUPDATE,{viewers:this.getViewerCount()})
},onChannelOnline:function(){dispatchEvent(ustream.events.CHANNELONLINE)},onChannelOffline:function(){dispatchEvent(ustream.events.CHANNELOFFLINE)
},addButton:function(label,style){return this.callMethod("viewer.customButtons","addButton",label,style)
},createChannel:function(channelId){return this.callMethod("logic","createChannel",channelId)},onBuyTicket:function(idColl){dispatchEvent(ustream.events.TICKETPURCHASEINIT,{eventId:idColl.eventId,mediaId:idColl.mediaId})
},onEnterTicket:function(idColl){dispatchEvent(ustream.events.TICKETENTERCODE,{eventId:idColl.eventId,mediaId:idColl.mediaId})
},createMediaItem:function(){this.loadChannel(ustream.vars.channelId)},loadChannel:function(cid){this.callMethod("logic","createChannel",cid)
},onHasTicket:function(){this.setHasTicket()},onHasNoTicket:function(){this.setHasNoTicket()},loadChannel:function(cid){this.callMethod("logic","createChannel",cid)
}})}());
(function(){eval(ustream.namespace);ustream.classes.ShowInfoDescriptionToggle=new Class({options:{container:"#ShowInfoTab",toggleElement:"#ShowInfoDescriptionToggle"},initialize:function(options){this.options=merge(this.options,options||{});
this.options.container=$(this.options.container);this.options.toggleElement=$(this.options.toggleElement);
this.options.toggleElement.click(eBind(this.toggleShowInfo,this));this.toggleShowLink()},toggleShowInfo:function(e){e.stop();
var more=this.options.container.find(".moreInfo"),less=this.options.container.find(".lessInfo");if(more.hasClass("full")){$(e.target).text(_t_("js.v3.channel_details.info_show_more"));
more.hide().removeClass("full");less.show()}else{$(e.target).text(_t_("js.v3.channel_details.info_show_less"));
more.show().addClass("full");less.hide()}},toggleShowLink:function(){var more=this.options.container.find(".moreInfo"),less=this.options.container.find(".lessInfo");
link=this.options.container.find(".moreInfo").next().find("a");if(more.hasClass("full")){$(link).text(_t_("js.v3.channel_details.info_show_less"))
}else{$(link).text(_t_("js.v3.channel_details.info_show_more"))}}})}());
(function(){eval(ustream.namespace);ustream.classes.AddMoreLess=new Class({options:{lazy:false,maxLetters:200,ellipsis:"...",target:".jsAddMoreLess",template:'<div class="all" style="display:none"><%= fullText %> <a class="jsShowLess" href="#">'+_t_("js.v3.add_more_less.less")+'</a></div><div class="fragment"><%= truncatedText %><%= ellipsis %> <a class="jsShowMore" href="#">'+_t_("js.v3.add_more_less.more")+"</a></div>"},initialize:function(options){this.options=merge(this.options,options||{});
captureEvent(ustream.events.ADDMORELESS,eBind(this._attach,this));this.template=new ustream.classes.SimpleTpl(this.options.template);
if(!this.options.lazy){this._attach()}},_attach:function(e){$(this.options.target).each(bind(function(i,el){var el=$(el),text=$.trim(el.text()),trunc=this._truncate(text,this.options.maxLetters);
el.if_(trunc!==text).empty().html(this.template.run({fullText:text,truncatedText:trunc,ellipsis:this.options.ellipsis})).removeClass("jsAddMoreLess").addClass("jsAddMoreLessManaged").click(eBind(this._onContainerClick,this)).show()
},this))},_onContainerClick:function(e){var el=$(e.target);el.closest(".jsAddMoreLessManaged").if_(el.hasClass("jsShowMore")).find("div.fragment").hide().end().find("div.all").show().end().each(function(){e.stop()
}).else_(el.hasClass("jsShowLess")).find("div.fragment").show().end().find("div.all").hide().end().each(function(){e.stop()
}).end()},_truncate:function(s,limit){var m,lsi,lastSpace=20,spaceAt=s.indexOf(" ");if(typeof s!=="string"){return""
}if(s.length<limit){return s}if(spaceAt===-1||spaceAt>limit){return s.substr(0,limit)}s=s.substr(0,limit);
lsi=s.lastIndexOf(" ");if(lsi>limit-lastSpace){return s}else{return s.substr(0,lsi)}}})})();
(function(){eval(ustream.namespace);ustream.classes.StaticMoreLess=new Class({options:{toggler:null,moreContent:null,lessContent:null,moreTxt:"More...",lessTxt:"Less..."},initialize:function(target,options){this.options=merge(this.options,options||{});
this.links=$(target).find(this.options.toggler);this.links.click(eBind(this.toggleMoreInfo,this));this.toggleLink()
},toggleMoreInfo:function(e){e.stop();var more=$(e.target).siblings(this.options.moreContent),less=this.options.lessContent?$(e.target).siblings(this.options.lessContent):null;
if(more.hasClass("full")){$(e.target).text(this.options.moreTxt);more.hide().removeClass("full");if(less){less.show()
}}else{$(e.target).text(this.options.lessTxt);more.show().addClass("full");if(less){less.hide()}}},toggleLink:function(){var more,elem;
forEach($.makeArray(this.links),function(elem){elem=$(elem);if(elem.prev(this.options.moreContent).hasClass("full")){elem.text(this.options.lessTxt)
}else{elem.text(this.options.moreTxt)}},this)}})})();
ustream.templates.dashboardFollowers='<input type="hidden" data-template="dashboardFollowers" /><% forEach(records, function(record){ %><li class="<%= record["className"] %> fakeWrap"><div class="wrap"><div class="left"><a href="<%= record["url"] %>"><img src="<%= record["picture"] %>" alt="<%= record["userName"] %>" width="61" /></a></div><div class="mid"><h3><% if (record["premiumIcon"]) { %><span class="ssIconInline clickable jsPmOpener"></span><% } %><a href="<%= record["url"] %>"><%= record["userName"] %></a><% if(record["isLive"]) { %><br /><span title="Now Live!"><% if (record["viewersNum"]) { %><% if (record["viewersNum"] == 1) { %><%= _t_("js.v3.dashboard_follow.live_with_viewer", {n: record["viewersNum"]}) %><% } else { %><%= _t_("js.v3.dashboard_follow.live_with_viewers", {n: record["viewersNum"]}) %><% } %><% } else { %><%= _t_("js.v3.dashboard_follow.live") %><% } %></span><% } %></h3><% if (record["crowdData"]["size"]) { %><!--div class="users"><%= _t_("js.v3.dashboard_follow.people_in_crowd") %> <span class="num"><%= record["crowdData"]["size"] %></span></div--><% } %><% if (typeof(noJoinDate) == "undefined") { %><%= _t_("js.v3.dashboard_follow.join_date") %> <%= record["crowdJoinDate"] %><% } %></div><% if (record["channelId"]) { %><% if ((typeof(noRightCol) == "undefined") && (ustream.vars.loggedInUserId != record["userId"])) { %><div class="right"><input type="hidden" class="followUser" value="{userId:<%= record["userId"] %>,isFollow:<%= record["crowdData"]["inCrowd"] %>,crowdSize:<%= record["crowdData"]["size"] %>,emailAlerts:<%= record["crowdData"]["emailAlerts"] %>,displayCrowdSize:false,buttonType:\'normal\',userBasedMode:true}" /></div><% } %><% } %></div></li><% }); %>';
ustream.templates.genTabbedTitleBox='<div><input type="hidden" data-template="genTabbedTitleBox" /><div class="tabbedTitleBox followLister <%= typeof(className) == "string" ? className : ""%>" id="<%= typeof(id) == "string" ? id : "" %>"><ul class="title"><% if( typeof(active) == "undefined") { %><% var active = 0; %><% } %><% forEach(titles, function(s, i){ %><li class="tab tab<%= i %> <%= i == active ? "active" : "" %>"><b></b><%= s %></li><% }); %></ul><% forEach(titles, function(s, i){ %><div class="pagerWrap<%= i %> pGroup pGroup<%= i %> upToTitleRight"></div><% }); %><div class="content"><% forEach(titles, function(s, i){ %><ul class="tabPageContent tpCont<%= i %> pGroup pGroup<%= i %>">&nbsp;</ul><% }); %></div></div></div>';
(function(){eval(ustream.namespace);ustream.classes.ChannelEventsSubscriberList=new Class({options:{attendingListUrl:"",attendingListFriendsUrl:"",title:""},titles:[],baseTpl:new ustream.classes.SimpleTpl(ustream.templates.genTabbedTitleBox),listTpl:new ustream.classes.SimpleTpl(ustream.templates.dashboardFollowers),emptyMsg:["","<p style='padding:10px;text-align:center;'>"+_t_("js.v3.channel_events_subscriber_list.emptymessaeg")+"</p>"],initialize:function(options){this.options=merge(this.options,options||{});
this._tabsInited=new Array(2);if(!ustream.vars.loggedIn){this.titles=[_t_("js.v3.channel_events_subscriber_list.title_everyone")]
}else{this.titles=[_t_("js.v3.channel_events_subscriber_list.title_everyone"),_t_("js.v3.channel_events_subscriber_list.title_friends")]
}(this.html=$(this.baseTpl.run({titles:this.titles,className:"channelEventsSubscriberList"}))).dialog({modal:true,title:this.options.title,autoOpen:true,width:500,minHeight:200});
this.tabBox=new ustream.classes.TabbedTitleBox(this.html,{onActiveTabSet:bind(function(n){if(n===1){if(!this._tabsInited[n]){this.cover(1);
$.get(this.options.attendingListFriendsUrl,bind(this.buildHtmlForInitial,this,1),"json")}}},this)});this.cover(0);
$.get(this.options.attendingListUrl,bind(this.buildHtmlForInitial,this,0),"json")},cover:function(n,remove){if(!this._covers){this._covers=[]
}if(remove){this._covers[n].destroy();delete this._covers[n];return}this._covers[n]=new ustream.classes.CoverLayer(this.html,{show:true})
},unCover:function(n){this.cover(n,true)},buildHtmlForInitial:function(n,resp){if(this._tabsInited[n]){return
}this._tabsInited[n]=true;this.unCover(n);if(!resp.records.length){this.html.find(".tpCont"+n).html(this.emptyMsg[n]);
return}this.renderList(n,resp);var pager=new ustream.classes.CallbackPager({pager:resp.pager,pagerUrl:resp.pagerUrl,pagerPath:this.html.find(".pagerWrap"+n),coverLayerEl:this.html,buildTpl:true,onResponse:bind(this.renderList,this,n)})
},renderList:function(n,resp){resp.noJoinDate=true;this.html.find(".tpCont"+n).empty().html(this.listTpl.run(resp)).end();
setTimeout(bind(function(){this.html.find("input.followUser").each(function(i){new ustream.classes.FollowUser(this,{_html:ustream.templates.followUserMini,_skipLoginCheck:!!$(this).parents("#Header").size()})
})},this),0)},show:function(){this.html.dialog("open")}})})();
ustream.templates.channelVideosBox='<div class="tabbedTitleBox" id="RecordedShowsBox" data-template="channelVideosBox"><ul class="title"><li class="active"><%= _t_("www.channel_page.v3.videos_tab.title", "Videos") %></li><li class="" id="HighlightsTab"><%= _t_("www.channel_page.v3.highlights_tab.title", "Highlights") %></li></ul><div id="RecordedShowsBoxPager"></div><div id="HighlightsShowsBoxPager"></div><div class="content"><div class="tabPageContent"><ul id="RecordedShowsBoxList" class="recordedShowThumbs"></ul></div><div class="tabPageContent hiliteContent" style="min-height:60px"><ul id="HighlightsShowsBoxList" class="recordedShowThumbs"></ul></div></div></div>';
ustream.templates.channelVideos='<% var isTlaUser = ",1181558,9939675,9714236,66331,1165819,186037,307598,2209330,8002434,".indexOf("," + ustream.vars.ownerId + ",") > -1; %><input type="hidden" data-template="channelVideos" /><% forEach (records, function(video,iterator){ %><li class="<%= ((iterator + 1) % 4 == 0)?"break":"" %>"><a href="<%= video["url"] %>" class="thumbnail"><span class="img"><img data-lazyload="<%= video["thumbnailUrl"] %>" src="" alt="<%= video["title"] %>" /></span></a><ul class="badges"><% if(true == video["isVod"] && video["isVod"] != "0" && video.isSubscription == 0) { %><li class="ppv"><%= _t_("js.v3.channel_videos.ppv_badge") %></li><% } else if (video.isVod == 1 && video.isSubscription == 1) { %><li class="subscription"><%= _t_("www.manageshow_videos_page.subscription_only_badge") %></li><% } else if (video.isVod == 0 && video.isSubscription == 1) { %><li class="subscriptionFree"><%= _t_("www.manageshow_videos_page.subscription_free_badge") %></li><% } %></ul><a href="<%= video["url"] %>" class="title"><%= stringUtils.truncateByLength(video["title"], 80, true) %></a><% if (!isTlaUser) { %><span class="views"><% if(typeof(liveSection) != "undefined" && liveSection) { %><%= _t_("js.v3.channel_videos.viewers", {n: video["views"]}) %> <% } else { %><%= _t_("js.v3.channel_videos.views", {n: video["views"]}) %> <% } %></span><% } %><% if (video["userName"]) { %><div class="user"><a href="<%= video["profileUrl"] %>"><%= video["userName"] %></a></div><% } %></li><% }); %>';
ustream.templates.callbackPager='<input type="hidden" data-template="callbackPager" /><div class="pager advancedPager" id="<%= T.id ? id : "" %>" style="<%= T.hidden ? "display:none" : "" %>"><span class="buttonWrapper"><a href="#" class="pagerButton next rightSide" title="<%= _t_("js.v3.pager.next") %>">&#x25ba;</a><!----><a href="#" class="pagerButton last rightSide leftSplit" title="<%= _t_("js.v3.pager.last") %>">&#x25ba;<span class="toLeft">I</span></a></span><span class="mid"><input value="<%= page %>" class="manualPager" /> <%= _t_("js.v3.pager.of") %> <span class="max"><%= pageCount %></span></span><span class="buttonWrapper"><a href="#" class="pagerButton first leftSide" title="<%= _t_("js.v3.pager.first") %>"><span>I</span>&#x25c4;</a><!----><a href="#" class="pagerButton prev leftSide leftSplit" title="<%= _t_("js.v3.pager.previous") %>">&#x25c4;</a></span></div>';
ustream.templates.thumbLister='<% if (videos.length > 0) { %><% var i = 0; %><% forEach(videos, function(video) { %><% if (i % 3 == 0) { %><ul class="recordedShowThumbsV4 clearAfter"><% } %><li class="<%= (i % 3 == 0) ? "firstinrow" : "" %>"><a href="<%= video.url %>" class="shadowbox"><% if (i < pageSize) { %><img src="<%= video.thumbnailUrl %>" alt="<%= video.title %>" width="192" height="108" class="lazyloaded" /><% } else { %><img src="" alt="<%= video.title %>" width="192" height="108" data-lazyload="<%= video.thumbnailUrl %>" /><% } %></a><% if (showBadges == true) { %><ul class="badges"><% if (video.isPpv == true) { %><li class="ppv"><%= _t_("js.v3.channel_videos.ppv_badge") %></li><% } %></ul><% } %><h4><a href="<%= video.url %>"><%= stringUtils.truncateByLength(video.title, 60, true) %></a></h4><% if (video.channelName != null) { %><a href="<%= video.channelUrl %>" class="username"><%= stringUtils.truncateByLength(video.channelName, 60, true) %></a><% } %></li><% if ((i + 1) % 3 == 0) { %></ul><% } %><% i++; %><% }) %><% } else if(emptyMsg.length > 0) { %><p><%= emptyMsg %></p><% } %>';
(function(){eval(ustream.namespace);ustream.classes.PpvShowMoreCodes=new Class({options:{container:null},initialize:function(options){this.options=merge(this.options,options||{})
},managePurchasedEvents:function(e){var container=this.options.container;if(e&&e.eventData&&e.eventData.container){container=e.eventData.container
}container.delegate(".toggleCodes","click",eBind(function(e){e.stop();var target=$(e.target),wrap=target.parents(".ppvCodes"),moreCodeSign=wrap.find(".moreCodeSign"),moreCodes=wrap.find(".moreCode");
if(target.hasClass("jsShowMoreCodes")){target.removeClass("jsShowMoreCodes").addClass("jsShowLessCodes").text(_t_("www.upcomingevents_widget.show_less_codes","show less"));
moreCodeSign.hide();moreCodes.show()}else{target.removeClass("jsShowLessCodes").addClass("jsShowMoreCodes").text(_t_("www.upcomingevents_widget.show_more_codes","show more"));
moreCodeSign.show();moreCodes.hide()}},this))}})})();
ustream.templates.channelEvents='<input type="hidden" data-template="channelEvents" /><% forEach(records, function(event, i){ %><li class="<%= event["className"] %> eventItem <%= event["isPpv"] ? "ppvEvent" : "" %>" attendingListUrl="<%= event["attendingListUrl"] %>" attendingListFriendsUrl="<%= event["attendingListFriendsUrl"] %>"><div class="wrap"><div class="date"><div class="dateBox<%= i == 0 ? " colored" : "" %>"><span class="month"><%= event["dateTime"]["monthShort"] %></span><strong class="dayNum"><%= event["dateTime"]["dayMonth"] %></strong><%= event["dateTime"]["dayShort"] %></div></div><div class="text"><% if (event["isPpv"] && typeof purchasedContentView == "undefined") { %><span class="ppvTag"><%= _t_("www.upcomingevents_widget.pay_per_view") %></span><% } %><a href="<%= typeof(event["channelUrl"]) == "undefined" ? "" : event["channelUrl"] %>#events" title="by <%= event["eventUserName"] %>" class="eventName"><%= event["eventTitle"] %></a><% if (event["formattedDateRange"]) { %><strong class="exactdate"><%= event["formattedDateRange"] %></strong><% } %><% if (typeof(event["formattedAttendingText"]) != "undefined") { %><div class="users"><%= event["formattedAttendingText"] %></div><% } %><% if (typeof(event["transactions"]) != "undefined") { %><% var iCode = 0; %><div class="ppvCodes"><% forEach(event["transactions"], function(transaction, i){ %><% if (transaction["ownTrans"]){ %><div class="transactionWrap <%= ( iCode >= 3 ) ? "moreCode" : "" %>"><span class="transactionLabel"><%= _t_( "www.upcomingevents_widget.transaction_id" ); %>: </span><%= transaction["transactionId"]; %></div><% } %><ul class="<%= ( iCode >= 3 ) ? "moreCode" : "" %>"><% var iTransactionCode = 0, ticketsLength = transaction["tickets"].length; %><% forEach(transaction["tickets"], function(ticket, j){ %><% iTransactionCode++; %><li class="ppvCode <%= ( iCode >= 3 ) ? "moreCode " : "" %><%= (ticket["youUsed"]) ? "activated " : "" %><%= ( ticketsLength == iTransactionCode ) ? "lastCode " : " " %>"><span><%= ticket["code"] %></span><b title="<%= _t_( "www.upcomingevents_widget.validated_ticket" ); %>">&nbsp;</b></li><% iCode++; %><% }); %></ul><% }); %><% if (iCode > 3) { %><div class="ppvCode moreCodeSign">...</div><a href="#" class="toggleCodes jsShowMoreCodes"><%= _t_("www.upcomingevents_widget.show_more_codes"); %></a><% } %></div><% } %><div class="eventDescription jsAddMoreLess"><%= event["eventDescription"] %></div><em class="countdown"><%= event["dateTime"]["countDown"] %></em></div><% if (ustream.vars.loggedInUserId != ustream.vars.ownerId) { %><% if ( event["isPpv"]){ %><div class="ppvAdd"><% if (event["isAttending"]){ %><span><b>&nbsp;</b><% if (typeof(past) != "undefined" && past) { %><span><%= _t_("www.upcomingevents_widget.attending_ticket_past") %></span><% } else { %><span><%= _t_("www.upcomingevents_widget.attending_ticket") %></span><% } %></span><% } else if(!event["past"] && event["freeTicket"]) { %><button class="major"rel="<%= event["addTicketUrl"] %>"><%= _t_("www.upcomingevents_widget.add_ticket") %></button><input type="hidden" class="jsFreeTicket" value="<%= event["freeTicket"]; %>"/><% } %></div><% } else { %><div class="rsvp"><input type="hidden" class="rsvp" value="{eventId: <%= event["eventId"]%>,href:\'<%= event["rsvpUrl"] %>\',isFollow:<%= event["isAttending"] ? "true" : "false"; %>}" /></div><% } %><% if (event["isPpv"]) { %><% if (event["eventId"] && event["isSelling"] && !event["past"]) { %><div class="buy"><strong class="price"><%= event["priceFormatted"] %></strong><button class="major" rel="<%= event["eventId"] %>"><% if(event["isAttending"] || event["hasTicket"]) { %><%= _t_("www.upcomingevents_widget.buy_more_ticket") %><% } else { %><%= _t_("www.upcomingevents_widget.buy_ticket") %><% } %></button></div><% } %><% } %><% } %><div class="clb"></div><span class="ie7">&nbsp;</span></div></li><% }); %>';
(function(){eval(ustream.namespace);ustream.classes.ChannelEvents=new Class({options:{pager:null,Url:null,itemsListPath:null,pagerPath:null,rawData:null,template:ustream.templates.channelEvents,labelGroup:null},initialize:function(options){if(!options){return $.console.log("Unmanaged event lister.")
}if((type(options)=="string")&&(options)){options={autoId:options}}this.options=merge(this.options,options||{});
var auid=this.options.autoId;if((auid)&&(!$("#"+auid).length||!ustream.vars[auid])){$.console.log("Skipped init for "+auid);
return false}if(this.options.autoId){this.options.pager=ustream.vars[auid].pager,this.options.pagerUrl=ustream.vars[auid].pagerUrl,this.options.itemsListPath="#"+auid+"List",this.options.pagerPath="#"+auid+"Pager"
}this.pager=new ustream.classes.CallbackPager(merge(this.options,{onResponse:bind(this.onResponse,this),coverLayerEl:$(this.options.itemsListPath).parent()}));
this.template=new ustream.classes.SimpleTpl(this.options.template);this.pageItemCont=$(this.options.itemsListPath);
if(this.options.rawData){this.useRawData(this.options.rawData)}this.pageItemCont.click(eBind(this.onClick,this));
this.setBuyPpvEvent();var container=$("#"+this.options.autoId+" #PurchasedContentList");this.showMoreCodes=new ustream.classes.PpvShowMoreCodes({container:container});
this.showMoreCodes.managePurchasedEvents()},onShow:function(){this.pager.show()},onHide:function(){this.pager.hide()
},useRawData:function(data){this.pager.lock();this.onResponse(data)},onResponse:function(data){data.past=this.pageItemCont.hasClass("past");
forEach(data.records,function(dateData){dateData.dateTime.monthShort=dateUtils.getFormattedDate(dateData.dateTime.monthShort);
dateData.dateTime.dayMonth=dateUtils.getFormattedDate(dateData.dateTime.dayMonth);dateData.dateTime.dayShort=dateUtils.getFormattedDate(dateData.dateTime.dayShort);
dateData.formattedDateRange=dateUtils.getFormattedDateRange(dateData.formattedDateRange)});this.pageItemCont.empty().html(this.template.run(data));
this.setBuyPpvEvent();dispatchEvent(ustream.events.ADDMORELESS);dispatchEvent("manageFollowButtons")},onClick:function(e){var target=e.target,el=$(target),eventItem,title,isPast;
if(el.hasClass("openSubscriberList")){e.stop();if(!target.subscriberList||target.loggedInCache!=ustream.vars.loggedIn){eventItem=el.closest("li.eventItem");
isPast=el.closest("ul").hasClass("past");if(isPast){title=_t_("js.v3.channel_events.subscriber_list_title_past")
}else{title=_t_("js.v3.channel_events.subscriber_list_title")}target.subscriberList=new ustream.classes.ChannelEventsSubscriberList({attendingListUrl:eventItem.attr("attendingListUrl"),attendingListFriendsUrl:eventItem.attr("attendingListFriendsUrl"),title:title});
target.loggedInCache=ustream.vars.loggedIn}target.subscriberList.show()}},setBuyPpvEvent:function(){this.pageItemCont.find(".ppvEvent .buy > button").click(eBind(function(e){var target=$(e.target),eventId=target.attr("rel"),url,urlParts;
if(!ustream.vars.isPPV){url=target.closest(".wrap").find(".text > .eventName").attr("href");urlParts=url.split("#")[0].split("?");
urlParts[0]+="/buyticket/"+eventId;location.href=urlParts[0]}},this))}})})();
(function(){eval(ustream.namespace);ustream.classes.CallbackPager=new Class({options:{loadOnInit:false,coverLayerEl:null,cover:null,buildTpl:false,mockResponse:null,onResponse:function(){},onLock:function(){},onUnLock:function(){},parameters:{}},initialize:function(options){this.options=merge(this.options,options||{});
if(typeof(options.pager)=="string"){if(!ustream.vars[options.pager]){$.console.log("CallbackPager.js - failed to initialize: ",options.pager);
return}this.options=merge(this.options,ustream.vars[options.pager]);this.options.pager=ustream.vars[options.pager].pager;
this.options.pagerUrl=ustream.vars[options.pager].pagerUrl;this.options.pagerPath=options.pagerSelector||"#"+options.pager+"Pager"
}this.pager=this.options.pager;this.pagerUrl=this.options.pagerUrl.replace(/xPAGEIDx/,"");this.pagerEl=$(this.options.pagerPath);
if(this.options.buildTpl){var tpl=new ustream.classes.SimpleTpl(ustream.templates.callbackPager);this.pagerEl.html(tpl.run(this.options.pager))
}this.pagerEl.click(eBind(this.onPagerClick,this));this.pagerEl.find(".mid input").change(eBind(this.onPagerInputChange,this)).keydown(eBind(this.onPagerKeyDown,this));
if(this.options.cover instanceof ustream.classes.CoverLayer){this.cover=this.options.cover}else{if(this.options.coverLayerEl){this.cover=new ustream.classes.CoverLayer(this.options.coverLayerEl)
}}this.fillPager();if(this.options.loadOnInit){this.onResponse(merge(this.options,{success:true}))}},show:function(){this.pagerEl.show()
},hide:function(){this.pagerEl.hide()},refresh:function(){this.getPage(this.pager.page)},onPagerInputChange:function(e){var el=e.target,val=$.trim(el.value.replace(/[^\d]/g,""));
if(val){this.getPage(val)}else{el.value=this.pager.page}},onPagerKeyDown:function(e){var el=e.target,val=parseInt($.trim(el.value.replace(/[^\d]/g,"")),10);
if(e.keyCode==40&&val>1){this.getPage(val-1)}else{if(e.keyCode==38&&val<this.pager.pageCount){this.getPage(val+1)
}}},onPagerClick:function(e){e.stop();if(this.locked){return}var el=$(e.target),p=this.pager,pNum=0;if(e.target.tagName=="SPAN"){el=$(e.target.parentNode)
}if(el.hasClass("disabled")){return}if(el.hasClass("first")){pNum=(1)}else{if(el.hasClass("prev")){pNum=(p.pagePrev)
}else{if(el.hasClass("last")){pNum=(p.pageCount)}else{if(el.hasClass("next")){pNum=(p.pageNext)}else{if(el.hasClass("manualPager")){el.select()
}}}}}if(pNum){this.getPage(pNum)}},lock:function(){this.locked=true;if(this.cover){this.cover.show()}this.options.onLock()
},unLock:function(){this.locked=false;if(this.cover){this.cover.hide()}this.options.onUnLock()},getPage:function(n){var url,firstParam=true,param="";
if(n<1){n=1}else{if(n>this.pager.pageCount){n=this.pager.pageCount}}this.lock();url=this.pagerUrl+n;for(var i in this.options.parameters){param+=(firstParam)?"?":"&";
param+=i+"="+encodeURIComponent(this.options.parameters[i]);firstParam=false}url=url+param;if(this.options.mockResponse){setTimeout(bind(function(){$.console.log("mock request ",this.options.mockResponse);
this.onResponse(this.options.mockResponse)},this),600)}else{$.getJSON(url,bind(this.onResponse,this))
}},fillPager:function(){var p=this.pager,visible=p.pageCount>1;this.pagerEl.addClassIf("visible",visible,true).find(".pager").addClassIf("visible",visible,true).end().find(".max").setHtml(p.pageCount).end().find(".mid input").setVal(p.page).if_(p.pageCount>999).css("width",30).else_(p.pageCount>99).css("width",23).else_().css("width",19).end().end().find(".pagerButton").removeClass("disabled").end().find(".leftSide, .prev").addClassIf("disabled",!p.pagePrev).end().find(".rightSide, .next").addClassIf("disabled",!p.pageNext).end()
},updatePager:function(data){this.pager=data.pager;if(data.pagerUrl){this.pagerUrl=data.pagerUrl.split("?")[0].replace(/xPAGEIDx/,"")
}this.fillPager()},onResponse:function(data){this.unLock();if(!data.success){return}this.updatePager(data);
dispatchEvent(ustream.events.PAGINATION,data,this);this.options.onResponse(data)},addParam:function(key,value){this.options.parameters[key]=value
},removeParam:function(key){delete this.options.parameters[key]}})})();
(function(){eval(ustream.namespace);ustream.classes.CenterImages=new Class({_imgNum:0,initialize:function(target,options){this.itemCont=$(target);
this._imgSizes={};this._imgSizesById={};if(options.size){this.imgBoxSize=options.size}if(options.autorun){this.fixPositions(true)
}var that=this;this.itemCont.find(".img img").each(function(){var el=$(this),_this=this;el.data("center",function(){that._onImageLoad.call(that,_this,true,true)
})})},fixPositions:function(firstRun){var that=this;this.itemCont.find(".img img").each(function(){var el=$(this),pid="CI_"+that.__instaId+"_"+that._imgNum++;
if(!el.attr("id")){el.attr("id",pid)}var isLazyCrap=el.hasClass("lazyload")||el.attr("src").match(/.*\/blank\.gif$/);
if(el.hasClass("centeredByJs")||isLazyCrap){return}if(firstRun){if(el.attr("complete")){that._onImageLoad(this,true);
return}}if(that._imgSizes[this.src]){that._onImageLoad(this)}else{var _this=this;el.css({opacity:0.1}).load(function(){setTimeout(function(){that._onImageLoad.call(that,_this)
},1)});if(BOM.ie&&el.attr("complete")){el.trigger("load")}}})},_onImageLoad:function(element,firstRun,reset){if(!element||typeof(element)=="number"){return
}var el=$(element),imgHeight,imgWidth,imgSrc=element.src,wDiff,hDiff,pad,mar;if(firstRun||!this._imgSizes[imgSrc]){if(reset){element.removeAttribute("width");
element.removeAttribute("height")}this._imgSizes[imgSrc]=[el.attr("width"),el.attr("height")]}imgWidth=this._imgSizes[imgSrc][0];
imgHeight=this._imgSizes[imgSrc][1];wDiff=Math.round((this.imgBoxSize[0]-imgWidth)/2);hDiff=Math.round((this.imgBoxSize[1]-imgHeight)/2);
if(hDiff>0){el.css({paddingTop:hDiff}).css({paddingBottom:hDiff})}if(wDiff>0){el.css({paddingLeft:wDiff}).css({paddingRight:wDiff})
}if(hDiff<0){el.css({marginTop:hDiff})}if(wDiff<0){el.css({marginLeft:wDiff})}el.css({opacity:1}).addClass("centeredByJs")
}})})();
(function(){eval(ustream.namespace);ustream.classes.CopyEmbedCode=new Class({options:{embedCode:'<embed height="100%"flashvars="callback=<%=callback%>&callbackParam=<%=callbackParam%>&clipboard=<%=data%>"allowscriptaccess="always"menu="false"scale="noscale"wmode="transparent"quality="low"bgcolor="#ffffff"name="swfcopy<%=id%>"id="swfcopy<%=id%>"style="width: 102px; opacity:0; filter: alpha(opacity=0); cursor:pointer;"src="<%=src%>"type="application/x-shockwave-flash"/>',container:"form.embed_code"},initialize:function(options){Ustream.External.embedUrlCopy=function(elPath){$(elPath).css({opacity:0}).fadeIn(300).animate({opacity:1}).fadeOut(800)
};this.options=merge(this.options,options||{});this.options.embedCode=new ustream.classes.SimpleTpl(this.options.embedCode);
this.options.container=$(this.options.container);var textInput=this.options.container.find("input[type=text],textarea");
textInput.click(function(){$(this).select()}).parents(".embedWrap").find(".clipboard").setHtml(this.options.embedCode.run({callback:"Ustream.External.embedUrlCopy",callbackParam:encodeURIComponent(this.options.callbackParam),src:ustream.vars.staticUrl+"swf/copy.swf",data:escape(textInput.val()),id:(new Date()).getTime()})).click(function(){textInput.select()
})},destroy:function(){}})}());
(function(){eval(ustream.namespace);ustream.classes.ChannelVideos=new Class({options:{pager:null,pagerUrl:null,itemListPath:"#RecordedShowThumbs",pagerPath:null,rawData:null,preFixImages:false,template:ustream.templates.channelVideos},initialize:function(options){if(type(options)=="string"){options={autoId:options,preFixImages:true}
}this.options=merge(this.options,options||{});var auid=this.options.autoId;if((auid)&&(!$("#"+auid).length||!ustream.vars[auid])){$.console.log("Skipped init for "+auid);
return false}if(this.options.autoId){this.options.pager=ustream.vars[auid].pager,this.options.pagerUrl=ustream.vars[auid].pagerUrl,this.options.itemListPath="#"+auid+"List",this.options.pagerPath="#"+auid+"Pager";
this.lazyLoadImages()}this.pager=new ustream.classes.CallbackPager(merge(this.options,{onResponse:bind(this.onResponse,this),coverLayerEl:$(this.options.itemListPath).parent(),buildTpl:true}));
this.template=new ustream.classes.SimpleTpl(this.options.template);this.pageItemCont=$(this.options.itemListPath);
this.imgCenterTool=new ustream.classes.CenterImages(this.pageItemCont,{autorun:this.options.preFixImages,size:[120,90]});
if(this.options.rawData){this.useRawData(this.options.rawData)}},onShow:function(){this.pager.show()},onHide:function(){this.pager.hide()
},useRawData:function(data){this.onResponse(data)},onResponse:function(data){this.pageItemCont.empty();
this.pageItemCont.html(this.template.run(data));this.lazyLoadImages();this.imgCenterTool.fixPositions()
},lazyLoadImages:function(){var imgs=$A($("#"+this.options.autoId).find("img:not(.lazyloaded)"));forEach(imgs,function(item){var src=$(item).attr("data-lazyload");
$(item).attr("src",src).addClass("lazyloaded")})}})})();
(function(){eval(ustream.namespace);ustream.classes.SimplePager=new Class({numPages:0,actPage:0,itemsPerPage:0,options:{loop:false,items:".pageables li",buttons:".pager .pagerButton"},initialize:function(target,options){this.options=merge(this.options,options||{});
this.target=$(target);this.items=this.target.find(this.options.items);this.itemsPerPage=this.getVisibleItems();
if(!this.itemsPerPage){this.itemsPerPage=1}if(this.itemsPerPage<1){this.itemsPerPage=1}this.numPages=Math.ceil(this.items.length/this.itemsPerPage);
if(this.numPages<2){return}this.pagerInit()},pagerInit:function(){this.buttons=this.target.find(this.options.buttons);
this.buttons.click(eBind(this._onBtnClick,this));this.goToPage(1)},goToPage:function(n){n=this._pageNumConstraints(n);
this.actPage=n;var i,start=(n-1)*this.itemsPerPage,stop=start+this.itemsPerPage;this._disableButtonsForPage(n);
this.items.hide().removeClass("last").slice(start,stop).find("img[rel]").moveAttr("rel","src").end().show().filter(":last").addClass("last")
},toNextPage:function(){this.goToPage(this.actPage+1)},toPrevPage:function(){this.goToPage(this.actPage-1)
},getVisibleItems:function(){return this.target.find(this.options.items+":visible").length},_onBtnClick:function(e){e.stop();
var el=$(e.target);if(el.hasClass("disabled")){return}this.goToPage(this.actPage+(el.hasClass("prev")?-1:1))
},_disableButtonsForPage:function(n){if(this.options.loop){return}var isLast=(n==this.numPages),isFirst=(n==1),btnHalf=Math.round(this.buttons.length/2);
this.buttons.removeClass("disabled");if(isFirst){this.buttons.slice(0,btnHalf).addClass("disabled")}else{if(isLast){this.buttons.slice(btnHalf,this.buttons.length).addClass("disabled")
}}},_pageNumConstraints:function(n){if(!this.options.loop){if(n<1){n=1}else{if(n>this.numPages){n=this.numPages
}}}else{if(n<1){n=this.numPages}else{if(n>this.numPages){n=1}}}return n}})})();
(function(){eval(ustream.namespace);ustream.classes.FlagContent=new Class({options:{form:"#VideoFlag",toggleControl:false},initialize:function(options){this.options=merge(this.options,options||{});
this.options.form=$(this.options.form);this.fieldset=this.options.form.find("fieldset");this.flagPanelDisplay=false;
this.isAnimating=false;this.cover=new ustream.classes.CoverLayer(this.options.form);this.getReasonField().change(eBind(this.onReasonChange,this)).change();
$("#VideoFlagPpvEvents").change(eBind(this.setTargetId,this));if(this.options.form.length<1){return}if(this.options.toggleControl){$(this.options.toggleControl).click(eBind(this.onToggleFlag,this))
}this.options.form.submit(eBind(this.onSubmit,this));if(!ustream.vars.loggedIn){captureEvent(ustream.events.LOGINSUCCESS,bind(this.onLogin,this))
}this.originalTargetId=this.options.form.find('input[name="targetId"]').val()},onLogin:function(e){if(e.eventData){if(e.eventData.inappReasons){this.setReasons(e.eventData.inappReasons);
this.exposeInappReasons(e.eventData.inappReasons)}if(e.eventData.flagContent){var select=this.options.form.find("select");
if(this.options.toggleControl){$(this.options.toggleControl).show()}this.options.form.submit()}}},onToggleFlag:function(e){e.stop();
if(this.isAnimating){return false}if(!this.flagPanelDisplay){this.isAnimating=true;this.fieldset.stop().slideDown("fast",bind(function(){this.isAnimating=false
},this));this.flagPanelDisplay=true}else{this.isAnimating=true;this.fieldset.stop().slideUp("fast",bind(function(){this.isAnimating=false
},this));this.flagPanelDisplay=false}return true},onSubmit:function(e){e.stop();if(!ustream.vars.loggedIn){return dispatchEvent(ustream.events.REQUIRELOGIN,{flagContent:true})
}this.cover.show();this.options.form.ajaxSubmit({type:"POST",dataType:"json",success:bind(this.onSubmitResponse,this)})
},onSubmitResponse:function(response){this.cover.hide();if(!response||!response.success){return dispatchEvent(ustream.events.AJAXNOTIFICATION,{response:response})
}if(this.options.toggleControl){this.onToggleFlag(nullEvent)}ustream.events.dispatch(ustream.events.SUCCESSNOTIFICATION,{message:_t_("js.v3.flag_content.report_sent")})
},reasonIsPpvReason:function(){var ppvReasons=ustream.vars.ppvReasons,isPpv=false,value=parseInt(this.getReasonField().val(),10),i=ppvReasons.length;
if(ppvReasons){while(i&&!isPpv){i-=1;isPpv=+ppvReasons[i]===value}}return isPpv},onReasonChange:function(e){this.setTargetType();
if(ustream.vars.ppvReasons){this.toggleFlaggableEvents(this.reasonIsPpvReason())}this.setTargetId()},getReasonField:function(){return this.options.form.find('select[name="reason"]')
},getFlaggableEvents:function(){$.ajax({url:stringUtils.urlSubst(ustream.vars.flaggableEventsUrl,{reason:this.getReasonField().val()}),type:"GET",success:bind(this.onFlaggableEventsResponse,this),error:bind(this.onFlaggableEventsResponseError,this)});
this.cover.show()},toggleFlaggableEvents:function(show){var select=$("#VideoFlagPpvEvents"),ppvFlags=this.options.form.find(".ppvEvents");
if(show){ppvFlags.show();this.getFlaggableEvents()}else{ppvFlags.hide()}select.attr("disabled",!show)
},setTargetType:function(){this.options.form.find('input[name="targetType"]').val(ustream.vars.reasonTypes[this.getReasonField().val()])
},setTargetId:function(){var newId=this.originalTargetId;if(this.reasonIsPpvReason()){newId=$("#VideoFlagPpvEvents").val()
}this.options.form.find('input[name="targetId"]').val(newId)},exposeInappReasons:function(reasons){var ppvReasons=[],reasonTypes={},defaultTargetType=ustream.vars.defaultFlagReasonTargetType,i;
forEach(reasons,function(reason){if(reason.isPpv&&defaultTargetType==="channel"){ppvReasons.push(reason.id);
reasonTypes[reason.id]="event"}else{reasonTypes[reason.id]=defaultTargetType}});ustream.vars.ppvReasons=ppvReasons;
ustream.vars.reasonTypes=reasonTypes},_reasonEnabled:function(reason){var defaultTargetType=ustream.vars.defaultFlagReasonTargetType,isPpvReason=reason.isPpv;
return(ustream.vars.isPpvEnabled&&(isPpvReason&&defaultTargetType==="video"&&reason.isVideo)||(isPpvReason&&defaultTargetType==="channel"&&reason.isChannel))||(!reason.isPpv)
},setReasons:function(reasons){var options="",rl=reasons.length,reason,i;for(i=0;i<rl;i+=1){reason=reasons[i];
if(this._reasonEnabled(reason)){options+='<option value="'+reason.id+'">'+reason.reason+"</option>"}}this.getReasonField().html(options)
},setEvents:function(events){var html='<option value="">'+_t_("js.v3.flag_content.select_an_event")+"</option>";
forEach(events,function(value,key){html+='<option value="'+key+'">'+value+"</option>"});$("#VideoFlagPpvEvents").html(html)
},onFlaggableEventsResponse:function(response){if(response&&response.success){this.cover.hide();this.setEvents(response.events)
}else{this.onFlaggableEventsResponseError(response)}},onFlaggableEventsResponseError:function(response){this.cover.hide();
var msg=_t_("js.common_for_all.error_occured");if(response&&response.error&&response.error.message){msg=response.error.message
}dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:msg})}})})();
(function(){eval(ustream.namespace);ustream.classes.ContentToggle=new Class({options:{toggleSelector:".moreToggle",contentSelector:".moreContent",moreLabel:_t_("js.v3.add_more_less.more"),lessLabel:_t_("js.v3.add_more_less.less"),dataKey:"moreContent"},initialize:function(options){this.options=merge(this.options,options||{});
$(document.body).click(eBind(this.onToggleClick,this))},onToggleClick:function(e){if($(e.target).is(this.options.toggleSelector)){e.stop();
var toggle=$(e.target),content=this.getContent(toggle);this.toggle(toggle,content)}},toggle:function(toggle,content){content.toggleClass("din");
toggle.html(content.hasClass("din")?this.options.moreLabel:this.options.lessLabel)},getContent:function(toggle){var content;
if(!$.data(toggle,this.options.dataKey)){content=toggle.siblings(this.options.contentSelector);$.data(toggle,this.options.dataKey,content)
}else{content=$.data(toggle,this.options.dataKey)}return content}})})();
(function(){eval(ustream.namespace);ustream.classes.PpvItemDownloader=new Class({initialize:function(){this.ppvEvents={};
captureEvent(ustream.events.TICKETPURCHASEINIT,eBind(this.getPpvEventData,this));captureEvent(ustream.events.TICKETPURCHASEINITLONG,eBind(this.getPpvEventData,this));
captureEvent(ustream.events.TICKETENTERCODE,eBind(this.getPpvEventData,this));captureEvent(ustream.events.LOGINSUCCESS,bind(this.onLogin,this));
captureEvent(ustream.events.TICKETBOUND,eBind(this.onTicketBound,this))},itemData:{},onTicketBound:function(e){var itemId=e.eventData.ppvItemId;
if(this.itemData[itemId]){this.itemData[itemId].isTicketBound=true}},onLogin:function(e){if(e.eventData.itemDownloadEvent){this.getPpvEventData(e.eventData.itemDownloadEvent,true)
}},getPpvEventData:function(e,afterLogin){if(ustream.vars.loggedIn){this._getPpvEventData(e,afterLogin)
}else{var data={itemDownloadEvent:e};if(typeof ustream.classes.LoginSignup!=="undefined"){dispatchEvent(ustream.events.REQUIRELOGINSIGNUP,data)
}else{dispatchEvent(ustream.events.REQUIRELOGIN,data)}}},_getPpvEventData:function(e,afterLogin){var itemId=e.eventData.eventId||e.eventData.mediaId,type=e.eventData.eventId?"event":"video",ppvEvent=this.ppvEvents[type+itemId],vars=ustream.vars,isVod=(vars.pageId==="Video_Video")?true:false,onResponse,loadingWindow;
e.eventData.ppvItemId=itemId;if(itemId){if(!ppvEvent){this.itemData[itemId]={};this.itemData[itemId].isTicketBound=false;
if(!this.loadingWindow){this.loadingWindow=new ustream.classes.LoadingWindow()}loadingWindow=this.loadingWindow;
onResponse=bind(function(response){if(response.success){var ppv=response.ppv,selling=isVod?true:ppv.selling;
ppv.hasEventVod=!!response.hasEventVod;this.ppvEvents[type+itemId]=ppv;this.initPpv(ppv,afterLogin);e.eventData.purchaseFlowMode=this.getPurchaseFlowMode(response);
this.itemData[itemId].purchaseFlowMode=e.eventData.purchaseFlowMode;this.dispatchRealEvent(e,selling);
loadingWindow.close()}else{loadingWindow.close();this.onError(response)}},this);loadingWindow.open();
$.getJSONE(stringUtils.urlSubst(vars.ppvItemDataUrl,{channelId:vars.channelId,itemId:itemId,itemType:type}),onResponse)
}else{this.dispatchRealEvent(e)}}},onError:function(response){var msg=response&&response.error&&response.error.message?response.error.message:_t_("js.common_for_all.error_occured"),alertHandler;
if(response.redirectUrl){alertHandler=new ustream.classes.AlertHandler({dialogOptions:{hideTitle:true},dialogData:{text:msg,btnCloseText:_t_("js.ppv.itemdownloader.alert_close")},onClose:function(){document.location.href=response.redirectUrl
}});alertHandler.open()}else{dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:msg})}},initPpv:function(ppv,afterLogin){var purchase=new ustream.classes.PpvTicketPurchase(ppv,afterLogin),entercode=new ustream.classes.PpvTicketValidation(ppv)
},onTicketPurchaseInit:function(e,selling){var event,ed=e.eventData,itemId=ed.eventId,isTicketBound=false,purchaseFlowMode="extended";
if(e.type===ustream.events.TICKETPURCHASEINITLONG){purchaseFlowMode="extended"}else{if(e.type===ustream.events.TICKETPURCHASEINIT){purchaseFlowMode="minimal"
}}if(this.itemData[itemId]){isTicketBound=this.itemData[itemId].isTicketBound;purchaseFlowMode=this.itemData[itemId].purchaseFlowMode;
if(isTicketBound&&purchaseFlowMode=="minimal"){purchaseFlowMode=ed.purchaseFlowMode="extended"}}if(!ed.purchaseFlowMode){ed.purchaseFlowMode=purchaseFlowMode
}if(typeof selling!=="boolean"||selling===true){switch(ed.purchaseFlowMode){case"extended":event=ustream.events.TICKETPURCHASEBEGINEXTENDED;
break;case"minimal":event=ustream.events.TICKETPURCHASEBEGINMINIMAL;break;case"confirm":event=ustream.events.TICKETPURCHASEBEGINCONFIRM;
break}dispatchEvent(event,e.eventData)}else{this.onError({error:{message:_t_("js.v3.ppv_item_downloader.event_selling_is_off")}})
}},dispatchRealEvent:function(e,selling){switch(e.type){case ustream.events.TICKETPURCHASEINIT:case ustream.events.TICKETPURCHASEINITLONG:this.onTicketPurchaseInit(e,selling);
break;case ustream.events.TICKETENTERCODE:dispatchEvent(ustream.events.TICKETENTERCODESTART,e.eventData);
break}},getPurchaseFlowMode:function(response){var hasBoundTicket=response.ppv.hasBoundTicket,isEventFree=response.ppv.isEventFree,isChannelOnAir=response.ppv.isChannelOnAir,output="extended";
if(!hasBoundTicket&&isChannelOnAir){output=isEventFree?"confirm":"minimal"}return output}})}());
(function(){eval(ustream.namespace);ustream.classes.SubscriptionInit=new Class({initialize:function(){captureEvent(ustream.events.SUBSCRIPTIONINIT,eBind(this.subscriptionInit,this));
captureEvent(ustream.events.SUBSCRIPTIONCOMPLETE,eBind(this.subscripionComplete,this));if(ustream.vars.subscribe){dispatchEvent(ustream.events.SUBSCRIPTIONINIT)
}captureEvent(ustream.events.FLASHPPVCREATEREADY,bind(this.notifyFlash,this));if(ustream.vars.loggedIn){this.notifyFlash()
}else{captureEvent(ustream.events.LOGINSUCCESS,eBind(this.onLogin,this));this.notifyFlash()}},subscriptionInit:function(e){var uvars=ustream.vars;
if($("#SubscriptionDialog").length<1){$('<div id="SubscriptionDialog"><iframe frameborder="0" border="0" scrolling="no" id="SubscriptionFrame"src="about:blank" /></div>').dialog({title:uvars.channelTitle,width:758,height:540,modal:true,close:bind(this.onDialogClose,this)})
}this.subscriptionDialog=$("#SubscriptionDialog");this.subscriptionDialog.find("iframe").load(function(){this.style.visibility="visible"
}).attr("src",stringUtils.urlSubst(uvars.subscriptionUrl,{channelId:uvars.channelId}));this.subscriptionDialog.dialog("open")
},notifyFlash:function(){if(ustream.vars.flashPpvCreateReady){if(ustream.vars.isUserSubscribed){dispatchEvent(ustream.events.USERSUBSCRIBED)
}else{dispatchEvent(ustream.events.USERNOTSUBSCRIBED)}}},checkLogin:function(){if(!ustream.vars.loggedIn){$.ajax({url:ustream.vars.getUserVariablesUrl,success:function(response){if(response&&response.success){ustream.vars=merge(ustream.vars,response.exposedVariables);
dispatchEvent(ustream.events.LOGINSUCCESS,response.exposedVariables)}}})}else{this.notifyFlash()}},onLogin:function(){if(ustream.vars.isUserSubscribed){this.notifyFlash()
}else{if(ustream.vars.checkSubscriptionUrl){$.ajax({url:ustream.vars.checkSubscriptionUrl,success:bind(function(response){if(response.success){ustream.vars.isUserSubscribed=true;
this.notifyFlash()}},this)})}}},subscripionComplete:function(e){if(this.subscriptionDialog){this.subscriptionDialog.dialog("close")
}else{this.onDialogClose()}},onDialogClose:function(){this.checkLogin()}})}());
(function(){eval(ustream.namespace);ustream.classes.SimpleTextAccordion=new Class({container:null,accordionItems:null,options:{showOnlyOne:true},initialize:function(options){this.options=merge(this.options,options||{});
this.container=$(this.options.container);this.accordionItems=this.container.find("dd");if(this.container.length){this.container.click(eBind(this.onTitleClick,this))
}return false},onTitleClick:function(e){e.stop();var target=$(e.target).closest("a"),content=target.parent("dt").next("dd"),active=this.accordionItems.filter(".active"),contentActive=content.hasClass("active");
if(this.options.showOnlyOne){this.hide(active)}if(!contentActive){this.show(content)}else{this.hide(content)
}},hide:function(el){el.removeClass("active").slideUp(200)},show:function(el){el.addClass("active").slideDown(200)
}})})();
(function(){eval(ustream.namespace);ustream.classes.App=ustream.classes.CommonPage.extend({pChannelDetails:function(){var countDown,featuredContentList;
this.isPPV=ustream.vars.isPPV;if(ustream.vars.authPage){this.resizePage();$(window).resize(this.resizePage);
return}ustream.external.showCbsCompanion=this.showCbsCompanion;this.addViewer();new ustream.classes.PrettyDateUpdater();
forEach($.makeArray($("input.followUserEventHeader")),function(elem){var follow=new ustream.classes.FollowUser(elem,{_html:ustream.templates.followUserEventHeader,_skipLoginCheck:true})
});new ustream.classes.AddMoreLess();captureEvent(ustream.events.SOCIALPOPOUT,function(){$("#SocialBoxExpand").addClass("disabled")
});captureEvent(ustream.events.SOCIALRESTORE,function(){$("#SocialBoxExpand").removeClass("disabled")
});$("#SocialBoxExpand").click(eBind(this.toggleExpandButton,this));if(this.isPPV){this.eventUnits=[];
$(".simpleEventList").each(bind(function(i,item){this.eventUnits.push(new ustream.classes.ChannelEvents(item.id))
},this))}this.addRecommendedLive();this.addUpcomingEvents();this.addVideoList("#ChannelVideoList");this.addVideoList("#ChannelHighlightList");
featuredContentList=new ustream.classes.ScrollPager(".rightCol_330 .featuredContent",{items:".content li",buttons:".pagerSteps a",loop:true,autoScroll:true,lazyLoadImages:true});
countDown=new ustream.classes.Countdown();captureEvent(ustream.events.FOLLOWABLEREADY,eBind(function(e){$(".eventActionBar[data-itemid="+e.eventData.item+"],.contentActionBar[data-itemid="+e.eventData.item+"]").animate({opacity:1,height:31})
}));forEach($A($("input.followNotableUser")),function(elem){follow=new ustream.classes.FollowNotableUser(elem)
});forEach($.makeArray($("input.followUserEventHeader")),function(elem){follow=new ustream.classes.FollowUser(elem,{_html:ustream.templates.followUserEventHeader,_skipLoginCheck:true})
});this.tabs=new ustream.classes.TabbedTitleBox("#tabbedTitleBoxDemo");new ustream.classes.StaticMoreLess("#ShowInfoTab",{toggler:".moreLink",moreContent:".moreInfo",lessContent:".lessInfo",moreTxt:_t_("js.v4.channel_details.info_more"),lessTxt:_t_("js.v4.channel_details.info_less")});
this.addEmbedCodes();var followUserChannels=[],subscription;this.keepAlive();this.followUserChannels=followUserChannels;
$("#PopoutChannelVideo").click(eBind(this.openVideoPopup,this));captureEvent(ustream.events.CHANNELONLINE,bind(this.onChannelOnline,this));
captureEvent(ustream.events.CHANNELOFFLINE,bind(this.onChannelOffline,this));new ustream.classes.FlagContent({form:"#VideoFlag"});
captureEvent(ustream.events.LOGINSUCCESS,eBind(this.onAjaxLogin,this));captureEvent(ustream.events.CHANNELONLINE,eBind(function(){$("#SocialBoxBannerComment").addClass("hasComment")
},this));captureEvent(ustream.events.CHANNELOFFLINE,eBind(function(){$("#SocialBoxBannerComment").removeClass("hasComment")
},this));new ustream.classes.ContentToggle();this.initPpv();if(ustream.vars.isSubscriptionEnabled){subscription=new ustream.classes.SubscriptionInit()
}if(ustream.classes.PmOverlay){var pmOverlay=new ustream.classes.PmOverlay()}$(".viewAll").click(function(){ustream.track("/eventtrack/channel/viewall")
})},initPpv:function(){if(this.isPPV){var events=ustream.events,signup,downloader,paypal;if(typeof ustream.classes.LoginSignup!=="undefined"){signup=new ustream.classes.LoginSignup({tplData:{secondaryTermId:"Signup_PpvTerms_Agree",secondaryTermLink:_t_("js.v3.login_signup_dialog.signup_viewer_terms",{termsLink:"/terms-ppv-popup"})}})
}paypal=new ustream.classes.PayPalWrapper({channelId:ustream.vars.channelId});this.showTicketPurchase();
downloader=new ustream.classes.PpvItemDownloader();if(ustream.vars.buyTicket){dispatchEvent(events.TICKETPURCHASEINITLONG,{eventId:ustream.vars.buyTicket})
}else{if(ustream.vars.enterTicket){dispatchEvent(events.TICKETENTERCODE,{eventId:ustream.vars.enterTicket})
}}captureEvent(events.LOGINSUCCESS,eBind(this.checkHasTicket,this));captureEvent(events.TICKETBOUND,eBind(this.notifyFlashAboutHasTicket,this));
captureEvent(events.FLASHPPVCREATEREADY,bind(this.notifyFlashAboutHasTicket,this));captureEvent(events.TICKETBOUND,bind(this.updateCrowdButton,this));
captureEvent(events.TICKETPURCHASESUCCESS,eBind(this.updateCrowdButton,this))}},updateCrowdButton:function(){if(this.followUserChannels){forEach(this.followUserChannels,function(item){if(item.target.find(".wrapCold").length>0){item.checkUserInCrowd()
}})}},checkHasTicket:function(){$.get(ustream.vars.checkActiveEventTicket,bind(function(response){if(response.success){ustream.vars.hasTicketForActiveEvent=response.hasTicketForActiveEvent;
dispatchEvent(ustream.events.TICKETBOUND)}},this))},notifyFlashAboutHasTicket:function(){if(ustream.vars.flashPpvCreateReady){if(ustream.vars.hasTicketForActiveEvent){dispatchEvent(ustream.events.USERHASTICKET)
}else{dispatchEvent(ustream.events.USERHASNOTICKET)}}},showTicketPurchase:function(){$("#ChannelEvents").delegate(".ppvEvent .buy > button","click",function(e){dispatchEvent(ustream.events.TICKETPURCHASEINITLONG,{eventId:$(e.target).attr("rel")})
})},openVideoPopup:function(e){e.stop();var el=$(e.target).closest("a"),popup=window.open(el.attr("href"),"ChannelVideoPopup","width=866,height=662,scrollbars=no,resizable=no");
if(this.viewer){this.viewer.stop()}},onChannelPopupChatClose:function(){this.socialStreamWithChat.closeSocialPopup(null,true)
},pChannelPopupChat:function(){this.isPPV=ustream.vars.isPPV;var hasBannerDom=!!$(".bottomBanner").length,hiddenFooter=false;
if(!hasBannerDom){hiddenFooter=true}$(".popout, .popout b").click(function(){window.close();return false
});this._addUnloadCallback("onChannelPopupChatClose");this.socialStreamWithChat=new ustream.classes.SocialStreamWithChat({inPopout:true});
if(BOM.ie){$(window).resize(function(){var footerHeight=hiddenFooter?1:76,headerHeight=35,contentHeight=$(document.body).height()-footerHeight-headerHeight;
$("#SocialBox, #SocialBox object, #SocialBox iframe").height(contentHeight+"px")}).resize()}if(hasBannerDom){$(window).resize(function(){if($(document.body).height()<270){$(".footer").parent().hide();
hiddenFooter=true}else{$(".footer").parent().show();hiddenFooter=false}}).resize()}},addViewer:function(){if(ustream.vars.isUfcViewer!="1"){var viewer=ustream.vars.viewer;
viewer.flashvars.enablejsapi=true;if(viewer){var html5viewer=new ustream.classes.Html5Viewer("v2",viewer);
if(!html5viewer.supported){this.viewer=new ustream.classes.FlashViewer("v2",viewer)}else{html5viewer.create()
}}}},addEmbedCodes:function(){new ustream.classes.CopyEmbedCode({container:"#ChannelEmbedCode",callbackParam:"#EmbedCallbackMessage_Viewer"});
new ustream.classes.CopyEmbedCode({container:"#ChannelSocialStreamEmbedCode",callbackParam:"#EmbedCallbackMessage_SocialStream"});
new ustream.classes.CopyEmbedCode({container:"#ChannelChatEmbedCode",callbackParam:"#EmbedCallbackMessage_Chat"});
if($("#CombinedFullSizeEmbedCode").length){new ustream.classes.CopyEmbedCode({container:"#CombinedFullSizeEmbedCode",callbackParam:"#EmbedCallbackMessage_Combined-full-size"})
}if($("#CombinedSmallEmbedCode").length){new ustream.classes.CopyEmbedCode({container:"#CombinedSmallEmbedCode",callbackParam:"#EmbedCallbackMessage_Combined-small"})
}},addUpcomingEvents:function(){var uncomingEventsList=new ustream.classes.ScrollPager("#ChannelEventsV4",{items:".content ul",buttons:".pagerSteps a",loop:true})
},pChannelPopup:function(){this.isPPV=ustream.vars.isPPV;this.addViewer();var innerWidth=$(window).width(),innerHeight=$(window).height();
$("#flashWrapper, #adaptvDiv, #channelFlashContent, #channelFlashContent object").css({width:innerWidth,height:innerHeight-90});
this._addUnloadCallback("channelPopupClose");$(window).resize(function(){var innerWidth=$(window).width();
var innerHeight=$(window).height();$("#flashWrapper, #adaptvDiv, #channelFlashContent, #channelFlashContent object").css({width:innerWidth,height:innerHeight-90})
});captureEvent(ustream.events.SUBSCRIPTIONCOMPLETE,bind(this.onPopupSubscriptionComplete,this));new ustream.classes.SubscriptionInit();
this.initPpv()},pChannelEmbed:function(){this.isPPV=ustream.vars.isPPV;this.addViewer();var ad=false,subscription,resizeFlash;
resizeFlash=function(){var innerWidth=$(window).width(),innerHeight=$(window).height();$("#flashWrapper,#adaptvDiv,#channelFlashContent,#channelFlashContent object").css({width:innerWidth,height:innerHeight+(ad?-90:0)})
};$(window).resize(resizeFlash);resizeFlash();subscription=new ustream.classes.SubscriptionInit();this.initPpv()
},onPopupSubscriptionComplete:function(){try{if(window.opener&&window.opener.ustream){window.opener.ustream.events.dispatch(window.top.ustream.events.SUBSCRIPTIONCOMPLETE)
}}catch(e){$.console.log("can not access to opener",e)}},channelPopupClose:function(){if(this.viewer){this.viewer.play()
}},addRecommendedLive:function(){var recommendedLiveList=new ustream.classes.ScrollPager("#RecommendedLive",{items:".content ul",buttons:".pagerSteps a",loop:true,autoScroll:true,hidePagerPages:true,lazyLoadImages:true})
},addVideoList:function(container){var videoListPager=new ustream.classes.ScrollPager(container,{items:".content .recordedShowThumbsV4",buttons:".pagerSteps a",loop:true,lazyLoadImages:true})
},toggleExpandButton:function(e){e.stop();var target=$(e.target);if(target.hasClass("disabled")){return
}if(target.hasClass("expand")){target.text("Less").removeClass("expand").addClass("decrease");$("#SocialBox iframe").css({height:"700px"})
}else{if(target.hasClass("decrease")){target.text("More").removeClass("decrease").addClass("expand");
$("#SocialBox iframe").css({height:"430px"})}}},onChannelOnline:function(){var eventDate=$("#EventHeader .eventDate"),eventPic=$("#EventHeader .eventPicture"),ts=eventDate.find(".prettyDate").attr("data-timestamp"),justNow=false;
if(!ts){ts=(new Date()).getTime();justNow=true}eventDate.html(_t_("js.v3.channel_details.broadcast_started")+' <span data-timestamp="'+ts+'" class="time prettyDate">'+((justNow)?_t_("js.v3.channel_details.just_now"):stringUtils.prettyDate(ts*1))+"</span>").find("span").data("data-timestamp",ts);
if(eventPic.find(".livebadgeLeft").size()>0){eventPic.find(".livebadgeLeft").show()}else{eventPic.append('<strong class="livebadgeLeft"></strong>')
}},onChannelOffline:function(){var eventDate=$("#EventHeader .eventDate"),eventPic=$("#EventHeader .eventPicture");
eventDate.html(_t_("js.v3.channel_details.channel_is_offline"));eventPic.find(".livebadgeLeft").remove()
},onAjaxLogin:function(e){var benefits;if(this.isPPV&&ustream.vars.upcomingEvents&&ustream.vars.upcomingEvents.length&&$("#v2").length){var upcomingEvents=ustream.vars.upcomingEvents;
for(var i=0,il=upcomingEvents.length;i<il;i++){if(upcomingEvents[i].isSelling&&upcomingEvents[i].hasTicket){this.viewer.setHasTicket();
break}}}$.getJSON(ustream.vars.onLoginRefreshUrl,false,bind(this.updateVideoBoxes,this));if(this.isPPV&e.eventData&&e.eventData.isOwner){this.hideEventButtons()
}benefits=ustream.vars.userBenefits||{};if(benefits.adfreeview){$(".banner, .hideAdMessage").hide()}},hideEventButtons:function(){var eventsLength=this.eventUnits.length;
for(iEvents=0;iEvents<eventsLength;iEvents++){var actEvent=this.eventUnits[iEvents],pager=actEvent.pager;
pager.refresh()}},updateVideoBoxes:function(response){var videosCont="#ChannelVideoList",highlightsCont="#ChannelHighlightList",videosCl,highlightsCl;
if(!response.success){return}if(response.videos.count){videosCl=new ustream.classes.CoverLayer(videosCont);
videosCl.show();this.updateVideoBox(response.videos.elements,videosCont,videosCl,true)}if(response.highlights.count){highlightsCl=new ustream.classes.CoverLayer(highlightsCont);
highlightsCl.show();this.updateVideoBox(response.highlights.elements,highlightsCont,highlightsCl,false)
}},updateVideoBox:function(response,container,cl,showBadges){var videolistTpl=new ustream.classes.SimpleTpl(ustream.templates.thumbLister);
$(container).find(".scrollPagerWrp").html(videolistTpl.run({videos:response,pageSize:ustream.vars.thumblisterPageSize,emptyMsg:ustream.vars.thumblisterEmptyMsg,showBadges:showBadges})).end().find(".title .scrollPager").remove();
this.addVideoList(container);cl.hide()},showCbsCompanion:function(adSrc,adHref,adWidth,adHeight){if($("div.largeRectBanner").length){$("div.largeRectBanner").eq(0).empty().html('<div id="PageRectangle" class="banner"><a href="'+adHref+'" style="display: block; width: '+adWidth+"px; height: "+adHeight+'px; overflow: hidden;" target="_blank"><img src="'+adSrc+'" alt="Advertisement" width="'+adWidth+'" height="'+adHeight+'" style="display: block;" /></a></div>')
}else{$("#recommendedLive").before('<div class="largeRectBanner"><div id="PageRectangle" class="banner"><a href="'+adHref+'" style="display: block; width: '+adWidth+"px; height: "+adHeight+'px; overflow: hidden;" target="_blank"><img src="'+adSrc+'" alt="Advertisement" width="'+adWidth+'" height="'+adHeight+'" style="display: block;" /></a></div></div>')
}},_addUnloadCallback:function(cbFuncStr){var cb=function(){var wo=window.opener;if(wo&&wo.ustream&&wo.ustream.app&&wo.ustream.app[cbFuncStr]){wo.ustream.app[cbFuncStr]()
}};if(BOM.ie){window.onunload=cb}else{$(window).unload(cb)}},resizePage:function(){if($(window).height()>430){$("#MainWrapper, #ContentWrapper").css({height:$(window).height()+"px"});
$("#Footer").css({position:"absolute",bottom:0})}},keepAlive:function(){var timerValue=ustream.vars.sessionTimeOut,keepAliveCounter=timerValue*1000-15000;
ustream.timer.add(keepAliveCounter,bind(function(){$.get(ustream.vars.keepAliveUrl,{},nullFunc)},this),"KeepAlive")
},pEmbedFullSizeCombined:function(){this.embedCombined()},pEmbedSmallCombined:function(){this.embedCombined()
},embedCombined:function(){this.addViewer();$("#PopoutChannelVideo").click(eBind(this.openVideoPopup,this));
captureEvent(ustream.events.CHANNELONLINE,bind(this.onChannelOnline,this));captureEvent(ustream.events.CHANNELOFFLINE,bind(this.onChannelOffline,this));
this.addEmbedCodes()}})})();
ustream.templates.premiumMembership='<div id="PremiumMembershipDialog" data-template="premiumMembership"><div id="PmIframeLoading" class="secureDialogLoading"></div><div id="PmIframeWrap"></div></div>';
(function(){eval(ustream.namespace);ustream.classes.PmOverlay=new Class({_exclusive:true,debug:false,options:{width:988,height:650,pmUrl:ustream.vars.pmOverlayUrl},initialize:function(options){this.options=$.extend(true,this.options,options||{});
if(!this.options.pmUrl){$.console.log("No pmOverlayUrl!");this.options.pmUrl="/premium-membership/prepare-inline"
}captureEvent(ustream.events.PMINIT,eBind(this.onStart,this));this._setDialog();this._hijackHideThisLinks()
},_hijackHideThisLinks:function(){$(".hideAdMessage > a").click(function(e){e.preventDefault();window.scrollTo(0,0);
ustream.events.dispatch(ustream.events.PMINIT)})},_setDialog:function(){this.template=new ustream.classes.SimpleTpl(ustream.templates.premiumMembership);
(this.dialogEl=$(this.template.run({url:this.options.pmUrl+"?r="+Math.random()}))).dialog({title:_t_("www.js.premium_membership.overlay_title"),width:this.options.width,height:this.options.height,autoOpen:false,modal:true,close:eBind(this.onDialogClose,this)})
},onDialogClose:function(e){if(ustream.vars.loggedIn){return}var ldUrl=ustream.vars.getLoginDataUrl;if(!ldUrl){$.console.log("No getLoginDataUrl!")
}$.getJSONE(ldUrl,"POST",bind(function(preSucc,resp){if(!resp.success){return false}if(resp.exposedVariables){$.extend(true,ustream.vars,resp.exposedVariables)
}ustream.events.dispatch(ustream.events.LOGINSUCCESS,resp.exposedVariables)},this,true))},onStart:function(){$("#PmIframeLoading").show();
$("#PmIframeWrap").html("<iframe id='PremiumMembershipFrame' src='"+this.options.pmUrl+"?r="+Math.random()+"' frameborder='0' scrolling='no'></iframe>");
$("#PremiumMembershipFrame").css({display:"none",overflow:"hidden",width:this.options.width-10,height:this.options.height-45});
var iframe=$("#PremiumMembershipFrame").get(0);if(iframe.attachEvent){iframe.attachEvent("onload",bind(this.onIframeLoad,this))
}else{iframe.onload=bind(this.onIframeLoad,this)}this.dialogEl.dialog("open")},onIframeLoad:function(e){if(!this.dialogEl.dialog("isOpen")){return
}$("#PmIframeLoading").hide();$("#PremiumMembershipFrame").show()}})}());

