
if(!Ustream){var Ustream={}}if(!Ustream.Components){Ustream.Components={}}Ustream.Components.Truncate=function(originalNode,maxLength,resultNode){var temp=new Array();
var max=maxLength;var current=0;var count=0;var descriptioner=function(node,arr){for(var k=0;k<node.length;
k++){if(node[k].nodeType==3){var text=node[k].textContent||node[k].nodeValue;if(text!="\n"){count+=text.length;
arr.push(text)}}else{var nodeN=node[k].nodeName.toLowerCase();switch(nodeN){case"img":case"hr":case"object":case"embed":case"input":case"textarea":break;
default:var innerArray=new Array();arr.push({name:nodeN,inner:innerArray,parameters:(nodeN=="a")?{href:node[k].href}:{}});
descriptioner(node[k].childNodes,innerArray);break}}}};var rescriptioner=function(arr){for(var k=0;k<arr.length;
k++){if((max-current)==0){break}if(typeof arr[k]=="string"){if(current+arr[k].length>max){var mar=max-current;
if(mar>0){var sub=arr[k].substring(0,mar);arguments[1].innerHTML+=sub+"...";current=max;break}}else{arguments[1].innerHTML+=arr[k];
current+=arr[k].length}}else{if(typeof arr[k]=="object"){var new_element=document.createElement(arr[k].name);
if(arr[k].name=="a"){new_element.href=arr[k].parameters.href;new_element.target="_blank"}rescriptioner(arr[k].inner,new_element);
arguments[1].appendChild(new_element)}}}};descriptioner(originalNode.childNodes,temp);if(count<max){delete temp,current,max;
var temp=new Array();var max=maxLength;var current=0;return false}rescriptioner(temp,resultNode);var returnValue=current;
delete temp,current,max;var temp=new Array();var max=maxLength;var current=0;return returnValue};
function dateToISO8610(date){return[date.getFullYear(),"-",date.getMonth()+1,"-",date.getDate(),"T",date.toTimeString().split(" ")[0],"Z"].join("")
}function prettyDate(time){var date=new Date((time||"").replace(/-/g,"/").replace(/[TZ]/g," ")),diff=(((new Date()).getTime()-date.getTime())/1000),day_diff=Math.floor(diff/86400);
if(isNaN(day_diff)||day_diff<0){return}return day_diff==0&&(diff<30&&"just now"||diff<60&&"30 seconds ago"||diff<120&&"1 minute ago"||diff<3600&&Math.floor(diff/60)+" minutes ago"||diff<7200&&"1 hour ago"||diff<86400&&Math.floor(diff/3600)+" hours ago")||day_diff==1&&"Yesterday"||day_diff>1&&day_diff+" days ago"
}if(typeof jQuery!="undefined"){jQuery.fn.prettyDate=function(){return this.each(function(){var date=prettyDate(this.title);
if(date){jQuery(this).text(date)}})}};
var RealTimer_Component=function(options){var that=this;this.options={};this.options.targetDiv=arguments[0].targetDiv;
this.options.interval=arguments[0].interval||6000;this.options.timeOffset=arguments[0].timeOffset||0;
this.options.formatter=(typeof arguments[0].formatter=="function")?arguments[0].formatter:function(dateObject){return dateObject.toUTCString()
};this.options.context=arguments[0].context||false;var current=(new Date()).getTime();this.start=new Date(current-this.options.timeOffset);
$(this.options.targetDiv).html((this.options.context)?this.options.context.split("%").join(this.options.formatter(this.start)):this.options.formatter(this.start));
this.timer=setInterval(function(){that.update()},this.options.interval);return this};RealTimer_Component.prototype.update=function(){$(this.options.targetDiv).html((this.options.context)?this.options.context.split("%").join(this.options.formatter(this.start)):this.options.formatter(this.start))
};RealTimer_Component.prototype.reset=function(){var that=this;this.start=new Date();if(!this.timer){this.timer=setInterval(function(){that.update()
},this.options.interval)}};RealTimer_Component.prototype.stop=function(){clearInterval(this.timer);this.timer=false
};
if(!Ustream){var Ustream={}}if(!Ustream.Components){Ustream.Components={}}Ustream.Components.JsonPager=function(){this.options={pagerSelector:"",callbackFunc:function(){}}
};Ustream.Components.JsonPager.prototype.init=function(options){this.options=$.extend(this.options,options);
this.element=(typeof this.options.pagerSelector=="string")?$(this.options.pagerSelector):this.options.pagerSelector;
var that=this;this.handler=function(e){$(e).stopEvent();that.options.callbackFunc.call(this,$(this).attr("rel"))
};this.element.find("a").click(this.handler)};Ustream.Components.JsonPager.prototype.reset=function(){this.element.html("")
};Ustream.Components.JsonPager.prototype.update=function(prefixURL,pagerData){var that=this;var inner=[];
inner.push((pagerData.page>1)?['<li><a rel="',prefixURL,pagerData.pagePrev,'">« Prev</a> |</li>'].join(""):"<li>« Prev |</li>");
var pagesDisplay=pagerData.pages.length;var pages=array_reverse(pagerData.pages);while(pagesDisplay--){inner.push((pagerData.page==pages[pagesDisplay])?["<li>"+pages[pagesDisplay]+" |</li>"].join(""):['<li><a rel="',prefixURL,pages[pagesDisplay],'">'+pages[pagesDisplay]+"</a> |</li>"].join(""));
inner.push((pages[pagesDisplay]==1&&pagerData.page>6&&pagerData.pageCount>11)?"<li>... |</li>":"")}inner.push((pagerData.page<pagerData.pageCount)?['<li><a rel="',prefixURL,pagerData.pageNext,'">Next »</a></li>'].join(""):"<li>Next »</li>");
this.element.html(inner.join(""));this.element.find("a").unbind("click",this.handler);this.handler=function(e){$(e).stopEvent();
that.options.callbackFunc.call(this,$(this).attr("rel"))};this.element.find("a").click(this.handler)};
function Twitter_Component(){this.options={form:null,loading:null,name:null,pass:null,button:null,afterSendEvent:function(){}};
this.init=function(options){this.options=$.extend(this.options,options);$(this.options.button).click(function(){this.sendtwitter()
}.bind(this))};this.sendtwitter=function(){$(this.options.loading).css("display","");var form=$(this.options.form);
form.ajaxSubmit({success:function(responseText,statusText){$(this.options.loading).css("display","none");
$(this.options.name).attr("value","");$(this.options.pass).attr("value","");alert(responseText);this.options.afterSendEvent()
}.bind(this)})}};
var timer=false;function onMetaUpdate(str){str=truncateByLength(str,97,true);if(str===" "){if(timer){timer.stop()
}$("#taglineUpdated").html("This channel hasn't got an update yet.")}else{if(timer&&$("#taglineTextHolder").html()!=str){str=str.split(" ");
for(var i in str){if(str[i].length>49){var first=str[i].substr(0,49);var last=str[i].substr(49);str[i]=[first,last].join(" ")
}}str=str.join(" ");$("#taglineUpdated").html("updated just now");if(timer){timer.reset()}}else{if(!timer){var updated=$("#taglineUpdated").html().match("updated ([0-9])* ([minutehourweek]*)[s]?")||$("#taglineUpdated").html().match("updated just now");
if(typeof updated=="object"&&updated.length>1){switch(updated[2]){case"minute":var timerInterval=1000*60;
break;case"hour":var timerInterval=1000*60*60;break;default:var timerInterval=false}}else{var timerInterval=(updated[0]=="updated just now")?0:false
}str=str.split(" ");for(var i in str){if(str[i].length>49){var first=str[i].substr(0,49);var last=str[i].substr(49);
str[i]=[first,last].join(" ")}}str=str.join(" ");if($("#taglineTextHolder").html()!=str||timerInterval!==false){$("#taglineUpdated").html("updated just now");
timer=new RealTimer_Component({targetDiv:"#taglineUpdated",formatter:function(date){return prettyDate(dateToISO8610(date))
},timeOffset:(timerInterval)?updated[1]*timerInterval:0,interval:timerInterval,context:"updated %"})}}}}$("#taglineTextHolder").text(str)
};
function Show_Widget(){this.init=function(){var test=false;var widget=this;var highTimer=setInterval(function(){try{if(document.getElementById("viewer")){clearInterval(highTimer);
widget.viewer=document.getElementById("viewer")}}catch(e){$.console.debug(e)}},500);$("#socialTabs")[0].scrollTop=0;
var st=new Tab_Component();st.init({selector:"socialTabs",ajax:false,activeClass:"active",takeRelBeforeActiveClass:false,show:function(item){item.each(function(){var tabPage=$(this);
if(tabPage.attr("id")=="ircChat"){$("#socialTabs").css({height:421});tabPage.css({width:468,height:386,visibility:"visible"});
$("#chatContent object").css({visibility:"visible"});if(!chatLoaded){tabPage.load("/ajax/channel/chat/"+tabPage.attr("rel"),"",function(){swfobject.embedSWF(embedSWF,"chat","100%","100%","9.0.115",expressInstall,flashvars,params,attributes,function(e){chatLoaded=true;
$("#chatContent object,#chatContent embed").css({visibility:"visible"});setTimeout(function(){window.document.chat.focus()
},500)})})}}else{$("#chatContent object").css({visibility:"hidden"});$("#socialTabs").css({height:621});
tabPage.show().css({"margin-top":0,position:"absolute",top:35,zIndex:100})}})},hide:function(item){item.each(function(){var tabPage=$(this);
if(tabPage.attr("id")=="ircChat"){tabPage.css({visibility:"hidden"})}else{tabPage.hide()}})},onInit:function(component){$("#"+component.options.selector).css({overflow:"hidden",width:468,height:($("div#socialTabs > div")[component.options.initTabIndex].id=="twitter")?621:421,"margin-bottom":10});
$("div#twitter").css({"margin-top":0,position:"absolute",top:35,zIndex:($("div#socialTabs > div")[component.options.initTabIndex].id=="twitter")?100:10});
$("#socialTabs")[0].scrollTop=0},initTabIndex:defaultSocialTab});var t=new Twitter_Component();t.init({form:"#twitterform",loading:"#loadingTwitter",name:"#share4",pass:"#share5",button:"#sendTwitter"});
if($("#socialLinkbar li").length<1&&$(".showpageAd").children().length<1){$("#socialTabs").hide()}if(jQuery.fn.popupwindow){$("a#showPopup").popupwindow().click(function(e){$(e).stopEvent();
widget.viewer.javascriptControl("pause","")});$("a#showEmbed").click(function(e){$(e).stopEvent();widget.viewer.javascriptControl("showEmbeds","")
})}if(Ustream.Components.Truncate(jQuery("#ShowInfo .content")[0],540,jQuery("#ShowInfo .intro")[0])){$("#ShowInfo div.content").hide();
jQuery("#ShowInfo .intro").append('<br /><br /><a class="more" href="#more">more...</a>');$("#ShowInfo div.intro a.more:last").click(function(){$("#ShowInfo div.content").show();
$("#ShowInfo div.intro").hide()})}else{$("#ShowInfo div.content").show();$("#ShowInfo div.intro").hide()
}if(channelId!=1570887){(new Ustream.Components.StaticPager()).init({prevButton:".verticalScroll a.down",nextButton:".verticalScroll a.up",numbers:".verticalScroll p",item:"div.item",itemsPerPage:2,targetDiv:"#recommendedLive",sourceJSON:recommendedLiveData,sourceTpl:function(data,item){item.find(" > a").attr("href",data.url).find("img").attr("src",data.picture).attr("alt",data.channel_title);
item.find("h3 a").attr("href",data.url).html(data.channel_title);item.find("p strong").attr("title",data.tagline).html(data.tagline);
if(data.channel_viewersnow>0){item.find("p span").html(data.channel_viewersnow+" viewers |")}else{item.find("p span").html("")
}item.find("p a").attr("href","/discovery/live/"+data.category_urlid).html(data.category_name)},autoRotate:20000})
}var ChannelFeed=Ustream.Widgets.ChannelFeed;new ChannelFeed();$("#socialTabs")[0].scrollTop=0;setTimeout(function(){$("#socialTabs")[0].scrollTop=0
},1000);(new Ustream.Components.FlagContent()).init()}}function switchShowTab(target){if(target=="chat"){$("#socialTabs a.chat").click()
}else{if(target=="social"){$("#socialTabs a.twitter").click()}}}if(!Ustream){var Ustream={}}if(!Ustream.External){Ustream.External={}
};
if(!Ustream){var Ustream={}}if(!Ustream.Widgets){Ustream.Widgets={}}if(!Ustream.Components){Ustream.Components={}
}Ustream.Components.FeedItem=function(){this.data=arguments[0]||{};this.options=arguments[1]||{}};Ustream.Components.FeedItem.prototype={commentPager:{},getComments:function(e){$(e).stopEvent();
var item=$(e.target);if(item.hasClass("open")){item.removeClass("open").parent().find("ul").remove()}else{item.addClass("open");
this.loadComments(item.parent().parent())}},loadComments:function(item){if(typeof arguments[1]=="string"){var url=arguments[1]||false;
var loaderArgument=false}else{var loaderArgument=arguments[1]||false;var url=false}var item=item;var that=this;
var loading=loaderArgument||new Loading_Component();$.ajax({type:"get",url:url||["/ajax/comments/get",item.attr("class").replace(" hascomments",""),item.attr("rel"),10,1].join("/"),dataType:"json",beforeSend:function(){if(!loaderArgument){loading.init({targetDiv:item.find("div.comments"),imageBig:false})
}},success:function(response){loading.remove();var len=response.data.records.length;if(len>0){if(item.find("div.comments strong").length<1){item.append(that.hascommentsTpl.run({commentCount:1}));
item.addClass("hascomments").find("div.comments strong").addClass("open");item.find("div.comments > strong").click(that.getComments.bind(that))
}item.find("div.comments strong").html(["<b></b> ",response.data.pager.displayedRows," Comments"].join(""));
var records=array_reverse(response.data.records);var output=new Array();output.push("<ul>");while(len--){records[len].type=(that.data&&that.data[0])?that.data[0].type:response.data.mode;
records[len].targetId=response.data.id;records[len].ownerId=response.data.ownerId;if(!records[len].userPicture){records[len].userPicture=staticUrl+"images/profile_50x67.png"
}var tempDiv=$(["<div>",records[len].comment,"</div>"].join(""));records[len].comment=tempDiv.text();
delete tempDiv;output.push(this.subcommentTpl.run(records[len]))}output.push("</ul>");item.find("div.comments").find("ul").remove().end().append(output.join(""));
item.find("div.comments").append('<ul class="pager"></ul>');this.commentPager=new Ustream.Components.JsonPager();
this.commentPager.init({pagerSelector:item.find("div.comments ul.pager"),callbackFunc:function(url){that.loadComments(item,url)
}});if(response.data.pager.pageCount>1){if(response.data.pager.pageCount>1){this.commentPager.update(["/ajax/comments/get",item.attr("class").replace(" hascomments",""),item.attr("rel"),10,""].join("/"),response.data.pager)
}else{this.commentPager.reset()}}item.find("div.comments a.delete").click(this.delComment.bind(this));
item.find("div.comments a.approve").click(this.approveComment.bind(this))}}.bind(this)})},addComment:function(e){$(e).stopEvent();
var item=$(e.target).parent();if(window.loggedIn){if(item.siblings("div.addComment").length<1){var commentField=$('<div class="addComment"><textarea rows="5"></textarea><a class="submit">Submit</a> or <a class="cancel">cancel</a></div>');
item.parent().append(commentField);commentField.find("a.cancel").click(this.cancelComment.bind(this));
commentField.find("a.submit").click(this.sendComment.bind(this))}}else{Ustream.Events.dispatch(Ustream.Events.REQUIRELOGIN)
}},cancelComment:function(e){$(e).stopEvent();$(e.target).parent().remove()},sendComment:function(e){$(e).stopEvent();
var item=$(e.target).parent().parent();var loading=new Loading_Component();$.ajax({type:"post",url:["/ajax/comments/add",item.attr("class").replace(" hascomments",""),item.attr("rel")].join("/"),dataType:"json",data:{comment:item.find("textarea").val()},beforeSend:function(){loading.init({targetDiv:item,imageBig:false})
},success:function(response){if(response.success){if(!response.message){item.find("div.comments strong").html(["<b></b> ",parseInt(item.find("div.comments strong").text(),10)+1," Comments"].join(""))
}else{alert(response.message)}if(item.find("div.comments ul").length>0){this.loadComments(item,loading)
}else{if(item.find("div.comments").length<1){this.loadComments(item,loading)}else{loading.remove()}}item.find("textarea").val("").end().find("div.addComment").remove();
return}else{loading.remove();if(response.error){alert(response.error.message)}else{alert("Error!")}}}.bind(this)})
},delComment:function(e){$(e).stopEvent();var control=$(e.target);var target=control.parent();var loading=new Loading_Component();
var deleteUrl=control.attr("rel");loading.init({targetDiv:target});$.getJSON(deleteUrl,null,function(response){loading.remove();
if(response.success){target.fadeOut("slow",function(){if(target.siblings().andSelf().length==1){target.parent().parent().remove()
}else{target.parent().parent().find("strong.open").html(["<b></b> ",parseInt(target.parent().parent().find("strong.open").text(),10)-1," Comments"].join(""));
target.remove()}})}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}})},approveComment:function(e){$(e).stopEvent();
var control=$(e.target);var target=control.parent();var loading=new Loading_Component();var approveUrl=control.attr("rel");
loading.init({targetDiv:target});$.getJSON(approveUrl,null,function(response){loading.remove();if(response.success){control.remove()
}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}})},removeItem:function(e){$(e).stopEvent();
var control=$(e.target);var target=control.parent().parent();var loading=new Loading_Component();var deleteUrl=control.attr("rel");
var deleteItemConfirmation=$("#deleteItemConfirmation");if(deleteItemConfirmation.length>0){deleteItemConfirmation.dialog("destroy").remove()
}deleteItemConfirmation=$('<div id="deleteItemConfirmation" title="Delete this item?"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure?</p></div>').appendTo("body");
deleteItemConfirmation.dialog({bgiframe:true,resizable:false,width:340,modal:true,buttons:{"Remove from list":function(){loading.init({targetDiv:target});
$.getJSON(deleteUrl,null,function(response){loading.remove();if(response.success){target.fadeOut("slow",function(){target.remove()
})}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}});$(this).dialog("close")
},Cancel:function(){$(this).dialog("close")}}});deleteItemConfirmation.dialog("open")},addEventHandlers:function(element){element.find("div a.addComment").click(this.addComment.bind(this));
element.find("div.comments > strong").click(this.getComments.bind(this));element.find("div a.remove").click(this.removeItem.bind(this));
return element},itemTpl:new Tpl.Template(['<li class="<%= this.type %><%= (this.commentCount > 0 )?" hascomments":"" %>" rel="<%= this.itemId %>">','<a href="/<%= this.userName %>" class="userImg"><img src="<%=this.userThumbnailUrl %>" alt="<%= this.userName %>" class="user" /></a>',"<div><%= this.content %></div>","<%= this.comments %>","</li>"].join("")),hascommentsTpl:new Tpl.Template(['<div class="comments">',"<strong><b></b> <%= this.commentCount %> Comments</strong>","</div>"].join("")),subcommentTpl:new Tpl.Template(["<li>",'<a href="/<%= this.userName %>"><img src="<%= this.userPicture %>" alt="<%= this.userName %>" class="user" /></a>','<p><a href="/<%= this.userName %>" class="user"><%= this.userName %>:</a> <%= wordwrap(this.comment,22," ",true) %></p>','<%= this.dateFormated %><% if (this.ownerId == loggedInUserId){ %> · <a class="delete" rel="/ajax/comments/del/<%= this.type %>/<%= this.targetId %>/<%= this.id%>">Delete</a><% } %><% if (this.ownerId == loggedInUserId && this.userId != loggedInUserId && this.visible == 0 ){ %><a class="approve" rel="/ajax/comments/approve/<%= this.type %>/<%= this.targetId %>/<%= this.id%>"> · Approve</a><% } %>',"</li>"].join("")),contentTpl:"",fetchTemplate:function(){var data=this.data[0];
data.comments=(data.commentCount>0)?this.hascommentsTpl.run(data):"";data.content=this.contentTpl.run(data);
switch(data.type){case"tagline":case"event":if($("img.showChannelPicture").attr("src").indexOf("na.jpg")==-1){data.userThumbnailUrl=$("img.showChannelPicture").attr("src")
}else{if(!data.userThumbnailUrl){data.userThumbnailUrl=staticUrl+"images/profile_50x67.png"}}break;default:if(!data.userThumbnailUrl){data.userThumbnailUrl=staticUrl+"images/profile_50x67.png"
}}var tempDiv=$(["<div>",data.title,"</div>"].join(""));data.title=tempDiv.text();delete tempDiv;var compiledData=$(this.itemTpl.run(data));
compiledData=this.addEventHandlers(compiledData);return compiledData}};Ustream.Components.FeedItem.prototype.toString=function(){return"channelFeed.js - channel feed item component - %REVISION%"
};Ustream.Components.EventFeedItem=function(){Ustream.Components.EventFeedItem.superclass.constructor.call(this,arguments)
};extend(Ustream.Components.EventFeedItem,Ustream.Components.FeedItem);Ustream.Components.EventFeedItem.prototype.contentTpl=new Tpl.Template(['<h3><a href=""><%= this.title %></a> <span rel="<%= this.eventId %>">(<%= this.followerNr %> attending)</span></h3>','<span class="dateFormat long" rel="<%= this.eventStartPst %>"><%= this.eventStartPstFormated %></span><% if (this.userId == loggedInUserId){ %> · <a class="remove" rel="/ajax/channelfeed/removefeed/<%=channelId %>/event/<%= this.itemId%>">Delete</a><% } %>','<a href="/ajax/follow/event/add/<%= this.eventId %>/<%= this.eventStartPst %>" class="rsvp" style="<%= (this.userFollowing ? "display: none;" : "") %>" rel="<%= this.eventId %>">RSVP</a>','<span class="icon"></span>'].join(""));
Ustream.Components.EventFeedItem.prototype.addEventHandlers=function(element){element=Ustream.Components.CommentFeedItem.superclass.addEventHandlers(element);
element.find("> div a.rsvp").click(this.rsvpItem.bind(this));return element};Ustream.Components.EventFeedItem.prototype.rsvpItem=function(e){$(e).stopEvent();
var control=$(e.target);if(window.loggedIn){$.ajax({url:$(this).attr("href"),success:function(response){$("#ChannelFeed ul.feedItems").find("h3 span[rel="+control.attr("rel")+"]").each(function(i,obj){var followerNr=$(obj).text().split(" ");
followerNr=parseInt(followerNr[0].substr(1))+1;$(obj).text("("+followerNr+" attending)")});$("#ChannelFeed ul.feedItems").find("a[rel="+control.attr("rel")+"]").remove()
}})}else{Ustream.Events.dispatch(Ustream.Events.REQUIRELOGIN)}};Ustream.Components.TaglineFeedItem=function(){Ustream.Components.TaglineFeedItem.superclass.constructor.call(this,arguments)
};extend(Ustream.Components.TaglineFeedItem,Ustream.Components.FeedItem);Ustream.Components.TaglineFeedItem.prototype.contentTpl=new Tpl.Template(['<h3><a href="/<%= this.userName %>"><%= this.userName %>:</a> <%= wordwrap(this.title,22," ",true) %></h3>',"live broadcast started <br />",'<%= this.createdAtFormated %> · <a class="addComment">Comment</a><% if (this.userId == loggedInUserId){ %> · <a class="remove" rel="/ajax/channelfeed/removefeed/<%= channelId %>/tagline/<%= this.itemId%>">Delete</a><% } %>','<span class="icon"></span>'].join(""));
Ustream.Components.VideoFeedItem=function(){Ustream.Components.VideoFeedItem.superclass.constructor.call(this,arguments)
};extend(Ustream.Components.VideoFeedItem,Ustream.Components.FeedItem);Ustream.Components.VideoFeedItem.prototype.getDeleteUrl=function(target){return"/ajax/recorded/del/"+target.attr("rel")
};Ustream.Components.VideoFeedItem.prototype.contentTpl=new Tpl.Template(['<h3><a href="/recorded/<%= this.videoId %>"><%= this.userName %>: <%= this.title %></a></h3>','<a href="/recorded/<%=this.videoId %>" class="video"><img src="<%= this.thumbnailUrl %>" alt="<%= this.userName %>: <%= this.title %>" /> <span></span></a>','Video from <%= (this.videoSource == "mobile")? "Ustream Mobile Recorder":"Ustream" %><br />','<%= (this.videoSource == "mobile")? "uploaded":"recorded" %> <%= this.createdAtFormated %> · <a class="addComment">Comment</a><% if (this.userId == loggedInUserId || this.ownerId == loggedInUserId){ %> · <a class="remove" rel="/ajax/channelfeed/removefeed/<%= channelId %>/video/<%= this.itemId%>">Delete</a><% } %>','<span class="icon"></span>'].join(""));
Ustream.Components.VideoFeedItem.prototype.removeItem=function(e){$(e).stopEvent();var control=$(e.target);
var target=control.parent().parent();var loading=new Loading_Component();var deleteUrl=control.attr("rel");
var deleteVideoUrl=this.getDeleteUrl(target);var deleteItemConfirmation=$("#deleteItemConfirmation");
if(deleteItemConfirmation.length>0){deleteItemConfirmation.dialog("destroy").remove()}deleteItemConfirmation=$('<div id="deleteItemConfirmation" title="Delete this item?"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure?</p></div>').appendTo("body");
deleteItemConfirmation.dialog({bgiframe:true,resizable:false,width:340,modal:true,buttons:{Delete:function(){loading.init({targetDiv:target});
$.getJSON(deleteVideoUrl,null,function(response){loading.remove();if(response.success){target.fadeOut("slow",function(){target.remove()
})}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}});$(this).dialog("close")
},"Remove from list":function(){loading.init({targetDiv:target});$.getJSON(deleteUrl,null,function(response){loading.remove();
if(response.success){target.fadeOut("slow",function(){target.remove()})}else{if(response.error){alert(response.error.message)
}else{alert("Error!")}}});$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}});deleteItemConfirmation.dialog("open")
};Ustream.Components.MomentFeedItem=function(){arguments[0].type="highlight";Ustream.Components.MomentFeedItem.superclass.constructor.call(this,arguments)
};extend(Ustream.Components.MomentFeedItem,Ustream.Components.FeedItem);Ustream.Components.MomentFeedItem.prototype.getDeleteUrl=function(target){return"/ajax/highlight/delhighlight/"+target.attr("rel")
};Ustream.Components.MomentFeedItem.prototype.contentTpl=new Tpl.Template(['<h3><a href="/recorded/<%= this.videoId %>/highlight/<%= this.momentId %>"><%= this.userName %>: <%= this.title %></a></h3>','<a href="/recorded/<%= this.videoId %>/highlight/<%= this.momentId %>" class="video"><img src="<%= this.thumbnailUrl %>" alt="<%= this.userName %>: <%= this.title %>" /> <span></span></a>','Video from <%= (this.videoSource == "mobile")? "Ustream Mobile Recorder":"Ustream" %><br />','<%= (this.videoSource == "mobile")? "uploaded":"recorded" %> <%= this.createdAtFormated %> · <a class="addComment">Comment</a><% if (this.userId == loggedInUserId || this.ownerId == loggedInUserId){ %> · <a class="remove" rel="/ajax/channelfeed/removefeed/<%= channelId %>/moment/<%= this.momentId %>">Delete</a><% } %>','<span class="icon"></span>'].join(""));
Ustream.Components.MomentFeedItem.prototype.removeItem=function(e){$(e).stopEvent();var control=$(e.target);
var target=control.parent().parent();var loading=new Loading_Component();var deleteUrl=control.attr("rel");
var deleteVideoUrl=this.getDeleteUrl(target);var deleteItemConfirmation=$("#deleteItemConfirmation");
if(deleteItemConfirmation.length>0){deleteItemConfirmation.dialog("destroy").remove()}deleteItemConfirmation=$('<div id="deleteItemConfirmation" title="Delete this item?"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure?</p></div>').appendTo("body");
deleteItemConfirmation.dialog({bgiframe:true,resizable:false,width:340,modal:true,buttons:(this.data[0].ownerId==loggedInUserId)?{Delete:function(){loading.init({targetDiv:target});
$.getJSON(deleteVideoUrl,null,function(response){loading.remove();if(response.success){target.fadeOut("slow",function(){target.remove()
})}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}});$(this).dialog("close")
},"Remove from list":function(){loading.init({targetDiv:target});$.getJSON(deleteUrl,null,function(response){loading.remove();
if(response.success){target.fadeOut("slow",function(){target.remove()})}else{if(response.error){alert(response.error.message)
}else{alert("Error!")}}});$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}:{Delete:function(){loading.init({targetDiv:target});
$.getJSON(deleteVideoUrl,null,function(response){loading.remove();if(response.success){target.fadeOut("slow",function(){target.remove()
})}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}});$(this).dialog("close")
},Cancel:function(){$(this).dialog("close")}}});deleteItemConfirmation.dialog("open")};Ustream.Components.CommentFeedItem=function(){Ustream.Components.CommentFeedItem.superclass.constructor.call(this,arguments)
};extend(Ustream.Components.CommentFeedItem,Ustream.Components.FeedItem);Ustream.Components.CommentFeedItem.prototype.contentTpl=new Tpl.Template(['<p><a href="/<%= this.userName %>" class="user"><%= this.userName %>:</a> ','<% if (typeof this.attach.type != "undefined") { %>','<span class="title"><%= wordwrap(this.title,22," ",true) %></span>','<br /><a href="/recorded/<%=this.attach.targetId %>" class="video" rel="<%=this.attach.targetId %>"><img src="<%= this.attach.picture %>" alt="" /> <span></span></a>',"Video Comment","<% } else { %>",'<%= wordwrap(this.title,22," ",true) %>',"<% } %>","</p>",'<%= this.createdAtFormated %> · <a class="addComment">Comment</a><% if (this.ownerId == loggedInUserId){ %> · <a class="remove" rel="/ajax/comments/del/<%= channelFeedSource %>/<%= this.targetId %>/<%= this.itemId%>">Delete</a><% } %><% if (this.ownerId == loggedInUserId && this.userId != loggedInUserId && this.visible == 0 ){ %><a class="approve" rel="/ajax/comments/approve/<%= channelFeedSource %>/<%= this.targetId %>/<%= this.itemId%>"> · Approve</a><% } %>'].join(""));
Ustream.Components.CommentFeedItem.prototype.addEventHandlers=function(element){element=Ustream.Components.CommentFeedItem.superclass.addEventHandlers(element);
element.find("> div a.approve").click(this.approveItem.bind(this));element.find("> div a.video").click(this.playVideo.bind(this));
return element};Ustream.Components.CommentFeedItem.prototype.approveItem=function(e){$(e).stopEvent();
var control=$(e.target);var target=control.parent();var loading=new Loading_Component();var approveUrl=control.attr("rel");
loading.init({targetDiv:target});$.getJSON(approveUrl,null,function(response){loading.remove();if(response.success){control.remove()
}else{if(response.error){alert(response.error.message)}else{alert("Error!")}}})};Ustream.Components.CommentFeedItem.prototype.playVideo=function(e){$(e).stopEvent();
var target=$(e.target).closest("a.video");var item=target.parent();$("#VideoFeedPlayerData").html("").append("<strong>"+item.find("a").eq(0).text()+"</strong>").append("<br />").append(item.text().replace(item.find("a").eq(0).text(),""));
viewVideoDialog(target.attr("rel"))};Ustream.Widgets.ChannelFeed=function(){var that=this;if(loggedIn&&loggedInUserId>0){$("#ChannelFeed div.feedControl form textarea").focus(function(){var item=$(this);
item.val((item.val()==item.attr("title"))?"":item.val()).next().show()}).blur(function(){var item=$(this);
item.val((item.val()==item.attr("title")||item.val()=="")?item.attr("title"):item.val())});$("#ChannelFeed div.feedControl form textarea").keyup(function(e){var rowsNeeded=1;
var arr=$("#ChannelComment").val().split("\n");var arrLen=arr.length;while(arrLen--){rowsNeeded+=Math.ceil(arr[arrLen].length/70)||1
}if(rowsNeeded>0&&$(this).attr("rows")!=rowsNeeded){$(this).attr("rows",rowsNeeded)}});$("#ChannelFeed div.feedControl a.videocomment").click(function(e){$(e).stopEvent();
that.initVideoComment()});var submitAction=function(e){$(e).stopEvent();if($("#ChannelComment").val()==$("#ChannelComment").attr("title")||$("#ChannelComment").val()==""){return false
}that.addComment("/ajax/comments/add/"+$("#ChannelFeed div.feedControl form").attr("rel"),{comment:$("#ChannelComment").val()});
$("#ChannelFeed div.feedControl form textarea").blur()};$("#ChannelFeed div.feedControl form").submit(submitAction).find("a.submit").click(submitAction)
}else{$("#ChannelFeed div.feedControl form textarea").focus(function(e){$(e).stopEvent();Ustream.Events.dispatch(Ustream.Events.REQUIRELOGIN);
return false});$("#ChannelFeed div.feedControl form a.submit,#ChannelFeed div.feedControl a.videocomment").click(function(e){$(e).stopEvent();
Ustream.Events.dispatch(Ustream.Events.REQUIRELOGIN);return false})}$("#ChannelFeed ul.feedTabs li").click(function(){var item=$(this);
$("#ChannelFeedActive").animate({left:item.position().left+6,width:item.outerWidth()+3},"fast");item.siblings().andSelf().removeClass("active");
item.addClass("active");if(item.hasClass("video")){if($("#ChannelFeed .videoSubSelector").length<1){$("#ChannelFeed ul.feedItems").before(['<div class="videoSubSelector all" style="height:0; overflow: hidden;">','<a href="',item.attr("rel").split("video").join("video;moment"),'" class="all active">All</a>','<a href="',item.attr("rel").split("video").join("video"),'" class="videos">Videos</a>','<a href="',item.attr("rel").split("video").join("moment"),'" class="highlights">Highlights</a></div>'].join(""));
$("#ChannelFeed .videoSubSelector").animate({height:42},"fast")}else{$("#ChannelFeed .videoSubSelector")[0].className="videoSubSelector";
$("#ChannelFeed .videoSubSelector").addClass("all").find(".active").removeClass("active").end().find(".all").addClass("active")
}}else{$("#ChannelFeed .videoSubSelector").remove()}that.loadItems(item.attr("rel"))});$(".videoSubSelector a").live("click",function(e){$(e).stopEvent();
$(this).parent()[0].className="videoSubSelector";$(this).siblings(".active").removeClass("active").end().addClass("active").parent().addClass($(this)[0].className);
that.loadItems($(this).attr("href"))});try{$("#ChannelFeedActive").css({left:$("#ChannelFeed ul.feedTabs li.active").position().left+6,width:$("#ChannelFeed ul.feedTabs li.active").outerWidth()+3})
}catch(e){}var div=$('<div id="VideoRecorder" title="" style="position:relative; width: 480px; height:416px; display:none;"></div>');
div.append('<div style="width: 480px; height:366px; z-index: 1;"><div id="RecorderLite" style="width: 480px; height:360px;"></div></div><div id="RecorderLiteData" style="font-size: 11px;"></div>');
$("#content").append(div);var div=$('<div id="VideoFeedPlayer" title="" style="position:relative; width: 480px; height:416px; display:none;"></div>');
div.append('<div style="width: 480px; height:366px; z-index: 1;"><div id="ViewLite" style="width: 480px; height:360px;"></div></div><div id="VideoFeedPlayerData" style="font-size: 11px;"></div>');
$("#content").append(div);if($("div.feedContent > ul.pager").length<1){$("div.feedContent").append('<ul class="pager"></ul>')
}this.pager=new Ustream.Components.JsonPager();this.pager.init({pagerSelector:"div.feedContent > ul.pager",callbackFunc:function(url){that.loadItems(url)
}});var EventFeedItem=Ustream.Components.EventFeedItem;var TaglineFeedItem=Ustream.Components.TaglineFeedItem;
var CommentFeedItem=Ustream.Components.CommentFeedItem;var VideoFeedItem=Ustream.Components.VideoFeedItem;
var MomentFeedItem=Ustream.Components.MomentFeedItem;var staticItems=jQuery.makeArray($("#ChannelFeed ul.feedItems li"));
var staticItemsLen=staticItems.length;while(staticItemsLen--){switch(staticItems[staticItemsLen].className.replace(" hascomments","")){case"event":this.items[staticItemsLen]=new EventFeedItem();
break;case"comment":this.items[staticItemsLen]=new CommentFeedItem();break;case"tagline":this.items[staticItemsLen]=new TaglineFeedItem();
break;case"video":this.items[staticItemsLen]=new VideoFeedItem();break;case"highlight":case"moment":this.items[staticItemsLen]=new MomentFeedItem({type:"highlight"});
break}try{this.items[staticItemsLen].addEventHandlers($(staticItems[staticItemsLen]))}catch(e){}}};Ustream.Widgets.ChannelFeed.prototype.toString=function(){return"channelFeed.js - channel feed widget - %REVISION%"
};Ustream.Widgets.ChannelFeed.prototype.pager={};Ustream.Widgets.ChannelFeed.prototype.items=[];Ustream.Widgets.ChannelFeed.prototype.clearItems=function(){var len=this.items.length;
while(this.items.length){var k=this.items.pop();delete k}this.items=new Array()};Ustream.Widgets.ChannelFeed.prototype.loadItems=function(url){var that=this;
var EventFeedItem=Ustream.Components.EventFeedItem;var TaglineFeedItem=Ustream.Components.TaglineFeedItem;
var CommentFeedItem=Ustream.Components.CommentFeedItem;var VideoFeedItem=Ustream.Components.VideoFeedItem;
var MomentFeedItem=Ustream.Components.MomentFeedItem;var loaderArgument=arguments[1]||false;$.ajax({url:url,dataType:"json",beforeSend:function(){$("#ChannelFeed ul.feedItems").animate({opacity:0},"fast");
$("#ChannelFeed ul.feedItems").css("height",$("#ChannelFeed ul.feedItems").outerHeight())},success:function(data){that.clearItems();
if(data.success){if(data.feed){var len=data.feed.length||0;$("#ChannelFeed ul.feedItems").html("");if(len>0){var feed=array_reverse(data.feed);
var output=new Array();while(len--){switch(feed[len].type){case"event":that.items[len]=new EventFeedItem(feed[len]);
break;case"comment":that.items[len]=new CommentFeedItem(feed[len]);break;case"tagline":that.items[len]=new TaglineFeedItem(feed[len]);
break;case"video":that.items[len]=new VideoFeedItem(feed[len]);break;case"moment":that.items[len]=new MomentFeedItem(feed[len]);
break}output.push(that.items[len].fetchTemplate())}output=jQuery.makeArray(output);$(output).appendTo("#ChannelFeed ul.feedItems");
if(data.pager.pageCount>1){url=url.split("/");url.pop();url.push("");that.pager.update(url.join("/"),data.pager)
}else{that.pager.reset()}}else{$("#ChannelFeed ul.feedItems").html("");if(url.indexOf("comments")>-1){var msg="Be the first to leave a comment!"
}else{var msg="There are no items to display yet."}var output='<li style="min-height: 30px; margin-top: 20px;" class="emptyItem">'+msg+"</li>";
$(output).appendTo("#ChannelFeed ul.feedItems");that.pager.reset()}}else{$("#ChannelFeed ul.feedItems").html("");
if(url.indexOf("comments")>-1){var msg="Be the first to leave a comment!"}else{var msg="There are no items to display yet."
}var output='<li style="min-height: 30px; margin-top: 20px;" class="emptyItem">'+msg+"</li>";$(output).appendTo("#ChannelFeed ul.feedItems");
that.pager.reset()}$("#ChannelFeed ul.feedItems").animate({opacity:1},"slow");$("#ChannelFeed ul.feedItems").css("height","auto")
}else{$("#ChannelFeed ul.feedItems").html("");that.pager.reset();$("#ChannelFeed ul.feedItems").animate({opacity:1},"slow");
$("#ChannelFeed ul.feedItems").css("height","auto")}}})};Ustream.Widgets.ChannelFeed.prototype.channelSelectorTimer=true;
Ustream.Widgets.ChannelFeed.prototype.initVideoComment=function(){var that=this;var videoCommentChannelId_cookie=$.cookie("videoCommentChannelId")||false;
videoCommentChannelId_cookie=(videoCommentChannelId_cookie&&videoCommentChannelId_cookie.split("::")[0]==loggedInUserId)?videoCommentChannelId_cookie.split("::")[1]:false;
this.channelSelectorTimer=true;if((broadcastProperties&&broadcastProperties.length==1)||videoCommentChannelId_cookie){this.videoCommentChannelId=(videoCommentChannelId_cookie)?videoCommentChannelId_cookie:broadcastProperties[0].channelId;
this.displayVideoComment(this.videoCommentChannelId)}else{if(broadcastProperties&&broadcastProperties.length>1){var channelSelector=$("#channelSelector");
if(channelSelector.length<1){channelSelector=$("#broadcastSelector").clone().attr("id","channelSelector").appendTo("body");
channelSelector.find("p").text("");channelSelector.children().attr("id","");channelSelector.find("select").after('<br /><label for="rememberMyVideoCommentChannel"><input type="checkbox" id="rememberMyVideoCommentChannel" /> Use this channel for all my video comments</label>');
channelSelector.dialog({title:"Select channel to record your videocomment",bgiframe:true,modal:true,autoOpen:false,width:400,buttons:{Cancel:function(){channelSelector.dialog("close")
},"Next »":function(){that.videoCommentChannelId=channelSelector.find("select").val();if($("#rememberMyVideoCommentChannel:checked")[0]){var date=new Date();
date.setTime(date.getTime()+(12*365*24*60*60*1000));$.cookie("videoCommentChannelId",[loggedInUserId,that.videoCommentChannelId].join("::"),{path:"/",expires:date})
}that.displayVideoComment(that.videoCommentChannelId);channelSelector.dialog("close")}},open:function(){$("embed, object").css("visibility","hidden");
$("#broadcastSelectorDropdown").change()},close:function(){if(that.channelSelectorTimer){$("embed, object").css("visibility","visible")
}}})}channelSelector.dialog("open")}else{var channelCreationInfo=$("#channelCreationInfo");if(channelCreationInfo.length<1){channelCreationInfo=$('<div id="channelCreationInfo" title="Channel created"><p style="margin-bottom: 10px;"><span class="ui-icon ui-icon-info" style="float:left; margin:0 7px 20px 0;"></span> </p><p class="progress">Please wait ... </p></div>').appendTo("body");
channelCreationInfo.dialog({bgiframe:true,resizable:false,height:170,autoOpen:false,modal:true,open:function(){channelCreationInfo.parent().find("button").css("visibility","hidden");
$.ajax({type:"get",url:"/ajax/mybroadcasts/channel/create-default.json",dataType:"json",success:function(response){if(response.success){that.videoCommentChannelId=response.channelId;
broadcastProperties.push({categoryName:"",channelId:response.channelId,channelName:response.title});channelCreationInfo.find("p.progress").html(["Your show '<em>",response.title,'</em>\' has been created, click "Continue".'].join(""));
channelCreationInfo.parent().find("button").css("visibility","visible")}else{channelCreationInfo.find("p.progress").html(["Sorry, could not create your channel, please try again later."].join(""))
}}})},buttons:{Continue:function(){that.displayVideoComment(that.videoCommentChannelId);$(this).dialog("close")
}},close:function(){if(that.channelSelectorTimer){$("embed, object").css("visibility","visible")}}})}channelCreationInfo.dialog("open")
}}};Ustream.Widgets.ChannelFeed.prototype.displayVideoComment=function(__channelId){var that=this;this.channelSelectorTimer=false;
$("#RecorderLiteData").html("").html(['<div id="recorderLiteSettings" rel="',__channelId,'" style="height: 18px;">','<div class="startstop">','<span id="startRecordBtn" onClick="if(!$(this).hasClass(\'disabled\'))recorderLite.flash.startRecord()" class="control"><b>●</b> Record</span>','<span id="stopRecordBtn" onClick="if(!$(this).hasClass(\'disabled\'))recorderLite.flash.stopRecord()" class="control"><b>■</b> Stop Recording</span>',"</div>",'<div class="settings">','<select id="cameraNamesCBox" onChange="recorderLite.changeDevice(this.options[this.selectedIndex].text,\'Camera\')"></select>','<select id="microphoneNamesCBox" onChange="recorderLite.changeDevice(this.options[this.selectedIndex].text,\'Microphone\')"></select>',"</div>",'<div class="previewSave">','<span id="startPreviewBtn" onClick="if(!$(this).hasClass(\'disabled\'))recorderLite.flash.startPreview()" class="control">Preview</span>','<span id="saveRecordBtn" onClick="if(!$(this).hasClass(\'disabled\'))recorderLite.sendSaveRecord()" class="control">Save</span>','<span id="cancelRecordBtn" onClick="if(!$(this).hasClass(\'disabled\'))recorderLite.flash.cancelRecord()" class="control"><b>●</b> Re-record</span>',"</div>",'<a class="settings">settings</a>','<div class="finish">Enter your comment: <br /><textarea></textarea><br class="clear" /><button class="button">Submit</button></div>',"</div>"].join(""));
$("#VideoRecorder").dialog({bgiframe:true,modal:true,height:466,width:508,autoOpen:true,close:function(){$("embed, object").css("visibility","visible");
try{recorderLite.flash.destroy()}catch(e){}$("#VideoRecorder").dialog("destroy")},open:function(event,ui){$("embed, object").css("visibility","hidden");
recorderLite.loaded(function(videoId,data){that.addComment(["/ajax/comments/add-attach/",$("#ChannelFeed .feedControl form").attr("rel"),"/video/",videoId].join(""),data)
},"Re: "+$("#taglineTextHolder").text())}})};Ustream.Widgets.ChannelFeed.prototype.addComment=function(url,data){var that=this;
$.ajax({type:"post",url:url,dataType:"json",data:data,beforeSend:function(){},success:function(response){if(response.success==true){that.loadItems($("#ChannelFeed ul.feedTabs li.active").attr("rel"));
$("#ChannelComment").val($("#ChannelComment").attr("title")).attr("rows",2);if(response.message){alert(response.message)
}}else{$("#ChannelFeed ul.feedItems").fadeIn("fast");if(response.error){alert(response.error.message)
}else{alert("Error!")}}}})};var recorderLite=function(){return{returnCallback:null,loaded:function(_callback,_title){this.returnCallback=_callback;
this.videoTitle=_title;this.disableGui();swfobject.embedSWF("/flash/recorderlite.swf","RecorderLite","480","360","10.0.0",staticUrl+"swf/expressInstall.swf",{cid:$("#recorderLiteSettings").attr("rel"),sid:sessionId},{allowscriptaccess:"always",wmode:"opaque"});
$("#RecorderLiteData a.settings").toggle(function(){$("#RecorderLiteData div.settings").show();$("#RecorderLiteData a.settings").addClass("on")
},function(){$("#RecorderLiteData div.settings").hide();$("#RecorderLiteData a.settings").removeClass("on")
})},flash:null,ready:function(id){recorderLite.flash=swfobject.getObjectById("RecorderLite")},multipleInstances:function(){alert("You cannot record a video comment while your are broadcasting")
},sessionError:function(){alert("sessionError")},alreadyOnline:function(){alert("You cannot record a video comment while your are broadcasting")
},cameraNames:function(){this.fillDeviceNames("camera")},microphoneNames:function(){this.fillDeviceNames("microphone")
},fillDeviceNames:function(type){var names=recorderLite.flash[type+"Names"]();for(var c=0;c<names.length;
c++){$("#"+type+"NamesCBox").append("<option>"+names[c]+"</option>")}$("#"+type+"NamesCBox").removeAttr("disabled")
},cameraName:function(){this.updateSelectedDeviceName("camera")},microphoneName:function(){this.updateSelectedDeviceName("microphone")
},updateSelectedDeviceName:function(type){var cb=$("#"+type+"NamesCBox")[0];var selectedDeviceName=recorderLite.flash[type+"Name"]();
for(var c=0;c<cb.options.length;c++){if(cb.options[c].text==selectedDeviceName){break}}cb.selectedIndex=c
},changeDevice:function(name,type){recorderLite.flash["set"+type+"Name"](name)},createRecorder:function(){$("#destroyBtn, #startRecordBtn, #RecorderLiteData a.settings").show();
$("#stopRecordBtn").hide();$("#RecorderLiteData div.settings, #RecorderLiteData .previewSave").hide();
$("#RecorderLiteData a.settings").removeClass("on")},waitForRecord:function(){$("#startRecordBtn").addClass("disabled")
},startRecord:function(){$("#startRecordBtn").hide().removeClass("disabled");$("#stopRecordBtn").removeClass("disabled").show();
this.startCounter()},stopRecord:function(){$("#startRecordBtn, #stopRecordBtn").addClass("disabled");
this.stopCounter()},startPreview:function(){$("#startPreviewBtn").addClass("disabled")},recordReady:function(){$("#startPreviewBtn, #saveRecordBtn, #cancelRecordBtn").removeClass("disabled").show();
$("#RecorderLiteData div.startstop").hide();$("#RecorderLiteData div.previewSave").show();$("#RecorderLiteData a.settings").removeClass("on");
$("#RecorderLiteData div.settings").hide()},cancelRecord:function(){this.stopCounter();this.restoreGui()
},sendSaveRecord:function(){var that=this;$("#RecorderLiteData div.finish").show();if($("#ChannelComment").val()!=$("#ChannelComment").attr("title")){$("#RecorderLiteData div.finish textarea").val($("#ChannelComment").val())
}$("#RecorderLiteData div.finish .button").click(function(){if($("#RecorderLiteData div.finish textarea").val()==""){return false
}var loading=new Loading_Component();loading.init({targetDiv:$("#RecorderLiteData div.finish")});that.flash.saveRecord($("#RecorderLiteData div.finish textarea").val(),that.videoTitle,false,["video","comment"])
})},saveRecord:function(id){this.returnCallback.call(this,id,{comment:$("#RecorderLiteData div.finish textarea").val()});
setTimeout(function(){$("#VideoRecorder").dialog("destroy");$("embed, object").css("visibility","visible")
},1000)},destroy:function(){this.stopCounter();this.disableGui();$("#VideoRecorder").dialog("destroy");
$("embed, object").css("visibility","visible")},disableGui:function(){$(".finish, #startRecordBtn,#stopRecordBtn,#destroyBtn, .settings, #startPreviewBtn,#saveRecordBtn,#cancelRecordBtn").hide()
},restoreGui:function(){this.stopCounter();$("#startPreviewBtn,#saveRecordBtn,#cancelRecordBtn").addClass("disabled");
$("#RecorderLiteData div.settings, #RecorderLiteData .previewSave").hide();$("#RecorderLiteData div.startstop").find(".control").andSelf().show();
$("#startRecordBtn").removeClass("disabled").show();$("#stopRecordBtn").hide()},counterInterval:null,counterState:0,startCounter:function(){$("#stopRecordBtn").after('<span id="recordCounter">00:00</span>');
this.counterState=0;this.counterInterval=setInterval(function(){recorderLite.counterState++;if(recorderLite.counterState==60){recorderLite.flash.stopRecord();
return}var formattedTime="00:";if(recorderLite.counterState>9){formattedTime+=recorderLite.counterState
}else{formattedTime+="0"+recorderLite.counterState}$("#recordCounter").text(formattedTime);document.getElementById("recordCounter").nodeValue=formattedTime
},1000)},stopCounter:function(){if(this.counterInterval){clearInterval(this.counterInterval)}$("#recordCounter").remove()
}}}();function viewVideoDialog(videoId){$("#VideoFeedPlayer").dialog({bgiframe:true,modal:true,height:466,width:508,beforeclose:function(){$("#viewer, #chat").css("visibility","visible")
},close:function(){$("#VideoFeedPlayer").dialog("destroy")},open:function(event,ui){$("#viewer, #chat").css("visibility","hidden");
var flashvars={vid:videoId,vrsl:vrsl};var params={wmode:"opaque",allowscriptaccess:"always"};var attributes={bgcolor:"#000000"};
var expressInstall=staticUrl+"swf/expressInstall.swf";swfobject.embedSWF(viewerlite_swf,"ViewLite","480","360","9.0.115",expressInstall,flashvars,params,attributes)
}})};