;(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)
{return $.toJSON(obj);},isAppleDevice:function()
{return(navigator.userAgent.match(/iPad|iPhone|iPod/i)!=null);},HtmlEncode:function(html)
{return $("<div/>").text(html).html();},HtmlDecode:function(text)
{return $("<div/>").html(text).text();}});$.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);$.extend({URLEncode:function(c)
{var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;while(x<c.length)
{var m=r.exec(c.substr(x));if(m!=null&&m.length>1&&m[1]!='')
{o+=m[1];x+=m[1].length;}
else
{if(c[x]==' ')
o+='+';else
{var d=c.charCodeAt(x);var h=d.toString(16);o+='%'+(h.length<2?'0':'')+h.toUpperCase();}
x++;}}
return o;},URLDecode:function(s)
{var o=s;var binVal,t;var r=/(%[^%]{2})/;while((m=r.exec(o))!=null&&m.length>1&&m[1]!='')
{b=parseInt(m[1].substr(1),16);t=String.fromCharCode(b);o=o.replace(m[1],t);}
return o;}});(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).addClass($this.options.backgroundClass2);$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);(function($)
{$.fn.EmbedTagBuilder=function(settings)
{var defaults={EmbedBaseUrl:null,OnConfigurationChanged:null};return this.each(function()
{var options=$.extend(true,{},defaults,settings);if(!options.EmbedBaseUrl)
{alert("EmbedBaseUrl is required.");return;}
if(!options.OnConfigurationChanged||typeof options.OnConfigurationChanged!="function")
{alert("OnConfigurationChanged is required.");return;}
var html=""+"<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"font-family:verdana;font-size:12px;\">"+" <tbody>"+"  <tr>"+"   <td itype=\"small\" style=\"vertical-align:bottom;padding:5px;\">"+"    <div style=\"width:50px;cursor:pointer;\">"+"     <div style=\"text-align:center;font-size:11px;\">320x191</div>"+"     <div itype=\"small\" style=\"border:1px solid #bbbbbb;position:relative;height:28px;\">"+"      <div style=\"position:absolute;top:50%;height:14px;margin-top:-7px;width:100%;text-align:center;\">Small</div>"+"     </div>"+"    <div>"+"   </td>"+"   <td itype=\"medium\" style=\"vertical-align:bottom;padding:5px;\">"+"    <div style=\"width:75px;cursor:pointer;\">"+"     <div style=\"text-align:center;font-size:11px;\">480x286</div>"+"     <div itype=\"small\" style=\"border:1px solid #bbbbbb;position:relative;height:43px;\">"+"      <div style=\"position:absolute;top:50%;height:14px;margin-top:-7px;width:100%;text-align:center;\">Medium</div>"+"     </div>"+"    <div>"+"   </td>"+"   <td itype=\"large\" style=\"vertical-align:bottom;padding:5px;\">"+"    <div style=\"width:100px;cursor:pointer;\">"+"     <div style=\"text-align:center;font-size:11px;\">640x382</div>"+"     <div itype=\"small\" style=\"border:1px solid #bbbbbb;position:relative;height:58px;\">"+"      <div style=\"position:absolute;top:50%;height:14px;margin-top:-7px;width:100%;text-align:center;\">Large</div>"+"     </div>"+"    <div>"+"   </td>"+"   <td itype=\"custom\" style=\"vertical-align:bottom;padding:5px;\">"+"    <div itype=\"custom\" style=\"width:160px;border:1px solid #bbbbbb;\">"+"     <div style=\"text-align:center;padding:5px 0px 10px 0px;\">Custom</div>"+"     <div style=\"padding:0px 20px 10px 20px;\">"+"      <div style=\"float:left;width:60px;padding-top:1px;\"><div>Width:</div><div style=\"font-size:10px;\">(min 320)</div></div>"+"      <input type\"text\" itype=\"width\" maxlength=\"4\" style=\"width:40px;text-align:center;border:1px solid #bbbbbb;padding:5px;\" />"+"     </div>"+"     <div style=\"padding:0px 0px 10px 20px;\">"+"      <div style=\"float:left;width:60px;padding-top:1px;\"><div>Height:</div><div style=\"font-size:10px;\">(min 191)</div></div>"+"      <input type\"text\" itype=\"height\" maxlength=\"4\" style=\"width:40px;text-align:center;border:1px solid #bbbbbb;padding:5px;\" />"+"     </div>"+"    <div>"+"   </td>"+"  </tr>"+" </tbody>"+"<table>"+"";$(this).html(html);var MIN_WIDTH=320;var MIN_HEIGHT=191;var txtWidth=$(this).find("input[itype=\"width\"]");var txtHeight=$(this).find("input[itype=\"height\"]");var ConfigChanged=function()
{var width=parseInt(txtWidth.attr("value"),10);var height=parseInt(txtHeight.attr("value"),10);if(isNaN(width))
{width=0;}
if(isNaN(height))
{height=0;}
var url=options.EmbedBaseUrl;url+="&width="+(width>MIN_WIDTH?width:MIN_WIDTH);url+="&height="+(height>MIN_HEIGHT?height:MIN_HEIGHT);var script="<script type=\"text/javascript\" src=\""+url+"\"></script>";options.OnConfigurationChanged(script);};var UpdateTextboxes=function(w,h)
{txtWidth.attr("value",w);txtHeight.attr("value",h);};var PredefinedBoxClicked=function(box)
{box.parent().find("div[itype]").each(function()
{$(this).css("border-color","#bbbbbb");});box.find("div[itype]").css("border-color","orange");};$(this).find("td[itype=\"small\"]").click(function()
{PredefinedBoxClicked($(this));UpdateTextboxes(320,191);ConfigChanged();});$(this).find("td[itype=\"medium\"]").click(function()
{PredefinedBoxClicked($(this));UpdateTextboxes(480,286);ConfigChanged();});$(this).find("td[itype=\"large\"]").click(function()
{PredefinedBoxClicked($(this));UpdateTextboxes(640,382);ConfigChanged();});$(this).find("td[itype=\"custom\"]").click(function()
{PredefinedBoxClicked($(this));});$(this).find("input[itype]").keypress(function(e)
{var code=e.charCode?e.charCode:e.keyCode?e.keyCode:0;return code>=48&&code<=57||code==8||code==46||code==35||code==36||code==37||code==39||code==9;});$(this).find("input[itype]").keydown(function(e)
{var value=parseInt($(this).attr("value"),10);if(isNaN(value))
{value=0;}
var code=e.keyCode;if(code===38&&value<9999)
{value++;$(this).attr("value",value);ConfigChanged();}
else if(code===40&&value>0)
{var min;if($(this).attr("itype")=="width")
{min=MIN_WIDTH;}
else
{min=MIN_HEIGHT;}
if(value>min)
{value--;$(this).attr("value",value);ConfigChanged();}}});$(this).find("input[itype]").keyup(function(e)
{var value=parseInt($(this).attr("value"),10);if(!isNaN(value)&&!jQuery.browser.msie)
{$(this).attr("value",value)}
ConfigChanged();});$(this).find("td[itype=\"large\"]").click();});};})(jQuery);if(!$.isPopulated(window.loadedShareLinksWidget))
{(function($)
{window.loadedShareLinksWidget=true;var VIDEOSHARETYPE="video";if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.shareLinks))
$.addStyleSheet("Styles/gd.shareLinks.css");var ShareLinks={linkDefaults:{displayOrder:['cutandpaste','email','facebook','twitter','delicious',,],delicious:{displayName:'Del.icio.us',icon:'delicious-icon.png'},facebook:{displayName:'Facebook',icon:'facebook-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+'-'+$widget.options.shareID+'">'+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;var shortUrl=$widget.options.shortUrl;var FormatContent=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+'-'+$widget.options.shareID).charCounter({counter:form.find('.'+$widget.widgetBaseClass+'-counter'),charLimit:charLimit});$('#'+$this.controls.user.id).fancyText();$('#'+$this.controls.password.id).fancyText();$('#'+$this.controls.message.id+'-'+$widget.options.shareID).fancyText();$('#'+$this.controls.user.id+', #'+$this.controls.password.id+', #'+$this.controls.message.id+'-'+$widget.options.shareID).bind("change",function(){$this.error($widget,"");});});};if(shortUrl)
{FormatContent(shortUrl);}
else
{$widget._shortenUrl(shortUrlProviderID,shortUrlProviderArgs,baseUrl,FormatContent);}},prepData:function($widget,callback)
{if(!$.isPopulated($("#"+this.controls.message.id+"-"+$widget.options.shareID).val()))
{callback({error:"Please enter the message to post."});}
else
{videoMe_Common.LogVideoShared($widget.options.videoId,"twitter");callback({service:"twitter",data:{message:$("#"+this.controls.message.id+"-"+$widget.options.shareID).charCounter("text")+this.extraText,shareID:$widget.options.shareID}});}},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+"-"+$widget.options.shareID).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 addShareLinksID='-'+$widget.options.shareID;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+addShareLinksID+'" /></dd>'+'</dl>'+'<dl>'+'<dt'+label+'>Your Email Address:</dt>'+'<dd><input style="width: 262px;" id="'+this.controls.userAddress.id+addShareLinksID+'" /></dd>'+'</dl>'+'<input type="checkbox" style="padding-top: 3px;'+($.browser.safari?" margin-left:4px;":"")+'" id="'+this.controls.sendCopy.id+addShareLinksID+'" /> <label for="'+this.controls.sendCopy.id+addShareLinksID+'">Send a copy to myself</label>'+'<dl>'+'<dt'+label+' style="padding-top:15px">Your Friend\'s Email Address:</dt>'+'<dd><input style="width: 262px" id="'+this.controls.sendToAddress.id+addShareLinksID+'" />'+'<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:181px;" id="'+this.controls.note.id+addShareLinksID+'"></textarea>'+'</dd>'+'</dl>'+'<div class="captcha"></div>'+'<div class="'+$widget.widgetBaseClass+'-error" />'+'</div>'+'<div class="action-button-group" style="padding-top:15px">'+'<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;var shortUrl=$widget.options.shortUrl;var FormatContent=function(url)
{$this.bodyText=$this.bodyText.replace("{video_url}",($.isPopulated(url)?url:""));buildForm(function($widget,form)
{var charLimit=(400-$this.extraText.length);var addShareLinksID='-'+$widget.options.shareID;form.find("#"+$this.controls.note.id+addShareLinksID).val($this.bodyText).charCounter({counter:form.find('.'+$widget.widgetBaseClass+'-counter'),charLimit:charLimit});$('#'+$this.controls.userName.id+addShareLinksID).makeSafeish({filters:{list:['html','charLimit']},filterCharLimit:35}).fancyText();$('#'+$this.controls.userAddress.id+addShareLinksID).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+addShareLinksID).fancyText();$('#'+$this.controls.note.id+addShareLinksID).makeSafeish().fancyText({newHeight:181});$('#'+$this.controls.userName.id+addShareLinksID+', #'+$this.controls.sendCopy.id+addShareLinksID+', #'+$this.controls.sendToAddress.id+addShareLinksID+', #'+$this.controls.note.id+addShareLinksID).bind("change",function(){$this.error($widget,"");});$this.open($widget);});};if(shortUrl)
{FormatContent(shortUrl);}
else
{$widget._shortenUrl(shortUrlProviderID,shortUrlProviderArgs,baseUrl,FormatContent);}},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 addShareLinksID='-'+$widget.options.shareID;var captcha=$("#"+this.controls.form.id).find(".captcha");var $this=this;var sendTo=$("#"+$this.controls.sendToAddress.id+addShareLinksID);var userName=$("#"+$this.controls.userName.id+addShareLinksID);var sendFrom=$("#"+$this.controls.userAddress.id+addShareLinksID);var captchaText=$.isPopulated(captcha.data("captcha"))?captcha.captcha("text"):"";var filter=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;var isEmailsValid=function(commaSeparatedEmails)
{var valid=true;var emailArr=commaSeparatedEmails.split(",");$.each(emailArr,function(index,value){if(!filter.test($.trim(value))){valid=false;return false;}});return valid;};if(!$.isPopulated(userName.val()))
{userName.focus();callback({error:"Your name is not specified."});}
else if(!$.isPopulated(sendFrom.val()))
{sendFrom.focus();callback({error:"Your email address is not specified."});}
else if(!$.isPopulated(sendTo.val()))
{sendTo.focus();callback({error:"Your friend's email address not specified."});}
else if(sendTo.val().split(",").length>5)
{sendTo.focus();callback({error:"Cannot send to more than 5 email addresses."});}
else if($.isPopulated(captcha.data("captcha"))&&captchaText=="")
{callback({error:"Security code not specified."});}
else if(!filter.test(sendFrom.val()))
{sendFrom.focus();callback({error:"Please Make 'Your Email Address' Valid."});}
else if(!isEmailsValid(sendTo.val()))
{sendTo.focus();callback({error:"Please Make 'Your Friend's Email Address' Valid."});}
else
{videoMe_Common.LogVideoShared($widget.options.videoId,"email");callback({service:"email",data:{userName:$("#"+$this.controls.userName.id+addShareLinksID).makeSafeish("getSafeText"),sendCopy:$("#"+$this.controls.sendCopy.id+"-"+$widget.options.shareID).is(':checked'),userAddress:$("#"+$this.controls.userAddress.id+addShareLinksID).val(),sendToAddress:$("#"+$this.controls.sendToAddress.id+addShareLinksID).val(),note:$("#"+$this.controls.note.id+addShareLinksID).charCounter("text",$("#"+$this.controls.note.id+addShareLinksID).makeSafeish("getSafeText"))+$this.extraText,url:$.isPopulated($this.url)?$this.url:$widget.options.url(),shareID:$widget.options.shareID,videoID:$widget.options.videoId,videoDuration:$.isPopulated($widget.options.videoDuration)?$widget.options.videoDuration:0,videoThumbnail:$widget.options.videoThumbnail,title:$widget.options.title(),shareType:$widget.options.shareType,captchaText:captchaText}});}},error:function($widget,message)
{$('#'+this.controls.form.id).find('.'+$widget.widgetBaseClass+"-error").html(message);},close:function($widget)
{var addShareLinksID='-'+$widget.options.shareID;$('#'+this.controls.userName.id+addShareLinksID).val("");$('#'+this.controls.userAddress.id+addShareLinksID).val("");$('#'+this.controls.sendToAddress.id+addShareLinksID).val("");$('#'+this.controls.sendCopy.id+addShareLinksID).attr("checked",false);$('#'+this.controls.note.id+addShareLinksID).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;var addShareLinksID='-'+$widget.options.shareID;buildForm(function($widget,form)
{form.find(".button-select").click(function()
{if($widget.options.shareType==VIDEOSHARETYPE)
{$('#'+$this.controls.embedCode.id+addShareLinksID).select();}
return false;});var embedTextarea=$('#'+$this.controls.embedCode.id+addShareLinksID);$widget.EmbedTextarea=embedTextarea;if($widget.options.shareType==VIDEOSHARETYPE)
{embedTextarea.fancyText({newHeight:85});}
$('#'+$this.controls.pageLink.id+addShareLinksID).fancyText();});},html:function($widget)
{var label=' class="'+$widget.widgetBaseClass+'-label"';var html='';html+='<div id="'+this.controls.form.id+'" class="'+this.controls.form.id+'-'+$widget.options.shareType+'"><dl>';html+='<dt'+label+'>Link to page:</dt>';if($widget.options.shareType==VIDEOSHARETYPE)
html+='<dd><div id="'+$widget.options.BaseID+'_d_link_clip_container" style="position:relative"><input readonly onclick="this.select();" style="width:550px;" type="text" id="'+this.controls.pageLink.id+'-'+$widget.options.shareID+'" value="'+$widget.options.url()+'"></div></dd>';else
html+='<dd><div id="'+$widget.options.BaseID+'_d_page_link_clip_container" style="position:relative"><input readonly onclick="this.select();" style="width:550px;" type="text" id="'+this.controls.pageLink.id+'-'+$widget.options.shareID+'" value="'+$widget.options.url()+'"></div></dd>';html+='</dl><br/>';html+="<div id=\""+$widget.options.BaseID+"_embed_ui_box\" style=\"display:none\">";if($widget.options.shareType==VIDEOSHARETYPE)
{html+='<div'+label+' style="margin-bottom:3px;">Embed:</div>';html+='<div id="'+$widget.options.BaseID+'_d_clip_container" style="position:relative"><textarea onclick="this.select();" readonly style="width: 550px;" id="'+this.controls.embedCode.id+'-'+$widget.options.shareID+'">&lt;script type="text/javascript" src="'+$widget.options.embedPath+'"&gt;&lt;/script&gt;</textarea></div>';html+="<div class=\"ui-shareLinks-label\" style=\"margin-top:10px;\">Select the embedded video player size:</div>";html+="<div id=\""+$widget.options.BaseID+"_embed_tag_builder\"></div>";}
html+="</div>";html+='<div class="action-button-group">';if($widget.options.shareType==VIDEOSHARETYPE)
{}
html+='<a href="#" class="cancel button-cancel action-button-link"></a>';html+='</div>';html+='<div id="'+$widget.options.BaseID+'_ClipTextDisplayDIV" class="ui-shareLinks-message-label" style="margin-left:80px;padding-top:12px;background-color:#FFFFFF"></div>';html+='</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(this.options.shareType.toLowerCase()!==VIDEOSHARETYPE)
{this.options.links.facebook=null;this.options.links.displayOrder=$.grep(this.options.links.displayOrder,function(val)
{return val.toLowerCase()!="facebook";});}
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;var dialogOptions={closeOnEscape:false,resizable:false,position:['50%','50%'],modal:true,width:560,zIndex:3000}
$this.options.dialogOptions=dialogOptions;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",top:"120px"});$(".ui-dialog-content",dialog).css({border:"0",padding:"0",overflow:"visible"});$(".ui-widget-content",dialog).css({border:"0",backgroundImage:""});break;}
$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()
{if(this.options.displayAs=="modal")
this.element.dialog("open");else
this.element.flyout("open");$('#'+this.options.BaseID+'_ClipTextDisplayDIV').hide();if(this.options.openModalType!='iconEmbed')
{var itemLoad;if(this.options.shareType=="video")
{itemLoad=videoMe_MyStuff.getVideo(this.options.videoId);}
else if(this.options.shareType=="album")
{itemLoad=videoMe_MyStuff.getAlbum(this.options.shareID);}
else if(this.options.shareType=="channel")
{itemLoad=videoMe_MyStuff.getChannel(this.options.shareID);}
if(itemLoad&&itemLoad.ShortUrl)
{if(this.options.links.twitter)
{this.options.links.twitter.controls.message.value=itemLoad.Title+' '+itemLoad.ShortUrl;$('#'+this.options.links.twitter.controls.message.id+'-'+this.options.shareID).val(this.options.links.twitter.controls.message.value);}}
else if(itemLoad)
{var shortenUrl=videoMe_MyStuff.GoDaddyUrlShorteningServiceBaseUrl;var bUseShortenUrl=videoMe_MyStuff.UseGoDaddyUrlShorteningService;var shortUrlProviderID;if(bUseShortenUrl)
shortUrlProviderID=2;else
shortUrlProviderID=1;var messageId=this.options.links.twitter.controls.message.id;var shareId=this.options.shareID;var shortenLink=function(url)
{$('#'+messageId+'-'+shareId).val(itemLoad.Title+' '+url);};videoMe_Common.shortenUrl(shortUrlProviderID,shortenUrl,this.options.url(),shortenLink);}}
this._openForm(this.currentForm);},_openForm:function(linkName)
{if(this.options.shareType==VIDEOSHARETYPE)
{var textarea=this.EmbedTextarea;var etb=$("#"+this.options.BaseID+"_embed_tag_builder");videoMe_Common.GetEmbedUrl(this.options.videoId,function(embedUrl)
{var settings={EmbedBaseUrl:embedUrl,OnConfigurationChanged:function(script)
{textarea.text(script);}};etb.EmbedTagBuilder(settings);});var embedBox=$("#"+this.options.BaseID+"_embed_ui_box");var selectEmbedCodeButton=$("#"+this.options.BaseID+"_select_embed_code_button");var formBox=$('.'+this.widgetBaseClass+'-formDisplay',this.element);var mainbox=this.element;var displayMode=this.options.displayAs;var embedLink='embed-link-embedcode-'+this.options.shareID;var embedClipContainer=this.options.BaseID+'_d_clip_container';var linkToPageLink='embed-link-pagelink-'+this.options.shareID;var linkToPageClipContainer=this.options.BaseID+'_d_link_clip_container';var linkToPageTextClipMsg=this.options.BaseID+'_ClipTextDisplayDIV';videoMe_Common.IsVideoEmbedEnabled(this.options.videoId,function(embedEnabled)
{if(embedEnabled)
{embedBox.show();selectEmbedCodeButton.show();if(linkName&&linkName!='twitter')
{formBox.css("height",371);}
else
{formBox.css("height",180);}}
else
{embedBox.hide();selectEmbedCodeButton.hide();if(linkName&&linkName!='twitter')
formBox.css("height",371);else
formBox.css("height",180);}
var box;if(linkName&&linkName!='twitter')
{box=displayMode=="modal"?mainbox.parent():mainbox;box.animate({top:100},{duration:500,queue:false});}});}
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);}});if(this.options.displayAs=="modal")
{this.element.dialog("close");}
else
{this.element.flyout("close");}},isClosed:function()
{if(this.options.displayAs=="modal")
{return this.element.dialog("isClosed");}
else
{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;});}});$("."+$this.widgetBaseClass+"-link-facebook",$this.element).click(function()
{videoMe_Common.LogVideoShared($this.options.videoId,"facebook");});$("."+$this.widgetBaseClass+"-link-delicious",$this.element).click(function()
{videoMe_Common.LogVideoShared($this.options.videoId,"delicious");});},_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='';var isIconEmbedModal=false;if(this.options.openModalType&&this.options.openModalType=="iconEmbed")
{isIconEmbedModal=true;}
html+='<div class="'+this.widgetBaseClass+'-headerMain">Share this '+this.options.friendlyName+'</div>';if(this.options.opener=='cutandpaste'&&isIconEmbedModal)
{html+='<div class="'+this.widgetBaseClass+'-header"><h1>Link:</h1>';}
else if(this.options.opener=='email'&&isIconEmbedModal)
{html+='<div class="'+this.widgetBaseClass+'-header"><h1>Email:</h1>';}
else if(this.options.opener=='twitter'&&isIconEmbedModal)
{html+='<div class="'+this.widgetBaseClass+'-header"><h1>Twitter:</h1>';}
else if(this.options.opener=='twitter'&&isIconEmbedModal)
{html+='<div class="'+this.widgetBaseClass+'-header"><h1>Delicious:</h1>';}
else
{html+='<div class="'+this.widgetBaseClass+'-header"><h1>Email &amp; Social Networks:</h1>';}
if(!isIconEmbedModal)
{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 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,digg:digg,email:email};},_shortenUrl:function(shortUrlProviderID,shortUrlProviderArgs,url,success)
{var link;if(shortUrlProviderID==1)
{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'},shareID:-1,shortUrl:null,shortUrlProviderID:1,shortUrlProviderArgs:null,videoThumbnail:"",videoDuration:0,shareType:"video",log:true}})(jQuery);}
(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.charCounter))
$.addStyleSheet("Styles/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");$this.element.removeClass("ui-charCounter-text-overlimit");switch(true)
{case difference>10:$this.options.counter.addClass($this.widgetBaseClass+"-ok");if($this.options.EnableSaveButtonHandler)
{$this.options.EnableSaveButtonHandler($this.element);}
break;case difference<=10&&difference>=0:$this.options.counter.addClass($this.widgetBaseClass+"-nearlimit");if($this.options.EnableSaveButtonHandler)
{$this.options.EnableSaveButtonHandler($this.element);}
break;case difference<0:$this.options.counter.addClass($this.widgetBaseClass+"-overlimit");$this.element.addClass("ui-charCounter-text-overlimit");if($this.options.DisableSaveButtonHandler)
{$this.options.DisableSaveButtonHandler($this.element);}
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/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" style="width:'+(parseInt(this.options.playerWidth)-22)+'px"><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 id="'+this.widgetBaseClass+"_share_video_button_"+this.options.videoId+'" 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:'')+($.browser.msie?' ie':' nonie')+'">'+'<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());if(!this.options.showGenericPlayer&&($.isPopulated(this.options.toggleVideoLinkBacks)&&(!this.options.toggleVideoLinkBacks)))
this.options.showGenericPlayer=true;var flashvars={doPlay:((this.options.autoplay)?1:0),loopCounter:-1,doLoad:0,doPassword:this.options.videoPromptForPassword,theVid:this.options.videoUrl,theTitle:this.options.videoTitle,thePic:this.options.videoThumbnail,subTitleParm1:this.options.videoUserName,Width:this.options.playerWidth,Height:this.options.playerHeight,Generic:this.options.showGenericPlayer?1:0,hideAllButReplay:1,doWatchMoreBar: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;}
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)
{RecordEvent(null,'click','23841','');var anchor=$(this).find("."+$this.widgetBaseClass+"-wrapper-center");var id="#editVideo-"+$this.options.videoId;{var editOptions={anchor:anchor,title:$this.videoTitle,videoId:$this.options.videoId,filename:$this.options.videoFileName,description:$this.options.videoDescription,tags:$this.options.videoTags,password:$this.options.password,selectedStillNumber:($.isPopulated($this.options.selectedStillNumber))?$this.options.selectedStillNumber:1,embedAllowLike:($.isPopulated($this.options.toggleLike))?$this.options.toggleLike:true,embedAllowSharing:($.isPopulated($this.options.toggleShare))?$this.options.toggleShare:true,allowComment:($.isPopulated($this.options.toggleComment))?$this.options.toggleComment:true,embedShowNoViews:($.isPopulated($this.options.embedShowNoViews))?$this.options.embedShowNoViews:true,embedPlayerAutoPlay:($.isPopulated($this.options.toggleAutoPlay))?$this.options.toggleAutoPlay:false,embedPlayerLoopVideo:($.isPopulated($this.options.toggleLoopPlay))?$this.options.toggleLoopPlay:false,embedShowVMELogo:($.isPopulated($this.options.embedShowVMELogo))?$this.options.embedShowVMELogo:true,embedShowVmeBar:($.isPopulated($this.options.embedShowVmeBar))?$this.options.embedShowVmeBar:true,allowEmbedPlayer:($.isPopulated($this.options.allowEmbedPlayer))?$this.options.allowEmbedPlayer:true,videoType:$this.options.videoType,accountType:$this.options.userType,dataPersister:$this.options.editPersister,showCategories:true,showFeatures:false,fromMyChannel:true,categoriesDataPersister:$this.options.editCategoriesPersister,thumbnailsDataPersister:$this.options.editVideoThumbnailsPersister,toggleVideoFeaturesPersister:$this.options.toggleVideoFeaturesPersister,backgroundInfo:{backgroundClass:'ui-videoPlayer-flyoutBackground',sizes:30},offsetX:20,offsetY:20,reloadOnSuccessfulUpdate:true};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;if($.isPopulated($this.options.allVideoThumbnails)&&$this.options.allVideoThumbnails.length>0)
editOptions.allVideoThumbnails=$this.options.allVideoThumbnails;else
editOptions.thumbnailsDataRetriever=$this.options.editVideoThumbnailsRetriever;$('<div id="'+id.replace("#","")+'" />').appendTo(document.body).editVideo(editOptions);}
if($.isPopulated($this.options.videoId)&&$this.options.videoId>0)
{var idVideo="#sharelinks-"+$this.options.videoId;if($.isPopulated($(idVideo))){$(idVideo).shareLinks("close");}}
if($.isPopulated($this.options.channelId)&&$this.options.channelId>0)
{var idChannel="#sharelinks-"+$this.options.channelId;if($.isPopulated($(idChannel))){$(idChannel).shareLinks("close");}}
if($.isPopulated($this.options.showId)&&$this.options.showId>0)
{var idShow="#sharelinks-"+$this.options.showId;if($.isPopulated($(idShow))){$(idShow).shareLinks("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())
{var FormatContent=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));};var shortUrl=$this.options.shortUrl;if(shortUrl)
{FormatContent(shortUrl);}
else
{videoMe_Common.shortenUrl($this.options.shortUrlProviderID,$this.options.shortUrlProviderArgs,$this.options.shareVidPath,FormatContent);}}
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:33,offsetY:-70,isRemote:$this.options.isRemote,emailCaptchaImageUrl:$this.options.emailCaptchaImageUrl,emailCaptchaDataPersisterUrl:$this.options.emailCaptchaDataPersisterUrl,emailCaptchaTrigger:$this.options.emailCaptchaTrigger,shortUrl:$this.options.shortUrl,friendlyName:"Video",shortUrlProviderID:$this.options.shortUrlProviderID,shortUrlProviderArgs:$this.options.shortUrlProviderArgs,videoId:$this.options.videoId};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"));shareOptions.BaseID=shareButton.attr("id")+"_base";shareDiv.shareLinks(shareOptions);}
else{if($(id).shareLinks("isClosed")){$(id).shareLinks("open");}
else{$(id).shareLinks("close");}}
if($.isPopulated($this.options.channelId)&&$this.options.channelId>0)
{var idChannel="#sharelinks-"+$this.options.channelId;if($.isPopulated($(idChannel))){$(idChannel).shareLinks("close");}}
if($.isPopulated($this.options.showId)&&$this.options.showId>0)
{var idShow="#sharelinks-"+$this.options.showId;if($.isPopulated($(idShow))){$(idShow).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);},updateOptions:function(data){this.videoTitle=data.Title;this.options.videoId=data.VideoId;this.options.videoFileName=data.FileName;this.options.videoDescription=data.Description;this.options.videoTags=data.Tags;this.options.password=data.Password;this.options.selectedStillNumber=data.SelectedStillNumber;this.options.toggleLike=data.EmbedAllowLike;this.options.toggleShare=data.EmbedAllowSharing;this.options.toggleComment=data.AllowComment;this.options.embedShowNoViews=data.EmbedShowNoViews;this.options.toggleAutoPlay=data.EmbedPlayerAutoPlay;this.options.toggleLoopPlay=data.EmbedPlayerLoopVideo;this.options.embedShowVMELogo=data.EmbedShowLargeLink;this.options.embedShowVmeBar=data.EmbedShowGreyBar;this.options.allowEmbedPlayer=data.EnableVideoPlayerEmbed;this.options.videoType=data.VideoType;}}
$.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,shortUrl:null,shortUrlProviderID:1,shortUrlProviderArgs:null,autoplay:false}})(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=encodeURIComponent(this.options.flashvars.theTitle);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/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/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.editChannel))
$.addStyleSheet("Styles/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: 99999; 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))
{RecordEvent(null,'click','23811','');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.editVideoThumbnail))
$.addStyleSheet("Styles/gd.editVideoThumbnail.css");var EditVideoThumbnail={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);$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){var $iThumbPos=0;if($.isPopulated($this.options.anchor)&&$this.options.displayAs=="flyout"){$this.element.corners($this.options.backgroundInfo);}
if($this.options.thumbnails&&$this.options.thumbnails.length>0)
{$iThumbPos=parseInt($.trim($element.find("."+$this.widgetBaseClass+"-view-selected-index").text()))-1;$element.find("."+$this.widgetBaseClass+"-view-image").attr('src',$this.options.thumbnails[$iThumbPos].smallThumbnailUrl);if($iThumbPos<=0){$element.find("."+$this.widgetBaseClass+"-scroll-left-image").hide();$element.find("."+$this.widgetBaseClass+"-scroll-right-image").show();}
else if($iThumbPos>=$this.options.thumbnails.length-1){$element.find("."+$this.widgetBaseClass+"-scroll-right-image").hide();$element.find("."+$this.widgetBaseClass+"-scroll-left-image").show();}}
$element.find("."+$this.widgetBaseClass+"-scroll-left-image").bind("click."+$this.widgetBaseClass,function(){if($iThumbPos>0){$iThumbPos=$iThumbPos-1;$element.find("."+$this.widgetBaseClass+"-view-image").attr('src',$this.options.thumbnails[$iThumbPos].smallThumbnailUrl);$element.find("."+$this.widgetBaseClass+"-view-selected-index").text($iThumbPos+1);if($iThumbPos<=0){$element.find("."+$this.widgetBaseClass+"-scroll-left-image").hide();}
if($iThumbPos<=($this.options.thumbnails.length-2)){$element.find("."+$this.widgetBaseClass+"-scroll-right-image").show();}}
RecordEvent(null,'click','42527','');return false;});$element.find("."+$this.widgetBaseClass+"-scroll-right-image").bind("click."+$this.widgetBaseClass,function(){if($iThumbPos<=($this.options.thumbnails.length-1)){$iThumbPos=$iThumbPos+1;$element.find("."+$this.widgetBaseClass+"-view-image").attr('src',$this.options.thumbnails[$iThumbPos].smallThumbnailUrl);$element.find("."+$this.widgetBaseClass+"-view-selected-index").text($iThumbPos+1);if($iThumbPos>=($this.options.thumbnails.length-1)){$element.find("."+$this.widgetBaseClass+"-scroll-right-image").hide();}
if($iThumbPos>=1){$element.find("."+$this.widgetBaseClass+"-scroll-left-image").show();}}
RecordEvent(null,'click','42526','');return false;});},_unconfigureEvents:function($this,$element){$this.element.find("."+$this.widgetBaseClass+"-scroll-left-image").unbind("click."+$this.widgetBaseClass);$this.element.find("."+$this.widgetBaseClass+"-scroll-right-image").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(allVideoThumbnails,selectedIndex){if($.isPopulated(selectedIndex))
$this.options.selectedStillNumber=selectedIndex;if($.isPopulated(allVideoThumbnails)){$this.options.thumbnails=[];for(var i=0;i<allVideoThumbnails.length;i++){$this.options.thumbnails.push({thumbnailID:allVideoThumbnails[i].VideoThumbNailId,smallThumbnailUrl:allVideoThumbnails[i].SmallThumbnailUrl});}}
var html='';if($this.options.thumbnails&&$this.options.thumbnails.length>0)
{html+='<div class="'+$this.widgetBaseClass+'-header">Choose a Thumbnail</div>';html+='<div class="'+$this.widgetBaseClass+'-main">';html+='<div class="'+$this.widgetBaseClass+'-instructions">Image 1 is your default thumbnail. You can keep this default, or select a different thumbnail.</div>';html+='<div class="'+$this.widgetBaseClass+'-space">&nbsp;</div>';html+='<div class="'+$this.widgetBaseClass+'-main-image">';html+='<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center"><tr>';html+='<td width="70" valign="middle" align="right" class="'+$this.widgetBaseClass+'-scroll-left"><img class="'+$this.widgetBaseClass+'-scroll-left-image" src="'+vme_ImageBaseUrl+'Images/btn_leftThumb.png" border="0" alt="Left" /></td>';html+='<td align="center" width="120" class="'+$this.widgetBaseClass+'-scroll-image"><img class="'+$this.widgetBaseClass+'-view-image" src="" alt="" /></td>';html+='<td width="130" valign="middle" align="left" class="'+$this.widgetBaseClass+'-scroll-right"><img class="'+$this.widgetBaseClass+'-scroll-right-image" src="'+vme_ImageBaseUrl+'Images/btn_rightThumb.png" border="0" alt="Right" /></td>';html+='</tr>';html+='<tr><td>&nbsp;</td><td align="center"><div class="'+$this.widgetBaseClass+'-view-selected-index" style="text-align:center;">'+selectedIndex+'</div></td><td>&nbsp;</td></tr>';html+='</table>';html+='</div>';html+='</div>';}
else
{if($this.options.sender=="uploadmultiple")
{html+='<div id="ThumbAlertDiv-'+$this.options.videoId+'" style="padding-left:25px;padding-top:8px;">'+'<div class="ErrorBox" style="width:260px;">'+'<div class="ErrorAlertImg"><img src="'+vme_ImageBaseUrl+'images/icon_alert_green.png" alt="alert" /></div>'+'<div class="ErrorAlertMsg" style="width:215px;" id="ThumbAlertMsgDiv-'+$this.options.videoId+'">Thumbnail will be available after the video is done processing.</div>'+'<div class="ErrorCloseImg" onclick="$(\''+'#ThumbAlertDiv-'+$this.options.videoId+'\').hide();"><img src="'+vme_ImageBaseUrl+'images/btn_close_alert_box.png" alt="close alert" /></div>'+'<div style="clear: both;" /></div>'+'</div>';}}
finish(html);}
if($.isFunction($this.options.dataRetriever)){$this.options.dataRetriever(buildHtml);}
else if($.isPopulated(this.options.allVideoThumbnails)&&$.isPopulated(this.options.selectedStillNumber)){buildHtml(this.options.allVideoThumbnails,this.options.selectedStillNumber);}
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 data={selectedStillNumber:parseInt($.trim($this.element.find('.'+$this.widgetBaseClass+'-view-selected-index').text()))}
this.options.dataPersister(data,finish);}}}
$.widget("ui.editVideoThumbnail",EditVideoThumbnail);$.ui.editVideoThumbnail.getter="isClosed";$.ui.editVideoThumbnail.defaults={displayAs:"flyout",showControls:true,thumbnails:[],selectedStillNumber:-1,sender:"",columnSize:7,offsetX:3,offsetY:0,positionX:"right",positionY:"",backgroundInfo:{sizes:30,backgroundClass:'ui-editVideoThumbnail-background'},log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.toggleVideoFeatures))
$.addStyleSheet("Styles/gd.toggleVideoFeatures.css");var ToggleVideoFeatures={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)
{}
$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);}
$('li:has(input.'+$this.widgetBaseClass+'-features)').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: 99999; 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});});$('li:has(input.'+$this.widgetBaseClass+'-videofeatures)').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: 99999; 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)
{}},_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(toggleLike,toggleShare,toggleComment,toggleVideoLinkBacks,toggleAutoPlay,toggleLoopPlay)
{$this.options.features=[];$this.options.features.push({toggle:"like",displayName:"Like",description:"like desc text",selected:toggleLike});$this.options.features.push({toggle:"share",displayName:"Share",description:"share desc text",selected:toggleShare});$this.options.features.push({toggle:"videolinkbacks",displayName:"Views",description:"video link desc text",selected:toggleVideoLinkBacks});$this.options.features.push({toggle:"comment",displayName:"Comments",description:"comment desc text",selected:toggleComment});$this.options.videofeatures=[];$this.options.videofeatures.push({toggle:"autoplay",displayName:"Auto Play",description:"video auto play desc text",selected:toggleAutoPlay});$this.options.videofeatures.push({toggle:"loopplay",displayName:"Loop",description:"video loop desc text",selected:toggleLoopPlay});var html='<div class="'+$this.widgetBaseClass+'-header">Video Features</div>';html+='<div class="'+$this.widgetBaseClass+'-instructions">Attributes:</div>';html+='<div class="'+$this.widgetBaseClass+'-main"><table cellpadding="0" cellspacing="0"><tr>';for(var i=0;i<$this.options.features.length;i++)
{html+='<td><ul>';html+='<li><input type="checkbox"'+($this.options.features[i].selected?' checked':'')+' class="'+$this.widgetBaseClass+'-features" value="'+$this.options.features[i].toggle+'" id="features-'+$this.options.features[i].toggle+'" /> <label for="features-'+$this.options.features[i].toggle+'">'+$this.options.features[i].displayName+'</label><span style="display:none">'+$this.options.features[i].description+'</span></li>';html+='</ul></td>';}
html+='</tr></table></div>';html+='<div class="'+$this.widgetBaseClass+'-instructions">Features:</div>';html+='<div class="'+$this.widgetBaseClass+'-main"><table cellpadding="0" cellspacing="0"><tr>';for(var i=0;i<$this.options.videofeatures.length;i++)
{html+='<td><ul>';html+='<li><input type="checkbox"'+($this.options.videofeatures[i].selected?' checked':'')+' class="'+$this.widgetBaseClass+'-videofeatures" value="'+$this.options.videofeatures[i].toggle+'" id="videofeatures-'+$this.options.videofeatures[i].toggle+'" /> <label for="videofeatures-'+$this.options.videofeatures[i].toggle+'">'+$this.options.videofeatures[i].displayName+'</label><span style="display:none">'+$this.options.videofeatures[i].description+'</span></li>';html+='</ul></td>';}
html+='</tr></table></div>';finish(html);}
if($.isPopulated(this.options.toggleLike)&&$.isPopulated(this.options.toggleShare)&&$.isPopulated(this.options.toggleComment)&&$.isPopulated(this.options.toggleVideoLinkBacks)&&$.isPopulated(this.options.toggleAutoPlay)&&$.isPopulated(this.options.toggleLoopPlay))
{buildHtml(this.options.toggleLike,this.options.toggleShare,this.options.toggleComment,this.options.toggleVideoLinkBacks,this.options.toggleAutoPlay,this.options.toggleLoopPlay);}},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 featuresSelected=[];$this.element.find('.'+$this.widgetBaseClass+'-features:checked').each(function(){featuresSelected.push($(this).val());});var videofeaturesSelected=[];$this.element.find('.'+$this.widgetBaseClass+'-videofeatures:checked').each(function(){videofeaturesSelected.push($(this).val());});var data=[];for(var i=0;i<this.options.features.length;i++)
{if(this.options.features[i].toggle=='like')
data.toggleLike=($.inArray(this.options.features[i].toggle.toString(),featuresSelected)>-1);else if(this.options.features[i].toggle=='share')
data.toggleShare=($.inArray(this.options.features[i].toggle.toString(),featuresSelected)>-1);else if(this.options.features[i].toggle=='comment')
data.toggleComment=($.inArray(this.options.features[i].toggle.toString(),featuresSelected)>-1);else if(this.options.features[i].toggle=='videolinkbacks')
data.toggleVideoLinkBacks=($.inArray(this.options.features[i].toggle.toString(),featuresSelected)>-1);}
for(var i=0;i<this.options.videofeatures.length;i++)
{if(this.options.videofeatures[i].toggle=='autoplay')
data.toggleAutoPlay=($.inArray(this.options.videofeatures[i].toggle.toString(),videofeaturesSelected)>-1);else if(this.options.videofeatures[i].toggle=='loopplay')
data.toggleLoopPlay=($.inArray(this.options.videofeatures[i].toggle.toString(),videofeaturesSelected)>-1);}
this.options.dataPersister(data,finish);}}}
$.widget("ui.toggleVideoFeatures",ToggleVideoFeatures);$.ui.toggleVideoFeatures.getter="isClosed";$.ui.toggleVideoFeatures.defaults={displayAs:"flyout",showControls:true,features:[],videofeatures:[],columnSize:1,offsetX:3,offsetY:0,positionX:"right",positionY:"",backgroundInfo:{sizes:30,backgroundClass:'ui-toggleVideoFeatures-background'},log:true}})(jQuery);(function($)
{if(!$.isPopulated(window.widgetPreloadedCss)||($.isPopulated(window.widgetPreloadedCss)&&!window.widgetPreloadedCss.fancyText))
$.addStyleSheet("Styles/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>').css("position","relative");if(($.browser.msie||$.browser.safari)&&(elementType=="select")&&(navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("chrome")<0))
{$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};}
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/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/gd.comments.css");var Comments={loggedIn:false,commentCount:0,DateNow:null,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.DateNow=$this.options.DateNow;$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()
{if(options.fromViewShow&&options.fromViewShow==true)
RecordEvent(null,'click','23849','');else
RecordEvent(null,'click','23836','');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=null;if($this.options.data&&$this.options.data.comments)
{list=$this.options.data.comments;}
else
{list=new Array();}
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=null;if($this.options.data&&$this.options.data.comments)
{list=$this.options.data.comments;}
else
{list=new Array();}
var DateNow=$this.DateNow;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(DateNow)+'</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)
{if($this.options.fromViewShow&&$this.options.fromViewShow==true)
RecordEvent(null,'click','23850','');else
RecordEvent(null,'click','23837','');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.DateNow=data.DateNow;$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;$this.DateNow=data.DateNow;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(DateNow)
{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=DateNow;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/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)
{if($this.options.title&&$this.options.title.length>0){if($this.options.title=="Delete Channel")
RecordEvent(null,'click','23825','');else if($this.options.title=="Delete Album")
RecordEvent(null,'click','23818','');else if($this.options.title=="Delete Video")
RecordEvent(null,'click','23833','');}
$this._saveData();$this.close();return false;});$this.element.find("."+$this.widgetBaseClass+"-button-cancel").bind("click."+$this.widgetBaseClass,function(event)
{if($this.options.title&&$this.options.title.length>0){if($this.options.title=="Delete Channel")
RecordEvent(null,'click','23826','');else if($this.options.title=="Delete Album")
RecordEvent(null,'click','23819','');else if($this.options.title=="Delete Video")
RecordEvent(null,'click','23834','');}
$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/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)+' / '+
Math.floor(e.MaximumKBytes/1024)+'MB';$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:[];this.allVideoThumbnails=$.isPopulated(options.thumbnails)?options.thumbnails:[];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 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.data?options.data.EmbedVideoUrl:"",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;if(this.displayAs!="embed")
{if($.isPopulated(options.selectedStillNumber)&&options.selectedStillNumber>0)
data.selectedStillNumber=options.selectedStillNumber;else
data.selectedStillNumber=0;JsonServiceProxy.invoke(options.secureDataUrl,'UpdateVideoPropertiesEdit2',{videoId:data.videoId,title:data.title,description:data.description,tags:data.tags,password:data.password,videoType:data.videoType,sender:options.sender,selectedStillNumber:data.selectedStillNumber,embedAllowLike:data.embedAllowLike,embedAllowSharing:data.embedAllowSharing,toggleComment:data.allowComment,embedPlayerAutoPlay:data.embedPlayerAutoPlay,embedPlayerLoopVideo:data.embedPlayerLoopVideo,embedShowNoViews:data.embedShowNoViews,embedShowLargeLink:data.embedShowVMELogo,embedShowGreyBar:data.embedShowVmeBar,enableVideoPlayerEmbed:data.allowEmbedPlayer},function(rawData)
{if($.isFunction(postEditVideoCallback))
{postEditVideoCallback(rawData,true);}
$("#videoDescription").html(rawData.Description);$("#"+anchorId).videoPlayer("updateOptions",rawData);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."});});}
else
{JsonServiceProxy.invoke(options.secureDataUrl,'UpdateVideoProperties',{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."});});},editVideoThumbnailsPersister:function(data,callback){if(data.selectedStillNumber&&data.selectedStillNumber>0){options.selectedStillNumber=data.selectedStillNumber;dialogOptions.selectedStillNumber=data.selectedStillNumber;}
if($.isPopulated(this.allVideoThumbnails)){dialogOptions.thumbnails=[];for(var i=0;i<this.allVideoThumbnails.length;i++){dialogOptions.thumbnails.push({thumbnailID:this.allVideoThumbnails[i].VideoThumbNailId,smallThumbnailUrl:this.allVideoThumbnails[i].SmallThumbnailUrl});}
options.thumbnails=dialogOptions.thumbnails;}
callback({allVideoThumbnails:dialogOptions.thumbnails,selectedIndex:dialogOptions.selectedStillNumber});},toggleVideoFeaturesPersister:function(data,callback){if($.isPopulated(data.toggleLike))
{dialogOptions.toggleLike=data.toggleLike;options.toggleLike=data.toggleLike;}
if($.isPopulated(data.toggleShare))
{dialogOptions.toggleShare=data.toggleShare;options.toggleShare=data.toggleShare;}
if($.isPopulated(data.toggleComment))
{dialogOptions.toggleComment=data.toggleComment;options.toggleComment=data.toggleComment;}
if($.isPopulated(data.toggleVideoLinkBacks))
{dialogOptions.toggleVideoLinkBacks=data.toggleVideoLinkBacks;options.toggleVideoLinkBacks=data.toggleVideoLinkBacks;}
if($.isPopulated(data.toggleAutoPlay))
{dialogOptions.toggleAutoPlay=data.toggleAutoPlay;options.toggleAutoPlay=data.toggleAutoPlay;}
if($.isPopulated(data.toggleLoopPlay))
{dialogOptions.toggleLoopPlay=data.toggleLoopPlay;options.toggleLoopPlay=data.toggleLoopPlay;}
callback({toggleLike:dialogOptions.toggleLike,toggleShare:dialogOptions.toggleShare,toggleComment:dialogOptions.toggleComment,toggleVideoLinkBacks:dialogOptions.toggleVideoLinkBacks,toggleAutoPlay:dialogOptions.toggleAutoPlay,toggleLoopPlay:dialogOptions.toggleLoopPlay});},sharePersister:function(widgetData,callback){var method,params;var doIt=false;if(widgetData.service=="twitter"){method='ShareVideoByTwitter';params={message:widgetData.data.message};qs="message="+encodeURIComponent(widgetData.data.message);window.open(options.basePath+"TwitterAuth.aspx?"+qs);$("#sharelinks-"+options.videoId).shareLinks("close");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:$.isPopulated(data.Duration)?data.Duration:0,comment:widgetData.data.note,sendCopyToSender:widgetData.data.sendCopy,captchaText:widgetData.data.captchaText,shareType:widgetData.data.shareType};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.channelId=data.ChannelId;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.toggleLike=data.EmbedAllowLike;dialogOptions.toggleShare=data.EmbedAllowSharing;dialogOptions.toggleComment=data.ToggleComment;dialogOptions.toggleAutoPlay=data.EmbedPlayerAutoPlay;dialogOptions.toggleLoopPlay=data.EmbedPlayerLoopVideo;dialogOptions.allowEmbedPlayer=data.EnableVideoPlayerEmbed;dialogOptions.embedShowNoViews=data.EmbedShowNoViews;dialogOptions.allowEmbedPlayer=data.EnableVideoPlayerEmbed;dialogOptions.embedShowVMELogo=data.EmbedShowLargeLink;dialogOptions.embedShowVmeBar=data.EmbedShowGreyBar;dialogOptions.likesCount=data.LikeCount;dialogOptions.abuseText=data.AbuseType;dialogOptions.playerWidth=data.PlayerWidth;dialogOptions.playerHeight=data.PlayerHeight;dialogOptions.useBackroundImageForVideoControls=data.UseBackroundImageForVideoControls;dialogOptions.shortUrl=data.ShortUrl;dialogOptions.shortUrlProviderID=data.ShortUrlProviderID;dialogOptions.shortUrlProviderArgs=data.ShortUrlProviderArgs;dialogOptions.selectedStillNumber=data.SelectedStillNumber;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($this.allVideoThumbnails))dialogOptions.allVideoThumbnails=$this.allVideoThumbnails;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.editVideoThumbnailsPersister))dialogOptions.editVideoThumbnailsPersister=options.editVideoThumbnailsPersister;if($.isPopulated(options.toggleVideoFeaturesPersister))dialogOptions.toggleVideoFeaturesPersister=options.toggleVideoFeaturesPersister;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.'});});};}
if(!$.isPopulated(dialogOptions.thumbnails)){dialogOptions.editVideoThumbnailsRetriever=function(callback){JsonServiceProxy.invoke(options.openDataUrl,'GetVideoThumbnailsByVideo',{videoId:options.videoId},function(rawData){$this.allVideoThumbnails=rawData;options.thumbnails=$this.allVideoThumbnails;dialogOptions.thumbnails=options.thumbnails;callback(options.thumbnails,dialogOptions.selectedStillNumber);},function(error){callback({success:false,error:"Could not load thumbnails:\n' + error + '\nPlease try again later."});});}}
$("#"+anchorId).videoPlayer(dialogOptions);if($.isFunction(postLaunchPlayercallback))postLaunchPlayercallback(options);}}

var videoMe_ShareLinksPopup=function(){var pub={};pub.CHANNEL_TYPE="channel";pub.ALBUM_TYPE="album";pub.VIDEO_TYPE="video";pub.LargeThumbnailUrl='';pub.Duration='';pub.initLink=function(shareType,clickObjectIDName,basePath,shareID,Title,videoID,videoThumbnail,videoDuration,mode,isRemote,displayAs,anchorItem,opener,showId)
{var urlShare='';var typeQueryIDName;var typeLinkLoc;var typeFriendlyName;if(shareType==pub.CHANNEL_TYPE)
{typeQueryIDName="chanid";typeLinkLoc="ViewChannel.aspx";typeFriendlyName="Channel";}
else if(shareType==pub.ALBUM_TYPE)
{typeQueryIDName="showid";typeLinkLoc="ViewShow.aspx";typeFriendlyName="Album";}
else
{typeQueryIDName="vid";typeLinkLoc="ViewVideo.aspx";typeFriendlyName="Video";}
var shareVidPath=basePath+typeLinkLoc+'?'+typeQueryIDName+'='+showId;if(opener=='delicious')
{urlShare=pub.urlBuilder({host:"delicious.com",protocol:"http",path:"save",query:{noui:"",v:"5",jump:"close",url:encodeURIComponent(shareVidPath),title:encodeURIComponent(Title)}});}
$('a#'+clickObjectIDName).attr("href",urlShare);}
pub.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;}
pub.init=function(shareType,clickObjectIDName,basePath,shareID,Title,videoID,videoThumbnail,videoDuration,mode,isRemote,displayAs,anchorItem,opener,showId,offsetX,offsetY,openModalType,ShortUrl,ShorteningServiceUrl,bUseGDUrlShortner){var dialogOptions={emailCaptchaTrigger:function(callback){JsonServiceProxy.invoke('WebServices/VideoMeService.svc/','RequireEmailCaptcha',{},function(captchaData){callback(captchaData);},function(Error){callback(false);});},successCallback:function(data){},sharePersister:function(widgetData,callback,appURL){var method,params;var doIt=false;if(widgetData.service=="twitter"){method='ShareVideoByTwitter';params={message:widgetData.data.message,shareID:widgetData.data.shareID};qs="message="+encodeURIComponent(widgetData.data.message);window.open(basePath+"TwitterAuth.aspx?"+qs);$("#sharelinks-"+widgetData.data.shareID).shareLinks("close");doIt=false;}
else if(widgetData.service=="email"){method='ShareVideoByEmail';params={userName:widgetData.data.userName,senderEmail:widgetData.data.userAddress,toEmail:widgetData.data.sendToAddress,videoTitle:widgetData.data.title,videoUrl:widgetData.data.url,videoThumbnail:widgetData.data.videoThumbnail,videoDuration:$.isPopulated(widgetData.data.videoDuration)?widgetData.data.videoDuration:0,comment:widgetData.data.note,sendCopyToSender:widgetData.data.sendCopy,captchaText:widgetData.data.captchaText,shareType:widgetData.data.shareType};doIt=true;}
else{var error;callback({success:false,error:'Could not send email.<br>Please try again later.'});}
if(doIt){JsonServiceProxy.invoke('WebServices/VideoMeService.svc/',method,params,function(rawData){callback({success:true,videoId:widgetData.data.videoID,originalData:widgetData},dialogOptions.successCallback);},function(error){callback({success:false,error:error.Message});});}}};var shareButton;if($.isPopulated(clickObjectIDName))
shareButton=$('#'+clickObjectIDName);else
shareButton=$element.find("."+"ui-videoPlayer"+"-button-share");var shortUrlProviderID;var shortUrlProviderArgs;if(ShortUrl&&ShortUrl.length>0)
{shortUrlProviderID=2;}
else if(bUseGDUrlShortner)
{shortUrlProviderArgs=ShorteningServiceUrl;shortUrlProviderID=2;}
else
{shortUrlProviderArgs=null;shortUrlProviderID=1;}
var typeQueryIDName;var typeLinkLoc;var typeFriendlyName;if(shareType==pub.CHANNEL_TYPE)
{typeQueryIDName="chanid";typeLinkLoc="ViewChannel.aspx";typeFriendlyName="Channel";}
else if(shareType==pub.ALBUM_TYPE)
{typeQueryIDName="showid";typeLinkLoc="ViewShow.aspx";typeFriendlyName="Album";}
else
{typeQueryIDName="vid";typeLinkLoc="ViewVideo.aspx";typeFriendlyName="Video";}
var idVideo="#sharelinks-"+videoID;var shareVidPath="";if(showId)
shareVidPath=basePath+typeLinkLoc+'?'+typeQueryIDName+'='+showId;else
shareVidPath=basePath+typeLinkLoc+'?'+typeQueryIDName+'='+shareID;if($.isAppleDevice())
{if(opener=='email')
{var FormatContent=function(url)
{var body=shareVidPath;body=body.replace("{video_url}",($.isPopulated(url)?url:""));shareButton.attr("href","mailto:?subject="+encodeURIComponent(Title.unescapeHtml())+"&body="+encodeURIComponent(body));};if(ShortUrl)
{FormatContent(ShortUrl);}
else
{videoMe_Common.shortenUrl(shortUrlProviderID,shortUrlProviderArgs,shareVidPath,FormatContent);}}
else
{$('#div-'+opener+'-'+showId).hide();}}
else
{shareButton.bind("click",function(event){var anchor;anchor=$(this).find(anchorItem);if($.isPopulated($(idVideo))){$(idVideo).shareLinks("close");}
var id="#sharelinks-"+shareID;var EmailShareID='#sharelinks-'+'Email-'+showId;var EmbedShareID='#sharelinks-'+'Embed-'+showId;var TwitterShareID='#sharelinks-'+'Twitter-'+showId;if(id!=EmailShareID)
$(EmailShareID).shareLinks("close");if(id!=EmbedShareID)
$(EmbedShareID).shareLinks("close");if(id!=TwitterShareID)
$(TwitterShareID).shareLinks("close");if($(id).length<1){var shareOptions={anchor:anchor,url:shareVidPath,title:Title,backgroundInfo:{backgroundClass:'ui-videoPlayer-flyoutBackground',sizes:30},offsetX:offsetX,offsetY:offsetY,positionY:"bottom",positionX:"left",displayAs:displayAs,opener:opener,isRemote:isRemote,emailCaptchaImageUrl:basePath+'Captcha/Captcha.ashx?type=img',emailCaptchaDataPersisterUrl:basePath+'Captcha/Captcha.ashx?type=verify',emailCaptchaTrigger:dialogOptions.emailCaptchaTrigger,videoThumbnail:videoThumbnail,videoDuration:videoDuration,shareID:shareID,shortUrl:ShortUrl,shortUrlProviderID:shortUrlProviderID,shortUrlProviderArgs:shortUrlProviderArgs,friendlyName:typeFriendlyName,shareType:shareType,showId:showId,openModalType:openModalType,videoId:videoID>0?parseInt(videoID):null};if(displayAs=="dialog"&&shareOptions.shareType=="video"&&jQuery.browser.msie&&jQuery.browser.version=="7.0")
{shareOptions.backgroundInfo.backgroundClass2="video_edit_dialog_ie7";}
if(dialogOptions.sharePersister)
shareOptions.dataPersister=dialogOptions.sharePersister;if(!($.isPopulated(dialogOptions.embedPath)))
{if(showId)
shareOptions.embedPath=basePath+'Embed.ashx?'+typeQueryIDName+'='+showId;else
shareOptions.embedPath=basePath+'Embed.ashx?'+typeQueryIDName+'='+shareID;}
shareOptions.links={twitter:{}};shareOptions.links.twitter.appendShortUrl=true;var shareDiv=$('<div id="'+id.replace("#","")+'" />').appendTo(document.body);shareOptions.BaseID=shareButton.attr("id")+"_base";shareDiv.shareLinks(shareOptions);}
else{if($(id).shareLinks("isClosed")){if($.isPopulated($(idVideo))){$(idVideo).shareLinks("close");}
$(id).shareLinks("open");}
else{$(id).shareLinks("close");}}
return false;});}};return pub;}();

