if(typeof(Function.prototype.bind)=='undefined'){Function.prototype.bind=function bind(){var __method=this;var args=Array.apply(null,arguments);object=args.shift();return function(){return __method.apply(object,args.concat(Array.apply(null,arguments)));}}}
(function()
{function size_image()
{var img=this;var piw=jQuery(img.parentNode).innerWidth();var pih=jQuery(img.parentNode).innerHeight();var iw=img.width;var ih=img.height;var ir=(ih==0?1:iw/ih);var nw=piw;var nh=Math.floor(nw/ir);if(nh>pih)
{nh=pih;nw=Math.floor(nh*ir)}
var ph=piw-nw;var pv=pih-nh;img.style.paddingTop=Math.ceil(pv/2)+'px';img.style.paddingBottom=Math.floor(pv/2)+'px';img.style.paddingLeft=Math.ceil(ph/2)+'px';img.style.paddingRight=Math.floor(ph/2)+'px';img.style.width=nw+'px';img.style.height=nh+'px';img.style.visibility='visible';}
function setup_image(arg_image,arg_src)
{arg_image.onload=size_image;arg_image.src=arg_src;}
jQuery.fn.zv_autosize=function(arg_src)
{this.each(function()
{var imgref=this;imgref.style.visibility='hidden';if(!arg_src)size_image.apply(imgref);else if(imgref.parentNode&&jQuery(imgref.parentNode).innerWidth()>0)setup_image(imgref,arg_src);else setTimeout(function(){setup_image(imgref,arg_src);},0);});return this;}})();function setupDropDowns(){var _oldhide=$.fn.hide;var _oldshow=$.fn.show;$.fn.hide=function(){$(this).trigger('hide');return _oldhide.apply(this,arguments);}
$.fn.show=function(){$(this).trigger('show');return _oldshow.apply(this,arguments);}
$("div.drop-holder").each(function(){var div=$(this);var link=$("a:first",div);var menus=$("div.drop-menu",div);var cnt=0;menus.each(function(){var m=$(this);m.bind("hide",function(){m.unbind("clickoutside");});m.bind("show",function(){m.bind("clickoutside",function(event){if(!$(event.target).equals(link)){m.hide();link.toggleClass("clicked",false);}});});m.click(function(event){event.stopPropagation();});m.hide();m.removeClass("none");$("a.close-dropdown",m).click(function(){m.hide();link.toggleClass("clicked",false);return false;});if(cnt++==0){link.click(function(){m.toggle();link.toggleClass("clicked");if(m.is(":visible")){$("div.drop-menu").each(function(){var omenu=$(this);if(omenu.get(0)!=m.get(0)&&omenu.is(":visible")){omenu.hide();var parent=omenu.parent();plink=$("a:first",parent);if(plink!=link){plink.toggleClass("clicked",false);}else{}}});}
return false;});}});});}
if(typeof window.console=='undefined'){window.console={log:function(){}};}
ZvCssCompatibility=new function()
{this.APPLE_IOS=(navigator.userAgent.match(/\(iPod;|\(iPhone;|\(iPad;/i)?true:false);this.ANDROID=(navigator.userAgent.match(/\Android [0-9]+(\.[0-9]+)*;/i)?true:false);this.NO_SELECT_MECHANISM=this.APPLE_IOS||this.ANDROID;}
if(!window.atob)
{var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";window.atob=function(input){var output='';var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output+=(String.fromCharCode(chr1));if(enc3!=64){output+=(String.fromCharCode(chr2));}
if(enc4!=64){output+=(String.fromCharCode(chr3));}}
return output;}}
if(!window.btoa)
{var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";window.btoa=function(input){var output='';var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output+=(keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4));}
return output;}}
var mouseInsideProgressBox=false;var postLoginAction=null;var favorites={};var queued={};var viewhistory={};$(document).ready(function(){var searchbox=$("input#q");searchbox.focus(function(){if(this.value=="search"||this.value==""){this.value="";}});searchbox.blur(function(){if(this.value==""){this.value="search";}});searchbox.autocomplete({source:"/completions.json",minLength:3,focus:function(event,ui){return false;},select:function(event,ui){document.location=ui.item.url;return false;}});$(".sharethis").click(showShareDialog);$("a.share").click(showShareDialog);$("#signin").click(displayLoginBox);$("img.centered").each(centerImage);$("div.imageholder").each(imageScaler);$("a.whatsthis").click(showWhatsThis);$("a.settings").click(showSettings);$("a.progress-small,a.progress-big").click(showViewedIndicatorMenu);initExternalClickTracking();setupViewedIndicatorClasses();if((typeof selectedTab!='undefined')&&selectedTab){$("ul#navigation a."+selectedTab).addClass("selected");}
$("input[type='text'][init]").initTextBox();loadUserData();setupXlLink();setupSuggestionArea();setupFreeForMeArea();$("a.logo").focus();});function animateButWait(){$("div#butwait").animate({"left":"0px"},1000);}
function setupFreeForMeArea(){$("a#butwait-newaccount").click(function(){$('div#butwait').hide();displayLoginBox();needAccount()});$("a#butwait-save").click(butWaitSettingsChange);$("div#butwait a.close").click(function(){setSubscriptions([]);$('div#butwait').hide();return false;});}
function butWaitSettingsChange(){setSubscriptions($("div#butwait input[type='checkbox']:checked").map(function(){return parseInt(this.value);}).toArray(),function(){if(typeof onFilterModeChange=="function"){onFilterModeChange();}else{window.location.reload(true);}
$('div#butwait').hide();});return false;}
function setupSuggestionArea(){var div=$("div#suggestions");function toggleSuggestionArea(){var showing=(div.css("right")!="0px");var rightPlacement=showing?"0px":"-340px";var zIndex=showing?"25":"15";if(showing){div.css({"z-index":zIndex});}
var options={complete:function(){div.css({"z-index":zIndex});}};div.animate({right:rightPlacement},options);}
function clearSuggestionArea(){$("select",div).val("Leave a comment");$("textarea",div).text("");$("input[type='text']",div).initTextBox();}
function sendSuggestion(){var serialized=$("form",div).serialize();$.post("/suggestions/",serialized,function(){showToast("Suggestion sent!");clearSuggestionArea();});toggleSuggestionArea();}
$("a.suggestions-button").click(toggleSuggestionArea);var sendButton=$("input.send",div);sendButton.click(function(){sendSuggestion();return false;});var cancelButton=$("input.cancel",div);cancelButton.click(function(){clearSuggestionArea();toggleSuggestionArea();return false;});}
function toDict(arr){var retme={};for(i in arr){retme[arr[i]]=true;}
return retme;}
function setupHistory(){for(hoverid in viewhistory){var hoverdata=viewhistory[hoverid];var csskey=(hoverdata.finished?"finished":"started")+"-"+(hoverdata.lastwatched?"last":"notlast");var selector=$("a.progress-big,a.progress-small").add("ul.videolist li").filter("[vidid='"+hoverid+"']");selector.removeClass(viewedIndicatorClasses).addClass(csskey);}}
function loadUserData(){function success(data,textStatus){favorites=toDict(data.favorites);queued=toDict(data.queue);$("a.favebutton").favoriteButton();$("a.queuebutton").queueButton();viewhistory=data.history;setupHistory();}
$.get("/userdata/?"+new Date().getTime(),success,"json");}
function dataToSaneFormat(data){var retme=[];for(i in data.data){retme.push(itemToSaneFormat(data.data[i],data.index));}
return retme;}
function itemToSaneFormat(origItem,index){var item={};for(type in index){item[type]=origItem[index[type]];}
return item;}
function getPrice(arg_data){return arg_data.VIDEO_PAY_MODEL==3?'Subscribed':arg_data.VIDEO_PAY_MODEL==1?'Subscription':arg_data.VIDEO_PRICE==0?'Free':'$'+arg_data.VIDEO_PRICE.toFixed(2);}
function secondsToUIString(seconds)
{if(!seconds){return"";}
var tdate=new Date(1970,1,1);tdate.setTime(tdate.getTime()+seconds*1000);var h=tdate.getHours();var m=tdate.getMinutes();var s=tdate.getSeconds();if(s>0&&s<10)s="0"+s;if(h==0)
{return m+":"+s;}
else
{if(h>0&&h<10)h="0"+h;if(m>0&&m<10)m="0"+m;return h+":"+m+":"+s;}}
function imgUrlToS3Url(arg_url,arg_suffix)
{return'http://s3.amazonaws.com/zincthumbs/'+btoa(arg_url)+arg_suffix;}
function imgError(arg_img)
{var s3img=arg_img.src.match(/^http:\/\/s3\.amazonaws\.com\/zincthumbs\/([A-Z0-9=]+)_/i);if(s3img)
{try
{var decoded=atob(s3img[1]);arg_img.setAttribute('src',decoded);return;}
catch(e){}}
var fallbacksrc=arg_img.getAttribute('fallback');if(fallbacksrc)
{arg_img.removeAttribute('fallback');arg_img.setAttribute('src',fallbacksrc);return;}
arg_img.removeAttribute('onerror');arg_img.setAttribute('src',"/site_media/art/errimg.png");}
function setupXlLink(){var pathname=document.location.pathname;if(pathname=="/myqueue/"){pathname="/myqueue";}else if(pathname=="/myfavorites/"){pathname="/favorites/xl";}else if(pathname=="/series/"){pathname="/p/top50shows";}else if(pathname=="/movies/"){pathname="/p/top50movies";}else if(pathname.indexOf("/p/")==0){pathname=pathname;}else if(pathname.indexOf("/series/")==0){pathname=pathname.replace(/^(\/series\/[^\/]+\/).*/i,'$1');}else if(pathname.indexOf("/providers/")==0){pathname=pathname;}else if(pathname.indexOf("/search/")==0){var querymatch=document.location.search.match(/[?&]q=([^&]+)/);if(querymatch)pathname="/searchXL?q="+querymatch[1];else pathname="/p/";}else{pathname="/p/";}
$("a.leanback").attr("href","/xl/index.html#"+pathname);}
function needAccount(){$("div#loginPage").hide();$("div#signupPage").removeClass("none").show();}
function haveAccount(){$("div#signupPage").hide();$("div#loginPage").show();}
function facebook_onlogin(){$("form#fblogin").submit();}
var TYPE_BIZRULES={"Video":{friendly_name:"Video",metadata:["airdate","airtime","duration","sources"]},"Episode":{friendly_name:"Episode",metadata:["episode","airdate","duration","sources"]},"Movie":{friendly_name:"Movie",metadata:["zincrank","releaseyear","duration","price","rating","score","sources","cast"]},"Show":{friendly_name:"Series",metadata:["zincrank","seasons","episodes","sources"]},}
function enableSpanVisibility(div,data){var visibleSpans=[];if(data.type in TYPE_BIZRULES)visibleSpans=TYPE_BIZRULES[data.type].metadata;$("div.image-description",div).hide();for(i in visibleSpans){var visibleSpan=visibleSpans[i];visibleSpan="span#"+visibleSpan;$(visibleSpan,div).parents("div.image-description").show();}}
function roundToHalf(x){x*=2;x=Math.round(x);return(x/2).toFixed(1);}
function fillInfoArea(div,data,img){enableSpanVisibility(div,data);var url=(img&&img.attr('src'))?img.attr('src'):imgUrlToS3Url(data.thumbnail,'_tt');var imgtag=document.createElement('img');imgtag.className='pagethumb';imgtag.setAttribute('onerror','imgError(this);');$(imgtag).zv_autosize(url);$("h2.item-title",div).text(data.name||"-").parent("a").attr("href",data.link);$("span#seasons",div).text(data.numseasons||"-");$("span#episodes",div).text(data.numepisodes||"-");$("span#episode",div).text(data.season_episode||"-");$("span#zincrank",div).text(data.zincrank||"-");$("span#sources",div).text(data.sources||"-");$("span#source",div).text(data.sources||"-");$("span#airdate",div).text(data.airdate||"-");$("span#airtime",div).text(data.airtime||"-");$("span#description",div).text(data.description||"-");$("div#description_ellipsis",div).each(function(){ZvEllipsizer.SetValue(this,data.description||"-");});$("img.pagethumb",div).replaceWith(imgtag);$("a.enlarge",div).click(function(){showEnlarged(data.thumbnail);return false;});$("a.favebutton",div).attr({"hoverid":data.hoverid}).favoriteButton();$("a.queuebutton",div).attr({"hoverid":data.hoverid}).queueButton();$("span#releaseyear",div).text(data.releaseyear||"-");$("span#duration",div).text(toHMS(data.duration));$("span#price",div).text(data.price||"-");$("span#rating",div).text(data.rating||"-");$("span#score").attr("starvalue",roundToHalf(data.userrating));$("a#title",div).attr("href",data.pageurl).text(data.name);if(data.num_new){$("img.new-sash",div).show();}else{$("img.new-sash",div).hide();}
if(data.playlink){$("img.overlay",div).show();$("div.playEpisode a",div).attr("href",data.playlink);$("a.imageholderlink").attr("href",data.playlink);}else{$("img.overlay",div).hide();$("div.playEpisode a",div).attr("href",data.link);$("a.imageholderlink").attr("href",data.link);}}
var loginProgressTimeout=undefined;function cancelLogin(){hideLoginProgress();hideLoginBox();return false;}
function showLoginProgress(){var loginProgress=$("div#loginProgress");loginProgress.show();loginProgress.removeClass("none");loginProgressTimeout=undefined;}
function hideLoginProgress(){var loginProgress=$("div#loginProgress");if(!loginProgress.hasClass("none"))loginProgress.addClass("none");loginProgress.hide();loginProgressTimeout=undefined;}
function hideLoginBox(){var bigLogin=$("div#bigLogin");bigLogin.hide();if(!bigLogin.hasClass("none"))bigLogin.addClass("none");}
function displayLoginBox(postAction){postLoginAction=postAction;$("div#bigLogin").show();$("div#bigLogin").removeClass("none");$("div#loginPage").show().siblings("div").hide();$("input[name='username']").focus();}
function doLogin(){var form=$("form#loginform");hideLoginBox();loginProgressTimeout=setTimeout(showLoginProgress,1000);function success(){if(loginProgressTimeout){clearTimeout(loginProgressTimeout);loginProgressTimeout=undefined;}else{hideLoginProgress();}
if(typeof postLoginAction=="function"){postLoginAction();postLoginAction=undefined;}else{window.location.reload(true);}}
function failure(data,text){if(loginProgressTimeout){clearTimeout(loginProgressTimeout);loginProgressTimeout=undefined;}else{hideLoginProgress();}
displayLoginBox(postLoginAction);if(data.responseText.indexOf("<html")>-1){data.responseText="Unable to login at this time, please try again later.";}
$("p.red",form).text(data.responseText).removeClass("none");return false;}
postForm("/accounts/login/",form.serialize(),success,failure);}
function submitRegistration(){var form=$("form#registerform");var pw1=$("input[name='password']",form).val();var pw2=$("input[name='password-confirm']",form).val();if(pw1!=pw2){$("p.red",form).text("Passwords don't match").removeClass("none");return false;}
$("p.red",form).addClass("none");function success(){window.location.href="/firsttime/";}
function failure(data,text){$("p.red",form).text(data.responseText).removeClass("none");}
postForm("/accounts/register/",form.serialize(),success,failure);}
function showPasswordReset(){$('div#loginPage').hide();$('div#passwordReset').load("/regaccounts/password/reset/").removeClass("none").show();}
function keepInfoAtTop(div,pushdown_pixels,init_top){var msie6=$.browser=='msie'&&$.browser.version<7;var APPLE_IOS=(navigator.userAgent.match(/\(iPod;|\(iPhone;|\(iPad;/i)?true:false);var ANDROID_OS=(navigator.userAgent.match(/android/i)?true:false);if(!msie6){var top=div.offset().top-parseFloat(div.css('margin-top').replace(/auto/,0));$(window).scroll(function(event){var y=$(this).scrollTop();if(APPLE_IOS){if(y>=top){div.addClass(' fixed');div.css('top',(y+30)+'px');}else{div.removeClass(' fixed');div.css('top',init_top+'px');}}else if(ANDROID_OS){if(y>=top){div.addClass(' fixed');div.css('top','20px');div.css('left','40px');}else{div.removeClass(' fixed');div.css('top',init_top+'px');div.css('left','0px');}}else{if(y>=top){div.addClass(' fixed');div.css('margin-top',pushdown_pixels+'px');}else{div.removeClass(' fixed');div.css('margin-top','0');}}});}}
function showWhatsThis(evt){var selector=$(this).attr("textsrc");var text=$(selector).html();$("div#whatsthis div").html(text);positionUnderLink(evt,$("div#whatsthis").removeClass("none").show());return false;}
function showSettings(evt){$("div#replaceme").load("/settings/",function(){positionUnderLink(evt,$("div#personalInfo").removeClass("none").show());setupBoxen();});return false;}
function imageScaler(){var t=$(this);var thumb=$("img.thumb, img.pagethumb",t);thumb.hide();function scaleImageInternal(){var ratio=t.width()/t.height();var thumbratio=thumb.width()/thumb.height();var ratioratio=(thumbratio-ratio)/thumbratio;if(Math.abs(ratioratio)<0.1){thumb.height(t.height());thumb.width(t.width());}else{if(thumbratio<ratio){thumb.height(t.height());}else{thumb.width(t.width());}}
thumb.show();}
thumb.load(scaleImageInternal);var src=thumb[0].src;thumb[0].src="/site_media/art/s.gif";thumb[0].src=src;}
function toHMS(sec){function pad(num){num=num+"";if(num.length==1){num="0"+num;}
return num;}
var hours=Math.floor(sec/3600);var minutes=Math.floor(Math.floor(sec%3600)/60);var seconds=(sec%3600)%60;var retstring="";if(hours>0){return hours+":"+pad(minutes)+":"+pad(seconds);}else{return minutes+":"+pad(seconds);}}
var viewedIndicatorClasses="";function setupViewedIndicatorClasses(){$("div.viewedstatus ul li").each(function(){klass=$(this).attr("class");if(klass){viewedIndicatorClasses+=klass+" ";}});$("div.viewedstatus").hover(function(){mouseInsideProgressBox=true;},function(){mouseInsideProgressBox=false;});$("body").mouseup(function(){if(!mouseInsideProgressBox){$("div.viewedstatus").hide();}});}
function showViewedIndicatorMenu(){var t=$(this);var pos=t.offset();var width=t.width();var newMenu=$("div.viewedstatus");newMenu.css({"left":(pos.left-newMenu.width()+width)+"px","top":(pos.top+t.height())+"px"});newMenu.toggle();$("ul li",newMenu).unbind("click");$("ul li",newMenu).click(function(){klass=$(this).attr("class");t.removeClass(viewedIndicatorClasses).addClass(klass);var vidid=t.attr("vidid");setViewed(vidid,klass,loadUserData);$("span.watched-status[vidid='"+vidid+"']").text($(this).text());$("a.progress-small[vidid='"+vidid+"'], a.progress-big[vidid='"+vidid+"'], div.progress-line[vidid='"+vidid+"'], li[vidid='"+vidid+"']").removeClass(viewedIndicatorClasses).addClass(klass);newMenu.hide();});return false;}
jQuery.fn.returnPress=function(x){return this.each(function(){jQuery(this).keypress(function(e){if((e.which&&e.which==13)||(e.keyCode&&e.keyCode==13)){x();return false;}
else{return true;}});});};$.fn.initTextBox=function(){return this.each(function(){var t=$(this);var flipped=false;function changetxt(){if(!flipped){flipped=true;t.val("");t.css({"color":"#292929"});}}
t.focus().keydown(changetxt).val(t.attr("init")).click(changetxt).setCursorPosition(0);});};jQuery.fn.equals=function(selector){return $(this).get(0)==$(selector).get(0);};$.expr[':'].focus=function(a){return(a==document.activeElement);}
function removeFromArray(arr,val){var idx=arr.indexOf(val);if(idx!=-1)arr.splice(idx,1);}
function arrayIntersection(){var val,arrayCount,firstArray,i,j,intersection=[],missing;var arrays=Array.prototype.slice.call(arguments);firstArr=arrays.pop();if(firstArr){arrayCount=arrays.length;for(j in firstArr){val=firstArr[j];missing=false;i=arrayCount;while(!missing&&i--){if(!isIn(val,arrays[i])){missing=true;}}
if(!missing){intersection.push(val);}}}
return intersection;}
$.fn.setCursorPosition=function(pos){if($(this).get(0).setSelectionRange){try{$(this).get(0).setSelectionRange(pos,pos);}catch(err){}}else if($(this).get(0).createTextRange){var range=$(this).get(0).createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}}
$.fn.favoriteButton=function(opts){var defaults={onRemove:function(){},onAdd:function(){}}
var opts=$.extend(defaults,opts);return this.each(function(){var addImg=$('<div><img src="/site_media/art/icon_favoritessmall.png" alt="Add to My Shows" title="Add to My Shows"/></div>');var delImg=$('<div><img src="/site_media/art/icon_deletered.png" alt="Remove from My Shows" title="Remove from My Shows"/></div>');var t=$(this);t.unbind("click.serverEvent");var hoverid=t.attr("hoverid");var add=!(hoverid in favorites);if(t.attr("big")){var addTxt=addImg.children().attr("alt");var delTxt=delImg.children().attr("alt");addImg.append(document.createTextNode(addTxt));delImg.append(document.createTextNode(delTxt));}
var img=add?addImg:delImg;t.html(img.clone());t.bind("click.serverEvent",function(){var allMatchingButtons=$("a.favebutton[hoverid='"+hoverid+"']");var add=!(hoverid in favorites);if(add){addToFavorites(hoverid,function(){favorites[hoverid]=true;allMatchingButtons.favoriteButton();opts.onAdd();});}else{removeFromFavorites(hoverid,function(){delete favorites[hoverid];allMatchingButtons.favoriteButton();opts.onRemove();});}
return false;});return this;});}
$.fn.queueButton=function(opts){var defaults={onRemove:function(){},onAdd:function(){}}
var opts=$.extend(defaults,opts);return this.each(function(){var addImg=$('<div><img src="/site_media/art/icon_queueblue.png" alt="Add to Queue" title="Add to Queue"/></div>');var delImg=$('<div><img src="/site_media/art/icon_deleteblue.png" alt="Remove from Queue" title="Remove from Queue"/></div>');var t=$(this);t.unbind("click.serverEvent");var hoverid=t.attr("hoverid");var add=!(hoverid in queued);if(t.attr("big")){var addTxt=addImg.children().attr("alt");var delTxt=delImg.children().attr("alt");addImg.append(document.createTextNode(addTxt));delImg.append(document.createTextNode(delTxt));}
var img=add?addImg:delImg;t.html(img.clone());t.bind("click.serverEvent",function(){var allMatchingButtons=$("a.queuebutton[hoverid='"+hoverid+"']");var add=!(hoverid in queued);if(add){addToQueue(hoverid,function(){queued[hoverid]=true;allMatchingButtons.queueButton();opts.onAdd();});}else{removeFromQueue(hoverid,function(){delete queued[hoverid];allMatchingButtons.queueButton();opts.onRemove();})}
return false;});return this;});}
$.fn.truncate=function(num){return this.each(function(){var t=$(this);t.text(t.text().substr(0,num));});}
function showEnlarged(img){var ei=$("div#enlargeImage");ei.unbind();$("img",ei).attr("src",img);ei.removeClass("none").show();ei.bind('clickoutside',function(event){if(event.target.className!="enlarge"&&event.target.parentElement.className!="enlarge")ei.hide();});}
function centerImage(){function centerImageInternal(){var img=$(this);var newleft=0-img.width()/2;var newtop=0-img.height()/2;img.css("top",newtop);if(img.parent().height()==img.height()){img.css("margin-top",0);img.css("top",0);}
img.css("left",newleft);}
$(this).load(centerImageInternal);var src=this.src;this.src="";this.src=src;}
function fbs_click(url,title){if(!url){url=location.href;}
if(!title){title=document.title;}
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url)+'&t='+encodeURIComponent(title),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
function loadImage(){var loader=$(this);image_src=loader.attr('src');var img=new Image();img.src=image_src;$(img).load(function(){loader.replaceWith(img);});}
function positionUnderLink(evt,toPosition){var pos=$(evt.currentTarget).offset();var width=toPosition.width();toPosition.css({top:pos.top+30,left:pos.left-width});toPosition.show();}
function escapeHTML(s){return s.split('&').join('&amp;').split('<').join('&lt;').split('"').join('&quot;');}
function qualifyURL(url){var el=document.createElement('div');el.innerHTML='<a href="'+escapeHTML(url)+'">x</a>';return el.firstChild.href;}
function showShareDialog(evt){var dialog=$("div#sharebox");function delayedHide(){setTimeout(function(){dialog.hide();},100);return true;}
if(dialog.is(':visible')){delayedHide();return false;}
positionUnderLink(evt,dialog);var link=$(evt.currentTarget);var shareurl=link.attr("shareurl");var sharetitle=link.attr("sharetitle");if(!shareurl){shareurl=document.location.href;sharetitle=document.title;}
shareurl=qualifyURL(shareurl);$("input",dialog).val(shareurl).focus().blur(delayedHide);$("a.facebook",dialog).click(function(){fbs_click(shareurl,sharetitle);});var sharetext=sharetitle+": "+shareurl;$("a.twitter",dialog).attr("href","http://twitter.com/home?status="+escape(sharetext));var emailsubject="I want to share a video with you";$("a.email",dialog).attr("href","mailto:?Subject="+escape(emailsubject)+"&Body="+escape(sharetext));return false;}
function debug(whatever){if(window.console){if(console&&console.log)console.log(whatever);}else{}}
function isIn(needle,haystack){return($.inArray(needle,haystack)!=-1);}
function post(url,arg_data,successcb,format,errorcb){$.ajax({type:"POST",url:url,contentType:format,data:arg_data,success:successcb,error:function(data,textStatus){if(errorcb){errorcb(data,textStatus);return;}
if(data.status==403){displayLoginBox(function(){post(url,arg_data,function(data,textStatus){if(successcb){successcb(data,textStatus);}
window.location.reload(true);},format,function(){debug("error");debug(data);debug(textStatus)});});return;}
debug("error");debug(data);debug(textStatus);}});}
function postJson(url,data,successcb){post(url,JSON.stringify(data),successcb,"application/json; charset=utf8")}
function postForm(url,data,successcb,errorcb){post(url,data,successcb,"application/x-www-form-urlencoded; charset=utf8",errorcb);}
function genericSuccess(data,textStatus){debug(data);debug(textStatus);}
function setFreeMode(mode,onSuccess){postJson("/settings/freemode",{"mode":mode},function(){if(typeof onFilterModeChange=="function"){onFilterModeChange();}else{window.location.reload(true);}
onSuccess();});}
function setSubscriptions(subs,onSuccess){postJson("/settings/subscriptions",{"subscriptions":subs},onSuccess);}
function setViewed(videoID,viewedClass,onSuccess){postJson("/history/set/",{"id":videoID,"class":viewedClass},onSuccess);}
function glowLink(arg_jqelement)
{arg_jqelement.stop().css('color','#ffff00').animate({color:'#ffffff'},2500);}
function addToQueue(id,onSuccess){function success(ret){glowLink($("a#queuelink"));$("span.queuecount").html(ret);showToast("Added video to queue");if(onSuccess){onSuccess();}}
postJson("/queue/add/",{"id":id},success);return false;}
function removeFromQueue(id,onSuccess){function success(ret){glowLink($("a#queuelink"));$("span.queuecount").html(ret);showToast("Removed video from queue");if(onSuccess){onSuccess();}}
postJson("/queue/remove/",{"id":id},success);return false;}
function addToHistory(videoID){function success(){debug("success");}
var videoURL=content["vid"+videoID].url;postJson("/history/addFromContent/",{"url":videoURL},success);return false;}
function addMovieToFavorites(slug){postForm("/movies/"+slug+"/addFavorite/",{},genericSuccess);}
function addToFavorites(itemid,onSuccess){function success(ret){glowLink($("a#favoriteslink"));$("span.favoritescount").html(ret);showToast("Added to My Shows");if(onSuccess){onSuccess(ret);}}
postJson("/myfavorites/add/",{"id":itemid},success);return false;}
function removeFromFavorites(itemid,onSuccess){function success(ret){glowLink($("a#favoriteslink"));$("span.favoritescount").html(ret);showToast("Removed from My Shows");if(onSuccess){onSuccess(ret);}}
postJson("/myfavorites/remove/",{"id":itemid},success);return false;}
function showWaitIndicator(msg){var waiter=$("div#waitingindicator");$("div.popuptext",waiter).text(msg);waiter.show();}
function hideWaitIndicator(){var waiter=$("div#waitingindicator");waiter.hide();}
function showToast(msg){var DURATION=1500;var toast=$("div#toast");$("div.popuptext",toast).text(msg);toast.show();setTimeout(function(){toast.fadeOut();},DURATION);}
function isInt(x){var y=parseInt(x);if(isNaN(y))return false;return x==y&&x.toString()==y.toString();}
function initExternalClickTracking()
{var host1=window.location.hostname;var host2=host1.search('www.')==0?host2=host1.substr(4):'www.'+host1;var prots=['http','https'];for(var i in prots){var prot=prots[i];var expr=":not(.trackingExternal):"+":not([href^='"+prot+"://"+host1+"'])"+":not([href^='"+prot+"://"+host2+"'])";jQuery("a[href^='"+prot+"://']"+expr).addClass('trackingExternal').bind('click',trackExternalClick);jQuery("a[href^='"+prot+"://',rel*='external']:not(.trackingExternal)").addClass('trackingExternal').bind('click',trackExternalClick);}}
function trackExternalClick(e)
{try{_gaq.push(['_trackEvent','External Link',jQuery(this).context.hostname,jQuery(this).attr('href')]);}catch(err){}}
var UiData=new function UiData()
{this.GetContentItem=function(arg_id)
{return(typeof content[arg_id]=='undefined'?null:content[arg_id]);}}
if(typeof(Zinc)=='undefined'){var Zinc={}};content={};function imgboxError(arg_img)
{var s3img=arg_img.src.match(/^http:\/\/s3\.amazonaws\.com\/zincthumbs\/([A-Z0-9=]+)_/i);if(s3img)
{try
{var decoded=atob(s3img[1]);arg_img.setAttribute('src',decoded);return;}
catch(e){}}
var fallbacksrc=arg_img.getAttribute('fallback');if(fallbacksrc)
{arg_img.removeAttribute('fallback');arg_img.setAttribute('src',fallbacksrc);return;}
arg_img.removeAttribute('onerror');arg_img.setAttribute('src',"/site_media/art/errimg.png");}
function imgboxLoad(arg_img)
{var s3match=(arg_img.src.match(/^http:\/\/s3\.amazonaws\.com\/zincthumbs\/([A-Z0-9=]+)_/i)?true:false);var img_width=arg_img.width;var img_height=arg_img.height;var box_width=arg_img.parentNode.offsetWidth;var box_height=arg_img.parentNode.offsetHeight;if(img_width<box_width||img_height<box_height)
{var new_width=box_width;var new_height=Math.round(new_width*(img_height/img_width));if(new_height>box_height)
{new_height=box_height;new_width=Math.round(new_height*(img_width/img_height));}
if(s3match)
{if(new_width>=box_width-2)new_width=box_width;if(new_height>=box_height-2)new_height=box_height;}
else
{if(new_width*1.1>box_width)new_width=box_width;if(new_height*1.1>box_height)new_height=box_height;}
if(img_width!=new_width||img_height!=new_height)
{arg_img.width=new_width;arg_img.height=new_height;}}}
function imgboxUpdate(arg_img,arg_src)
{var newimg=document.createElement('img');newimg.setAttribute('onload',"imgboxLoad(this);");newimg.setAttribute('onerror',"imgboxError(this);");arg_img.parentNode.insertBefore(newimg,arg_img);arg_img.parentNode.removeChild(arg_img);newimg.setAttribute('src',arg_src);}
ZvHoverLib=new function()
{var HOVER_TIME_PRESHOW=200;var HOVER_TIME_FADEIN=500;var HOVER_TIME_FADEOUT=300;var hover_timer=null;var hover_tablet_ready=false;var hover_active_element=null;var hover_showing_element=null;var hover_hiding_element=null;var hover_datacache={};var hover_datarequest=null;this.HOVER_DISABLE_MOUSEOUT=false;function m_hover_animate_show(arg_reshowing)
{var jqhoverboxdiv=jQuery('.hoverbox',hover_showing_element);var leftside=true;var boxleft=jQuery(hover_showing_element).offset().left;var winwidth=jQuery(window).width();if(boxleft>winwidth/2)leftside=false;if(leftside)jqhoverboxdiv.removeClass('hoverbox_right');else jqhoverboxdiv.addClass('hoverbox_right');if(!arg_reshowing)jqhoverboxdiv.css('opacity',0.0);var opacity=jqhoverboxdiv.css('opacity');var animatetime=Math.floor((1.0-opacity)*HOVER_TIME_FADEIN);jQuery(hover_showing_element).addClass('thumbtile_hovered');jqhoverboxdiv.stop().animate({opacity:1.0},HOVER_TIME_FADEIN);}
function m_hover_animate_hide()
{var jqhoverboxdiv=jQuery('.hoverbox',hover_hiding_element);var opacity=jqhoverboxdiv.css('opacity');var animatetime=Math.floor((opacity)*HOVER_TIME_FADEOUT);jqhoverboxdiv.stop().animate({opacity:0.0},animatetime,m_hover_animate_hide_complete);}
function m_hover_animate_hide_complete()
{jQuery(hover_hiding_element).removeClass('thumbtile_hovered');m_hoverbox_depopulate(hover_hiding_element);hover_hiding_element=null;m_hover_show_if_ready();}
function m_hover_reshow()
{hover_showing_element=hover_hiding_element;hover_hiding_element=null;m_hover_animate_show(true);}
function m_hover_show_if_ready()
{if(!hover_showing_element)return;if(hover_hiding_element)return;if(hover_datarequest)return;m_hover_animate_show(false);}
function m_hoverbox_populate(arg_hoverid)
{m_hoverbox_depopulate(hover_active_element);var jqdatacontainer=jQuery('.hoverbox',hover_active_element);var datacontainer=jqdatacontainer.get(0);datacontainer.appendChild(document.getElementById('hover_data_template').firstChild.cloneNode(true));var data=hover_datacache[arg_hoverid];var bizrules=TYPE_BIZRULES[data.type];if(!bizrules)bizrules=TYPE_BIZRULES["Video"];var metadata=bizrules.metadata;for(var i=0;i<metadata.length;i++)
{var item=jQuery("[name='"+metadata[i]+"']",datacontainer);var row=item.parents('tr').get(0);row.style.display='table-row';}
jQuery("[name='title']",datacontainer).text(data.name);jQuery("[name='description']",datacontainer).text(data.description);jQuery("[name='type']",datacontainer).text(bizrules.friendly_name);jQuery("[name='seasons']",datacontainer).val(data.numseasons||'-');jQuery("[name='episodes']",datacontainer).val(data.numepisodes||'-');jQuery("[name='episode']",datacontainer).val(data.season_episode||'-');jQuery("[name='zincrank']",datacontainer).val(data.zincrank||'-');jQuery("[name='sources']",datacontainer).val(data.sources||'-');jQuery("[name='airdate']",datacontainer).val(data.airdate||'-');jQuery("[name='airtime']",datacontainer).val(data.airtime||'-');jQuery("[name='releaseyear']",datacontainer).val(data.releaseyear||'-');jQuery("[name='duration']",datacontainer).val(data.duration?toHMS(data.duration):'-');jQuery("[name='price']",datacontainer).val(data.price||'-');jQuery("[name='rating']",datacontainer).val(data.rating||'-');jQuery("[name='score']",datacontainer).attr('starvalue',roundToHalf(data.userrating));if(data.actors){var textArea=jQuery("[name='cast']",datacontainer);var parentRow=textArea.parents("tr");jQuery("[name='cast']",parentRow).val(data.actors[0]||"-");var remainingActors=data.actors.slice(1,3);for(i in remainingActors){var actor=remainingActors[i];var newRow=parentRow.clone();jQuery("[name='cast']",newRow).val(actor);jQuery("th",newRow).html("&nbsp;");parentRow.after(newRow);}}}
function m_hoverbox_depopulate(arg_div)
{var jqdatacontainer=jQuery('.hoverbox',arg_div);var datacontainer=jqdatacontainer.get(0);while(datacontainer.firstChild)datacontainer.removeChild(datacontainer.firstChild);}
function m_hover_datacallback(arg_data,arg_textstatus,arg_xhr)
{hover_datarequest=null;if(arg_textstatus!='success'||!arg_data)
{m_hover_deactivate();return;}
var hoverid=arg_data.hoverid;hover_datacache[hoverid]=arg_data;m_hoverbox_populate(hoverid);m_hover_show_if_ready();}
function m_hover_get_and_show()
{hover_showing_element=hover_active_element;var hoverid=hover_showing_element.getAttribute('zv_hoverid');if(typeof hover_datacache[hoverid]!='undefined')
{m_hoverbox_populate(hoverid);}
else
{hover_datarequest=$.getJSON("/getJsonData/",hoverid,m_hover_datacallback);}
m_hover_show_if_ready();}
function m_hover_abort_and_hide()
{if(hover_datarequest)
{hover_datarequest.abort();hover_datarequest=null;}
if(hover_timer){clearTimeout(hover_timer);hover_timer=null;}
if(hover_showing_element)
{hover_hiding_element=hover_showing_element;hover_showing_element=null;m_hover_animate_hide();}}
function m_hover_activate(arg_div)
{if(hover_active_element==arg_div)return;if(hover_active_element)m_hover_deactivate();hover_active_element=arg_div;hover_tablet_ready=false;if(hover_hiding_element==hover_active_element)
{m_hover_reshow();}
else
{hover_timer=setTimeout(m_hover_get_and_show,HOVER_TIME_PRESHOW);}}
function m_hover_deactivate()
{if(!hover_active_element)return;if(hover_timer)
{clearTimeout(hover_timer);hover_timer=null;}
m_hover_abort_and_hide();hover_active_element=null;}
function m_hover_mouseenter(arg_event)
{m_hover_activate(arg_event.currentTarget.parentNode);}
function m_hover_mouseleave()
{if(ZvHoverLib.HOVER_DISABLE_MOUSEOUT)return;m_hover_deactivate();}
function m_tablet_mouseclick(arg_event)
{var hoverlink=arg_event.currentTarget.parentNode;if(hoverlink!=hover_active_element)return false;if(!hover_tablet_ready)
{hover_tablet_ready=true;return false;}
return true;}
jQuery(document).ready(function()
{var elements_with_hoverids=jQuery('div[zv_hoverid] a.thumbtile_link');elements_with_hoverids.mouseenter(m_hover_mouseenter).mouseleave(m_hover_mouseleave);if(ZvCssCompatibility.NO_SELECT_MECHANISM)
{HOVER_TIME_PRESHOW=0;HOVER_TIME_FADEIN=0;HOVER_TIME_FADEOUT=0;elements_with_hoverids.click(m_tablet_mouseclick);}});}
ZvEllipsizer=new function()
{var m_self=this;var m_make_multiline_ellipsis_regex=new RegExp(/[\r\n\s\.,\-]+$/m);function make_multiline_ellipsis(arg_element,arg_setvalue)
{var use_innertext=(typeof arg_element.textContent=='undefined'?true:false);if(arg_setvalue&&use_innertext)arg_element.innerText=arg_element.__ELLIPSIS_TEXT;else if(arg_setvalue&&!use_innertext)arg_element.textContent=arg_element.__ELLIPSIS_TEXT;if(arg_element.offsetHeight<arg_element.scrollHeight)
{var min=0;var max=arg_element.__ELLIPSIS_TEXT.length;while(min<max)
{var attempt_size=Math.floor((min+max)/2);var attempt_text=arg_element.__ELLIPSIS_TEXT.substr(0,attempt_size).replace(m_make_multiline_ellipsis_regex,'')+'...';if(use_innertext)arg_element.innerText=attempt_text;else arg_element.textContent=attempt_text;if(arg_element.offsetHeight<arg_element.scrollHeight)max=attempt_size;else if(min==attempt_size)max=attempt_size;else min=attempt_size;}}}
function m_ellipsize_all()
{jQuery('.autoellipsis').each(function(){m_self.SetFromContent(this);});}
this.SetFromContent=function(arg_element)
{if(arg_element.__ELLIPSIS_TEXT)
{make_multiline_ellipsis(arg_element,true);}
else
{arg_element.__ELLIPSIS_TEXT=arg_element.textContent||arg_element.innerText;make_multiline_ellipsis(arg_element,false);}}
this.SetValue=function(arg_element,arg_text)
{arg_element.__ELLIPSIS_TEXT=arg_text;make_multiline_ellipsis(arg_element,true);}
jQuery(window).ready(m_ellipsize_all);jQuery(window).resize(function(){setTimeout(m_ellipsize_all,1);});m_ellipsize_all();};function setupBoxen(){$("div#personalInfo input[type=text]").returnPress(saveUserInfo);}
function saveProviders(){setSubscriptions($("#usersettings-subscriptions input[type='checkbox']:checked").map(function(){return parseInt(this.value);}).toArray(),function(){if(typeof onFilterModeChange=="function"){onFilterModeChange();}else{window.location.reload(true);}});return false;}
function resetUserInfo(){$("div#personalInfo input[type=text]").each(function(){$(this).val($(this).attr("original"));});}
function saveUserInfo(){var username=$("div#personalInfo input[name=username]").val();var email=$("div#personalInfo input[name=email]").val();function successCB(){$("a#welcome").text(username);showToast("Saved personal information");}
saveProviders();$('div#personalInfo').hide();postJson("/settings/userinfo",{"username":username,"email":email},successCB);}
function changePassword(){var passDiv=$("div.user");var oldPass=$("input[name=old]",passDiv).val();var newPass=$("input[name=new]",passDiv).val();var verifyPass=$("input[name=verify]",passDiv).val();if(newPass!=verifyPass){$("h2.pwmatch",passDiv).removeClass("none").show();return;}
function successCB(){$('div#personalInfo').hide();showToast("Changed password");}
postJson("/settings/password",{"old":oldPass,"new":newPass},successCB);}
(function(window,undefined){var document=window.document;(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz;})?/\b_super\b/:/.*/;this.JRClass=function(){};JRClass.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret;};})(name,prop[name]):prop[name];}function JRClass(){if(!initializing&&this.init)this.init.apply(this,arguments);}JRClass.prototype=prototype;JRClass.constructor=JRClass;JRClass.extend=arguments.callee;return JRClass;};})();var VideoJS=JRClass.extend({init:function(element,setOptions){if(typeof element=='string'){this.video=document.getElementById(element);}else{this.video=element;}
this.video.player=this;this.values={};this.elements={};this.options={autoplay:false,preload:true,useBuiltInControls:false,controlsBelow:false,controlsAtStart:false,controlsHiding:true,defaultVolume:0.85,playerFallbackOrder:["html5","flash","links"],flashPlayer:"htmlObject",flashPlayerVersion:false};if(typeof VideoJS.options=="object"){_V_.merge(this.options,VideoJS.options);}
if(typeof setOptions=="object"){_V_.merge(this.options,setOptions);}
if(this.getPreloadAttribute()!==undefined){this.options.preload=this.getPreloadAttribute();}
if(this.getAutoplayAttribute()!==undefined){this.options.autoplay=this.getAutoplayAttribute();}
this.box=this.video.parentNode;this.linksFallback=this.getLinksFallback();this.hideLinksFallback();this.each(this.options.playerFallbackOrder,function(playerType){if(this[playerType+"Supported"]()){this[playerType+"Init"]();return true;}});this.activateElement(this,"player");this.activateElement(this.box,"box");},behaviors:{},newBehavior:function(name,activate,functions){this.behaviors[name]=activate;this.extend(functions);},activateElement:function(element,behavior){if(typeof element=="string"){element=document.getElementById(element);}
this.behaviors[behavior].call(this,element);},errors:[],warnings:[],warning:function(warning){this.warnings.push(warning);this.log(warning);},history:[],log:function(event){if(!event){return;}
if(typeof event=="string"){event={type:event};}
if(event.type){this.history.push(event.type);}
if(this.history.length>=50){this.history.shift();}
try{console.log(event.type);}catch(e){try{opera.postError(event.type);}catch(e){}}},setLocalStorage:function(key,value){if(!localStorage){return;}
try{localStorage[key]=value;}catch(e){if(e.code==22||e.code==1014){this.warning(VideoJS.warnings.localStorageFull);}}},getPreloadAttribute:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("preload")){var preload=this.video.getAttribute("preload");if(preload===""||preload==="true"){return"auto";}
if(preload==="false"){return"none";}
return preload;}},getAutoplayAttribute:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("autoplay")){var autoplay=this.video.getAttribute("autoplay");if(autoplay==="false"){return false;}
return true;}},bufferedPercent:function(){return(this.duration())?this.buffered()[1]/this.duration():0;},each:function(arr,fn){if(!arr||arr.length===0){return;}
for(var i=0,j=arr.length;i<j;i++){if(fn.call(this,arr[i],i)){break;}}},extend:function(obj){for(var attrname in obj){if(obj.hasOwnProperty(attrname)){this[attrname]=obj[attrname];}}}});VideoJS.player=VideoJS.prototype;VideoJS.player.extend({flashSupported:function(){if(!this.flashElement){this.flashElement=this.getFlashElement();}
if(this.flashElement&&this.flashPlayerVersionSupported()){return true;}else{return false;}},flashInit:function(){this.replaceWithFlash();this.element=this.flashElement;this.video.src="";var flashPlayerType=VideoJS.flashPlayers[this.options.flashPlayer];this.extend(VideoJS.flashPlayers[this.options.flashPlayer].api);(flashPlayerType.init.context(this))();},getFlashElement:function(){var children=this.video.children;for(var i=0,j=children.length;i<j;i++){if(children[i].className=="vjs-flash-fallback"){return children[i];}}},replaceWithFlash:function(){if(this.flashElement){this.box.insertBefore(this.flashElement,this.video);this.video.style.display="none";}},flashPlayerVersionSupported:function(){var playerVersion=(this.options.flashPlayerVersion)?this.options.flashPlayerVersion:VideoJS.flashPlayers[this.options.flashPlayer].flashPlayerVersion;return VideoJS.getFlashVersion()>=playerVersion;}});VideoJS.flashPlayers={};VideoJS.flashPlayers.htmlObject={flashPlayerVersion:9,init:function(){return true;},api:{width:function(width){if(width!==undefined){this.element.width=width;this.box.style.width=width+"px";this.triggerResizeListeners();return this;}
return this.element.width;},height:function(height){if(height!==undefined){this.element.height=height;this.box.style.height=height+"px";this.triggerResizeListeners();return this;}
return this.element.height;}}};VideoJS.player.extend({linksSupported:function(){return true;},linksInit:function(){this.showLinksFallback();this.element=this.video;},getLinksFallback:function(){return this.box.getElementsByTagName("P")[0];},hideLinksFallback:function(){if(this.linksFallback){this.linksFallback.style.display="none";}},showLinksFallback:function(){if(this.linksFallback){this.linksFallback.style.display="block";}}});VideoJS.merge=function(obj1,obj2,safe){for(var attrname in obj2){if(obj2.hasOwnProperty(attrname)&&(!safe||!obj1.hasOwnProperty(attrname))){obj1[attrname]=obj2[attrname];}}
return obj1;};VideoJS.extend=function(obj){this.merge(this,obj,true);};VideoJS.extend({setupAllWhenReady:function(options){VideoJS.options=options;VideoJS.DOMReady(VideoJS.setup);},DOMReady:function(fn){VideoJS.addToDOMReady(fn);},setup:function(videos,options){var returnSingular=false,playerList=[],videoElement;if(!videos||videos=="All"){videos=VideoJS.getVideoJSTags();}else if(typeof videos!='object'||videos.nodeType==1){videos=[videos];returnSingular=true;}
for(var i=0;i<videos.length;i++){if(typeof videos[i]=='string'){videoElement=document.getElementById(videos[i]);}else{videoElement=videos[i];}
playerList.push(new VideoJS(videoElement,options));}
return(returnSingular)?playerList[0]:playerList;},getVideoJSTags:function(){var videoTags=document.getElementsByTagName("video"),videoJSTags=[],videoTag;for(var i=0,j=videoTags.length;i<j;i++){videoTag=videoTags[i];if(videoTag.className.indexOf("video-js")!=-1){videoJSTags.push(videoTag);}}
return videoJSTags;},browserSupportsVideo:function(){if(typeof VideoJS.videoSupport!="undefined"){return VideoJS.videoSupport;}
VideoJS.videoSupport=!!document.createElement('video').canPlayType;return VideoJS.videoSupport;},getFlashVersion:function(){if(typeof VideoJS.flashVersion!="undefined"){return VideoJS.flashVersion;}
var version=0,desc;if(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]=="object"){desc=navigator.plugins["Shockwave Flash"].description;if(desc&&!(typeof navigator.mimeTypes!="undefined"&&navigator.mimeTypes["application/x-shockwave-flash"]&&!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)){version=parseInt(desc.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1],10);}}else if(typeof window.ActiveXObject!="undefined"){try{var testObject=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(testObject){version=parseInt(testObject.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1],10);}}
catch(e){}}
VideoJS.flashVersion=version;return VideoJS.flashVersion;},isIE:function(){return!+"\v1";},isIPad:function(){return navigator.userAgent.match(/iPad/i)!==null;},isIPhone:function(){return navigator.userAgent.match(/iPhone/i)!==null;},isIOS:function(){return VideoJS.isIPhone()||VideoJS.isIPad();},iOSVersion:function(){var match=navigator.userAgent.match(/OS (\d+)_/i);if(match&&match[1]){return match[1];}},isAndroid:function(){return navigator.userAgent.match(/Android/i)!==null;},androidVersion:function(){var match=navigator.userAgent.match(/Android (\d+)\./i);if(match&&match[1]){return match[1];}},warnings:{videoNotReady:"Video is not ready yet (try playing the video first).",localStorageFull:"Local Storage is Full"}});if(VideoJS.isIE()){document.createElement("video");}
window.VideoJS=window._V_=VideoJS;VideoJS.player.extend({html5Supported:function(){if(VideoJS.browserSupportsVideo()&&this.canPlaySource()){return true;}else{return false;}},html5Init:function(){this.element=this.video;this.fixPreloading();this.supportProgressEvents();this.volume((localStorage&&localStorage.volume)||this.options.defaultVolume);if(VideoJS.isIOS()){this.options.useBuiltInControls=true;this.iOSInterface();}else if(VideoJS.isAndroid()){this.options.useBuiltInControls=true;this.androidInterface();}
if(!this.options.useBuiltInControls){this.video.controls=false;if(this.options.controlsBelow){_V_.addClass(this.box,"vjs-controls-below");}
this.activateElement(this.video,"playToggle");this.buildStylesCheckDiv();this.buildAndActivatePoster();this.buildBigPlayButton();this.buildAndActivateSpinner();this.buildAndActivateControlBar();this.loadInterface();this.getSubtitles();}},canPlaySource:function(){if(this.canPlaySourceResult){return this.canPlaySourceResult;}
var children=this.video.children;for(var i=0,j=children.length;i<j;i++){if(children[i].tagName.toUpperCase()=="SOURCE"){var canPlay=this.video.canPlayType(children[i].type)||this.canPlayExt(children[i].src);if(canPlay=="probably"||canPlay=="maybe"){this.firstPlayableSource=children[i];this.canPlaySourceResult=true;return true;}}}
this.canPlaySourceResult=false;return false;},canPlayExt:function(src){if(!src){return"";}
var match=src.match(/\.([^\.]+)$/);if(match&&match[1]){var ext=match[1].toLowerCase();if(VideoJS.isAndroid()){if(ext=="mp4"||ext=="m4v"){return"maybe";}}else if(VideoJS.isIOS()){if(ext=="m3u8"){return"maybe";}}}
return"";},forceTheSource:function(){this.video.src=this.firstPlayableSource.src;this.video.load();},fixPreloading:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("preload")&&this.video.preload!="none"){this.video.autobuffer=true;}else{this.video.autobuffer=false;this.video.preload="none";}},supportProgressEvents:function(e){_V_.addListener(this.video,'progress',this.playerOnVideoProgress.context(this));},playerOnVideoProgress:function(event){this.setBufferedFromProgress(event);},setBufferedFromProgress:function(event){if(event.total>0){var newBufferEnd=(event.loaded/event.total)*this.duration();if(newBufferEnd>this.values.bufferEnd){this.values.bufferEnd=newBufferEnd;}}},iOSInterface:function(){if(VideoJS.iOSVersion()<4){this.forceTheSource();}
if(VideoJS.isIPad()){this.buildAndActivateSpinner();}},androidInterface:function(){this.forceTheSource();_V_.addListener(this.video,"click",function(){this.play();});this.buildBigPlayButton();_V_.addListener(this.bigPlayButton,"click",function(){this.play();}.context(this));this.positionBox();this.showBigPlayButtons();},loadInterface:function(){if(!this.stylesHaveLoaded()){if(!this.positionRetries){this.positionRetries=1;}
if(this.positionRetries++<100){setTimeout(this.loadInterface.context(this),10);return;}}
this.hideStylesCheckDiv();this.showPoster();if(this.video.paused!==false){this.showBigPlayButtons();}
if(this.options.controlsAtStart){this.showControlBars();}
this.positionAll();},buildAndActivateControlBar:function(){this.controls=_V_.createElement("div",{className:"vjs-controls"});this.box.appendChild(this.controls);this.activateElement(this.controls,"controlBar");this.activateElement(this.controls,"mouseOverVideoReporter");this.playControl=_V_.createElement("div",{className:"vjs-play-control",innerHTML:"<span></span>"});this.controls.appendChild(this.playControl);this.activateElement(this.playControl,"playToggle");this.progressControl=_V_.createElement("div",{className:"vjs-progress-control"});this.controls.appendChild(this.progressControl);this.progressHolder=_V_.createElement("div",{className:"vjs-progress-holder"});this.progressControl.appendChild(this.progressHolder);this.activateElement(this.progressHolder,"currentTimeScrubber");this.loadProgressBar=_V_.createElement("div",{className:"vjs-load-progress"});this.progressHolder.appendChild(this.loadProgressBar);this.activateElement(this.loadProgressBar,"loadProgressBar");this.playProgressBar=_V_.createElement("div",{className:"vjs-play-progress"});this.progressHolder.appendChild(this.playProgressBar);this.activateElement(this.playProgressBar,"playProgressBar");this.timeControl=_V_.createElement("div",{className:"vjs-time-control"});this.controls.appendChild(this.timeControl);this.currentTimeDisplay=_V_.createElement("span",{className:"vjs-current-time-display",innerHTML:"00:00"});this.timeControl.appendChild(this.currentTimeDisplay);this.activateElement(this.currentTimeDisplay,"currentTimeDisplay");this.timeSeparator=_V_.createElement("span",{innerHTML:" / "});this.timeControl.appendChild(this.timeSeparator);this.durationDisplay=_V_.createElement("span",{className:"vjs-duration-display",innerHTML:"00:00"});this.timeControl.appendChild(this.durationDisplay);this.activateElement(this.durationDisplay,"durationDisplay");this.volumeControl=_V_.createElement("div",{className:"vjs-volume-control",innerHTML:"<div><span></span><span></span><span></span><span></span><span></span><span></span></div>"});this.controls.appendChild(this.volumeControl);this.activateElement(this.volumeControl,"volumeScrubber");this.volumeDisplay=this.volumeControl.children[0];this.activateElement(this.volumeDisplay,"volumeDisplay");this.fullscreenControl=_V_.createElement("div",{className:"vjs-fullscreen-control",innerHTML:"<div><span></span><span></span><span></span><span></span></div>"});this.controls.appendChild(this.fullscreenControl);this.activateElement(this.fullscreenControl,"fullscreenToggle");},buildAndActivatePoster:function(){this.updatePosterSource();if(this.video.poster){this.poster=document.createElement("img");this.box.appendChild(this.poster);this.poster.src=this.video.poster;this.poster.className="vjs-poster";this.activateElement(this.poster,"poster");}else{this.poster=false;}},buildBigPlayButton:function(){this.bigPlayButton=_V_.createElement("div",{className:"vjs-big-play-button",innerHTML:"<span></span>"});this.box.appendChild(this.bigPlayButton);this.activateElement(this.bigPlayButton,"bigPlayButton");},buildAndActivateSpinner:function(){this.spinner=_V_.createElement("div",{className:"vjs-spinner",innerHTML:"<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>"});this.box.appendChild(this.spinner);this.activateElement(this.spinner,"spinner");},buildStylesCheckDiv:function(){this.stylesCheckDiv=_V_.createElement("div",{className:"vjs-styles-check"});this.stylesCheckDiv.style.position="absolute";this.box.appendChild(this.stylesCheckDiv);},hideStylesCheckDiv:function(){this.stylesCheckDiv.style.display="none";},stylesHaveLoaded:function(){if(this.stylesCheckDiv.offsetHeight!=5){return false;}else{return true;}},positionAll:function(){this.positionBox();this.positionControlBars();this.positionPoster();},positionBox:function(){if(this.videoIsFullScreen){this.box.style.width="";this.element.style.height="";if(this.options.controlsBelow){this.box.style.height="";this.element.style.height=(this.box.offsetHeight-this.controls.offsetHeight)+"px";}}else{if(this.options.controlsBelow){this.element.style.height="";}}},getSubtitles:function(){var tracks=this.video.getElementsByTagName("TRACK");for(var i=0,j=tracks.length;i<j;i++){if(tracks[i].getAttribute("kind")=="subtitles"&&tracks[i].getAttribute("src")){this.subtitlesSource=tracks[i].getAttribute("src");this.loadSubtitles();this.buildSubtitles();}}},loadSubtitles:function(){_V_.get(this.subtitlesSource,this.parseSubtitles.context(this));},parseSubtitles:function(subText){var lines=subText.split("\n"),line="",subtitle,time,text;this.subtitles=[];this.currentSubtitle=false;this.lastSubtitleIndex=0;for(var i=0;i<lines.length;i++){line=_V_.trim(lines[i]);if(line){subtitle={id:line,index:this.subtitles.length};line=_V_.trim(lines[++i]);time=line.split(" --> ");subtitle.start=this.parseSubtitleTime(time[0]);subtitle.end=this.parseSubtitleTime(time[1]);text=[];for(var j=i;j<lines.length;j++){line=_V_.trim(lines[++i]);if(!line){break;}
text.push(line);}
subtitle.text=text.join('<br/>');this.subtitles.push(subtitle);}}},parseSubtitleTime:function(timeText){var parts=timeText.split(':'),time=0;time+=parseFloat(parts[0])*60*60;time+=parseFloat(parts[1])*60;var seconds=parts[2].split(/\.|,/);time+=parseFloat(seconds[0]);ms=parseFloat(seconds[1]);if(ms){time+=ms/1000;}
return time;},buildSubtitles:function(){this.subtitlesDisplay=_V_.createElement("div",{className:'vjs-subtitles'});this.box.appendChild(this.subtitlesDisplay);this.activateElement(this.subtitlesDisplay,"subtitlesDisplay");},addVideoListener:function(type,fn){_V_.addListener(this.video,type,fn.rEvtContext(this));},play:function(){this.video.play();return this;},onPlay:function(fn){this.addVideoListener("play",fn);return this;},pause:function(){this.video.pause();return this;},onPause:function(fn){this.addVideoListener("pause",fn);return this;},paused:function(){return this.video.paused;},currentTime:function(seconds){if(seconds!==undefined){try{this.video.currentTime=seconds;}
catch(e){this.warning(VideoJS.warnings.videoNotReady);}
this.values.currentTime=seconds;return this;}
return this.video.currentTime;},onCurrentTimeUpdate:function(fn){this.currentTimeListeners.push(fn);},duration:function(){return this.video.duration;},buffered:function(){if(this.values.bufferStart===undefined){this.values.bufferStart=0;this.values.bufferEnd=0;}
if(this.video.buffered&&this.video.buffered.length>0){var newEnd=this.video.buffered.end(0);if(newEnd>this.values.bufferEnd){this.values.bufferEnd=newEnd;}}
return[this.values.bufferStart,this.values.bufferEnd];},volume:function(percentAsDecimal){if(percentAsDecimal!==undefined){this.values.volume=Math.max(0,Math.min(1,parseFloat(percentAsDecimal)));this.video.volume=this.values.volume;this.setLocalStorage("volume",this.values.volume);return this;}
if(this.values.volume){return this.values.volume;}
return this.video.volume;},onVolumeChange:function(fn){_V_.addListener(this.video,'volumechange',fn.rEvtContext(this));},width:function(width){if(width!==undefined){this.video.width=width;this.box.style.width=width+"px";this.triggerResizeListeners();return this;}
return this.video.offsetWidth;},height:function(height){if(height!==undefined){this.video.height=height;this.box.style.height=height+"px";this.triggerResizeListeners();return this;}
return this.video.offsetHeight;},supportsFullScreen:function(){if(typeof this.video.webkitEnterFullScreen=='function'){if(!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")){return true;}}
return false;},html5EnterNativeFullScreen:function(){try{this.video.webkitEnterFullScreen();}catch(e){if(e.code==11){this.warning(VideoJS.warnings.videoNotReady);}}
return this;},enterFullScreen:function(){if(this.supportsFullScreen()){this.html5EnterNativeFullScreen();}else{this.enterFullWindow();}},exitFullScreen:function(){if(this.supportsFullScreen()){}else{this.exitFullWindow();}},enterFullWindow:function(){this.videoIsFullScreen=true;this.docOrigOverflow=document.documentElement.style.overflow;_V_.addListener(document,"keydown",this.fullscreenOnEscKey.rEvtContext(this));_V_.addListener(window,"resize",this.fullscreenOnWindowResize.rEvtContext(this));document.documentElement.style.overflow='hidden';_V_.addClass(this.box,"vjs-fullscreen");this.positionAll();},exitFullWindow:function(){this.videoIsFullScreen=false;document.removeEventListener("keydown",this.fullscreenOnEscKey,false);window.removeEventListener("resize",this.fullscreenOnWindowResize,false);document.documentElement.style.overflow=this.docOrigOverflow;_V_.removeClass(this.box,"vjs-fullscreen");this.positionAll();},onError:function(fn){this.addVideoListener("error",fn);return this;},onEnded:function(fn){this.addVideoListener("ended",fn);return this;}});VideoJS.player.newBehavior("player",function(player){this.onError(this.playerOnVideoError);this.onPlay(this.playerOnVideoPlay);this.onPlay(this.trackCurrentTime);this.onPause(this.playerOnVideoPause);this.onPause(this.stopTrackingCurrentTime);this.onEnded(this.playerOnVideoEnded);this.trackBuffered();this.onBufferedUpdate(this.isBufferFull);},{playerOnVideoError:function(event){this.log(event);this.log(this.video.error);},playerOnVideoPlay:function(event){this.hasPlayed=true;},playerOnVideoPause:function(event){},playerOnVideoEnded:function(event){this.currentTime(0);this.pause();},trackBuffered:function(){this.bufferedInterval=setInterval(this.triggerBufferedListeners.context(this),500);},stopTrackingBuffered:function(){clearInterval(this.bufferedInterval);},bufferedListeners:[],onBufferedUpdate:function(fn){this.bufferedListeners.push(fn);},triggerBufferedListeners:function(){this.isBufferFull();this.each(this.bufferedListeners,function(listener){(listener.context(this))();});},isBufferFull:function(){if(this.bufferedPercent()==1){this.stopTrackingBuffered();}},trackCurrentTime:function(){if(this.currentTimeInterval){clearInterval(this.currentTimeInterval);}
this.currentTimeInterval=setInterval(this.triggerCurrentTimeListeners.context(this),100);this.trackingCurrentTime=true;},stopTrackingCurrentTime:function(){clearInterval(this.currentTimeInterval);this.trackingCurrentTime=false;},currentTimeListeners:[],triggerCurrentTimeListeners:function(late,newTime){this.each(this.currentTimeListeners,function(listener){(listener.context(this))(newTime||this.currentTime());});},resizeListeners:[],onResize:function(fn){this.resizeListeners.push(fn);},triggerResizeListeners:function(){this.each(this.resizeListeners,function(listener){(listener.context(this))();});}});VideoJS.player.newBehavior("mouseOverVideoReporter",function(element){_V_.addListener(element,"mousemove",this.mouseOverVideoReporterOnMouseMove.context(this));_V_.addListener(element,"mouseout",this.mouseOverVideoReporterOnMouseOut.context(this));},{mouseOverVideoReporterOnMouseMove:function(){this.showControlBars();clearInterval(this.mouseMoveTimeout);this.mouseMoveTimeout=setTimeout(this.hideControlBars.context(this),4000);},mouseOverVideoReporterOnMouseOut:function(event){var parent=event.relatedTarget;while(parent&&parent!==this.box){parent=parent.parentNode;}
if(parent!==this.box){this.hideControlBars();}}});VideoJS.player.newBehavior("box",function(element){this.positionBox();_V_.addClass(element,"vjs-paused");this.activateElement(element,"mouseOverVideoReporter");this.onPlay(this.boxOnVideoPlay);this.onPause(this.boxOnVideoPause);},{boxOnVideoPlay:function(){_V_.removeClass(this.box,"vjs-paused");_V_.addClass(this.box,"vjs-playing");},boxOnVideoPause:function(){_V_.removeClass(this.box,"vjs-playing");_V_.addClass(this.box,"vjs-paused");}});VideoJS.player.newBehavior("poster",function(element){this.activateElement(element,"mouseOverVideoReporter");this.activateElement(element,"playButton");this.onPlay(this.hidePoster);this.onEnded(this.showPoster);this.onResize(this.positionPoster);},{showPoster:function(){if(!this.poster){return;}
this.poster.style.display="block";this.positionPoster();},positionPoster:function(){if(!this.poster||this.poster.style.display=='none'){return;}
this.poster.style.height=this.height()+"px";this.poster.style.width=this.width()+"px";},hidePoster:function(){if(!this.poster){return;}
this.poster.style.display="none";},updatePosterSource:function(){if(!this.video.poster){var images=this.video.getElementsByTagName("img");if(images.length>0){this.video.poster=images[0].src;}}}});VideoJS.player.newBehavior("controlBar",function(element){if(!this.controlBars){this.controlBars=[];this.onResize(this.positionControlBars);}
this.controlBars.push(element);_V_.addListener(element,"mousemove",this.onControlBarsMouseMove.context(this));_V_.addListener(element,"mouseout",this.onControlBarsMouseOut.context(this));},{showControlBars:function(){if(!this.options.controlsAtStart&&!this.hasPlayed){return;}
this.each(this.controlBars,function(bar){bar.style.display="block";});},positionControlBars:function(){this.updatePlayProgressBars();this.updateLoadProgressBars();},hideControlBars:function(){if(this.options.controlsHiding&&!this.mouseIsOverControls){this.each(this.controlBars,function(bar){bar.style.display="none";});}},onControlBarsMouseMove:function(){this.mouseIsOverControls=true;},onControlBarsMouseOut:function(event){this.mouseIsOverControls=false;}});VideoJS.player.newBehavior("playToggle",function(element){if(!this.elements.playToggles){this.elements.playToggles=[];this.onPlay(this.playTogglesOnPlay);this.onPause(this.playTogglesOnPause);}
this.elements.playToggles.push(element);_V_.addListener(element,"click",this.onPlayToggleClick.context(this));},{onPlayToggleClick:function(event){if(this.paused()){this.play();}else{this.pause();}},playTogglesOnPlay:function(event){this.each(this.elements.playToggles,function(toggle){_V_.removeClass(toggle,"vjs-paused");_V_.addClass(toggle,"vjs-playing");});},playTogglesOnPause:function(event){this.each(this.elements.playToggles,function(toggle){_V_.removeClass(toggle,"vjs-playing");_V_.addClass(toggle,"vjs-paused");});}});VideoJS.player.newBehavior("playButton",function(element){_V_.addListener(element,"click",this.onPlayButtonClick.context(this));},{onPlayButtonClick:function(event){this.play();}});VideoJS.player.newBehavior("pauseButton",function(element){_V_.addListener(element,"click",this.onPauseButtonClick.context(this));},{onPauseButtonClick:function(event){this.pause();}});VideoJS.player.newBehavior("playProgressBar",function(element){if(!this.playProgressBars){this.playProgressBars=[];this.onCurrentTimeUpdate(this.updatePlayProgressBars);}
this.playProgressBars.push(element);},{updatePlayProgressBars:function(newTime){var progress=(newTime!==undefined)?newTime/this.duration():this.currentTime()/this.duration();if(isNaN(progress)){progress=0;}
this.each(this.playProgressBars,function(bar){if(bar.style){bar.style.width=_V_.round(progress*100,2)+"%";}});}});VideoJS.player.newBehavior("loadProgressBar",function(element){if(!this.loadProgressBars){this.loadProgressBars=[];}
this.loadProgressBars.push(element);this.onBufferedUpdate(this.updateLoadProgressBars);},{updateLoadProgressBars:function(){this.each(this.loadProgressBars,function(bar){if(bar.style){bar.style.width=_V_.round(this.bufferedPercent()*100,2)+"%";}});}});VideoJS.player.newBehavior("currentTimeDisplay",function(element){if(!this.currentTimeDisplays){this.currentTimeDisplays=[];this.onCurrentTimeUpdate(this.updateCurrentTimeDisplays);}
this.currentTimeDisplays.push(element);},{updateCurrentTimeDisplays:function(newTime){if(!this.currentTimeDisplays){return;}
var time=(newTime)?newTime:this.currentTime();this.each(this.currentTimeDisplays,function(dis){dis.innerHTML=_V_.formatTime(time);});}});VideoJS.player.newBehavior("durationDisplay",function(element){if(!this.durationDisplays){this.durationDisplays=[];this.onCurrentTimeUpdate(this.updateDurationDisplays);}
this.durationDisplays.push(element);},{updateDurationDisplays:function(){if(!this.durationDisplays){return;}
this.each(this.durationDisplays,function(dis){if(this.duration()){dis.innerHTML=_V_.formatTime(this.duration());}});}});VideoJS.player.newBehavior("currentTimeScrubber",function(element){_V_.addListener(element,"mousedown",this.onCurrentTimeScrubberMouseDown.rEvtContext(this));},{onCurrentTimeScrubberMouseDown:function(event,scrubber){event.preventDefault();this.currentScrubber=scrubber;this.stopTrackingCurrentTime();this.videoWasPlaying=!this.paused();this.pause();_V_.blockTextSelection();this.setCurrentTimeWithScrubber(event);_V_.addListener(document,"mousemove",this.onCurrentTimeScrubberMouseMove.rEvtContext(this));_V_.addListener(document,"mouseup",this.onCurrentTimeScrubberMouseUp.rEvtContext(this));},onCurrentTimeScrubberMouseMove:function(event){this.setCurrentTimeWithScrubber(event);},onCurrentTimeScrubberMouseUp:function(event){_V_.unblockTextSelection();document.removeEventListener("mousemove",this.onCurrentTimeScrubberMouseMove,false);document.removeEventListener("mouseup",this.onCurrentTimeScrubberMouseUp,false);if(this.videoWasPlaying){this.play();this.trackCurrentTime();}},setCurrentTimeWithScrubber:function(event){var newProgress=_V_.getRelativePosition(event.pageX,this.currentScrubber);var newTime=newProgress*this.duration();this.triggerCurrentTimeListeners(0,newTime);if(newTime==this.duration()){newTime=newTime-0.1;}
this.currentTime(newTime);}});VideoJS.player.newBehavior("volumeDisplay",function(element){if(!this.volumeDisplays){this.volumeDisplays=[];this.onVolumeChange(this.updateVolumeDisplays);}
this.volumeDisplays.push(element);this.updateVolumeDisplay(element);},{updateVolumeDisplays:function(){if(!this.volumeDisplays){return;}
this.each(this.volumeDisplays,function(dis){this.updateVolumeDisplay(dis);});},updateVolumeDisplay:function(display){var volNum=Math.ceil(this.volume()*6);this.each(display.children,function(child,num){if(num<volNum){_V_.addClass(child,"vjs-volume-level-on");}else{_V_.removeClass(child,"vjs-volume-level-on");}});}});VideoJS.player.newBehavior("volumeScrubber",function(element){_V_.addListener(element,"mousedown",this.onVolumeScrubberMouseDown.rEvtContext(this));},{onVolumeScrubberMouseDown:function(event,scrubber){_V_.blockTextSelection();this.currentScrubber=scrubber;this.setVolumeWithScrubber(event);_V_.addListener(document,"mousemove",this.onVolumeScrubberMouseMove.rEvtContext(this));_V_.addListener(document,"mouseup",this.onVolumeScrubberMouseUp.rEvtContext(this));},onVolumeScrubberMouseMove:function(event){this.setVolumeWithScrubber(event);},onVolumeScrubberMouseUp:function(event){this.setVolumeWithScrubber(event);_V_.unblockTextSelection();document.removeEventListener("mousemove",this.onVolumeScrubberMouseMove,false);document.removeEventListener("mouseup",this.onVolumeScrubberMouseUp,false);},setVolumeWithScrubber:function(event){var newVol=_V_.getRelativePosition(event.pageX,this.currentScrubber);this.volume(newVol);}});VideoJS.player.newBehavior("fullscreenToggle",function(element){_V_.addListener(element,"click",this.onFullscreenToggleClick.context(this));},{onFullscreenToggleClick:function(event){if(!this.videoIsFullScreen){this.enterFullScreen();}else{this.exitFullScreen();}},fullscreenOnWindowResize:function(event){this.positionControlBars();},fullscreenOnEscKey:function(event){if(event.keyCode==27){this.exitFullScreen();}}});VideoJS.player.newBehavior("bigPlayButton",function(element){if(!this.elements.bigPlayButtons){this.elements.bigPlayButtons=[];this.onPlay(this.bigPlayButtonsOnPlay);this.onEnded(this.bigPlayButtonsOnEnded);}
this.elements.bigPlayButtons.push(element);this.activateElement(element,"playButton");},{bigPlayButtonsOnPlay:function(event){this.hideBigPlayButtons();},bigPlayButtonsOnEnded:function(event){this.showBigPlayButtons();},showBigPlayButtons:function(){this.each(this.elements.bigPlayButtons,function(element){element.style.display="block";});},hideBigPlayButtons:function(){this.each(this.elements.bigPlayButtons,function(element){element.style.display="none";});}});VideoJS.player.newBehavior("spinner",function(element){if(!this.spinners){this.spinners=[];_V_.addListener(this.video,"loadeddata",this.spinnersOnVideoLoadedData.context(this));_V_.addListener(this.video,"loadstart",this.spinnersOnVideoLoadStart.context(this));_V_.addListener(this.video,"seeking",this.spinnersOnVideoSeeking.context(this));_V_.addListener(this.video,"seeked",this.spinnersOnVideoSeeked.context(this));_V_.addListener(this.video,"canplay",this.spinnersOnVideoCanPlay.context(this));_V_.addListener(this.video,"canplaythrough",this.spinnersOnVideoCanPlayThrough.context(this));_V_.addListener(this.video,"waiting",this.spinnersOnVideoWaiting.context(this));_V_.addListener(this.video,"stalled",this.spinnersOnVideoStalled.context(this));_V_.addListener(this.video,"suspend",this.spinnersOnVideoSuspend.context(this));_V_.addListener(this.video,"playing",this.spinnersOnVideoPlaying.context(this));_V_.addListener(this.video,"timeupdate",this.spinnersOnVideoTimeUpdate.context(this));}
this.spinners.push(element);},{showSpinners:function(){this.each(this.spinners,function(spinner){spinner.style.display="block";});clearInterval(this.spinnerInterval);this.spinnerInterval=setInterval(this.rotateSpinners.context(this),100);},hideSpinners:function(){this.each(this.spinners,function(spinner){spinner.style.display="none";});clearInterval(this.spinnerInterval);},spinnersRotated:0,rotateSpinners:function(){this.each(this.spinners,function(spinner){spinner.style.WebkitTransform='scale(0.5) rotate('+this.spinnersRotated+'deg)';spinner.style.MozTransform='scale(0.5) rotate('+this.spinnersRotated+'deg)';});if(this.spinnersRotated==360){this.spinnersRotated=0;}
this.spinnersRotated+=45;},spinnersOnVideoLoadedData:function(event){this.hideSpinners();},spinnersOnVideoLoadStart:function(event){this.showSpinners();},spinnersOnVideoSeeking:function(event){},spinnersOnVideoSeeked:function(event){},spinnersOnVideoCanPlay:function(event){},spinnersOnVideoCanPlayThrough:function(event){this.hideSpinners();},spinnersOnVideoWaiting:function(event){this.showSpinners();},spinnersOnVideoStalled:function(event){},spinnersOnVideoSuspend:function(event){},spinnersOnVideoPlaying:function(event){this.hideSpinners();},spinnersOnVideoTimeUpdate:function(event){if(this.spinner.style.display=="block"){this.hideSpinners();}}});VideoJS.player.newBehavior("subtitlesDisplay",function(element){if(!this.subtitleDisplays){this.subtitleDisplays=[];this.onCurrentTimeUpdate(this.subtitleDisplaysOnVideoTimeUpdate);this.onEnded(function(){this.lastSubtitleIndex=0;}.context(this));}
this.subtitleDisplays.push(element);},{subtitleDisplaysOnVideoTimeUpdate:function(time){if(this.subtitles){if(!this.currentSubtitle||this.currentSubtitle.start>=time||this.currentSubtitle.end<time){var newSubIndex=false,reverse=(this.subtitles[this.lastSubtitleIndex].start>time),i=this.lastSubtitleIndex-(reverse)?1:0;while(true){if(reverse){if(i<0||this.subtitles[i].end<time){break;}
if(this.subtitles[i].start<time){newSubIndex=i;break;}
i--;}else{if(i>=this.subtitles.length||this.subtitles[i].start>time){break;}
if(this.subtitles[i].end>time){newSubIndex=i;break;}
i++;}}
if(newSubIndex!==false){this.currentSubtitle=this.subtitles[newSubIndex];this.lastSubtitleIndex=newSubIndex;this.updateSubtitleDisplays(this.currentSubtitle.text);}else if(this.currentSubtitle){this.currentSubtitle=false;this.updateSubtitleDisplays("");}}}},updateSubtitleDisplays:function(val){this.each(this.subtitleDisplays,function(disp){disp.innerHTML=val;});}});VideoJS.extend({addClass:function(element,classToAdd){if((" "+element.className+" ").indexOf(" "+classToAdd+" ")==-1){element.className=element.className===""?classToAdd:element.className+" "+classToAdd;}},removeClass:function(element,classToRemove){if(element.className.indexOf(classToRemove)==-1){return;}
var classNames=element.className.split(/\s+/);classNames.splice(classNames.lastIndexOf(classToRemove),1);element.className=classNames.join(" ");},createElement:function(tagName,attributes){return this.merge(document.createElement(tagName),attributes);},blockTextSelection:function(){document.body.focus();document.onselectstart=function(){return false;};},unblockTextSelection:function(){document.onselectstart=function(){return true;};},formatTime:function(secs){var seconds=Math.round(secs);var minutes=Math.floor(seconds/60);minutes=(minutes>=10)?minutes:"0"+minutes;seconds=Math.floor(seconds%60);seconds=(seconds>=10)?seconds:"0"+seconds;return minutes+":"+seconds;},getRelativePosition:function(x,relativeElement){return Math.max(0,Math.min(1,(x-this.findPosX(relativeElement))/relativeElement.offsetWidth));},findPosX:function(obj){var curleft=obj.offsetLeft;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;}
return curleft;},getComputedStyleValue:function(element,style){return window.getComputedStyle(element,null).getPropertyValue(style);},round:function(num,dec){if(!dec){dec=0;}
return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);},addListener:function(element,type,handler){if(element.addEventListener){element.addEventListener(type,handler,false);}else if(element.attachEvent){element.attachEvent("on"+type,handler);}},removeListener:function(element,type,handler){if(element.removeEventListener){element.removeEventListener(type,handler,false);}else if(element.attachEvent){element.detachEvent("on"+type,handler);}},get:function(url,onSuccess){if(typeof XMLHttpRequest=="undefined"){XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){}
try{return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(f){}
try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(g){}
throw new Error("This browser does not support XMLHttpRequest.");};}
var request=new XMLHttpRequest();request.open("GET",url);request.onreadystatechange=function(){if(request.readyState==4&&request.status==200){onSuccess(request.responseText);}}.context(this);request.send();},trim:function(string){return string.toString().replace(/^\s+/,"").replace(/\s+$/,"");},bindDOMReady:function(){if(document.readyState==="complete"){return VideoJS.onDOMReady();}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",VideoJS.DOMContentLoaded,false);window.addEventListener("load",VideoJS.onDOMReady,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",VideoJS.DOMContentLoaded);window.attachEvent("onload",VideoJS.onDOMReady);}},DOMContentLoaded:function(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",VideoJS.DOMContentLoaded,false);VideoJS.onDOMReady();}else if(document.attachEvent){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",VideoJS.DOMContentLoaded);VideoJS.onDOMReady();}}},DOMReadyList:[],addToDOMReady:function(fn){if(VideoJS.DOMIsReady){fn.call(document);}else{VideoJS.DOMReadyList.push(fn);}},DOMIsReady:false,onDOMReady:function(){if(VideoJS.DOMIsReady){return;}
if(!document.body){return setTimeout(VideoJS.onDOMReady,13);}
VideoJS.DOMIsReady=true;if(VideoJS.DOMReadyList){for(var i=0;i<VideoJS.DOMReadyList.length;i++){VideoJS.DOMReadyList[i].call(document);}
VideoJS.DOMReadyList=null;}}});VideoJS.bindDOMReady();Function.prototype.context=function(obj){var method=this,temp=function(){return method.apply(obj,arguments);};return temp;};Function.prototype.evtContext=function(obj){var method=this,temp=function(){var origContext=this;return method.call(obj,arguments[0],origContext);};return temp;};Function.prototype.rEvtContext=function(obj,funcParent){if(this.hasContext===true){return this;}
if(!funcParent){funcParent=obj;}
for(var attrname in funcParent){if(funcParent[attrname]==this){funcParent[attrname]=this.evtContext(obj);funcParent[attrname].hasContext=true;return funcParent[attrname];}}
return this.evtContext(obj);};if(window.jQuery){(function($){$.fn.VideoJS=function(options){this.each(function(){VideoJS.setup(this,options);});return this;};$.fn.player=function(){return this[0].player;};})(jQuery);}
window.VideoJS=window._V_=VideoJS;})(window);var INTRO_VID_LOCATION="https://s3.amazonaws.com/zincwebmedia/videos/1-discover.flv";function launchVideo(){$("div#replaceme").load("/miniplayer/"+INTRO_VID_LOCATION,function(){});return false;}
$(document).ready(function(){$("a#videocorner").click(launchVideo);});
