var VinesVideoPage=new Class({Implements:[Options,Events],options:{subscriber:window.VINES_SUBSCRIBER},initialize:function(e){this.playerwrap=e;this.video=this.playerwrap.video;this.scrollWindow=new Fx.Scroll(window,{offset:{y:-100}});$$("#video-streams .feed-hdr .categories a").addEvent("click",this.toggleComments.bind(this));$$(".video #home-promo-main .comments a").addEvent("click",this.toggleComments.bind(this));$$(".js-paginate-cage").each(function(g){var f=new VinesPaginator(g)});$$('#video-streams [id^="tabcontent-vid_"]').addEvent("showtab",function(f){$$("#video-streams .feed-hdr dd").removeClass("on");f.getParent().addClass("on")});var b=new VinesAutocomplete($("video_autosearch"),"/search/autocomplete/",JSON.decode($("video_autosearch").get("data-search-data")));b.addEvent("onSelection",function(f,g){this.loadVideoById(f.id);b.reset()}.bind(this));this.initPlaylist();this.initAutoPlay();this.initHistory();$$(".playing-next .random").addEvent("click",this.getRandomVideo.bind(this));if(this.options.subscriber){this.enableSubscriberFeatures()}if($$(".videodoor").length>0&&(Cookie.read("fd-video-ts")||window.location.hash.test(/^#t=\d+m\d+s$/))){var d=function(g){var f=g.match(/\d+/g);return(parseInt(f[0],10)*60)+parseInt(f[1],10)},c=Cookie.read("fd-video-ts")||d(window.location.hash),a=function(){this.playerwrap.removeEvent("playing",a);this.playerwrap.player.seek(c)}.bind(this);this.playerwrap.options.autoplay=true;this.playerwrap.addEvents({playing:a,ready:this.playerwrap.playVideo.bind(this.playerwrap,this.video)});Cookie.dispose("fd-video-ts")}},initAutoPlay:function(){this.idle_play_count=0;this.playerwrap.addEvent("ended",this.autoPlay.bind(this));$$(".playing-next .auto-play").addEvent("click",function(a){a.stop();this.toggleClass("on");if(this.hasClass("on")){Cookie.dispose("no_auto_play")}else{Cookie.write("no_auto_play",true,{duration:365})}})},autoPlay:function(){if($$(".playing-next .auto-play.on").length===0){return}this.idle_play_count+=1;if(this.idle_play_count>=3){var a=new Element("div.idlemsg").inject(this.playerwrap.element),c=new Element("span",{text:"Hello? Are you still there?"}).inject(a),b=new Element("a.btn",{text:"Yes!"}).inject(a);b.addEvent("click",function(d){a.destroy();this.idle_play_count=0;this.loadVideoById(this.playlist[0])}.bind(this))}else{this.loadVideoById(this.playlist[0])}},enableSubscriberFeatures:function(){$$(".video-player .embiggen a").addEvent("click",this.embiggen.bind(this));$$(".playing-next .playing-img, #video-streams").addEvent("click:relay(a[data-video-id])",function(c,b){if(c.event.button!=1&&!c.meta&&!c.shift){c.stop();this.idle_play_count=0;this.loadVideoById(b.get("data-video-id"))}}.bind(this))},categoryLoaded:function(a){this.buildPlaylist(a);a.addEvent("showtab",this.buildPlaylist.bind(this))},initPlaylist:function(){$$('#video-streams [id^="tabcontent-vid_"]').addEvent("contentloaded",this.categoryLoaded.bind(this));$$('#video-streams [id^="tabcontent-vid_"]:not(.dn)').addEvent("showtab",this.buildPlaylist.bind(this));this.buildPlaylist()},buildPlaylist:function(){var a=$$('.playing-next .playing-img a[data-video-id], #video-streams [id^="tabcontent-"]:not(.dn) a[data-video-id]');var b=a.get("data-video-id").invoke("toInt");b.erase(this.video.id);b=[].combine(b);this.playlist=b},getRandomVideo:function(c){c.stop();var d=$$(".playing-next .random")[0];var b=$$(".playing-next .playing-img a")[0];var a=new Request.JSON({url:"/video/get-random-video/",onSuccess:function(e){d.set("data-video-id",e.id);this.playlist.splice(0,1,e.id);this.updateNext(e)}.bind(this)}).post({json:JSON.encode({video_id:b.get("data-video-id")})})},getVideoById:function(a,c){var b=new Request.JSON({url:"/video/get-single-video/",onSuccess:c}).post({json:JSON.encode({video_id:a})})},updateNext:function(a){$$(".playing-img img")[0].set("src",a.image_url);$$(".playing-img a")[0].set("data-video-id",a.id).set("href",a.video_url);$$(".playing-name")[0].set("text",a.video_name)},updateCurrent:function(c){this.video=c;this.playerwrap.video=c;if($$("#home-promo-main h2 a").length>0){$$("#home-promo-main h2 a").set({text:c.video_name,href:c.video_url})}else{$$("#home-promo-main h2").set("text",c.video_name)}$$("#home-promo-main p.video-deck").set("text",c.deck);$$("#home-promo-main a.comments span").set("text",c.video_comment_count+" Comments on this Video");$$("#home-promo-main a.comments").set("href",c.video_url);$$("#home-promo-main p.video-date a").set({href:c.user_profile_url,text:c.user_name});var b=new Date(c.publish_date_ts*1000);var a=["Jan.","Feb.","March","April","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."];$$("#home-promo-main p.video-date .date").set("text",a[b.getMonth()]+" "+b.getDate()+", "+b.getFullYear());$$("#home-promo-main li.comments a").set({text:c.video_comment_count+" Comments",href:c.video_url});$$("#home-promo-main li.dl ul a").each(function(d,f){var e="";switch(f){case 0:e=c.urls.progressive_mobile;break;case 1:e=c.urls.progressive_low;break;case 2:e=c.urls.progressive_high;break;case 3:e=c.urls.progressive_hd+"?download=1";break;default:break}d.set("href",e)});$$("#home-promo-main li.theater a").set("href","/video/theater/"+c.id+"/");$$(".video-player li.twitter, .video-player li.fb, .video-player li.share").destroy();this.updateHistory(c)},initHistory:function(){window.onpopstate=function(a){if(a.state&&a.state.id){a.state.popstate=true;this.loadVideoById(a.state.id)}}.bind(this)},updateHistory:function(a){if(!a.popstate&&$$(".videodoor").length>0&&!!(window.history&&history.pushState)&&window.location.pathname!=a.video_url){document.title=a.video_name+" - "+window.VINES_SITE_FULL_NAME;window.history.pushState(a,document.title,a.video_url)}},buildInterAgeGate:function(){this.playerwrap.element.getElements(".age-gate").destroy();var a=new Element("div.idlemsg").inject(this.playerwrap.element),c=this.playerwrap.buildAgeGate().inject(a),b=new Element("a.btn",{text:"Go"}).inject(a);b.addEvent("click",this.playerwrap.playVideo.bind(this.playerwrap,this.video))},buildSubscriberMessage:function(){var a=new Element("div.idlemsg").inject(this.playerwrap.element),c=new Element("span",{text:"This video is available to premium members only."}).inject(a),b=new Element("a.btn",{text:"Click here to get access.",href:window.VINES_SIGNUP_URL}).inject(a);return false},loadVideoById:function(a){this.scrollWindow.toElement(this.playerwrap.element,"y");this.playerwrap.pauseVideo();if(this.playlist[0]==a){var c=this.playlist.shift();this.playlist.include(c);this.getVideoById(this.playlist[0],this.updateNext)}var b=new Request.JSON({url:"/video/get-single-video/",onSuccess:this.videoLoaded.bind(this)}).post({json:JSON.encode({video_id:a})});var d=new Request.HTML({url:"/video/get-single-video/",update:"object-stats-wrap"}).post({json:JSON.encode({video_id:a,tpl:"video/async_object_links.html"})});this.loadComments(a)},videoLoaded:function(a){this.updateCurrent(a);this.playerwrap.element.getElements(".idlemsg").destroy();if(a.age_gate&&!this.playerwrap.options.age_gate_passed){this.buildInterAgeGate();return false}if(a.subscriber_only&&!this.options.subscriber){this.buildSubscriberMessage();return false}this.playerwrap.playVideo(a);return true},toggleComments:function(a){a.stop();$("video-streams").toggleClass("fourcol").toggleClass("last");$("video-search").toggleClass("fourcol").toggleClass("last");$("comments-stream").toggleClass("eightcol");this.loadComments()},loadComments:function(a){a=a||this.playerwrap.video.id;if(!$("comments-stream")||!$("comments-stream").hasClass("eightcol")||$("comments-stream").get("data-video-id")==a){return}$("comments-stream").set("data-video-id",a).empty();var d=new Element("div.loading").inject("comments-stream");var c="/shout/display-comment-list/?object_id="+a+"&content_type_id="+$("comments-stream").get("data-ctid");var b=new Request.HTML({url:"/shout/display-comment-list/",update:"comments-stream",onComplete:function(){$("comments-stream").addClass("js-paginate-cage").set("data-js-paginate-url",c);var e=new VinesPaginator("comments-stream");window.fireEvent("newcontent")}}).get({object_id:a,content_type_id:$("comments-stream").get("data-ctid")})},embiggen:function(c){c.stop();if(Browser.firefox&&this.playerwrap.player){var b=this.playerwrap.player.getPosition(),a=function(){this.playerwrap.player.removeEvent("playing",a);this.playerwrap.player.seek(b)}.bind(this);this.playerwrap.player.addEvent("playing",a)}c.target.set("text",c.target.get("text")=="Embiggen"?"Debiggen":"Embiggen");$$(".player-hold").toggleClass("eightcol");$$(".player-info").toggleClass("fourcol").toggleClass("last");$$("#home-promo-main").toggleClass("andre");$$("#video-streams").toggleClass("andre");if($$("#home-promo-main.andre").length>0){Cookie.write("embiggen",true,{duration:365})}else{Cookie.dispose("embiggen")}}});var RubixVideoSignal=new Class({Implements:[Options,Events],initialize:function(a,b,d,c){this.video_id=a;if(b=="streaming"||b=="progressive"){b="flowplayer"}this.data={quality:d,video_length:c,player:b.toLowerCase()};this.request=new Request({url:"/videos/log-video-watched/"+a+"/"+(new Date().getTime())+"/",method:"get",initialDelay:0,delay:10000})},start:function(){this.request.startTimer(this.data)},stop:function(){this.request.stopTimer();this.request.get(this.data)}});var VideoPlayer=new Class({Implements:[Options,Events],options:{player:null},initialize:function(c,d,b){this.setOptions(b);this.rubixSignal=new RubixVideoSignal(d.id,this.options.playbackType,this.options.qualityType,d.length_seconds);this.element=c.empty();var a=new Element("div.curtain").inject(this.element).tween("opacity",1);this.addEvents({loading:function(){this.playback_skipped=false}.bind(this),seeking:function(){this.playback_skipped=true}.bind(this),playing:function(){if(this.video.id!=this.rubixSignal.video_id){this.rubixSignal.request.stopTimer();this.rubixSignal=new RubixVideoSignal(this.video.id,this.options.playbackType,this.options.qualityType,this.video.length_seconds)}this.rubixSignal.start()}.bind(this),paused:function(){this.rubixSignal.stop()}.bind(this),ended:function(){this.rubixSignal.stop();if(!!this.video.quest_url&&!this.playback_skipped){new Request({url:this.video.quest_url,method:"GET"}).send()}}.bind(this)});this.load(d)},load:function(b){this.fireEvent("loading");this.video=b;if(this.hdrequest){this.hdrequest.cancel()}var d=b.urls;var c=this.options.playbackType=="html5"?"progressive":this.options.playbackType,a=d[c+"_"+this.options.qualityType];if(!a){alert("Something unfortunate happened and the video can not play. Try reloading...");return}if(this.options.qualityType=="hd"){this.hdrequest=new Request.JSON({url:a,onSuccess:function(e){this.url=(this.url||this.options.playbackType=="html5")?e.url:encodeURIComponent(e.url);this.play(this.url)}.bind(this),onFailure:function(e){alert("Couldn't tune into the encrypted channel. Reload and try again.")}}).get()}else{this.url=a;this.play(this.url)}},play:function(){alert("player does not have a play function implemented")},pause:function(){alert("player does not have a pause function implemented")},seek:function(){alert("player does not have a seek function implemented")},getPosition:function(){alert("player does not have a getPosition function implmented")},getDuration:function(){alert("player does not have a getDuration function implemented")},onPlay:function(){this.fireEvent("playing")},onPause:function(){this.fireEvent("paused")},onBuffer:function(){this.fireEvent("buffering")},onEnd:function(){this.fireEvent("ended")},onSeek:function(){this.fireEvent("seeking")}});var VinesFlowPlayer=new Class({Extends:VideoPlayer,options:{controls:{autoHide:"always",timeColor:"#c6c6c6",durationColor:"#ffffff",timeFontSize:"10",timeBgColor:null,buttonColor:"#f7f7f7",buttonOverColor:"#ffffff",backgroundColor:"rgba(12, 12, 12, 0.7)",backgroundGradient:[0.12,0],bufferColor:"#404040",bufferGradient:[0.25,0],sliderColor:"#222222",sliderGradient:[0.5,0],sliderBorder:"1px solid rgba(0, 0, 0, 1)",borderRadius:"0px",tooltipColor:"#000",tooltipTextColor:"#ffffff",progressColor:"#a0a0a0",progressGradient:[1,0],volumeColor:"#a0a0a0",volumeSliderColor:"#222222",volumeSliderGradient:[0.5,0],volumeBorder:"1px solid rgba(0, 0, 0, 1)",scrubberBarHeightRatio:"0.5",volumeBarHeightRatio:"0.5",height:"24",borderWidth:1,borderColor:"rgba(70, 70, 70, 1)"}},initialize:function(b,c,a){this.setOptions(window.VIDEO_CONSTANTS);this.parent(b,c,a)},play:function(a){if(!this.player){this.buildPlayer([this.createClip(a)])}else{this.player.play(this.createClip(a))}},pause:function(){if(this.player){this.player.pause()}},seek:function(a){if(this.player){this.player.seek(a)}},createClip:function(a){var b={provider:this.options.playbackType=="progressive"?"http":"rtmp",url:a};if(this.options.playbackType=="streaming"&&this.options.qualityType=="hd"){b.netConnectionUrl=this.options.streamingPrefix.replace("rtmp://","rtmp://s")}return b},buildPlayer:function(b){var a={playlist:b,clip:{onStart:this.onPlay.bind(this),onFinish:this.onEnd.bind(this),onResume:this.onPlay.bind(this),onPause:this.onPause.bind(this),onBeforeSeek:this.onSeek.bind(this),scaling:"fit"},canvas:{background:"#000000",backgroundGradient:"none"},plugins:{rtmp:{netConnectionUrl:this.options.streamingPrefix,url:this.options.rtmpSwf}}};if(this.options.playerKey){a.key=this.options.playerKey}if(this.options.controls){a.plugins.controls=this.options.controls}this.player=$f(this.element,{src:this.options.playerSwf,wmode:"opaque"},a);this.player.play()},getPosition:function(){return this.player.getTime()}});var VinesHTML5Player=new Class({Extends:VideoPlayer,play:function(a){if(!this.player){this.buildPlayer()}this.player.src=a;this.player.load()},pause:function(){this.player.pause()},seek:function(a){this.player.currentTime=a;this.player.play()},buildPlayer:function(){this.player=new Element("video",{controls:"controls",autoplay:"autoplay","x-webkit-airplay":"allow"});this.player.empty().inject(this.element);this.addPlayerEvents();if(Browser.chrome){var a=new Element("a.fullscreen-toggle",{text:"fullscreen"}).inject(this.player,"after"),c=this.element.getParent(),b=c.getParent();a.addEvent("click",function(d){c.toggleClass("fullscreen");if(c.hasClass("fullscreen")){c.inject(document.body);$("over_skin").addClass("dn")}else{c.inject(b,"top");$("over_skin").removeClass("dn")}this.player.play()}.bind(this))}},addPlayerEvents:function(){this.player.addEventListener("playing",this.onPlay.bind(this),false);this.player.addEventListener("pause",this.onPause.bind(this),false);this.player.addEventListener("seeked",this.onSeek.bind(this),false);this.player.addEventListener("ended",this.onEnd.bind(this),false)},getPosition:function(){return this.player.currentTime}});var VinesYouTubePlayer=new Class({Extends:VideoPlayer,initPlayer:function(){this.player_options={width:"100%",height:"100%",videoId:this.video.youtube_id,playerVars:{autohide:1,iv_load_policy:3,showinfo:0,rel:0,wmode:"opaque"},events:{onStateChange:this.onPlayerStateChange.bind(this)}};if(this.options.autoplay){this.player_options.playerVars.autoplay=1}this.element_id="ytPlayer-wrap-"+this.video.youtube_id;this.element_id=this.element_id+"-"+String($$('[id^="'+this.element_id+'"]').length);this.element.empty().set("id",this.element_id);if(window.YT){this.buildPlayer()}else{if(document.getElement('script[src="http://www.youtube.com/player_api"]')){window.addEvent("onYouTubePlayerAPIReader",this.buildPlayer.bind(this))}else{window.onYouTubePlayerAPIReady=function(){window.fireEvent("onYouTubePlayerAPIReader")};window.addEvent("onYouTubePlayerAPIReader",this.buildPlayer.bind(this));var a=document.createElement("script");a.src="http://www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}}},buildPlayer:function(){this.player=new YT.Player(this.element_id,this.player_options)},onPlayerStateChange:function(a){switch(a.data){case YT.PlayerState.ENDED:this.onEnd();break;case YT.PlayerState.PLAYING:this.onPlay();break;case YT.PlayerState.PAUSED:this.onPause();break;case YT.PlayerState.BUFFERING:this.onBuffer();break;case YT.PlayerState.CUED:break;default:break}},load:function(a){this.fireEvent("loading");this.video=a;if(this.player){this.player.loadVideoById(a.youtube_id)}else{this.initPlayer()}},pause:function(){if(this.player){this.player.pauseVideo()}},seek:function(a){this.player.seekTo(a,true)},getPosition:function(){return this.player.getCurrentTime()}});var VinesPlayerWrap=new Class({Implements:[Options,Events],options:{subscriber:window.VINES_SUBSCRIBER,age_gate_passed:false,qualityType:"high",qualityTypes:["low","high","hd"],qualityCookieName:"video_quality",playbackType:"YouTube",playbackTypes:["streaming","progressive","html5","YouTube"],playbackCookieName:"video_playback_type"},initialize:function(b,c,a){this.setOptions(a);this.element=$(b);this.element.store("playerwrap",this);this.video=c;if(this.video.youtube_id){Asset.image("http://youtube.com/favicon.ico",{onLoad:this.buildSettings.bind(this),onError:function(){this.video.force_whiskey_player=true;this.buildSettings()}.bind(this)})}else{this.buildSettings()}$$(".frontdoor #home-promo-main.video a.js-promo, .frontdoor #home-promo-main.video .embed .comments").addEvent("click",function(){if(this.player){Cookie.write("fd-video-ts",this.player.getPosition())}}.bind(this))},buildSettings:function(){var i=this,e=new Element("div.settings").inject(this.element);if(this.video.age_gate){this.buildAgeGate().inject(e)}if(!this.options.subscriber&&(this.video.youtube_id&&!this.video.force_whiskey_player)){this.choosePlayer();return false}else{this.options.autoplay=true}var a=new Element("ul.playback").inject(e),h=new Element("ul.quality").inject(e),g=this.options.playbackCookieName,c=this.options.qualityCookieName,f=Cookie.read(g),b=Cookie.read(c);if(!this.video.youtube_id||this.video.force_whiskey_player){this.options.playbackTypes.erase("YouTube")}if(Browser.Platform.ios){this.options.playbackTypes.erase("streaming");this.options.playbackTypes.erase("progressive")}if(this.options.playbackTypes.contains(f)){this.options.playbackType=f}this.options.playbackTypes.each(function(l){var j=new Element("li").inject(a),k=new Element("a",{text:l}).inject(j);if(this.options.playbackType==l){k.addClass("selected")}if(l=="html5"){k.addClass("vinestip");k.set("title","::HTML5 Video is a subscriber-only feature that works in H.264-compliant browsers.")}}.bind(this));if(!a.getElement(".selected")){a.getElement("a").addClass("selected");this.options.playbackType=this.options.playbackTypes[0]}if(this.options.playbackType=="YouTube"){h.setStyle("display","none")}a.addEvent("click:relay(a)",function(k){var j=this.get("text");if(j=="html5"&&!i.options.subscriber){k.stop();return false}a.getElements(".selected").removeClass("selected");this.addClass("selected");i.options.playbackType=j;Cookie.write(g,i.options.playbackType,{duration:365});h.setStyle("display",(i.options.playbackType=="YouTube")?"none":"block");return true});if(this.options.qualityTypes.contains(b)){this.options.qualityType=b}this.options.qualityTypes.each(function(l){var j=new Element("li").inject(h),k=new Element("a",{text:l}).inject(j);if(this.options.qualityType==l){k.addClass("selected")}if(l=="hd"){k.addClass("vinestip");k.set("title","::HD video is a subscriber-only feature.")}}.bind(this));h.addEvent("click:relay(a)",function(k){var j=this.get("text");if(j=="hd"&&!i.options.subscriber){k.stop();return false}h.getElements(".selected").removeClass("selected");this.addClass("selected");i.options.qualityType=j;Cookie.write(c,i.options.qualityType,{duration:365});return true});var d=new Element("a.play").inject(this.element).addEvent("click",this.playVideo.bind(this,this.video));this.fireEvent("ready");return true},buildAgeGate:function(){var l=this,b=["January","February","March","April","May","June","July","August","September","October","November","December"],k=new Element("form.age-gate",{action:""}),m=new Element("fieldset").inject(k),e=new Element("legend",{text:"Enter your birthday"}).inject(m),c=new Element("select",{name:"month"}).inject(m),f=new Element("select",{name:"day"}).inject(m),a=new Element("select",{name:"year"}).inject(m),n=Cookie.read("video_agegate");b.each(function(p,d){var o=new Element("option",{value:d+1,text:p}).inject(c)});var h=new Date().getFullYear();for(var i=h;i>h-60;i--){new Element("option",{value:i,text:i}).inject(a)}for(var g=1;g<=31;g++){new Element("option",{value:g,text:g}).inject(f)}if(n){var j=n.split(":");a.set("value",j[0]);c.set("value",j[1]);f.set("value",j[2])}return k},ageCheck:function(){if(!this.video.age_gate||this.options.age_gate_passed){return true}var c=this.element.getElements('[name="month"],[name="day"],[name="year"]').get("value").invoke("toInt").associate(["month","day","year"]),b=new Date(),a={day:b.getDate(),month:(b.getMonth()+1),year:b.getFullYear()};if((a.month<c.month)||(a.month==c.month&a.day<c.day)){a.year-=1}this.options.age_gate_passed=(a.year-c.year)>=18;Cookie.write("video_agegate",c.year+":"+c.month+":"+c.day,{duration:365});if(!this.options.age_gate_passed){alert("You're too young to watch the filth in this video. Go to church instead.")}else{this.element.getElements(".idlemsg").destroy()}return this.options.age_gate_passed},playVideo:function(a){if(!this.ageCheck()){return false}if(this.player){if(this.options.playbackType.toLowerCase()=="youtube"&&!a.youtube_id){this.options.playbackType="streaming";this.choosePlayer()}else{this.player.load(a)}}else{if(this.options.playbackType.toLowerCase()=="youtube"&&!a.youtube_id){this.options.playbackType="streaming"}this.choosePlayer()}return true},pauseVideo:function(){if(this.player){this.player.pause()}},seekVideo:function(a){if(this.player){this.player.seek(a)}},html5VideoCheck:function(){var c=document.createElement("video"),a=false;try{if(a=!!c.canPlayType){a=new Boolean(a);a.ogg=c.canPlayType('video/ogg; codecs="theora"');var b='video/mp4; codecs="avc1.42E01E';a.h264=c.canPlayType(b+'"')||c.canPlayType(b+', mp4a.40.2"');a.webm=c.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(d){}return a},choosePlayer:function(){switch(this.options.playbackType){case"html5":if(!this.html5VideoCheck().h264&&!confirm("Your browser reports that it can not play h.264 video natively. Do you want to try anyway?")){return}this.player=new VinesHTML5Player(this.element,this.video,this.options);break;case"streaming":case"progressive":this.player=new VinesFlowPlayer(this.element,this.video,this.options);break;default:this.player=new VinesYouTubePlayer(this.element,this.video,this.options);break}this.player.addEvents({playing:this.fireEvent.bind(this,"playing"),paused:this.fireEvent.bind(this,"paused"),buffering:this.fireEvent.bind(this,"buffering"),ended:this.fireEvent.bind(this,"ended"),seeking:this.fireEvent.bind(this,"seeking")})}});document.addEvent("domready",function(){$$(".player[data-video]").each(function(a){var b=new VinesPlayerWrap(a,JSON.parse(a.get("data-video")))});$$("body.video #home-promo-main .player[data-video]").each(function(b){var a=b.retrieve("playerwrap"),c=new VinesVideoPage(a)});$$(".frontdoor .playing-next .random").addEvent("click",function(c){c.stop();var d=$$(".playing-next .random")[0];var b=$$(".playing-next .playing-img a")[0];var a=new Request.JSON({url:"/video/get-random-video/",onSuccess:function(e){d.set("data-video-id",e.id);$$(".playing-img img")[0].set("src",e.image_url);$$(".playing-img a")[0].set("data-video-id",e.id).set("href",e.video_url);$$(".playing-name")[0].set("text",e.video_name)}}).post({json:JSON.encode({video_id:b.get("data-video-id")})})})});
