/* THEATRICS.COM LLC CONFIDENTIAL - Unpublished Copyright (c) 2009-2011 Theatrics.com, LLC, All Rights Reserved. */

var INITIAL_HASH_VALUE=window.location.hash;var BeckiUtils=(function()
{this.VIDEO_URL="http://www.theatrics.com/beckinfield/video/";this.PLAYER_WIDTH=640;this.PLAYER_HEIGHT=360;this.PLAYER_TYPE='mini';this.PLAYER_EMBED_CODE='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="_PLAYER_WIDTH_" height="_PLAYER_HEIGHT_" id="theatricsplayer"> '+'<param name="movie" value="http://www.viddler.com/_PLAYER_TYPE_/VidKeyAbc123/" /> '+'<param name="nologo" value="t" />'+'<param name="hidestats" value="t" />'+'<param name="optNoTopMenu" value="1" />'+'<param name="wmode" value="transparent" />'+'<param name="useJavaScript" value="t" />'+'<param name="enablecallbacks" value="t" />'+'<param name="whichbar" value="0" />'+'<param name="autoplay" value="_AUTOPLAY_" />'+'<param name="flashvars" value="nologo=t&hidestats=t&optNoTopMenu=1&wmode=transparent&useJavaScript=t&enablecallbacks=t&whichbar=0&autoplay=_AUTOPLAY_"/>'+'<param name="allowScriptAccess" value="always" />'+'<param name="allowFullScreen" value="true" />'+'<embed src="http://www.viddler.com/_PLAYER_TYPE_/VidKeyAbc123/" '+'width="_PLAYER_WIDTH_" height="_PLAYER_HEIGHT_" '+'type="application/x-shockwave-flash" '+'allowScriptAccess="always" allowFullScreen="true" '+'flashvars="nologo=t&hidestats=t&optNoTopMenu=1&wmode=transparent&useJavaScript=t&enablecallbacks=t&whichbar=0&autoplay=_AUTOPLAY_" '+'name="theatricsplayer" wmode="transparent" >'+'</embed></object>';function GetVideoEmbedCode(altvid,autoplay,w,h,start,playerType,showLogo)
{altvid=(altvid)?altvid:BeckiVideoPlayer.CURRENT_ALTVID;autoplay=(autoplay===true||autoplay==='t')?'t':'f';w=(w>0)?w:BeckiUtils.PLAYER_WIDTH;h=(h>0)?h:BeckiUtils.PLAYER_HEIGHT;start=(start>0)?start:0;if(playerType!=='player'&&playerType!=='mini'&&playerType!=='simple'){playerType=BeckiUtils.PLAYER_TYPE;}
showLogo=(showLogo)?true:false;var o=ParseAltVid(altvid);var embed=BeckiUtils.PLAYER_EMBED_CODE;if(start>0){var re1=new RegExp("VidKeyAbc123/","g");embed=embed.replace(re1,"VidKeyAbc123/"+start);}
var re=new RegExp("VidKeyAbc123","g");embed=embed.replace(re,o.vid);re=new RegExp("_AUTOPLAY_","g");embed=embed.replace(re,autoplay);re=new RegExp("_PLAYER_TYPE_","g");embed=embed.replace(re,playerType);re=new RegExp("_PLAYER_WIDTH_","g");embed=embed.replace(re,w);re=new RegExp("_PLAYER_HEIGHT_","g");embed=embed.replace(re,h);if(showLogo){re=new RegExp('<param name="nologo" value="t" />',"g");embed=embed.replace(re,'');re=new RegExp('nologo=t&',"g");embed=embed.replace(re,'');}
return embed;}
function MailToVideoLink(videoid,title,desc,msgid)
{var EMAIL_SUBJECT=["Check out my video at Beckinfield!","Inappropriate Content","Copyrighted Material","Technical Problem (playback, quality, error message, etc.)"];var EMAIL_BODY=["Hi,\n\nClick the link below to see my latest video at Beckinfield!\n\n","Inappropriate Content reported for the following video:\n\n","Copyrighted Material reported for the following video:\n\n","Technical Problem (playback, quality, error message, etc.) reported for the following video:\n\n"];if(msgid===undefined||msgid===null||msgid<=0){msgid=0;}
if(videoid===undefined||videoid===null||videoid<=0){videoid=BeckiVideoPlayer.CURRENT_VIDEO;}
if(title===undefined||title===null){title=$('#videoinfo-title').html();}
if(!title)title='';title=title.replace("&nbsp;"," ");if(title.length>0)title+="\n";if(desc===undefined||desc===null){desc=$('#videoinfo-description').html();}
if(!desc)desc='';desc=desc.replace("&nbsp;"," ");if(desc.length>0)desc+="\n";desc=title+desc;if(desc.length>0)desc+="\n";var body=EMAIL_BODY[msgid]+desc+"Link: "+BeckiUtils.VIDEO_URL+videoid;var to='';if(msgid>0){to='support@beckinfield.com';body+="\n\nPlease do not modify the text above. Enter your comments below this line:\n"+"______________________________________________________________________________________\n\n";}
openMailTo(to,EMAIL_SUBJECT[msgid],body);return false;}
this.GenericPopupRegistry=[];function GenericPopupFind(name)
{return BeckiUtils.GenericPopupRegistry[name];}
function GenericPopupHide(name)
{var popup=BeckiUtils.GenericPopupRegistry[name];if(popup){popup.hide();}}
function GenericPopup(config)
{var t=new Date().getTime();var r=Math.floor(Math.random()*99+1);this.ajaxAction="/site/noaction/noparam/";this.attrName=null;this.hoverSelector=null;this.useClickForHoverOnTouchDevices=true;this.clickSelector=null;this.usePageWideMask=false;this.name='GenericPopup'+t+r;this.cacheDuration=5*(60*1000);this.sizingSelector='> DIV';this.contentSelector=null;this.usePageXY=true;this.popupW=-1;this.popupH=-1;this.padLeft=0;this.padTop=0;this.container=null;this.containerClass=null;this.parseAjaxParamCallback=null;this.getPointValueCallback=null;this.getPointPositionCallback=null;this.applyConfig(config);this.timeoutId=0;this.cache=[];this.target=null;this.currentValue=null;this.currentPoint=null;this.top=0;this.left=0;this.pointOffset=null;this.pointWidth=0;this.pointHeight=0;this.isTouchDevice=isTouchDevice();BeckiUtils.GenericPopupRegistry[this.name]=this;var mythis=this;if(this.clickSelector!=null){$(this.clickSelector).click(mythis,this.clickHandler);}
if(this.useClickForHoverOnTouchDevices&&this.isTouchDevice&&this.hoverSelector!=null){$(this.hoverSelector).click(mythis,this.clickHandler);}
if(!isTouchDevice()&&this.hoverSelector!=null){$(this.hoverSelector).mouseenter(mythis,this.hoverOver);$(this.hoverSelector).mouseleave(mythis,this.hoverOut);}
this.createContainer();}
GenericPopup.prototype.applyConfig=function(config)
{for(var c in config){this[c]=config[c];}}
GenericPopup.prototype.setDataPoint=function(value,html)
{var t=new Date().getTime();var dp={html:html,time:t};this.cache[value]=dp;return this.cache[value];}
GenericPopup.prototype.getDataPoint=function(value)
{var t=new Date().getTime();if(this.cache===undefined||this.cache===null){this.cache=[];}
if(this.cache[value]===undefined||this.cache[value]===null||this.cache[value].html===undefined||this.cache[value].html===null||this.cache[value].html.length<=0||this.cache[value].time===undefined||this.cache[value].time===null||(t-this.cache[value].time)>=this.cacheDuration)
{return null;}
return this.cache[value];}
GenericPopup.prototype.createContainer=function()
{if(this.container==null)
{if(this.containerClass!=null){$('body').append('<div id="'+this.name+'" class="'+this.containerClass+'" style="display: none;"></div>');}else{$('body').append('<div id="'+this.name+'" style="position: absolute; display: none;"></div>');}
this.container=$('#'+this.name);}}
GenericPopup.prototype.render=function()
{if(this.timeoutId===0||this.currentValue===null){return;}
if(this.contentSelector!=null){$(this.contentSelector,this.container).html(this.cache[this.currentValue].html);}else{this.container.html(this.cache[this.currentValue].html);}
if(this.usePageWideMask){var mythis=this;$('body').append('<div id="'+this.name+'-target" style="position: absolute; z-index: 9500; background-color: transparent;"></div>');this.target=$('#'+this.name+'-target');this.target.css('top',this.pointOffset.top+'px');this.target.css('left',this.pointOffset.left+'px');this.target.css('width',this.pointWidth+'px');this.target.css('height',this.pointHeight+'px');this.target.click(function(){mythis.container.click();});CreateClearPageWideMask('BeckiVideoThumbnailMask',true,true,function(){mythis.hide();});}
this.container.css('display','block');var w=this.popupW;if(w<0){if(this.sizingSelector!=null){w=$(this.sizingSelector,this.container).width();}else{w=this.container.width();}}
var h=this.popupH;if(h<0){if(this.sizingSelector!=null){h=$(this.sizingSelector,this.container).height();}else{h=this.container.height();}}
this.left=(this.pointOffset.left-((w-this.pointWidth)/2))+this.padLeft;if(this.left<0){this.left=0;}
this.top=(this.pointOffset.top-h)+this.padTop;if(this.top<0){this.top=0;}
this.container.css('top',this.top+'px');this.container.css('left',this.left+'px');}
GenericPopup.prototype.show=function()
{if(this.getDataPoint(this.currentValue)!=null){this.render();return;}
var ajaxParam=this.currentValue;if(this.parseAjaxParamCallback!=null){ajaxParam=this.parseAjaxParamCallback(ajaxParam);}
var mythis=this;$.ajax({type:"GET",url:beckiBaseUrl+mythis.ajaxAction+ajaxParam,success:function(html){if(html!=null&&html!=''){mythis.setDataPoint(mythis.currentValue,html);mythis.render();return;}}});}
GenericPopup.prototype.isShowing=function()
{return this.container.is(":visible");}
GenericPopup.prototype.hide=function()
{clearTimeout(this.timeoutId);this.timeoutId=0;this.currentValue=null;if(this.container!=null){this.container.css('display','none');}
if(this.usePageWideMask){if(this.target!=null){this.target.hide();this.target.remove();}
CloseClearPageWideMask('BeckiVideoThumbnailMask');}}
GenericPopup.prototype.getPointValue=function(point)
{this.currentPoint=point;if(this.getPointValueCallback!=null){this.currentValue=this.getPointValueCallback(point);return this.currentValue;}
if(this.attrName!=null&&this.attrName!=''){this.currentValue=$(point).attr(this.attrName);}else{this.currentValue=$(point).attr('alt');if(!this.currentValue){this.currentValue=$(point).attr('href');}}
return this.currentValue;}
GenericPopup.prototype.getPointPosition=function(point,event)
{if(this.getPointPositionCallback!=null){this.getPointPositionCallback(point,event);return;}
if(this.usePageXY){this.pointOffset={top:event.pageY,left:event.pageX};this.pointWidth=0;this.pointHeight=$(point).offset();}else{this.pointOffset=$(point).offset();this.pointWidth=$(point).width();this.pointHeight=$(point).height();}}
GenericPopup.prototype.pointEventHandler=function(point,event)
{if(this.getPointValue(point)){this.getPointPosition(point,event);var mythis=this;this.timeoutId=setTimeout(function(){mythis.show();},0);}}
GenericPopup.prototype.clickHandler=function(event)
{var mythis=event.data;var oldValue=mythis.currentValue;var newValue=mythis.getPointValue(this);if(newValue==oldValue){mythis.hide();}else{mythis.pointEventHandler(this,event);}
return false;}
GenericPopup.prototype.hoverOver=function(event)
{if(event&&event.data)event.data.pointEventHandler(this,event);}
GenericPopup.prototype.hoverOut=function(event)
{if(event&&event.data)event.data.hide();}
function SidebarHover(selector,className)
{var popup=$('#'+className);if(popup.length<=0){$('body').append('<div id="'+className+'" class="'+className+'"></div>');popup=$('#'+className);}
$(selector).hover(function(){popup.css('display','block');var wp=popup.width();var hp=popup.height();var w=$(this).width();var offset=$(this).offset();var left=offset.left+(w/2)-(wp/2);var top=offset.top-hp;popup.css('left',left+'px');popup.css('top',top+'px');},function(){popup.css('display','none');});}
function InfoBoxPopup(config)
{this.name='BeckiInfoBoxPopup';this.linkButtonSelector=".infoboxpop-popup .linkButton";this.href=null;this.popupConfigOverrides=null;var popupConfig={attrName:'ajaxparam',containerClass:"infoboxpop-popup",sizingSelector:null,ajaxAction:"/search/infobox",usePageXY:false,ignoreHoverOnTouchDevice:true,useClickForHoverOnTouchDevices:false,parseAjaxParamCallback:function(value){return value;}}
for(var c in config){this[c]=config[c];}
if(this.popupConfigOverrides!==null){for(var pc in this.popupConfigOverrides){popupConfig[pc]=this.popupConfigOverrides[pc];}}
this.popup=new BeckiUtils.GenericPopup(popupConfig);}
InfoBoxPopup.prototype.bindEvents=function(hoverSelector,actionSelector)
{var mythis=this;actionSelector=(actionSelector)?actionSelector:null;hoverSelector=(hoverSelector)?hoverSelector:null;if(this.popup.isTouchDevice)
{if(hoverSelector!=null)
{$(hoverSelector).unbind("click");$(hoverSelector).click(function(){var ajaxparam=$(this).attr('ajaxparam');mythis.href=$(this).attr('href');if(mythis.popup.isShowing())
{if(mythis.popup.currentValue==ajaxparam){mythis.popup.hide();}else{mythis.hoverOver(this);}}
else{mythis.hoverOver(this);}
return false;});}
if(actionSelector!=null)
{$(this.linkButtonSelector,this.popup.container).unbind("click");$(this.linkButtonSelector,this.popup.container).click(function(){mythis.popup.hide();if(mythis.href!=null){window.location.href=mythis.href;}});this.popup.container.unbind("click");this.popup.container.click(function(){mythis.popup.hide();if(mythis.href!=null){window.location.href=mythis.href;}
return false;});$(actionSelector).unbind("dblclick");$(actionSelector).dblclick(function(){mythis.popup.hide();if(mythis.href!=null){window.location.href=mythis.href;}
return false;});}}
else
{if(hoverSelector!=null){this.hoverIntent(hoverSelector);}}}
InfoBoxPopup.prototype.isShowing=function()
{return this.popup.isShowing();}
InfoBoxPopup.prototype.hide=function()
{this.popup.hide();}
InfoBoxPopup.prototype.hoverOver=function(scope)
{var event={data:this.popup};this.popup.pointEventHandler(scope,event);}
InfoBoxPopup.prototype.hoverIntent=function(selector)
{var mythis=this;if(!isTouchDevice()){$(selector).hoverIntent({over:function(){mythis.hoverOver(this);},timeout:0,out:function(){mythis.hide();}});}}
function VideoCarousel(config)
{this.index=0;this.cookie=null;this.videoCarouselSel='';this.notificationSel='';this.messageSel=null;this.eCarouselSel='';this.ajaxLoading=true;this.pageControls=false;this.ajaxOption='';this.totalCount=0;this.bindEventsCallback=null;this.eCarousel=null;this.eCarouselSettings={};for(var c in config){this[c]=config[c];}}
VideoCarousel.prototype.ajaxGetData=function(eCarousel,pageSize,nextFetchOffset,next)
{var mythis=this;jQuery.ajax({type:"GET",dataType:'json',url:beckiBaseUrl+mythis.ajaxOption+"/playing/"+BeckiVideoPlayer.CURRENT_VIDEO+"/totalcount/"+mythis.totalCount+"/pagesize/"+pageSize+"/offset/"+nextFetchOffset,success:function(data){mythis.handleAjaxData(eCarousel,pageSize,nextFetchOffset,next,data);}});}
VideoCarousel.prototype.handleAjaxData=function(eCarousel,pageSize,nextFetchOffset,next,data)
{if(data.totalCount>=0){this.totalCount=data.totalCount;this.setNotification(this.totalCount);}
if(data.paging&&data.paging.length>0){this.setPagingControls(data.paging);}
if(data.message==null||data.message.length==0){if(this.messageSel){$(this.messageSel).css("visibility","hidden");$(this.messageSel).hide();$(this.videoCarouselSel).css("visibility","visible");$(this.videoCarouselSel).show();}}
if(data.message&&data.message.length>0)
{if(this.messageSel)
{$(this.videoCarouselSel).css("visibility","hidden");$(this.videoCarouselSel).hide();$(this.messageSel).text(data.message);$(this.messageSel).css("visibility","visible");$(this.messageSel).show();}
eCarousel.clear();eCarousel.buttonsOff();}
else if(data.start&&data.start.length>0)
{this.ajaxOption=data.start;eCarousel.replace(data.items);}
else{eCarousel.add(data.items,next,nextFetchOffset);}}
VideoCarousel.prototype.ajaxGetPageControls=function(pageSize,offset)
{var mythis=this;jQuery.ajax({type:"GET",url:beckiBaseUrl+"/video/pagecontrols"+mythis.ajaxOption+"/totalcount/"+mythis.totalCount+"/pagesize/"+pageSize+"/offset/"+offset,success:function(html){if(html&&html.length&&html!='nodata'){mythis.setPagingControls(html);}}});}
VideoCarousel.prototype.setPagingControls=function(pagingHtml)
{var mythis=this;$('#paging_controls_'+this.index).html(pagingHtml);$("#goto_page"+this.index+" A").unbind('click');$("#goto_page"+this.index+" A").click(function(){var pagingUrl=$(this).attr('href');mythis.gotoPage(pagingUrl);return false;});}
VideoCarousel.prototype.setNotification=function(count)
{if(this.notificationSel&&this.notificationSel.length>0){if(count>0){$(this.notificationSel).html(''+count).show();}else{$(this.notificationSel).html('').hide();}}}
VideoCarousel.prototype.showMore=function(cookieName)
{createCookie(cookieName,'more',90);_gaq.push(['_trackEvent','Video','ShowMore',cookieName]);playPause();window.location.reload(true);}
VideoCarousel.prototype.showLess=function(cookieName)
{createCookie(cookieName,'less',90);_gaq.push(['_trackEvent','Video','ShowLess',cookieName]);playPause();window.location.reload(true);}
VideoCarousel.prototype.gotoPage=function(pagingUrl)
{var i=pagingUrl.lastIndexOf('/p/')+3;var p=pagingUrl.substr(i);p=parseInt(p);this.eCarousel.gotoPage(p);}
VideoCarousel.prototype.init=function()
{var mythis=this;this.setNotification(this.totalCount);this.eCarouselSettings.initCallback=function(eCarousel){mythis.eCarousel=eCarousel;};this.eCarouselSettings.offsetChangeCallback=function(eCarousel,offset,dataFromCache){if(mythis.cookie){createCookie(mythis.cookie,offset,0,1,0);}
if(dataFromCache&&mythis.pageControls){mythis.ajaxGetPageControls(eCarousel.settings.pageSize,offset);}};this.eCarouselSettings.ajaxGetData=function(eCarousel,pageSize,nextFetchOffset,next){if(mythis.ajaxLoading){mythis.ajaxGetData(eCarousel,pageSize,nextFetchOffset,next);}};this.eCarouselSettings.bindEventsCallback=function(eCarousel){if(mythis.bindEventsCallback!=null){mythis.bindEventsCallback(mythis);}}
this.eCarouselSettings.beforeBtnHover=function(){BeckiVideoThumbnailPopup.hide();};this.eCarouselSettings.beforeBtnClick=function(){BeckiVideoThumbnailPopup.hide();};this.eCarouselSettings.isTouchDevice=isTouchDevice();this.eCarouselSettings.ajaxLoading=this.ajaxLoading;$(this.eCarouselSel).eCarousel(this.eCarouselSettings);}
return{VIDEO_URL:VIDEO_URL,PLAYER_WIDTH:PLAYER_WIDTH,PLAYER_HEIGHT:PLAYER_HEIGHT,PLAYER_TYPE:PLAYER_TYPE,PLAYER_EMBED_CODE:PLAYER_EMBED_CODE,GetVideoEmbedCode:GetVideoEmbedCode,MailToVideoLink:MailToVideoLink,GenericPopup:GenericPopup,GenericPopupRegistry:GenericPopupRegistry,GenericPopupHide:GenericPopupHide,GenericPopupFind:GenericPopupFind,SidebarHover:SidebarHover,InfoBoxPopup:InfoBoxPopup,VideoCarousel:VideoCarousel}})();BeckiVideoThumbnailPopup={name:'BeckiVideoThumbnailPopup',popup:null,init:function(){if(this.popup){return this.popup;}
this.popup=new BeckiUtils.GenericPopup({name:this.name,attrName:'altvid',containerClass:"vidthumbpop-popup",sizingSelector:null,ajaxAction:"/video/earl",usePageXY:false,ignoreHoverOnTouchDevice:true,useClickForHoverOnTouchDevices:false,parseAjaxParamCallback:function(value){return ParseAltVid2PostData(value);}});return this.popup;},bindEvents:function(hoverSelector,playSelector){this.init();playSelector=(playSelector)?playSelector:null;hoverSelector=(hoverSelector)?hoverSelector:null;if(this.popup.isTouchDevice)
{if(hoverSelector!=null)
{$(hoverSelector).unbind("click");$(hoverSelector).click(function(){var altvid=$(this).attr('altvid');if(BeckiVideoThumbnailPopup.popup.isShowing())
{if(BeckiVideoThumbnailPopup.popup.currentValue==altvid){BeckiVideoThumbnailPopup.popup.hide();}else{BeckiVideoThumbnailPopup.hoverOver(this);}}
else{BeckiVideoThumbnailPopup.hoverOver(this);}
return false;});}
if(playSelector!=null)
{$(".vidthumbpop-popup .linkButton",this.popup.container).unbind("click");$(".vidthumbpop-popup .linkButton",this.popup.container).click(function(){var altvid=BeckiVideoThumbnailPopup.popup.currentValue;var scope=BeckiVideoThumbnailPopup.popup.currentPoint;BeckiVideoThumbnailPopup.popup.hide();PlayVideoMode(scope,altvid);});this.popup.container.unbind("click");this.popup.container.click(function(){var altvid=BeckiVideoThumbnailPopup.popup.currentValue;var scope=BeckiVideoThumbnailPopup.popup.currentPoint;BeckiVideoThumbnailPopup.popup.hide();PlayVideoMode(scope,altvid);return false;});$(playSelector).unbind("dblclick");$(playSelector).dblclick(function(){BeckiVideoThumbnailPopup.popup.hide();PlayVideoMode(this);return false;});}}
else
{if(playSelector!=null)
{$(playSelector).unbind("click");$(playSelector).click(function(){BeckiVideoThumbnailPopup.popup.hide();PlayVideoMode(this);return false;});}
if(hoverSelector!=null){this.hoverIntent(hoverSelector);}}},isShowing:function(){this.init();return this.popup.isShowing();},hide:function(){this.init();this.popup.hide();},hoverOver:function(scope){this.init();var event={data:this.popup};this.popup.pointEventHandler(scope,event);},hoverIntent:function(selector){this.init();var mythis=this;if(!isTouchDevice()){$(selector).hoverIntent({over:function(){mythis.hoverOver(this);},timeout:0,out:function(){mythis.hide();}});}}};BeckiVideoPlayer=(function()
{this.AdRulesOn=true;this.DEBUG_ON=false;this.cookieExpireDays=90;this.videoCount=0;this.playQue=[];this.CURRENT_ALTVID='_0_0';this.CURRENT_VID='0';this.CURRENT_VIDEO='0';this.UNAVAILABLE_VIDEOID=646;this.BOOKMARK_VIDEO_ON=true;this.trackingVideo='0';this.trackingVID='0';this.trackVideoViewCache=[];function trackVideoViewClear()
{if(BeckiVideoPlayer.trackingVideo<=0||BeckiVideoPlayer.trackingVideo==='0'){return;}
BeckiVideoPlayer.trackVideoViewCache[BeckiVideoPlayer.trackingVideo]=null;}
function trackVideoView()
{if(BeckiVideoPlayer.trackingVideo<=0||BeckiVideoPlayer.trackingVideo==='0'){return;}
var staleTime=5*(60*1000);var t=new Date().getTime();if(BeckiVideoPlayer.trackVideoViewCache[BeckiVideoPlayer.trackingVideo]!==undefined&&BeckiVideoPlayer.trackVideoViewCache[BeckiVideoPlayer.trackingVideo]!==null&&(t-BeckiVideoPlayer.trackVideoViewCache[BeckiVideoPlayer.trackingVideo])<staleTime){return;}
BeckiVideoPlayer.trackVideoViewCache[BeckiVideoPlayer.trackingVideo]=t;$.ajax({type:"GET",url:beckiBaseUrl+"/video/play/video/"+BeckiVideoPlayer.trackingVideo+"/vid/"+BeckiVideoPlayer.trackingVID});_gaq.push(['_trackEvent','Video','Play',BeckiVideoPlayer.trackingVideo]);}
function playQuePush(altvid,start,stop,type,playerMode)
{var v={'altvid':altvid,'start':start,'stop':stop,'type':type,'playerMode':playerMode};BeckiVideoPlayer.playQue.push(v);}
function playQuePop()
{if(BeckiVideoPlayer.playQue.length>0){return BeckiVideoPlayer.playQue.shift();}
return null;}
function playQueNext(autoplay)
{var v=BeckiVideoPlayer.playQuePop();if(v){if(BeckiVideoPlayer.DEBUG_ON){alert('playQueNext: '+v.type+' altvid:'+v.altvid+' start:'+v.start+' stop:'+v.stop+' VideosWatchedCount:'+BeckiVideoPlayer.videoCount);}
PlayVideoStartStop(v.altvid,v.start,v.stop,autoplay);if(v.type==='video'){BeckiVideoPlayer.getVideoPostRollDetails(v.altvid,v.playerMode);}
return true;}
return false;}
function isFirstVisit()
{return(BeckiVideoPlayer.videoCount==1);}
function isVideoCount(count)
{return(BeckiVideoPlayer.videoCount>=Number(count));}
function isVideoInterval(interval)
{return((BeckiVideoPlayer.videoCount%Number(interval))==0);}
this.VideoAdRules=[];function runAdRules(altvid,playerMode)
{BeckiVideoPlayer.playQue=[];var preRoll=null;var postRoll=null;for(var i=0;i<BeckiVideoPlayer.VideoAdRules.length;i++)
{var r=BeckiVideoPlayer.VideoAdRules[i];if(r.isRuleValid()){if(r.post&&postRoll==null){postRoll=r;}else if(!r.post&&preRoll==null){preRoll=r;}}
if(preRoll!=null&&postRoll!=null){break;}}
if(preRoll!=null&&preRoll.altvid!==null){BeckiVideoPlayer.playQuePush(preRoll.altvid,preRoll.start,preRoll.stop,'pre#'+preRoll.ruleId,playerMode);}
BeckiVideoPlayer.playQuePush(altvid,0,0,'video',playerMode);if(postRoll!=null&&postRoll.altvid!==null){BeckiVideoPlayer.playQuePush(postRoll.altvid,postRoll.start,postRoll.stop,'post#'+postRoll.ruleId,playerMode);}}
function setCurrentVideo(altvid)
{var o=ParseAltVid(altvid);if(o.video!=BeckiVideoPlayer.UNAVAILABLE_VIDEOID){BeckiVideoPlayer.CURRENT_ALTVID=altvid;BeckiVideoPlayer.CURRENT_VID=o.vid;BeckiVideoPlayer.CURRENT_VIDEO=o.video;BeckiVideoPlayer.trackingVideo=o.video;BeckiVideoPlayer.trackingVID=o.vid;createCookie('LastVideoWatched',altvid,BeckiVideoPlayer.cookieExpireDays,0,0);if(BeckiVideoPlayer.BOOKMARK_VIDEO_ON){window.location.hash='#'+altvid;}
$('#CURRENT_ALTVID').html(altvid);}}
function play(altvid,autoplay,playerMode)
{BeckiVideoPlayer.playQue=null;if(INITIAL_HASH_VALUE.length>4&&INITIAL_HASH_VALUE[1]=='_'){altvid=INITIAL_HASH_VALUE.substr(1);}
INITIAL_HASH_VALUE='';BeckiVideoPlayer.setCurrentVideo(altvid);var wcount=readCookie('watchcount');if(wcount!=null){BeckiVideoPlayer.videoCount=parseInt(wcount);}
BeckiVideoPlayer.videoCount++;createCookie('watchcount',BeckiVideoPlayer.videoCount,BeckiVideoPlayer.cookieExpireDays,0,0);BeckiVideoPlayer.getVideoSideBar(altvid,playerMode);if(BeckiVideoPlayer.AdRulesOn){BeckiVideoPlayer.runAdRules(altvid,playerMode);return BeckiVideoPlayer.playQueNext(autoplay);}else{PlayVideoStartStop(altvid,0,0,autoplay);BeckiVideoPlayer.getVideoPostRollDetails(altvid,playerMode);return true;}}
function getVideoSideBar(altvid,playerMode)
{FavActorHoverOut();var sideBar=$("#videoinfo-side-panel");if(sideBar&&sideBar.length>0&&sideBarAltVid!=altvid)
{var sideBarAltVid=$(".sideBarAltVid",sideBar).text();if(sideBarAltVid!=altvid)
{$.ajax({type:"GET",url:beckiBaseUrl+"/video/sidebar"+ParseAltVid2PostData(altvid)+"/playermode/"+playerMode,success:function(html){if(html===null||html===undefined)html='';var identifier="<!-- VideoId=";if(html.substr(0,identifier.length)==identifier){var videoid=html.substr(identifier.length,(html.indexOf(" -->")-identifier.length));if(videoid==BeckiVideoPlayer.CURRENT_VIDEO){sideBar.html(html);}}else{sideBar.html(html);}}});}}}
function getVideoPostRollDetails(altvid,playerMode)
{hideVidPostRoll();if($("#vidpostroll_vrpopup").length>0)
{setTimeout(function(){$.ajax({type:"GET",url:beckiBaseUrl+"/video/postroll/playermode/"+playerMode+ParseAltVid2PostData(altvid),success:function(html){if(html!=='error'){$("#vidpostroll_vrpopup").html(html);}}});},1000);}}
function getNextOrPrevActorVideo(altvid,next,playerMode)
{var upNext=$("#postRollUpNext");if(upNext&&upNext.length>0)
{$.ajax({type:"GET",url:beckiBaseUrl+"/video/upnext/playermode/"+playerMode+ParseAltVid2PostData(altvid)+"/next/"+next,success:function(html){if(html===null||html===undefined)html='';upNext.html(html);}});}}
function BeckiVideoAdRule(config)
{this.ruleId=0;this.enabled=true;this.disabledTime=0;this.post=false;this.start=0;this.stop=0;this.altvid=null;this.adSeries=[];this.adSeriesIndex=0;this.playCount=0;this.maxPlays=0;this.rule=[];this.time=(new Date()).getTime();this.applyConfig(config);}
BeckiVideoAdRule.prototype.applyConfig=function(config)
{for(var c in config){this[c]=config[c];}}
BeckiVideoAdRule.prototype.nextAdSeries=function()
{if(this.maxPlays<=0||this.maxPlays>this.adSeries.length){if(this.adSeriesIndex>=this.adSeries.length){this.adSeriesIndex=0;}}
if(this.adSeries.length>0)
{if(this.adSeriesIndex<this.adSeries.length)
{this.altvid=this.adSeries[this.adSeriesIndex];if(this.adSeries.length>1){this.adSeriesIndex++;}
return this.altvid;}}
this.altvid=null;return this.altvid;}
BeckiVideoAdRule.prototype.isMaxPlays=function()
{if(this.maxPlays<=0)
return false;if(this.playCount>=this.maxPlays){if(BeckiVideoPlayer.DEBUG_ON){alert('maxPlays reached for AdRule_'+this.ruleId+'_PlayCount = '+this.playCount+' maxPlays = '+this.maxPlays);}
return true;}
return false;}
BeckiVideoAdRule.prototype.adPlay=function()
{var mythis=this;$.ajax({type:"GET",url:beckiBaseUrl+"/video/adplay/ruleid/"+this.ruleId+"/playcount/"+this.playCount+"/adseriesindex/"+this.adSeriesIndex,success:function(html){if(html=='reset'){mythis.playCount=0;mythis.adSeriesIndex=0;mythis.time=(new Date()).getTime();mythis.enabled=true;}}});}
BeckiVideoAdRule.prototype.isRuleValid=function()
{if(!this.enabled)
{var timenow=(new Date()).getTime();var minutes=Math.round((timenow-this.disabledTime)/(1000*60));if(minutes>=15){this.disabledTime=(new Date()).getTime();this.adPlay();}
return false;}
if(this.isMaxPlays())
{this.enabled=false;this.disabledTime=(new Date()).getTime();return false;}
var passed=[];for(var i=0;i<this.rule.length;i++)
{var r=this.rule[i];switch(r.name)
{case'firstVisit':passed[i]=BeckiVideoPlayer.isFirstVisit();break;case'videoCount':passed[i]=BeckiVideoPlayer.isVideoCount(r.data);break;case'videoInterval':passed[i]=BeckiVideoPlayer.isVideoInterval(r.data);break;case'videoIntervalAfterCount':if(BeckiVideoPlayer.isVideoCount(r.data[0])){passed[i]=BeckiVideoPlayer.isVideoInterval(r.data[1]);}else{passed[i]=false;}
break;case'minutes':var timenow2=(new Date()).getTime();var minutes2=Math.round((timenow2-this.time)/(1000*60));passed[i]=(minutes2>=Number(r.data))?true:false;break;}}
var allPassed=false;for(i=0;i<passed.length;i++)
{if(i==0){allPassed=passed[i];}else{allPassed=(allPassed&&passed[i]);}}
if(allPassed)
{this.nextAdSeries();if(this.altvid!==null){this.playCount++;this.time=(new Date()).getTime();}else{allPassed=false;}
this.adPlay();}
return allPassed;}
return{AdRulesOn:AdRulesOn,DEBUG_ON:DEBUG_ON,cookieExpireDays:cookieExpireDays,videoCount:videoCount,playQue:playQue,CURRENT_ALTVID:CURRENT_ALTVID,CURRENT_VID:CURRENT_VID,CURRENT_VIDEO:CURRENT_VIDEO,UNAVAILABLE_VIDEOID:UNAVAILABLE_VIDEOID,BOOKMARK_VIDEO_ON:BOOKMARK_VIDEO_ON,trackingVideo:trackingVideo,trackingVID:trackingVID,trackVideoViewCache:trackVideoViewCache,trackVideoViewClear:trackVideoViewClear,trackVideoView:trackVideoView,playQuePush:playQuePush,playQuePop:playQuePop,playQueNext:playQueNext,runAdRules:runAdRules,setCurrentVideo:setCurrentVideo,play:play,getVideoSideBar:getVideoSideBar,getVideoPostRollDetails:getVideoPostRollDetails,getNextOrPrevActorVideo:getNextOrPrevActorVideo,isFirstVisit:isFirstVisit,isVideoCount:isVideoCount,isVideoInterval:isVideoInterval,VideoAdRules:VideoAdRules,BeckiVideoAdRule:BeckiVideoAdRule}})();var _hashWatcherId=null;var _pageTitle=null;function hashChange()
{var h=window.location.hash;if(h.length>4&&h[0]=='#'&&h[1]=='_')
{var altvid=h.substr(1);if($('#theatricsplayer-playeractual').length>0){if(altvid!==BeckiVideoPlayer.CURRENT_ALTVID){BeckiVideoPlayer.play(altvid,true,'page');}}else{if($('#popup-player').length>0){if(altvid!==BeckiVideoPlayer.CURRENT_ALTVID){BeckiVideoPlayer.play(altvid,true,'play');}}else{PlayVideoPopup(altvid);}}}else if($('#popup-player').length>0){ClosePageWideMask();}
if(_pageTitle!==null){$(document).attr('title',_pageTitle);}}
$(document).ready(function(){hashChange();});if(window.addEventListener){if("onhashchange"in window){_hashWatcherId=1;window.addEventListener("hashchange",hashChange,false);}}else if(setInterval){_hashWatcherId=setInterval(hashChange,500);$(document).ready(function(){_pageTitle=$(document).attr('title');var tstop=_pageTitle.indexOf('#');if(tstop>0){_pageTitle=_pageTitle.substring(0,tstop);}
if(_pageTitle.length<10){_pageTitle='Beckinfield';}});}
function showVidPostRoll()
{$('#vidpostroll').fadeIn("slow");vidPlayerHide();}
function hideVidPostRoll()
{$('#vidpostroll').css("display","none");}
var _playHasStartedOnce=false;var _playTimeUpdateId=null;var _playStartTime=0;var _playStopTime=0;var playClearStartStop=function()
{_playHasStartedOnce=false;_playStartTime=0;_playStopTime=0;if(_playTimeUpdateId!==null){clearTimeout(_playTimeUpdateId);_playTimeUpdateId=null;}}
var playCurrentTime=function()
{if(BrowserDetection.isHTML5PlayerMode()){return $('#theatricsplayer-playeractual object video').get(0).currentTime;}else{return viddlerCurrentTime('theatricsplayer');}}
var playPause=function()
{if(BrowserDetection.isHTML5PlayerMode()){if($('#theatricsplayer-playeractual object video').length>0){$('#theatricsplayer-playeractual object video').get(0).pause();}}else{viddlerPause('theatricsplayer');}}
var playStop=function()
{playClearStartStop();playPause();playEnded();}
var playTimeUpdate=function()
{if(_playStopTime>0){if(playCurrentTime()>=_playStopTime){playStop();}}}
var playUntil=function(stop)
{_playStopTime=stop;if(_playTimeUpdateId!==null){clearTimeout(_playTimeUpdateId);_playTimeUpdateId=null;}
if(!BrowserDetection.isHTML5PlayerMode()){_playTimeUpdateId=setInterval(playTimeUpdate,250);}}
function playLoadMedia(event)
{if(_playStartTime>0){$('#theatricsplayer-playeractual object video').get(0).currentTime=_playStartTime;}
_playStartTime=0;}
function playStart(start)
{_playStartTime=start;$('#theatricsplayer-playeractual object video').get(0).addEventListener('loadedmetadata',playLoadMedia,false);}
var playStarted=function()
{if(!_playHasStartedOnce)
{_playHasStartedOnce=true;BeckiVideoPlayer.trackVideoView();}
hideVidPostRoll();$('.hide-after-play').removeClass('hidden');}
var playEnded=function()
{playClearStartStop();BeckiVideoPlayer.trackVideoViewClear();$('.hide-after-play').addClass('hidden');if(BeckiVideoPlayer.playQueNext(true)){return;}
showVidPostRoll();if(CurrentPopupPlayerParent!=null){$('#popup-player',CurrentPopupPlayerParent).hide();$('#popup-player',CurrentPopupPlayerParent).remove();CurrentPopupPlayerParent=null;}}
function bgVideoErrorCard(selector)
{$(selector).css("background","url("+beckiBaseUrl+"/images/bg/video-error-card.png) no-repeat");}
function clearVideoErrorCard(selector)
{$(selector).css("background","transparent");}
function resetVideoErrorCard(selector)
{setTimeout('bgVideoErrorCard("'+selector+'");',3000);}
function setVideoErrorCard(selector,w,h)
{$(selector).css("width",w);$(selector).css("height",h);resetVideoErrorCard(selector);}
function PlayVideoMode(scope,altvid)
{altvid=(altvid)?altvid:null;if(altvid==null){altvid=$(scope).attr('altvid');if(!altvid){altvid=$(scope).attr('alt');if(!altvid){altvid=$(scope).attr('href');}}}
var playerMode=$(scope).attr('playermode');if(playerMode=='page'){var href=$(scope).parent().attr('href');if(href&&href.length>0){playPause();window.location.href=href;}else{BeckiVideoPlayer.play(altvid,true,'page');}}else if(playerMode=='play'){BeckiVideoPlayer.play(altvid,true,'play');}else{PlayVideoPopup(altvid);}}
var CurrentPopupPlayerParent=null;function PlayVideoPopup(altvid,w,h,target)
{var size='';if(w&&h){size='/width/'+w+'/height/'+h;}
playClearStartStop();altvid=(altvid)?altvid:BeckiVideoPlayer.CURRENT_ALTVID;var o=ParseAltVid(altvid);if(o.vid==='')return;$.ajax({type:"GET",url:beckiBaseUrl+"/video/playpop"+ParseAltVid2PostData(altvid)+size,success:function(html){if(CurrentPopupPlayerParent!=null){$('#popup-player',CurrentPopupPlayerParent).hide();$('#popup-player',CurrentPopupPlayerParent).remove();CurrentPopupPlayerParent=null;}
if(target){$(target).append('<div id="popup-player" style="position: relative; top:-'+h+'px;"></div>');$('#popup-player',target).html(html);$(target).css('height',h+'px');}else{$('body').append('<div id="popup-player" class="popup-player"></div>');$('#popup-player').html(html);}
INITIAL_HASH_VALUE='';BeckiVideoPlayer.play(altvid,true,'play');if(size.length>0){if(target){CurrentPopupPlayerParent=target;}else{CurrentPopupPlayerParent=$('body');}
$('#popup-player',CurrentPopupPlayerParent).show();}else{ShowWithPageWideMask(3000,'#popup-player',true);}}});}
function GetPlayer(altvid)
{var player=$('#theatricsplayer-playeractual');if(player&&player.length>0){return false;}
playClearStartStop();altvid=(altvid)?altvid:BeckiVideoPlayer.CURRENT_ALTVID;var o=ParseAltVid(altvid);if(o.vid===''||(o.vid==0&&o.video==0))return false;$.ajax({type:"GET",url:beckiBaseUrl+"/video/getplayer"+ParseAltVid2PostData(altvid),success:function(html){$('#centerstage').html(html);}});return true;}
function PlayVideoStartStop(altvid,start,stop,autoplay)
{if(GetPlayer(altvid))return;altvid=(altvid)?altvid:BeckiVideoPlayer.CURRENT_ALTVID;var o=ParseAltVid(altvid);if(o.vid===''||(o.vid==0&&o.video==0))return;start=(start)?start:0;stop=(stop)?stop:0;autoplay=(autoplay)?'t':'f';BeckiVideoPlayer.trackingVideo=o.video;BeckiVideoPlayer.trackingVID=o.vid;playClearStartStop();if(BrowserDetection.isHTML5PlayerMode()){$('#jsStoryBarMenuUL > li > ul').hide();if($('#theatricsplayer-playeractual').is(':hidden')){vidPlayerShow();return;}
viddlerVideoSwitch($('#theatricsplayer-playeractual object'),o.vid);if(start>0){playStart(start);}
var videoplayer=$('#theatricsplayer-playeractual object video').get(0);videoplayer.play();}else{clearVideoErrorCard('#theatricsplayer-playeractual');var embed=BeckiUtils.GetVideoEmbedCode(altvid,autoplay,0,0,start,false,null);$('#theatricsplayer-playeractual').html(embed);resetVideoErrorCard('#theatricsplayer-playeractual');}
if(stop>0){playUntil(stop);}
BeckiVideoThumbnailPopup.hide();}
function PlaySpecialVideoPopup(altvid)
{altvid=(altvid)?altvid:BeckiVideoPlayer.CURRENT_ALTVID;$.ajax({type:"GET",url:beckiBaseUrl+"/video/playspecial"+ParseAltVid2PostData(altvid),success:function(html){theDialog({html:html,title:'Beckinfield',modal:true,width:666,minWidth:666,resizable:false});}});}
function vidPlayerShow()
{var player=$('#theatricsplayer-playeractual');if(player&&player.length>0){if(BrowserDetection.isHTML5PlayerMode()){if($('#theatricsplayer-playeractual').is(':hidden')){$('#theatricsplayer-playeractual').show();setTimeout("BeckiVideoPlayer.play(BeckiVideoPlayer.CURRENT_ALTVID,true,'page');",100);}else{BeckiVideoPlayer.play(BeckiVideoPlayer.CURRENT_ALTVID,true,'page');}}}}
function vidPlayerHide()
{var player=$('#theatricsplayer-playeractual');if(player&&player.length>0){if(BrowserDetection.isHTML5PlayerMode()){if($('#theatricsplayer-playeractual').is(':visible')){$('#theatricsplayer-playeractual object video').get(0).pause();$('#theatricsplayer-playeractual').hide();}}}}
function vidReplay()
{hideVidPostRoll();if(BrowserDetection.isHTML5PlayerMode()){vidPlayerShow();}else{BeckiVideoPlayer.play(BeckiVideoPlayer.CURRENT_ALTVID,true,'page');}}
function vidRolloverPlay()
{if(!_playHasStartedOnce){vidReplay();}}
function showAdminVideoInfo(videoId)
{$.ajax({type:"GET",url:beckiBaseUrl+"/video/jacob/video/"+videoId,success:function(html){if(html!=null&&html!=''){theDialog({theId:"admin-video-info",html:html,title:'Admin Video Info',width:680});$("#admin-video-info .admin-videodata .admin-datavalue a").click(function(){window.open(this.href);return false;});return;}}});}
function favoriteActor(cid,toggle,hoverOff)
{hoverOff=(hoverOff)?hoverOff:false;toggle=(toggle)?1:0;$.ajax({type:"GET",url:beckiBaseUrl+"/video/favorite/char/"+cid+"/toggle/"+toggle,success:function(html){if(html=='success'){$('#favoriteCharacter').html('<span></span>Following');if(!hoverOff)ConfigureFavActorPopup(toggle,true,true);}
else if(html=='unset'){$('#favoriteCharacter').html('<span></span>Follow');if(!hoverOff)ConfigureFavActorPopup(toggle,false,true);}
else if(html=='alreadyset'){if(!hoverOff)ConfigureFavActorPopup(toggle,true,true);}
else if(html=='nologin'){SignInToUseFeature("Follow");}
else{theatricsMessage(html,'Follow action failed.',null,"Follow Failed");}}});_gaq.push(['_trackEvent','Character','Favorite',cid+'']);}
var FavActorHoverOutTimeoutId=null;function ConfigureFavActorPopup(toggle,isFavorited,notify)
{var touch=isTouchDevice();FavActorPopup.removeClass('favactor-popup-add favactor-popup-added favactor-popup-remove favactor-popup-removed');if(isFavorited){$('#favoriteCharacter').addClass('isFavorited');if(touch||!toggle){FavActorPopup.addClass('favactor-popup-added');}else{FavActorPopup.addClass('favactor-popup-remove');}}else{$('#favoriteCharacter').removeClass('isFavorited');if(touch||!toggle){FavActorPopup.addClass('favactor-popup-removed');}else{FavActorPopup.addClass('favactor-popup-add');}}
if(notify&&(touch||!toggle)){FavActorHoverOver(null,true);if(FavActorHoverOutTimeoutId!=null){clearTimeout(FavActorHoverOutTimeoutId);}
FavActorHoverOutTimeoutId=setTimeout("FavActorHoverOut(); FavActorHoverOutTimeoutId=null;",3000);}}
function FavActorHoverOver(evt,noConfigure)
{noConfigure=(noConfigure)?true:false;if(!noConfigure){ConfigureFavActorPopup(true,$('#favoriteCharacter').hasClass('isFavorited'),false);}
var offset=$('#favoriteCharacter').offset();var left=offset.left-33;var top=offset.top-84;FavActorPopup.css('left',left+'px');FavActorPopup.css('top',top+'px');FavActorPopup.css('display','block');}
function FavActorHoverOut()
{if(FavActorPopup!=null){FavActorPopup.css('display','none');}}
var FavActorPopup=null;function setupFavActorPopup(selector,cid,toggle,isFavorited,hoverOff)
{hoverOff=(hoverOff)?hoverOff:false;if(!hoverOff)
{if(FavActorPopup==null){$('body').append('<div id="favactor-popup" class="favactor-popup favactor-popup-add"></div>');FavActorPopup=$('#favactor-popup');}
if(FavActorHoverOutTimeoutId!=null){clearTimeout(FavActorHoverOutTimeoutId);}
FavActorPopup.css('display','none');if(toggle){ConfigureFavActorPopup(toggle,isFavorited,false);}
if(!isTouchDevice()&&toggle){$(selector).hover(FavActorHoverOver,FavActorHoverOut);}}
$(selector).click(function(){favoriteActor(cid,toggle,hoverOff);return false;});}
var USER_RATED_CLASSES='userRated userRated1 userRated2 userRated3 userRated4 userRated5';var starRatingTimeoutId=null;function initStarRating(starSelector,userRate,share)
{share=(share)?share:0;$(starSelector+' .userRating').removeClass(USER_RATED_CLASSES);if(userRate>=1&&userRate<=5){$(starSelector+' .userRating').addClass('userRated userRated'+userRate);$(starSelector+' .userRatingTextHideAfterRate').text('');}
if(!isTouchDevice()){$(starSelector).click(function(){$(starSelector+' > ul').toggle();});$(starSelector).mouseleave(function(){$(starSelector+' > ul').hide();});}else{$(starSelector).click(function(){if(starRatingTimeoutId!==null){clearTimeout(starRatingTimeoutId);starRatingTimeoutId=null;}
$(starSelector+' > ul').toggle();if($(starSelector+' > ul').is(':visible')){starRatingTimeoutId=setTimeout(function(){$(starSelector+' > ul').hide();starRatingTimeoutId=null;},16000);}});}
$(starSelector+' .rateStar').click(function(){$(starSelector+' > ul').fadeOut('fast');var rate=$(this).attr('href');rate=parseInt(rate);$(starSelector+' .userRating').removeClass(USER_RATED_CLASSES);if(rate>=1&&rate<=5){$(starSelector+' .userRating').addClass('userRated userRated'+rate);$(starSelector+' .userRatingTextHideAfterRate').text('');}
rateVideo(rate,null,starSelector,share);return false;});}
function rateVideo(rating,video,starSelector,share)
{share=(share)?share:0;if(video===null)video=BeckiVideoPlayer.CURRENT_VIDEO;$.ajax({type:"GET",url:beckiBaseUrl+"/video/rate/video/"+video+"/rating/"+rating,success:function(html){if(html=='nologin'){SignInToUseFeature("Star Rating");$(starSelector+' .userRating').removeClass(USER_RATED_CLASSES);}
else if(html=='pending'){ValidateEmailToUseFeature('rating');}
else if(html!='success'){theatricsMessage(html,'Star Rating failed.',null,"Star Rating Failed");$(starSelector+' .userRating').removeClass(USER_RATED_CLASSES);}else{if(share>0){shareVideo(share,video,0);}}}});_gaq.push(['_trackEvent','Video','Rate',BeckiVideoPlayer.CURRENT_VIDEO]);}
function shareVideo(share,video,force)
{if(video===null)video=BeckiVideoPlayer.CURRENT_VIDEO;$.ajax({type:"GET",url:beckiBaseUrl+"/video/share/video/"+video+"/share/"+share+"/force/"+force,success:function(html){if(html!==''){theatricsMessage(html,null,null,"Share this video!",680,275);}}});_gaq.push(['_trackEvent','Video','Share',BeckiVideoPlayer.CURRENT_VIDEO]);}
function setupFlagVideo(selector)
{$(selector).click(function(){$.ajax({type:"get",url:beckiBaseUrl+"/video/flag/video/"+BeckiVideoPlayer.CURRENT_VIDEO,success:function(html){theDialog({theId:'flag-video-dialog',title:'Report A Concern',html:html,modal:true,width:632,height:335,minWidth:632,minHeight:335,resizable:false,noPadding:true});}});_gaq.push(['_trackEvent','Video','Flag',BeckiVideoPlayer.CURRENT_VIDEO+'']);return false;});if(!isTouchDevice()){BeckiUtils.SidebarHover(selector,'flagvideo-popup');}}
var EmbedVideoEffect=function(){};function EmbedVideoEffector(){if($('.video-embed-popup .image img').is(':visible')&&$('.video-embed-popup .image img').width()>0){EmbedVideoEffect();}else{setTimeout(EmbedVideoEffector,100);}}
function setupEmbedVideo(selector,w,h,hoverOff)
{hoverOff=(hoverOff)?hoverOff:false;$(selector).click(function(){$.ajax({type:"get",url:beckiBaseUrl+"/video/embed"+ParseAltVid2PostData(BeckiVideoPlayer.CURRENT_ALTVID),success:function(html){theDialog({theId:'embed-video-dialog',html:html,title:'Embed This Video',minWidth:w,minHeight:h,modal:true,resizable:false});setTimeout(EmbedVideoEffector,100);}});_gaq.push(['_trackEvent','Video','Embed',BeckiVideoPlayer.CURRENT_ALTVID]);return false;});if(!isTouchDevice()&&!hoverOff){BeckiUtils.SidebarHover(selector,'embedvideo-popup');}}
function NewsPlayOverlayClick(){if(CurrentNewsPlay===null)
return false;var altvid=$(CurrentNewsPlay).children('IMG').attr('alt');PlayVideoPopup(altvid);return false;}
var NewsPlayOverlay=null;function CreateNewsPlayOverlay()
{if(NewsPlayOverlay==null)
{$('body').append('<div id="newsplayoverlay" class="newsplayoverlay"></div>');NewsPlayOverlay=$('#newsplayoverlay');if(!isTouchDevice()){NewsPlayOverlay.hover(function(){undoFadeAway("#newsplayoverlay");},function(){fadeAway("#newsplayoverlay",0.25);});}
NewsPlayOverlay.click(NewsPlayOverlayClick);}}
var CurrentNewsPlay=null;function NewsPlayOverlayHoverOver()
{undoFadeAway("#newsplayoverlay");CurrentNewsPlay=this;var img=$(this).children('IMG');var offset=$(img).offset();var left=offset.left;var top=offset.top;if(NewsPlayOverlay==null)CreateNewsPlayOverlay();NewsPlayOverlay.css('left',left+'px');NewsPlayOverlay.css('top',top+'px');NewsPlayOverlay.css('display','block');}
function NewsPlayOverlayHoverOut()
{if(NewsPlayOverlay!=null){fadeAway("#newsplayoverlay",0.25);}}
var MyFavoritesPopup=null;function CreateMyFavoritesPopup()
{if(MyFavoritesPopup==null)
{$('body').append('<div id="myfavorites-popup" class="myfavorites-popup">'+'<div id="about-favorite-btn" class="about-favorite-btn">About...</div>'+'<div id="delete-favorite-btn" class="delete-favorite-btn">Remove</div>'+'</div>');MyFavoritesPopup=$('#myfavorites-popup');$('.about-favorite-btn').click(function(){if(CurrentMyFavorite===null)return;var href=$(CurrentMyFavorite).attr('href');if(href&&href.length>0){window.location.href=href;}});$('.delete-favorite-btn').click(function(){WarnDeleteFavorite();});if(!isTouchDevice())
{$('#myfavorites-popup').hover(function(){undoFadeAway("#myfavorites-popup");},function(){fadeAway("#myfavorites-popup",0.25);});}}}
var CurrentMyFavorite=null;var CurrentMyFavoriteIndex=0;var CurrentMyFavoriteCarousel=null;var CurrentMyFavoriteDelete=null;function FavoriteHoverOver(evt,scope)
{scope=(scope)?scope:this;undoFadeAway("#myfavorites-popup");var mommy=$(scope).closest('li');if(mommy.hasClass('delete-favorite-item'))return;CurrentMyFavorite=mommy.children('a').get(0);CurrentMyFavoriteIndex=mommy.attr('jcarouselindex');CurrentMyFavoriteIndex=parseInt(CurrentMyFavoriteIndex);var img=$(CurrentMyFavorite).children('img').get(0);var offset=$(img).offset();if(MyFavoritesPopup==null)CreateMyFavoritesPopup();MyFavoritesPopup.css('left',(offset.left)+'px');MyFavoritesPopup.css('top',(offset.top+5)+'px');MyFavoritesPopup.css('display','block');}
function FavoriteHoverOut()
{if(MyFavoritesPopup!=null){fadeAway("#myfavorites-popup",0.25);}}
function WarnDeleteFavorite(){if(CurrentMyFavorite===null)return;var name=$(CurrentMyFavorite).attr('charactername');var actorid=$(CurrentMyFavorite).attr('name');var s=$("#avatar-list-img-"+actorid).attr("src");FavoriteHoverOut();var msg='Delete "'+name+'" from your favorites?';if(s!==null&&s!==undefined){msg='<img class="video-delete-thumbnail" src="'+s+'"/><div class="video-delete-warning">'+msg+'</div>';}
var buttons={"Delete":function(){DeleteFavorite(actorid,CurrentMyFavorite,CurrentMyFavoriteCarousel);CurrentMyFavorite=null;CurrentMyFavoriteIndex=0;theDialogClose('warn-on-delete-dialog');},"Cancel":function(){theDialogClose('warn-on-delete-dialog');}};theDialog({theId:'warn-on-delete-dialog',pre:msg,title:'Delete Favorite',minWidth:422,minHeight:216,modal:true,buttons:buttons});}
function DeleteFavorite(actorid,node,ec)
{$.ajax({type:"get",url:beckiBaseUrl+"/video/deletefavorite/actor/"+actorid,success:function(html){if(html=='nologin'){SignInToUseFeature("Stop Following");}else if(html=='success'){if(ec){ec.remove($(node).parent('li').attr('itemid'));}}}});_gaq.push(['_trackEvent','Actor','FavoriteDelete',actorid+'']);}
var BlogPostRegisterSaveFuncs=[];function BlogPostRegisterSaveCb(fname,func)
{BlogPostRegisterSaveFuncs[fname]=func;}
function BlogPostGetSaveCb(fname)
{return BlogPostRegisterSaveFuncs[fname];}
function BlogPostEdit(postId,savecb)
{$.ajax({type:"GET",url:beckiBaseUrl+"/blogpost/edit/post/"+postId+'/savecb/'+savecb,success:function(html){theDialog({theId:'popup-blog-post-dialog',html:html,title:'Post a blog entry',modal:true,width:440,height:'auto',minWidth:440,minHeight:449,resizable:true,noPadding:true});}});}
function BlogPostClose()
{theDialogClose('popup-blog-post-dialog');}
function BlogPostDeleteNow(postId,selector)
{$.ajax({type:"GET",url:beckiBaseUrl+"/blogpost/delete/post/"+postId,success:function(html){if(html!=='success'){theatricsMessage(html,'Delete blog entry failed.',null,"Delete blog entry failed");}else{$(selector).remove();}}});}
function BlogPostDelete(postId,selector)
{var msg='Are you sure you want to delete your post?';var buttons={'Yes, delete post':function(){theDialogClose('warn-on-post-delete-dialog');BlogPostDeleteNow(postId,selector);},'No, keep post':function(){theDialogClose('warn-on-post-delete-dialog');}};theDialog({theId:'warn-on-post-delete-dialog',pre:msg,html:'',title:'Delete post?',dialogClass:'theatricsMessage',modal:true,minWidth:500,minHeight:150,buttons:buttons});}
function BlogPostFlag(postId)
{$.ajax({type:"get",url:beckiBaseUrl+"/blogpost/flag/post/"+postId,success:function(html){theDialog({theId:'flag-blogpost-dialog',title:'Report A Concern',html:html,modal:true,width:632,height:335,minWidth:632,minHeight:335,resizable:false,noPadding:true});}});_gaq.push(['_trackEvent','BlogPost','Flag',postId+'']);return false;}
function BlogPostFlagClose()
{theDialogClose('flag-blogpost-dialog');}
function BlogPostShare(postId)
{$.ajax({type:"GET",url:beckiBaseUrl+"/blogpost/share/post/"+postId,success:function(html){if(html!==''){theatricsMessage(html,null,null,"Share this post!",435,250);}}});_gaq.push(['_trackEvent','BlogPost','Share',postId+'']);return false;}
