if(!window.ustream){window.ustream={}}if(!ustream.labels){ustream.labels={}}(function(l){l["js.v3.follow_user.follow_tooltip"]="Follow this channel to be notified when it's live!";l["js.v3.follow_user.join_crowd"]="Join Crowd";l["js.v3.manageshow_videos.ppv_badge"]="PPV";l["www.manageshow_videos_page.subscription_only_badge"]="Subscription Only";l["www.manageshow_videos_page.subscription_free_badge"]="Now Free";l["js.v3.recorded_video_list.total"]="Total Views";l["js.v3.recorded_video_list.length"]="Length";l["js.v3.comments.comment_confirm_deletion_title"]="Confirm";l["js.v3.comments.comment_confirm_deletion"]="Are you sure?";l["js.common_for_all.button_cancel"]="Cancel";l["js.v3.comments.button_remove_from_list"]="Remove from List";l["js.v3.comments.record_video_comment"]="Record Video Comment";l["js.v3.comments.ban"]="Ban";l["js.v3.comments.unban"]="Unban";l["js.v3.comments.comment"]="Comment";l["js.v3.comments.delete"]="Delete";l["js.v3.comments.approve"]="Approve";l["js.common_for_all.button_submit"]="Submit";l["js.v3.comments.comments"]="Comment(s)";l["js.v3.comments.video_comment"]="Video Comment";l["js.v3.video_comment_channels.use_this_channel"]="Use this channel for all my video comments";l["js.v3.video_comment_recorder.add_your_comment"]="Add your comment";l["js.v3.video_comment_recorder.record"]="Record";l["js.v3.video_comment_recorder.record_stop"]="Stop Record";l["js.v3.video_comment_recorder.preview"]="Preview";l["js.v3.video_comment_recorder.rerecord"]="Re-record";l["js.v3.video_comment_recorder.comment_save"]="Comment and Save";l["js.v3.video_comment_recorder.save"]="Save";l["js.v3.video_comment_recorder.settings"]="Settings";l["js.v3.highlight.seek_title"]="Drag sliders to select start &amp; stop";l["js.v3.highlight.hilite_desc"]="Describe what happened!";l["js.v3.highlight.btn_preview"]="Preview";l["js.v3.highlight.btn_stop"]="Stop";l["js.v3.highlight.btn_save"]="Save";l["js.v3.highlight.or"]="or";l["js.v3.highlight.btn_cancel"]="Cancel";l["js.v3.highlight.succ_msg"]="You've created a highlight!";l["js.v3.highlight.share_link"]="Share the link:";l["js.v3.highlight.btn_copy"]="Copy";l["js.v3.highlight.btn_finish"]="Finish";l["js.v3.highlight.embed_copied_message"]="Copied!";l["js.v3.video_comment_recorder.need_channel"]="<p>You must have at least 1 channel in order to record video comments.<\/p><p>Go, <a href='#dashboardUrl#'>create one<\/a>!<\/p>";l["js.ppv.login_signup_dialog.signup_title"]="Signup";l["js.v3.login_signup_dialog.username"]="Username";l["js.v3.login_signup_dialog.email"]="Email";l["js.v3.login_signup_dialog.password"]="Password";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.terms_required_v2"]="You have to accept our Terms of Service and Privacy Policy to use our service.";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.viewer_terms_required"]="You have to accept our Viewer Terms of Service to use our service.";l["js.v3.login_signup_dialog.action_signup"]="Signup";l["js.ppv.login_signup_dialog.already.have.an.account"]="Already have an account? Login Here!";l["js.ppv.login_signup_dialog.login_title"]="Login";l["js.v3.login_dialog.tab_ustream"]="Ustream";l["js.v3.login_dialog.tab_facebook"]="Facebook";l["js.v3.login_dialog.label_username"]="Username";l["js.v3.login_dialog.error_username"]="Please enter your username.";l["js.v3.login_dialog.label_password"]="Password";l["js.v3.login_dialog.error_password"]="Please type in your password.";l["js.v3.login_dialog.action_login"]="Login";l["js.v3.login_dialog.label_remember"]="Remember me";l["js.v3.login_dialog.forgot_user"]="Forgot Username";l["js.v3.login_dialog.forgot_pass"]="Forgot Password";l["js.v3.login_dialog.facebook_text"]="You can connect to Ustream with your Facebook account to login.";l["js.v3.login_dialog.action_facebook"]="Connect with Facebook";l["js.v3.login_dialog.sign_up_now"]="No account? Sign Up Now!";l["www.upcomingevents_widget.show_less_codes"]="show less";l["www.upcomingevents_widget.show_more_codes"]="show more";l["www.upcomingevents_widget.pay_per_view"]="Pay Per View";l["www.upcomingevents_widget.attending_ticket_past"]="attended";l["www.upcomingevents_widget.attending_ticket"]="attending";l["www.upcomingevents_widget.add_ticket"]="Redeem Ticket";l["www.upcomingevents_widget.buy_ticket_button_title_already_have"]="You have already purchased access to this event.";l["www.upcomingevents_widget.buy_ticket"]="Buy Ticket";l["js.v3.channel_events.subscriber_list_title_past"]="People who attended this event";l["js.v3.channel_events.subscriber_list_title"]="People attending this event";l["js.v3.highlight_creator.open_error"]="Sorry, but this video is too short for tagging, please use 10 seconds or longer videos!";l["js.v3.highlight_creator.missing_description"]="Please enter a description for this highlight.";l["js.v3.flash_recorder_lite.already_broadcasting"]="You're already broadcasting on Ustream!";l["js.v3.flash_recorder_lite.not_logged_in"]="You are not logged in!";l["js.v3.video_comment_recorder.button_next"]="Next \u00bb";l["js.v3.video_comment_recorder.button_cancel"]="Cancel";l["js.v3.video_comment_recorder.select_channel_title"]="Select channel to record your video comment";l["js.v3.video_comment_recorder.no_channel_error"]="No channels! You must have at least 1 channel in order to record video comments.";l["js.v3.video_comment_recorder.recorder_title"]="Record your video comment";l["js.v3.video_comment_recorder.title_not_set_error"]="Enter comment please!";l["js.v3.comments.you_must_be_logged_in"]="You must be logged in to add a comment";l["js.v3.flag_content.report_sent"]="Your request has been submitted.";l["js.v3.flag_content.choose"]="Choose";l["js.v3.flag_content.select_an_event"]="Select an event";l["js.common_for_all.error_occured"]="An error occured!";l["js.v3.rating.already_rated"]="This highlight is already rated by you.";l["js.v3.rating.one_rated"]="One rated";l["js.v3.rating.thanks_for_rating"]="Thanks for rating! ";l["js.v3.add_more_less.more"]="more";l["js.v3.add_more_less.less"]="less";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.v3.subscriptioninit.loadertext"]="Please wait while the secure page loads";l["js.v3.upcomingshows.buy_ticket_button_title_already_have"]="You have already purchased access to this event.";l["js.v3.upcomingshows.subscribe_button_title_already_have"]="You already have an active subscription to this channel!";l["js.v4.channel_details.info_more"]="More";l["js.v4.channel_details.info_less"]="Less";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.recorded.pager_counter"]="#showFrom#-#showTo# of #displayedRows#";l["js.common_for_all.unknown_error"]="Error!";})(ustream.labels);
if(!window.ustream){window.ustream={}}if(!window.ustream.__modules){ustream.__modules=[]}ustream.__modules.push("ppvTracker.js");
ustream.ppvTracker=(function(){var url="//www.ustream.tv/ajax/track/purchase.json",availableParams=["source","action","target_type","target_id"],enc=encodeURIComponent,getCustomParams=function(params){var items=[],item;
for(item in params){if(item&&params[item]&&params.hasOwnProperty(item)){items.push(item+":"+params[item])
}}return items.join(";")},getUrl=function(args){var pl=availableParams.length,param,i=0,params=[],output=[],item;
for(;i<pl;i+=1){item=availableParams[i];if(item){params.push({n:item,v:enc(args[item])})}}if(args.params){params.push({n:"params",v:getCustomParams(args.params)})
}for(i=0,pl=params.length;i<pl;i+=1){param=params[i];if(param.n&&param.v){output.push(enc(param.n)+"="+enc(param.v))
}}return url+"?"+output.join("&")},parseSarch=function(search){var items=search.split("&"),i=0,il=items.length,output={},item;
for(;i<il;i+=1){item=items[i].split("=");output[item[0]]=item[1]}return output},siteOpener="site",embedOpener="embed",unknownOpener="unknown",getOpener=function(){var opener=parseSarch(document.location.search.replace(/^\?/,"")).opener,win;
if(!opener){try{win=window;if(win.opener&&win.opener!==win&&win.opener.ustream){opener=embedOpener}else{if(win.parent&&win.parent!==win&&win.parent.ustream){opener=siteOpener
}else{opener=unknownOpener}}}catch(e){opener=unknownOpener}if(win.parent===win){opener=siteOpener}}return opener
},getReferrer=function(locIsBetter){var opener=getOpener(),referrer,win=window,parent;if(opener===embedOpener){try{parent=win.opener.document
}catch(e){}}else{try{parent=win.parent.document}catch(er){}}if(parent){referrer=locIsBetter?parent.location:parent.referrer
}return referrer},output={openers:{site:siteOpener,embed:embedOpener,unknown:unknownOpener},getReferrer:getReferrer,track:function(action,target,targetId,params,cb){var args={source:getOpener(),action:action,target_type:target,target_id:targetId,params:params},url=getUrl(args),img;
cb=cb||function(){};if(url){img=new Image();if(typeof cb==="function"){img.onload=cb;img.onerror=cb}img.src=url
}return img}};return output}());
if(window.jQuery){(function($){if($.browser.msie){try{document.execCommand("BackgroundImageCache",false,true)
}catch(e){}}$.fn.rating=function(options){if(this.length==0){return this}if(typeof arguments[0]=="string"){if(this.length>1){var args=arguments;
return this.each(function(){$.fn.rating.apply($(this),args)})}$.fn.rating[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);
return this}var options=$.extend({},$.fn.rating.options,options||{});$.fn.rating.calls++;this.not(".star-rating-applied").addClass("star-rating-applied").each(function(){var control,input=$(this);
var eid=(this.name||"unnamed-rating").replace(/\[|\]/g,"_").replace(/^\_+|\_+$/g,"");var context=$(this.form||document.body);
var raters=context.data("rating");if(!raters||raters.call!=$.fn.rating.calls){raters={count:0,call:$.fn.rating.calls}
}var rater=raters[eid];if(rater){control=rater.data("rating")}if(rater&&control){control.count++}else{control=$.extend({},options||{},($.metadata?input.metadata():($.meta?input.data():null))||{},{count:0,stars:[],inputs:[]});
control.serial=raters.count++;rater=$('<span class="star-rating-control"/>');input.before(rater);rater.addClass("rating-to-be-drawn");
if(input.prop("disabled")){control.readOnly=true}rater.append(control.cancel=$('<div class="rating-cancel"><a title="'+control.cancel+'">'+control.cancelValue+"</a></div>").mouseover(function(){$(this).rating("drain");
$(this).addClass("star-rating-hover")}).mouseout(function(){$(this).rating("draw");$(this).removeClass("star-rating-hover")
}).click(function(){$(this).rating("select")}).data("rating",control))}var star=$('<div class="star-rating rater-'+control.serial+'"><a title="'+(this.title||this.value)+'">'+this.value+"</a></div>");
rater.append(star);if(this.id){star.attr("id",this.id)}if(this.className){star.addClass(this.className)
}if(control.half){control.split=2}if(typeof control.split=="number"&&control.split>0){var stw=($.fn.width?star.width():0)||control.starWidth;
var spi=(control.count%control.split),spw=Math.floor(stw/control.split);star.width(spw).find("a").css({"margin-left":"-"+(spi*spw)+"px"})
}if(control.readOnly){star.addClass("star-rating-readonly")}else{star.addClass("star-rating-live").mouseover(function(){$(this).rating("fill");
$(this).rating("focus")}).mouseout(function(){$(this).rating("draw");$(this).rating("blur")}).click(function(){$(this).rating("select")
})}if(this.checked){control.current=star}input.hide();input.change(function(){$(this).rating("select")
});star.data("rating.input",input.data("rating.star",star));control.stars[control.stars.length]=star[0];
control.inputs[control.inputs.length]=input[0];control.rater=raters[eid]=rater;control.context=context;
input.data("rating",control);rater.data("rating",control);star.data("rating",control);context.data("rating",raters)
});$(".rating-to-be-drawn").rating("draw").removeClass("rating-to-be-drawn");return this};$.extend($.fn.rating,{calls:0,focus:function(){var control=this.data("rating");
if(!control){return this}if(!control.focus){return this}var input=$(this).data("rating.input")||$(this.tagName=="INPUT"?this:null);
if(control.focus){control.focus.apply(input[0],[input.val(),$("a",input.data("rating.star"))[0]])}},blur:function(){var control=this.data("rating");
if(!control){return this}if(!control.blur){return this}var input=$(this).data("rating.input")||$(this.tagName=="INPUT"?this:null);
if(control.blur){control.blur.apply(input[0],[input.val(),$("a",input.data("rating.star"))[0]])}},fill:function(){var control=this.data("rating");
if(!control){return this}if(control.readOnly){return}this.rating("drain");this.prevAll().andSelf().filter(".rater-"+control.serial).addClass("star-rating-hover")
},drain:function(){var control=this.data("rating");if(!control){return this}if(control.readOnly){return
}control.rater.children().filter(".rater-"+control.serial).removeClass("star-rating-on").removeClass("star-rating-hover")
},draw:function(){var control=this.data("rating");if(!control){return this}this.rating("drain");if(control.current){control.current.data("rating.input").prop("checked",true);
control.current.prevAll().andSelf().filter(".rater-"+control.serial).addClass("star-rating-on")}else{$(control.inputs).prop("checked",false)
}control.cancel[control.readOnly||control.required?"hide":"show"]();this.siblings()[control.readOnly?"addClass":"removeClass"]("star-rating-readonly")
},select:function(value,wantCallBack){var control=this.data("rating");if(!control){return this}if(control.readOnly){return
}control.current=null;if(typeof value!="undefined"){if(typeof value=="number"){return $(control.stars[value]).rating("select",undefined,wantCallBack)
}if(typeof value=="string"){$.each(control.stars,function(){if($(this).data("rating.input").val()==value){$(this).rating("select",undefined,wantCallBack)
}})}}else{control.current=this[0].tagName=="INPUT"?this.data("rating.star"):(this.is(".rater-"+control.serial)?this:null)
}this.data("rating",control);this.rating("draw");var input=$(control.current?control.current.data("rating.input"):null);
if((wantCallBack||wantCallBack==undefined)&&control.callback){control.callback.apply(input[0],[input.val(),$("a",control.current)[0]])
}},readOnly:function(toggle,disable){var control=this.data("rating");if(!control){return this}control.readOnly=toggle||toggle==undefined?true:false;
if(disable){$(control.inputs).prop("disabled",true)}else{$(control.inputs).prop("disabled",false)}this.data("rating",control);
this.rating("draw")},disable:function(){this.rating("readOnly",true,true)},enable:function(){this.rating("readOnly",false,false)
}});$.fn.rating.options={cancel:"Cancel Rating",cancelValue:"",split:0,starWidth:16};$(function(){})})(jQuery)
};
(function(){eval(ustream.namespace);ustream.classes.PrettyDateUpdater=$.klass({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))}})}})})();
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><b class="jcmbLock"></b></div><% } %>';
ustream.templates.recordedVideoList='<ul data-template="recordedVideoList"><% forEach( records,function(record){ %><li><a href="<%= record.url %>" title="<%= record.title %>" class="img"><img src="<%= record.picture %>" width="90" height="68" alt="<%= record.title %>" /></a><div><h3><a href="<%= record.url %>"><%= record.title %></a></h3><ul class="badges"><% if (record.isVod == 1 && record.isSubscription == 0) { %><li class="ppv"><%= _t_("js.v3.manageshow_videos.ppv_badge") %></li><% } else if (record.isVod == 1 && record.isSubscription == 1) { %><li class="subscription"><%= _t_("www.manageshow_videos_page.subscription_only_badge") %></li><% } else if (record.isVod == 0 && record.isSubscription == 1) { %><li class="subscriptionFree"><%= _t_("www.manageshow_videos_page.subscription_free_badge") %></li><% } %></ul><%= _t_("js.v3.recorded_video_list.total") %>: <%=record.views %> | <%= _t_("js.v3.recorded_video_list.length") %>: <%=record.length %></div></li><% }); %></ul>';
ustream.templates.commentsConfirm='<div title="<%= _t_("js.v3.comments.comment_confirm_deletion_title") %>" data-template="commentsConfirm"><div class="commentDeleteConfirm"><p><%= _t_("js.v3.comments.comment_confirm_deletion") %></p><div class="endBtns"><a href="#" class="button close"><%= _t_("js.common_for_all.button_cancel") %></a><a href="#" class="button action"><%= _t_("js.v3.comments.button_remove_from_list") %></a></div></div></div>';
ustream.templates.comments='<ul data-template="comments"> <?php foreach($records as $record) { ?> <li data-recordId="<?= $record["id"] ?>" data-userId="<?= $record["userId"] ?>" class="subHidden <?= $record["blocked"] ? "blocked" : "" ?>"> <div class="userPic"> <img src="<?= $record["userPicture"] ?>" width="60" height="45" border="0" alt="<?= $record["userName"] ?>" /> </div> <div class="comment"> <a href="<?= $record["userUrl"] ?>" class="userName"><?= $record["userName"] ?>:</a> <?= $record["comment"] ?> <div class="footer"> <?php if ($record["attach"]) { ?> <img height="45" width="60" class="videoComment jsOpenVideo" border="0" src="<?= $record["attach"]["picture"] ?>" data-url="<?= $record["attach"]["targetUrl"] ?>" data-targetId="<?= $record["attach"]["targetId"] ?>" /> <br /> <?= _t_("js.v3.comments.record_video_comment") ?> <br /> <?php } ?> <span><?= $record["dateFormated"] ?></span> <?php /*var*/ $addSeparator = false; ?> <?php if ($mode == "user") { ?> <?php if ($userId == $ownerId && $ownerId != $record["userId"]) { ?> <a href="#" class="jsBan"><?= _t_("js.v3.comments.ban") ?></a> <a href="#" class="jsUnBan"><?= _t_("js.v3.comments.unban") ?></a> <?php $addSeparator = true; ?> <?php } ?> <?php } else { ?> <a href="#" class="jsAddComment"><?= _t_("js.v3.comments.comment") ?></a> <?php $addSeparator = true; ?> <?php } ?> <?php if ($userId == $ownerId) { ?> <?php if ($addSeparator) { ?> · <?php } ?> <a href="#" class="jsDeleteComment"><?= _t_("js.v3.comments.delete") ?></a> <?php if (!$record["isVisible"]) { ?> <span>· <a href="#" class="jsApproveComment"><?= _t_("js.v3.comments.approve") ?></a> </span> <?php } ?> <?php } ?> <div class="commentForm"> <textarea></textarea> <div class="commentFormBtns"> <a href="#" class="jsSubmitComment"><?= _t_("js.common_for_all.button_submit") ?></a> or <a href="#" class="jsCancelComment"><?= _t_("js.common_for_all.button_cancel") ?></a> </div> </div> </div> <div class="subComment" style="<?= $record["commentCount"] > 0 ? "" : "display:none" ?>"> <div class="inner"> <div class="subCommentTitle link jsToggleSubComment"><b>►</b><span>▼</span><i><?= $record["commentCount"] ?></i> <?= _t_("js.v3.comments.comments") ?></div> <div class="subCommentText"><span class="loading">&nbsp;</span></div> </div> </div> </div> <div class="clb"></div> <div class="separator"></div> </li> <?php }/*foreach*/ ?> </ul>';
ustream.templates.subComment='<input type="hidden" data-template="subComment" /><?php foreach($records as $record) { ?> <div class="subCommentItem" data-recordId="<?= $record["id"] ?>"><img width="75" src="<?= $record["userPicture"] ?>" /><a class="userName link" href="<?= $record["userUrl"] ?>"><?= $record["userName"] ?>:</a> <?= $record["comment"] ?><div class="footer"><?php if ($record["attach"]) { ?> <img height="45" width="60" class="videoComment jsOpenVideo" border="0" src="<?= $record["attach"]["picture"] ?>" data-url="<?= $record["attach"]["targetUrl"] ?>"data-targetId="<?= $record["attach"]["targetId"] ?>" /> <br /> <?= _t_("js.v3.comments.video_comment") ?> <br /> <?php } ?> <span><?= $record["dateFormated"] ?></span> <?php if (ustream.vars.loggedInUserId == $ownerId) { ?> · <a href="#" class="jsDeleteSubComment">Delete</a><?php if (!$record["isVisible"]) { ?><span> · <a href="#" class="jsApproveSubComment">Approve</a></span><?php } ?><?php } ?></div><div class="clb"></div></div><?php }/*foreach*/ ?> ';
ustream.templates.videoCommentChannels='<div id="RecLiteChannel" data-template="videoCommentChannels"><select id="RecLiteChannelSelect"><% forEach(channels,function( channel ){ %><option value="<%=channel.id %>"><%=channel.name %></option><% }); %></select><br /><label for="RecLiteDefaultChannel"><input type="checkbox" id="RecLiteDefaultChannel" /> <%= _t_("js.v3.video_comment_channels.use_this_channel") %> </label></div>';
ustream.templates.videoCommentRecorder='<div id="VideoCommentRecorder" data-template="videoCommentRecorder" ><form action="" method="post"><div id="FlashRecorderWrap"><div id="FlashRecorder"></div></div><fieldset class="comment din"><label><%= _t_("js.v3.video_comment_recorder.add_your_comment") %></label><textarea id="VideoCommentText"></textarea></fieldset><ul class="tabs"><li class="controls"><span class="step1 din"><a href="#" id="RecordButton" class="button"><span class="ui-icon-red ui-icon-bullet"></span> <%= _t_("js.v3.video_comment_recorder.record") %></a></span><span class="step2 din"><a href="#" id="StopButton" class="button"><span class="ui-icon ui-icon-stop"></span> <%= _t_("js.v3.video_comment_recorder.record_stop") %></a><span class="counter">00:00</span></span><span class="step3 din"><a href="#" id="PlayButton" class="button"><span class="ui-icon ui-icon-play"></span> <%= _t_("js.v3.video_comment_recorder.preview") %></a><a href="#" id="RerecordButton" class="button"><span class="ui-icon-red ui-icon-bullet"></span> <%= _t_("js.v3.video_comment_recorder.rerecord") %></a><a href="#" id="CommentButton" class="button"><span class="ui-icon ui-icon-comment"></span> <%= _t_("js.v3.video_comment_recorder.comment_save") %></a></span><span class="step4 din"><a href="#" id="SaveButton" class="button"><span class="ui-icon-green ui-icon-circle-check"></span> <%= _t_("js.v3.video_comment_recorder.save") %></a></span></li><li><a href="#" id="RecorderSettingsToggle"><%= _t_("js.v3.video_comment_recorder.settings") %> <span></span></a></li></ul><fieldset class="controls din"><select id="RecLiteVideoSelect" rel="Camera"></select> <select id="RecLiteAudioSelect" rel="Microphone"></select></fieldset></form></div>';
ustream.templates.highlightCreator='<div id="HighlightCreator" class="step1" data-template="highlightCreator"><fieldset class="step1"><div class="seekControl"><span class="seekButtonWrapper" id="SeekFrom"><a title="" class="seekButton rwd " href="#">◄</a><span class="seekFrom">00:00</span><a title="" class="seekButton fwd " href="#">►</a></span><span class="seekTitle"><%= _t_("js.v3.highlight.seek_title") %></span><span class="seekButtonWrapper" id="SeekTo"><a title="" class="seekButton rwd " href="#">◄</a><span class="seekTo">00:00</span><a title="" class="seekButton fwd " href="#">►</a></span></div><input type="text" name="" id="HighlightDescription" class="default" value="<%= _t_("js.v3.highlight.hilite_desc") %>" title="<%= _t_("js.v3.highlight.hilite_desc") %>" /><br class="clear"/><button id="HLPreview"><span class="ui-icon ui-icon-play"></span> <%= _t_("js.v3.highlight.btn_preview") %></button> <button id="HLStop" class="din"><span class="ui-icon ui-icon-stop"></span> <%= _t_("js.v3.highlight.btn_stop") %></button> <button id="HLSave"><%= _t_("js.v3.highlight.btn_save") %></button> <%= _t_("js.v3.highlight.or") %> <a href="#" class="cancel"><%= _t_("js.v3.highlight.btn_cancel") %></a></fieldset><fieldset class="step2 nobottom embedWrap"><div><p><%= _t_("js.v3.highlight.succ_msg") %></p><a href="" target="_blank" class="highlightLink"></a><br class="clear"/><span class="share"></span><strong><%= _t_("js.v3.highlight.share_link") %></strong><input type="text" name="" id="" class="shortLink" value="" readonly="readonly" /> <a class="button" id="ShortLinkCopyUrl"><%= _t_("js.v3.highlight.btn_copy") %></a> <a class="button" id="HighlightFinish"><%= _t_("js.v3.highlight.btn_finish") %></a><div class="clipboard"></div><span class="embedCopiedMessage" id="ShortUrlCallbackMessage_Embed"><%= _t_("js.v3.highlight.embed_copied_message") %></span></div></fieldset></div>';
ustream.templates.needChannel='<div title="No channels!" data-template="needChannel"><div class="needChannel"><%= _t_("js.v3.video_comment_recorder.need_channel", {dashboardUrl: "/dashboard/"}) %></div></div>';
ustream.templates.loginSignupEmbed='<div data-template="loginSignupDialog"><div id="LoginSignupSignup"><h5><%= _t_("js.ppv.login_signup_dialog.signup_title", "Signup") %></h5><div class="tabbedTitleBoxV4"><div class="content"><form action="/ajax/signup/saveSimple.json" method="POST" class="form" id="LoginSignupForm" onsubmit="return false"><div class="inputWrap"><label for="Signup_Username"><%= _t_("js.v3.login_signup_dialog.username") %></label><br /><input type="text" id="Signup_Username" name="signup[username]" size="24" value="" /></div><div class="inputWrap evenWrap"><label for="Signup_Email"><%= _t_("js.v3.login_signup_dialog.email") %>:</label><br /><input type="text" id="Signup_Email" name="signup[email]" size="24" value="" /></div><br class="clb" /><div class="inputWrap"><label for="Signup_Password"><%= _t_("js.v3.login_signup_dialog.password") %></label><br /><input type="password" id="Signup_Password" name="signup[password]" size="24" /><br /></div><div class="inputWrap evenWrap"><label for="Signup_Verify"><%= _t_("js.v3.login_signup_dialog.retype_password") %></label><br /><input type="password" id="Signup_Verify" name="signup[passwordVerify]" title="<%= _t_("js.v3.login_signup_dialog.retype_password_required") %>" size="24" /></div><p class="checkRow"><input type="checkbox" id="Signup_Agree" name="signup[agree]" value="1" title="<%= _t_("js.v3.login_signup_dialog.terms_required_v2") %>" /><label class="grey signupAgreeLabel" for="Signup_Agree"><%= _t_("js.v3.login_signup_dialog.terms_agree_v2", {termsLink: "/terms-popup", privacyLink: "/privacy-policy-popup"}) %></label></p><% if (typeof secondaryTermId !== "undefined") { %><p class="checkRow"><input type="checkbox" id="<%= secondaryTermId %>" name="signup[vieweragree]" value="1" class="required"title="<%= _t_("js.v3.login_signup_dialog.viewer_terms_required") %>" /><label class="grey" for="<%= secondaryTermId %>"><%= secondaryTermLink %></label></p><% } else if (typeof termAccepted !== "undefined" && termAccepted) { %><input type="hidden" name="signup[vieweragree]" value="on" /><% } else { %><input type="hidden" value="1" name="signup[skipViewerAgree]" /><% } %><input type="hidden" value="" id="SignupClientIp" name="signup[client_ip]" /><p><input type="submit" class="submit major button" value="<%=_t_("js.v3.login_signup_dialog.action_signup") %>" /></p></form></div></div><button type="button" id="AlreadyHaveAnAccount"><%=_t_("js.ppv.login_signup_dialog.already.have.an.account") %></button></div><div id="LoginSignupLogin" class="din"><h5><%= _t_("js.ppv.login_signup_dialog.login_title", "Login") %></h5><input type="hidden" data-template="loginSignupDialog" /><div class="tabbedTitleBoxV4" id="LoginSignupTabs"><div class="title"><ul><li class="active"><span class="ustream"></span> <%=_t_("js.v3.login_dialog.tab_ustream") %></li><li><span class="facebook"></span> <%=_t_("js.v3.login_dialog.tab_facebook") %></li></ul></div><div class="content"><div class="tabPageContent" id="UstreamLogin"><form id="LoginForm" method="POST" action="/ajax/login.json" class="form"><p><label for="LoginUsername"><%=_t_("js.v3.login_dialog.label_username") %></label><br /><input type="text" name="username" class="text" id="LoginUsername" size="24" title="<%=_t_("js.v3.login_dialog.error_username") %>" /></p><p><label for="LoginPassword"><%=_t_("js.v3.login_dialog.label_password") %></label><br /><input type="password" name="password" class="text" id="LoginPassword" size="24" title="<%=_t_("js.v3.login_dialog.error_password") %>" /></p><p style="padding-bottom: 8px;"><input type="submit" class="submit major button bigfont" value="<%=_t_("js.v3.login_dialog.action_login") %>" /><label for="LoginRemember"><input type="checkbox" name="remember" id="LoginRemember" checked="checked" /> <%=_t_("js.v3.login_dialog.label_remember") %></label></p><p class="forgotData" style="display: block;"><a target="_blank" href="/forgot-username" title="<%=_t_("js.v3.login_dialog.forgot_user") %>"><%=_t_("js.v3.login_dialog.forgot_user") %></a> | <a target="_blank" href="/forgot-password" title="<%=_t_("js.v3.login_dialog.forgot_pass") %>"><%=_t_("js.v3.login_dialog.forgot_pass") %></a></p></form></div><div class="tabPageContent" id="FacebookLogin"><p><%=_t_("js.v3.login_dialog.facebook_text") %></p><a href="#" class="facebookLoginButton" title="<%=_t_("js.v3.login_dialog.action_facebook") %>"><img id="fb_login_image" src="<%= ustream.vars.staticUrl %>v3/images/loginbuttons/connect_light_large_long.gif" title="<%=_t_("js.v3.login_dialog.action_facebook") %>" alt="<%=_t_("js.v3.login_dialog.action_facebook") %>" /></a></div></div></div><button type="button" id="Signup"><%=_t_("js.v3.login_dialog.sign_up_now") %></button></div></div>';
(function(){eval(ustream.namespace);ustream.classes.PpvShowMoreCodes=$.klass({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.preventDefault();e.stopPropagation();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" && (typeof ustream.classes.ChannelEvents === "undefined" || ustream.classes.ChannelEvents.showAttending(event))) { %><div class="users"><%= event["formattedAttendingText"] %></div><% } %><div class="eventDescription jsAddMoreLess"><%= event["eventDescription"] %></div><em class="countdown"><%= event["dateTime"]["countDown"] %></em></div><% if (+ustream.vars.loggedInUserId !== +event.ownerId && !ustream.vars.isPpvRestricted) { %><% 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"] && !isDashboard) { %><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"] && (!(event["isAttending"] || event["hasTicket"]) || ustream.vars.pageId === "Channel_Details")) { %><div class="buy"><strong class="price"><%= event["priceFormatted"] %></strong><button class="major<%= (event["isAttending"]) ? " readonly" : "" %>" rel="<%= event["eventId"] %>"<%= (event["isAttending"]) ? " readonly=\\"readonly\\" title=\\"" + _t_("www.upcomingevents_widget.buy_ticket_button_title_already_have") + "\\"" : "" %>><%= _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=$.klass({options:{pager:null,Url:null,itemsListPath:null,pagerPath:null,rawData:null,template:ustream.templates.channelEvents,labelGroup:null,isDashboard:false},initialize:function(options){if(!options){return $.console.log("Unmanaged event lister.")
}var auid,container;if((typeof(options)==="string")&&(options)){options={autoId:options}}this.options=merge(this.options,options||{});
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();container=$("#"+this.options.autoId+" #PurchasedContentList");this.showMoreCodes=new ustream.classes.PpvShowMoreCodes({container:container});
this.showMoreCodes.managePurchasedEvents();captureEvent(ustream.events.TICKETPURCHASESUCCESS,eBind(this.onTicketPurchase,this));
captureEvent(ustream.events.TICKETBOUND,eBind(this.onTicketPurchase,this));captureEvent(ustream.events.LOGINSUCCESS,eBind(this.pager.refresh,this.pager))
},onTicketPurchase:function(){if(ustream.vars.loggedIn){this.pager.refresh()}},updatePpvButton:function(e){var args=e.eventData,itemId=null;
if(args.item&&args.item.type==="event"&&args.item.id){itemId=args.item.id}else{if(args.ppvItemId){itemId=args.ppvItemId
}}if(itemId){this.pageItemCont.find('.ppvEvent .buy > button[rel="'+itemId+'"]').toReadonly()}},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)});data.isDashboard=this.options.isDashboard;
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.preventDefault();e.stopPropagation();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(!target.hasClass("readonly")){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]}else{dispatchEvent(ustream.events.TICKETPURCHASEINIT,{eventId:eventId})
}}},this))}});ustream.classes.ChannelEvents.showAttending=function(event){var output=true,exceptions=ustream.vars.attendingExceptions,userId=event.eventUserId?+event.eventUserId:+event.userId,channelId=+event.channelId;
if(exceptions&&(userId||channelId)){if(userId){forEach(exceptions.laxUsers,function(item){if(item===userId){output=false;
return false}})}if(output&&channelId){forEach(exceptions.specialChannels,function(item){if(item===channelId){output=false;
return false}})}}return output}}());
(function(){eval(ustream.namespace);ustream.classes.TabbedSubBox=ustream.classes.TabbedTitleBox.extend({initialize:function(target,options){this.parent(target,options)
},populate:function(){this.tabLinks=this.target.find(".tabBar li");this.pages=this.target.find(".tabContent")
}})})();
(function(){eval(ustream.namespace);ustream.classes.EmbedConfigurator=$.klass({options:{sizes:{small:{width:480,height:270},medium:{width:608,height:368},large:{width:864,height:486}}},initialize:function(target,options){this.options=merge(this.options,options||{});
this.target=$(target);this.selectors=this.target.find(".embedSizes li");this.tarea=this.target.find(".embedCode");
this.tarea.click(function(){this.select()});if(this.target.find(".legacyCode").size()>0){this.legacycode=this.target.find(".legacyCode").val()
}this.embedcode=this.tarea.val();forEach(this.options.sizes,bind(function(val,key){this.selectors.filter("."+key).data("size",key).children(".size").html(val.width+" x "+val.height)
},this));this.selectors.click(eBind(this.onClick,this));this.selectors.filter(".custom").find("input").focus(eBind(this.onCustomInput,this)).blur(eBind(this.onCustomInput,this)).keydown(eBind(this.onCustomInput,this)).keyup(eBind(this.onCustomInput,this)).change(eBind(this.onCustomInput,this));
this.target.find("input[name=legacy]").change(bind(this.updateTextarea,this))},onClick:function(e){var target=$(e.target).closest("li");
target.siblings().removeClass("selected").end().addClass("selected");this.setSize(this.options.sizes[target.data("size")])
},setSize:function(dim){if(dim){this.embedcode=this.embedcode.replace(/width="(\d*)"/gi,'width="'+dim.width+'"').replace(/height="(\d*)"/gi,'height="'+dim.height+'"');
if(this.legacycode){this.legacycode=this.legacycode.replace(/width="(\d*)"/gi,'width="'+dim.width+'"').replace(/height="(\d*)"/gi,'height="'+dim.height+'"')
}this.updateTextarea()}},updateTextarea:function(){var legacy=!!this.target.find("input[name=legacy]:checked").size();
if(legacy){this.target.find(".legacyNote").show()}else{this.target.find(".legacyNote").hide()}this.tarea.val((legacy)?this.legacycode:this.embedcode)
},onCustomInput:function(e){var etype=e.type,target=$(e.target),type=target.attr("name"),other=target.closest("li").find("input").not("[name="+type+"]"),custom=this.selectors.filter(".custom"),otherval;
target.removeClass("pre");target.val(target.val().replace(/(\D*)/gi,""));if(!other.val()){other.addClass("pre")
}if(other.hasClass("pre")){if(type==="width"){otherval=Math.round(~~target.val()*(9/16))+26}else{otherval=Math.round(~~target.val()/(9/16))
}other.val(otherval)}this.setSize({width:custom.find("input[name=width]").val(),height:custom.find("input[name=height]").val()})
}})}());
(function(){eval(ustream.namespace);ustream.classes.TwitterButton=$.klass({options:{id:"twitter_tweet_button_",lang:"en",text:"",url:"",count:"none",width:110,height:20,counturl:"",template:'<iframe scrolling="no" frameborder="0" allowtransparency="true" src="//platform0.twitter.com/widgets/tweet_button.html?_=<%= ts %>&amp;count=<%= count %>&amp;id=<%= id %>&amp;lang=<%= lang %>&amp;original_referer=<%= referer %>&amp;text=<%= text %>&amp;counturl=<%= counturl %>&amp;url=<%= url %>" class="twitter-share-button twitter-count-horizontal" style="width: <%= width %>px; height: <%= height %>px;" title="Twitter For Websites: Tweet Button"></iframe>'},initialize:function(options){$.extend(this.options,options||{});
this.options.template=new ustream.classes.SimpleTpl(this.options.template)},get:function(){var url=encodeURIComponent(this.options.url),counturl=!!this.options.counturl?encodeURIComponent(this.options.counturl):url,referer=encodeURIComponent(location.href),id=~~$(".twitter-share-button").size()+1,data={ts:(new Date()).getTime(),id:encodeURIComponent(this.options.id+id),lang:encodeURIComponent(this.options.lang),text:encodeURIComponent(this.options.text),url:url,referer:referer,count:this.options.count,width:this.options.width,height:this.options.height,counturl:counturl};
return this.options.template.run(data)}})}());
(function(){eval(ustream.namespace);ustream.classes.FacebookButton=$.klass({options:{width:90,height:20,url:"",layout:"button_count",action:"like",template:'<iframe scrolling="no" frameborder="0" allowtransparency="true" style="border: medium none; overflow: hidden; width: <%= width %>px; height: <%= height %>px;" src="http://www.facebook.com/plugins/like.php?href=<%= url %>&amp;send=false&amp;layout=<%= layout %>&amp;show_faces=false&amp;width=<%= width %>&amp;action=<%= action %>&amp;colorscheme=light&amp;height=<%= height %>" class="fb-share"></iframe>'},initialize:function(options){$.extend(this.options,options||{});
this.options.template=new ustream.classes.SimpleTpl(this.options.template)},get:function(){var url=encodeURIComponent(this.options.url),data={layout:this.options.layout,action:this.options.action,url:url,width:this.options.width,height:this.options.height};
return this.options.template.run(data)}})}());
(function(){eval(ustream.namespace);ustream.classes.HighlightCreator=$.klass({options:{flashObject:{},insertAfter:"",opener:"",template:"",id:"#HighlightCreator",seekStepPercent:0.5,forceOneSecSteps:true},initialize:function(options){$.extend(this.options,options||{});
this.options.template=new ustream.classes.SimpleTpl(ustream.templates.highlightCreator);this.options.insertAfter=$(this.options.insertAfter);
this.options.opener=$(this.options.opener);this.options.opener.click(eBind(this.onOpenerClick,this));
this.options.saveUrl=ustream.vars.highlightSaveUrl;this.seekTimer={};this.seekIndex=0;this.options.seekStepPercent=(this.options.seekStepPercent/100);
this.opened=false;captureEvent(ustream.events.LOGINSUCCESS,eBind(this.onLogin,this))},updatePoints:function(){var start=this.duration*this.startPercent,end=this.duration*this.endPercent,zeroPad=stringUtils.zeroPad,mFunc=this.options.forceOneSecSteps?"round":"floor",startP=zeroPad(Math.floor(start/60),2)+":"+zeroPad(Math[mFunc](start%60),2),endP=zeroPad(Math.floor(end/60),2)+":"+zeroPad(Math[mFunc](end%60),2);
this.container.find(".seekFrom").text(startP).end().find(".seekTo").text(endP)},seek:function(point,where){var ssp=this.options.seekStepPercent,fo=this.options.flashObject,betweenLimit=(this.endPercent-this.startPercent)>this.percentMinLimit,startPointRwd=(point==="from"&&where<0),endPointFwd=(point==="to"&&where>0);
if(this.seekIndex>0&&(betweenLimit||startPointRwd||endPointFwd)){switch(point){case"from":if(this.startPercent+ssp*where>0){this.startPercent+=ssp*where
}fo.startPointSeek(this.startPercent);break;case"to":if(this.endPercent+ssp*where<1){this.endPercent+=ssp*where
}fo.endPointSeek(this.endPercent);break}this.updatePoints();this.seekIndex+=1;this.seekTimer=setTimeout(bind(this.seek,this,point,where),(this.seekIndex>7)?70:200)
}},onSeek:function(point,where,e){e.preventDefault();e.stopPropagation();this.seekIndex=1;this.seek(point,where)
},onSeekStop:function(e){e.preventDefault();e.stopPropagation();clearTimeout(this.seekTimer);this.seekIndex=0
},onFlashSeek:function(e){var data=e.eventData,point=data.point,where=data.percent;switch(point){case"from":this.startPercent=where;
break;case"to":this.endPercent=where;break}this.updatePoints()},onFlashPause:function(){$("#HLPreview").removeClass("din");
$("#HLStop").addClass("din")},onFlashPlay:function(){$("#HLStop").removeClass("din");$("#HLPreview").addClass("din")
},attachEvents:function(){this.container.find(".cancel, #HighlightFinish").click(eBind(this.close,this)).end().find("#SeekFrom .fwd").mousedown(eBind(this.onSeek,this,"from",1)).end().find("#SeekFrom .rwd").mousedown(eBind(this.onSeek,this,"from",-1)).end().find("#SeekTo .fwd").mousedown(eBind(this.onSeek,this,"to",1)).end().find("#SeekTo .rwd").mousedown(eBind(this.onSeek,this,"to",-1)).end().find(".seekControl a").mouseup(eBind(this.onSeekStop,this)).end().find(".seekControl a").mouseout(eBind(this.onSeekStop,this)).end().find(".seekControl a").click(eBind(function(e){e.preventDefault();
e.stopPropagation()},this)).end().find("#HLPreview").click(eBind(this.onPreview,this,true)).end().find("#HLStop").click(eBind(this.onPreview,this,false)).end().find("#HLSave").click(eBind(this.onSave,this)).end();
this.container.find("#HighlightDescription").focus(eBind(this.onFocusDescription,this)).blur(eBind(this.onBlurDescription,this));
captureEvent(ustream.events.HIGHLIGHTSTARTSEEK,eBind(this.onFlashSeek,this));captureEvent(ustream.events.HIGHLIGHTENDSEEK,eBind(this.onFlashSeek,this));
captureEvent(ustream.events.VIDEOSTOP,eBind(this.onFlashPause,this));captureEvent(ustream.events.VIDEOSTART,eBind(this.onFlashPlay,this))
},open:function(){if(this.opened){this.close();return}this.opened=true;var fo=this.options.flashObject;
fo.pause();this.duration=fo.getDuration();if(!this.duration){this.duration=0}if(this.duration<10){this.opened=false;
this.throwError(_t_("js.v3.highlight_creator.open_error"));return}if(this.options.forceOneSecSteps){this.options.seekStepPercent=(100/this.duration)/100
}this.container=$(this.options.template.run());this.cover=new ustream.classes.CoverLayer(this.container);
this.attachEvents();this.percentMinLimit=(10/this.duration);this.startPercent=0;this.endPercent=1;this.updatePoints();
this.container.hide().insertAfter(this.options.insertAfter).slideDown();this.options.opener.find(".ui-icon-blue").toggleClass("ui-icon-carat-1-s").toggleClass("ui-icon-carat-1-n");
fo.showHighlightUI();fo.showHighlightUI()},close:function(e){if(e){e.preventDefault();e.stopPropagation()
}$(this.options.id).slideUp("fast",function(){$(this).remove()});this.options.opener.find(".ui-icon-blue").toggleClass("ui-icon-carat-1-s").toggleClass("ui-icon-carat-1-n");
this.options.flashObject.hideHighlightUI();this.opened=false;this.cover.destroy();if(typeof this.copyUrl!=="undefined"){this.copyUrl.destroy()
}},onPreview:function(toStart,e){e.preventDefault();e.stopPropagation();var fo=this.options.flashObject;
if(toStart){$("#HLStop").removeClass("din");$("#HLPreview").addClass("din");fo.startPreview()}else{$("#HLPreview").removeClass("din");
$("#HLStop").addClass("din");fo.stopPreview()}},onSave:function(e){e.preventDefault();e.stopPropagation();
var sendData,descriptionEl=this.container.find("#HighlightDescription");if(descriptionEl.val()===descriptionEl.attr("title")){this.throwError(_t_("js.v3.highlight_creator.missing_description"));
return}sendData={videoId:$("#videoId").val(),description:descriptionEl.val(),start:this.startPercent,end:this.endPercent};
this.cover.show();$.ajax({url:this.options.saveUrl,type:"POST",dataType:"json",data:{highlight:sendData},success:bind(this.onSaveResponse,this)})
},onSaveResponse:function(response){this.cover.hide();if(response.success){this.container.find(".highlightLink").text(this.container.find("#HighlightDescription").val()).attr("href",response.url).end().find(".shortLink").val(response.tinyUrl).end().removeClass("step1").addClass("step2");
var twButton=new ustream.classes.TwitterButton({text:"I've just highlighted a moment on Ustream, check this out!",url:response.tinyUrl,count:"none",width:60,height:20}),fbButton=new ustream.classes.FacebookButton({url:response.tinyUrl,width:100,height:20,layout:"button_count",action:"recommend"});
this.container.find(".share").append(twButton.get()).append(fbButton.get());this.options.flashObject.hideHighlightUI();
this.copyUrl=new ustream.classes.CopyEmbedCode({container:this.container.find("fieldset.step2"),callbackParam:"#ShortUrlCallbackMessage_Embed"})
}else{this.throwError(response.error.message||"Error!")}},onOpenerClick:function(e){e.preventDefault();
e.stopPropagation();if(ustream.vars.loggedIn){this.open()}else{dispatchEvent(ustream.events.REQUIRELOGIN,{highlightClicked:true})
}},onFocusDescription:function(){var element=this.container.find("#HighlightDescription"),val=element.val(),defaultVal=element.attr("title");
if(val===defaultVal){element.val("").removeClass("default")}},onBlurDescription:function(){var element=this.container.find("#HighlightDescription"),val=element.val(),defaultVal=element.attr("title");
if(val===""||val===defaultVal){element.addClass("default").val(defaultVal)}},onLogin:function(e){var hlClicked=e.eventData.highlightClicked||false;
if(hlClicked){this.open()}},throwError:function(error){dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:error})
}})}());
(function(){eval(ustream.namespace);ustream.classes.CopyEmbedCode=$.klass({options:{embedCode:'<embed height="100%" width="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: 100%; 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.FlashViewerCore=ustream.classes.FlashBase.extend({initialize:function(id,options){if(ustream.vars.loggedInUserId>0){this.options.flashvars.userid=ustream.vars.loggedInUserId
}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");
this.addListener("channel","adsVideoAdStarted","onVideoAdPlay");this.addListener("channel","adsVideoAdFinished","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));captureEvent(ustream.events.STOPFLASHMOVIES,eBind(this.pause,this));
captureEvent(ustream.events.PLAYFLASHMOVIES,eBind(this.play,this))}},resize:function(width,height){dispatchEvent(ustream.events.FLASHRESIZE,{width:width,height:height})
},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(){var aS=this.getProperty("logic.media.modules.ppv","alreadySubscribed");
if(typeof aS==="boolean"){this.setProperty("logic.media.modules.ppv","alreadySubscribed",true)}else{this.setProperty("logic.channel.modules.ppv","alreadySubscribed",true)
}},setAlreadyNotSubscribed:function(){var aS=this.getProperty("logic.media.modules.ppv","alreadySubscribed");
if(typeof aS==="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)
},onHideAdClick:function(){dispatchEvent(ustream.events.PMINIT)},onEnterTicket:function(idColl){dispatchEvent(ustream.events.TICKETENTERCODE,{eventId:idColl.eventId,mediaId:idColl.mediaId})
},onBuyTicket:function(idColl){dispatchEvent(ustream.events.TICKETPURCHASEINIT,{eventId:idColl.eventId,mediaId:idColl.mediaId})
},createMediaItem:function(){}})}());
(function(){eval(ustream.namespace);ustream.classes.FlashPlayer=ustream.classes.FlashViewerCore.extend({ready:function(){this.parent();
var vid=this.options.flashvars.vid;if(this.options.flashvars.enablejsapi){this.addListener("recorded","pause","onPlayerPause");
this.addListener("recorded","play","onPlayerPlay");this.addListener("viewer","ready","onPlayerReady")
}},onPlayerReady:function(){dispatchEvent(ustream.events.FLASHPLAYERREADY,{id:this.id,instance:this.instance})
},stop:function(){this.parent(true)},getDuration:function(){this.pipe("setIntervalMinimum",10);return this.getProperty("logic.media","duration")
},showHighlightUI:function(){this.pipe("showHighlightUI")},hideHighlightUI:function(){this.pipe("hideHighlightUI")
},startPointSeek:function(percent){this.pipe("startPointSeek",percent)},endPointSeek:function(percent){this.pipe("endPointSeek",percent)
},startPreview:function(){this.pipe("startPreview")},stopPreview:function(){this.pipe("stopPreview")},onPlayerPlay:function(){dispatchEvent(ustream.events.VIDEOSTART)
},onPlayerPause:function(){dispatchEvent(ustream.events.VIDEOSTOP)},createRecord:function(videoId){return this.callMethod("logic","createRecorded",videoId)
},createMediaItem:function(){if(ustream.vars.ppvItem&&ustream.vars.ppvItem.mediaId){this.createRecord(ustream.vars.ppvItem.mediaId)
}}})}());
(function(){eval(ustream.namespace);ustream.classes.FlashRecorderLite=ustream.classes.FlashBase.extend({options:{movie:"/flash/recorderlite.swf",width:430,height:320,version:"9.0.115",params:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},flashvars:{enablejsapi:true},expressinstall:"/swf/expressInstall.swf",onFillDeviceNames:nullFunc,onStartRecord:nullFunc,onStopRecord:nullFunc,onWaitForRecord:nullFunc,onRecordReady:nullFunc,onStartCounter:nullFunc,onUpdateCounter:nullFunc,onStartPreview:nullFunc,onStopPreview:nullFunc,onCancelRecord:nullFunc},initialize:function(id,options){window.recorderLite=this;
if(typeof(ustream.flash.recorder)!=="object"){ustream.flash.recorder={}}this.flash=null;ustream.flash.recorder[id]=this;
this.parent(id,options)},ready:function(){this.instance=this.flash=window.swfobject.getObjectById(this.id)
},multipleInstances:function(){ustream.events.dispatch(ustream.events.ERRORNOTIFICATION,{message:_t_("js.v3.flash_recorder_lite.already_broadcasting"),delay:6000});
if(typeof(this.options.onFailure)!=="undefined"){this.options.onFailure()}},sessionError:function(){ustream.events.dispatch(ustream.events.ERRORNOTIFICATION,{message:_t_("js.v3.flash_recorder_lite.not_logged_in"),delay:6000});
if(typeof(this.options.onFailure)!=="undefined"){this.options.onFailure()}},alreadyOnline:function(){this.multipleInstances()
},cameraNames:function(){this.fillDeviceNames("Camera")},microphoneNames:function(){this.fillDeviceNames("Microphone")
},fillDeviceNames:function(type){var names=this.instance[type.toLowerCase()+"Names"]();if(typeof(this.options.onFillDeviceNames)!=="undefined"){this.options.onFillDeviceNames(type,names)
}},cameraName:function(){this.updateSelectedDeviceName("Camera")},microphoneName:function(){this.updateSelectedDeviceName("Microphone")
},updateSelectedDeviceName:function(type){if(typeof(this.options.updateSelectedDeviceName)!=="undefined"){this.options.updateSelectedDeviceName(type)
}},changeDevice:function(type,name){this.instance["set"+type+"Name"](name)},createRecorder:function(){if(typeof(this.options.createRecorder)!=="undefined"){this.options.createRecorder()
}},waitForRecord:function(){if(typeof(this.options.onWaitForRecord)!=="undefined"){this.options.onWaitForRecord()
}},startRecordCommand:function(){this.instance.startRecord()},startRecord:function(){if(typeof(this.options.onStartRecord)!=="undefined"){this.options.onStartRecord(this)
}this.counterInterval=null;this.counterState=0;this.startCounter()},startCounter:function(){if(typeof(this.options.onStartCounter)!=="undefined"){this.options.onStartCounter()
}this.counterState=0;this.counterInterval=ustream.timer.add(1000,bind(this.updateCounter,this))},updateCounter:function(){this.counterState+=1;
if(this.counterState===60){this.instance.stopRecord();return}if(typeof(this.options.onUpdateCounter)!=="undefined"){this.options.onUpdateCounter(this.counterState)
}},stopCounter:function(){if(this.counterInterval){this.counterInterval.stop()}},stopRecordCommand:function(){this.instance.stopRecord()
},stopRecord:function(){this.stopCounter();if(typeof(this.options.onStopRecord)!=="undefined"){this.options.onStopRecord()
}},startPreviewCommand:function(){this.instance.startPreview()},startPreview:function(){if(typeof(this.options.onStartPreview)!=="undefined"){this.options.onStartPreview()
}},stopPreview:function(){if(typeof(this.options.onStopPreview)!=="undefined"){this.options.onStopPreview()
}},recordReady:function(){if(typeof(this.options.onRecordReady)!=="undefined"){this.options.onRecordReady()
}},cancelRecordCommand:function(){this.instance.cancelRecord()},cancelRecord:function(){this.stopCounter();
if(typeof(this.options.onCancelRecord)!=="undefined"){this.options.onCancelRecord()}},sendSaveRecord:function(description,title,isPrivate,tags){isPrivate=isPrivate||false;
tags=tags||["video","comment"];this.instance.saveRecord(description,title,isPrivate,tags)},saveRecord:function(videoId){if(typeof(this.options.onSaveRecord)!=="undefined"){this.options.onSaveRecord(videoId)
}},destroy:function(){this.stopCounter();this.disableGui();$("#VideoRecorder").dialog("destroy");$("embed, object").css("visibility","visible")
},disableGui:function(){},restoreGui:function(){this.stopCounter()}})}());
(function(){eval(ustream.namespace);ustream.classes.VideoCommentRecorder=$.klass({options:{},templates:{channels:"",recorder:""},initialize:function(options){this.options=merge(this.options,options||{});
this.usedChannel=0;this.templates.channels=ustream.templates.videoCommentChannels;this.templates.recorder=ustream.templates.videoCommentRecorder;
this.templates.channels=new ustream.classes.SimpleTpl(this.templates.channels);this.templates.recorder=new ustream.classes.SimpleTpl(this.templates.recorder);
this.videoTitle="Re:"+$("#EventHeader > h2").text()||"Re:"},setDefaultChannel:function(){$.cookie("ustreamVideoCommentDefault",this.usedChannel,{expires:7,path:"/",domain:"ustream.tv"})
},getDefaultChannel:function(){var defChan=($.cookie("ustreamVideoCommentDefault"))*1;if(defChan>0){this.usedChannel=defChan;
return true}return false},open:function(userChannels){if(!ustream.vars.loggedIn){return}var bcProps=userChannels||ustream.vars.userChannels,overlayButtons={};
if(bcProps&&bcProps.length>1){if(this.getDefaultChannel()){this.openRecorderLite()}else{this.overlay=$(this.templates.channels.run({channels:bcProps}));
overlayButtons[_t_("js.v3.video_comment_recorder.button_next")]=bind(this.onChannelSelect,this);overlayButtons[_t_("js.v3.video_comment_recorder.button_cancel")]=bind(this.onChannelCancel,this);
this.overlay.dialog({title:_t_("js.v3.video_comment_recorder.select_channel_title"),modal:true,width:400,height:140,buttons:overlayButtons,autoOpen:true,close:bind(this.onModalClose,this)})
}}else{if(bcProps.length==1){this.usedChannel=(bcProps[0].channelId||bcProps[0].id);this.openRecorderLite()
}else{dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:_t_("js.v3.video_comment_recorder.no_channel_error")})
}}},onChannelSelect:function(){this.usedChannel=this.overlay.find("select").val();if(this.overlay.find("input[type=checkbox]:checked").length>0){this.setDefaultChannel()
}this.overlay.dialog("destroy");this.openRecorderLite()},onChannelCancel:function(){this.overlay.dialog("close")
},openRecorderLite:function(){this.overlay=$(this.templates.recorder.run()).appendTo("body");this.overlay.dialog({title:_t_("js.v3.video_comment_recorder.recorder_title"),modal:true,width:450,height:386,autoOpen:true,close:bind(this.onModalClose,this)});
var flashRecorderParams={flashvars:{enablejsapi:true,cid:this.usedChannel,sid:ustream.vars.sessionId},params:{allowscriptaccess:"always",wmode:"transparent"},onFailure:bind(function(){this.overlay.dialog("close")
},this),onFillDeviceNames:bind(this.onFillDeviceNames,this),updateSelectedDeviceName:bind(this.updateSelectedDeviceName,this),waitForRecord:bind(this.waitForRecord,this),onStartRecord:bind(this.onStartRecord,this),onStopRecord:bind(this.onStopRecord,this),onStartCounter:bind(this.onStartCounter,this),onUpdateCounter:bind(this.onUpdateCounter,this),onRecordReady:bind(this.onRecordReady,this),onStartPreview:bind(this.onStartPreview,this),onStopPreview:bind(this.onStopPreview,this),onCancelRecord:bind(this.onCancelRecord,this),createRecorder:bind(this.createRecorder,this),onSaveRecord:bind(this.onSaveRecord,this)};
this.recorder=new ustream.classes.FlashRecorderLite("FlashRecorder",flashRecorderParams);this.overlay.find("#RecordButton").click(eBind(function(e){e.preventDefault();
e.stopPropagation();this.recorder.startRecordCommand()},this)).end().find("#StopButton").click(eBind(function(e){e.preventDefault();
e.stopPropagation();this.recorder.stopRecordCommand()},this)).end().find("#PlayButton").click(eBind(function(e){e.preventDefault();
e.stopPropagation();this.recorder.startPreviewCommand()},this)).end().find("#CommentButton").click(eBind(function(e){e.preventDefault();
e.stopPropagation();if(!$(e.target).closest("a").hasClass("disabled")){this.onCommentRecord()}},this)).end().find("#RerecordButton").click(eBind(function(e){e.preventDefault();
e.stopPropagation();if(!$(e.target).closest("a").hasClass("disabled")){this.recorder.cancelRecordCommand()
}},this)).end().find("#SaveButton").click(eBind(function(e){e.preventDefault();e.stopPropagation();var titleText=$.trim($("#VideoCommentRecordText").val());
if(!titleText){return dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:_t_("js.v3.video_comment_recorder.title_not_set_error")})
}this.recorder.sendSaveRecord(titleText,this.videoTitle,false,["video","comment"])},this)).end().find("#RecorderSettingsToggle").click(eBind(this.onSettings,this)).end().find("fieldset select").change(eBind(this.onChangeDevice,this))
},onSettings:function(e){e.preventDefault();e.stopPropagation();this.overlay.find("#RecorderSettingsToggle").toggleClass("active").end().find("fieldset.controls").toggleClass("din")
},onCommentRecord:function(){this.overlay.find(".step1,.step2,.step3").addClass("din").end().find(".step4").removeClass("din").end().find("li:not(.controls)").hide().end().find(".comment").removeClass("din").end();
var tArea=$('<textarea id="VideoCommentRecordText"></textarea>').insertAfter(this.overlay.parent()),tOffset=$("#VideoCommentText").offset();
tArea.css({left:tOffset.left,top:tOffset.top})},onModalClose:function(){if(this.recorder){this.recorder.destroy()
}this.overlay.dialog("destroy");this.recorder=null;delete this.recorder;$("#VideoCommentRecordText,#VideoCommentRecorder").remove()
},onFillDeviceNames:function(type,names){var select=this.overlay.find("select[rel="+type+"]");select.children().remove();
forEach(names,function(name,index){select.append('<option value="'+name+'">'+name+"</option>")})},updateSelectedDeviceName:function(){},waitForRecord:function(){},onChangeDevice:function(e){var select=$(e.target),type=select.attr("rel"),name=select.val();
this.recorder.changeDevice(type,name)},createRecorder:function(){this.overlay.find(".step2,.step3").addClass("din").end().find(".step1").removeClass("din")
},onStartRecord:function(){this.overlay.find(".step1,.step3").addClass("din").end().find(".step2").removeClass("din").end().find("#PlayButton,#CommentButton,#RerecordButton")
},onStopRecord:function(){this.overlay.find(".step1,.step2").addClass("din").end().find(".step3").removeClass("din")
},onStartCounter:function(){this.overlay.find(".counter").text("00:00")},onUpdateCounter:function(seconds){var formattedTime="00:";
if(seconds>9){formattedTime+=seconds}else{formattedTime+="0"+seconds}this.overlay.find(".counter").text(formattedTime)
},onRecordReady:function(){this.overlay.find("#PlayButton,#CommentButton,#RerecordButton").removeClass("disabled")
},onStartPreview:function(){this.overlay.find("#PlayButton,#CommentButton,#RerecordButton").addClass("disabled")
},onStopPreview:function(){this.overlay.find("#PlayButton,#CommentButton,#RerecordButton").removeClass("disabled")
},onCancelRecord:function(){this.overlay.find(".step2,.step3").addClass("din").end().find(".step1").removeClass("din")
},onSaveRecord:function(videoId){dispatchEvent(ustream.events.NEWVIDEOCOMMENT,{id:videoId,comment:$("#VideoCommentRecordText").val()});
this.overlay.dialog("close")}})})();
(function(){eval(ustream.namespace);ustream.classes.Comments=$.klass({debug:false,globalMode:"video",_openLastComment:null,options:{controlId:"",globalMode:false},templates:{confirm:new ustream.classes.SimpleTpl(ustream.templates.commentsConfirm),comment:new ustream.classes.SimpleTpl(ustream.templates.comments),subComment:new ustream.classes.SimpleTpl(ustream.templates.subComment)},initialize:function(options){if(typeof(options)=="string"){options={controlId:options}
}this.options=merge(this.options,options||{});this.target=$("#"+this.options.controlId);if(!this.target.length){$.console.log("Comments not initialized. Target: #",this.options.controlId,this.target);
return}this.target.click(eBind(this.onClick,this));if(this.options.globalMode!==false){this.globalMode=this.options.globalMode
}else{var lowId=this.options.controlId.toLowerCase().match(/(video|highlight|user)/);if(lowId&&lowId.length==2){this.globalMode=lowId[1]
}else{throw ("Unknown comment type (supported: video, highlight, user)")}}captureEvent(ustream.events.NEWVIDEOCOMMENT,eBind(this.addVideoComment,this));
this.addPager();$("#AddCommentTop").click(eBind(this.onMainSubmitClick,this));this.addTextareaLoginWrapper();
this.addLoginHandler();this.addConfirmDialog();if(this.debug){this.pager.refresh()}this.onDomChange()
},addPager:function(){var pagerOpts={pager:this.options.controlId,onResponse:bind(this.renderList,this),coverLayerEl:this.target};
if(this.debug){pagerOpts.mockResponse=this._testJson.feedGet}this.pager=new ustream.classes.CallbackPager(pagerOpts)
},addTextareaLoginWrapper:function(){var bound=eBind(this.onTextareaFocus,this);$("#CommentTop").focus(bound);
this.globalId=$("#CommentTop").attr("data-recordId");this.target.find("textarea").focus(bound)},addLoginHandler:function(){captureEvent(ustream.events.LOGINSUCCESS,eBind(function(e){var comLog=e.eventData.commentLoginNeeded;
if(comLog){if(e.eventData.commentInstaId==this.__instaId){if($(comLog).attr("id")!="CommentTop"){this._openLastComment=$(comLog).closest("li").index()
}else{$(comLog).focus()}}}this.pager.refresh()},this))},addConfirmDialog:function(){(this.confirmDialog=$(this.templates.confirm.run())).dialog({modal:true,autoOpen:false,width:300,minHeight:100});
var close=bind(function(){this.confirmDialog.parent().find(".ui-dialog-titlebar-close").click()},this);
this.confirmDialog.find("a.close").click(eBind(function(e){e.preventDefault();e.stopPropagation();close()
},this));var nullFunc=function(){};this.onConfirmActionClick=nullFunc;this.confirmDialog.find("a.action").click(eBind(function(e){e.preventDefault();
e.stopPropagation();this.onConfirmActionClick();this.onConfirmActionClick=nullFunc;close()},this))},onTextareaFocus:function(e){var el=$(e.target);
if(!ustream.vars.loggedIn){dispatchEvent(ustream.events.REQUIREAJAXLOGIN,{commentLoginNeeded:el,commentInstaId:this.__instaId})
}},allowComment:function(){if(ustream.vars.loggedIn){return true}dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:_t_("js.v3.comments.you_must_be_logged_in")});
return false},onMainSubmitClick:function(e){e.preventDefault();e.stopPropagation();if(!this.allowComment()){return
}var el=$(e.target),cont=el.closest(".addComment").find(".inner"),tArea=$("#CommentTop"),val=$.trim(tArea.val());
if(!val){return}if(!cont.cover){cont.cover=new ustream.classes.CoverLayer(cont)}cont.cover.show();this.$post(this.getUrl("add",{mode:this.globalMode,targetId:this.globalId}),{comment:val},bind(function(resp){cont.cover.hide();
if(!resp.success){return this.errMsg(resp)}this.succMsg(resp);tArea.val("");this.pager.getPage(1)},this),"json","fake:feedGet");
return},openConfirmDialog:function(boundFunc){this.onConfirmActionClick=boundFunc;this.confirmDialog.dialog("open")
},addVideoComment:function(e){e=e.eventData;if(!this.allowComment()||!e.comment){return}if(!this.target.cover){this.target.cover=new ustream.classes.CoverLayer(this.target,{show:true})
}this.$post(this.getUrl("attach",{mode:this.globalMode,targetId:this.globalId,attachId:e.id}),{comment:e.comment},bind(function(resp){this.target.cover.destroy();
delete this.target.cover;if(!resp.success){return this.errMsg(resp)}this.succMsg(resp);this.pager.getPage(1)
},this),"json","fake:feedGet");return},onClick:function(e){var el=$(e.target),li=el.closest("li"),recId,url,val;
if(el.get(0).parentNode.className.indexOf("js")>-1){el=el.parent()}if(el.hasClass("jsToggleSubComment")){li.toggleClass("subHidden");
if(!li.hasClass("subHidden")){this.getSubCommentsFor(li)}e.preventDefault();e.stopPropagation();return
}if(el.hasClass("jsAddComment")){li.toggleClass("commentFormVisible");e.preventDefault();e.stopPropagation();
return}if(el.hasClass("jsCancelComment")){li.removeClass("commentFormVisible");li.find(".commentForm textarea").val("");
e.preventDefault();e.stopPropagation();return}if(el.hasClass("jsDeleteComment")){var action=bind(function(li){li.cover=new ustream.classes.CoverLayer(li,{show:true});
this.deleteComment(li)},this,li);this.openConfirmDialog(action);e.preventDefault();e.stopPropagation();
return}if(el.hasClass("jsDeleteSubComment")){li=el.closest(".subCommentItem");var action=bind(function(li){li.cover=new ustream.classes.CoverLayer(li,{show:true});
this.deleteComment(li,true)},this,li);this.openConfirmDialog(action);e.preventDefault();e.stopPropagation();
return}if(el.hasClass("jsBan")){this.banUser(li);e.preventDefault();e.stopPropagation();return}if(el.hasClass("jsUnBan")){this.banUser(li,true);
e.preventDefault();e.stopPropagation();return}if(el.hasClass("jsApproveComment")){li.cover=new ustream.classes.CoverLayer(li,{show:true});
this.approveComment(li,el);e.preventDefault();e.stopPropagation();return}if(el.hasClass("jsApproveSubComment")){li=el.closest(".subCommentItem");
li.cover=new ustream.classes.CoverLayer(li,{show:true});this.approveComment(li,el,true);e.preventDefault();
e.stopPropagation();return}if(el.hasClass("jsSubmitComment")){e.preventDefault();e.stopPropagation();
if(!this.allowComment()){return}recId=li.attr("data-recordId");val=$.trim(li.find("textarea").val());
if(!val){return}li.cover=new ustream.classes.CoverLayer(li,{show:true});this.$post(this.getUrl("add",{mode:"comment",targetId:recId}),{comment:val},bind(function(resp){li.cover.destroy();
li.cover=null;if(!resp.success){return this.errMsg(resp)}this.succMsg(resp);li.find(".jsCancelComment").click();
this.renderSubCommentsHtml(li,resp)},this),"json","fake:addSubComment");return}if(el.hasClass("jsOpenVideo")){url=el.attr("data-url");
if(url){window.open(url,"_self")}return}},getSubCommentsFor:function(li){var sc=li.find(".subComment");
sc.cover=new ustream.classes.CoverLayer(sc,{show:true});this.$get(this.getUrl("get",{mode:"comment",targetId:li.attr("data-recordId"),limit:10,pageId:1}),{},bind(function(resp){sc.cover.destroy();
sc.cover=null;if(!resp.success){return this.errMsg(resp)}this.renderSubCommentsHtml(li,resp)},this),"json","fake:subComment")
},renderSubCommentsHtml:function(li,resp){li.find(".subCommentText").html(this.templates.subComment.run(resp));
var liNum=resp.records.length;if(liNum){this.updateSubCommentTitle(li,liNum);li.find(".subComment").show()
}if(li.cover){li.cover.hide()}},banUser:function(li,isUnBan){var userId=li.attr("data-userId"),recordId=li.attr("data-recordId"),lis,action=isUnBan?"unban":"ban";
if(!userId){return}lis=li.parent().find("li[data-userId="+userId+"]");this.addCovers(lis);this.$get(this.getUrl(action,{mode:this.globalMode,targetId:this.globalId,commentId:recordId,userId:userId}),{},bind(function(resp){this.destroyCovers(lis);
if(!resp.success){return this.errMsg(resp)}if(action=="ban"){lis.addClass("blocked")}else{lis.removeClass("blocked")
}},this),"json","fake:simpleSuccTrue")},approveComment:function(li,el,isSub){this.$get(this.getUrl("approve",{mode:this.globalMode,targetId:this.globalId,commentId:li.attr("data-recordId")}),{},bind(function(resp){li.cover.destroy();
li.cover=null;if(!resp.success){return this.errMsg(resp)}el.parent().remove()},this),"json","fake:approveComment")
},deleteComment:function(li,isSub){this.$get(this.getUrl("delete",{mode:isSub?"comment":this.globalMode,targetId:isSub?li.closest("li").attr("data-recordId"):this.globalId,commentId:li.attr("data-recordId")}),{},bind(function(resp){if(!resp.success){li.cover.destroy();
li.cover=null;return this.errMsg(resp)}var parent=isSub?li.closest(".subComment"):null;li.slideUp("fast",bind(function(){li.remove();
if(isSub){var liNum=parent.find(".subCommentItem").length;if(!liNum){parent.remove()}else{this.updateSubCommentTitle(parent,liNum)
}}this.onDomChange()},this))},this),"json","fake:deleteComment")},renderList:function(resp){resp.userId=~~ustream.vars.loggedInUserId;
this.target.removeClass("hasItems").addClassIf("hasItems",resp.records.length).find("ul:eq(0)").outerHtml(this.templates.comment.run(resp));
var comLog=this._openLastComment;if(comLog!==null){this.target.find("ul > li").eq(comLog).find(".jsAddComment").click().end().find("textarea").focus();
this._openLastComment=null}this.onDomChange()},updateSubCommentTitle:function(li,liNum){var title=li.find(".subCommentTitle i");
title.text(liNum)},getUrl:function(url,params){var cUrl=ustream.vars.commentUrls[url];if(!params){return cUrl
}return stringUtils.urlSubst(cUrl,params)},onDomChange:function(){var pagerActive=this.target.find(".pager").hasClass("visible");
this.target.removeClass("hasItems").addClassIf("hasItems",this.target.find("ul > li").length).removeClass("noPager").addClassIf("noPager",!pagerActive).find("ul > li > .separator").removeClass("last").last().addClass("last")
},addCovers:function(lis){lis.each(function(){var li=this;if(!li.cover){li.cover=new ustream.classes.CoverLayer(li)
}li.cover.show()})},destroyCovers:function(lis){lis.each(function(){var li=this;if(li.cover){li.cover.destroy();
li.cover=null}})},errMsg:function(resp){var msg="Error.";if(resp&&resp.error&&resp.error.message){msg=resp.error.message
}dispatchEvent(ustream.events.ERRORNOTIFICATION,{message:msg})},succMsg:function(resp){if(resp.message){dispatchEvent(ustream.events.SUCCESSNOTIFICATION,{message:resp.message})
}},_ajax:function(url,params,callback,respType,fakeRespId,mode){if(!this.debug){return $[mode](url,params,callback,respType)
}setTimeout(bind(function(){callback(this._testJson[fakeRespId.replace(/^fake:/,"")])},this),600)},"$get":function(){return this._ajax.apply(this,($.makeArray(arguments)).concat("get"))
},"$post":function(){return this._ajax.apply(this,($.makeArray(arguments)).concat("post"))}})})();
(function(){eval(ustream.namespace);ustream.classes.CallbackPager=$.klass({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.preventDefault();e.stopPropagation();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.FlagContent=$.klass({options:{form:"#VideoFlag",toggleControl:false},initialize:function(options){this.options=merge(this.options,options||{});
this.options.form=$(this.options.form);this.originalTargetId=this.options.form.find('input[name="targetId"]').val();
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.validator=new ustream.classes.Validator({form:this.options.form,rules:{reason:{required:true}},submitHandler:bind(this.onSubmit,this)});
if(!ustream.vars.loggedIn){captureEvent(ustream.events.LOGINSUCCESS,bind(this.onLogin,this))}},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.preventDefault();
e.stopPropagation();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(){if(!ustream.vars.loggedIn){this.savedReason=this.getReasonField().attr("value");
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.prop("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='<option value="">'+_t_("js.v3.flag_content.choose")+"</option>",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);if(this.savedReason){this.getReasonField().attr("value",this.savedReason)
}},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.Rating=$.klass({options:{div:"#Rating",messageDiv:"#rateMessage"},initialize:function(options){this.options=merge(this.options,options||{});
this.options.div=$(this.options.div);this.rate=this.options.div.find("input[type=radio]").rating();if(!ustream.vars.loggedIn){this.rate.rating("disable")
}this.inputs=this.options.div.find("input[name=rate]");this.stars=this.options.div.find("span.star-rating-control div.star-rating a");
this.rateNumber=this.options.div.find("#rateNumber");this.stars.live("click",eBind(this.onClick,this));
this.messageDiv=$(this.options.messageDiv);this.cover=new ustream.classes.CoverLayer(this.options.div);
if(!ustream.vars.loggedIn){this.stars.click(eBind(function(e){if(!ustream.vars.loggedIn){e.preventDefault();
e.stopPropagation();dispatchEvent(ustream.events.REQUIREAJAXLOGIN,{ratingData:$(e.target).attr("title")})
}},this));ustream.events.capture(ustream.events.LOGINSUCCESS,bind(this.onLogin,this))}},onLogin:function(e){if(typeof(e.eventData.userRated)!="undefined"&&e.eventData.userRated){this.messageDiv.text(_t_("js.v3.rating.already_rated"));
return}this.messageDiv.text("");this.rate.rating("enable").rating("readOnly",false);if(typeof(e.eventData.ratingData)!="undefined"){this.rate.rating("select",e.eventData.ratingData);
this.sendRate(e.eventData.ratingData)}},onClick:function(e){if($(e.target).parent().hasClass("star-rating-readonly")){return false
}this.cover.show();this.sendRate(e.target.title)},sendRate:function(rate){$.getJSON(this.options.div.attr("rel").replace(/xRATEx/gi,rate),null,bind(this.onRateResponse,this))
},onRateResponse:function(response){this.cover.hide();if(response.success){if(this.rateNumber.find("span").length>0){this.rateNumber.find("span").incNum()
}else{this.rateNumber.text(_t_("js.v3.rating.one_rated"))}this.messageDiv.text(_t_("js.v3.rating.thanks_for_rating"));
this.inputs.rating("disable");this.stars.die()}else{this.messageDiv.text(response.error.message)}}})})();
(function(){eval(ustream.namespace);ustream.classes.ContentToggle=$.klass({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.preventDefault();
e.stopPropagation();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.DialogOverViewer=$.klass({options:{viewerSelector:"#v2"},initialize:function(options){this.options=merge(this.options,options||{})
},getModal:function(){return this.options.modal},_getViewer:function(){return $(this.options.viewerSelector)
},_getPos:function(){var win,viewerOffset,dialogDimensions,height,width,scrollTop,scrollLeft,pos,viewer,output=null;
viewer=this._getViewer();if(viewer.length){win=$(window);viewerOffset=viewer.offset();dialogDimensions=this.options.dialogDimensions;
height=viewer.height();width=viewer.width();scrollTop=win.scrollTop();scrollLeft=win.scrollLeft();pos=[parseInt(width/2-dialogDimensions.width/2+viewerOffset.left-scrollLeft,10),parseInt(height/2-dialogDimensions.height/2+viewerOffset.top-scrollTop,10)];
output={pos:pos,scrollTop:scrollTop,scrollLeft:scrollLeft}}return output},_fixDialogPos:function(posDetails){if(!ustream.vars.isIframe){var dialogParent,dialogPos,scrollPos;
dialogParent=this.options.modal.parent();dialogPos=dialogParent.offset();scrollPos=posDetails.pos[1]+posDetails.scrollTop;
if(dialogPos.top<scrollPos){setTimeout(bind(function(){dialogParent.css({top:scrollPos})},this),0)}}},setDialogPosition:function(){if(!this.options.modal||!this.options.modal.length){return
}var posDetails=this._getPos(),pos,scrollPos;if(posDetails){pos=posDetails.pos;if(!isNaN(pos[0])&&!isNaN(pos[1])){this.options.modal.dialog("option","position",pos);
this._fixDialogPos(posDetails)}}},scrollToDialog:function(){var modal=this.getModal(),pos,doc;if(!modal||!modal.length){return
}if(!ustream.vars.isIframe){pos=modal.parent().position().top;doc=$(document);if(doc.scrollTop()>pos){doc.scrollTop(pos-40)
}}},captureNotification:function(){if(!this.ustrNotificationCaptured){var setPos=eBind(this.setPosition,this);
captureEvent(ustream.events.USTREAMNOTIFICATIONSHOW,setPos);captureEvent(ustream.events.USTREAMNOTIFICATIONHIDE,setPos);
$(window).resize(setPos);this.ustrNotificationCaptured=true}},setPosition:function(){this.setDialogPosition();
this.scrollToDialog()},fixPostion:function(){this.setPosition();this.captureNotification()}})}());
(function(){eval(ustream.namespace);ustream.classes.PpvItemDownloader=$.klass({initialize:function(){var evs=ustream.events;
this.ppvEvents={};captureEvent(evs.TICKETPURCHASEINIT,eBind(this.getPpvEventData,this));captureEvent(evs.TICKETENTERCODE,eBind(this.getPpvEventData,this))
},onLogin:function(e){var dlEvent=e.eventData.itemDownloadEvent;if(dlEvent){this.getPpvEventData(dlEvent)
}},loading:function(){if(!this.loadingWindow){this.loadingWindow=new ustream.classes.LoadingWindow()}this.loadingWindow.open()
},stopLoading:function(){if(this.loadingWindow){this.loadingWindow.close()}},getPpvEventData:function(e){var eventId=e.eventData.eventId,mediaId=e.eventData.mediaId,itemId=eventId||e.eventData.mediaId,channelId=eventId?mediaId:"",type=eventId?"event":"video",ppvEvent=this.ppvEvents[type+itemId],ppv;
if(ustream.vars.channelId){channelId=ustream.vars.channelId}e.eventData.ppvItemId=itemId;e.eventData.ppvItemType=type;
if(!ppvEvent){ppv={itemId:itemId,ppvItemType:type,channelId:channelId};this.ppvEvents[type+itemId]=ppv;
this.initPpv(ppv)}this.dispatchRealEvent(e,true);return},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 cls=ustream.classes,purchase=new cls.PpvPurchaseTicket(ppv),entercode=new cls.PpvTicketValidation(ppv)
},onTicketPurchaseInit:function(e,selling){var ed=e.eventData,loc;if(typeof selling!=="boolean"||selling===true){dispatchEvent(ustream.events.TICKETPURCHASESTART,ed);
loc=document.location;ustream.ppvTracker.track("start",ed.ppvItemType,ed.ppvItemId,{url:loc.host+loc.pathname})
}else{this.onError({error:{message:_t_("js.v3.ppv_item_downloader.event_selling_is_off")}})}},dispatchRealEvent:function(e,selling){var evs=ustream.events;
switch(e.type){case evs.TICKETPURCHASEINIT:this.onTicketPurchaseInit(e,selling);break;case evs.TICKETENTERCODE:dispatchEvent(evs.TICKETENTERCODESTART,e.eventData);
break}}})}());
(function(){eval(ustream.namespace);ustream.classes.SubscriptionInit=$.klass({options:{viewerSelector:"#v2"},initialize:function(){captureEvent(ustream.events.SUBSCRIPTIONINIT,eBind(this.subscriptionInit,this));
captureEvent(ustream.events.SUBSCRIPTIONCOMPLETE,eBind(this.subscripionComplete,this));captureEvent(ustream.events.SUBSCRIPTIONFAILED,eBind(this.subscripionComplete,this));
if(ustream.vars.subscribe){if($(this.options.viewerSelector).get(0).ready){dispatchEvent(ustream.events.SUBSCRIPTIONINIT)
}else{captureEvent(ustream.events.FLASHREADY,eBind(function(e){if(("#"+e.eventData.id)===this.options.viewerSelector){dispatchEvent(ustream.events.SUBSCRIPTIONINIT)
}},this))}}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()}},getDialogDimensions:function(){var isNewSubscriptionFlow=ustream.vars.isNewSubscriptionFlow;
return{width:isNewSubscriptionFlow?608:758,height:isNewSubscriptionFlow?368:540}},createDialog:function(){if($("#SubscriptionDialog").length<1){var uvars=ustream.vars,dialogConf;
dialogConf={title:uvars.videoTitle||uvars.channelTitle,modal:true,close:bind(this.onDialogClose,this)};
dialogConf=merge(dialogConf,this.getDialogDimensions());$('<div id="SubscriptionDialog"></div>').dialog(dialogConf)
}},addIframe:function(){if(this.modal){var uvars=ustream.vars,isNewSubscriptionFlow=uvars.isNewSubscriptionFlow,viewerOffset,dialogConf,iframeSize=isNewSubscriptionFlow?' width="588" height="326"':'width="738" height="502"';
this.modal.html('<div id="SecureFrameLoader"><p>'+_t_("js.v3.subscriptioninit.loadertext")+'<span></span></p></div><iframe style="visibility: hidden;" frameborder="0" border="0" scrolling="no" id="SubscriptionFrame" src="about:blank"'+iframeSize+"/>");
this.modal.find("iframe").load(function(){this.style.visibility="visible";$("#SecureFrameLoader").remove()
}).attr("src",stringUtils.urlSubst(uvars.subscriptionUrl,{channelId:uvars.channelId})+"?opener="+ustream.ppvTracker.openers.site)
}},trackStart:function(){var loc=document.location;ustream.ppvTracker.track("start","channel",ustream.vars.channelId,{url:loc.host+loc.pathname})
},subscriptionInit:function(e){this.trackStart();this.createDialog();this.modal=$("#SubscriptionDialog");
if(!this.dialogOverViewer){this.dialogOverViewer=new ustream.classes.DialogOverViewer({modal:this.modal,viewerSelector:"#v2",dialogDimensions:this.getDialogDimensions()})
}this.modal.dialog("open");this.dialogOverViewer.fixPostion();this.addIframe()},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(){var checkSubscriptionUrl;
if(ustream.vars.isUserSubscribed){this.notifyFlash()}else{if(ustream.vars.checkSubscriptionUrl){checkSubscriptionUrl=stringUtils.urlSubst(ustream.vars.checkSubscriptionUrl,{channelId:ustream.vars.channelId});
$.ajax({url:checkSubscriptionUrl,success:bind(function(response){if(response.success){ustream.vars.isUserSubscribed=true;
this.notifyFlash()}},this)})}}},subscripionComplete:function(e){if(this.modal){this.modal.dialog("close")
}else{this.onDialogClose()}},onDialogClose:function(){this.checkLogin();this.modal.html("")}})}());
(function(){eval(ustream.namespace);ustream.classes.TabbedTitleBox=$.klass({initialize:function(target,options){var o=this.options=merge(this.options,options||{}),realId,activeByClass,tabsFromCookie;
this.target=$(target);realId=this.target.attr("id");if(realId){this.cookieName="tab-"+realId}this.populate();
if(this.target.find(".tabsV4").length){this.tabsV4=true}if(this.tabsV4){this.tabLinks.find("b").append('<span class="arrowBorder"></span><span class="arrow"></span>')
}else{this.tabLinks.append('<span class="arrow"></span>')}activeByClass=-1;if(typeof(this.options.active)==="undefined"){this.tabLinks.each(function(n){if($(this).hasClass("active")){activeByClass=n
}})}if(!this.options.lazyActivate){if(this.options.allowCookies){tabsFromCookie=this.loadTabNum()}if(!tabsFromCookie){this.setActiveTab(activeByClass>-1?activeByClass:this.options.active)
}}this.tabLinks.click($.proxy(this.onTabLinkClick,this));this.loadTabNum()},populate:function(){this.tabLinks=this.target.find(".title li");
this.pages=this.target.find(".tabPageContent")},saveTabNum:function(){if(!this.cookieName||!this.options.allowCookies){return false
}$.cookie(this.cookieName,this.lastActiveNum,{expires:7});return true},loadTabNum:function(){if(!this.cookieName||!this.options.allowCookies){return false
}var n=~~$.cookie(this.cookieName);this.setActiveTab(n);return true},onTabLinkClick:function(e){var self=e.target,i=0,act=-1;
if($(self).hasClass("disabled")){return false}this.tabLinks.forEach(function(el,n){if((el===self)||(el===self.parentNode)){this.setActiveTab(n)
}},this)},setActiveTab:function(n){this.pages.hide();this.tabLinks.removeClass("active");if(typeof(this.pages[n])!=="undefined"){$(this.tabLinks[n]).addClass("active");
if(this.tabsV4){$(this.tabLinks).find("b").removeClass("active");$(this.tabLinks[n]).find("b").addClass("active")
}this.pages[n].style.display="block";this.target.find(".pGroup").hide().end().find(".pGroup"+n).show().end()
}this.onActiveTabSet(n);this.lastActiveNum=n;this.saveTabNum()},onActiveTabSet:function(n){if(typeof(this.options.onActiveTabSet)==="function"){this.options.onActiveTabSet(n)
}},disableTabEx:function(n){this.tabLinks.removeClass("disabled").eq(n).addClass("disabled")}})})();
(function(){eval(ustream.namespace);ustream.classes.StaticMoreLess=$.klass({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.preventDefault();e.stopPropagation();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;
this.links.forEach(function(elem){elem=$(elem);if(elem.prev(this.options.moreContent).hasClass("full")){elem.text(this.options.lessTxt)
}else{elem.text(this.options.moreTxt)}},this)}})})();
(function(){eval(ustream.namespace);ustream.classes.BuyActionBar=$.klass({options:{},initialize:function(options){this.options=merge(this.options,options||{});
this.container=$(this.options.container);this.setupPpv();this.captureEvents()},getButtonsChannelId:function(btn){return +$(btn).closest(".contentActionBar").attr("data-channelid")
},onBuyButtonClick:function(e){var target=$(e.target),contentActionBar,eventId,type;if(this.getButtonsChannelId(target)===+ustream.vars.channelId){e.preventDefault();
contentActionBar=target.closest(".contentActionBar");eventId=parseInt(contentActionBar.attr("data-itemid"),10);
type=contentActionBar.attr("data-itemtype");if(!isNaN(eventId)){if(!target.hasClass("readonly")){this.startPurchase(eventId,type)
}}else{throw new Error("Event id is not a number.")}}},onSubscribeButtonClick:function(e){var target=$(e.target);
if(this.getButtonsChannelId(target)===+ustream.vars.channelId){e.preventDefault();if(!target.hasClass("readonly")){this.startSubscription()
}}},setHasTicket:function(eventId){this.container.find('.contentActionBar[data-itemid="'+eventId+'"] .buy').toReadonly().attr("title",_t_("js.v3.upcomingshows.buy_ticket_button_title_already_have","You have already purchased access to this event."))
},onTicketPurchaseSuccess:function(e){if(e&&e.eventData&&e.eventData.item){var item=e.eventData.item;
if(item.type==="event"){this.setHasTicket(item.id)}}},onTicketBound:function(e){if(e&&e.eventData&&e.eventData.ppvItemId){if(typeof e.eventData.type==="string"){if(e.eventData.type==="event"){this.setHasTicket(e.eventData.ppvItemId)
}}else{this.setHasTicket(e.eventData.ppvItemId)}}},onUserSubscribed:function(){this.container.find(".button.subscribe").toReadonly().attr("title",_t_("js.v3.upcomingshows.subscribe_button_title_already_have","You already have an active subscription to this channel!"))
},captureEvents:function(){captureEvent(ustream.events.TICKETBOUND,bind(this.onTicketBound,this));captureEvent(ustream.events.TICKETPURCHASESUCCESS,eBind(this.onTicketPurchaseSuccess,this));
captureEvent(ustream.events.USERSUBSCRIBED,eBind(this.onUserSubscribed,this))},startSubscription:function(){dispatchEvent(ustream.events.SUBSCRIPTIONINIT)
},startPurchase:function(itemId,type){var args={};if(type==="video"){args.mediaId=itemId}else{args.eventId=itemId
}dispatchEvent(ustream.events.TICKETPURCHASEINIT,args)},setupPpv:function(){this.container.delegate(".button.buy","click",eBind(this.onBuyButtonClick,this));
this.container.delegate(".button.subscribe","click",eBind(this.onSubscribeButtonClick,this))}})}());
(function(){eval(ustream.namespace);ustream.classes.BuyButtonInitializer=$.klass({initialize:function(){var ppvButtons=$(".contentActionBar div.ppv"),subscribeButtons=$(".contentActionBar div.subscribe"),actionBars=[],visibileCss={opacity:1,height:31},init;
this.actionBars=[];this.ppvButtons=ppvButtons;ppvButtons.parent().css(visibileCss);subscribeButtons.parent().css(visibileCss);
$.unique(ppvButtons.closest("ul")).parent().each(bind(this.initButton,this));$.unique(subscribeButtons.closest("ul")).parent().each(bind(this.initButton,this));
captureEvent(ustream.events.LOGINSUCCESS,eBind(this.onLogin,this))},initButton:function(i,elem){var buyActionBar=new ustream.classes.BuyActionBar({container:elem});
this.actionBars.push(buyActionBar)},buildParams:function(ids,name){var items=[];forEach(ids,function(id){items.push(name+"[]="+id)
});return items.join("&")},onLogin:function(e){var eventIds=[],videoIds=[],actionBars=this.actionBars,onSuccess,setHasTicket,postData,buildParams,events;
this.ppvButtons.closest(".contentActionBar").each(function(){var id=+$(this).attr("data-itemid"),isVideo=$(this).attr("data-itemtype")==="video";
if(id){if(isVideo){videoIds.push(id)}else{eventIds.push(id)}}});setHasTicket=function(itemId){forEach(actionBars,function(actionBar){actionBar.setHasTicket(+itemId)
})};onSuccess=function(response){if(response&&response.success){var data=response.data;forEach(data.purchasedEvents,function(val,key){setHasTicket(key)
});forEach(data.purchasedVideos,function(val,key){setHasTicket(key)});forEach(data.subscribedChannels,function(val,key){setHasTicket(key)
})}};$.ajax({url:ustream.vars.ppvCheckUserAccess,type:"POST",success:onSuccess,data:[this.buildParams(eventIds,"eventIds"),this.buildParams(videoIds,"videoIds")].join("&")})
}})}());
(function(){eval(ustream.namespace);ustream.classes.App=ustream.classes.CommonPage.extend({templates:{needChannel:new ustream.classes.SimpleTpl(ustream.templates.needChannel)},initialize:function(){var html5viewer,comments,highlightcreator,prettyDateUpdater,staticMoreLess,rating,flagContent,tabbedTitleBoxDemo,vcRec,followUserChannels=[],upcomingShows,countDown,featuredMomentsList,featuredChannels,recommendedVideos,events=ustream.events,loginSignup,itemDownloader,contentToggle,subscription,uncomingEventsList,buyButtonInitializer;
this.parent();this.addNeedChannelDialog();this.videoId=$("input#videoId").val();ustream.vars.viewer.flashvars.enablejsapi=true;
if(window.location.hash.indexOf("debug")===-1){html5viewer=new ustream.classes.Html5Viewer("v2",ustream.vars.viewer);
if(!html5viewer.supported){this.viewer=new ustream.classes.FlashPlayer("v2",ustream.vars.viewer)}}comments=new ustream.classes.Comments({controlId:"VideoComments",globalMode:ustream.vars.commentMode});
if(!html5viewer.supported){highlightcreator=new ustream.classes.HighlightCreator({flashObject:this.viewer,insertAfter:"#adaptvDiv",opener:"a#CreateHighlight"})
}prettyDateUpdater=new ustream.classes.PrettyDateUpdater();staticMoreLess=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")});
$("input.followUserEventHeader").forEach(function(elem){var follow=new ustream.classes.FollowUser(elem,{_html:ustream.templates.followUserEventHeader,_skipLoginCheck:true})
});rating=new ustream.classes.Rating({div:"#Rating",messageDiv:"#rateMessage"});flagContent=new ustream.classes.FlagContent({form:"#VideoFlag",toggleControl:"#ToggleFlag"});
tabbedTitleBoxDemo=new ustream.classes.TabbedTitleBox("#tabbedTitleBoxDemo");var live=new ustream.classes.EmbedConfigurator("#EmbedViewer",{sizes:{small:{width:480,height:270},medium:{width:608,height:368},large:{width:864,height:486}}});
$("#EmbedTab .shortUrl").focus(function(){this.select()});vcRec=new ustream.classes.VideoCommentRecorder();
$("#AddVideoComment").click($.proxy(function(){if(!ustream.vars.loggedIn){dispatchEvent(ustream.events.REQUIREAJAXLOGIN,{doAddVideoComment:true})
}else{if(ustream.vars.userChannels.length>0){vcRec.open()}else{this.needChannelDialog.dialog("open")}}return false
},this));captureEvent(ustream.events.LOGINSUCCESS,$.proxy(function(e){if(e.eventData.doAddVideoComment){vcRec.open(e.eventData.userChannels)
}},this));$(".rightCol .videoInfo .followUserChannel").each(function(){followUserChannels.push(new ustream.classes.FollowUser(this,{closestContainer:"div.follow",html:new ustream.classes.SimpleTpl(ustream.templates.followUser)}))
});this.followUserChannels=followUserChannels;var countDown=new ustream.classes.Countdown();$(".simpleEventList").each(function(){new ustream.classes.ChannelEvents(this.id)
});featuredMomentsList=new ustream.classes.ScrollPager("#ChannelHighlightList",{items:".content .recordedShowThumbsV4",buttons:".pagerSteps a",loop:true,lazyLoadImages:true});
featuredChannels=new ustream.classes.ScrollPager(".rightCol_330 .featuredContent",{items:".content li",buttons:".pagerSteps a",loop:true,autoScroll:true,lazyLoadImages:true});
captureEvent(ustream.events.FOLLOWABLEREADY,$.proxy(function(e){$(".eventActionBar[data-itemid="+e.eventData.item+"],.contentActionBar[data-itemid="+e.eventData.item+"]").animate({opacity:1,height:31})
}));countDown=new ustream.classes.Countdown();recommendedVideos=new ustream.classes.ScrollPager("#RecommendedLive",{items:".content ul",buttons:".pagerSteps a",loop:true,autoScroll:true,hidePagerPages:true,lazyLoadImages:true});
uncomingEventsList=new ustream.classes.ScrollPager("#ChannelEventsV4",{items:".content ul",buttons:".pagerSteps a",loop:true});
if(ustream.vars.isPPV){if(typeof ustream.classes.LoginSignup!=="undefined"){loginSignup=new ustream.classes.LoginSignup({smallDialog:true,moveAbovePlayer:true,tplData:{secondaryTermId:"Signup_PpvTerms_Agree",secondaryTermLink:_t_("js.v3.login_signup_dialog.signup_viewer_terms",{termsLink:"/terms-ppv-popup"})}})
}itemDownloader=new ustream.classes.PpvItemDownloader();contentToggle=new ustream.classes.ContentToggle();
if(ustream.vars.buyTicket){dispatchEvent(events.TICKETPURCHASEINIT,ustream.vars.ppvItem)}else{if(ustream.vars.enterTicket){dispatchEvent(events.TICKETENTERCODE,ustream.vars.ppvItem)
}}captureEvent(events.LOGINSUCCESS,$.proxy(this.checkHasTicket,this));captureEvent(events.TICKETPURCHASESUCCESS,$.proxy(this.checkHasTicket,this));
captureEvent(events.TICKETBOUND,$.proxy(this.notifyFlashAboutHasTicket,this));captureEvent(events.FLASHPPVCREATEREADY,$.proxy(this.notifyFlashAboutHasTicket,this));
captureEvent(events.TICKETBOUND,$.proxy(this.updateCrowdButton,this));captureEvent(events.TICKETPURCHASESUCCESS,$.proxy(this.updateCrowdButton,this))
}subscription=new ustream.classes.SubscriptionInit();buyButtonInitializer=new ustream.classes.BuyButtonInitializer();
this.initTaboola()},checkHasTicket:function(){if(ustream.vars.loggedIn){$.get(ustream.vars.checkDeemTicketUrl,$.proxy(function(response){if(response&&response.haveTicket){ustream.vars.hasTicket=response.haveTicket;
var ppvItem=ustream.vars.ppvItem;dispatchEvent(ustream.events.TICKETBOUND,{type:ustream.vars.ppvItem.eventId?"event":"media",ppvItemId:ppvItem.eventId||ppvItem.mediaId})
}},this))}},notifyFlashAboutHasTicket:function(){if(ustream.vars.flashPpvCreateReady){if(ustream.vars.hasTicket){dispatchEvent(ustream.events.USERHASTICKET)
}else{dispatchEvent(ustream.events.USERHASNOTICKET)}}},updateCrowdButton:function(a){$.forEach(this.followUserChannels,function(item){if(item.target.find(".wrapCold").length>0){item.checkUserInCrowd()
}})},addNeedChannelDialog:function(){(this.needChannelDialog=$(this.templates.needChannel.run())).dialog({modal:true,autoOpen:false,width:395,minHeight:50});
var close=$.proxy(function(){this.needChannelDialog.parent().find(".ui-dialog-titlebar-close").click()
},this);this.needChannelDialog.find("a.close").click($.proxy(function(e){e.preventDefault();e.stopPropagation();
close()},this));var nullFunc=function(){};this.needChannelDialog.find("a.action").click($.proxy(function(e){e.preventDefault();
e.stopPropagation();close()},this))},onVideoListPagerResponse:function(listId,response){if(!response.success){return
}var list=$(listId),p=response.pager,recs=response.records,rlen=recs.length,numFormat=phpJs.number_format,zeroPad=stringUtils.zeroPad,rec,vidLen;
list.find(".num").html(stringUtils.labelSubst(_t_("js.v3.recorded.pager_counter"),p));while(rlen){rlen-=1;
rec=recs[rlen];rec.viewers=numFormat(rec.views,0,",",",");vidLen=rec.length*1;if(vidLen<1){rec.length="00:00"
}else{rec.length=zeroPad(Math.floor(vidLen/60),2)+":"+zeroPad(Math.floor(vidLen%60),2)}}list.find(".content ul").replaceWith(this.videoListTpl.run(response))
},errMsg:function(resp){var msg=_t_("js.common_for_all.unknown_error");if(resp&&resp.error&&resp.error.message){msg=resp.error.message
}ustream.events.dispatch(ustream.events.ERRORNOTIFICATION,{message:msg})},liveBlink:function(){this.liveBlinkLabel.find("span").toggleClass("hidden")
},initTaboola:function(){if(!!!$(".taboolaPlaceholder").size()){return false}window.rboxReady=function(evnt){var isPremium=ustream.vars.isPremium,adFree=ustream.vars.adFree,mode;
if(isPremium||adFree){mode="video-horizontalx4-premium-users"}else{mode="video-horizontalx4-regular-users"
}TRC.drawRBox({mode:mode,container:"ChannelHighlightList"})};captureEvent(ustream.events.FLASHREADY,function(e){if(e.eventData.id=="v2"){var taboolaLoader=document.createElement("script");
document.getElementsByTagName("head")[0].appendChild(taboolaLoader);if(taboolaLoader.attachEvent){taboolaLoader.attachEvent("onactivate",rboxReady)
}else{taboolaLoader.addEventListener("activate",rboxReady,false)}taboolaLoader.type="text/javascript";
taboolaLoader.src="http://cdn.taboolasyndication.com/libtrc/ustream/rbox.js?dynamic&video=video-"+ustream.vars.videoId
}})}})}());

