;(function($)
{$.extend($.expr[':'],{isBound:function(obj,index,meta,stack)
{return $.isPopulated($(obj).data(meta[3]));},isNotBound:function(obj,index,meta,stack)
{return!$.isPopulated($(obj).data(meta[3]));}});$.extend({isPopulated:function(obj)
{var populated=(obj!=null&&obj!=undefined);if(populated&&obj.constructor==String)
{populated=(obj.length>0&&obj!="undefined");}
return populated;},addCSS:function(cssCode)
{var styleElement=document.createElement("style");styleElement.type="text/css";if(styleElement.styleSheet)
{styleElement.styleSheet.cssText=cssCode;}
else
{styleElement.appendChild(document.createTextNode(cssCode));}
document.getElementsByTagName("head")[0].appendChild(styleElement);},addStyleSheet:function(src)
{var styleElement=document.createElement("link");styleElement.type="text/css";styleElement.href=src;styleElement.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(styleElement);},getCSS:function(stylesheetFileName,selector)
{var css=null;for(var i=0;i<document.styleSheets.length;i++)
{if($.isPopulated(document.styleSheets[i].href)&&document.styleSheets[i].href.indexOf(stylesheetFileName)>-1)
{var stylesheet=document.styleSheets[i];for(var j=0;j<stylesheet.cssRules.length;j++)
{if(stylesheet.cssRules[j].selectorText.indexOf(selector)>-1)
{css=stylesheet.cssRules[j].style.cssText;}}
break;}}
return css;},getQueryStringVariable:function(variable)
{if(!jQuery.isPopulated(variable))variable=="";variable=variable.toLowerCase();var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++)
{var pair=vars[i].split("=");var q=pair[0];if(!jQuery.isPopulated(q))q="";q=q.toLowerCase();if(q==variable)
{return pair[1];}}
return"";},getPosition:function(options)
{if(!$.isPopulated(options.anchor)||!$.isPopulated(options.element))return null;options.offsetX=($.isPopulated(options.offsetX))?options.offsetX:0;options.offsetY=($.isPopulated(options.offsetY))?options.offsetY:0;options.positionX=($.isPopulated(options.positionX))?options.positionX:"";options.positionY=($.isPopulated(options.positionY))?options.positionY:"";var offsetAncestor=options.element.offsetParent();var ancestorLimited=offsetAncestor.css("overflow")=="hidden";var anchorPoint=(ancestorLimited)?options.anchor.position():options.anchor.offset();function getPositionForType(positionName,positionType)
{if(!$.isPopulated(positionType)||(positionType.toLowerCase()!="x"&&positionType.toLowerCase()!="y"))positionType="x";positionType=positionType.toLowerCase();if(!$.isPopulated(positionName))positionName="";positionName=positionName.toLowerCase();var dimension=positionType=="x"?"width":"height";var anchor=positionType=="x"?"left":"top";var offset="offset"+positionType.toUpperCase();var capped=dimension.substr(0,1).toUpperCase()+dimension.substr(1);var outerDimension="outer"+capped;var innerDimension="inner"+capped;var scrollAnchor="scroll"+anchor.substr(0,1).toUpperCase()+anchor.substr(1);var adjustedPosition=null;var getPositionInfo=function(positive)
{var adjusted=false;var pos=positive?getPositive():getNegative();if((positive?tooPositive(pos):tooNegative(pos)))
{var newPos=positive?getNegative():getPositive();if(!(positive?tooNegative(newPos):tooPositive(newPos)))
{pos=newPos;adjusted=true;}}
return{position:pos,adjusted:adjusted};}
var getPositive=function(){return anchorPoint[anchor]+options.anchor[outerDimension]()+options[offset];};var getNegative=function(){return anchorPoint[anchor]-options.element[outerDimension]()-options[offset];};var tooPositive=function(pos){return(pos+options.element[dimension]())>($(window)[dimension]()+$(window)[scrollAnchor]());};var tooNegative=function(pos){return(ancestorLimited?(pos)<0:(pos)<$(window)[scrollAnchor]());};var position=0;var positionInfo;switch(positionName)
{case"top":case"left":positionInfo=getPositionInfo(false);position=positionInfo.position;adjustedPosition=positionInfo.adjusted?(positionType=="x"?"right":"bottom"):null;break;case"bottom":case"right":positionInfo=getPositionInfo(true);position=positionInfo.position;adjustedPosition=positionInfo.adjusted?(positionType=="x"?"left":"top"):null;break;case"flush":position=anchorPoint[anchor]+options[offset];if(tooPositive(position))
{positionInfo=getPositionInfo(false);position=positionInfo.position;adjustedPosition=positionInfo.adjusted?(positionType=="x"?"right":"bottom"):null;}
break;default:position=anchorPoint[anchor]+(options.anchor[dimension]()/2)+options[offset];if(tooPositive(position))
{positionInfo=getPositionInfo(false);position=positionInfo.position;adjustedPosition=positionInfo.adjusted?(positionType=="x"?"right":"bottom"):null;}
break;}
return{position:position,adjustedPosition:adjustedPosition};}
var retVal={x:getPositionForType(options.positionX,"x"),y:getPositionForType(options.positionY,"y")};return retVal;},convertToJson:function(obj)
{var b="\\";var q='"';var rq=/"/g;var rb=/\\/g;var str="{";for(var i in obj)
{var render="";if(typeof obj[i]=='object')
{render=jQuery.convertToJson(obj[i]);}
else
{render='"'+decodeURIComponent(obj[i]).replace(rb,b+b).replace(rq,b+q)+'"';}
str+='"'+i+'" : '+render+', ';}
if(str!="{")str=str.substring(0,str.length-2);str+="}";return str;},isAppleDevice:function()
{return(navigator.userAgent.match(/iPad|iPhone|iPod/i)!=null);}});$.fn.extend({ellipsesHtml:function(html)
{var element=$(this);var tag=element.get(0).tagName;var temp=$('<'+tag+'></'+tag+'>').insertBefore(element);element.remove().html(html);temp.replaceWith(element);}});String.prototype.stripCssUnit=function()
{var val=this.toString();if(val==null||val==undefined||val==''||val=='auto')return val;re=new RegExp('(px|pt|em|\%|\b)','g');var num=val.replace(re,'');if(num=='')num=0;return parseInt(num);}
Date.parseWCFDateStringToUTC=function(dateString)
{dateString=dateString.replace("/Date(","").replace(")/","");var milliseconds=dateString;var tzSign=(dateString.indexOf("-")>-1)?"-":(dateString.indexOf("+")>-1)?"+":"";if(tzSign!="")milliseconds=dateString.split(tzSign)[0];var date=new Date();date.setTime(new Number(milliseconds));return date;}
String.prototype.commafyNumber=function()
{var nStr=this.toString();nStr+='';x=nStr.split('.');x1=x[0];x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1))
{x1=x1.replace(rgx,'$1'+','+'$2');}
return x1+x2;}
String.prototype.escapeDouble=function()
{var str=this.toString();return str.replace(/\"/g,"\\\"");};String.prototype.escapeDoubleToHtml=function()
{var str=this.toString();return str.replace(/\"/g,"&#34;");};String.prototype.uriEscapeTroublemakers=function()
{var str=this.toString();str=str.replace(/%/g,"%25").replace(/\"/g,"%22").replace(/&/g,"%26");return str;};String.prototype.unescapeHtml=function()
{var str=this.toString();return $('<div/>').html(str).text();}
String.prototype.makeSafeForVideoPlayer=function()
{var str=this.toString();return str.unescapeHtml().stripHtml().uriEscapeTroublemakers();}
String.prototype.stripHtml=function()
{var str=this.toString();return str.replace(/(<([^>]+)>)/ig,"");}
String.prototype.differenceIndexOf=function(compare)
{var index=-1;var str=this.toString();var len=str.length>compare.length?compare.length:str.length;for(var i=0;i<len;i++)
{if(str.charAt(i)!=compare.charAt(i))
{index=i;break;}}
if(index==-1&&str.length!=compare.length)index=len;return index;}
String.prototype.convertToFriendlyName=function()
{var str=this.toString();str=str.replace(/[-_=]/g,' ');var parts=str.split(' ');if(parts.length>0)
{str='';for(var i=0;i<parts.length;i++)
{var helperWord=("|a|an|and|or|the|of|".indexOf('|'+parts[i].toLowerCase()+'|')>=0);if(!helperWord||i==0)
{str+=parts[i].substring(0,1).toUpperCase();if(parts[i].length>1)str+=parts[i].substring(1);}
else str+=parts[i];if(i<(parts.length-1))str+=' ';}}
return str;}
String.prototype.convertFileNameToFriendlyName=function()
{var str=this.toString();str=str.replace(/(\.+([a-zA-Z0-9]{1,10}))/g,'');return str.convertToFriendlyName();}})(jQuery);(function($)
{var Corners={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);var z=$this.options.zIndex;var zUp=z+1;var zDown=z-1;if(!$.isPopulated($this.options.sizes.topheight))
{var size=$this.options.sizes;$this.options.sizes={topHeight:size,bottomHeight:size,leftWidth:size,rightWidth:size};}
var html='<div class="'+$this.widgetBaseClass+'-topbar" style="position: absolute; top: -'+$this.options.sizes.topHeight+'px; height:'+$this.options.sizes.topHeight+'px; width: 100%; z-index: '+zDown+';">';html+='<div class="'+$this.widgetBaseClass+'-topleft" style="position: absolute; left: -'+$this.options.sizes.leftWidth+'px; top: 0;  height:'+$this.options.sizes.topHeight+'px; width:'+$this.options.sizes.leftWidth+'px; background-position: 0 0; z-index: '+zUp+';"></div>';html+='<div class="'+$this.widgetBaseClass+'-topright" style="position: absolute; right: -'+$this.options.sizes.rightWidth+'px; top: 0;  height:'+$this.options.sizes.topHeight+'px; width:'+$this.options.sizes.rightWidth+'px; background-position: 100% 0; z-index: '+zUp+';"></div>';html+='<div class="'+$this.widgetBaseClass+'-topmiddle" style="position: absolute; background-position: 50% 0; margin: 0 auto; width: 100%;  height:'+$this.options.sizes.topHeight+'px; top: 0; left: 0; z-index: '+zDown+';"></div>';html+='</div>';html+='<div class="'+$this.widgetBaseClass+'-leftbar" style="position: absolute; top: 0; left: -'+$this.options.sizes.leftWidth+'px; height: 100%; width:'+$this.options.sizes.leftWidth+'px; background-position: 0 50%; z-index: '+zUp+';"></div>';$this.element.prepend(html);html='<div class="'+$this.widgetBaseClass+'-rightbar" style="position: absolute; top: 0; right: -'+$this.options.sizes.rightWidth+'px; height: 100%; width:'+$this.options.sizes.rightWidth+'px; background-position: 100% 50%; text-align: center; z-index: '+zUp+';"></div>';html+='<div class="'+$this.widgetBaseClass+'-bottombar" style="position: absolute; bottom: -'+$this.options.sizes.bottomHeight+'px; height:'+$this.options.sizes.bottomHeight+'px; width: 100%; z-index: '+zDown+';">';html+='<div class="'+$this.widgetBaseClass+'-bottomleft" style="position: absolute; left: -'+$this.options.sizes.leftWidth+'px; bottom: 0; height:'+$this.options.sizes.bottomHeight+'px;  width:'+$this.options.sizes.leftWidth+'px; background-position: 0 100%; z-index: '+zUp+';"></div>';html+='<div class="'+$this.widgetBaseClass+'-bottomright" style="position: absolute; right: -'+$this.options.sizes.rightWidth+'px; bottom: 0; height:'+$this.options.sizes.bottomHeight+'px; width:'+$this.options.sizes.rightWidth+'px; background-position: 100% 100%; z-index: '+zUp+';"></div>';html+='<div class="'+$this.widgetBaseClass+'-bottommiddle" style="position: absolute; margin: 0 auto; width: 100%; left: 0; bottom: 0; background-position: 50% 100%; height:'+$this.options.sizes.bottomHeight+'px; z-index: '+zDown+';"></div>';html+='</div>';$this.element.append(html);if(!$.isPopulated($this.options.backgroundClass.topLeft))
{$('.ui-corners-topleft, .ui-corners-topright, .ui-corners-topmiddle, .ui-corners-bottomleft, .ui-corners-bottomright, .ui-corners-bottommiddle, .ui-corners-leftbar, .ui-corners-rightbar',$this.element).addClass($this.options.backgroundClass);$this.element.addClass($this.options.backgroundClass).css({backgroundPosition:"-"+$this.options.sizes.leftWidth+"px -"+$this.options.sizes.topHeight+"px"});}
else
{$('.ui-corners-topleft').addClass($this.options.backgroundClass.topLeft);$('.ui-corners-topright').addClass($this.options.backgroundClass.topRight);$('.ui-corners-topmiddle').addClass($this.options.backgroundClass.topMiddle);$('.ui-corners-leftbar').addClass($this.options.backgroundClass.leftSide);$('.ui-corners-rightbar').addClass($this.options.backgroundClass.rightSide);$('.ui-corners-bottomleft').addClass($this.options.backgroundClass.bottomLeft);$('.ui-corners-bottomRight').addClass($this.options.backgroundClass.bottomRight);$('.ui-corners-bottomMiddle').addClass($this.options.backgroundClass.bottomMiddle);$('.ui-corners').addClass($this.options.backgroundClass.contentArea).css({backgroundPosition:"-"+$this.options.sizes.leftWidth+"px -"+$this.options.sizes.topHeight+"px"});}},destroy:function()
{this._log("destroying "+this.widgetBaseClass);this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}}}
$.widget("ui.corners",Corners);$.ui.corners.defaults={newWidth:198,newHeight:60,sizes:20,zIndex:0,log:true}})(jQuery);if(!$.isPopulated(window.loadedShareLinksWidget))
{(function($)
{window.loadedShareLinksWidget=true;if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.shareLinks))
$.addStyleSheet("Styles/jquery.gd/gd.shareLinks.css");var ShareLinks={linkDefaults:{displayOrder:['cutandpaste','email','facebook','twitter','myspace','delicious','digg','stumbleupon'],delicious:{displayName:'Del.icio.us',icon:'delicious-icon.png'},facebook:{displayName:'Facebook',icon:'facebook-icon.png'},digg:{displayName:'Digg',icon:'digg-icon.png'},myspace:{displayName:'MySpace',icon:'myspace-icon.png'},stumbleupon:{displayName:'StumbleUpon',icon:'stumbleupon-icon.png'},reddit:{displayName:'Reddit',icon:'reddit-icon.png'},twitter:{displayName:'Twitter',icon:'twitter-icon.png',extraText:" from Video.ME",bodyText:'',controls:{user:{id:"twitter-user"},password:{id:"twitter-password"},message:{id:"twitter-message"},form:{id:"twitter-submit-form"}},html:function($widget)
{var label=' class="'+$widget.widgetBaseClass+'-label"';var html='<div id="'+this.controls.form.id+'">'+'<div>'+'<div style="float:left; width: 558px;">'+'<dl>'+'<dt'+label+'>'+'Message'+'<span style="position: absolute; width: 100px; right: 15px; text-align: right;" class="'+
$widget.widgetBaseClass+'-counter">400</span>'+'</dt>'+'<dd>'+'<textarea style="width:538px; height:100px;" id="'+this.controls.message.id+'">'+this.controls.message.value+'</textarea>'+'</dd>'+'</dl>'+'</div>'+'<div style="clear:both;"></div>'+'</div>'+'<div class="action-button-group">'+'<a href="#" class="submit button-post action-button-link"></a>'+'<a href="#" class="cancel button-cancel action-button-link"></a>'+'<span class="'+$widget.widgetBaseClass+'-error" style="padding: 0px;"></span>'+'</div>'+'</div>';return html;},prepControls:function($widget,buildForm)
{var $this=this;var baseUrl=$.isPopulated($this.url)?$this.url:$widget.options.url();var shortUrlProviderID=$widget.options.shortUrlProviderID;var shortUrlProviderArgs=$widget.options.shortUrlProviderArgs;$widget._shortenUrl(shortUrlProviderID,shortUrlProviderArgs,baseUrl,function(url)
{var reservedChars=(url.length+1);if(!$this.appendShortUrl)
reservedChars=0;var charLimit=(140-$this.extraText.length);var body=$this.bodyText.length>0?' '+$this.bodyText:'';body=body.replace("{video_url}",($.isPopulated(url)?url:""));var maxLength=(charLimit-reservedChars)-body.length;var title=maxLength<=$widget.options.title().length?'':$widget.options.title();if(body.length>0&&title.length==0)body=body.substr(1);maxLength=(charLimit-reservedChars)-(title.length);body=maxLength<=0?'':maxLength>=body.length?body:$widget._cleanTrunc(body,maxLength);if($this.appendShortUrl)
$this.controls.message.value=title+body+" "+url;else
$this.controls.message.value=$.trim(body);buildForm(function($widget,form)
{form.find("#"+$this.controls.message.id).charCounter({counter:form.find('.'+$widget.widgetBaseClass+'-counter'),charLimit:charLimit});$('#'+$this.controls.user.id).fancyText();$('#'+$this.controls.password.id).fancyText();$('#'+$this.controls.message.id).fancyText();$('#'+$this.controls.user.id+', #'+$this.controls.password.id+', #'+$this.controls.message.id).bind("change",function(){$this.error($widget,"");});});});},prepData:function($widget,callback)
{if(!$.isPopulated($("#"+this.controls.message.id).val()))
{callback({error:"Please enter the message to post."});}
else
{callback({service:"twitter",data:{message:$("#"+this.controls.message.id).charCounter("text")+this.extraText}});}},open:function($widget)
{$('#'+this.controls.user.id).focus();},close:function($widget)
{$('#'+this.controls.password.id).val("").charCounter("reset");},error:function($widget,message)
{$('#'+this.controls.form.id).find('.'+$widget.widgetBaseClass+"-error").html(message);},destroy:function($widget)
{$("#"+this.controls.form.id).find("#"+$this.controls.message.id).charCounter("destroy");}},email:{displayName:'Email',icon:'email-icon.png',extraText:'',bodyText:'',controls:{userName:{id:"email-userName"},sendCopy:{id:"email-sendCopy"},userAddress:{id:"email-userAddress"},sendToAddress:{id:"email-sendToAddress"},note:{id:"email-note"},form:{id:"email-submit-form"}},html:function($widget)
{var label=' class="'+$widget.widgetBaseClass+'-label"';var html='<div id="'+this.controls.form.id+'">'+'<div>'+'<div style="float:left; width: 290px;">'+'<dl>'+'<dt'+label+'>Your Name:</dt>'+'<dd><input style="width: 262px" id="'+this.controls.userName.id+'" /></dd>'+'</dl>'+'<dl>'+'<dt'+label+'>Your Email Address:</dt>'+'<dd><input style="width: 262px;" id="'+this.controls.userAddress.id+'" /></dd>'+'</dl>'+'<input type="checkbox" style="padding-top: 3px;'+($.browser.safari?" margin-left:4px;":"")+'" id="'+this.controls.sendCopy.id+'" /> Send a copy to myself'+'<dl>'+'<dt'+label+'>Your Friend\'s Email Address:</dt>'+'<dd><input style="width: 262px" id="'+this.controls.sendToAddress.id+'" />'+'<div class="'+$widget.widgetBaseClass+'-multiemailinstructions">Separate multiple addresses with commas(,)</div></dd>'+'</dl>'+'</div>'+'<div style="float:left; width: 270px; height: 250px;">'+'<dl>'+'<dt'+label+'>'+'Personal Note <span class="normal">(Optional):</span>'+'<span style="position: absolute; width: 100px; right: 15px; text-align: right;" class="'+
$widget.widgetBaseClass+'-counter">400</span>'+'</dt>'+'<dd>'+'<textarea style="width:262px; height:151px;" id="'+this.controls.note.id+'"></textarea>'+'</dd>'+'</dl>'+'<div class="captcha"></div>'+'<div class="'+$widget.widgetBaseClass+'-error" />'+'</div>'+'<div class="action-button-group">'+'<a href="#" class="submit button-email action-button-link"></a>'+'<a href="#" class="cancel button-cancel action-button-link"></a>'+'</div>'+'</div>'+'</div>';return html;},prepControls:function($widget,buildForm)
{var $this=this;var baseUrl=$.isPopulated($this.url)?$this.url:$widget.options.url();var shortUrlProviderID=$widget.options.shortUrlProviderID;var shortUrlProviderArgs=$widget.options.shortUrlProviderArgs;$widget._shortenUrl(shortUrlProviderID,shortUrlProviderArgs,baseUrl,function(url)
{$this.bodyText=$this.bodyText.replace("{video_url}",($.isPopulated(url)?url:""));buildForm(function($widget,form)
{var charLimit=(400-$this.extraText.length);form.find("#"+$this.controls.note.id).val($this.bodyText).charCounter({counter:form.find('.'+$widget.widgetBaseClass+'-counter'),charLimit:charLimit});$('#'+$this.controls.userName.id).makeSafeish({filters:{list:['html','charLimit']},filterCharLimit:35}).fancyText();$('#'+$this.controls.userAddress.id).makeSafeish({filters:{list:['commas','charLimit'],commas:function(text)
{var stripped=text.replace(/,/ig,"");if(stripped!=text)$this.error($widget,"You may only send from one email address.");else $this.error($widget,"");return stripped;}},filterCharLimit:100}).fancyText();$('#'+$this.controls.sendToAddress.id).fancyText();$('#'+$this.controls.note.id).makeSafeish().fancyText({newHeight:151});$('#'+$this.controls.userName.id+', #'+$this.controls.sendCopy.id+', #'+$this.controls.sendToAddress.id+', #'+$this.controls.note.id).bind("change",function(){$this.error($widget,"");});$this.open($widget);});});},open:function($widget)
{var $this=this;$("#"+$this.controls.userName.id).focus();var setupCaptcha=function(doIt)
{var captcha=$("#"+$this.controls.form.id).find(".captcha");if(doIt)
{if($.isPopulated(captcha.data("captcha")))
{captcha.show().captcha("reset");}
else
{captcha.captcha({dataPersisterUrl:$widget.options.emailCaptchaDataPersisterUrl,imageWidth:65,imageHeight:35,imageSrc:$widget.options.emailCaptchaImageUrl,submitControl:$("#"+$this.controls.form.id).find(".submit")});captcha.captcha("responseElement").fancyText();captcha.show();}}
else
{captcha.hide();}}
if($.isFunction($widget.options.emailCaptchaTrigger))$widget.options.emailCaptchaTrigger(setupCaptcha);else setupCaptcha(false);},prepData:function($widget,callback)
{var captcha=$("#"+this.controls.form.id).find(".captcha");var $this=this;var sendTo=$("#"+$this.controls.sendToAddress.id).val();var captchaText=$.isPopulated(captcha.data("captcha"))?captcha.captcha("text"):"";if(!$.isPopulated($("#"+$this.controls.userName.id).val()))
{callback({error:"Your name not specified."});}
else if(!$.isPopulated($("#"+$this.controls.userAddress.id).val()))
{callback({error:"Your email address not specified."});}
else if(!$.isPopulated(sendTo))
{callback({error:"Your friend's email address not specified."});}
else if(sendTo.split(",").length>5)
{callback({error:"Cannot send to more than 5 email addresses."});}
else if($.isPopulated(captcha.data("captcha"))&&captchaText=="")
{callback({error:"Security code not specified."});}
else
{callback({service:"email",data:{userName:$("#"+$this.controls.userName.id).makeSafeish("getSafeText"),sendCopy:$("#"+$this.controls.sendCopy.id).is(':checked'),userAddress:$("#"+$this.controls.userAddress.id).val(),sendToAddress:$("#"+$this.controls.sendToAddress.id).val(),note:$("#"+$this.controls.note.id).charCounter("text",$("#"+$this.controls.note.id).makeSafeish("getSafeText"))+$this.extraText,url:$.isPopulated($this.url)?$this.url:$widget.options.url(),title:$widget.options.title(),captchaText:captchaText}});}},error:function($widget,message)
{$('#'+this.controls.form.id).find('.'+$widget.widgetBaseClass+"-error").html(message);},close:function($widget)
{$('#'+this.controls.userName.id).val("");$('#'+this.controls.userAddress.id).val("");$('#'+this.controls.sendToAddress.id).val("");$('#'+this.controls.sendCopy.id).attr("checked",false);$('#'+this.controls.note.id).charCounter("reset");$('#'+this.controls.form.id).find('.'+$widget.widgetBaseClass+"-error").html("");},destroy:function($widget)
{$("#"+this.controls.form.id).find('.'+$widget.widgetBaseClass+'-counter').charCounter("destroy");}},cutandpaste:{displayName:'Embed',icon:'embed-icon.png',controls:{embedCode:{id:'embed-link-embedcode'},pageLink:{id:'embed-link-pagelink'},form:{id:"embed-link-form"}},prepControls:function($widget,buildForm)
{var $this=this;buildForm(function($widget,form)
{form.find(".button-select").click(function()
{$('#'+$this.controls.embedCode.id).select();return false;});$('#'+$this.controls.pageLink.id).fancyText();$('#'+$this.controls.embedCode.id).fancyText({newHeight:136});});},html:function($widget)
{var label=' class="'+$widget.widgetBaseClass+'-label"';var html='<div id="'+this.controls.form.id+'" ><dl>';html+='<dt'+label+'>Link to page:</dt>';html+='<dd><input style="width:550px;" type="text" id="'+this.controls.pageLink.id+'" value="'+$widget.options.url()+'"></dd>';html+='<dt'+label+'>Embed:</dt>';html+='<dd><textarea style="width: 550px; height: 136px;" id="'+this.controls.embedCode.id+'">&lt;script type="text/javascript" src="'+$widget.options.embedPath+'"&gt;&lt;/script&gt;</textarea></dd>';html+='</dl><br/>';html+='<div class="action-button-group">';html+='<a class="button-select action-button-link" href="#"></a>';html+='<a href="#" class="cancel button-cancel action-button-link"></a>';html+='</div></div>';return html;}}},remoteEmail:{displayName:'Email',icon:'email-icon.png'},_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);var displayOrder=this.options.links.displayOrder;this.options.links=$.extend(true,this.linkDefaults,this.options.links);if($.isPopulated(displayOrder))this.options.links.displayOrder=displayOrder;if(this.options.isRemote&&$.isPopulated(this.options.links.email))
{if($.isPopulated(this.options.links.email.extraText))this.remoteEmail.extraText=this.options.links.email.extraText;if($.isPopulated(this.options.links.email.bodyText))this.remoteEmail.bodyText=this.options.links.email.bodyText;if($.isPopulated(this.options.links.email.url))this.remoteMail.url=this.options.links.email.url;this.options.links.email=this.remoteEmail;}
if(!$.isFunction(this.options.title))
{var title=this.options.title;this.options.title=function(){return title;};}
if(!$.isFunction(this.options.url))
{var url=this.options.url;this.options.url=function(){return url;};}
$this.element.addClass($this.widgetBaseClass);$this.element.css("zIndex","3000");$this.element.html($this._getInitHtml());$this.options.isClosed=false;if($this.options.displayAs=="flyout")
{$this.element.flyout({anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY,backgroundInfo:$this.options.backgroundInfo});}
$this._configureEvents($this);if($.isPopulated($this.options.opener)&&($.inArray($this.options.opener,$this.options.links.displayOrder)>-1))
{$this.currentForm=$this.options.opener;var linkDef=$this.options.links[$this.currentForm];if($.isPopulated(linkDef.html))
{$this._showForm($("."+$this.widgetBaseClass+"-launch-"+$this.options.opener,$this.element),$this,$this.options.opener,linkDef);}}
else $this.currentForm=$this.links.displayOrder[0];},destroy:function()
{this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},open:function()
{this.element.flyout("open");this._openForm(this.currentForm);},_openForm:function(linkName)
{var list=$.isPopulated(linkName)?[linkName]:this.options.links.displayOrder;var linkDefs=this.options.links;for(var i=0;i<list.length;i++)
{var name=list[i];if($.isFunction(linkDefs[name].open))
{linkDefs[name].open(this);}}},close:function()
{var $this=this;$.each($this.options.links.displayOrder,function(i,name)
{var linkDef=$this.options.links[name];if($.isFunction(linkDef.close))
{linkDef.close($this);}});this.element.flyout("close");},isClosed:function()
{return this.element.flyout("isClosed");},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configureEvents:function($this)
{var options=this.options;if($this.options.displayAs=="flyout")$this.element.corners($this.options.backgroundInfo);$.each(options.links.displayOrder,function(i,name)
{var linkDef=options.links[name];if($.isPopulated(linkDef.html))
{$("."+$this.widgetBaseClass+"-launch-"+name,$this.element).click(function()
{if(!$.isPopulated($this.element.data("inclick"+name))&&($this.element.data("current")!=name))
{$this.element.data("inclick"+name,true);$this.element.data("current",name);$this._showForm($(this),$this,name,linkDef,function(){$this.element.removeData("inclick"+name);});}
return false;});}});},_unconfigureEvents:function($this,$element)
{$.each($this.options.links.displayOrder,function(i,name)
{var linkDef=$this.options.links[name];if(linkDef.destroy)
{linkDef.destroy();}});},_showForm:function(a,$this,linkName,linkDef,callback)
{$this.currentForm=linkName;var $element=$this.element;var formBox=$('.'+$this.widgetBaseClass+'-formDisplay',$element);a.parents("ul").find("a").removeClass($this.widgetBaseClass+"-link-active");a.addClass($this.widgetBaseClass+"-link-active");var formId=linkDef.controls.form.id;var form=formBox.find("#"+formId);var showIt=function()
{form.siblings(":visible").animate({opacity:0,height:form.height()},{duration:400,queue:false,complete:function(){$(this).css({display:"none",opacity:"",height:""});}});formBox.animate({width:form.width(),height:form.height()},{duration:500,queue:false,complete:function(){form.fadeIn("slow",function(){$this._openForm($this.currentForm);});}});var resize=null;if($this.options.positionX=="left")
{resize={};resize.left=(form.width()<$this.options.minWidth?$this.options.minWidth:form.width())+($this.element.css("paddingLeft").stripCssUnit()+$this.element.css("paddingRight").stripCssUnit());resize.left=$this.options.anchor.offset().left-resize.left-$this.options.offsetX;}
if($this.options.positionY=="top")
{if(resize==null)resize={};var formYDiff=($this.element.outerHeight(false)-formBox.outerHeight(false));var elHeight=form.outerHeight(true)+formYDiff;elHeight=(elHeight<$this.options.minHeight?$this.options.minHeight:elHeight);resize.top=$this.options.anchor.offset().top-elHeight-$this.options.offsetY;}
if(resize!=null)
{$this.element.animate(resize,{duration:500,queue:false,complete:function(){if($.isFunction(callback))callback();}});}}
if(form.length<1)
{var wait=$this.element.find('.'+this.widgetBaseClass+'-formWait');wait.css({display:'block',height:formBox.height(),width:formBox.width(),position:'absolute'});wait.siblings(":visible").animate({opacity:0,height:wait.height()},{duration:400,queue:false,complete:function(){$(this).css({display:"none",opacity:"",height:""});}});linkDef.prepControls($this,function(postPrep)
{var html=linkDef.html($this);form=$(html).appendTo(formBox).css({position:"absolute"}).hide().addClass($this.widgetBaseClass+"-form");if($.isPopulated(linkDef.prepData))
{form.find(".submit").click(function(){$this._sendData(linkName,$this);return false;});}
form.find(".cancel").click(function(){$this.close();return false;});if($.isFunction(postPrep))postPrep($this,form);showIt();});}
else showIt();},_cleanTrunc:function(text,targetLength)
{var temp=text.toString();var result=temp;if(temp.length>targetLength+3)
{result=temp.substring(0,targetLength-3)+"...";}
if(result=='...')result='';return result;},_getInitHtml:function()
{var links=this._getLinks({url:this.options.url(),title:this.options.title(),fullDefs:this.options.links});var html='<div class="'+this.widgetBaseClass+'-header"><h1>Email &amp; Social Networks:</h1>';html+="<ul>";var list=this.options.links.displayOrder;var linkDefs=this.options.links;for(var i=0;i<list.length;i++)
{var name=list[i];html+='<li><a href=';if(linkDefs[name].html)html+='"#" ';else html+='"'+links[name]()+'" target="_blank" ';html+='class="'+this.widgetBaseClass+'-link-'+name+' '+this.widgetBaseClass+'-link';if(linkDefs[name].html)html+=' '+this.widgetBaseClass+'-launch-'+name;html+='" title="'+linkDefs[name].displayName+'" >'+linkDefs[name].displayName+'</a></li>';}
html+="</ul></div>";html+='<div class="'+this.widgetBaseClass+'-formDisplay"><div class="'+this.widgetBaseClass+'-formWait"></div></div>';return html;},_urlBuilder:function(options)
{options=$.extend({encode:false,host:"www.godaddy.com",protocol:"http",path:""},options);var link="";if(options.host!=null&&options.host!='undefined'&&options.host!='')
{link+=options.protocol+'://'+options.host;}
else if(options.protocol=="mailto")
{link+=options.protocol+":";}
if(options.path!=null&&options.path!='undefined'&&options.path!='')
{link+="/"+options.path;}
if(options.query!=null&&options.query!=undefined)
{var isFirst=true;var item;for(item in options.query)
{link+=(isFirst?"?":"&")+item+"="+options.query[item];isFirst=false;}}
return options.encode?encodeURIComponent(link):link;},_getLinks:function(options)
{var $this=this;var encode=encodeURIComponent;options=$.extend({url:"http://www.godaddy.com",title:"GoDaddy.com"},options);function delicious()
{return $this._urlBuilder({host:"delicious.com",protocol:"http",path:"save",query:{noui:"",v:"5",jump:"close",url:encode(options.url),title:encode(options.title)}});}
function facebook()
{return $this._urlBuilder({host:"www.facebook.com",path:"sharer.php",query:{u:encode(options.url),t:encode(options.title)}});}
function digg()
{return $this._urlBuilder({host:"digg.com",path:"submit",query:{url:encode(options.url),t:encode(options.title),bodytext:''}});}
function myspace()
{return $this._urlBuilder({host:"www.myspace.com",path:"index.cfm",query:{fuseaction:"postto",u:encode(options.url),t:encode(options.title),c:encode('<a href="'+options.url+'">'+options.title+'</a>')}});}
function reddit()
{return $this._urlBuilder({host:"www.reddit.com",path:"login",query:{dest:$this._urlBuilder({encode:true,host:"",protocol:"",path:"submit",query:{url:encode(options.url),title:encode(options.title)}})}});}
function stumbleupon()
{return $this._urlBuilder({host:"www.stumbleupon.com",path:"submit",query:{url:encode(options.url),title:encode(options.title)}});}
function email()
{var body=options.url;if($.isPopulated(options.fullDefs.email))
{body=$.isPopulated(options.fullDefs.email.url)?options.fullDefs.email.url:body;body=$.isPopulated(options.fullDefs.email.bodyText)?options.fullDefs.email.bodyText+"\n\n"+body:body;body=$.isPopulated(options.fullDefs.email.extraText)?body+"\n\n"+options.fullDefs.email.extraText:body;}
return $this._urlBuilder({protocol:'mailto',host:"",path:"",query:{subject:encode(options.title.unescapeHtml()),body:encode(body)}});}
return{delicious:delicious,facebook:facebook,myspace:myspace,reddit:reddit,stumbleupon:stumbleupon,digg:digg,email:email};},_shortenUrl:function(shortUrlProviderID,shortUrlProviderArgs,url,success)
{if(shortUrlProviderID==1)
{var link='http://to.ly/api.php?json=1&longurl='+encodeURIComponent(url)+'&callback=?';$.getJSON(link,function(data)
{if(success)
{success(data.shorturl);}});}
else if(shortUrlProviderID==2)
{link=shortUrlProviderArgs+"?url="+url+"&callback=?"
$.getJSON(link,function(data)
{if(success)
{success(data);}});}},_sendData:function(service,$this)
{if($.isFunction($this.options.dataPersister))
{var callback=function(preppedData)
{if(!$.isPopulated(preppedData.error))
{$this.options.dataPersister(preppedData,function(data)
{if(data.success)
{$this.close();}
else
{if($.isFunction($this.options.links[service].error))
$this.options.links[service].error($this,data.error);else
alert(data.error);}});}
else
{if($.isFunction($this.options.links[service].error))
$this.options.links[service].error($this,preppedData.error);else
alert(preppedData.error);}}
$this.options.links[service].prepData($this,callback);}}}
$.widget("ui.shareLinks",ShareLinks);$.ui.shareLinks.getter="isClosed";$.ui.shareLinks.defaults={url:window.location.href,title:document.title,position:"right",opener:"cutandpaste",links:{},displayAs:"flyout",offsetX:-7,offsetY:-7,positionY:"top",positionX:"right",minHeight:200,minWidth:200,backgroundInfo:{sizes:30,backgroundClass:'ui-shareLinks-background'},shortUrlProviderID:1,shortUrlProviderArgs:null,log:true}})(jQuery);}
(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.charCounter))
$.addStyleSheet("Styles/jquery.gd/gd.charCounter.css");var CharCounter={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.options.addedCounter=false;if(!$.isPopulated($this.options.counter))
{$this.options.counter=$("<div/>").appendTo($this.element.parent());$this._positionCounter();$this.options.addedCounter=true;}
$this.options.counter.addClass($this.widgetBaseClass+"-counter");$this._setCounter($this);$this._configureEvents($this,$this.element);},destroy:function()
{if(this.options.addedCounter)this.options.counter.empty().remove();this.element.removeClass(this.widgetBaseClass);this._unconfigureEvents(this,this.element);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_positionCounter:function()
{var $this=this;$this.options.counter.css({position:"absolute",top:$this.element.offset().top+$this.element.height()+5,left:$this.element.offset().left-$this.options.counter.width()});this.options.minWidth=this.element.width();},_configureEvents:function($this,$element)
{var options=this.options;$this.element.bind("keyup."+$this.widgetBaseClass+" change."+$this.widgetBaseClass,function(event)
{var $element=$(event.target);var $this=$element.data("charCounter");$this._setCounter($this);});},_unconfigureEvents:function($this,$element)
{$this.element.unbind("keyup."+$this.widgetBaseClass+" change."+$this.widgetBaseClass);},_setCounter:function($this)
{var count=$this.element.val().length;var difference=$this.options.charLimit-count;$this.options.counter.text(difference).removeClass($this.widgetBaseClass+"-ok "+$this.widgetBaseClass+"-nearlimit "+$this.widgetBaseClass+"-overlimit");switch(true)
{case difference>10:$this.options.counter.addClass($this.widgetBaseClass+"-ok");break;case difference<=10&&difference>=0:$this.options.counter.addClass($this.widgetBaseClass+"-nearlimit");break;case difference<0:$this.options.counter.addClass($this.widgetBaseClass+"-overlimit");break;}},reset:function()
{this._setCounter(this);},text:function(text)
{var text=$.isPopulated(text)?text:this.element.val();return text.substring(0,this.options.charLimit);}}
$.widget("ui.charCounter",CharCounter);$.ui.charCounter.getter="text";$.ui.charCounter.defaults={counter:null,charLimit:140,log:true}})(jQuery);if(!$.isPopulated(window.loadedVideoPlayerWidget))
{(function($){window.loadedVideoPlayerWidget=true;if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.videoPlayer))
$.addStyleSheet("Styles/jquery.gd/gd.videoPlayer.css");var VideoPlayer={videoTitle:'',_init:function(){var $this=this;$this._log("abc123-loading "+$this.widgetBaseClass+" - video "+this.options.videoId);if($this.options.unavailable){if($this.options.isRemote){$this.element.append('<a href="'+$this.options.remoteBasePath+'" class="'+$this.widgetBaseClass+'-unavailable-embedded"><span class="unavailablemessage-embedded">Ouch!</span> <span>Sorry to tell you that the video you want is gone.</span></a>');}
else if($this.options.allLocked){$this.element.append('<a href="'+$this.options.unavailableReturnUrl+'" class="'+$this.widgetBaseClass+'-onlyPasswordProtectedInChannel"></a>');}else{var url=$this.options.unavailableReturnUrl?$this.options.unavailableReturnUrl:"#";$this.element.append('<a href="'+url+'" class="'+$this.widgetBaseClass+'-unavailable"></a>');}}
else{this.videoTitle=this.options.videoTitle;this.loggedIn=($.isPopulated(this.options.userId)&&(this.options.userId>0));this.canEdit=(this.loggedIn&&(this.options.videoUserId==this.options.userId||$this.options.mode=="abuse"));$this.element.addClass($this.widgetBaseClass);$this.element.html($this._getInitHtml());$this.element.width($this.options.playerWidth);$this.element.height($this.options.playerHeight+
$this.element.find("."+this.widgetBaseClass+"-videocontrols").outerHeight());var timestamp=(new Date().getMilliseconds());if(!$.isPopulated($this.element.attr("id")))
$this.element.attr("id",$this.widgetBaseClass+timestamp);if($.isAppleDevice())
$this._setUpHtml5($this,$this.element);else
$this._setUpFlash($this,$this.element);if($this.options.showControls)
$this._configure($this,$this.element);}},destroy:function(){if(this.options.showControls)this._unconfigure(this,this.element);this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg){if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log){console.log(msg);}},_getInitHtml:function(){var html='<div id="'+this.element.attr("id")+'-vid" class="'+this.widgetBaseClass+'-vid" style="width:'+this.options.playerWidth+'px; height:'+this.options.playerHeight+'px; margin:0px; padding:0px; background-color:#000"></div>';if(this.options.showControls){html+='<div class="'+this.widgetBaseClass+'-videocontrols clear-fix';if(this.options.useBackroundImageForVideoControls)
html+=' '+this.widgetBaseClass+'-videocontrols-bgimage'
html+='">';if(this.options.mode=="normal"||this.options.mode=="event"){html+='<div class="div-container-video clear-fix"><div class="'+this.widgetBaseClass+'-actions"><ul>';if(!this.options.isRemote){html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-like '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners('Like',this.widgetBaseClass+'-liketext')+'</a></li>';}
if(this.options.isRemote&&$.isAppleDevice())html+='<li><a href="'+this.options.shareVidPath+'" class="'+this.widgetBaseClass+'-button-gohome '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners('View on Video.ME')+'</a></li>';html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-share '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners("Share Video")+'</a></li>';if(this.options.mode!="event"){html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-flag '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners('<div class="flagIcon" />Flag')+'</a></li>';}
var onRootUtl=stringEndsWith(window.location.pathname,"/",true);var onDefaultPage=stringEndsWith(window.location.pathname,"default.aspx",true);if(!onRootUtl&&!onDefaultPage){if(this.canEdit&&!$.isAppleDevice()){html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-edit '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners('<div class="editIcon" />Edit')+'</a></li>';}}
html+='</ul></div>';html+='<div class="'+this.widgetBaseClass+'-stats">';html+='<div style="float: right;" class="'+this.widgetBaseClass+'-likes '+this.widgetBaseClass+'-statsbutton">';html+=this._wrapContentForCorners('<div class="likesIcon" />'+'<span class="'+this.widgetBaseClass+'-likestext">'+this.options.likesCount+'</span>');html+='</div>';html+='<div style="float: right;" class="'+this.widgetBaseClass+'-views '+
this.widgetBaseClass+'-statsbutton">'+
this._wrapContentForCorners(this._getNumViewsHtml(this.options.viewsCount))+'</div>';html+='</div></div>';}
else{html+='<span class="'+this.widgetBaseClass+'-abusetype">Abuse Type: '+this.options.abuseText+'</span>';html+='<div class="'+this.widgetBaseClass+'-abuse-actions"><ul>';if(this.options.abuseText!='No Issues')
html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-allow '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners("Allow Video")+'</a></li>';html+='<li><a href="#" class="'+this.widgetBaseClass+'-button-remove '+this.widgetBaseClass+'-actionbutton">'+this._wrapContentForCorners("Remove Video")+'</a></li>';html+='</ul></div>';}
html+='</div>';}
return html;},_getNumViewsHtml:function(numViews){var html=this.options.viewsCount.toString().commafyNumber()+' view'+
(this.options.viewsCount=="1"?'':'s');return html;},_wrapContentForCorners:function(content,contentClass){var html='<div class="'+this.widgetBaseClass+'-wrapper'+($.isPopulated(contentClass)?' '+contentClass:'')+'">'+'<div class="'+this.widgetBaseClass+'-wrapper-left"></div>'+'<div class="'+this.widgetBaseClass+'-wrapper-center">'+content+'</div>'+'<div class="'+this.widgetBaseClass+'-wrapper-right"></div>'+'</div>';return html;},_setUpFlash:function(){var vid=$("#"+this.element.attr("id")+"-vid");this.element.width(vid.width());var flashvars={doPlay:0,doLoad:0,doPassword:this.options.videoPromptForPassword,theVid:this.options.videoUrl,theTitle:this.options.videoTitle,thePic:this.options.videoThumbnail,subTitleParm1:this.options.videoUserName,vmLink:(this.options.isRemote?this.options.remoteBasePath:this.options.basePath)+'?ci=22844',Width:this.options.playerWidth,Height:this.options.playerHeight,Generic:this.options.showGenericPlayer?1:0};if(this.options.mode=="event"){flashvars.doBy=0;flashvars.subTitleParm1=this.options.modeData.eventTitle;flashvars.doWatchMoreBar=0;if($.isPopulated(this.options.modeData.eventAdLink)){flashvars.ad1InitialTime=$.isPopulated(this.options.modeData.eventAdTimeout)?(this.options.modeData.eventAdTimeout*10):50;flashvars.doAd1=1;flashvars.ad1Link=this.options.modeData.eventAdLink;flashvars.ad1LinkPops=0;}
if($.isPopulated(this.options.modeData.eventLink)){flashvars.subTitleLink1=this.options.modeData.eventLink;flashvars.vmLink=this.options.modeData.eventLink;}
if($.isPopulated(this.options.modeData.eventVideoTitleOverride))flashvars.theTitle=this.options.modeData.eventVideoTitleOverride;if($.isPopulated(this.options.modeData.eventVideoThumbnailOverride))flashvars.thePic=this.options.modeData.eventVideoThumbnailOverride;}
var params={flashvars:flashvars,promptForPassword:(this.options.videoType==2&&this.options.isRemote),isRemote:this.options.isRemote,remoteBasePath:this.options.remoteBasePath,videoId:this.options.videoId,playerWidth:this.options.playerWidth,playerHeight:this.options.playerHeight,viewPersister:this.options.viewPersister,privateUrlRetriever:this.options.privateUrlRetriever};if(this.options.isRemote)params.playerParams={allowscriptaccess:"always"};vid.flashPlayer(params);var $this=this;vid.bind("viewed",function(e,viewCount){$this._log("incrementing view count; current: "+viewCount+"; video ID: "+$this.options.videoId);$this.options.viewsCount=viewCount;var innerHtml=$this._getNumViewsHtml($this.options.viewsCount);var html=$this._wrapContentForCorners(innerHtml);$this.element.find('.'+$this.widgetBaseClass+'-views').html(html);});if(this.options.videoPromptForPassword>0){vid.bind("passwordVerified",function(e,playerId,videoUrl){document.getElementById(playerId).playPrivateURL(videoUrl);});}},_setUpHtml5:function(){var vid=$("#"+this.element.attr("id")+"-vid");this.element.width(vid.width());var params={url:this.options.videoUrl,thumbnail:this.options.videoThumbnail,promptForPassword:(this.options.videoType==2&&this.options.isRemote),isRemote:this.options.isRemote,remoteBasePath:this.options.remoteBasePath,videoId:this.options.videoId,width:this.options.playerWidth,height:this.options.playerHeight,viewPersister:this.options.viewPersister,privateUrlRetriever:this.options.privateUrlRetriever};if(this.options.mode=="event"){if($.isPopulated(this.options.modeData.eventVideoThumbnailOverride))params.thumbnail=this.options.modeData.eventVideoThumbnailOverride;}
vid.html5Player(params);var $this=this;vid.bind("viewed",function(e,viewCount){$this.options.viewsCount=viewCount;var innerHtml=$this._getNumViewsHtml($this.options.viewsCount);var html=$this._wrapContentForCorners(innerHtml);$this.element.find('.'+$this.widgetBaseClass+'-views').html(html);});if(this.options.videoPromptForPassword>0){}},_configure:function($this,$element){var options=this.options;if($this.options.mode=="normal"||$this.options.mode=="event"){var params={};if(!this.options.isRemote){params={alreadyVoted:$this.options.viewerLikesVideo,contentXPath:"."+$this.widgetBaseClass+" ."+$this.widgetBaseClass+'-liketext .ui-videoPlayer-wrapper-center',counter:$this.element.find("."+$this.widgetBaseClass+"-likestext"),count:$this.options.likesCount,loggedIn:this.loggedIn,votedHtml:'<div class="voted" />Unlike',notVotedHtml:'<div class="notvoted" />Like',videoId:$this.options.videoId};if($.isFunction($this.options.likePersister))params.dataPersister=$this.options.likePersister;$this.element.find("."+$this.widgetBaseClass+"-button-like").likeIt(params);if(!$.isAppleDevice()){$this.element.find("."+$this.widgetBaseClass+"-button-edit").bind("click."+$this.widgetBaseClass,function(event){var anchor=$(this).find("."+$this.widgetBaseClass+"-wrapper-center");var id="#editVideo-"+$this.options.videoId;if($(id).length<1){var editOptions={anchor:anchor,title:$this.videoTitle,filename:$this.options.videoFileName,description:$this.options.videoDescription,tags:$this.options.videoTags,password:$this.options.password,videoType:$this.options.videoType,accountType:$this.options.userType,dataPersister:$this.options.editPersister,showCategories:true,categoriesDataPersister:$this.options.editCategoriesPersister,backgroundInfo:{backgroundClass:'ui-videoPlayer-flyoutBackground',sizes:30},offsetX:20,offsetY:20};if($.isPopulated($this.options.displayEditAs))editOptions.displayAs=$this.options.displayEditAs;if($.isPopulated($this.options.categoriesData))editOptions.categoriesData=$this.options.categoriesData;if($.isPopulated($this.options.allCategories))editOptions.allCategories=$this.options.allCategories;else editOptions.categoriesDataRetriever=$this.options.editCategoriesRetriever;$('<div id="'+id.replace("#","")+'" />').appendTo(document.body).editVideo(editOptions);}
else{if($(id).editVideo("isClosed"))$(id).editVideo("open");else $(id).editVideo("close");}
return false;});}
if($.getQueryStringVariable("likeIt")=="1")$this.element.find("."+$this.widgetBaseClass+"-button-like").click();}
var shareButton=$element.find("."+$this.widgetBaseClass+"-button-share");if($.isAppleDevice())
{videoMe_Common.shortenUrl($this.options.shortUrlProviderID,$this.options.shortUrlProviderArgs,$this.options.shareVidPath,function(url)
{var body=$this.options.shareVidPath;if($this.options.mode=="event"&&$.isPopulated($this.options.modeData.eventEmailText))
{body=$this.options.modeData.eventEmailText+"\n\n"+body;}
body=body.replace("{video_url}",($.isPopulated(url)?url:""));shareButton.attr("href","mailto:?subject="+encodeURIComponent($this.options.videoTitle.unescapeHtml())+"&body="+encodeURIComponent(body));});}
else
{shareButton.bind("click",function(event){try{RecordEvent(event,'click','22842','');}
catch(e){}
var anchor=$(this).find("."+$this.widgetBaseClass+"-wrapper-center");var id="#sharelinks-"+$this.options.videoId;if($(id).length<1){var shareOptions={anchor:anchor,url:$this.options.shareVidPath,title:$this.videoTitle,backgroundInfo:{backgroundClass:'ui-videoPlayer-flyoutBackground',sizes:30},offsetX:20,offsetY:20,isRemote:$this.options.isRemote,emailCaptchaImageUrl:$this.options.emailCaptchaImageUrl,emailCaptchaDataPersisterUrl:$this.options.emailCaptchaDataPersisterUrl,emailCaptchaTrigger:$this.options.emailCaptchaTrigger,shortUrlProviderID:$this.options.shortUrlProviderID,shortUrlProviderArgs:$this.options.shortUrlProviderArgs};if($this.options.sharePersister)shareOptions.dataPersister=$this.options.sharePersister;if($this.options.embedPath)shareOptions.embedPath=$this.options.embedPath;shareOptions.links={twitter:{}};if($this.options.mode=="event"){shareOptions.links={twitter:{bodyText:$this.options.modeData.eventTwitterText,extraText:'',commercialEvent:true},email:{bodyText:$this.options.modeData.eventEmailText}};shareOptions.links.twitter.appendShortUrl=$this.options.modeData.appendShortUrlForTwitterText;if($.isPopulated($this.options.modeData.eventVideoShareUrl)){shareOptions.links.twitter.url=$this.options.modeData.eventVideoShareUrl;shareOptions.links.email.url=$this.options.modeData.eventVideoShareUrl;}}
else{shareOptions.links.twitter.appendShortUrl=true;}
var shareDiv=$('<div id="'+id.replace("#","")+'" />').appendTo(document.body);if(!$this.options.isRemote)
shareDiv.insertAfter($this.element.find(".ui-videoPlayer-videocontrols"));shareDiv.shareLinks(shareOptions);}
else{if($(id).shareLinks("isClosed")){$(id).shareLinks("open");}
else{$(id).shareLinks("close");}}
return false;});}
var flagButton=$this.element.find("."+$this.widgetBaseClass+"-button-flag");if($.isAppleDevice()){flagButton.attr("href",($this.options.isRemote?$this.options.remoteBasePath+"/":"")+"FlagVideo.aspx?ci=22843&vid="+$this.options.videoId);}
else{flagButton.bind("click."+$this.widgetBaseClass,function(event){try{RecordEvent(event,'click','22843','');}
catch(e){}
var anchor=$(this).find("."+$this.widgetBaseClass+"-wrapper-center");var id="#flagvid-"+$this.options.videoId;if($(id).length<1){params={anchor:anchor,dataPersister:$this.options.flagPersister,backgroundInfo:{backgroundClass:'ui-videoPlayer-flyoutBackground',sizes:30},offsetX:20,offsetY:20};if($.isPopulated($this.options.abuseTypes))params.abuseTypes=$this.options.abuseTypes;$('<div id="'+id.replace("#","")+'" />').appendTo(document.body).flagAbuse(params);}
else{if($(id).flagAbuse("isClosed"))
$(id).flagAbuse("open");else
$(id).flagAbuse("close");}
return false;});}}
else if($this.options.mode=="admin"||$this.options.mode=="audit"){$this.element.find("."+$this.widgetBaseClass+"-button-allow").bind("click."+$this.widgetBaseClass,function(){if($.isFunction($this.options.auditPersister))$this.options.auditPersister(true);});$this.element.find("."+$this.widgetBaseClass+"-button-remove").bind("click."+$this.widgetBaseClass,function(){if($.isFunction($this.options.auditPersister))$this.options.auditPersister(false);});}},_unconfigure:function($this,$element){if($this.options.mode=="normal"){$this.element.find("."+$this.widgetBaseClass+"-button-share").unbind("click."+$this.widgetBaseClass);$this.element.find("."+$this.widgetBaseClass+"-button-flag").unbind("click."+$this.widgetBaseClass);if($this.loggedIn)
$this.element.find("."+$this.widgetBaseClass+"-button-like").likeIt("destroy");else
$this.element.find("."+$this.widgetBaseClass+"-button-like").unbind("click."+$this.widgetBaseClass);$("#sharelinks-"+$this.options.videoId).shareLinks("destroy");$("#flagvid-"+$this.options.videoId).flagAbuse("destroy");}
else{$this.element.find("."+$this.widgetBaseClass+"-button-allow").unbind("click."+$this.widgetBaseClass);$this.element.find("."+$this.widgetBaseClass+"-button-remove").unbind("click."+$this.widgetBaseClass);}},reload:function(data){if($.isAppleDevice())
this.element.find("."+this.widgetBaseClass+"-vid").html5Player("reload",data);else
this.element.find("."+this.widgetBaseClass+"-vid").flashPlayer("reload",data);}}
$.widget("ui.videoPlayer",VideoPlayer);$.ui.videoPlayer.defaults={isRemote:false,basePath:'',remoteBasePath:'',videoId:1,videoPromptForPassword:0,videoTitle:'Video',videoThumbnail:null,videoUrl:null,videoUserName:'',showControls:true,playerWidth:640,playerHeight:381,likesCount:0,viewsCount:0,mode:"normal",auditPersister:null,viewPersister:null,likePersister:null,abuseText:"",log:true,viewerLikesVideo:false,useBackroundImageForVideoControls:false,showGenericPlayer:false,shortUrlProviderID:1,shortUrlProviderArgs:null}})(jQuery);}
function stringEndsWith(str,substr,ignoreCase)
{return new RegExp(substr+"$",ignoreCase?"i":"").test(str);};function savePlayerVolume(vol)
{document.cookie="player_vol="+vol;}
function getSavedPlayerVolume()
{if(document.cookie)
{var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++)
{var varName=(cookies[i].split("=")[0]);var varValue=(cookies[i].split("=")[1]);if(varName=='player_vol')return varValue;}}
return-1;}
(function($)
{var FlashPlayer={playerId:null,_init:function()
{var $this=this;$this._log("vidload-1234: loading "+$this.widgetBaseClass+" into #"+$this.element.attr("id"));this.options.viewCallbackName=$this.widgetBaseClass.replace("-","")+"viewCounter"+this.options.videoId;this.options.flashvars.viewStartCallback=this.options.viewCallbackName;if(!this.options.isRemote)
this.options.flashvars.vmLinkPops=0;this.options.flashvars.theTitle=this.options.flashvars.theTitle.makeSafeForVideoPlayer();var playerParamsDefaults={quality:"high",allowfullscreen:"true",allowscriptaccess:"samedomain",wmode:"opaque"};this.options.playerParams=$.extend(true,{},playerParamsDefaults,this.options.playerParams);var playerAttributesDefaults={id:"vmplayer",name:"vmplayer"};this.options.playerAttributes=$.extend(true,{},playerAttributesDefaults,this.options.playerAttributes);if(this.options.isRemote)
this.options.playerAttributes.id=this.element.attr("id")+'-'+this.options.playerAttributes.id;this.options.playerId=this.options.playerAttributes.id;if(!$.isPopulated(window[this.widgetBaseClass+"-players"]))
window[this.widgetBaseClass+"-players"]={};window[this.widgetBaseClass+"-players"][this.options.videoId]=this.options.playerId;this.loggedIn=($.isPopulated(this.options.userId)&&(this.options.userId>0));$this.element.addClass($this.widgetBaseClass);$this.element.width($this.options.playerWidth);$this.element.height($this.options.playerHeight);$this.element.html($this._getInitHtml());var timestamp=(new Date().getMilliseconds());if(!$.isPopulated($this.element.attr("id")))
$this.element.attr("id")=$this.widgetBaseClass+timestamp;this.element.width($("#"+$this.element.attr("id")+"-vid").width());this.element.height($("#"+$this.element.attr("id")+"-vid").height());swfobject.embedSWF(this.options.remoteBasePath+'vmplayer.swf?v=0.3',$this.element.attr("id")+"-vid",$this.options.playerWidth.toString(),$this.options.playerHeight.toString(),"9.0.115","expressInstall.swf",this.options.flashvars,this.options.playerParams,this.options.playerAttributes);this._configure(this,this.element);},destroy:function()
{if(this.options.showControls)this._unconfigure(this,this.element);this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_getInitHtml:function()
{var html='<div id="'+this.element.attr("id")+'-vid" style="width:'+this.options.playerWidth+'px; height:'+this.options.playerHeight+'px; margin:0px; padding:0px; background-color:#000;overflow:auto;">';html+='<div style="background-color:#fff; margin-top:15px; padding:20px 0 20px 20px;">';html+='<h3>Can'+"'"+'t see video here?&nbsp; Your Flash player may be outdated or blocked.&nbsp; Try these steps...</h3>';html+='<ol><li>Verify that you are running Adobe(r) Flash(r) 9.0.115 or above.&nbsp; You can get the latest Flash player here: ';html+='<a href="http://get.adobe.com/flashplayer" style="color:#000088">get.adobe.com/flashplayer</a><br>&nbsp;<br></li>';html+='<li>Check that your browser or plugin settings are not preventing Flash from running.&nbsp;  Some javascript and ad blockers interfere with Flash.<br>&nbsp;<br></li>';html+='<li>Make sure your previous Flash version is fully uninstalled.&nbsp; Sometimes your browser will try to use an older version, even after you'+"'"+'ve installed an upgrade.</li></ol>';html+='</div></div>';return html;},_configure:function($this,$element)
{var options=this.options;$this._log("configuring player");this._log(options);if($.isFunction($this.options.viewPersister))
{window[$this.options.viewCallbackName]=function()
{$this.options.viewPersister(function(data)
{if(data.success)
{$this._log("firing viewed event for video "+$this.options.videoId);$this._log($this.options);$element.trigger("viewed",[data.count]);}
else $this._log(data.error);});}}
if($this.options.promptForPassword)
{window.testUserResponse=function(videoId,password)
{var playerId=window[$this.widgetBaseClass+"-players"][videoId];if($.isFunction($this.options.privateUrlRetriever))
$this.options.privateUrlRetriever(videoId,password,function(data)
{url=data.success?data.url:'';$element.trigger("passwordVerified",[playerId,url]);});}}},_unconfigure:function($this,$element)
{if($.isFunction($this.options.viewPersister))window[$this.options.viewCallbackName]=null;},reload:function(data)
{var prevars={};if($.isPopulated(data.title))prevars.theTitle=data.title;if($.isPopulated(data.url))prevars.theVid=data.url;if($.isPopulated(data.thumbnail))prevars.thePic=data.thumbnail;this.options.flashvars.theTitle=this.options.flashvars.theTitle.makeSafeForVideoPlayer();this.options.flashvars=$.extend(true,{},this.options.flashvars,prevars);var flashvars=$.convertToJson(this.options.flashvars);var retval=document.getElementById(this.options.playerId).playernewvideo(flashvars);if(retval==0)this._log('jsonString not formatted correctly or missing required values – video not changed\n'+flashvars);}}
$.widget("ui.flashPlayer",FlashPlayer);$.ui.flashPlayer.defaults={isRemote:false,remoteBasePath:"",videoId:1,playerWidth:640,playerHeight:381,viewPersister:null,promptForPassword:false,log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.html5Player))
{$.addStyleSheet("Styles/jquery.gd/gd.html5Player.css");}
var Html5Player={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass+" into #"+$this.element.attr("id"));$this.element.addClass($this.widgetBaseClass);$this.element.width($this.options.width);var timestamp=(new Date().getMilliseconds());if(!$.isPopulated($this.element.attr("id")))$this.element.attr("id")=$this.widgetBaseClass+timestamp;this._setUpWidget();},_setUpWidget:function()
{this.element.html(this._getInitHtml());this.element.width($("#"+this.element.attr("id")+"-vid").width());this._configure(this,this.element);},destroy:function()
{if(this.options.showControls)this._unconfigure(this,this.element);this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_getInitHtml:function()
{var html='<div id="'+this.element.attr("id")+'-vid" style="width:'+this.options.width+'px; height:'+this.options.height+'px; margin:0; padding:0;">';if(!this.options.promptForPassword)
{html+='<video poster="'+this.options.thumbnail+'" width="'+this.options.width+'" height="'+this.options.height+'" controls="controls" preload="preload" src="'+this.options.url+'">';html+='This browser does not support the HTML5 video tag.';html+='</video>';html+='<div class="'+this.widgetBaseClass+'-donemsg" style="width:'+this.options.width+'px; height:'+this.options.height+'px;display:none;"><div class="links"><a class="replay" href="#">replay</a><a class="gohome" href="'+this.options.remoteBasePath+'"></a></div></div>';}
else
{html+='<div class="'+this.widgetBaseClass+'-passwordPrompt" style="width:'+this.options.width+'px; height:'+this.options.height+'px;">';html+='<div class="fields">';html+='<div class="blurb" style="'+$.getCSS("gd.html5Player.css",".blurb")+'">This video is password protected</div>';html+='<div class="label" style="'+$.getCSS("gd.html5Player.css",".label")+'">Do you know this password?</div>';html+='<input type="password" class="'+this.widgetBaseClass+'-password" /><a href="#">Watch</a>';html+='</div></div>';}
html+='</div>';return html;},_configure:function($this,$element)
{$this.hasPlayed=false;var $video=$this.element.find("video");if($video.length>0)
{$this._configurePlayer($this,$element);}
else
{if($this.options.promptForPassword)
{$this._configurePasswordPrompt($this,$element);}}},_configurePlayer:function($this,$element)
{var $video=$this.element.find("video");var video=$video.get(0);$this._log("video tag loaded "+video.readyState+"\n"+$this.options.url);var videoError=function(e)
{var error=video.error.code==video.error.MEDIA_ERR_SRC_NOT_SUPPORTED?"Source not supported. Your browser cannot play this video.":video.error.code==video.error.MEDIA_ERR_ABORTED?"Video download aborted.":video.error.code==video.error.MEDIA_ERR_NETWORK?"Network error during download. Please try again later.":video.error.code==video.error.MEDIA_ERR_DECODE?"Unable to finish decoding. Video is not encoded properly.":"Unknown error";$this._log("Error loading video: "+error);};$video.bind("error",videoError);$video.find("source").bind("error",videoError);$video.bind("play",function(e)
{if(!$this.hasPlayed)
{$this.options.viewPersister(function(data)
{if(data.success)
{$element.trigger("viewed",[data.count]);$this.hasPlayed=true;}
else $this._log(data.error);});}});if($this.options.isRemote)
{var replay=$('.'+$this.widgetBaseClass+'-donemsg .replay');var gohome=$('.'+$this.widgetBaseClass+'-donemsg .gohome');var div=$('.'+$this.widgetBaseClass+'-donemsg');replay.bind("click",function(e)
{div.hide();video.play();return false;});$video.bind("ended",function(e)
{div.css({top:$video.offset().top,left:$video.offset().left});gohome.css({top:(div.height()/2)-(gohome.height()/2)+5,left:(div.width()/2)-((gohome.width()/2)+(replay.width()/2)+35)});replay.css({top:(div.height()/2)-((replay.height()/2))+5,left:(div.width()/2)-((replay.width()/2)-(gohome.width()/2)-30)});});}},_configurePasswordPrompt:function($this,$element)
{var divP=$('.'+this.widgetBaseClass+'-passwordPrompt',$element);var fields=$('.fields',divP);fields.css({top:(divP.height()/2)-(fields.height()/2),left:(divP.width()/2)-(fields.width()/2)});fields.find('a').bind("click",function(e)
{if($.isFunction($this.options.privateUrlRetriever))
{$this.options.privateUrlRetriever($this.options.videoId,$element.find('.'+$this.widgetBaseClass+'-password').val(),function(data)
{if(data.success)
{var url=data.url;$this.options.url=url;$this.options.promptForPassword=false;$this._setUpWidget();$element.trigger("passwordVerified",[$element.attr("id"),url]);}
else
{$element.find("."+$this.widgetBaseClass+"-passwordPrompt .label").text("Invalid password. Please try again.");}});}});},_unconfigure:function($this,$element)
{if($.isFunction($this.options.viewPersister))window[$this.options.viewCallbackName]=null;},reload:function(data)
{this.options.flashvars=$.extend(true,{},this.options.flashvars,data.flashvars);this.options.flashvars.theTitle=this.options.flashvars.theTitle.makeSafeForVideoPlayer();var flashvars=$.convertToJson(this.options.flashvars);var retval=document.getElementById(this.playerId).playernewvideo(flashvars);if(retval==0)this._log('jsonString not formatted correctly or missing required values – video not changed\n'+flashvars);}}
$.widget("ui.html5Player",Html5Player);$.ui.html5Player.defaults={isRemote:false,remoteBasePath:"",videoId:1,playerWidth:640,playerHeight:381,viewPersister:null,promptForPassword:false,log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.flagAbuse))
$.addStyleSheet("Styles/jquery.gd/gd.flagAbuse.css");var FlagAbuse={isClosed:false,_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.element.html($this._getInitHtml());if($this.options.displayAs=="flyout")
{$this.element.css("zIndex","3000");$this.element.flyout({anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY,backgroundInfo:$this.options.backgroundInfo});}
$this._configureEvents($this,$this.element);},destroy:function()
{this._unconfigureEvents(this,this.element);this.element.flyout("destroy");this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configureEvents:function($this,$element)
{var options=this.options;$this.element.find("."+$this.widgetBaseClass+"-button-ok").bind("click."+$this.widgetBaseClass,function(event)
{if($this._saveChoice())
{$this.close(true);}
return false;});$this.element.find("."+$this.widgetBaseClass+"-button-cancel").bind("click."+$this.widgetBaseClass,function(event)
{$this.close();return false;});},_unconfigureEvents:function($this,$element)
{$this.element.find("."+$this.widgetBaseClass+"-button-ok").unbind("click."+$this.widgetBaseClass);$this.element.find("."+$this.widgetBaseClass+"-button-cancel").unbind("click."+$this.widgetBaseClass);},_getInitHtml:function()
{var html='<div class="'+this.widgetBaseClass+'-main">';html+='<h1>Flag this video for review:</h1>';html+='<div class="'+this.widgetBaseClass+'-blurb">If you want us to look at this video, tell us why and we\'ll check it out.</div>';html+='<ul class="'+this.widgetBaseClass+'-flaglist">';for(var i=0;i<this.options.abuseTypes.length;i++)
{if(!this.options.isRemote||(this.options.isRemote&&!this.options.abuseTypes[i].hideIfRemote))
html+='<li><input type="radio" name="abuseType" class="'+this.widgetBaseClass+'-abuseType" value="'+this.options.abuseTypes[i].value+'" id="abt-'+this.options.abuseTypes[i].value+'" /> <label for="abt-'+this.options.abuseTypes[i].value+'">'+this.options.abuseTypes[i].displayName+'</label></li>';}
html+='</ul>';html+='<div class="'+this.widgetBaseClass+'-error"></div>';html+='<div class="'+this.widgetBaseClass+'-actions"><a href="#" class="'+this.widgetBaseClass+'-button-ok"></a><a href="#" class="'+this.widgetBaseClass+'-button-cancel"></a></div>';html+='</div>';return html;},open:function()
{if(this.options.displayAs=="flyout")this.element.flyout("open");},close:function(okButtonClicked)
{if(this.options.displayAs=="flyout")this.element.flyout("close");else if($.isFunction(this.options.closeCallback))this.options.closeCallback(okButtonClicked);},isClosed:function()
{return this.options.displayAs=="flyout"?this.element.flyout("isClosed"):false;},_saveChoice:function()
{if($.isFunction(this.options.dataPersister))
{var code=this.element.find("input[@name='abuseType']:checked").val();if(!$.isPopulated(code))
{$('.'+this.widgetBaseClass+'-error').show().html("Please select an abuse type.");return false;}
this.options.dataPersister(code);return true;}}}
$.widget("ui.flagAbuse",FlagAbuse);$.ui.flagAbuse.getter="isClosed";$.ui.flagAbuse.defaults={abuseTypes:[{value:"copyright",displayName:"Copyright Infringement"},{value:"obscenity",displayName:"Obscene Content"},{value:"explicit",displayName:"Sexually Explicit"},{value:"other",displayName:"Other"}],offsetX:-7,offsetY:-7,positionY:"top",positionX:"right",displayAs:"flyout",isRemote:false,backgroundInfo:{sizes:30,backgroundClass:'ui-flagAbuse-background'},log:true}})(jQuery);(function($){var LikeIt={_init:function(){var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.options.counterCreated=false;if(!$.isPopulated($this.options.counter)){$this.options.counter=$("<div/>").appendTo($this.element.parent());$this.options.counterCreated=true;}
var likeCookie=$.cookie("like");var likeVideoIdArray=$.isPopulated(likeCookie)?likeCookie.split(','):[];var index=$.inArray($this.options.videoId.toString(),likeVideoIdArray);if(index<0){$this.options.alreadyVoted=false;}
else{$this.options.alreadyVoted=true;}
$this.options.counter.addClass($this.widgetBaseClass+"-counter");$this._setCounter($this,true);$this._configureEvents($this,$this.element);},destroy:function(){if(this.options.counterCreated)this.options.counter.empty().remove();this.element.removeClass(this.widgetBaseClass);this._unconfigureEvents(this,this.element);$.widget.prototype.destroy.call(this);},_log:function(msg){if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log){console.log(msg);}},_configureEvents:function($this,$element){var options=$this.options;$element.bind("click."+$this.widgetBaseClass,function(event){$this._changeVote($this);return false;});},_unconfigureEvents:function($this,$element){$element.unbind("click."+this.widgetBaseClass);},_setCounter:function($this,fromInit){$this.options.counter.html($this.options.count.toString().commafyNumber());var content=$.isPopulated($this.options.contentXPath)?$($this.options.contentXPath):$this.element;content.html($this.options.alreadyVoted?$this.options.votedHtml:$this.options.notVotedHtml);if(fromInit==undefined||fromInit==null||fromInit==false){var likeCookie=$.cookie("like");var likeVideoIdArray=$.isPopulated(likeCookie)?likeCookie.split(','):[];var likeIndex=$.inArray($this.options.videoId.toString(),likeVideoIdArray);if($this.options.alreadyVoted){if(likeIndex<0){if(likeVideoIdArray.length>0)
likeCookie+=",";likeCookie+=$this.options.videoId;}}
else{if(likeIndex>=0){likeVideoIdArray=$.grep(likeVideoIdArray,function(name){return name!=$this.options.videoId.toString();});likeCookie=likeVideoIdArray.join(",");}}
$.cookie("like",likeCookie,{expires:365});}},_changeVote:function($this){$this.options.alreadyVoted=!$this.options.alreadyVoted;if($.isFunction($this.options.dataPersister)){$this.options.dataPersister($this.options.alreadyVoted,function(data){if(data.success){$this.options.count=data.count;$this._setCounter($this);}
else{$this._log(data.error);}});}
else{$this.options.count+=($this.options.alreadyVoted)?1:0;$this._setCounter($this);}}}
$.widget("ui.likeIt",LikeIt);$.ui.likeIt.defaults={counter:null,count:0,alreadyVoted:false,votedHtml:"Unlike",notVotedHtml:"Like",loggedIn:false,log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.editVideo))
$.addStyleSheet("Styles/jquery.gd/gd.editVideo.css");var EditVideo={buttonDefaults:{list:['save','cancel'],save:{displayName:'Save',click:function($this,event)
{$this._saveData($this);return false;}},cancel:{displayName:'Cancel',click:function($this,event)
{$this.close();return false;}}},dialogDefaults:{closeOnEscape:false,bgiframe:true,resizable:false,zIndex:3000,position:['50%','50%'],modal:true},_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);var buttons=this.options.buttons;this.options.buttons=$.extend(true,this.buttonDefaults,this.options.buttons);if($.isPopulated(buttons))this.options.buttons.list=buttons.list;if($this.options.displayAs=="modal")
{var dialogOptions=this.options.dialogOptions;this.options.dialogOptions=$.extend(true,this.dialogDefaults,this.options.dialogOptions);if($.isPopulated(dialogOptions))this.options.dialogOptions=dialogOptions;}
$this.element.addClass($this.widgetBaseClass);$this.options.displayAs=$this.options.displayAs.toLowerCase();$this.element.addClass($this.widgetBaseClass+'-'+$this.options.displayAs);$this.options.isClosed=false;if($.isFunction($this.options.preOpen))$this.options.preOpen($this);$this._getInitHtml(function(html)
{$this.element.html(html);switch($this.options.displayAs)
{case"flyout":$this.element.flyout({anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY,backgroundInfo:$this.options.backgroundInfo});break;case"modal":if(!$.isPopulated($this.options.dialogOptions.width))$this.options.dialogOptions.width=$this.element.width();if($.isPopulated($this.options.dialogOptions.close))
{$this.options.close=$this.options.dialogOptions.close;$this.options.dialogOptions.close=null;}
if($.isPopulated($this.options.dialogOptions.open))
{$this.options.open=$this.options.dialogOptions.open;$this.options.dialogOptions.open=null;}
$this.options.dialogOptions.open=function(){$this.element.corners($this.options.backgroundInfo);};$this.element.dialog($this.options.dialogOptions);var dialog=$this.element.parents(".ui-dialog");$(".ui-dialog-titlebar",dialog).hide();dialog.css({overflow:"visible",padding:0,width:$this.options.dialogOptions.width,"font-family":"Arial, verdana, Helvetica, sans-serif","font-size":"12px"});$(".ui-dialog-content",dialog).css({border:"0",padding:"0",overflow:"visible"});$(".ui-widget-content",dialog).css({border:"0",backgroundImage:""});break;}
$this._configureEvents($this,$this.element);if($.isFunction($this.options.open))$this.options.open($this);});},destroy:function()
{this._unconfigureEvents(this,this.element);switch(this.options.displayAs)
{case"flyout":this.element.flyout("destroy");break;case"modal":this.element.dialog("destroy");break;}
this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configureEvents:function($this,$element)
{$this.element.find('.'+this.widgetBaseClass+'-edit-description').makeSafeish().charCounter({counter:$element.find('.'+$this.widgetBaseClass+'-counter-description'),charLimit:$this.options.descriptionCharLimit});$this.element.find('.'+this.widgetBaseClass+'-edit-title').makeSafeish().charCounter({counter:$element.find('.'+$this.widgetBaseClass+'-counter-title'),charLimit:$this.options.titleCharLimit});$this.element.find('.'+this.widgetBaseClass+'-edit-tags').makeSafeish().autocomplete("getTagsAutocomplete.aspx",{minChars:1,multiple:true,matchContains:true,autoFill:true});$this.element.find('.'+this.widgetBaseClass+'-edit-password').makeSafeish({filters:{list:['html','charLimit']},filterCharLimit:50}).charCounter({counter:$element.find('.'+$this.widgetBaseClass+'-counter-password'),charLimit:$this.options.passwordCharLimit});$this.element.find('.'+$this.widgetBaseClass+'-edit-privacy').bind("click change",function()
{if($(this).val()==2)
{$this.element.find('.'+$this.widgetBaseClass+'-edit-password-container').css("display","");}
else
{$this.element.find('.'+$this.widgetBaseClass+'-edit-password-container').css("display","none");}});for(var i=0;i<$this.options.buttons.list.length;i++)
{var buttonName=$this.options.buttons.list[i];$this.element.find("."+$this.widgetBaseClass+"-button-"+buttonName).bind("click."+$this.widgetBaseClass,{buttonName:buttonName},function(event)
{$this.options.buttons[event.data.buttonName].click($this,event);return false;});}
if($this.options.showCategories)
{var options={dataPersister:$this.options.categoriesDataPersister,displayAs:"embed",showControls:false};if($.isPopulated($this.options.categoriesData))options.categoriesData=$this.options.categoriesData;if($.isPopulated($this.options.allCategories))
{options.allCategories=$this.options.allCategories;}else
{options.dataRetriever=$this.options.categoriesDataRetriever;}
$this.element.find('.'+$this.widgetBaseClass+'-categories').editCategories(options);}
$this.element.find('.'+$this.widgetBaseClass+'-fields input, .'+$this.widgetBaseClass+'-fields textarea, , .'+$this.widgetBaseClass+'-fields select').each(function()
{var options={};if($this.options.displayAs!="embed")
{options={newWidth:350};if(this.tagName.toLowerCase()=='textarea')options.newHeight=100;}
$(this).fancyText(options);});},_unconfigureEvents:function($this,$element)
{for(var i=0;i<$this.options.buttons.list.length;i++)
{$this.element.find("."+$this.widgetBaseClass+"-button-"+$this.options.buttons.list[i]).unbind("click."+$this.widgetBaseClass);}
if(this.element.displayAs=="flyout")this.element.flyout("destroy");$this.element.find('.'+this.widgetBaseClass+'-edit-title').makeSafeish("destroy");$this.element.find('.'+this.widgetBaseClass+'-edit-title').charCounter("destroy");$this.element.find('.'+this.widgetBaseClass+'-edit-description').makeSafeish("destroy");$this.element.find('.'+this.widgetBaseClass+'-edit-description').charCounter("destroy");$this.element.find('.'+this.widgetBaseClass+'-edit-tags').makeSafeish("destroy");this.element.removeClass(this.widgetBaseClass);this.element.removeClass(this.widgetBaseClass+'-'+this.options.displayAs);},_getInitHtml:function(finish)
{var $this=this;var buildHtml=function(data)
{if($.isPopulated(data))
{$this.options.title=($.isPopulated(data.Title))?data.Title:'';$this.options.description=($.isPopulated(data.Description))?data.Description:'';$this.options.tags=($.isPopulated(data.Tags))?data.Tags:'';$this.options.fileName=($.isPopulated(data.FileName))?data.FileName:'';$this.options.password=($.isPopulated(data.Password))?data.Password:'';$this.options.videoType=data.VideoType;}
var html='';if($this.options.displayAs=="flyout"||$this.options.displayAs=="modal")html+='<h1 class="'+$this.widgetBaseClass+'-titlebar">Video Properties</h1>';if($this.options.showCategories)html+='<table><tr><td>';html+='<div class="'+$this.widgetBaseClass+'-main">';html+='<div class="'+$this.widgetBaseClass+'-header">Tell Us About Your Video</div>';if($.isPopulated($this.options.fileName))
{html+='<div class="'+$this.widgetBaseClass+'-label-filename">Original file name:</div>'+'<div class="'+$this.widgetBaseClass+'-data-filename" title="'+$this.options.fileName+'">'+$this.options.fileName+'</div>';}
if($.isPopulated($this.options.password))
{html+='<div class="'+$this.widgetBaseClass+'-password-notice">This video is password protected. Only people with whom you share your password will be able to see it.</div>';}
if($this.options.displayAs=="embed")
{html+='<div class="'+$this.widgetBaseClass+'-requiredNotice '+$this.widgetBaseClass+'-red" >* Required</div>';}
html+='<div class="'+$this.widgetBaseClass+'-fields">'+'<div class="'+$this.widgetBaseClass+'-label-title">'+'<span style="float:left;">'+$this.options.titleLabel+'</span>'+'<span class="'+$this.widgetBaseClass+'-counter-title">'+
$this.options.titleCharLimit+'</span>'+'</div>'+'<div><input class="'+$this.widgetBaseClass+'-edit-title" value="'+$this.options.title.escapeDoubleToHtml()+'" /></div>'+'<div class="'+$this.widgetBaseClass+'-label-description">'+'<span style="float:left;">'+$this.options.descriptionLabel+'</span>'+'<span class="'+$this.widgetBaseClass+'-counter-description">'+
$this.options.descriptionCharLimit+'</span>'+'</div>'+'<div><textarea class="'+$this.widgetBaseClass+'-edit-description" id="editVideoDescription" rows="4">'+$this.options.description.escapeDoubleToHtml()+'</textarea></div>'+'<div class="'+$this.widgetBaseClass+'-label-tags">'+$this.options.tagsLabel+'</div>'+'<div><input class="'+$this.widgetBaseClass+'-edit-tags" value="'+$this.options.tags.escapeDouble()+'" /></div>'+'<div class="'+$this.widgetBaseClass+'-blurb-tags">Separate by commas (,)</div>';var downgradedToFree=($this.options.accountType==0&&$this.options.videoType==2);if($this.options.showPrivacy&&($this.options.accountType>0||downgradedToFree))
{html+='<div class="'+$this.widgetBaseClass+'-privacy-container" >'+'<div class="'+$this.widgetBaseClass+'-label-privacy">Privacy Settings:</div>'+'<div>'+'<select class="'+$this.widgetBaseClass+'-edit-privacy" >'+'<option value="1"'+($this.options.videoType==1?' selected':'')+'>Display video to everyone</option>';if(!downgradedToFree)html+='<option value="2"'+($this.options.videoType==2&&$.isPopulated($this.options.password)?' selected':'')+'>Password-protect this video</option>';html+='<option value="3"'+($this.options.videoType==2&&!$.isPopulated($this.options.password)?' selected':'')+'>Make this video private</option>'+'</select>'+'</div><div class="'+$this.widgetBaseClass+'-edit-password-container"'+(!($this.options.videoType==2&&$.isPopulated($this.options.password))?' style="display:none"':'')+'>'+'<div class="'+$this.widgetBaseClass+'-label-privacy">'+'<span style="float:left;">Password:</span>'+'<span class="'+$this.widgetBaseClass+'-counter-password" ></span></div>'+'<input class="'+$this.widgetBaseClass+'-edit-password" value="'+$this.options.password+'" /></div>'+'</div>'+'</div>';}
html+='<div class="'+$this.widgetBaseClass+'-label-error"></div>';html+='</div>';if($this.options.showCategories)
{html+='</td>';html+='<td><div class="'+$this.widgetBaseClass+'-categories" /></td>';html+='</tr></table>';}
html+='<div class="'+$this.widgetBaseClass+'-actions">';for(var i=0;i<$this.options.buttons.list.length;i++)
{var buttonName=$this.options.buttons.list[i];var buttonDef=$this.options.buttons[buttonName];html+='<a href="#" class="'+$this.widgetBaseClass+'-button '+$this.widgetBaseClass+'-button-'+buttonName+'">'+buttonDef.displayName+'<a/>';}
html+='</div>';finish(html);}
if($.isFunction($this.options.dataRetriever))
{$this.options.dataRetriever(buildHtml);}
else
{buildHtml();}},open:function()
{var $this=this;if($.isFunction($this.options.preOpen))$this.options.preOpen($this);switch(this.options.displayAs)
{case"flyout":if($.isFunction($this.options.open))this.element.flyout("open",function(){$this.options.open($this);});else this.element.flyout("open");break;case"modal":this.element.dialog("open");if($.isFunction($this.options.open))this.options.open($this);break;}},close:function()
{var $this=this;if(this.options.displayAs=="modal")
{this.element.dialog("close");if($.isFunction($this.options.close))$this.options.close($this);}
else if(this.options.displayAs=="flyout")
{if($.isFunction($this.options.close))this.element.flyout("close",function(){$this.options.close($this);});else this.element.flyout("close");}
$this.element.find('.'+$this.widgetBaseClass+'-label-error').html('');},isClosed:function()
{if(this.options.displayAs=="modal")
return!this.element.dialog("isOpen");else if(this.options.displayAs=="flyout")
return this.element.flyout("isClosed");},_saveData:function()
{var $this=this;var finish=function(data,callback)
{if(data.success)
{if($this.options.showCategories)
{$this.element.find('.'+$this.widgetBaseClass+'-categories').editCategories("saveData");}
$this.options.tags=data.newData.Tags;$this.element.find('.'+$this.widgetBaseClass+'-edit-tags').val(data.newData.Tags);var privacy=$this.element.find('.'+$this.widgetBaseClass+'-privacy-container');if(privacy.length>0&&$this.options.accountType==0&&data.newData.VideoType!=2)
{$this.options.videoType==data.newData.VideoType;$this.options.showPrivacy==false;privacy.hide();}
if($.isFunction(callback))
{callback(data);if($this.options.displayAs!='embed')$this.close();}
else $this.close();}
else
{$this._log(data.error);$this.element.find('.'+$this.widgetBaseClass+'-label-error').html(data.error);}};if($.isFunction(this.options.dataPersister))
{var data={title:$.trim($this.element.find('.'+$this.widgetBaseClass+'-edit-title').makeSafeish('getSafeText')).substring(0,$this.options.titleCharLimit),description:$.trim($this.element.find('.'+$this.widgetBaseClass+'-edit-description').makeSafeish('getSafeText').substring(0,$this.options.descriptionCharLimit)),tags:$.trim($this.element.find('.'+$this.widgetBaseClass+'-edit-tags').makeSafeish('getSafeText')),password:$.isPopulated($this.options.password)?$this.options.password:null,videoType:$.isPopulated($this.options.videoType)?$this.options.videoType:1}
if($this.options.showPrivacy)
{privacy=$this.element.find('.'+$this.widgetBaseClass+'-edit-privacy').val();privacy=$.isPopulated(privacy)?privacy:1;data.videoType=privacy==1?1:2;data.password=privacy==2?$.trim($this.element.find('.'+$this.widgetBaseClass+'-edit-password').val()):null;if((!$.isPopulated(data.password)||data.password.length==0)&&privacy==2)
{finish({success:false,error:'Please enter the Password'});return;}}
data.title=(data.title.length==0)?$this.options.title:data.title;if(data.title.length==0)
{finish({success:false,error:'Please enter the Title'});return;}
this.options.dataPersister(data,finish);}}}
$.widget("ui.editVideo",EditVideo);$.ui.editVideo.getter="isClosed";$.ui.editVideo.defaults={titleCharLimit:34,descriptionCharLimit:400,passwordCharLimit:50,displayAs:"flyout",showCategories:false,fileName:"",title:"",description:"",tags:"",offsetX:-7,offsetY:-7,positionX:"right",positionY:"top",titleLabel:"Video name:",descriptionLabel:"Video description:",tagsLabel:"Tags:",showPrivacy:true,accountType:0,backgroundInfo:{sizes:30,backgroundClass:'ui-editVideo-background'},log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.editChannel))
$.addStyleSheet("Styles/jquery.gd/gd.editCategories.css");var EditCategories={buttonDefaults:{list:['save','cancel'],save:{displayName:'Save',click:function($this,event)
{if(!$(this).hasClass("disabled"))
{$this.saveData($this);$this.close();}
return false;}},cancel:{displayName:'Cancel',click:function($this,event)
{if(!$(this).hasClass("disabled"))
{$this.close();return false;}}}},_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);if($this.options.showControls)
{var buttons=this.options.buttons;this.options.buttons=$.extend(true,this.buttonDefaults,this.options.buttons);if($.isPopulated(buttons))this.options.buttons.list=buttons.list;}
$this.element.addClass($this.widgetBaseClass).addClass($this.widgetBaseClass+'-'+$this.options.displayAs);$this.options.isClosed=false;if($.isFunction($this.options.preOpen))$this.options.preOpen($this);$this._getInitHtml(function(html)
{$this.element.html(html);if($.isFunction($this.options.postBuildCallback))$this.options.postBuildCallback();if($this.options.displayAs=="flyout")$this._positionElement();$this._configureEvents($this,$this.element);if($.isFunction($this.options.open))$this.options.open($this);});},destroy:function()
{this._unconfigureEvents(this,this.element);this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configureEvents:function($this,$element)
{if($.isPopulated($this.options.anchor)&&$this.options.displayAs=="flyout")
{$this.element.corners($this.options.backgroundInfo);}
if($this.options.showControls)
{for(var i=0;i<$this.options.buttons.list.length;i++)
{var buttonName=$this.options.buttons.list[i];$this.element.find("."+$this.widgetBaseClass+"-button-"+buttonName).bind("click."+$this.widgetBaseClass,{buttonName:buttonName},function(event)
{$this.options.buttons[event.data.buttonName].click($this,event);});}}
$('.'+$this.widgetBaseClass+'-category').bind("click."+$this.widgetBaseClass,function()
{if($(this).not(":checked"))
{if($this.element.find('input.'+$this.widgetBaseClass+'-category:checked').length<=3)
{return true;}
else
{return false;}}
else return true;});$('li:has(input.'+$this.widgetBaseClass+'-category)').each(function()
{var li=$(this);var description=li.find("span").html();var title=li.find("label").text();li.hoverIntent({action:function(element)
{var div=$('<div style="position:absolute; width: 200px; line-height: 16px; z-index: 5000; display: block; border: 1px solid #ddd; background: white; padding: 10px;"><strong>'+title+':</strong><br/>'+description+'</div>').appendTo(document.body);var positionInfo=$.getPosition({element:div,anchor:li,positionX:"flush",positionY:"bottom",offsetX:15,offsetY:0});div.css({top:positionInfo.y.position,left:positionInfo.x.position});div.fadeIn("500");element.data("temp",div);},elapsed:function(element)
{var div=element.data("temp");div.fadeOut("500",function()
{div.remove();element.removeData("temp");});},delay:1,duration:5});});},_unconfigureEvents:function($this,$element)
{if($this.options.showControls)
{for(var i=0;i<$this.options.buttons.list.length;i++)
{$this.element.find("."+$this.widgetBaseClass+"-button-"+$this.options.buttons.list[i]).unbind("click."+$this.widgetBaseClass);}}},_positionElement:function()
{var $this=this;if($.isPopulated($this.options.anchor))
{$this.element.css("position","absolute");var positionInfo=$.getPosition({element:$this.element,anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY});if(positionInfo.x.adjustedPosition!=null)$this.options.positionX=positionInfo.x.adjustedPosition;if(positionInfo.y.adjustedPosition!=null)$this.options.positionY=positionInfo.y.adjustedPosition;$this.element.css({top:positionInfo.y.position,left:positionInfo.x.position});}
this.options.minWidth=this.element.width();},_getInitHtml:function(finish)
{var $this=this;var buildHtml=function(allCategories,categoriesData)
{if($.isPopulated(allCategories)&&$.isPopulated(categoriesData))
{$this.options.categories=[];for(var i=0;i<allCategories.length;i++)
{$this.options.categories.push({value:allCategories[i].CategoryId,displayName:allCategories[i].CategoryName,description:allCategories[i].CategoryDescription,selected:($.inArray(allCategories[i].CategoryId.toString(),categoriesData)>-1)});}}
var html='<div class="'+$this.widgetBaseClass+'-header">Organize Your Video</div>';html+='<div class="'+$this.widgetBaseClass+'-instructions"><strong>Optional - Choose categories for your video to appear:</strong><br/>Select up to three (3).</div>';html+='<div class="'+$this.widgetBaseClass+'-main"><table><tr>';var fullColumn=true;var temp='';for(var i=0;i<$this.options.categories.length;i++)
{if(fullColumn)temp+='<td><ul>';fullColumn=false;temp+='<li><input type="checkbox"'+($this.options.categories[i].selected?' checked':'')+' class="'+$this.widgetBaseClass+'-category" value="'+$this.options.categories[i].value+'" id="cat-'+$this.options.categories[i].value+'" /> <label for="cat-'+$this.options.categories[i].value+'">'+$this.options.categories[i].displayName+'</label><span style="display:none">'+$this.options.categories[i].description+'</span></li>';if((i+1)%$this.options.columnSize==0)
{fullColumn=true;temp+='</ul></td>';}}
if(!fullColumn)
{temp+='</ul></td>';}
html+=temp+"</tr></table>";html+='</div>';if($this.options.showControls)
{html+='<div class="'+$this.widgetBaseClass+'-actions">';for(var i=0;i<$this.options.buttons.list.length;i++)
{var buttonName=$this.options.buttons.list[i];var buttonDef=$this.options.buttons[buttonName];html+='<a href="#" class="'+$this.widgetBaseClass+'-button '+$this.widgetBaseClass+'-button-'+buttonName+(buttonDef.disable?' disabled':'')+'"'+(buttonDef.hide?' style="display: none"':'')+'>'+buttonDef.displayName+'<a/>';}
html+='</div>';}
finish(html);}
if($.isFunction($this.options.dataRetriever))
{$this.options.dataRetriever(buildHtml);}
else if($.isPopulated(this.options.allCategories)&&$.isPopulated(this.options.categoriesData))
{buildHtml(this.options.allCategories,this.options.categoriesData);}
else
{buildHtml();}},open:function()
{var $this=this;if($.isFunction($this.options.preOpen))$this.options.preOpen($this);this.element.fadeIn("slow",function()
{if($.isFunction($this.options.open))$this.options.open($this);});this.options.isClosed=false;},close:function()
{if($.isPopulated(this.element.data("dialog")))
{this.element.dialog("close");this.element.dialog("destroy");this.destroy();}
else
{this.element.fadeOut(300);}
if($.isFunction(this.options.close))this.options.close(this);this.options.isClosed=true;},isClosed:function()
{return this.options.isClosed;},saveData:function()
{var $this=this;var finish=function(data,callback)
{if(data.success)
{if($.isFunction(callback))callback(data);else $this.close();}
else
{$this._log(data.error);$this.element.find('.'+$this.widgetBaseClass+'-label-error').html(data.error);}};if($.isFunction(this.options.dataPersister))
{var categories=[];$this.element.find('.'+$this.widgetBaseClass+'-category:checked').each(function(){categories.push($(this).val());});var data={categories:categories};this.options.dataPersister(data,finish);}}}
$.widget("ui.editCategories",EditCategories);$.ui.editCategories.getter="isClosed";$.ui.editCategories.defaults={displayAs:"flyout",showControls:true,categories:[],columnSize:7,offsetX:3,offsetY:0,positionX:"right",positionY:"",backgroundInfo:{sizes:30,backgroundClass:'ui-editCategories-background'},log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.fancyText))
$.addStyleSheet("Styles/jquery.gd/gd.fancyText.css");var fancyText={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);var cWidth=$this.element.css("width");var width=($.isPopulated($this.options.newWidth))?$this.options.newWidth:$.isPopulated(cWidth)&&cWidth!="auto"&&cWidth.substr(cWidth.length-2,1)!="%"?cWidth.stripCssUnit():$this.element.width();if(!$.isAppleDevice())
{var elementType=$this.element.attr("tagName").toLowerCase();var baseClass=$this.widgetBaseClass+elementType;$this.element.addClass(baseClass);$this._log("fancyText for "+elementType);var cHeight=$this.element.css("height");var height=($.isPopulated($this.options.newHeight))?$this.options.newHeight:$.isPopulated(cHeight)&&cHeight!="auto"&&cHeight.substr(cHeight.length-2,1)!="%"?cHeight.stripCssUnit():$this.element.height();var bWidth=$this.options.borderWidth;var bHeight=$this.options.borderHeight;var dblWidth=(bWidth*2);var dblHeight=(bHeight*2);var adjustedWidth=width-dblWidth;var sidesHeight=$this.options.sidesHeight;var css;var wrapper='<div class="'+baseClass+'-main" style="width: '+adjustedWidth+'px;[[height]]"></div>';var wrapperHeight='';switch(elementType)
{case"textarea":sidesHeight=height-dblHeight;css={width:adjustedWidth+"px",height:sidesHeight+"px"};wrapperHeight=' height:'+(height-2)+'px;';break;case"select":case"input":css={width:(adjustedWidth-4)+"px"};break;}
wrapper=wrapper.replace("[[height]]",wrapperHeight);$this.element.css(css).wrap(wrapper);var innerDiv=$this.element.parent();innerDiv.wrap('<div class="'+baseClass+'-wrapper"></div>').before('<div class="'+baseClass+'-topbar">'+'<div class="'+baseClass+'-topleft" style="width: '+bWidth+'px; height: '+bHeight+'px;"></div>'+'<div class="'+baseClass+'-leftbar" style="width: '+bWidth+'px; height: '+sidesHeight+'px;"></div>'+'<div class="'+baseClass+'-bottomleft" style="width: '+bWidth+'px; height: '+bHeight+'px;"></div>'+'</div>');innerDiv.after('<div style="float:left; height:'+(dblHeight+sidesHeight)+'px; width: '+bWidth+'px;">'+'<div class="'+baseClass+'-topright" style="width: '+bWidth+'px; height: '+bHeight+'px;"></div>'+'<div class="'+baseClass+'-rightbar" style="width: '+bWidth+'px; height: '+sidesHeight+'px;"></div>'+'<div class="'+baseClass+'-bottomright" style="width: '+bWidth+'px; height: '+bHeight+'px;"></div>'+'</div>'+'<div style="clear:both;"></div>');if(($.browser.msie||$.browser.safari)&&elementType=="select")
{$this._fixForNaughtyBrowsers($this,baseClass,bHeight);}
else
{$this.element.css("border","0");}}
else
{$this.element.css({border:"1px solid #666",padding:'9px',width:width});}},_fixForNaughtyBrowsers:function($this,baseClass,bHeight)
{var innerDiv=$this.element.parent();var winVersion=4;var isWindows=navigator.userAgent.indexOf("Windows")>-1;var start=navigator.userAgent.indexOf("Windows NT");if(start>-1)
{var end=navigator.userAgent.indexOf(";",start);var winVersion=parseInt(navigator.userAgent.substring(start+10,end-1));}
var oldWindows=isWindows&&(winVersion<6);if($.browser.safari&&oldWindows)$this.element.css("border-style","solid");else $this.element.css("border","0");if($.browser.msie||($.browser.safari&&oldWindows))
{if($.browser.msie)
{$('<div class="'+baseClass+'-ieFix"></div>').appendTo(innerDiv).css({height:$this.element.height()-($.browser.safari?0:5),width:$this.element.width()-($.browser.safari?0:5),position:'absolute',top:$this.element.position().top+bHeight+1,left:$this.element.position().left});var ieFix2Css=oldWindows?{height:$this.element.height()-7,width:13,top:$this.element.position().top+2+bHeight,left:($this.element.position().left+$this.element.width())-19}:{height:$this.element.height()-3,width:13,top:$this.element.position().top+bHeight+1,left:($this.element.position().left+$this.element.width())-17};$('<div class="'+baseClass+'-ieFixArrow"></div>').appendTo(innerDiv).css(ieFix2Css);}
else
{var safariCssH={height:0,width:$this.element.width(),border:"2px solid white",position:'absolute',top:$this.element.position().top+bHeight+1,left:$this.element.position().left};var safariCssV={height:$this.element.height(),width:0,border:"2px solid white",position:"absolute",top:$this.element.position().top+bHeight+1,left:$this.element.position().left};$('<div class="'+baseClass+'-safariFixT"></div>').appendTo(innerDiv).css(safariCssH);$('<div class="'+baseClass+'-safariFixL"></div>').appendTo(innerDiv).css(safariCssV);safariCssH.top=safariCssH.top+$this.element.height()+3;$('<div class="'+baseClass+'-safariFixB"></div>').appendTo(innerDiv).css(safariCssH);safariCssH={height:0,width:17,border:"2px solid white",position:"absolute",top:$this.element.position().top+bHeight+2,left:($this.element.position().left+$this.element.width())+4};safariCssV={height:19,width:0,border:"2px solid white",position:"absolute",top:$this.element.position().top+bHeight+2,left:($this.element.position().left+$this.element.width())+4};$('<div class="'+baseClass+'-safariFixArrowT"></div>').appendTo(innerDiv).css(safariCssH);$('<div class="'+baseClass+'-safariFixArrowL"></div>').appendTo(innerDiv).css(safariCssV);safariCssH.top=safariCssH.top+19;$('<div class="'+baseClass+'-safariFixArrowB"></div>').appendTo(innerDiv).css(safariCssH);safariCssV.left=safariCssV.left+17;$('<div class="'+baseClass+'-safariFixArrowR"></div>').appendTo(innerDiv).css(safariCssV);}}},destroy:function()
{this._log("destroying "+this.widgetBaseClass);this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}}}
$.widget("ui.fancyText",fancyText);$.ui.fancyText.defaults={borderWidth:6,borderHeight:6,sidesHeight:24,log:true}})(jQuery);(function($)
{var Flyout={flyoutIsClosed:true,_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.element.css("zIndex","3000");$this._positionElement();if($.isPopulated($this.options.backgroundInfo))$this.element.corners($this.options.backgroundInfo);},destroy:function()
{this.element.removeClass(this.widgetBaseClass);if($.isPopulated($this.options.backgroundInfo))this.element.corners("destroy");this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_positionElement:function()
{var $this=this;if($.isPopulated($this.options.anchor))
{$this.element.css("position","absolute");var positionInfo=$.getPosition({element:$this.element,anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY});if(positionInfo.x.adjustedPosition!=null)$this.options.positionX=positionInfo.x.adjustedPosition;if(positionInfo.y.adjustedPosition!=null)$this.options.positionY=positionInfo.y.adjustedPosition;$this.element.css({top:positionInfo.y.position,left:positionInfo.x.position});}
this.options.minWidth=this.element.width();},open:function(callback)
{this._positionElement();this.element.fadeIn("slow",callback);this.flyoutIsClosed=false;},close:function(callback)
{this.element.fadeOut("slow",callback);this.flyoutIsClosed=true;},isClosed:function()
{return this.flyoutIsClosed;}}
$.widget("ui.flyout",Flyout);$.ui.flyout.getter="isClosed";$.ui.flyout.defaults={offsetX:0,offsetY:0,positionY:"bottom",positionX:"right",backgroundInfo:{sizes:30,backgroundClass:'ui-flyout-background'},log:true}})(jQuery);(function($)
{var HoverIntent={actionTimeoutIndex:0,elapsedTimeoutIndex:0,actionTriggered:false,actionFired:false,elapsedTriggered:false,delay:0,duration:0,_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);if(!$.isFunction($this.options.action))
{$this.destroy();return;}
$this.delay=$this.options.delay*1000;$this.duration=$this.options.duration*1000;$this.element.bind("mouseenter",function()
{if($this.actionTriggered)clearTimeout($this.actionTimeoutIndex);$this.actionTimeoutIndex=setTimeout(function()
{$this.action();},$this.delay);$this.actionTriggered=true;});$this.element.bind("mouseleave",function()
{if($this.actionTriggered)
{window.clearTimeout($this.actionTimeoutIndex);$this.actionTriggered=false;}
if($this.elapsedTriggered)
{clearTimeout($this.elapsedTimeoutIndex);$this.elapsed();}});},destroy:function()
{this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},action:function()
{var $this=this;this.options.action(this.element);this.actionFired=true;this.elapsedTimeoutIndex=setTimeout(function()
{$this.elapsed();},$this.duration);this.elapsedTriggered=true;},elapsed:function()
{this.actionFired=false;this.options.elapsed(this.element);this.elapsedTriggered=false;},isInAction:function()
{return this.actionFired;}}
$.widget("ui.hoverIntent",HoverIntent);$.ui.hoverIntent.getter="isInAction";$.ui.hoverIntent.defaults={duration:5,delay:2,action:null,elapsed:null,log:true}})(jQuery);(function($)
{var MakeSafeish={filters:{list:['html'],html:function(text,options){return text.replace(/(<([^>]+)>)/ig,"");},charLimit:function(text,options,element)
{if(element.attr("maxlength")!=options.filterCharLimit)element.attr("maxlength",options.filterCharLimit);return text.substr(0,options.filterCharLimit);}},_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);var useFilters=$this.options.filters.list;$this.options.filters=$.extend(false,$this.filters,$this.options.filters);if($.isPopulated(useFilters))$this.options.filters.list=useFilters;var elementType=$this.element.attr("tagName").toLowerCase();if(!(elementType=="textarea"||elementType=="input"))
{$this._log("destroying "+$this.widgetBaseClass+": wrong element type - "+elementType);$this.destroy();return;}
$this.element.val($this.getSafeText());$this.element.caret();$this.element.bind("keyup",function()
{var text=$this.getSafeText();var current=$this.element.val();if(text!=current)
{var position;if(text.length>0)
{position={start:text.differenceIndexOf(current)};if(position.start<0)position="end";else position.end=position.start;}
$this.element.val(text);if(text.length>0)$this.element.caret("setPosition",position);}});},destroy:function()
{this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},getSafeText:function()
{var text=this.element.val();for(var i=0;i<this.options.filters.list.length;i++)
{text=this.options.filters[this.options.filters.list[i]](text,this.options,this.element);}
return text;}}
$.widget("ui.makeSafeish",MakeSafeish);$.ui.makeSafeish.getter="getSafeText";$.ui.makeSafeish.defaults={filters:{},log:true}})(jQuery);(function($)
{var Caret={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);var elementType=$this.element.attr("tagName").toLowerCase();if(!(elementType=="textarea"||elementType=="input"))
{$this._log("destroying "+$this.widgetBaseClass+": wrong element type - "+elementType);$this.destroy();return;}},destroy:function()
{this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},getPosition:function()
{var elem=this.element.get(0);var start=0,end=0;if(elem.selectionStart)
{start=elem.selectionStart;end=elem.selectionEnd;}
else if(document.selection)
{var val=this.element.get(0).value;var vlen=val.length;var range=document.selection.createRange().duplicate();range.moveEnd("character",vlen);start=(range.text==""?vlen:(vlen-range.text.length));range=document.selection.createRange().duplicate();range.moveStart("character",-vlen);end=range.text.length;}
this._log("found "+start+" : "+end);return{start:start,end:end};},setPosition:function(position)
{var val=this.element.val();var elem=this.element.get(0);var start=0,end=-1;var parseName=function(positionName)
{switch(positionName.toLowerCase())
{case"end":return val.length;break;case"start":default:return 0;break;}}
if(typeof position!="number")
{if($.isPopulated(position.start))
{start=(typeof position.start!="number")?parseName(postion.start):position.start;end=(typeof position.end!="number")?parseName(postion.end):position.end;}
else
{start=parseName(position);end=start;}}
else
{start=position;end=position;}
if(start<0)start=0;if(end>val.length)end=val.length;if(end<start)end=start;if(start>end)start=end;this._log("position start: "+start+" end: "+end);if(elem.selectionStart)
{elem.selectionStart=start;elem.selectionEnd=end;}
else if(document.selection)
{var range=elem.createTextRange();range.collapse(true);range.moveStart("character",start);range.moveEnd("character",end-start);range.select();}},setSelection:function(start,end)
{this.setPosition({start:start,end:end});},getSelection:function()
{var selection=this.getPosition();return(selection.end>0)?this.element.val().substr(selection.start,selection.end):'';}}
$.widget("ui.caret",Caret);$.ui.caret.getter="getPosition, getSelection";$.ui.caret.defaults={log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.captcha))
$.addStyleSheet("Styles/jquery.gd/gd.captcha.css");var Captcha={_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.element.html($this._getInitHtml());$this._configureEvents($this,$this.element);},destroy:function()
{if(this.options.counterCreated)this.options.counter.empty().remove();this.element.removeClass(this.widgetBaseClass);this._unconfigureEvents(this,this.element);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_getInitHtml:function()
{var html='<div class="'+this.widgetBaseClass+'-main">';html+='<div class="label">Security Code:</div>';html+='<div class="'+this.widgetBaseClass+'-image" style="background: transparent url('+this.options.imageSrc+'&nocache='+(new Date).getUTCMilliseconds()+') no-repeat; height: '+this.options.imageHeight+'px; width: '+this.options.imageWidth+'px; float:left;"></div>';html+='<span><input class="'+this.widgetBaseClass+'-response" type="text" /></span>';if(this.options.showReset)html+='<a href="#" class="'+this.widgetBaseClass+'-reset">reset</a>';if(!$.isPopulated(this.options.submitControl))html+='<a href="#" class="'+this.widgetBaseClass+'-submit">submit</a>';html+='</div>';return html;},_configureEvents:function($this,$element)
{if(!$.isPopulated($this.options.submitControl))
{$element.find('.'+$this.widgetBaseClass+'-submit').bind("click."+$this.widgetBaseClass,function(event)
{$this._confirm($this);return false;});}
if(this.options.showReset)
{$element.find('.'+$this.widgetBaseClass+'-reset').bind("click."+$this.widgetBaseClass,function(event)
{$this.reset($this);return false;});}},_unconfigureEvents:function($this,$element)
{if(!$.isPopulated($this.options.submitControl))
{$element.find('.'+$this.widgetBaseClass+'-submit').unbind("click."+this.widgetBaseClass);}},_confirm:function($this)
{if($.isPopulated($this.options.dataPersisterUrl))
{var response=$this.element.find("."+$this.widgetBaseClass+'-response').val();$.getJSON($this.options.dataPersisterUrl+($this.options.dataPersisterUrl.indexOf("?")>0?"&":"?")+'method=?&response='+response,function(data)
{if(data.success)$this.options.verified();else $this.options.notVerified();});}
else
{$this.options.notVerified();}},confirm:function()
{this._confirm(this);},reset:function()
{this.element.find('.'+this.widgetBaseClass+'-image').replaceWith('<div class="'+this.widgetBaseClass+'-image" style="background: transparent url('+this.options.imageSrc+'&nocache='+(new Date).getUTCMilliseconds()+') no-repeat; height: '+this.options.imageHeight+'px; width: '+this.options.imageWidth+'px; float: left;"></div>');this.element.find('.'+this.widgetBaseClass+'-response').val("");},text:function()
{return this.element.find("."+this.widgetBaseClass+'-response').val();},responseElement:function()
{return this.element.find("."+this.widgetBaseClass+'-response');},imageElement:function()
{return this.element.find("."+this.widgetBaseClass+'-image');}}
$.widget("ui.captcha",Captcha);$.ui.captcha.getter="text, responseElement, imageElement";$.ui.captcha.defaults={imageSrc:null,dataPersisterUrl:null,verified:function(){alert("Verified!");},notVerified:function(){alert("Unable to verify. Please try again");},submitControl:null,showReset:true,log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.comments))
$.addStyleSheet("Styles/jquery.gd/gd.comments.css");var Comments={loggedIn:false,commentCount:0,addedOnClientCount:0,needToLoad:false,savingComment:false,_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);if(!$.isPopulated($this.options.data))$this.options.data={};if(!$.isPopulated($this.options.data.comments))$this.options.data.comments=[];$this.needToLoad=false;$this.commentCount=$this.options.commentCount;if($.isPopulated($this.commentCount))
{if($this.commentsCount>0&&$this.commentsCount>$this.options.data.comments.length)
$this.needToLoad=true;}
else
{if($this.options.data.comments.length==0)$this.needToLoad=true;$this.commentCount=$this.options.data.comments.length;}
$this.loggedIn=($.isPopulated(this.options.userId)&&(this.options.userId>0));$this.addedOnClientCount=0;$this._getInitHtml($this.element,function(){$this._configure($this,$this.element);});},destroy:function()
{this._unconfigure(this,this.element);this.element.removeClass(this.widgetBaseClass);this.element.empty();this.options.data.comments=null;this.options.data=null;$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configure:function($this,$element)
{var options=this.options;var $this=this;$this._configureDynamic($this);$element.find("."+$this.widgetBaseClass+"-commententry").charCounter({counter:$element.find('.'+$this.widgetBaseClass+'-counter'),charLimit:$this.options.charLimit});$element.find("."+$this.widgetBaseClass+"-button-leavecomment").bind("click."+$this.widgetBaseClass,function()
{var button=$(this);if($this.loggedIn)
{$element.find("."+$this.widgetBaseClass+'-commentform').css({overflow:"hidden"}).slideDown("slow",function()
{$element.find("."+$this.widgetBaseClass+'-commententry').focus().select();$element.find("."+$this.widgetBaseClass+'-counter').fadeIn("slow");button.fadeOut("slow");});}
else if($.isAppleDevice())
{var target=encodeURIComponent("ViewVideo.aspx?vid="+$this.options.vid+"&openComments=1");window.location="Login.aspx?target="+target;}
else
{videoMe_LoginPopup.showLoginPopup(videoMe_LoginPopup.GOTO_COMMENTS);}
return false;});if($.getQueryStringVariable("openComments")=="1"&&$.getQueryStringVariable("cancel")!="1")
{$element.find("."+$this.widgetBaseClass+"-button-leavecomment").click();}
$element.find("."+$this.widgetBaseClass+"-button-postcomment").bind("click."+$this.widgetBaseClass,function()
{$this._saveComment($this);$this._closePosting($this);return false;});$element.find("."+$this.widgetBaseClass+'-commentform').bind("keydown."+$this.widgetBaseClass,function(event)
{var source=$(event.target);var cleanUp=function()
{event.returnValue=false;event.cancel=true;event.stopPropagation();event.preventDefault();};try
{if(event.which||event.keyCode)
{var keyPressed=event.keyCode;var caught=false;if((keyPressed==$.ui.keyCode.ENTER)||(keyPressed==$.ui.keyCode.TAB))
{if($this.savingComment!=true)
{$this.savingComment=true;$this._saveComment($this);$this._closePosting($this);caught=true;}}
if(keyPressed==$.ui.keyCode.ESCAPE)
{$this._closePosting($this);caught=true;}
if(caught)
{cleanUp();return false;}}}
catch(e){}
return true;});},_configureDynamic:function($this)
{$this.element.find("."+$this.widgetBaseClass+"-pagelinkclickable:isNotBound(commentChangePage)").data("commentChangePage",true).bind("click."+$this.widgetBaseClass,function()
{$this.changePage(parseInt($(this).text()));return false;});$this.element.find("."+$this.widgetBaseClass+"-pageprevlink:isNotBound(commentPagePrev)").data("commentPagePrev",true).bind("click."+$this.widgetBaseClass,function()
{if($this.options.pageIndex>1)
$this.changePage($this.options.pageIndex-1);return false;});$this.element.find("."+$this.widgetBaseClass+"-pagenextlink:isNotBound(commentPageNext)").data("commentPageNext",true).bind("click."+$this.widgetBaseClass,function()
{if($this.options.pageIndex<$this.options.pageCount)
$this.changePage($this.options.pageIndex+1);return false;});$this.element.find("."+$this.widgetBaseClass+"-button-deletecomment:isNotBound(commentDeleteButton)").data("commentDeleteButton",true).bind("click."+$this.widgetBaseClass,function(event)
{var widget=$this;var id=$(this).attr("id").replace(widget.widgetBaseClass+'-comment-','');widget._deleteComment(widget,id);return false;});},_unconfigure:function($this,$element)
{$element.find("."+$this.widgetBaseClass+"-commententry").charCounter("destroy");$element.find("."+$this.widgetBaseClass+"-pagelink").die("click."+$this.widgetBaseClass);$element.find("."+$this.widgetBaseClass+"-pageprevlink").die("click."+$this.widgetBaseClass);$element.find("."+$this.widgetBaseClass+"-pagenextlink").die("click."+$this.widgetBaseClass);$element.find("."+$this.widgetBaseClass+"-button-leavecomment").unbind("click."+$this.widgetBaseClass);$element.find("."+$this.widgetBaseClass+"-button-postcomment").unbind("click."+$this.widgetBaseClass);$element.find("."+$this.widgetBaseClass+'-commentform').unbind("keydown."+$this.widgetBaseClass);},_getInitHtml:function($element,configure)
{var $this=this;var buildHtml=function(commentHtml)
{var html='<div>'+'<div class="'+$this.widgetBaseClass+'-postingheader">'+'<h1>Comments:</h1>';if($this.options.mode=="normal")
{html+='<span class="'+$this.widgetBaseClass+'-button-leavecomment">leave comment</span>';if($this.loggedIn)
{html+='<span class="'+$this.widgetBaseClass+'-counter" style="display:none;">'+
$this.options.charLimit+'</span>';}}
html+='</div>';if($this.options.mode=="normal"&&$this.loggedIn)
{html+='<div class="'+$this.widgetBaseClass+'-commentform" style="display:none;">'+'<textarea class="'+$this.widgetBaseClass+'-commententry"></textarea>'+'<span class="'+$this.widgetBaseClass+'-button-postcomment">post comment</span>'+'</div>';}
html+='<div class="'+$this.widgetBaseClass+'-commentlistbox">'+
commentHtml+'</div>'+'<div class="'+$this.widgetBaseClass+'-footer"></div>';$element.html(html);$('.'+$this.widgetBaseClass+'-commententry').fancyText();if($this.options.mode=="normal")$('.'+$this.widgetBaseClass+'-button-leavecomment').show();if($.isFunction(configure))configure();}
this._getCommentListHtml(buildHtml);},_getCommentListHtml:function(finish)
{var html="";var getPageIndexes=function($this)
{var list=$this.options.data.comments;var start=($this.options.pageIndex-1)*$this.options.pageSize;var end=$this.options.pageSize+start;end=(end>$this.commentCount)?($this.commentCount):end;return{start:start,end:end};}
var $this=this;var buildHtml=function()
{var html="";var list=$this.options.data.comments;var pageIndexes=getPageIndexes($this);var pageNavHtml=$this._getPageNavHtml();html+='<div class="'+$this.widgetBaseClass+'-commentlistboxwrapper">';html+=pageNavHtml;if(list.length>0&&list.length>=pageIndexes.start)
{html+='<ul class="'+$this.widgetBaseClass+'-commentlist">';for(var i=pageIndexes.start;i<pageIndexes.end;i++)
{var item=list[i];html+='<li><div class="'+$this.widgetBaseClass+'-commentheader"><div class="'+$this.widgetBaseClass+'-commentheadertext">';html+='<span class="'+$this.widgetBaseClass+'-commentusername">'+item.UserName+'</span>';var date=item.DateCreated.convertToLocalTime();html+='<span class="'+$this.widgetBaseClass+'-commenttime" title="'+date.toLocaleString()+'">'+date.getElapsedFriendly()+'</span>';html+='</div>';if(item.UserProfileId==$this.options.userId||$this.options.videoOwnerUserId==$this.options.userId||$this.options.mode=="audit")
{html+='<a href="#" class="'+$this.widgetBaseClass+'-button-deletecomment" id="'+$this.widgetBaseClass+'-comment-'+item.CommentId+'">delete</a>';}
html+='</div>';html+='<div class="'+$this.widgetBaseClass+'-commenttext">'+item.CommentText+'</div>';html+='</li>';}
html+='</ul>';}
html+=pageNavHtml;html+='</div>';finish(html);}
if((this.commentCount==0&&this.needToLoad)||this.options.data.comments.length<getPageIndexes(this).end)
{this._getCommentData(this.options.pageIndex,buildHtml);}
else html=buildHtml();},_getPageNavHtml:function()
{var pageNavHtml="";pageCount=Math.floor(this.commentCount/this.options.pageSize);pageCount=(this.commentCount%this.options.pageSize)>0?pageCount+1:pageCount;this.options.pageCount=pageCount;if(this.commentCount>this.options.pageSize)
{pageNavHtml+='<div class="'+this.widgetBaseClass+'-pagenav">';pageNavHtml+='<div style="float: left; /*right*/">';pageNavHtml+='<div class="'+this.widgetBaseClass+'-pagelinkitem '+this.widgetBaseClass+'-pageprevlink'+((this.options.pageIndex>1)?"":"disabled")+'">prev</div>';for(var j=0;j<pageCount;j++)
{pageNavHtml+='<div class="'+this.widgetBaseClass+'-pagelinkitem '+this.widgetBaseClass+'-pagelinknumber '+this.widgetBaseClass+'-pagelink'+(j+1==this.options.pageIndex?"selected":"clickable")+'">'+(j+1)+'</div>';}
pageNavHtml+='<div class="'+this.widgetBaseClass+'-pagelinkitem '+this.widgetBaseClass+'-pagenextlink'+((this.options.pageIndex<pageCount)?"":"disabled")+'">next</div>';pageNavHtml+='<div style="clear:both;"></div>';pageNavHtml+='</div>';pageNavHtml+='<div style="clear:both;"></div>';pageNavHtml+='</div>';}
return pageNavHtml;},changePage:function(newIndex)
{var $this=this;this.options.pageIndex=newIndex;var commentBox=this.element.find("."+this.widgetBaseClass+"-commentlistbox");var commentWrapper=this.element.find("."+this.widgetBaseClass+"-commentlistboxwrapper");var loadHtml=function(html)
{var temp=$(html).appendTo(commentBox).css({position:"absolute",display:"none",width:commentBox.width()+"px"});$this._configureDynamic($this);var height=temp.height();commentBox.css({position:"relative",height:commentWrapper.height()});commentWrapper.animate({opacity:0},{duration:600,queue:false,complete:function()
{$(this).remove();}});commentBox.animate({height:height},{duration:1000,queue:false});temp.fadeIn(1000);}
$this._getCommentListHtml(loadHtml)},_closePosting:function($this)
{$this.element.find("."+$this.widgetBaseClass+'-commentform').slideUp("slow",function()
{$this.element.find("."+$this.widgetBaseClass+'-counter').fadeOut("slow");$this.element.find("."+$this.widgetBaseClass+'-button-leavecomment').fadeIn("slow");$this.element.find("."+$this.widgetBaseClass+'-commententry').val("").charCounter("reset");$this.savingComment=false;});},_saveComment:function($this)
{var commentField=$this.element.find("."+this.widgetBaseClass+"-commententry");var comment=commentField.val().substring(0,$this.options.charLimit);var updateClient=function(data)
{if(data.success)
{data.comment.AddedOnClient=true;$this.options.data.comments.splice(0,0,data.comment);$this.commentCount++;$this.addedOnClientCount++;$this.changePage(1);}
else
{alert("Unable to save comment.  Try again later.");}};if($.isFunction($this.options.dataPersister))
$this.options.dataPersister({action:"save",text:comment},updateClient);},_deleteComment:function($this,commentId)
{var updateClient=function(data)
{if(data.success)
{var thisComment=$.grep($this.options.data.comments,function(item,idx)
{return item.CommentId==data.commentId;});if(thisComment.length==1)
{$this.options.data.comments=$.grep($this.options.data.comments,function(item,idx)
{return item.CommentId!=data.commentId;});$this.commentCount--;if(thisComment[0].AddedOnClient)$this.addedOnClientCount--;$this.changePage(1);}}
else
{alert("Unable to remove comment.  Try again later.");}};if($.isFunction($this.options.dataPersister))
$this.options.dataPersister({action:"delete",commentId:commentId},updateClient);},_getCommentData:function(pageIndex,displayData)
{var $this=this;if($.isFunction(this.options.dataRetriever))
{var count=$this.options.pageSize;var insertPoint=($this.options.pageIndex-1)*$this.options.pageSize;insertPoint+=$this.addedOnClientCount;if(insertPoint>($this.options.data.comments.length+1))
{count+=(insertPoint-$this.options.data.comments.length);insertPoint=$this.options.data.comments.length;}
$this.options.dataRetriever(insertPoint,count,function(data)
{$this.commentCount=data.commentCount;if(data.comments.length>0)
{for(var i=0;i<data.comments.length;i++)
{$this.options.data.comments.splice(insertPoint+i,0,data.comments[i]);}}
displayData();});}}}
$.widget("ui.comments",Comments);$.ui.comments.defaults={data:{comments:[]},charLimit:400,pageSize:10,pageIndex:1,mode:"normal",vid:0,log:true};if(!(new Date()).getElapsedFriendly)
{Date.prototype.getElapsedFriendly=function()
{var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var seconds=function(elapsed)
{return Math.floor(elapsed/1000);};var minutes=function(elapsed)
{var val=seconds(elapsed);return{minutes:Math.floor(val/60),seconds:val%60};};var hours=function(elapsed)
{var val=minutes(elapsed);return{hours:Math.floor(val.minutes/60),minutes:val.minutes%60,seconds:val.seconds};};var days=function(elapsed)
{var val=hours(elapsed);return{days:Math.floor(val.hours/24),hours:val.hours%24,minutes:val.minutes,seconds:val.seconds};};var weeks=function(elapsed)
{var val=days(elapsed);return{weeks:Math.floor(val.days/7),days:val.days%7,hours:val.hours,minutes:val.minutes,seconds:val.seconds};};var years=function(elapsed)
{var val=days(elapsed);return{years:Math.floor(val.days/365),days:val.days%365,hours:val.hours,minutes:val.minutes,seconds:val.seconds};};var start=this;var now=new Date();var elapsed=years(now-start);var text="";if(elapsed.years<1&&elapsed.days<1&&elapsed.hours<1&&elapsed.minutes<1)
{if(elapsed.seconds<0)elapsed.seconds=0;text=elapsed.seconds+" second"+(elapsed.seconds==1?"":"s")+" ago";}
else if(elapsed.years<1&&elapsed.days<1&&elapsed.hours<1)
{text=elapsed.minutes+" minute"+(elapsed.minutes==1?"":"s")+" ago";}
else if(elapsed.years<1&&elapsed.days<1)
{text=elapsed.hours+" hour"+(elapsed.hours==1?"":"s");text+=" ago";}
else if(elapsed.years<1&&elapsed.days==1)
{text="yesterday";}
else if(elapsed.years<1&&elapsed.days<7&&elapsed.days>1)
{text=dayNames[start.getDay()];}
else if(elapsed.years<1)
{text=monthNames[start.getMonth()]+" "+start.getDate();}
else
{text=monthNames[start.getMonth()]+" "+start.getDate()+", "+start.getFullYear();}
return text;}}
if(!(new Date()).convertToLocalTime)
{Date.prototype.convertToLocalTime=function(timeZoneInMinutes)
{timeZoneInMinutes=(timeZoneInMinutes==null||timeZoneInMinutes==undefined||timeZoneInMinutes=="")?-(new Date()).getTimezoneOffset():timeZoneInMinutes;var milliseconds=this.getTime();var tzDiff=(((timeZoneInMinutes*60)*1000));var date=new Date();date.setTime(milliseconds+tzDiff);return date;}}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.deleteItem))
$.addStyleSheet("Styles/jquery.gd/gd.deleteItem.css");var deleteItem={isClosed:false,dialogDefaults:{closeOnEscape:false,bgiframe:true,resizable:false,zIndex:3000,position:['50%','50%'],modal:true},_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.options.displayAs=$this.options.displayAs.toLowerCase();$this.element.addClass($this.widgetBaseClass+'-'+$this.options.displayAs);$this.element.html($this._getInitHtml());if($this.options.displayAs=="modal")
{var dialogOptions=this.options.dialogOptions;this.options.dialogOptions=$.extend(true,this.dialogDefaults,this.options.dialogOptions);if($.isPopulated(dialogOptions))this.options.dialogOptions=dialogOptions;}
$this.element.css("zIndex","3000");switch($this.options.displayAs)
{case"flyout":$this.element.flyout({anchor:$this.options.anchor,positionX:$this.options.positionX,positionY:$this.options.positionY,offsetX:$this.options.offsetX,offsetY:$this.options.offsetY,backgroundInfo:$this.options.backgroundInfo});break;case"modal":if(!$.isPopulated($this.options.dialogOptions.width))$this.options.dialogOptions.width=$this.element.width();if($.isPopulated($this.options.dialogOptions.close))
{$this.options.close=$this.options.dialogOptions.close;$this.options.dialogOptions.close=null;}
if($.isPopulated($this.options.dialogOptions.open))
{$this.options.open=$this.options.dialogOptions.open;$this.options.dialogOptions.open=null;}
$this.options.dialogOptions.open=function(){$this.element.corners($this.options.backgroundInfo);};$this.element.dialog($this.options.dialogOptions);var dialog=$this.element.parents(".ui-dialog");$(".ui-dialog-titlebar",dialog).hide();dialog.css({overflow:"visible",padding:0,width:$this.options.dialogOptions.width,"font-family":"Arial, verdana, Helvetica, sans-serif","font-size":"12px"});$(".ui-dialog-content",dialog).css({border:"0",padding:"0",overflow:"visible"});$(".ui-widget-content",dialog).css({border:"0",backgroundImage:"",minHeight:"100px"});break;}
$this._configureEvents($this,$this.element);},destroy:function()
{this._unconfigureEvents(this,this.element);switch(this.options.displayAs)
{case"flyout":this.element.flyout("destroy");break;case"modal":this.element.dialog("destroy");break;}
this.element.removeClass(this.widgetBaseClass);this.element.removeClass(this.widgetBaseClass+'-'+this.options.displayAs);this.element.empty();$.widget.prototype.destroy.call(this);},_log:function(msg)
{if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_configureEvents:function($this,$element)
{var options=this.options;$this.element.find("."+$this.widgetBaseClass+"-button-ok").bind("click."+$this.widgetBaseClass,function(event)
{$this._saveData();$this.close();return false;});$this.element.find("."+$this.widgetBaseClass+"-button-cancel").bind("click."+$this.widgetBaseClass,function(event)
{$this.close();return false;});},_unconfigureEvents:function($this,$element)
{$this.element.find("."+$this.widgetBaseClass+"-button-ok").unbind("click."+$this.widgetBaseClass);$this.element.find("."+$this.widgetBaseClass+"-button-cancel").unbind("click."+$this.widgetBaseClass);},_getInitHtml:function()
{var html='<div class="'+this.widgetBaseClass+'-main">';if(this.options.displayAs=="flyout"||this.options.displayAs=="modal")html+='<h1>'+this.options.title+'</h1>';html+='<div class="'+this.widgetBaseClass+'-blurb">'+this.options.blurb+'</div>';html+='<div class="'+this.widgetBaseClass+'-actions"><a href="#" class="'+this.widgetBaseClass+'-button-ok"></a><a href="#" class="'+this.widgetBaseClass+'-button-cancel"></a></div>';html+='</div>';return html;},open:function()
{var $this=this;if(this.options.displayAs=="modal")this.element.dialog("open");else if(this.options.displayAs=="flyout")this.element.flyout("open");},close:function()
{var $this=this;if(this.options.displayAs=="modal")this.element.dialog("close");else if(this.options.displayAs=="flyout")this.element.flyout("close");},isClosed:function()
{if(this.options.displayAs=="modal")
return!this.element.dialog("isOpen");else if(this.options.displayAs=="flyout")
return this.element.flyout("isClosed");},_saveData:function()
{if($.isFunction(this.options.dataPersister))
{this.options.dataPersister(true);}}}
$.widget("ui.deleteItem",deleteItem);$.ui.deleteItem.getter="isClosed";$.ui.deleteItem.defaults={displayAs:"flyout",offsetX:-7,offsetY:-7,positionY:"top",positionX:"right",title:"Delete Video",blurb:"Are you sure you want to delete this video? This action cannot be undone.",backgroundInfo:{sizes:30,backgroundClass:'ui-deleteItem-background'},log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.availSpaceIndicator))
$.addStyleSheet("Styles/jquery.gd/gd.availSpaceIndicator.css");var AvailSpaceIndicator={spaceData:null,_init:function()
{var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this.element.append(this._getInitHtml());if($.isPopulated($this.options.spaceData))$this.spaceData=$this.options.spaceData;$this._buildDisplay();},destroy:function()
{this.element.removeClass(this.widgetBaseClass);this.element.empty();$.widget.prototype.destroy.call(this);},getSpaceData:function()
{return this.spaceData;},refresh:function()
{this.spaceData=null;this._buildDisplay();},_getInitHtml:function()
{html='<div class="top">'+'<div class="topHeader">Space Used</div>'+'<div class="spaceBarsHolder">'+'<div class="outerSpaceBar">'+'<div class="outerSpaceBar-left"></div>'+'<div class="outerSpaceBar-center"></div>'+'<div class="outerSpaceBar-right"></div>'+'<div style="clear:both;"></div>'+'</div>'+'<div class="innerSpaceBar">'+'<div class="innerSpaceBar-left"></div>'+'<div class="innerSpaceBar-center"></div>'+'<div class="innerSpaceBar-right"></div>'+'<div style="clear:both;"></div>'+'</div>'+'</div>'+'<div style="padding-top:5px;">'+'<div class="spaceRemainingUpgrade">&nbsp;</div>'+'<div class="spaceRemainingLabelDiv" style=""><span class="spaceRemainingLabel" /></div>'+'</div>'+'</div>';return html;},_formatDisplay:function($this)
{var e=$this.spaceData;var spaceRemainingText=$this._formatMegaBytesFromKiloBytes(e.UploadedKBytes)+' / '+
$this._formatMegaBytesFromKiloBytes(e.MaximumKBytes);$this.element.find('.spaceRemainingLabel').text(spaceRemainingText);$this.element.find('.outerSpaceBar-center').width($this.options.dspWidthCenter);$this.element.find('.innerSpaceBar-center').width($this.options.dspWidthCenter);var ttlWidth=10+$this.options.dspWidthCenter+10;$this.element.find('.outerSpaceBar').width(ttlWidth);$this.element.find('.innerSpaceBar').width(ttlWidth);var percentRemaining=Math.min(1,e.UploadedKBytes/e.MaximumKBytes);var centerWidth=percentRemaining*ttlWidth-10-10;$this.element.find('.outerSpaceBar-left').css({backgroundImage:"url(Images/progress_bar_small_08.gif)"});$this.element.find('.outerSpaceBar-center').css({backgroundImage:"url(Images/progress_bar_small_06.gif)"});$this.element.find('.outerSpaceBar-right').css({backgroundImage:"url(Images/progress_bar_small_07.gif)"});if(percentRemaining==0.00||percentRemaining==1.00){$this.element.find('.innerSpaceBar-left,.innerSpaceBar-center,.innerSpaceBar-right').hide();if(percentRemaining==1.00){$this.element.find('.outerSpaceBar-left').css("backgroundImage","url(Images/progress_bar_small_01.gif)");$this.element.find('.outerSpaceBar-center').css("backgroundImage","url(Images/progress_bar_small_03.gif)");$this.element.find('.outerSpaceBar-right').css("backgroundImage","url(Images/progress_bar_small_09.gif)");}}
else{$this.element.find('.innerSpaceBar-left,.innerSpaceBar-center,.innerSpaceBar-right').show();$this.element.find('.innerSpaceBar-center').width(Math.max(0,centerWidth));}
$this.element.find(".spaceRemainingUpgrade").html("Limit resets on "+e.ResetDay);},_buildDisplay:function()
{if(!$.isPopulated(this.spaceData))
this._retrieveAvailSpace(this._formatDisplay);else
this._formatDisplay(this);},_retrieveAvailSpace:function(callback)
{var $this=this;var getAvailableSpaceSuccess=function(e)
{if(e!=null)
{$this.spaceData=e;callback($this);}}
var getAvailableSpaceError=function(e)
{$this._log(e.Message);}
JsonServiceProxy.invoke('WebServices/VideoMeSecureService.svc/','GetAvailableSpace',{},getAvailableSpaceSuccess,getAvailableSpaceError);},_log:function(msg)
{if(window.console&&console.log)
{console.log(msg);}},_formatMegaBytesFromKiloBytes:function(kiloBytes)
{return Math.ceil(kiloBytes/1024)+'MB';}}
$.widget("ui.availSpaceIndicator",AvailSpaceIndicator);$.ui.availSpaceIndicator.getter="getSpaceData";$.ui.availSpaceIndicator.defaults={dspWidthCenter:246,log:true}})(jQuery);

(function($)
{var VideoPasswordPopup={_tryingPassword:false,_videoPasswordDiv:null,_goodPassword:false,_videoId:0,_init:function(){var $this=this;$this._log("loading "+$this.widgetBaseClass);$this.element.addClass($this.widgetBaseClass);$this._videoPasswordDiv=$($this.options.videoPasswordHtml);$($this.options.videoNameDiv).html($this.options.videoName);var checkKey=function(e){try{if(e.which||e.keyCode){if((e.which==13)||(e.keyCode==13)){$this._tryPassword();e.returnValue=false;e.cancel=true;e.stopPropagation();e.preventDefault();return false;}}}catch(e){}};$($this.options.passwordInput).bind("keyup",checkKey).fancyText();$($this.options.videoPasswordOkBtn).bind("click",function(){$this._tryPassword();});$($this.options.videoPasswordClose).bind("click",function(){$this.close();});$($this.options.videoPasswordCancelBtn).bind('click',function(){$this.close();});$this._videoPasswordDiv.dialog({modal:true,buttons:{},width:536,height:302,autoOpen:false,open:function(){$('.ui-dialog-titlebar').hide();$this._videoPasswordDiv.parent().removeClass('ui-widget-content ui-corner-all');$($this.options.passwordInput).val('').focus();},close:function(){if($this._tryingPassword==true)return false;if($this._goodPassword==true){$this.options.onGoodPasswordCallback();}else{$this.options.onBadPasswordCallback();}}});},destroy:function(){var $this=this;$($this.options.passwordInput).unbind();$($this.options.videoPasswordOkBtn).unbind();$($this.options.videoPasswordClose).unbind();$($this.options.videoPasswordCancelBtn).unbind();$this._videoPasswordDiv.dialog("destroy");this.element.removeClass(this.widgetBaseClass);$.widget.prototype.destroy.call(this);},open:function(args){var $this=this;$this._videoId=args.videoId;$($this.options.videoPasswordClose).show();$($this.options.videoPasswordOkBtn).show();$($this.options.videoPasswordCancelBtn).show();$($this.options.videoPasswordWait).hide();$this._videoPasswordDiv.dialog("open");},close:function(){this._videoPasswordDiv.dialog("close");},_log:function(msg){var $this=this;if(!$.isPopulated(this.options)||!$.isPopulated(this.options.log))return;if(window.console&&console.log)
{console.log(msg);}},_errored:function(msg){var $this=this;$($this.options.videoPasswordClose).show();$($this.options.videoPasswordOkBtn).show();$($this.options.videoPasswordCancelBtn).show();$($this.options.videoPasswordWait).hide();$($this.options.videoPasswordErr).show().text(msg);},_tryPassword:function(){var $this=this;var password=$.trim($($this.options.passwordInput).val());if(password.length==0){$this._errored('Incorrect password. Try again.');return;}
$this._tryingPassword=true;$($this.options.videoPasswordClose).hide();$($this.options.videoPasswordOkBtn).hide();$($this.options.videoPasswordCancelBtn).hide();$($this.options.videoPasswordWait).show();$this.options.checkPasswordFunction($this._videoId,password,function(isCorrectPassword){$this._tryingPassword=false;$this._goodPassword=isCorrectPassword;if(isCorrectPassword){$this.close();}else{$this._errored('Incorrect password. Try again.');}},function(){$this._tryingPassword=false;$this._errored('Communication error.  Please try again.');});}}
$.widget("ui.videoPasswordPopup",VideoPasswordPopup);$.ui.videoPasswordPopup.defaults={videoName:null,videoNameDiv:null,checkPasswordFunction:null,videoPasswordHtml:null,videoPasswordClose:null,videoPasswordOkBtn:null,videoPasswordCancelBtn:null,passwordInput:null,videoPasswordWait:null,videoPasswordErr:null,onBadPasswordCallback:null,onGoodPasswordCallback:null,log:true}})(jQuery);

if(!$.isPopulated(window.videoMe))window.videoMe={};window.videoMe.videoPlayer=function(options,anchorId,postLaunchPlayercallback,postEditVideoCallback,postAssignCategoriesCallback){if(!$.isPopulated(options.videoId))return;if(!$.isPopulated(options.secureDataUrl))options.secureDataUrl='WebServices/VideoMeSecureService.svc/';if(!$.isPopulated(options.openDataUrl))options.openDataUrl='WebServices/VideoMeService.svc/';this.allCategories=$.isPopulated(options.categories)?options.categories:[];var $this=this;function getAllCategories(callback){if($this.allCategories.length==0){JsonServiceProxy.invoke(options.openDataUrl,'ListAvailableCategories',null,function(rawData){$this.allCategories=rawData;options.categories=$this.allCategories;callback();},function(error){alert(error.Message);});}
else{callback();}}
getAllCategories(function(){if($.isPopulated(options.data)){launchPlayer();}
else{var service=(options.mode=="audit")||(options.userId>0)?options.secureDataUrl:options.openDataUrl;JsonServiceProxy.invoke(service,'GetVideoAndStatsByVideo',{videoId:options.videoId},function(data){options.data=data;launchPlayer();},function(error){options.data=null;launchPlayer();});}});function launchPlayer(){var data=options.data;var lastTwitterStatus='';twttr.anywhere(function(twitter){twitter.bind("authComplete",function(e,user){twitter.Status.update(lastTwitterStatus);$("#sharelinks-"+options.videoId).shareLinks("close");});});var width=0;var height=0;if(data)
{width=data.PlayerWidth;height=data.PlayerHeight;}
var dialogOptions={userName:options.userName,userId:options.userId,userType:options.userType,videoId:options.videoId,basePath:options.basePath,embedPath:options.basePath+"Embed.ashx?vid="+options.videoId+"&width="+width+"&height="+height,shareVidPath:options.basePath+"ViewVideo.aspx?vid="+options.videoId,emailCaptchaDataPersisterUrl:options.basePath+"Captcha/Captcha.ashx?type=verify",emailCaptchaImageUrl:options.basePath+"Captcha/Captcha.ashx?type=img",emailCaptchaTrigger:function(callback){JsonServiceProxy.invoke(options.openDataUrl,'RequireEmailCaptcha',{},function(captchaData){callback(captchaData);},function(Error){callback(false);});},flagPersister:function(abuseTypeCode){JsonServiceProxy.invoke(options.openDataUrl,'FlagVideo',{videoId:options.videoId,abuseType:abuseTypeCode});},viewPersister:function(callback){JsonServiceProxy.invoke(options.openDataUrl,'AddVideoViewCount',{videoId:options.videoId},function(rawData){callback({success:true,count:rawData});},function(error){callback({success:false});});RecordEvent(null,'click','22840','');},likePersister:function(likeIt,callback){RecordEvent(null,'click','22841','');var method=likeIt?"AddVideoLikeCount":"RemoveVideoLikeCount";JsonServiceProxy.invoke(options.openDataUrl,method,{videoId:options.videoId},function(rawData){callback({success:true,count:rawData});},function(error){callback({success:false,error:error.Message});});},editPersister:function(data,callback){data.videoId=options.videoId;JsonServiceProxy.invoke(options.secureDataUrl,'UpdateVideoPropertiesEx',{videoId:data.videoId,title:data.title,description:data.description,tags:data.tags,password:data.password,videoType:data.videoType,sender:'player'},function(rawData){if($.isFunction(postEditVideoCallback))postEditVideoCallback(rawData,true);$("#videoDescription").html(rawData.Description);callback({success:true,videoId:data.videoId,originalData:data,newData:rawData},options.successfulCallback);},function(error){callback({success:false,error:"Could not save data:\n"+error+"\nPlease try again later."});});},editCategoriesPersister:function(data,callback){data.videoId=options.videoId;JsonServiceProxy.invoke(options.secureDataUrl,'AssignCategoriesToVideo',{videoId:data.videoId,categories:data.categories.join(",")},function(rawData){if($.isFunction(postAssignCategoriesCallback))postAssignCategoriesCallback(data.categories);callback({success:true,videoId:data.videoId,originalData:data},options.successCallback);},function(error){callback({success:false,error:"Could not save data:\n' + error + '\nPlease try again later."});});},sharePersister:function(widgetData,callback){var method,params;var doIt=false;if(widgetData.service=="twitter"){twttr.anywhere(function(T){T.signIn();});lastTwitterStatus=widgetData.data.message;method='ShareVideoByTwitter';params={message:widgetData.data.message};doIt=false;}
else if(widgetData.service=="email"){method='ShareVideoByEmail';params={userName:widgetData.data.userName,senderEmail:widgetData.data.userAddress,toEmail:widgetData.data.sendToAddress,videoTitle:data.Title,videoUrl:widgetData.data.url,videoThumbnail:data.LargeThumbnailUrl,videoDuration:data.Duration,comment:widgetData.data.note,sendCopyToSender:widgetData.data.sendCopy,captchaText:widgetData.data.captchaText};doIt=true;}
else{callback({success:false,error:'Could not save data:\n'+error.Message+'\nPlease try again later.'});}
if(doIt){JsonServiceProxy.invoke(options.openDataUrl,method,params,function(rawData){callback({success:true,videoId:data.videoId,originalData:widgetData},options.successCallback);},function(error){callback({success:false,error:error.Message});});}},privateUrlRetriever:function(videoId,password,callback){var digest=Crypto.MD5(password);JsonServiceProxy.invoke(options.openDataUrl,'getprivatevideourl',{videoid:videoId,passwordHash:digest},function(data){callback({success:true,url:data});},function(error){callback({success:false,error:error.Message});});}};if($.isPopulated(data)){dialogOptions.videoUserId=data.UserProfileId;dialogOptions.showId=data.ShowId;dialogOptions.videoUserName=data.UserName;dialogOptions.videoFileName=data.FileName;dialogOptions.videoDescription=data.Description;dialogOptions.videoTags=data.Tags;dialogOptions.videoType=data.VideoType;dialogOptions.password=data.Password;dialogOptions.videoTitle=data.Title;dialogOptions.videoThumbnail=data.LargeThumbnailUrl;dialogOptions.videoUrl=data.VideoUrl;dialogOptions.videoPromptForPassword=0;dialogOptions.viewsCount=data.ViewCount;dialogOptions.likesCount=data.LikeCount;dialogOptions.abuseText=data.AbuseType;dialogOptions.playerWidth=data.PlayerWidth;dialogOptions.playerHeight=data.PlayerHeight;dialogOptions.useBackroundImageForVideoControls=data.UseBackroundImageForVideoControls;dialogOptions.shortUrlProviderID=data.ShortUrlProviderID;dialogOptions.shortUrlProviderArgs=data.ShortUrlProviderArgs;dialogOptions.categoriesData=($.isPopulated(data.Categories)&&data.Categories.length>0)?data.Categories.split(","):[];dialogOptions.viewerLikesVideo=data.ViewerLikesVideo;}else{dialogOptions.unavailable=true;dialogOptions.allLocked=options.allLocked;dialogOptions.unavailableReturnUrl=options.unavailableReturnUrl;}
if(options.mode=="event"){dialogOptions.mode="event";dialogOptions.modeData={eventTitle:options.eventTitle,eventLink:options.eventLink};if($.isPopulated(options.eventAdLink))dialogOptions.modeData.eventAdLink=options.eventAdLink;if($.isPopulated(options.eventAdTimeout))dialogOptions.modeData.eventAdTimeout=options.eventAdTimeout;if($.isPopulated(options.eventEmailText))dialogOptions.modeData.eventEmailText=options.eventEmailText;if($.isPopulated(options.eventTwitterText))dialogOptions.modeData.eventTwitterText=options.eventTwitterText;if($.isPopulated(options.appendShortUrlForTwitterText))
dialogOptions.modeData.appendShortUrlForTwitterText=options.appendShortUrlForTwitterText;if($.isPopulated(options.eventVideoTitleOverride))dialogOptions.modeData.eventVideoTitleOverride=options.eventVideoTitleOverride;if($.isPopulated(options.eventVideoThumbnailOverride))dialogOptions.modeData.eventVideoThumbnailOverride=options.eventVideoThumbnailOverride;if($.isPopulated(options.eventVideoShareUrl))dialogOptions.modeData.eventVideoShareUrl=options.eventVideoShareUrl;if($.isPopulated(options.eventISC))dialogOptions.shareVidPath=dialogOptions.shareVidPath+"&isc="+options.eventISC;}
if($.isPopulated(options.mode))dialogOptions.mode=options.mode;if($.isPopulated(options.displayEditAs))dialogOptions.displayEditAs=options.displayEditAs;if($.isPopulated(options.showControls))dialogOptions.showControls=options.showControls;if($.isPopulated(options.abuseTypes))dialogOptions.abuseTypes=options.abuseTypes;if($.isPopulated($this.allCategories))dialogOptions.allCategories=$this.allCategories;if($.isPopulated(options.auditPersister))dialogOptions.auditPersister=options.auditPersister;if($.isPopulated(options.flagPersister))dialogOptions.flagPersister=options.flagPersister;if($.isPopulated(options.viewPersister))dialogOptions.viewPersister=options.viewPersister;if($.isPopulated(options.likePersister))dialogOptions.likePersister=options.likePersister;if($.isPopulated(options.editPersister))dialogOptions.editPersister=options.editPersister;if($.isPopulated(options.editCategoriesPersister))dialogOptions.editCategoriesPersister=options.editCategoriesPersister;if($.isPopulated(options.sharePersister))dialogOptions.emailPersister=options.sharePersister;if(!$.isPopulated(dialogOptions.categoriesData)){dialogOptions.editCategoriesRetriever=function(callback){JsonServiceProxy.invoke(options.openDataUrl,'GetVideoCategoryIds',{videoId:options.videoId},function(rawData){callback(options.categories,rawData);},function(error){callback({success:false,error:'Could not load categories:\n'+error.Message+'\nPlease try again later.'});});};}
$("#"+anchorId).videoPlayer(dialogOptions);if($.isFunction(postLaunchPlayercallback))postLaunchPlayercallback(options);}}

