function createNamespace(e){var a=window,d=e.split("."),f=d.length;for(var c=0;c<f;c++){var b=d[c];if(!a[b])a[b]={};a=a[b]}}createNamespace("SoapboxService.Utils");SoapboxService.Utils.CreateEnum=function(){var a={};a.parse=function(h){var e=h.split("|"),f=0;for(var c=e.length-1;c>=0;c--){var g=e[c].trim(),d=false;for(var b in a)if(b==g){f|=a[b];d=true;break}if(d==false)throw new Error("Invalid Enumeration Value")}return f};a.toString=function(d){var b=new Sys.StringBuilder;for(var c in a)if((a[c]&d)!=0){if(b.isEmpty()==false)b.append(" | ");b.append(c)}return b.toString()};a.getName=function(){return name};a.isFlags=function(){return true};var c=arguments.length;for(var b=0;b<c;b+=2)a[arguments[b]]=arguments[b+1];return a};SoapboxService.Utils.GetUrlWithParams=function(a,c){a+=a.indexOf("?")==-1?"?":"";for(var b=0;b<c.length;b++){if(b>0)a+="&";a+=encodeURIComponent(c[b].Name)+"="+encodeURIComponent(c[b].Value.toString())}return a};SoapboxService.Utils.HashCodeFletcher=function(e){var c=e.length,a=65535,b=65535,f=0;while(c){var d=c>360?360:c;c-=d;do{a+=e.charCodeAt(f++);b+=a}while(--d);a=(a&65535)+(a>>16);b=(b&65535)+(b>>16)}a=(a&65535)+(a>>16);b=(b&65535)+(b>>16);return b<<16|a};function checkDefined(a){return typeof a!="undefined"&&null!=a}function checkString(a){return typeof a=="string"&&a.length>0}function checkStringNull(a){return checkString(a)&&a!="null"}function checkFloat(a,c,b){if(parseFloat(a)||0==a){if(checkDefined(c))if(a<c)return false;if(checkDefined(b))if(a>b)return false;return true}return false}function checkInt(a,c,b){if(null!=a&&(typeof a!="string"||""!=a)&&!isNaN(a)){if(checkDefined(c))if(a<c)return false;if(checkDefined(b))if(a>b)return false;return true}return false}function checkObject(a){return typeof a=="object"&&null!=a}function checkFunction(a){return typeof a=="function"}function checkGuid(a){var b=/^\{?[a-fA-F\d]{8}-?([a-fA-F\d]{4}-?){3}[a-fA-F\d]{12}\}?$/;return b.test(a)}function checkArray(b,d,c){var a=b instanceof Array;if(checkInt(d))a=a&&b.length>=d;if(checkInt(c))a=a&&b.length<=c;return a}function isTrue(a){switch(typeof a){case "boolean":return a;case "string":return a.toLowerCase()=="true";default:return false}}createNamespace("Msn.Json");Msn.Json.HttpRequestManager=function(){this.cfg={ENCODING:"responseEncoding",TIMEOUT:20000};var _this=this,_factories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],_factory=null;this.NewRequest=function(){if(null!=_factory)return _factory();for(var a=0;a<_factories.length;a++)try{var b=_factories[a]();if(null!=b){_factory=_factories[a];return b}}catch(c){continue}_factory=function(){throw new error("XMLHttpRequest is not supported")};_factory()};this.MakeRequest=function(vidRequest){var request;try{request=this.NewRequest()}catch(a){vidRequest.ErrCallback(vidRequest.Context);return}var timer=setTimeout(function(){handleTimeout(request,vidRequest.ErrCallback,vidRequest.Context)},this.cfg.TIMEOUT);request.onreadystatechange=function(){if(request.readyState==4){if(timer)clearTimeout(timer);if(request.status==200){var json;eval("json ="+request.responseText);vidRequest.Callback(json,vidRequest.Context)}else vidRequest.ErrCallback(vidRequest.Context)}};vidRequest.AddParam(this.cfg.ENCODING,"json");var verb,url,params;if(vidRequest.HttpMethod=="post"){verb="POST";url=vidRequest.Url;params=encodePostParams(vidRequest.Params())}else{verb="GET";url=vidRequest.UrlWithParams();params=null}request.open(verb,url,true);if(verb=="POST")request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");request.send(params)};function handleTimeout(c,b,a){c.abort();b(a)}function encodePostParams(b){var c=[],d=/%20/g;for(var a=0;a<b.length;a++){var e=encodeURIComponent(b[a].Name).replace(d,"+")+"="+encodeURIComponent(b[a].Value).replace(d,"+");c.push(e)}return c.join("&")}};Msn.HttpRequestManager=new Msn.Json.HttpRequestManager;createNamespace("VideoService");VideoService.RequestFactory=function(g,h){var a=g,b=h;this.Create=function(a,b){switch(a){case VideoService.RequestType.Soapbox:return e();case VideoService.RequestType.VC:return f(b);case VideoService.RequestType.UserVideo:return d();case VideoService.RequestType.UserComments:return c();default:throw"Request type not supported"}};function e(){return new SoapboxService.Request(a)}function f(a){return new VCService.Request(b,a)}function d(){return new UserVideoService.Request(a,b)}function c(){return new UserCommentsService.Request(a,b)}};VideoService.RequestType=SoapboxService.Utils.CreateEnum("Soapbox",0,"VC",1,"UserVideo",2);createNamespace("VideoService");VideoService.RequestManagerFactory=new function(){this.Create=function(a){switch(a){case VideoService.HandlerType.XMLHTTP:return Msn.HttpRequestManager;default:return Msn.VideoRequestManager}}};VideoService.HandlerType=SoapboxService.Utils.CreateEnum("XMLHTTP",0,"AJAX",1);createNamespace("SoapboxService");SoapboxService.Config=function(b,a,c){this.AppServiceId=b;this.GetServiceUrl=function(){var b=typeof a=="string"&&a.length>0?a:"http://video.msn.com";return b+"/SoapboxService2.aspx"};this.HandlerType=c};createNamespace("SoapboxService");SoapboxService.ResultCode=SoapboxService.Utils.CreateEnum("Success",0,"UnknownError",1,"NotSignedIn",2,"OffendingInput",3,"LimitReached",4,"InvalidInput",5,"NicknameNotSet",6,"FeatureNotAvailable",7,"PermissionDenied",8,"BetaNotAuthorized",9,"VideoNotFound",10,"VideoNotEditable",11,"AccessDenied",12,"InvalidTitle",13,"InvalidDescription",14,"InvalidCategory",15,"InvalidTags",16,"InvalidPermission",17,"StorageFull",18,"UnknownFileType",19,"FileNotSpecified",20,"InvalidUserId",21,"InvalidVideoId",22,"InvalidTimeStamp",23,"InvalidHash",24,"InvalidAppServiceId",25,"UploadQuotaExceeded",26,"ABCHServiceDownRetry",27,"ABCHServiceDownFailed",28,"InvalidFriendsList",29,"ReverseIPLookupFailed",30);SoapboxService.NicknameCode=SoapboxService.Utils.CreateEnum("Success",0,"UnknownError",1,"TooManyChanges",2,"TooShort",3,"TooLong",4,"Offensive",5,"InvalidChar",6,"ServiceDown",7,"NotSignedIn",8,"AccessDenied",9,"CannotOverride",10,"AlreadyTaken",-1);SoapboxService.SearchType=SoapboxService.Utils.CreateEnum("Keyword",1,"User",2,"Tag",3,"Favorites",4,"AllVideos",5,"Channel",6,"Recommendations",7,"List",8,"Source",9,"Shared",10);SoapboxService.OffensiveType=SoapboxService.Utils.CreateEnum("Offensive",0,"ChildAbuse",1,"Nudity",2,"Harassment",3,"Copyrighted",4,"RacialDiscrimination",7);SoapboxService.SortOrder=SoapboxService.Utils.CreateEnum("Default",0,"Relevance",0,"Rating",1,"DateUploaded",2,"Playcount",3);SoapboxService.VideoStatus=SoapboxService.Utils.CreateEnum("New",0,"Processing",1,"Published",2,"Failed",3,"Approved",4,"Rejected",5,"Pending",6,"LockedForReview",7);createNamespace("SoapboxService");SoapboxService.Request=function(c){var b=c,a;this.cfg={METHOD:"mn",APPID:"appServiceId"};this.Execute=function(d,i,f,c,h,g){a=new Msn.Json.VideoRequest(b.GetServiceUrl(),f,c,g,h);a.AddParam(this.cfg.METHOD,d);a.AddParam(this.cfg.APPID,b.AppServiceId);a.AddParams(i);var e=VideoService.RequestManagerFactory.Create(b.HandlerType);e.MakeRequest(a)}};createNamespace("VideoService");VideoService.Proxy=function(c,b){var e=this,d=typeof b=="object"&&null!=b?b:VCService.Config.Default(),a=new VideoService.RequestFactory(c,d);this.GetAllUserVideos=function(c,f,d,b,e){var h=a.Create(VideoService.RequestType.Soapbox),g={"maxResults":c,"offset":f};h.Execute("getalluservideos",g,d,b,e)};this.GetUserVideoListPrivate=function(j,f,b,e,k,g,h,d,i){var c=a.Create(VideoService.RequestType.UserVideo),l={"userCid":j,"isPrivate":f,"rct":b,"maxResults":e,"videoType":g,"offset":k};if(b==VCService.UsageEventType.Bookmarked)c.SetAutoFill(true);c.Execute("getuservideolistprivate",l,h,d,i)};this.GetPublicUserVideos=function(f,c,g,d,b,e){var i=a.Create(VideoService.RequestType.UserVideo),h={"userCid":f,"maxResults":c,"offset":g};i.Execute("getpublicuservideos",h,d,b,e)};this.GetSharedUserVideos=function(c,f,d,b,e){var h=a.Create(VideoService.RequestType.Soapbox),g={"maxResults":c,"offset":f};h.Execute("getsharedvideos",g,d,b,e)};this.LoadVideo=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("loadvideo",f,c,b,d)};this.LoadUserVideoData=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("loaduservideodata",f,c,b,d)};this.GetCopyRightResult=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("getcopyrightresult",f,c,b,d)};this.PostComment=function(g,e,c,h,d,b,f){var j=a.Create(VideoService.RequestType.Soapbox),i={"videoId":g,"comment":e,"maxResults":c,"offset":h};j.Execute("postcomment",i,d,b,f,"post")};this.GetComments=function(f,c,g,d,b,e){var i=a.Create(VideoService.RequestType.Soapbox),h={"videoId":f,"maxResults":c,"offset":g};i.Execute("getcomments",h,d,b,e)};this.DeleteComment=function(d,g,c,h,e,b,f){var j=a.Create(VideoService.RequestType.Soapbox),i={"commentId":d,"videoId":g,"maxResults":c,"offset":h};j.Execute("deletecomment",i,e,b,f,"post")};this.GetUserComments=function(f,c,g,d,b,e){var i=a.Create(VideoService.RequestType.UserComments),h={"userCid":f,"maxResults":c,"offset":g};i.Execute("getusercomments",h,d,b,e)};this.AddTag=function(e,h,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"tag":h};g.Execute("addtag",f,c,b,d,"post")};this.AddPrivateTag=function(e,h,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"tag":h};g.Execute("addprivatetag",f,c,b,d,"post")};this.RemoveTag=function(e,h,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"tag":h};g.Execute("removetag",f,c,b,d,"post")};this.RemovePrivateTag=function(e,h,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"tag":h};g.Execute("removeprivatetag",f,c,b,d,"post")};this.LoadUserTags=function(g,d,h,b,e,c,f){var j=a.Create(VideoService.RequestType.Soapbox),i={"userCid":g,"maxResults":d,"offset":h,"alphabetize":b};j.Execute("loadusertags",i,e,c,f)};this.SetVideoRating=function(e,g,c,b,d){var h=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"value":g};h.Execute("setvideorating",f,c,b,d,"post")};this.ClearVideoRating=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("clearvideorating",f,c,b,d,"post")};this.GetCategories=function(c,b,d){var f=a.Create(VideoService.RequestType.Soapbox),e={};f.Execute("getcategories",e,c,b,d,"post")};this.AddFavorite=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("addfavorite",f,c,b,d,"post")};this.RemoveFavorite=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("removefavorite",f,c,b,d,"post")};this.GetCountryCode=function(c,d,b,e){var g=a.Create(VideoService.RequestType.Soapbox),f={"ipAddress":c};g.Execute("getcountrycode",f,d,b,e)};this.GetNickname=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"userCid":e};g.Execute("getnickname",f,c,b,d)};this.SetNickname=function(b,d,c,e){var g=a.Create(VideoService.RequestType.Soapbox),f={"desiredNickname":b};g.Execute("setnickname",f,d,c,e,"post")};this.SetCustomNickname=function(b,d,c,e){var g=a.Create(VideoService.RequestType.Soapbox),f={"desiredNickname":b};g.Execute("setcustomnickname",f,d,c,e,"post")};this.GetUserProperties=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"userCid":e};g.Execute("getuserproperties",f,c,b,d)};this.GetCurrentUserInfo=function(c,b,d){var f=a.Create(VideoService.RequestType.Soapbox),e={};f.Execute("getcurrentuserinfo",e,c,b,d)};this.FlagOffensive=function(g,d,e,c,b,f){var i=a.Create(VideoService.RequestType.Soapbox),h={"videoId":g,"flagType":d,"comment":e};i.Execute("flagoffensive",h,c,b,f,"post")};this.FlagOffensiveComment=function(c,f,d,b,e){var h=a.Create(VideoService.RequestType.Soapbox),g={"videoId":f,"commentId":c};h.Execute("flagoffensivecomment",g,d,b,e,"post")};this.ReportPlayback=function(e,f,c,b,d){var h=a.Create(VideoService.RequestType.Soapbox),g={"videoId":e,"isSkip":f};h.Execute("reportplayback",g,c,b,d,"post")};this.EditVideo=function(e,h,i,g,k,j,c,b,d){var l=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e,"title":h,"desc":i,"catId":g,"tags":k,"perm":j};l.Execute("editvideo",f,c,b,d,"post")};this.DeleteVideo=function(e,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),f={"videoId":e};g.Execute("deletevideo",f,c,b,d,"post")};this.DeleteSharedVideo=function(f,e,c,b,d){var h=a.Create(VideoService.RequestType.Soapbox),g={"videoId":f,"ownerId":e};h.Execute("deletesharedvideo",g,c,b,d,"post")};this.EmailVideo=function(c,e,g,h,d,b,f){var j=a.Create(VideoService.RequestType.Soapbox),i={"toEmailId":c,"fromName":e,"message":g,"videoId":h};j.Execute("emailvideo",i,d,b,f,"post")};this.RecordExpTrigger=function(f,c,b,d){var g=a.Create(VideoService.RequestType.Soapbox),e={"expId":f};g.Execute("recordexptrigger",e,c,b,d,"post")};this.RecordExpObservation=function(c,g,d,b,e){var h=a.Create(VideoService.RequestType.Soapbox),f={"observName":c,"data":g};h.Execute("recordexpobservation",f,d,b,e,"post")};this.GetUploadCredentials=function(g,h,j,i,f,c,b,d){var k=a.Create(VideoService.RequestType.Soapbox),e={"title":g,"desc":h,"tags":j,"perm":i,"catId":f};k.Execute("getuploadcredentials",e,c,b,d,"post")};this.AddPermissions=function(h,d,b,e,f,c,g){var j=a.Create(VideoService.RequestType.Soapbox),i={"videoId":h,"friendsList":d,"newFriendsList":b,"memberType":e};j.Execute("addpermissions",i,f,c,g,"post")};this.DeletePermissions=function(g,c,d,e,b,f){var i=a.Create(VideoService.RequestType.Soapbox),h={"videoId":g,"friendsList":c,"memberType":d};i.Execute("deletepermissions",h,e,b,f,"post")};this.GetActivities=function(h,d,c,f,e,b,g){var j=a.Create(VideoService.RequestType.Soapbox),i={"poolKey":h,"bucketKey":d,"startIndex":c,"endIndex":f};j.Execute("getactivities",i,e,b,g,"post")};this.ReportActivity=function(c,f,d,e,b,g){var i=a.Create(VideoService.RequestType.Soapbox),h={"viewKeys":f,"clickKeys":d,"bucketKey":c};i.Execute("reportactivity",h,e,b,g,"post")}};createNamespace("UserCommentsService");UserCommentsService.Request=function(f,g){var d=this,e=new VideoService.RequestFactory(f,g),c=function(){},b=function(){},a=null;this.Execute=function(d,i,f,a,g){c=f;b=a;var h=e.Create(VideoService.RequestType.Soapbox);h.Execute(d,i,this.OnSbRequestCb,this.OnSbRequestErrCb,g)};this.OnSbRequestCb=function(b,h){if(checkObject(b)&&checkDefined(b.Comments)){a=b;if(b.Comments.length>0){var g="";for(var f=0;f<b.Comments.length;f++){if(f>0)g+=",";g+=b.Comments[f].VideoId}var i=e.Create(VideoService.RequestType.VC,VCService.Domain.Soapbox);i.Execute("videobyuuids",{"uuids":g},d.OnVcRequestCb,d.OnVcRequestErrCb,h)}else c(d.BuildEmptyResult(),h)}};this.OnSbRequestErrCb=function(a){b(a)};this.OnVcRequestCb=function(b,d){if(checkObject(a)&&checkObject(b)){a.Videos=b.Videos;c(a,d)}};this.OnVcRequestErrCb=function(a){b(a)};this.BuildEmptyResult=function(){a.Videos=[];return a}};createNamespace("UserVideoService");UserVideoService.Request=function(g,h){var b=this,f=new VideoService.RequestFactory(g,h),d=function(){},c=function(){},a=null,e=false;this.Execute=function(b,i,e,a,g){d=e;c=a;var h=f.Create(VideoService.RequestType.Soapbox);h.Execute(b,i,this.OnSbRequestCb,this.OnSbRequestErrCb,g)};this.SetAutoFill=function(a){e=isTrue(a)};this.OnSbRequestCb=function(c,e){if(checkObject(c)&&checkDefined(c.VideoIds)){a=c;if(c.VideoIds.length>0){var g=c.VideoIds.join(","),h=f.Create(VideoService.RequestType.VC,VCService.Domain.Soapbox);h.Execute("videobyuuids",{"uuids":g},b.OnVcRequestCb,b.OnVcRequestErrCb,e)}else d(b.BuildEmptyResult(),e)}};this.OnSbRequestErrCb=function(a){c(a)};this.OnVcRequestCb=function(j,l){if(checkObject(a)&&checkObject(j)){var c={},i=a.VideoIds,g=j.Videos,k=i.length,f=g.length;c.SearchKey="uservideolist";c.Videos=g;c.Count=f;if(e&&f<k){var h=b.FindRejectedVideos(i,g);c.Videos=c.Videos.concat(b.CreateRejectedVideos(h));c.Count=f+h.length}c.Offset=a.Offset;c.TotalCount=a.TotalCount;c.SearchType="";d(c,l)}};this.CreateRejectedVideos=function(d){var c=[];for(var b=0;b<d.length;b++){var a={};a.Id=d[b];a.Status=SoapboxService.VideoStatus.Rejected;c.push(a)}return c};this.FindRejectedVideos=function(c,f){var e=c.length,g=f.length,b=[],a=0,d=0;while(d<g){if(c[a]==f[d].Id)d++;else b.push(c[a]);a++}if(a<e)b=b.concat(c.splice(a,e-a));return b};this.OnVcRequestErrCb=function(a){c(a)};this.BuildEmptyResult=function(){var b={};b.SearchKey="uservideolist";b.Videos=[];b.Count=0;b.Offset=a.Offset;b.TotalCount=0;b.SearchType="";return b}};createNamespace("VCService");VCService.Adapter=function(a){this.ConvertSearchResult=function(a,c){var d=null;if(checkObject(a)){var b=this.ConvertVideoList(a);if(checkDefined(b)){var g=c?a.$tag:a.$q,e=c?SoapboxService.SearchType.Tag:SoapboxService.SearchType.Keyword,f=checkInt(a.$total)?a.$total:b.length;d={"SearchKey":g,"Videos":b,"Count":b.length,"Offset":a.$ind-1,"TotalCount":f,"SearchType":e}}}return d};this.ConvertVideoList=function(a){var d=[];if(checkObject(a)&&checkArray(a.video)){var c=a.video;for(var b=0;b<c.length;b++){var e=this.ConvertVideo(c[b]);if(e)d.push(e)}}return d};this.ConvertVideo=function(d){var c={};try{c.CsId=d.csId.$;c.GeoAvailable=this.getVideoGeoAvailable(d);if(!c.GeoAvailable)return null;c.Title=b(d.title.$);c.Description=b(d.description.$);c.Id=d.uuid.$;c.Source=d.source.$;c.SourceFriendlyName=b(d.source.$friendlyName);c.Provider=d.providerId.$;c.MediaFiles=[this.getVideoFileUrl(d,1002),this.getVideoFileUrl(d,1003)];c.StreamLength=d.durationSecs.$;c.StartDate=d.startDate.$;c.ReleaseDate=d.startDate.$;c.RelatedLinks=this.getVideoRelatedLinks(d);c.PosterFrame=this.getFileUrl(d,2009);if(a.UseImageScaling){var e=a.GetRandomImageUrl(c.Id),g=d.$version;if(checkString(e)){var f="{0}/Image.aspx?uuid={1}&w={2}&h={3}";c.Thumbnail=f.format(e,c.Id,112,84);c.MiniThumbnail=f.format(e,c.Id,64,48);c.MediumThumbnail=f.format(e,c.Id,228,171);c.PosterFrame=f.format(e,c.Id,424,318)}}if(c.CsId==a.SoapboxCsId){if(!a.IsSoapboxEnabled)return null;c.Status=this.getVideoStatus(d);c.OwnerId=c.Source;c.OwnerNickname=c.SourceFriendlyName;if(!checkString(c.MediaFiles[VCService.MediaFormat.WMV])&&checkString(c.Id))c.MediaFiles[VCService.MediaFormat.WMV]=a.StreamingHostUrl+"/StreamingUrl.aspx?vid="+c.Id;if(!checkString(c.MediaFiles[VCService.MediaFormat.FLV])&&checkString(c.Id))c.MediaFiles[VCService.MediaFormat.FLV]=a.StreamingHostUrl+"/StreamingUrl.aspx?vid="+c.Id+"&t=.flv";if(!checkString(c.Thumbnail)){c.Thumbnail=this.getFileUrl(d,2007);if(!checkString(c.Thumbnail))c.Thumbnail=this.getFileUrl(d,2008)}c.Channels=this.getVideoCategory(d);c.Market=a.SoapboxMarket;c.PageGroup=this.getVideoPageGroup(d,a.SoapboxPageGroup);c.BSBPageGroup=a.SoapboxBsbPageGroup}else{if(!checkString(c.Thumbnail))c.Thumbnail=this.getFileUrl(d,2007);c.FlashMetadata=this.getFileUrl(d,1201);c.Status=SoapboxService.VideoStatus.Published;c.Market=a.VcMarket;c.PageGroup=this.getVideoPageGroup(d,a.MsnVideoPageGroup);c.BSBPageGroup=a.MsnVideoBsbPageGroup}c.Tags=this.getVideoTags(d,true);c.AllTags=this.getVideoTags(d,false);c.AverageRating=parseFloat(this.getUsage(d,VCService.UsageEventType.Rated,VCService.UsageCounterType.Average));c.PlayCount=this.getUsage(d,VCService.UsageEventType.Played,VCService.UsageCounterType.Total);c.NumComments=this.getUsage(d,VCService.UsageEventType.Reviewed,VCService.UsageCounterType.Total);c.NumFavorites=this.getUsage(d,VCService.UsageEventType.Bookmarked,VCService.UsageCounterType.Total);c.PlayCountExtended=this.getUsage(d,VCService.UsageEventType.Played,VCService.UsageCounterType.Extended);c.NumCommentsExtended=this.getUsage(d,VCService.UsageEventType.Reviewed,VCService.UsageCounterType.Extended);c.NumFavoritesExtended=this.getUsage(d,VCService.UsageEventType.Bookmarked,VCService.UsageCounterType.Extended)}catch(h){c=null}return c};function b(b){var a="";try{tempDiv=document.createElement("DIV");tempDiv.innerHTML=b+"&nbsp;";a=tempDiv.innerText;a=a.replace("\\r\\n","");a=a.replace(/\s*$/g,"")}catch(c){}return a}this.convertExtendedMetadata=function(a){return a};this.getVideoPageGroup=function(b,c){var a=c;if(checkObject(b)&&checkObject(b.pageGroup)&&checkString(b.pageGroup.$))switch(b.pageGroup.$){case "MSVBSB":case "MSVTV3":case "MSVBST":case "MSNFBS":a="MSVV43";break;case "MSNTV4":case "MSNSCB":case "MSCVE4":case "MSVAP4":case "MSVCE4":case "MSVCF4":case "MSVSCB":case "MSVUK4":a="MSVV44";break;case "MSVNPB":case "MSVTVM":case "MSVNP1":a="MSVV42";break;default:if(checkString(c))a=c;else a=b.pageGroup.$}return a};this.getVideoStatus=function(a){var c=null;if(checkObject(a)&&checkObject(a.tags))for(var b=0;b<a.tags.tag.length;b++){var d=a.tags.tag[b];if(d.$namespace=="UserVideoStatus"){c=parseInt(d.$);break}}return c};this.getVideoGeoAvailable=function(c){var b=true;if(c.csId.$==a.SoapboxCsId&&!a.IsSoapboxEnabled)b=false;return b};this.getVideoRelatedLinks=function(a){var d=[];if(checkObject(a)&&checkObject(a.extendedXml)&&checkObject(a.extendedXml.relatedLinks)&&checkObject(a.extendedXml.relatedLinks.link))if(checkDefined(a.extendedXml.relatedLinks.link.length))for(var c=0;c<a.extendedXml.relatedLinks.link.length;c++){var b={};b.url=a.extendedXml.relatedLinks.link[c].$url;b.text=a.extendedXml.relatedLinks.link[c].$;d[c]=b}else{b={};b.url=a.extendedXml.relatedLinks.link.$url;b.text=a.extendedXml.relatedLinks.link.$;d[0]=b}return d};this.getVideoTags=function(a,g){var f=[];if(checkObject(a)&&checkObject(a.tags)){var e=checkArray(a.tags.tag)?a.tags.tag:checkDefined(a.tags.tag)?[a.tags.tag]:[];for(var d=0;d<e.length;d++){var c=e[d];if(!g||c.$namespace=="User"){var b={};b.Name=c.$;b.Namespace=c.$namespace;f.push(b)}}}return f};this.getVideoCategory=function(a){var d=[];if(checkObject(a)&&checkObject(a.tags))for(var b=0;b<a.tags.tag.length;b++){var e=a.tags.tag[b];if(e.$namespace=="Category"){var c={};c.Id=e.$;d[0]=c;break}}return d};this.getVideoFileUrl=function(a,d){var c=null;if(checkObject(a)&&checkObject(a.videoFiles)&&checkObject(a.videoFiles.videoFile))for(var b=0;b<a.videoFiles.videoFile.length;b++)if(a.videoFiles.videoFile[b].$formatCode==d){c=a.videoFiles.videoFile[b].uri.$;break}return c};this.getFileUrl=function(a,d){var c=null;if(checkObject(a)&&checkObject(a.files)&&checkObject(a.files.file))for(var b=0;b<a.files.file.length;b++)if(a.files.file[b].$formatCode==d){c=a.files.file[b].uri.$;break}return c};this.getUsage=function(a,d,e){var c=null;if(checkObject(a)&&checkObject(a.usage)&&checkObject(a.usage.usageItem))for(var b=0;b<a.usage.usageItem.length;b++)if(a.usage.usageItem[b].$counterType==d){switch(e){case VCService.UsageCounterType.Total:c=a.usage.usageItem[b].$totalCount;break;case VCService.UsageCounterType.Average:c=a.usage.usageItem[b].$totalAverage;break;case VCService.UsageCounterType.Extended:c={hourlyCount:a.usage.usageItem[b].$hourlyCount,dailyCount:a.usage.usageItem[b].$dailyCount,weeklyCount:a.usage.usageItem[b].$weeklyCount,monthlyCount:a.usage.usageItem[b].$monthlyCount,allTimes:a.usage.usageItem[b].$totalCount};break}break}return c};this.convertRelatedTagsResult=function(b){var e,d=null;if(checkObject(b)&&checkObject(b.tag)){e=b.$mk==a.SoapboxMarket?VCService.Domain.Soapbox:VCService.Domain.VideoCatalog;d=[];for(var c=0;c<b.tag.length&&c<this.cfg.MAX_RELATED_TAGS;c++){var f={"Type":Msn.CloudEntryType.Tags,"Name":b.tag[c].$name,"Data":e};d.push(f)}}return d};this.convertTemplate=function(b){var a=null;if(checkObject(b)&&checkObject(b.template)){var c,g=b.template,f=["default","g0","g1","g2"];for(var e=0;e<f.length;e++){var d=f[e];if(checkDefined(g[d])){a={};a.type=d;c=g[d];break}}if(checkObject(a)&&checkObject(c)){a.label=b.$label;a.menuId=b.$id;switch(a.type){case "default":a.videosUrl=c.videosRef.$videosUrl;break;case "g0":case "g1":case "g2":a.header=this.convertTemplateHeader(c.header);a.section=this.convertTemplateSection(c.section);break}}}return a};this.convertTemplateHeader=function(a){var d=[];if(checkObject(a))for(var b=0;b<a.length;b++)try{var c={};c.imageUrl=a[b].$imageUrl;c.videoRef=a[b].$videoRef;c.caption=a[b].$caption;c.headline=a[b].$headline;c.copyright=a[b].$copyright;d.push(c)}catch(e){}return d};this.convertTemplateSection=function(a){var d=[];if(checkObject(a))for(var b=0;b<a.length;b++)try{var c={};c.title=a[b].$title;c.imageUrl=a[b].$imageUrl;c.videosUrl=a[b].videosRef.$videosUrl;d.push(c)}catch(e){}return d}};createNamespace("VCService");VCService.Config=function(){var b=[],a=[];this.VCServiceUrl="http://catalog.video.msn.com";this.SoapboxMarket="uv-en-us";this.VcMarket="us";this.RandomServerArray=[];this.RandomImageUrlArray=[];this.Lcid="";this.SoapboxCsId="";this.IsSoapboxEnabled=true;this.UseImageScaling=true;this.MaxRelatedTags=25;this.MsnVideoPageGroup="";this.SoapboxPageGroup="";this.MsnVideoBsbPageGroup="";this.SoapboxBsbPageGroup="";this.StreamingHostUrl="";this.GetFilter=function(){return this.GetFilterMask().toString(16)};this.GetFilterMask=function(){var b=0;for(var c=0;c<a.length;c++)b=b|a[c];return b};this.GetUsageCounters=function(){return b.join(",")};this.AddFilter=function(b){a.push(b)};this.AddUsageCounter=function(a){b.push(a)};this.GetServiceUrl=function(b){var a=this.VCServiceUrl;if(checkArray(this.RandomServerArray)&&this.RandomServerArray.length>0){var c=Math.abs(SoapboxService.Utils.HashCodeFletcher(b));a=this.RandomServerArray[c%this.RandomServerArray.length]}return a};this.GetRandomImageUrl=function(b){var a=this.VCServiceUrl;if(checkArray(this.RandomImageUrlArray)&&this.RandomImageUrlArray.length>0){var c=Math.abs(SoapboxService.Utils.HashCodeFletcher(b));a=this.RandomImageUrlArray[c%this.RandomImageUrlArray.length]}return a}};VCService.Config.Default=function(){var a=new VCService.Config;a.AddFilter(VCService.FilterType.HasThumbnail);a.AddFilter(VCService.FilterType.IsPublished);a.AddFilter(VCService.FilterType.HasFlash);a.AddUsageCounter(VCService.UsageEventType.Played);a.AddUsageCounter(VCService.UsageEventType.Rated);a.AddUsageCounter(VCService.UsageEventType.Reviewed);a.AddUsageCounter(VCService.UsageEventType.Bookmarked);a.SoapboxMarket="uv-en-us";a.VCMarket="us";a.ServiceUrl="http://catalog.video.msn.com";a.RandomServerArray=["http://edge1.catalog.video.msn.com","http://edge2.catalog.video.msn.com","http://edge3.catalog.video.msn.com","http://edge4.catalog.video.msn.com","http://edge5.catalog.video.msn.com"];return a};createNamespace("VCService");VCService.UsageEventType=SoapboxService.Utils.CreateEnum("Played",1,"Emailed",2,"Rated",3,"Blogged",4,"Reviewed",5,"Bookmarked",6,"PlaybackFailed",7,"TimeSpent",8,"Recommended",9);VCService.UsageCounterType=SoapboxService.Utils.CreateEnum("Total",0,"Average",1,"Extended",2);VCService.FilterType=SoapboxService.Utils.CreateEnum("HasWmv",1,"HasFlash",2,"HasThumbnail",8,"HasMediumImg",16,"IsPublished",128);VCService.Domain=SoapboxService.Utils.CreateEnum("Soapbox",0,"VideoCatalog",1);VCService.MediaFormat=SoapboxService.Utils.CreateEnum("WMV",0,"FLV",1);createNamespace("VCService");VCService.Request=function(k,e){var l=this,b=k,j=typeof e!="undefined"&&null!=e?e:VCService.Domain.Soapbox,d=new VCService.Adapter(b),a,h={"videobyuuid":"video","videobyuuids":"videolist","videobytag":"searchresult","search":"searchresult"},f,g=function(){},c=function(){};this.OverrideFilter=null;this.OverrideCounter=null;this.OverrideLcid=null;this.ConvertOutput=true;this.Execute=function(e,n,l,i,m){var r=checkString(this.OverrideFilter)?this.OverrideFilter:b.GetFilter(),q=checkString(this.OverrideCounter)?this.OverrideCounter:b.GetUsageCounters(),o=checkString(this.OverrideLcid)?this.OverrideLcid:b.Lcid;g=l;c=i;f=h[e];a=new Msn.Json.VideoRequest(e+".aspx?",this.OnVcRequestCb,this.OnVcRequestErrCb,"get",m);j==VCService.Domain.Soapbox?a.AddParam("mk",b.SoapboxMarket):a.AddParam("mk",b.VcMarket);a.AddParam("ff",r);a.AddParam("rct",q);a.AddParam("lcid",o);a.AddParams(n);var p=a.UrlWithParams(),d=b.GetServiceUrl(p),k=d.substr(d.length-1)=="/"?"":"/";a.Url=d+k+a.Url;Msn.VideoRequestManager.MakeRequest(a)};this.OnVcRequestCb=function(d,b){var a=d;if(l.ConvertOutput)a=i(d);if(null!=a)g(a,b);else c(b)};this.OnVcRequestErrCb=function(a){c(a)};function i(a){switch(f){case "video":return {"Video":d.ConvertVideo(a)};case "videolist":return {"Videos":d.ConvertVideoList(a)};case "searchresult":return d.ConvertSearchResult(a);default:}}};VCService.Sort=function(c,b,a){this.GetPrimary=function(){return checkInt(c)?c:""};this.GetSecondary=function(){return checkString(b)?b:""};this.GetSortDirection=function(){return checkInt(a)?a:""}};createNamespace("Msn.Json");Msn.Json.VideoRequestManager=function(){var _this=this,_requests=[],_maxRequestId=0,_scriptDiv=null;this.cfg={ENCODING:"responseEncoding",CALLBACK:"callbackName",CALLBACK_DATA:"cd",TIMEOUT:20000};var Request=function(d,e,f,c,a,b){this.Id=d;this.ReqId=e;this.Callback=c;this.CallbackData=b;this.ErrCallback=a;this.Cancelled=false};this.MakeRequest=function(a){var b=null;if(typeof a!="undefined"&&null!=a){if(_scriptDiv==null){_scriptDiv=document.createElement("div");document.body.appendChild(_scriptDiv)}var d=_maxRequestId++;b=SoapboxService.Utils.HashCodeFletcher(a.UrlWithParams());for(var e=0;e<_requests.length;e++)if(_requests[e].Id==b){b+="_"+d;break}a.AddParam(this.cfg.ENCODING,"json");a.AddParam(this.cfg.CALLBACK,"Msn.VideoRequestManager.DoCallback");a.AddParam(this.cfg.CALLBACK_DATA,b);var f=a.UrlWithParams(),g=new Request(d,b,f,a.Callback,a.ErrCallback,a.Context);_requests.push(g);var c=document.createElement("script");c.id="VideoRequest"+d;_scriptDiv.appendChild(c);window.setTimeout(function(){handleTimeout(b)},this.cfg.TIMEOUT);c.src=f}return b};function handleTimeout(b){for(var a=0;a<_requests.length;a++)if(_requests[a].ReqId==b&&!_requests[a].Cancelled){_requests[a].Cancelled=true;_requests[a].ErrCallback(_requests[a].CallbackData);cleanup(_requests[a].Id);break}}this.DoCallback=function(obj,reqId,error){for(var i=0;i<_requests.length;i++)if(_requests[i].ReqId==reqId){var req=_requests[i];_requests.splice(i,1);if(!req.Cancelled)if(checkError(error))req.ErrCallback(req.CallbackData);else{var result=eval(obj);req.Callback(result,req.CallbackData)}cleanup(req.Id);obj=null;break}};function checkError(a){if(typeof a=="string"&&a.length>0)return true;return false}function cleanup(b){var a=document.getElementById("VideoRequest"+b);setTimeout(function(){if(a&&a.parentNode)a.parentNode.removeChild(a)},100)}};Msn.Json.VideoRequest=function(f,c,d,e,b){var a=[];this.Url=f;this.HttpMethod=typeof e=="string"?e:"get";this.Callback=typeof c=="function"?c:function(){};this.ErrCallback=typeof d=="function"?d:function(){};this.Context=typeof b=="object"&&null!=b?b:{};this.AddParam=function(c,b){a.push(new Msn.Json.Param(c,b))};this.AddParams=function(c){var b;for(b in c)a.push(new Msn.Json.Param(b,c[b]))};this.Params=function(){return a};this.UrlWithParams=function(){return SoapboxService.Utils.GetUrlWithParams(this.Url,a)}};Msn.Json.Param=function(b,a){this.Name=b;this.Value=a};Msn.VideoRequestManager=new Msn.Json.VideoRequestManager;function moreContent(f,c,d,e){if(typeof document.getElementById(f)!="undefined"&&null!=document.getElementById(f)){var g=document.getElementById(f);if(e)g.className="moreTabActive";else g.className="moreButton_container"}if(typeof document.getElementById(d)!="undefined"&&null!=document.getElementById(d)){var a=document.getElementById(d);if(e)if(typeof a.srcup!="undefined")a.src=a.srcup;else a.src="/i/header/moreDropdown_UpArrow.gif";else if(typeof a.srcdown!="undefined")a.src=a.srcdown;else a.src="/i/header/moreDropdown_DownArrow.gif"}if(typeof document.getElementById(c)!="undefined"&&null!=document.getElementById(c)){var b=document.getElementById(c);if(e){b.style.visibility="visible";b.style.display="inline"}else{b.style.visibility="hidden";b.style.display="block"}}}var s=s_gi(s_account);s.currencyCode="USD";s.trackDownloadLinks=true;s.trackExternalLinks=false;s.trackInlineStats=true;s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls";s.linkLeaveQueryString=false;s.linkTrackVars="None";s.linkTrackEvents="None";s.visitorNamespace="msnportal";s.usePlugins=true;function s_doPlugins(a){a.readCTcookie()}s.doPlugins=s_doPlugins;s.startLinkTracking=new Function("c","u","v","var s=this,i,lt,ltv,a=new Array;a=v.split('|');ltv='';for(var x=0;x<a.length;x++){i=a[x].indexOf('=');ltv+=a[x].substring(0,i)+',';s[a[x].substring(0,i)]=a[x].substring(i+1,a[x].length);}s.linkTrackVars=ltv;s.trackExternalLinks=true;lt=s.lt(u);if(lt.length==0) {s.tl(this,'e', c);}if(lt=='e'){s.linkType=lt;s.linkName='Custom Link Tracking';return '';}else{s.trackExternalLinks=false;s.c_w(c,v,0);return '';}");s.readCTcookie=new Function("var s=this,cval,i,a=new Array;cval=s.c_r('s_msnct');if(cval){a=cval.split('|');for(var x=0;x<a.length;x++){i=a[x].indexOf('=');s[a[x].substring(0,i)]=a[x].substring(i+1,a[x].length);}s.c_w('s_msnct','',0);}return '';");s.getQueryParam=new Function("qp","d","var s=this,v='',d=d?d:'',i,t;while(qp){i=qp.indexOf(',');i=i<0?qp.length:i;t=s.gcgi(qp.substring(0,i));if(t)v+=v?d+t:t;qp=qp.substring(i==qp.length?i:i+1)}return v");s.gcgi=new Function("k","var v='',s=this;if(k&&s.wd.location.search){var q=s.wd.location.search.toLowerCase(),qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s.pt(q,'&','cgif',k.toLowerCase())}return v");s.cgif=new Function("t","k","if(t){var s=this,i=t.indexOf('='),sk=i<0?t:t.substring(0,i),sv=i<0?'True':t.substring(i+1);if(sk.toLowerCase()==k)return s.epa(sv)}return ''");s.getANID=new Function("var anon=s.c_r('ANON');if(anon){var a=anon.split('&');for(var x=0;x<a.length;x++){i=a[x].indexOf('=');if('a'==a[x].substring(0,i).toLowerCase())return a[x].substring(i+1,a[x].length);}}");s.setMSNProps=new Function("var s=this,d=new Date;m=d.getUTCMonth()+1;y=d.getUTCFullYear();s.evar1=m+'/'+y;s.evar2=m+'/'+d.getUTCDate()+'/'+y;s.prop29=unescape(s.wd.location.href.match('[^?#]*'));s.prop23=s.getANID();");s.setMSNProps();var s_objectID;function s_c2fe(b){var f="",c=0,a,g,e,d;while(1){a=b.indexOf('"',c);e=b.indexOf("\\",c);d=b.indexOf("\n",c);if(a<0||e>=0&&e<a)a=e;if(a<0||d>=0&&d<a)a=d;if(a>=0){f+=(a>c?b.substring(c,a):"")+(a==d?"\\n":"\\"+b.substring(a,a+1));c=a+1}else return f+b.substring(c)}return b}function s_c2fa(d){var b=d.indexOf("(")+1,e=d.indexOf(")"),a="",c;while(b>=0&&b<e){c=d.substring(b,b+1);if(c==",")a+='","';else if(("\n\r\t ").indexOf(c)<0)a+=c;b++}return a?'"'+a+'"':a}function s_c2f(cc){cc=""+cc;var fc="var f=new Function(",s=cc.indexOf(";",cc.indexOf("{")),e=cc.lastIndexOf("}"),o,a,d,q,c,f,h,x;fc+=s_c2fa(cc)+',"var s=new Object;';c=cc.substring(s+1,e);s=c.indexOf("function");while(s>=0){d=1;q="";x=0;f=c.substring(s);a=s_c2fa(f);e=o=c.indexOf("{",s);e++;while(d>0){h=c.substring(e,e+1);if(q){if(h==q&&!x)q="";if(h=="\\")x=x?0:1;else x=0}else{if(h=='"'||h=="'")q=h;if(h=="{")d++;if(h=="}")d--}if(d>0)e++}c=c.substring(0,s)+"new Function("+(a?a+",":"")+'"'+s_c2fe(c.substring(o+1,e))+'")'+c.substring(e+1);s=c.indexOf("function")}fc+=s_c2fe(c)+';return s");';eval(fc);return f}function s_gi(un,pg,ss){var c="function s_c(un,pg,ss){var s=this;s.wd=window;if(!s.wd.s_c_in){s.wd.s_c_il=new Array;s.wd.s_c_in=0;}s._il=s.wd.s_c_il;s._in=s.wd.s_c_in;s._il[s._in]=s;s.wd.s_c_in++;s.m=function(m){return (''+m).indexOf('{')<0};s.fl=function(x,l){return x?(''+x).substring(0,l):x};s.co=function(o){if(!o)return o;var n=new Object,x;for(x in o)if(x.indexOf('select')<0&&x.indexOf('filter')<0)n[x]=o[x];return n};s.num=function(x){x=''+x;for(var p=0;p<x.length;p++)if(('0123456789').indexOf(x.substring(p,p+1))<0)return 0;return 1};s.rep=function(x,o,n){var i=x.indexOf(o),l=n.length>0?n.length:1;while(x&&i>=0){x=x.substring(0,i)+n+x.substring(i+o.length);i=x.indexOf(o,i+l)}return x};s.ape=function(x){var s=this,i;x=x?s.rep(escape(''+x),'+','%2B'):x;if(x&&s.charSet&&s.em==1&&x.indexOf('%u')<0&&x.indexOf('%U')<0){i=x.indexOf('%');while(i>=0){i++;if(('89ABCDEFabcdef').indexOf(x.substring(i,i+1))>=0)return x.substring(0,i)+'u00'+x.substring(i);i=x.indexOf('%',i)}}return x};s.epa=function(x){var s=this;return x?unescape(s.rep(''+x,'+',' ')):x};s.pt=function(x,d,f,a){var s=this,t=x,z=0,y,r;while(t){y=t.indexOf(d);y=y<0?t.length:y;t=t.substring(0,y);r=s.m(f)?s[f](t,a):f(t,a);if(r)return r;z+=y+d.length;t=x.substring(z,x.length);t=z<x.length?t:''}return ''};s.isf=function(t,a){var c=a.indexOf(':');if(c>=0)a=a.substring(0,c);if(t.substring(0,2)=='s_')t=t.substring(2);return (t!=''&&t==a)};s.fsf=function(t,a){var s=this;if(s.pt(a,',','isf',t))s.fsg+=(s.fsg!=''?',':'')+t;return 0};s.fs=function(x,f){var s=this;s.fsg='';s.pt(x,',','fsf',f);return s.fsg};s.c_d='';s.c_gdf=function(t,a){var s=this;if(!s.num(t))return 1;return 0};s.c_gd=function(){var s=this,d=s.wd.location.hostname,n=s.cookieDomainPeriods,p;if(d&&!s.c_d){n=n?parseInt(n):2;n=n>2?n:2;p=d.lastIndexOf('.');while(p>=0&&n>1){p=d.lastIndexOf('.',p-1);n--}s.c_d=p>0&&s.pt(d,'.','c_gdf',0)?d.substring(p):''}return s.c_d};s.c_r=function(k){var s=this;k=s.ape(k);var c=' '+s.d.cookie,i=c.indexOf(' '+k+'='),e=i<0?i:c.indexOf(';',i),v=i<0?'':s.epa(c.substring(i+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''};s.c_w=function(k,v,e){var s=this,d=s.c_gd(),l=s.cookieLifetime,t;v=''+v;l=l?(''+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){t=(v!=''?parseInt(l?l:0):-60);if(t){e=new Date;e.setTime(e.getTime()+(t*1000))}}if(k&&l!='NONE'){s.d.cookie=k+'='+s.ape(v!=''?v:'[[B]]')+'; path=/;'+(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?' domain='+d+';':'');return s.c_r(k)==v}return 0};s.eh=function(o,e,r,f){var s=this,b='s_'+e+'_'+s._in,n=-1,l,i,x;if(!s.ehl)s.ehl=new Array;l=s.ehl;for(i=0;i<l.length&&n<0;i++){if(l[i].o==o&&l[i].e==e)n=i}if(n<0){n=i;l[n]=new Object}x=l[n];x.o=o;x.e=e;f=r?x.b:f;if(r||f){x.b=r?0:o[e];x.o[e]=f}if(x.b){x.o[b]=x.b;return b}return 0};s.cet=function(f,a,t,o,b){var s=this,r;if(s.isie&&a.apv>=5)eval('try{r=s.m(f)?s[f](a):f(a)}catch(e){r=s.m(t)?s[t](e):t(e)}');else{if(s.ismac&&s.u.indexOf('MSIE 4')>=0)r=s.m(b)?s[b](a):b(a);else{s.eh(s.wd,'onerror',0,o);r=s.m(f)?s[f](a):f(a);s.eh(s.wd,'onerror',1)}}return r};s.gtfset=function(e){var s=this;return s.tfs};s.gtfsoe=new Function('e','var s=s_c_il['+s._in+'];s.eh(window,\"onerror\",1);s.etfs=1;var c=s.t();s.etfs=0;return true');s.gtfsfb=function(a){return window};s.gtfsf=function(w){var s=this,p=w.parent,l=w.location;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.host){s.tfs=p;return s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){var s=this;if(!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet('gtfsf',s.tfs,'gtfset',s.gtfsoe,'gtfsfb')}return s.tfs};s.ca=function(){var s=this,imn='s_i_'+s.fun;if(s.d.images&&s.apv>=3&&!s.isopera&&(s.ns6<0||s.apv>=6.1)){s.ios=1;if(!s.d.images[imn]&&(!s.isns||(s.apv<4||s.apv>=5))){s.d.write('<im'+'g style=\"display:none;\" name=\"'+imn+'\" height=1 width=1 border=0 alt=\"\">');if(!s.d.images[imn])s.ios=0}}};s.mr=function(sess,q,ta){var s=this,ns=s.visitorNamespace,unc=s.rep(s.fun,'_','-'),imn='s_i_'+s.fun,im,b,e,rs='http'+(s.ssl?'s':'')+'://'+(ns?ns:(s.ssl?'102':unc))+'.112.2O7.net/b/ss/'+s.un+'/1/H.1-pdv-2/'+sess+'?[AQB]&ndh=1'+(q?q:'')+(s.q?s.q:'')+'&[AQE]';if(s.isie&&!s.ismac){if(s.apv>5.5)rs=s.fl(rs,4095);else rs=s.fl(rs,2047)}if(s.ios){im=s.wd[imn]?s.wd[imn]:s.d.images[imn];if(!im)im=s.wd[imn]=new Image;im.src=rs;if(rs.indexOf('&pe=')>=0&&(!ta||ta=='_self'||ta=='_top'||(s.wd.name&&ta==s.wd.name))){b=e=new Date;while(e.getTime()-b.getTime()<500)e=new Date}return ''}return '<im'+'g sr'+'c=\"'+rs+'\" width=1 height=1 border=0 alt=\"\">'};s.gg=function(v){var s=this;return s.wd['s_'+v]};s.glf=function(t,a){if(t.substring(0,2)=='s_')t=t.substring(2);var s=this,v=s.gg(t);if(v)s[t]=v};s.gl=function(v){var s=this;s.pt(v,',','glf',0)};s.gv=function(v){var s=this;return s['vpm_'+v]?s['vpv_'+v]:s[v]};s.havf=function(t,a){var s=this,b=t.substring(0,4),x=t.substring(4),n=parseInt(x),k='g_'+t,m='vpm_'+t,q=t,v=s.linkTrackVars,e=s.linkTrackEvents;s[k]=s.gv(t);if(s.lnk||s.eo){v=v?v+','+s.vl_l:'';if(v&&!s.pt(v,',','isf',t))s[k]='';if(t=='events'&&e)s[k]=s.fs(s[k],e)}s[m]=0;if(t=='pageURL')q='g';else if(t=='referrer')q='r';else if(t=='charSet'){q='ce';if(s[k]&&s.em==2)s[k]='UTF-8'}else if(t=='visitorNamespace')q='ns';else if(t=='cookieDomainPeriods')q='cdp';else if(t=='cookieLifetime')q='cl';else if(t=='visitVariableProvider')q='vvp';else if(t=='currencyCode')q='cc';else if(t=='channel')q='ch';else if(t=='campaign')q='v0';else if(s.num(x)) {if(b=='prop')q='c'+n;else if(b=='eVar')q='v'+n;else if(b=='hier'){q='h'+n;s[k]=s.fl(s[k],255)}}if(s[k]&&t!='linkName'&&t!='linkType')s.qav+='&'+q+'='+s.ape(s[k]);return ''};s.hav=function(){var s=this;s.qav='';s.pt(s.vl_t,',','havf',0);return s.qav};s.lnf=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';var te=t.indexOf('=');if(t&&te>0&&h.indexOf(t.substring(te+1))>=0)return t.substring(0,te);return ''};s.ln=function(h){var s=this,n=s.linkNames;if(n)return s.pt(n,',','lnf',h);return ''};s.ltdf=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';var qi=h.indexOf('?');h=qi>=0?h.substring(0,qi):h;if(t&&h.substring(h.length-(t.length+1))=='.'+t)return 1;return 0};s.ltef=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';if(t&&h.indexOf(t)>=0)return 1;return 0};s.lt=function(h){var s=this,lft=s.linkDownloadFileTypes,lef=s.linkExternalFilters,lif=s.linkInternalFilters;lif=lif?lif:s.wd.location.hostname;h=h.toLowerCase();if(s.trackDownloadLinks&&lft&&s.pt(lft,',','ltdf',h))return 'd';if(s.trackExternalLinks&&(lef||lif)&&(!lef||s.pt(lef,',','ltef',h))&&(!lif||!s.pt(lif,',','ltef',h)))return 'e';return ''};s.lc=new Function('e','var s=s_c_il['+s._in+'],b=s.eh(this,\"onclick\");s.lnk=s.co(this);s.t();s.lnk=0;if(b)return this[b](e);return true');s.bc=new Function('e','var s=s_c_il['+s._in+'];if(s.d&&s.d.all&&s.d.all.cppXYctnr)return;s.eo=e.srcElement?e.srcElement:e.target;s.t();s.eo=0');s.ot=function(o){var a=o.type,b=o.tagName;return (a&&a.toUpperCase?a:b&&b.toUpperCase?b:o.href?'A':'').toUpperCase()};s.oid=function(o){var s=this,t=s.ot(o),p=o.protocol,c=o.onclick,n='',x=0;if(!o.s_oid){if(o.href&&(t=='A'||t=='AREA')&&(!c||!p||p.toLowerCase().indexOf('javascript')<0))n=o.href;else if(c){n=s.rep(s.rep(s.rep(s.rep(''+c,\"\\r\",''),\"\\n\",''),\"\\t\",''),' ','');x=2}else if(o.value&&(t=='INPUT'||t=='SUBMIT')){n=o.value;x=3}else if(o.src&&t=='IMAGE')n=o.src;if(n){o.s_oid=s.fl(n,100);o.s_oidt=x}}return o.s_oid};s.rqf=function(t,un){var s=this,e=t.indexOf('='),u=e>=0?','+t.substring(0,e)+',':'';return u&&u.indexOf(','+un+',')>=0?s.epa(t.substring(e+1)):''};s.rq=function(un){var s=this,c=un.indexOf(','),v=s.c_r('s_sq'),q='';if(c<0)return s.pt(v,'&','rqf',un);return s.pt(un,',','rq',0)};s.sqp=function(t,a){var s=this,e=t.indexOf('='),q=e<0?'':s.epa(t.substring(e+1));s.sqq[q]='';if(e>=0)s.pt(t.substring(0,e),',','sqs',q);return 0};s.sqs=function(un,q){var s=this;s.squ[un]=q;return 0};s.sq=function(q){var s=this,k='s_sq',v=s.c_r(k),x,c=0;s.sqq=new Object;s.squ=new Object;s.sqq[q]='';s.pt(v,'&','sqp',0);s.pt(s.un,',','sqs',q);v='';for(x in s.squ)s.sqq[s.squ[x]]+=(s.sqq[s.squ[x]]?',':'')+x;for(x in s.sqq)if(x&&s.sqq[x]&&(x==q||c<2)){v+=(v?'&':'')+s.sqq[x]+'='+s.ape(x);c++}return s.c_w(k,v,0)};s.wdl=new Function('e','var s=s_c_il['+s._in+'],r=true,b=s.eh(s.wd,\"onload\"),i,o,oc;if(b)r=this[b](e);for(i=0;i<s.d.links.length;i++){o=s.d.links[i];oc=o.onclick?\"\"+o.onclick:\"\";if((oc.indexOf(\"s_gs(\")<0||oc.indexOf(\".s_oc(\")>=0)&&oc.indexOf(\".tl(\")<0)s.eh(o,\"onclick\",0,s.lc);}return r');s.wds=function(){var s=this;if(s.apv>3&&(!s.isie||!s.ismac||s.apv>=5)){if(s.b&&s.b.attachEvent)s.b.attachEvent('onclick',s.bc);else if(s.b&&s.b.addEventListener)s.b.addEventListener('click',s.bc,false);else s.eh(s.wd,'onload',0,s.wdl)}};s.vs=function(x){var s=this,v=s.visitorSampling,g=s.visitorSamplingGroup,k='s_vsn_'+s.un+(g?'_'+g:''),n=s.c_r(k),e=new Date,y=e.getYear();e.setYear(y+10+(y<1900?1900:0));if(v){v*=100;if(!n){if(!s.c_w(k,x,e))return 0;n=x}if(n%10000>v)return 0}return 1};s.dyasmf=function(t,m){if(t&&m&&m.indexOf(t)>=0)return 1;return 0};s.dyasf=function(t,m){var s=this,i=t?t.indexOf('='):-1,n,x;if(i>=0&&m){var n=t.substring(0,i),x=t.substring(i+1);if(s.pt(x,',','dyasmf',m))return n}return 0};s.uns=function(){var s=this,x=s.dynamicAccountSelection,l=s.dynamicAccountList,m=s.dynamicAccountMatch,n,i;s.un.toLowerCase();if(x&&l){if(!m)m=s.wd.location.host;if(!m.toLowerCase)m=''+m;l=l.toLowerCase();m=m.toLowerCase();n=s.pt(l,';','dyasf',m);if(n)s.un=n}i=s.un.indexOf(',');s.fun=i<0?s.un:s.un.substring(0,i)};s.t=function(){var s=this,trk=1,tm=new Date,sed=Math&&Math.random?Math.floor(Math.random()*10000000000000):tm.getTime(),sess='s'+Math.floor(tm.getTime()/10800000)%10+sed,yr=tm.getYear(),vt=tm.getDate()+'/'+tm.getMonth()+'/'+(yr<1900?yr+1900:yr)+' '+tm.getHours()+':'+tm.getMinutes()+':'+tm.getSeconds()+' '+tm.getDay()+' '+tm.getTimezoneOffset(),tfs=s.gtfs(),ta='',q='',qs='';s.uns();if(!s.q){var tl=tfs.location,x='',c='',v='',p='',bw='',bh='',j='1.0',k=s.c_w('s_cc','true',0)?'Y':'N',hp='',ct='',pn=0,ps;if(s.apv>=4)x=screen.width+'x'+screen.height;if(s.isns||s.isopera){if(s.apv>=3){j='1.1';v=s.n.javaEnabled()?'Y':'N';if(s.apv>=4){j='1.2';c=screen.pixelDepth;bw=s.wd.innerWidth;bh=s.wd.innerHeight;if(s.apv>=4.06)j='1.3'}}s.pl=s.n.plugins}else if(s.isie){if(s.apv>=4){v=s.n.javaEnabled()?'Y':'N';j='1.2';c=screen.colorDepth;if(s.apv>=5){bw=s.d.documentElement.offsetWidth;bh=s.d.documentElement.offsetHeight;j='1.3';if(!s.ismac&&s.b){s.b.addBehavior('#default#homePage');hp=s.b.isHomePage(tl)?\"Y\":\"N\";s.b.addBehavior('#default#clientCaps');ct=s.b.connectionType}}}else r=''}if(s.pl)while(pn<s.pl.length&&pn<30){ps=s.fl(s.pl[pn].name,100)+';';if(p.indexOf(ps)<0)p+=ps;pn++}s.q=(x?'&s='+s.ape(x):'')+(c?'&c='+s.ape(c):'')+(j?'&j='+j:'')+(v?'&v='+v:'')+(k?'&k='+k:'')+(bw?'&bw='+bw:'')+(bh?'&bh='+bh:'')+(ct?'&ct='+s.ape(ct):'')+(hp?'&hp='+hp:'')+(p?'&p='+s.ape(p):'')}if(s.usePlugins)s.doPlugins(s);var l=s.wd.location,r=tfs.document.referrer;if(!s.pageURL)s.pageURL=s.fl(l?l:'',255);if(!s.referrer)s.referrer=s.fl(r?r:'',255);if(s.lnk||s.eo){var o=s.eo?s.eo:s.lnk;if(!o)return '';var p=s.gv('pageName'),w=1,t=s.ot(o),n=s.oid(o),x=o.s_oidt,h,l,i,oc;if(s.eo&&o==s.eo){while(o&&!n&&t!='BODY'){o=o.parentElement?o.parentElement:o.parentNode;if(!o)return '';t=s.ot(o);n=s.oid(o);x=o.s_oidt}oc=o.onclick?''+o.onclick:'';if((oc.indexOf(\"s_gs(\")>=0&&oc.indexOf(\".s_oc(\")<0)||oc.indexOf(\".tl(\")>=0)return ''}ta=o.target;h=o.href?o.href:'';i=h.indexOf('?');h=s.linkLeaveQueryString||i<0?h:h.substring(0,i);l=s.linkName?s.linkName:s.ln(h);t=s.linkType?s.linkType.toLowerCase():s.lt(h);if(t&&(h||l))q+='&pe=lnk_'+(t=='d'||t=='e'?s.ape(t):'o')+(h?'&pev1='+s.ape(h):'')+(l?'&pev2='+s.ape(l):'');else trk=0;if(s.trackInlineStats){if(!p){p=s.gv('pageURL');w=0}t=s.ot(o);i=o.sourceIndex;if(s.gg('objectID')){n=s.gg('objectID');x=1;i=1}if(p&&n&&t)qs='&pid='+s.ape(s.fl(p,255))+(w?'&pidt='+w:'')+'&oid='+s.ape(s.fl(n,100))+(x?'&oidt='+x:'')+'&ot='+s.ape(t)+(i?'&oi='+i:'')}}if(!trk&&!qs)return '';var code='';if(trk&&s.vs(sed))code=s.mr(sess,(vt?'&t='+s.ape(vt):'')+s.hav()+q+(qs?qs:s.rq(s.un)),ta);s.sq(trk?'':qs);s.lnk=s.eo=s.linkName=s.linkType=s.wd.s_objectID='';return code};s.tl=function(o,t,n){var s=this;s.lnk=s.co(o);s.linkType=t;s.linkName=n;s.t()};s.ssl=(s.wd.location.protocol.toLowerCase().indexOf('https')>=0);s.d=document;s.b=s.d.body;s.n=navigator;s.u=s.n.userAgent;s.ns6=s.u.indexOf('Netscape6/');var apn=s.n.appName,v=s.n.appVersion,ie=v.indexOf('MSIE '),i;if(v.indexOf('Opera')>=0||s.u.indexOf('Opera')>=0)apn='Opera';s.isie=(apn=='Microsoft Internet Explorer');s.isns=(apn=='Netscape');s.isopera=(apn=='Opera');s.ismac=(s.u.indexOf('Mac')>=0);if(ie>0){s.apv=parseInt(i=v.substring(ie+5));if(s.apv>3)s.apv=parseFloat(i)}else if(s.ns6>0)s.apv=parseFloat(s.u.substring(s.ns6+10));else s.apv=parseFloat(v);s.em=0;if(String.fromCharCode){i=escape(String.fromCharCode(256)).toUpperCase();s.em=(i=='%C4%80'?2:(i=='%U0100'?1:0))}s.un=un;s.uns();s.vl_l='charSet,visitorNamespace,cookieDomainPeriods,cookieLifetime,visitVariableProvider,pageName,pageURL,referrer,currencyCode,purchaseID';s.vl_t=s.vl_l+',channel,server,pageType,campaign,state,zip,events,products,linkName,linkType';for(var n=1;n<51;n++)s.vl_t+=',prop'+n+',eVar'+n+',hier'+n;s.vl_g=s.vl_t+',trackDownloadLinks,trackExternalLinks,trackInlineStats,linkLeaveQueryString,linkDownloadFileTypes,linkExternalFilters,linkInternalFilters,linkNames';if(pg)s.gl(s.vl_g);if(!ss){s.wds();s.ca()}}",l=window.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf("MSIE "),m=u.indexOf("Netscape6/"),a,i,s;if(l)for(i=0;i<l.length;i++){s=l[i];s.uns();if(s.un==un)return s;else if(s.pt(s.un,",","isf",un)){s=s.co(s);s.un=un;s.uns();return s}}if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a>=5&&v.indexOf("Opera")<0&&u.indexOf("Opera")<0){eval(c);return new s_c(un,pg,ss)}else s=s_c2f(c);return s(un,pg,ss)}createNamespace("Msn");Msn.Browser=SoapboxService.Utils.CreateEnum("IE",0,"Firefox",1,"MSNTV",2,"Safari",3,"Other",4);Msn.WindowContext=SoapboxService.Utils.CreateEnum("DestinationPage",0,"DaughterWindow",1,"IMActivity",2);Msn.constructor=function(){this.mainControls=[];this.controls=[];this.subscribers={};this.config=gConfig;this.running=false;this.debugMode=window.location.search.indexOf("debug")!=-1;this.displayValue="block";var _renderArray=[],_scriptIFrame=null;this.initMsnControls=function(){this.setGlobalizedUI(document.body);var c,b=document.body.getElementsByTagName("div");for(var a=0;a<b.length;a++)if(checkString(b[a].getAttribute("tp"))&&checkString(b[a].id)){c=b[a].getAttribute("prio");if(!checkInt(c))c=-1;_renderArray.push({"element":b[a],"prio":c})}_renderArray=_renderArray.sort(this.renderPriorityComparer);this.initMsnControlsInternal()};this.initMsnControlsInternal=function(){var elt,obj,node,p,t1=(new Date).getTime();elt=_renderArray[0].element;p=elt.getAttribute("param");p=checkString(p)?p:undefined;obj=eval("new "+elt.getAttribute("tp")+"("+p+")");obj.uniqueId=elt.id;Msn.Controls.mainControls.push(obj);var t2=(new Date).getTime();if(checkDefined(obj._render)){if(checkString(elt.innerText))elt.innerText="";node=document.createElement("SPAN");elt.appendChild(node);obj.node=node;obj.render()}var t3=(new Date).getTime();if(Msn.Controls.debugMode){var log=elt.getAttribute("tp")+" "+(t2-t1)+" "+(t3-t2);setTimeout(function(){Msn.Controls.log("stats",log)},100)}_renderArray=_renderArray.slice(1,_renderArray.length);setTimeout(_renderArray.length>0?Msn.Controls.initMsnControlsInternal:Msn.Controls.loadMsnControlsInternal,10)};this.loadMsnControlsInternal=function(){Msn.Controls.load();Msn.Controls.loadImg()};this.enable=function(){var a=this.overlay;if(checkObject(a))a.style.display="none"};this.disable=function(f,b,d,c,e){if(!checkObject(b))b=this.node;if(!checkInt(d))d=b.offsetWidth;if(!checkInt(c))c=b.offsetHeight;var a=this.overlay;if(!checkObject(a)){this.overlay=a=document.createElement("DIV");a.style.position="absolute";a.style.opacity=".75";a.style.filter="alpha(opacity=75)";a.style.zIndex=1;if(checkString(e))a.title=e;if(b.childNodes.length>0)b.insertBefore(a,b.childNodes[0]);else b.appendChild(a)}a.style.display="block";a.style.pixelHeight=c;a.style.pixelWidth=d;a.style.backgroundColor=f};this.renderPriorityComparer=function(a,b){return b.prio-a.prio};this.load=function(){_scriptIFrame=document.createElement("IFRAME");_scriptIFrame.style.display="none";document.body.appendChild(_scriptIFrame);for(var a=0;a<this.mainControls.length;a++)if(checkFunction(this.mainControls[a].loadState))try{this.mainControls[a].loadState()}catch(b){}};this.loadImg=function(){var b=document.images;for(var a=0;a<b.length;a++)try{if(b[a].getAttribute("lazySrc"))b[a].src=b[a].getAttribute("lazySrc")}catch(c){}};this.save=function(){var b=this.mainControls;for(var a=0;a<b.length;a++)if(checkFunction(b[a].saveState))b[a].saveState()};this.addListener=function(a,e,d,g,h,i){if(checkDefined(a)&&checkFunction(d)){if(!checkDefined(this.listeners)){this.listeners=[];this.controls.push(this)}var j=this,c=function(a){return d.call(j,a,g,h,i)};a.attachEvent(e,c);var f={e:a,t:e,f:c};this.listeners.push(f);if(this.debugMode){var k=0;for(var b=0;b<this.controls.length;b++)k+=this.controls[b].listeners.length}}};this.addListener2=function(a,e,d,g,h,i){if(checkDefined(a)&&checkFunction(d)){if(!checkDefined(this.listeners)){this.listeners=[];this.controls.push(this)}var j=this,c=function(a,b){return d.call(j,a,b,g,h,i)};a.attachEvent(e,c);var f={e:a,t:e,f:c};this.listeners.push(f);if(this.debugMode){var k=0;for(var b=0;b<this.controls.length;b++)k+=this.controls[b].listeners.length}}};this.dispose=function(){this.overlay=null;if(checkDefined(this.listeners)){for(var b=0;b<this.listeners.length;b++){var a=this.listeners[b];a.e.detachEvent(a.t,a.f)}this.listeners.clear()}if(checkFunction(this.onDispose))this.onDispose()};this.disposeAll=function(){if(this.controls){for(var a=0;a<this.controls.length;a++){var b=this.controls[a];b.dispose()}this.controls=null}};this.fireEvent=function(a,c,d){if(checkInt(a)&&checkDefined(this.subscribers[a]))for(var b=0;b<this.subscribers[a].length;b++)if(checkFunction(this.subscribers[a][b].onEvent))try{this.subscribers[a][b].onEvent(this,a,c,d)}catch(e){if(this.debugMode)window.alert("Exception "+a+": "+e.description)}};this.subscribeEvent=function(a){if(checkInt(a))if(!checkDefined(this.subscribers[a]))this.subscribers[a]=[this];else if(!this.subscribers[a].contains(this))this.subscribers[a].add(this)};this.unsubscribeEvent=function(a){if(checkString(a)&&checkDefined(this.subscribers[a]))this.subscribers[a].remove(this)};this.render=function(b){this.dispose();if(b){var a=document.createElement("SPAN");this.node=a;b.appendChild(a);this._render(a);var d=document.createElement("SPAN");b.appendChild(d)}else if(this.node){var c=this.node.childNodes;if(c.length>0)this.node.innerHTML="";this._render(this.node)}};this.attachScript=function(c,b){try{if(checkString(c)){var d=checkDefined(b)?b:document.body,a=document.createElement("SCRIPT");a.type="text/javascript";d.appendChild(a);a.src=c}}catch(e){}};this.attachScriptSafe=function(b){if(checkString(b)&&checkDefined(_scriptIFrame)){var a=_scriptIFrame.contentDocument||_scriptIFrame.contentWindow.document;if(checkDefined(a)){a.open();a.write(("<script type='text/javascript' language='javascript' src='{0}' />").format(b));a.close()}}};this.attachPageSafe=function(a){if(checkString(a)&&checkDefined(_scriptIFrame))_scriptIFrame.src=a};this.setVisibility=function(a){if(a){if(checkDefined(this.node))this.node.style.visibility="visible"}else if(checkDefined(this.node))this.node.style.visibility="hidden"};this.setDisplay=function(a){if(a){if(checkDefined(this.node))this.node.style.display=this.displayValue}else if(checkDefined(this.node))this.node.style.display="none"};this.setGlobalizedUI=function(a){if(checkDefined(a)){var b=$["IDS_GMT_FontFamily"];if(checkString(b))a.style.fontFamily=b;var c=$["IDS_GMT_FontSize"];if(checkInt(c))a.style.fontSize=c+"pt"}};this.log=function(b,c){if(this.debugMode){var a=document.getElementById(b);if(!a){a=document.createElement("DIV");a.id=b;a.className="debug";document.body.appendChild(a)}a.appendChild(document.createTextNode("["+new Date+"] "+c));a.appendChild(document.createElement("BR"));a.scrollTop=a.scrollHeight-a.clientHeight}};this.getBrowser=function(){return getBrowser()};this.setDraggable=function(d,g,h,e,f,b,a,c){new Draggable(this,d,g,h,e,f,b,a,c)};function Draggable(m,a,p,q,n,o,g,i,j){this.attachEventListener=function(b,c,a){if(window.addEventListener)document.addEventListener(c,a,false);else document.attachEvent(b,a)};this.detachEventListener=function(b,c,a){if(window.removeEventListener)document.removeEventListener(c,a,false);else document.detachEvent(b,a)};this.moveObject=function(i){if(h){var b=temp1+(i?i.clientX:event.clientX)-k,g=temp2+(i?i.clientY:event.clientY)-l;if(checkDefined(c)&&b<c)b=c;else if(checkDefined(e)&&b>e)b=e;if(checkDefined(d)&&g<d)g=d;else if(checkDefined(f)&&g>f)g=f;a.style.left=b+"px";a.style.top=g+"px";return false}};this.startDrag=function(c){if(!c)c=window.event;var d=c.target?c.target:c.srcElement;if(d==a){h=true;b.attachEventListener("onmouseup","mouseup",b.endDrag);if(checkFunction(g))b.attachEventListener("onmousemove","mousemove",g);temp1=parseInt(a.style.left.substring(0,a.style.left.length-2));temp2=parseInt(a.style.top.substring(0,a.style.left.length-2));k=c.clientX;l=c.clientY;b.attachEventListener("onmousemove","mousemove",b.moveObject);if(c.preventDefault)c.preventDefault();if(checkFunction(i))i()}};this.endDrag=function(){h=false;b.detachEventListener("onmousemove","mousemove",b.moveObject);b.detachEventListener("onmouseup","mouseup",b.endDrag);if(checkFunction(g))b.detachEventListener("onmousemove","mousemove",g);if(checkFunction(j))j()};var b=this,h=false,k,l,c=p,d=q,e=n,f=o;a.style.position="absolute";if(a.style.left==""&&checkDefined(c))a.style.left=c+"px";if(a.style.top==""&&checkDefined(d))a.style.top=d+"px";styleLeft=parseInt(a.style.left.substring(0,a.style.left.length-2));styleTop=parseInt(a.style.top.substring(0,a.style.top.length-2));if(checkDefined(c)&&styleLeft<c)a.style.left=c+"px";else if(checkDefined(e)&&styleLeft>e)a.style.left=e+"px";if(checkDefined(d)&&styleTop<d)a.style.top=d+"px";else if(checkDefined(f)&&styleTop>f)a.style.top=f+"px";m.addListener(a,"onmousedown",b.startDrag)}this.animate=function(c,d,b,a,e,f){if(checkDefined(c)&&checkInt(d,0)&&checkInt(b,0)&&checkFunction(a))return new Animator(c,d,b,a,e,f);return null};function Animator(a,f,i,d,c,e){this.onTick=function(){var l=((new Date).getTime()-h)/1000;if(l>=0&&l<f){var k=Math.pow(l/f,i);k=e?1-k:k;var j=d(k);if(checkDefined(j)){if(checkInt(j.x))a.style.left=j.x+"px";if(checkInt(j.y))a.style.top=j.y+"px";if(checkInt(j.width))a.style.width=j.width+"px";if(checkInt(j.height))a.style.height=j.height+"px";if(checkFloat(j.opacity,0,1)){a.style.opacity=j.opacity;a.style.MozOpacity=j.opacity;a.style.filter="alpha(opacity="+100*j.opacity+")"}}b=setTimeout(g.onTick,10)}else{k=e?0:1;j=d(k);if(checkDefined(j)){if(checkInt(j.x))a.style.left=j.x+"px";if(checkInt(j.y))a.style.top=j.y+"px";if(checkInt(j.width))a.style.width=j.width+"px";if(checkInt(j.height))a.style.height=j.height+"px";if(checkFloat(j.opacity,0,1)){a.style.opacity=j.opacity;a.style.MozOpacity=j.opacity;a.style.filter="alpha(opacity="+100*j.opacity+")"}}b=null;if(checkFunction(c))c()}};this.cancel=function(){if(b){clearTimeout(b);b=null}};var g=this,h=(new Date).getTime(),b=setTimeout(g.onTick,10)}this.eventLocation=function(d,c){if(!c)c=window.event;if(this.getBrowser()==Msn.Browser.IE)return {x:c.x,y:c.y};else{var b=d,a={x:0,y:0};while(b){a.x+=b.offsetLeft;a.y+=b.offsetTop;b=b.offsetParent}a.x=window.pageXOffset+c.clientX-a.x;a.y=window.pageYOffset+c.clientY-a.y;return a}};this.setCSSFloat=function(a,b){if(checkDefined(a))if(this.getBrowser()==Msn.Browser.IE)a.style.styleFloat=b;else a.style.cssFloat=b};this.getLinkHref=function(){if(this.getBrowser()==Msn.Browser.IE)return "#";else return "javascript:void(0);"};this.createLink=function(e,b,c,d){var a=document.createElement("A");a.appendChild(document.createTextNode(e));a.href=this.getLinkHref();a.alt=a.title=checkString(d)?d:e;if(checkString(c))a.className=c;if(checkFunction(b))this.addListener(a,"onclick",b);return a};this.onTimeOut=function(){customAlert("This request timed out. Please try again later.")};this.onError=function(){customAlert("There was an unknown error. Please try again later.")};this.OverrideFlashUnloadHanlders=function(){if(this.getBrowser()==Msn.Browser.IE){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}}};this.FlashCleanup=function(){if(this.getBrowser()==Msn.Browser.IE){var d=document.getElementsByTagName("OBJECT");for(var c=0;c<d.length;c++)try{var a=d[c];a.style.display="none";for(var b in a)if(checkFunction(a[b]))a[b]=empty}catch(e){}}}};Msn.Controls=new Msn.constructor;function pageLoad(){if(!Msn.Controls.running){Msn.Controls.running=true;detectPlaybackSequence();if(window.attachEvent){window.attachEvent("onbeforeunload",pageBeforeUnload);window.attachEvent("onresize",onWindowResize);window.attachEvent("onfocus",onWindowFocus);document.attachEvent("onkeydown",pageKeyDown)}else if(window.addEventListener){window.addEventListener("beforeunload",pageBeforeUnload,false);window.addEventListener("resize",onWindowResize,false);window.addEventListener("focus",onWindowFocus,false);document.addEventListener("keydown",pageKeyDown,false)}Msn.Controls.initMsnControls()}}function pageUnload(){try{if(checkDefined(Msn.UploadManager))if(Msn.UploadManager.IsUploading())Msn.UploadManager.cancelAllUploads()}catch(a){}try{Msn.Controls.running=false;Msn.Controls.FlashCleanup();Msn.Controls.disposeAll();if(window.detachEvent){window.detachEvent("onbeforeunload",pageBeforeUnload);window.detachEvent("onresize",onWindowResize);window.detachEvent("onfocus",onWindowFocus)}else if(window.removeEventListener){window.removeEventListener("beforeunload",pageBeforeUnload,false);window.removeEventListener("resize",onWindowResize,false);window.removeEventListener("focus",onWindowFocus,false)}Msn.Controls.mainControls=null;Msn.Controls.subscribers=null;Msn.Controls=null;Msn=null}catch(a){}}if(window.attachEvent){window.attachEvent("onload",pageLoad);window.attachEvent("onunload",pageUnload)}else if(window.addEventListener){window.addEventListener("load",pageLoad,false);window.addEventListener("unload",pageUnload,false)}function pageBeforeUnload(b){var a=checkDefined(event)?event:b;Msn.Controls.OverrideFlashUnloadHanlders();if(checkDefined(Msn.UploadManager))if(Msn.UploadManager.IsUploading())a.returnValue="Some of your videos are currently being uploaded. If you leave this page now, your upload will be cancelled."}var _windowWidth=document.documentElement.clientWidth,_windowHeight=document.documentElement.clientHeight;function onWindowResize(){if(_windowWidth!=document.documentElement.clientWidth||_windowHeight!=document.documentElement.clientHeight){_windowWidth=document.documentElement.clientWidth;_windowHeight=document.documentElement.clientHeight;if(Msn.Controls.running)Msn.Controls.fireEvent(Msn.Event.WindowResize)}}function onWindowFocus(){if(Msn.Controls.running)Msn.Controls.fireEvent(Msn.Event.WindowFocus)}function pageKeyDown(){if(event.ctrlKey&&event.shiftKey&&event.keyCode==68)Msn.Controls.debugMode=true}customAlert=function(b,c){var a=new Msn.Controls.Dialog;a.description=b;a.type=c?Msn.Dialog.Info:Msn.Dialog.Alert;Msn.Controls.fireEvent(Msn.Event.DialogRequest,a)};window.bp=function(){window.alert("debug breakpoint")};function empty(){}var cfg={WMP_MIN_VERSION:9,SL_MIN_VERSION:"1.0",REQ_PAGE:"/req.aspx",MSNTV_PAGE:"http://g.msn.com/0VD0/36/61",OS_REQ_COOKIE_NAME:"v_supportCheck",SL_REQ_COOKIE_NAME:"v_silverlightCheck"},browserSupported=checkSupport()||checkString(cookieGet(cfg.OS_REQ_COOKIE_NAME));if(window.location.pathname.toLowerCase().indexOf(cfg.REQ_PAGE)<0&&!browserSupported)if(getBrowser()==Msn.Browser.MSNTV)window.location.href=cfg.MSNTV_PAGE;else if(!browserSupported){cookieSet(cfg.OS_REQ_COOKIE_NAME,"1",60*24*180);window.location.href=cfg.REQ_PAGE+"?rc=1"}function detectPlaybackSequence(){Msn.Controls.config.showFlash=false;Msn.Controls.config.showWmp=false;Msn.Controls.config.showSilverlight=false;Msn.Controls.config.playbackSequence=[];var b;if(getBrowser()==Msn.Browser.IE)b=Msn.Controls.config.playbackSequenceIE.split(",");else b=Msn.Controls.config.playbackSequenceNonIE.split(",");var c="v_sfx_"+(getBrowser()==Msn.Browser.IE)?"ie":"nonie",a=getUrlParam("seq");if(checkString(a))if(a=="default")cookieClear(c);else{b=a.split(",");cookieSet(c,a,1000000)}else{a=cookieGet(c);if(checkString(a))b=a.split(",")}for(var d=0;d<b.length;d++)switch(b[d]){case "flash":if(!Msn.Controls.config.showFlash){Msn.Controls.config.playbackSequence.push("flash");Msn.Controls.config.showFlash=true}break;case "wmp":if(!Msn.Controls.config.showWmp&&!Msn.Controls.config.showSilverlight&&detectWmpVersion(cfg.WMP_MIN_VERSION)){Msn.Controls.config.playbackSequence.push("wmp");Msn.Controls.config.showWmp=true}break;case "silverlight":if(!Msn.Controls.config.showWmp&&!Msn.Controls.config.showSilverlight){var e=detectSilverlightVersion(cfg.SL_MIN_VERSION);if(document.location.href.indexOf(cfg.REQ_PAGE)<0&&!e&&!checkString(cookieGet(cfg.SL_REQ_COOKIE_NAME))){document.cookie=cfg.SL_REQ_COOKIE_NAME+"=1"+";Path=/;";window.location.href=cfg.REQ_PAGE+"?rc=2"}if(e){Msn.Controls.config.playbackSequence.push("silverlight");Msn.Controls.config.showSilverlight=true}}break}}Msn.Controls.AdapterFactory=function(){this.create=function(b){var a=null;switch(b){case Msn.Domain.Soapbox:a=new Msn.Controls.SoapboxAdapter;break;case Msn.Domain.VideoCatalog:a=new Msn.Controls.VCAdapter;break;case Msn.Domain.LiveSearch:a=new Msn.Controls.LiveSearchAdapter;break}return a}};Msn.Controls.AddComments=function(){var b=this,d=null,c=null,a=null,e=0;this.subscribeEvent(Msn.Event.NicknameSet);this.subscribeEvent(Msn.Event.CommentPageChanged);this.onEvent=function(f,b,d){if(Msn.Event.NicknameSet==b){c.dispose();c=null;this.render()}else if(Msn.Event.FocusReceived==b){if(checkDefined(c))c.onEvent(this,b);else if(checkDefined(a))try{a.focus()}catch(g){}}else if(Msn.Event.CommentPageChanged==b)e=d};this.cfg={CLOSE_TITLE:$["IDS_CLI_CloseTitle"],COMMENTS:$["IDS_CLI_CommentsMax"],POST_LABEL:$["IDS_CLI_PostLabel"],POST_FAILED:$["IDS_CLI_PostFailed"],CANCEL_LABEL:$["IDS_CLI_CancelLabel"],EMPTY_COMMENT:$["IDS_CLI_EmptyComment"],COMMENT_MAX_LENGTH_ERROR:$["IDS_CLI_CommentMaxLengthError"],INVALID_COMMENTS_CHARS:$["IDS_CLI_InvalidCommentsChars"],SET_NICKNAME:$["IDS_CLI_SetNickname"],SIGN_IN_TO_ADD_COMMENT:$["IDS_CLI_SignInToAddComment"],STATUS_MSG_POST:["",$["IDS_CLI_StatusMsgPost1"],$["IDS_CLI_StatusMsgPost2"],$["IDS_CLI_StatusMsgPost3"],$["IDS_CLI_StatusMsgPost4"],$["IDS_CLI_StatusMsgPost5"],$["IDS_CLI_StatusMsgPost6"],$["IDS_CLI_StatusMsgPost7"]],COMMENTS_PER_PAGE:20,NICKNAME_MAX_LENGTH:24,COMMENT_MAX_LENGTH:1000};this._videoId=null;this._video=null;this._editMode=false;this._inProgress=false;this.onSubmit=function(d,b){if(checkDefined(b)&&checkDefined(b.value)&&false==this._inProgress){var a=b.value.trim();if(!checkString(a)){customAlert(this.cfg.EMPTY_COMMENT);return false}if(a.length>this.cfg.COMMENT_MAX_LENGTH){customAlert(this.cfg.COMMENT_MAX_LENGTH_ERROR.format(this.cfg.COMMENT_MAX_LENGTH));return false}var c="< > / \\";if(!validChar(a,c)){customAlert(this.cfg.INVALID_COMMENTS_CHARS.format(c));return false}Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"comment:post"});Msn.SoapboxServiceManager.PostComment(this._videoId,a,this.cfg.COMMENTS_PER_PAGE,e*this.cfg.COMMENTS_PER_PAGE,this.postCb,this.onError);this._inProgress=true;this.onClosePane()}return false};this.setVideo=function(a){if(checkDefined(a)){this._video=a;this._videoId=a.Id;e=0;this.clear()}};this.clear=function(){if(checkDefined(a))a.value=""};this.onCancel=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"comment:cancel"});this.onClosePane()};this.onClose=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"comment:close"});this.onClosePane()};this.onClosePane=function(){this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL);this.clear();return false};this.postCb=function(a){if(checkDefined(a)&&checkDefined(a.VideoId)&&a.VideoId==b._videoId){if(SoapboxService.ResultCode.Success==a.StatusCode){b.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.Comment);a.VideoOwner=b._video.OwnerId;b.fireEvent(Msn.Event.CommentsUpdated,a)}else if(checkInt(a.StatusCode,SoapboxService.ResultCode.Success,SoapboxService.ResultCode.FeatureNotAvailable))customAlert(b.cfg.STATUS_MSG_POST[a.StatusCode],false);b._inProgress=false}};this.onError=function(){customAlert(b.cfg.POST_FAILED);b._inProgress=false};this._render=function(f){var e,h,b,g;if(null!=f){e=document.createElement("DIV");e.className="closeLinkLocation";b=document.createElement("A");b.appendChild(document.createTextNode(this.cfg.CLOSE_TITLE));b.href=this.getLinkHref();b.tabIndex=23;e.appendChild(b);f.appendChild(e);this.addListener(b,"onclick",this.onClose);if(!Msn.Passport.isUserLoggedIn()){if(!checkDefined(d))d=new Msn.Controls.Link(this.cfg.SIGN_IN_TO_ADD_COMMENT,Msn.Passport.login);d.render(f)}else if(!Msn.Passport.getHasNickname()){if(!checkDefined(c))c=new Msn.Controls.Nickname(this.cfg.SET_NICKNAME+"<BR />",this.onNicknameComplete);c.render(f)}else{e=document.createElement("DIV");e.className="divPadding";g=document.createElement("DIV");g.className="divTitlePadding";g.appendChild(document.createTextNode(this.cfg.COMMENTS));e.appendChild(g);b=document.createElement("DIV");a=document.createElement("TEXTAREA");this.setGlobalizedUI(a);a.className="inputComment";a.maxLength=this.cfg.COMMENT_MAX_LENGTH;a.value="";a.tabIndex=20;b.appendChild(a);e.appendChild(b);e.appendChild(document.createElement("BR"));b=document.createElement("A");b.title=this.cfg.POST_LABEL;b.href=this.getLinkHref();b.className="tLink";b.appendChild(document.createTextNode(this.cfg.POST_LABEL));b.tabIndex=21;this.addListener(b,"onclick",this.onSubmit,a);e.appendChild(b);e.appendChild(document.createTextNode("  /  "));b=document.createElement("A");b.title=this.cfg.CANCEL_LABEL;b.href=this.getLinkHref();b.className="tLink";b.tabIndex=22;b.appendChild(document.createTextNode(this.cfg.CANCEL_LABEL));this.addListener(b,"onclick",this.onCancel);e.appendChild(b);f.appendChild(e)}}}};Msn.Controls.AddComments.prototype=Msn.Controls;Msn.Controls.AddToPlaylist=function(f){var d=this;this.cfg={VIDEO_ADDED:$["IDS_CLI_VideoAdded"],VIDEO_ADDED_SHORT:$["IDS_CLI_VideoAddedShort"],ADD_TO_PLAYLIST:$["IDS_CLI_AddToPlaylist"],ADDTOPLAYLIST_BUTTON:Msn.ImageEnum.ADD_TO_PLAYLIST,ADDTOPLAYLIST_BUTTON_DOWN:Msn.ImageEnum.VIDEO_ADDED};var b=null,c=null,a,e=f;this.setVideo=function(a){b=a;d.hideConfirmation()};this.setConfirmVisibility=function(b){if(checkDefined(a))if(b){a.style.visibility="visible";setTimeout(d.hideConfirmation,3000)}else a.style.visibility="hidden"};this.hideConfirmation=function(){d.setConfirmVisibility(false)};this.onAddToPlaylist=function(c,a){if(checkObject(b))switch(b.Status){case SoapboxService.VideoStatus.Published:case SoapboxService.VideoStatus.Approved:case SoapboxService.VideoStatus.LockedForReview:case SoapboxService.VideoStatus.Pending:d.setConfirmVisibility(true);b.AddSource=a?"playAll":b.AddSource;d.fireEvent(Msn.Event.MediaQueue,b);ReportTracking(b,"",Msn.Event.MediaClick,"add");break}return false};this.onAddToPlaylistDown=function(){Msn.ImageLoader.Load(this.cfg.ADDTOPLAYLIST_BUTTON_DOWN,c);};this.onAddToPlaylistUp=function(){Msn.ImageLoader.Load(this.cfg.ADDTOPLAYLIST_BUTTON,c);};this._render=function(f){if(null!=f){var d,b=document.createElement("A");b.className="addToPlaylist";b.href=this.getLinkHref();b.title=this.cfg.ADD_TO_PLAYLIST;c=document.createElement("IMG");Msn.ImageLoader.Load(this.cfg.ADDTOPLAYLIST_BUTTON,c);c.alt=this.cfg.ADD_TO_PLAYLIST;b.appendChild(c);this.addListener(b,"onclick",this.onAddToPlaylist);this.addListener(b,"onmousedown",this.onAddToPlaylistDown);this.addListener(b,"onmouseup",this.onAddToPlaylistUp);this.addListener(b,"onmouseout",this.onAddToPlaylistUp);f.appendChild(b);d=document.createElement("SPAN");d.style.position="relative";a=document.createElement("SPAN");a.className="addToPlaylistConfirm";var g=e?50:90;a.style.width=g+"px";d.style.left=g*-1+"px";a.innerText=e?this.cfg.VIDEO_ADDED_SHORT:this.cfg.VIDEO_ADDED;d.appendChild(a);f.appendChild(d)}}};Msn.Controls.AddToPlaylist.prototype=Msn.Controls;Msn.Controls.AdModule=function(p,n,s){var b=this,q=300,o=240,r=s,k=p,d=null,a=null,g=null,h=0,c=null,e=[],l=n;this.eventHandler=null;this.cfg={EXPAND_FRAME:8};this.changeMovie=function(g,f){if(checkString(g)){if(c){clearTimeout(c);c=null;e.clear()}var h=setUrlValue(g,"fd",location.hostname)+"&";if(null==d)b.renderFlash(h,f);else if(checkDefined(a)){a.LoadMovie(0,h);if(!f)j()}}};this.changeDimensions=function(b,a){if(checkDefined(d))d.changeDimensions(b,a)};this.playExpanded=function(){var c=function(){if(checkDefined(a)&&h>=b.cfg.EXPAND_FRAME)a.Play()};f(c)};this.expand=function(){var a=function(){if(h<b.cfg.EXPAND_FRAME)i("NGAPCollapse");else m(b.cfg.EXPAND_FRAME)};f(a)};this.collapse=function(){f(function(){i("NGAPExpand")})};this.collapseStatic=function(){f(function(){i("MSNStatic")})};function i(b){if(checkDefined(a)){a.TGotoLabel("/",b);a.TCallLabel("/",b)}}function m(b){if(checkDefined(a)){a.TGotoFrame("/",b);a.TCallFrame("/",b)}}function f(d){if(checkFunction(d))e.push(d);if(checkDefined(a)&&(this.getBrowser()==Msn.Browser.IE||a.PercentLoaded)&&a.PercentLoaded()==100){h=checkFunction(a.TotalFrames)?a.TotalFrames():a.TotalFrames;if(c){clearTimeout(c);c=null}for(var b=0;b<e.length;b++)try{e[b]()}catch(g){}e.clear()}else if(!c)c=setTimeout(function(){f()},500)}function j(){if(l)b.expand();else b.collapseStatic()}this.setHandler=function(a){b.eventHandler=a};this.renderFlash=function(e,c){if(null!=g){if(null!=d)g.innerHTML="";d=new Msn.Controls.FlashObject(k,e,q,o);d.setWMode(r);d.render(g);a=d.getObjectNode();b.addListener(a,"fscommand",b.eventHandler);window[k+"_DoFSCommand"]=b.eventHandler;if(!c)j()}};this._render=function(a){g=a}};Msn.Controls.AdModule.prototype=Msn.Controls;Msn.Controls.AlternateSearch=function(){var e=this,a=null,b=null,c=null;this.cfg={DID_YOU_MEAN:$["IDS_CLI_DidYouMean"]};this.subscribeEvent(Msn.Event.SearchCompleted);this.onEvent=function(g,f,a){switch(f){case Msn.Event.SearchCompleted:if(checkDefined(a)&&checkDefined(a.originalTerm)&&checkDefined(a.alternateSearchQuery)){var e=a.originalTerm,d=a.alternateSearchQuery;if(d.updateSearchBox&&(b!=e||!checkString(c))&&(d.videoDomain==Msn.Domain.VideoCatalog||d.videoDomain==Msn.Domain.Soapbox)){this.setAlternateSearchQuery(d);b=e;c=d.term;this.render()}}break}};this.setAlternateSearchQuery=function(b){a=b};this.executeAltSearch=function(){if(checkDefined(a)&&checkString(a.term))siteSearch(a.term,true)};this._render=function(b){if(null!=b){d=document.createElement("DIV");d.className="alternateSearch";if(checkDefined(a)&&checkString(a.term)){var c=new Msn.Controls.Link(this.cfg.DID_YOU_MEAN,this.executeAltSearch,"",true,a.term);c.render(d)}b.appendChild(d)}}};Msn.Controls.AlternateSearch.prototype=Msn.Controls;Msn.Controls.Application=function(){var a=this,h=0,c=0,b=null,e=false,f=null,d=getColumnData().columnCount;if(!checkDefined(Msn.Application)){Msn.Application=this;var g=Msn.Cache.get("Categories");if(checkArray(g))g.sort(alphaCatCompare)}this.cfg={MSG_VIDEOERROR:$["IDS_CLI_MsgVideoerror"],DOCUMENT_TITLE:$["IDS_GMT_DocumentTitle"],OPINION_SCRIPT_URL:"http://hp.msn.com/scr/op/ol-fdbkv3_r1.js",HELP_SCRIPT_URL:("http://help.live{0}.com/resources/neutral/launchhelp.js").format(Msn.Controls.config.envDomainSuffix),REPORTING_SCRIPT_URL:$["IDS_GMT_CustomReportingScriptUrl"],REPORTING_PAGE_URL:$["IDS_GMT_CustomReportingPageUrl"],MAX_COMMENTS_PER_PAGE:10};f=this.cfg.DOCUMENT_TITLE;this.subscribeEvent(Msn.Event.Navigate);this.subscribeEvent(Msn.Event.MediaPlayByVideoId);this.subscribeEvent(Msn.Event.MediaQueueByVideoId);this.subscribeEvent(Msn.Event.MediaChanged);this.subscribeEvent(Msn.Event.FocusRequest);this.subscribeEvent(Msn.Event.CommentsUpdated);this.subscribeEvent(Msn.Event.FavsUpdated);this.subscribeEvent(Msn.Event.VideoSharedUpdated);this.subscribeEvent(Msn.Event.VideoDeleted);this.subscribeEvent(Msn.Event.TagsUpdated);this.subscribeEvent(Msn.Event.VideoEdited);this.subscribeEvent(Msn.Event.DialogBoxActive);this.subscribeEvent(Msn.Event.DialogBoxInActive);this.subscribeEvent(Msn.Event.DocumentTitle);this.subscribeEvent(Msn.Event.WindowResize);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.ViewProfileRequest);this.onEvent=function(o,h,g){if(h==Msn.Event.Navigate){if(checkDefined(g)&&Msn.Menu.Help==g.menuId)setTimeout(this.displayHelp,100)}else if(h==Msn.Event.MediaPlayByVideoId){if(checkGuid(g)){c=g;var l=new Msn.Controls.VideoService([c]);l.getVideos(null,this.onVideoQueryCompletePlay,this.onVideoQueryError)}}else if(h==Msn.Event.MediaQueueByVideoId){if(checkGuid(g)){l=new Msn.Controls.VideoService([g]);l.getVideos(null,this.onVideoQueryCompleteQueue,this.onVideoQueryError)}}else if(h==Msn.Event.MediaChanged){if(checkDefined(g)&&checkString(g.Id)&&c!=g.Id){c=g.Id;var k=new Msn.Controls.VideoServiceExtended(g);k.getExtendedMetadata(null,this.onVideoMetadataComplete,this.onVideoMetadataError)}}else if(h==Msn.Event.FocusRequest){if(checkDefined(g))b=g}else if(h==Msn.Event.CommentsUpdated){if(checkDefined(g.VideoOwner)&&Msn.Passport.getCid()==g.VideoOwner)Msn.SoapboxServiceManager.GetUserComments(Msn.Passport.getCid(),this.cfg.MAX_COMMENTS_PER_PAGE,0,this.getUserCommentsCb,this.onError)}else if(h==Msn.Event.VideoDeleted){var m=checkObject(g)?g:{};m.VideoOwner=Msn.Passport.getCid();this.fireEvent(Msn.Event.CommentsUpdated,m);this.fireEvent(Msn.Event.FavsUpdated);this.fireEvent(Msn.Event.TagsUpdated)}else if(h==Msn.Event.FavsUpdated){var i=Msn.Controls.SearchQueryFactory.create(Msn.Passport.getCid(),SoapboxService.SearchType.Favorites,0,SoapboxService.SortOrder.Default);i.disableMenuSelect();i.disableHistoryEntry();i.useCache=false;k=new Msn.Controls.SearchQueryService(i);k.makeRequest(d,null,this.onUserFavoritesCb,null)}else if(h==Msn.Event.VideoSharedUpdated){i=Msn.Controls.SearchQueryFactory.create(Msn.Passport.getCid(),SoapboxService.SearchType.Shared,0,SoapboxService.SortOrder.Default);i.disableMenuSelect();i.disableHistoryEntry();i.useCache=false;k=new Msn.Controls.SearchQueryService(i);k.makeRequest(d,null,this.onSharedVideosCb,null)}else if(h==Msn.Event.TagsUpdated||h==Msn.Event.VideoEdited)Msn.SoapboxServiceManager.LoadUserTags(Msn.Passport.getCid(),0,0,false,this.getUserTagsCb,this.onError);else if(h==Msn.Event.DialogBoxActive)e=true;else if(h==Msn.Event.DialogBoxInActive)e=false;else if(h==Msn.Event.DocumentTitle){if(checkString(g))document.title=f=g}else if(h==Msn.Event.WindowResize){var j=getColumnData();if(d!=j.columnCount){d=j.columnCount;this.fireEvent(Msn.Event.SearchColumnCountChanged,j);this.fireEvent(Msn.Event.PageRefresh)}else this.fireEvent(Msn.Event.SearchColumnMarginChanged,j)}else if(h==Msn.Event.ControlsAckFullScreen){if(this.getBrowser()!=Msn.Browser.Firefox)document.documentElement.style.overflow=g?"hidden":"scroll"}else if(h==Msn.Event.ViewProfileRequest)if(Msn.Passport.isUserLoggedIn()){var n={cid:Msn.Passport.getCid(),nickname:Msn.Passport.getNickname()};a.fireEvent(Msn.Event.ViewProfile,n)}};this.onVideoMetadataComplete=function(b,d){if(checkDefined(b.Video)&&checkString(b.Video.Id)&&b.Video.Id==c){if(d)a.fireEvent(Msn.Event.MediaPlay,b.Video);a.fireEvent(Msn.Event.MediaMetadata,b);a.fireEvent(Msn.Event.MediaMetadataComplete)}};this.onVideoMetadataError=function(){a.fireEvent(Msn.Event.MetadataError)};this.onVideoQueryCompletePlay=function(b){if(checkArray(b)&&b.length>0){var c={Video:b[0]};Msn.Controls.fireEvent(Msn.Event.MediaChangedBegin,c.Video);a.onVideoMetadataComplete(c,true)}};this.onVideoQueryCompleteQueue=function(b){if(checkArray(b)&&b.length>0&&checkDefined(b[0]))a.fireEvent(Msn.Event.MediaQueue,b[0])};this.onVideoQueryError=function(){};this.getDocumentTitle=function(){return this.cfg.DOCUMENT_TITLE};this.displayHelp=function(a){if(window.LaunchHelp)if(a)LaunchHelp(("http://help.live{0}.com").format(Msn.Controls.config.envDomainSuffix),"MSN_Video_v4",Msn.Controls.config.market,"","keyword","lairetam_thgirypoc",false,"b1","","","");else LaunchHelp(("http://help.live{0}.com").format(Msn.Controls.config.envDomainSuffix),"MSN_Video_v4",Msn.Controls.config.market,"","","",false,"b1","","","")};this.getUserCommentsCb=function(b){if(checkDefined(b))a.fireEvent(Msn.Event.CommentsUpdatedData,b)};this.getUserTagsCb=function(b){if(checkDefined(b))a.fireEvent(Msn.Event.TagsUpdatedData,b)};this.onUserFavoritesCb=function(){a.fireEvent(Msn.Event.FavsUpdatedData)};this.onSharedVideosCb=function(){a.fireEvent(Msn.Event.VideoSharedUpdatedData)};this.onTick=function(){document.title=f;if(checkDefined(b)&&!e){if(checkFunction(b.onEvent))b.onEvent(a,Msn.Event.FocusReceived);b=null}a.fireEvent(Msn.Event.ApplicationTick,h++);setTimeout(a.onTick,1000)};this.loadState=function(){this.onTick();setTimeout(a.loadExternalScripts,5000)};this.loadExternalScripts=function(){a.attachScript(a.cfg.HELP_SCRIPT_URL);a.attachScript(a.cfg.OPINION_SCRIPT_URL);a.attachPageSafe(a.cfg.REPORTING_PAGE_URL);a.attachScriptSafe(a.cfg.REPORTING_SCRIPT_URL)};this.onError=function(){}};Msn.Controls.Application.prototype=Msn.Controls;Msn.Controls.Autoplay=function(){this.cfg={AUTO_PLAY_SOAPBOX:$["IDS_GMT_AutoPlaySpbx"],RELATED_VIDEOS_ALG:$["IDS_GMT_RelatedVideosAlg"]};var a=this;this.subscribeEvent(Msn.Event.MediaPlay);this.subscribeEvent(Msn.Event.MediaQueue);this.subscribeEvent(Msn.Event.DefaultVideosLoaded);this.subscribeEvent(Msn.Event.RequestAutoplay);this.subscribeEvent(Msn.Event.SetEditorAutoPlay);this.subscribeEvent(Msn.Event.MediaAutoPlay);this.onEvent=function(d,c,b){switch(c){case Msn.Event.MediaAutoPlay:case Msn.Event.MediaPlay:case Msn.Event.MediaQueue:switch(b.Status){case SoapboxService.VideoStatus.Published:case SoapboxService.VideoStatus.Approved:case SoapboxService.VideoStatus.LockedForReview:case SoapboxService.VideoStatus.Pending:a.update(b,c==Msn.Event.MediaAutoPlay);break}break;case Msn.Event.SetEditorAutoPlay:a.setEditorQueue(b);break;case Msn.Event.DefaultVideosLoaded:a.setQueue(b);break;case Msn.Event.RequestAutoplay:a.autoplay();break;default:break}};var d,h={},e=[],c=[],i=new Msn.Controls.VideoService,b,g=0,j=3,f=true;this.update=function(b,e){if(checkObject(b)){a.removeFromQueues(b);if(checkString(b.Id)&&b.CsId!=Msn.Controls.config.SoapboxCsId){if(!e){d=b;c=[]}h[b.Id]=true;f=true}else if(b.CsId==Msn.Controls.config.SoapboxCsId)f=isTrue(a.cfg.AUTO_PLAY_SOAPBOX)}};this.autoplay=function(){if(f)if(checkDefined(d)){a.getRelatedVideos(d);d=null}else a.playFromQueue()};this.getRelatedVideos=function(d){if(b==undefined)b=checkInt(Msn.Controls.config.relatedVideosPerQuery,0,100)?Msn.Controls.config.relatedVideosPerQuery:20;Msn.Controls.log("mediaPlayer","[Autoplay] querying VC for "+b+" videos related to "+d.Id);var e=new Msn.Controls.VCAdapterHelper,c="RelatedVideos.aspx?mk={0}&uuids={1}&ps={2}{3}{4}{5}";c=c.format(d.Market,d.Id,b,a.cfg.RELATED_VIDEOS_ALG,e.getUsageParam(),e.getFilterParam());i.getVideosFromServiceUrl(c,null,a.onVCCallback,a.onVCError)};this.getRandomVideos=function(){if(b==undefined)b=checkInt(Msn.Controls.config.relatedVideosPerQuery,0,100)?Msn.Controls.config.relatedVideosPerQuery:20;Msn.Controls.log("mediaPlayer","[Autoplay] querying VC for "+b+" random videos");var d=new Msn.Controls.VCAdapterHelper,c="RandomVideo.aspx?mk={0}&ps={1}&c={1}{2}{3}";c=c.format(Msn.Controls.config.VCMarket,b,d.getUsageParam(),d.getFilterParam());i.getVideosFromServiceUrl(c,null,a.onVCCallback,a.onVCError)};this.onVCCallback=function(b){if(checkArray(b,1)){g=0;a.setQueue(b);a.playFromQueue()}else a.onVCError()};this.onVCError=function(){if(g++<j){Msn.Controls.log("mediaPlayer","[Autoplay] error encountered when querying VC. Retrying.");a.getRandomVideos()}else{Msn.Controls.log("mediaPlayer","[Autoplay] error encountered when querying VC. Aborting.");g=0}};this.playFromQueue=function(){if(e.length>0)Msn.Controls.fireEvent(Msn.Event.MediaAutoPlay,e[0]);else if(c.length>0)Msn.Controls.fireEvent(Msn.Event.MediaAutoPlay,c[0]);else a.getRandomVideos()};this.populateQueue=function(c,a){if(checkArray(a,1))for(var b=0;b<a.length;b++)if(checkString(a[b].Id)&&!h[a[b].Id])c.push(a[b])};this.setEditorQueue=function(b){a.populateQueue(e,b)};this.setQueue=function(b){c=[];a.populateQueue(c,b)};this.removeFromQueue=function(b,c){if(checkObject(c)&&checkString(c.Id))for(var a=b.length-1;a>=0;a--)if(b[a].Id==c.Id)b.splice(a,1)};this.removeFromQueues=function(b){a.removeFromQueue(c,b);a.removeFromQueue(e,b)}};Msn.Controls.Autoplay.prototype=Msn.Controls;Msn.Controls.Blog=function(){var b=this;this.cfg={SPACES_TOOLTIP:$["IDS_CLI_SpacesTooltip"],SPACES_TEXT:$["IDS_CLI_SpacesText"],SPACES:getCDNPath("/i/blog.jpg"),BLOG_LINK:$["IDS_GMT_BlogToSpacesLink"].format(Msn.Controls.config.envDomainSuffix,Msn.Controls.config.market),DISABLED_MESSAGE:$["IDS_CLI_CommunityFeatureDisabled"],SIGN_IN_TO_BLOG:$["IDS_CLI_SignInReqdForBlog"],MAX_ACTION_LENGTH:15};var a=null,c=null,e=true,d=new Msn.Controls.GenericActionLink;this.onBlog=function(){Msn.Controls.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL);if(Msn.Passport.isUserLoggedIn()){if(checkDefined(a)&&checkDefined(a.Video)){openStandardWindow(f(),"_blank");Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:a.Video,type:"meta:rr",name:"blog"})}}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:a.Video,type:"meta",name:"blog:signinerror"});Msn.Passport.loginDialog(b.cfg.SIGN_IN_TO_BLOG)}return false};function f(){var h=getHostUrl()+b.cfg.PERMALINK_URL+c.Id,a=b.cfg.BLOG_LINK;a+="Title=";a+=escape(c.Title.replace(/\r\n/g,"<br/>"));a+="&SourceURL=";a+=escape(h);a+="&description=";var d="<br/>";if(e){var f=new Msn.Controls.EmbedVideo;f.setVideo(c);d+=f.getEmbed()}else{var g=new Msn.Controls.VideoLink;g.setVideo(c);d+=g.getVideoLink()}a+=escape(d.replace(/\r\n/g,"<br/>"));return a}this.setVideo=function(d){a=d;if(checkDefined(a)&&checkDefined(a.Video)){c=a.Video;e=c.CsId==Msn.Controls.config.SoapboxCsId}else b.disable("White",null,null,"16",b.cfg.DISABLED_MESSAGE)};this._render=function(c){if(null!=c){d.setImage(b.cfg.SPACES,this.cfg.SPACES_TOOLTIP,"videoActionImage");d.setMaxTextLength(b.cfg.MAX_ACTION_LENGTH);d.setLinkText(this.cfg.SPACES_TEXT,"videoActionText");d.setOnClickHandler(b.onBlog);d.render(c);b.setVideo(a)}}};Msn.Controls.Blog.prototype=Msn.Controls;Msn.Controls.BrowseTagControl=function(){var k=this;this.cfg={SEARCH_LABEL:$["IDS_CLI_SearchLabel"],USER_CREATED_VIDEOS:$["IDS_CLI_UserCreatedVideos"],BROWSE_SOAPBOX_VIDEOS:$["IDS_CLI_BrowseSoapboxVideos"],TOP_TAGS:$["IDS_CLI_TopTags"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"]};var i=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.TOP_TAGS,d=new Msn.Controls.Container(true,true,i,false),b=new Msn.Controls.Cloud,e=[],f=false,a=new Msn.Controls.Container(true,true,"",false),c=new Msn.Controls.SearchResultPanel(4,4,true,false,true);c.setContainerProperty(a,this.cfg.TOP_TAGS,true,true);this.subscribeEvent(Msn.Event.SelectTopTag);this.subscribeEvent(Msn.Event.Navigate);this.onEvent=function(g,e,a){if(e==Msn.Event.SelectTopTag)b.selectByName(a);else if(e==Msn.Event.Navigate)if(checkDefined(a)&&Msn.Menu.TopTags==a.menuId){var d=c.getSearchQuery();if(d)this.onTagClicked(Msn.CloudEntryType.Tags,d.term,d.videoDomain,a.sortOrder);else{f=true;b.selectByIndex(0,false,a.sortOrder)}}};this.onTagClicked=function(h,e,g,b){if(!b)b=SoapboxService.SortOrder.Default;if(h==Msn.CloudEntryType.Tags&&checkString(e)){var d=Msn.Controls.SearchQueryFactory.create(e,SoapboxService.SearchType.Tag,0,b,g);c.setSearchQuery(d);a.setRssUrl(d.rssUrl,d.zuneUrl);if(!f)Msn.Reporting.search(e,"tag","","gal");else f=false}};var g=Msn.Cache.get("PopularTags");if(checkObject(g))for(var h=0;h<g.length;h++){var j={"Type":Msn.CloudEntryType.Tags,"Name":g[h].Name,"Data":Msn.Domain.Soapbox};e.push(j)}b.setMaxEntries(40);b.setOnEntryClick(this.onTagClicked);b.setEntries(e,this.cfg.DATA_NOT_AVAILABLE);d.setContent(b);d.showViewAll(false);d.setScrollable(false);a.setContent(c);a.showViewAll(false);a.setScrollable(false);a.showRss(true);this._render=function(b){var c;if(null!=b){d.render(b);if(e.length>0){b.appendChild(document.createElement("BR"));a.render(b)}}}};Msn.Controls.BrowseTagControl.prototype=Msn.Controls;Msn.Controls.BrowseVideosPage=function(){var e=this;this.cfg={USER_CREATED_VIDEOS:$["IDS_CLI_UserCreatedVideos"],BROWSE_SOAPBOX_VIDEOS:$["IDS_CLI_BrowseSoapboxVideos"],MOST_RECENT:$["IDS_CLI_MostRecent"],MOST_COMMENTED:$["IDS_CLI_MostCommented"],TOP_TAGS:$["IDS_CLI_TopTags"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"]};var i=new Msn.Controls.SearchResultPanel(4,2,false,false,true),m=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.MOST_RECENT,b=new Msn.Controls.Container(true,true,m,false),h=new Msn.Controls.SearchResultPanel(4,2,false,false,true),k=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.MOST_COMMENTED,a=new Msn.Controls.Container(true,true,k,false),d=new Msn.Controls.Cloud,l=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.TOP_TAGS,c=new Msn.Controls.Container(true,true,l,false);this.subscribeEvent(Msn.Event.Navigate);this.onEvent=function(c,b,a){if(b==Msn.Event.Navigate)if(checkDefined(a)&&Msn.Menu.BrowseVideos==a.menuId)this.refresh()};this.onViewAllRecentVideos=function(){e.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MostRecent})};this.onViewAllCommentedVideos=function(){e.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MostCommented})};this.onViewAllTags=function(){e.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.TopTags})};this.onTagClicked=function(b,a){if(b==Msn.CloudEntryType.Tags&&checkString(a)){e.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.TopTags});e.fireEvent(Msn.Event.SelectTopTag,a)}};this.refresh=function(){var c=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListRecent,0,SoapboxService.SortOrder.Default);c.disableMenuSelect();c.disableHistoryEntry();i.setSearchQuery(c);b.setRssUrl(c.rssUrl,c.zuneUrl);c=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListMostCommented,0,SoapboxService.SortOrder.Default);c.disableMenuSelect();c.disableHistoryEntry();h.setSearchQuery(c);a.setRssUrl(c.rssUrl,c.zuneUrl)};var j=[],f=Msn.Cache.get("PopularTags");if(checkObject(f))for(var g=0;g<f.length;g++){var n={"Type":Msn.CloudEntryType.Tags,"Name":f[g].Name,"Data":null};j.push(n)}d.setMaxEntries(25);d.setOnEntryClick(this.onTagClicked);d.setEntryClassname("tagUnselected","tagUnselected");d.setEntries(j,this.cfg.DATA_NOT_AVAILABLE);c.setContent(d);c.showViewAll(true);c.setOnViewAllClick(this.onViewAllTags);c.setScrollable(false);b.setContent(i);b.showRss(true);b.showViewAll(true);b.setOnViewAllClick(this.onViewAllRecentVideos);a.setContent(h);a.showRss(true);a.showViewAll(true);a.setOnViewAllClick(this.onViewAllCommentedVideos);this._render=function(d){if(null!=d){c.render(d);b.render(d);d.appendChild(document.createElement("BR"));a.render(d);d.appendChild(document.createElement("BR"))}}};Msn.Controls.BrowseVideosPage.prototype=Msn.Controls;Msn.cacheConstructor=function(){var a={};this.insert=function(b,c){if(checkString(b)&&checkDefined(c))a[b]=c};this.remove=function(b){if(checkString(b))a[b]=null};this.get=function(b){if(checkString(b))if(checkDefined(a[b]))return a[b];else{var c=Msn.Controls.config;if(checkObject(c)&&checkDefined(c[b]))return c[b]}return null}};Msn.Cache=new Msn.cacheConstructor;Msn.Controls.Category=function(){var b=this,c=Msn.MenuManager;if(!checkDefined(Msn.CategoryManager))Msn.CategoryManager=this;this.cfg={CATEGORY:$["IDS_CLI_Category"]};var a=null;this.setVideo=function(b){a=b;this.render()};this.onCategoryClicked=function(d,c,a){b.fireEvent(Msn.Event.MenuClick,{menuId:c});b.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"cat:"+a});return false};this._render=function(d){if(null!=d)if(null!=a&&checkDefined(a.Video)&&checkDefined(a.Video.Channels)&&checkDefined(a.Video.Channels[0])&&checkDefined(a.Video.Channels[0].Id)){d.appendChild(document.createTextNode(this.cfg.CATEGORY));var f=c.getCategoryDataFromGuid(a.Video.Channels[0].Id),e=f.categoryFriendlyName.toLowerCase(),b=document.createElement("A");b.href=this.getLinkHref();b.appendChild(document.createTextNode(e));var g=f.categoryMenuId;this.addListener(b,"onclick",this.onCategoryClicked,g,e);d.appendChild(b)}}};Msn.Controls.Category.prototype=Msn.Controls;Msn.Controls.ChannelsHome=function(columns){var that=this,_cfg={MISSING_CAT_IMG:getCDNPath("/i/cat/unknown.jpg")},_categories,_container;this.onImageError=function(b,a){a.src=_cfg.MISSING_CAT_IMG};this.onCategoryClick=function(b,a){that.fireEvent(Msn.Event.MenuClick,{menuId:a});return false};this.setContainer=function(a){if(checkDefined(a))_container=a};this._render=function(p){if(null!=p){if(null==_categories)_categories=Msn.Cache.get("Categories");if(null!=_categories){var e,s;if(_categories.length>0){var tb,tbb,tr,td;tb=document.createElement("TABLE");tb.width="100%";tbb=document.createElement("TBODY");tr=document.createElement("TR");td=document.createElement("TD");tb.cellSpacing="10";tb.cellPadding="0";tb.appendChild(tbb);tbb.appendChild(tr);tr.appendChild(td);for(var n=0;n<_categories.length;n++){var category=_categories[n],catName=category.FriendlyName,image=category.Image,id=category.Id;s=document.createElement("SPAN");e=document.createElement("IMG");e.src=image;e.alt=e.title=catName;e.style.cursor="pointer";e.style.valign="middle";e.width="115";e.height="85";s.appendChild(e);var catMenuId=eval("Msn.Menu."+category.Name.replace(/ /g,""));this.addListener(e,"onclick",this.onCategoryClick,catMenuId);this.addListener(e,"onerror",this.onImageError,e);td.appendChild(s);td.className="category";td.valign="middle";td.align="center";td.appendChild(document.createElement("BR"));e=document.createElement("A");e.href=this.getLinkHref();e.title=catName;e.className="categoryTitle";e.appendChild(document.createTextNode(catName));this.addListener(e,"onclick",this.onCategoryClick,catMenuId);td.appendChild(e);if((n+1)%columns==0&&n!=_categories.length-1){tr=document.createElement("TR");tbb.appendChild(tr)}td=document.createElement("TD");tr.appendChild(td)}}p.appendChild(tb)}}}};Msn.Controls.ChannelsHome.prototype=Msn.Controls;Msn.Controls.Cloud=function(){var l=this,a=[],j=true,f="",c=24,e=null,m=null,b=null,h="tagSelected",d="tagUnselected",g=false,i="",k=new Msn.Controls.AlternateSearch;this.cfg={ERROR_MSG:$["IDS_CLI_ErrorMsg"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],LOADING:$["IDS_CLI_Loading"],MAX_ENTRY_LENGTH:30};this.setDelimiter=function(a){i=a};this.setEntries=function(b,e){if(checkDefined(b)){g=false;a.clear();for(var d=0;d<b.length;d++)if(checkString(b[d].Name))a.push(b[d]);if(a.length>c)a=a.slice(0,c);f=checkString(e)?e:l.cfg.ERROR_MSG;if(j)a.sort(this.alphaCompare)}else g=true;this.render()};this.alphaCompare=function(a,b){if(a.Name.toLowerCase()>b.Name.toLowerCase())return 1;else if(a.Name.toLowerCase()<b.Name.toLowerCase())return -1;return 0};this.setMaxEntries=function(a){if(checkInt(a,0)){c=a;this.render()}};this.setAlphaSort=function(a){j=a};this.setEntryClassname=function(b,a){if(checkString(b))h=b;if(checkString(a))d=a;this.render()};this.selectByIndex=function(b,d,c){if(checkInt(b,0,a.length)&&b<a.length&&checkObject(a[b].node))this.onEntryClicked(null,a[b].node,d,c)};this.selectByName=function(d,e){if(checkString(d))for(var b=0;b<a.length&&b<=c;b++)if(d.toLowerCase()==a[b].Name.toLowerCase()){this.selectByIndex(b,e);break}};this.setOnEntryClick=function(a){e=a};this.onEntryClicked=function(c,a,g,f){if(checkDefined(a)&&checkString(a.innerText)){if(checkDefined(b))b.className=d;b=a;b.className=h}if(checkDefined(e)&&!g)if(checkString(a.title)&&checkInt(a.entryType,0))e(a.entryType,a.title,a.entryData,f);if(checkDefined(c)&&checkString(c.type)&&c.type=="click")if(checkString(a.title)&&checkInt(a.entryType,0))switch(a.entryType){case Msn.CloudEntryType.Search:Msn.Reporting.search("",a.title);break}};this.onEntryMouseOut=function(b,a){if(checkDefined(a))a.style.textDecoration="none"};this.onEntryMouseOver=function(b,a){if(checkDefined(a))if(a.className==d)a.style.textDecoration="underline"};this._render=function(l){var e,h;if(null!=l){d1=document.createElement("DIV");k.render(d1);l.appendChild(d1);h=document.createElement("DIV");h.className="tagContainer";b=null;if(a.length>0)for(var j=0;j<a.length&&j<=c;j++){e=document.createElement("SPAN");h.appendChild(e);if(j!=a.length-1){spacer=document.createElement("SPAN");spacer.innerText=i;h.appendChild(spacer)}e.className=d;e.innerText=ll(a[j].Name,this.cfg.MAX_ENTRY_LENGTH);e.title=a[j].Name;e.entryType=a[j].Type;e.entryData=a[j].Data;a[j].node=e;this.addListener(e,"onclick",this.onEntryClicked,e,false);this.addListener(e,"onmouseover",this.onEntryMouseOver,e);this.addListener(e,"onmouseout",this.onEntryMouseOut,e);h.appendChild(document.createTextNode(" "))}else if(g)h.appendChild(document.createTextNode(this.cfg.DATA_NOT_AVAILABLE));else if(checkString(f)){elNoEntry=document.createElement("SPAN");elNoEntry.innerHTML=f;h.appendChild(elNoEntry)}else h.appendChild(document.createTextNode(this.cfg.LOADING));l.appendChild(h)}}};Msn.Controls.Cloud.prototype=Msn.Controls;Msn.CloudEntryType=SoapboxService.Utils.CreateEnum("None",0,"Tags",1,"Categories",2,"Taxonomy",3,"Search",4);Msn.Controls.Comments=function(){var a=this;this.subscribeEvent(Msn.Event.CommentsUpdated);this.subscribeEvent(Msn.Event.VideoPanelRemoteControl);this.onEvent=function(c,b,a){switch(b){case Msn.Event.CommentsUpdated:this.getCommentsCb(a);break;case Msn.Event.VideoPanelRemoteControl:if(a==Msn.VideoPanel.NULL)this.displayComments(true);else this.displayComments(false);break}};this.displayComments=function(a){if(checkDefined(_elComment))if(a){_elComment.style.display="block";_elComment.style.visibility="visible"}else{_elComment.style.display="none";_elComment.style.visibility="hidden"}};this.cfg={COMMENTS:$["IDS_CLI_Comments"],REPORT:$["IDS_CLI_Report"],ALT_OFFENSIVE:$["IDS_CLI_AltOffensive"],DLG_OFFENSIVE:$["IDS_CLI_DlgOffensive"],DLG_DELETE:$["IDS_CLI_DlgDelete"],FAILED_OFFENSIVE:$["IDS_CLI_FailedOffensive"],FAILED_DELETE:$["IDS_CLI_FailedDelete"],COMMENT_VIDEO:$["IDS_CLI_CommentVideo"],ALT_DELETE:$["IDS_CLI_AltDelete"],SOURCE_TITLE:$["IDS_CLI_SourceTitle"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],LOADING:$["IDS_CLI_Loading"],SIGN_IN_ADD_COMMENT:$["IDS_CLI_SignInAddComment"],COUNT_COMMENT:$["IDS_CLI_CountComment"],COUNT_COMMENTS:$["IDS_CLI_CountComments"],ANONYMOUS:$["IDS_CLI_Anonymous"],POSTED:$["IDS_CLI_Posted"],STATUS_MSG:["",$["IDS_CLI_StatusMsgPost1"],$["IDS_CLI_StatusMsgPost2"],$["IDS_CLI_StatusMsgPost3"],$["IDS_CLI_StatusMsgPost4"],$["IDS_CLI_StatusMsgPost5"],$["IDS_CLI_StatusMsgPost6"],$["IDS_CLI_StatusMsgPost7"]],STATUS_MSG_DELETE:["",$["IDS_CLI_StatusMsgDelete1"],$["IDS_CLI_StatusMsgDelete2"],"","","","",$["IDS_CLI_StatusMsgDelete7"]],STATUS_MSG_FLAG:[$["IDS_CLI_StatusMsgFlag0"],$["IDS_CLI_StatusMsgFlag1"],$["IDS_CLI_StatusMsgFlag2"],"","","","",$["IDS_CLI_StatusMsgFlag7"]],IMG_COMMENTS:Msn.ImageEnum.ADD_COMMENT,IMG_DELETE:Msn.ImageEnum.DEL_COMMENT,NICKNAME_MAX_LENGTH:24,COMMENT_MAX_LENGTH:1000,COMMENTS_PER_PAGE:20,SOURCE_LOGO:getCDNPath($["IDS_GMT_SoapboxLogo"])};this._videoId=null;this._ownerCid=0;this._isSoapboxVideo=false;this._comments=null;this._count=null;this._inProgress=false;this._pageNum=0;this._elSourceLogo=null;this._elLabelDiv=null;this._loadingDiv=document.createElement("DIV");this._loadingDiv.appendChild(document.createTextNode(this.cfg.LOADING));this._errorDiv=document.createElement("DIV");this._errorDiv.appendChild(document.createTextNode(this.cfg.DATA_NOT_AVAILABLE));_elComment=null;this._commentsDiv=null;this.onPageClick=function(c,b){a._pageNum=b;Msn.SoapboxServiceManager.GetComments(a._videoId,a.cfg.COMMENTS_PER_PAGE,a._pageNum*a.cfg.COMMENTS_PER_PAGE,a.getCommentsCb,a.getCommentsErrorCb);a.fireEvent(Msn.Event.CommentPageChanged,a._pageNum);return false};var c=new Msn.Controls.Pagination(this.onPageClick,this.cfg.COMMENTS_PER_PAGE,false),b=new Msn.Controls.Pagination(this.onPageClick,this.cfg.COMMENTS_PER_PAGE,false);this.onCommentVideo=function(){if(Msn.Passport.isUserLoggedIn()){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"comment:on"});this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.Comment)}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"comment:signinerror"});Msn.Passport.loginDialog(a.cfg.SIGN_IN_ADD_COMMENT)}};this.deleteLinkClick=function(e,c,d){if(checkString(c)&&checkString(d))if(Msn.Passport.isUserLoggedIn()&&false==this._inProgress){var b=new Msn.Controls.Dialog;b.description=a.cfg.DLG_DELETE;b.type=Msn.Dialog.Confirm;b.onComplete=function(b){a.deleteCommentConfirmed(b,c,d,a._pageNum*a.cfg.COMMENTS_PER_PAGE)};a.fireEvent(Msn.Event.DialogRequest,b)}else customAlert(this.cfg.STATUS_MSG_DELETE[SoapboxService.ResultCode.NotSignedIn])};this.deleteCommentConfirmed=function(b,c,d,e){if(b){Msn.SoapboxServiceManager.DeleteComment(c,d,a.cfg.COMMENTS_PER_PAGE,e,a.deleteCb,a.deleteErrorCb);a._inProgress=true}};this.flagLinkClick=function(e,c,d){if(checkString(c)&&checkString(d))if(Msn.Passport.isUserLoggedIn()){this.fireEvent(Msn.Event.SetAutoProgress,false);var b=new Msn.Controls.Dialog;b.description=a.cfg.DLG_OFFENSIVE;b.type=Msn.Dialog.Confirm;b.onComplete=function(b){a.flagCommentConfirmed(b,c,d)};a.fireEvent(Msn.Event.DialogRequest,b)}else customAlert(this.cfg.STATUS_MSG_FLAG[SoapboxService.ResultCode.NotSignedIn]);return false};this.flagCommentConfirmed=function(b,c,d){this.fireEvent(Msn.Event.SetAutoProgress,true);if(b)Msn.SoapboxServiceManager.FlagOffensiveComment(c,d,a.flagCb,a.flagErrorCb)};this.setVideo=function(b){if(checkDefined(b)&&checkString(b.Id))if(b.Id==this._videoId){if(this.getBrowser()==Msn.Browser.IE)window.setTimeout(function(){a.render()},10)}else{this._videoId=b.Id;this._ownerCid=b.OwnerId;this._pageNum=0;this._isSoapboxVideo=b.CsId==Msn.Controls.config.SoapboxCsId;this.setLoading(true);Msn.SoapboxServiceManager.GetComments(this._videoId,this.cfg.COMMENTS_PER_PAGE,this._pageNum*this.cfg.COMMENTS_PER_PAGE,this.getCommentsCb,this.getCommentsErrorCb)}};this.onUserProfileClick=function(e,c,d){if(checkString(c)&&c!="0"){var b={};b.cid=c;b.nickname=d;a.fireEvent(Msn.Event.ViewProfile,b)}};this.onUserProfileClickDummy=function(){return true};this.setLoading=function(a){if(checkDefined(a)&&checkDefined(this._commentsDiv)&&checkDefined(this._loadingDiv))if(a){this._commentsDiv.style.display="none";this._loadingDiv.style.display="block";this._errorDiv.style.display="none"}else{this._commentsDiv.style.display="block";this._loadingDiv.style.display="none";this._errorDiv.style.display="none"}};this.setError=function(){this._commentsDiv.style.display="none";this._loadingDiv.style.display="none";this._errorDiv.style.display="block"};this.getCommentsCb=function(b){if(checkDefined(b)&&checkDefined(b.VideoId)&&b.VideoId==a._videoId)if(SoapboxService.ResultCode.Success==b.StatusCode){a._comments=b.Comments;a._count=b.Count;a._editMode=false;a.render()}else if(checkInt(b.StatusCode,SoapboxService.ResultCode.UnknownError,SoapboxService.ResultCode.FeatureNotAvailable))customAlert(a.cfg.STATUS_MSG[b.Status])};this.deleteCb=function(b){if(checkDefined(b)&&checkDefined(b.VideoId)&&b.VideoId==a._videoId){if(SoapboxService.ResultCode.Success==b.StatusCode)if(a._pageNum>0&&a._pageNum*a.cfg.COMMENTS_PER_PAGE>=b.Count)a.onPageClick(null,a._pageNum-1);else{a._comments=b.Comments;a._count=b.Count;a._editMode=false;a.render();b.VideoOwner=a._ownerCid;a.fireEvent(Msn.Event.CommentsUpdated,b)}else if(checkInt(b.StatusCode,SoapboxService.ResultCode.Success,SoapboxService.ResultCode.FeatureNotAvailable)){var c=b.StatusCode==SoapboxService.ResultCode.Success;customAlert(a.cfg.STATUS_MSG_DELETE[b.StatusCode],c)}a._inProgress=false}};this.flagCb=function(b){if(checkDefined(b)&&checkDefined(b.VideoId)&&b.VideoId==a._videoId)if(checkInt(b.StatusCode,SoapboxService.ResultCode.Success,SoapboxService.ResultCode.FeatureNotAvailable)){var c=b.StatusCode==SoapboxService.ResultCode.Success;customAlert(a.cfg.STATUS_MSG_FLAG[b.StatusCode],c)}};this.getCommentsErrorCb=function(){a.setError();a._inProgress=false};this.deleteErrorCb=function(){customAlert(a.cfg.FAILED_DELETE);a._inProgress=false};this.flagErrorCb=function(){customAlert(a.cfg.FAILED_FLAG);a._inProgress=false};this.onImageError=function(b,a){a.style.display="none"};this.onSourceLogoClick=function(){Msn.MenuManager.loadDefaultSoapboxMenuItem()};this._render=function(t){var i,j,w,f,o,s,e,n;if(null!=t){j=document.createElement("DIV");j.className="metadataPadding";this._commentsDiv=document.createElement("DIV");j.appendChild(this._loadingDiv);j.appendChild(this._errorDiv);if(this._videoId&&this._comments){var l,k,h,d;l=document.createElement("TABLE");k=document.createElement("TBODY");h=document.createElement("TR");d=document.createElement("TD");l.width="300px";l.cellSpacing="0";l.cellPadding="0";l.appendChild(k);k.appendChild(h);h.appendChild(d);d.colSpan="2";if(this._isSoapboxVideo){this._elSourceLogo=document.createElement("IMG");this._elSourceLogo.src=this.cfg.SOURCE_LOGO;this._elSourceLogo.alt=this.cfg.SOURCE_TITLE;this._elSourceLogo.className="sourceLogo";this.addListener(this._elSourceLogo,"onerror",this.onImageError,this._elSourceLogo);this.addListener(this._elSourceLogo,"onclick",this.onSourceLogoClick);d.appendChild(this._elSourceLogo)}else{this._elLabelDiv=document.createElement("DIV");this._elLabelDiv.appendChild(document.createTextNode(this.cfg.COMMENTS));this._elLabelDiv.className="metadataLabel";d.appendChild(this._elLabelDiv)}h=document.createElement("TR");d=document.createElement("TD");k.appendChild(h);h.appendChild(d);d.align="left";var u=this._count>1?this.cfg.COUNT_COMMENTS:this.cfg.COUNT_COMMENT;o=document.createElement("B");s=document.createTextNode(u.format(this._count));o.appendChild(s);d.appendChild(o);d=document.createElement("TD");h.appendChild(d);f=document.createElement("IMG");f.title=this.cfg.COMMENT_VIDEO;f.className="tLink";Msn.ImageLoader.Load(this.cfg.IMG_COMMENTS,f);f.width="12";f.height="11";d.appendChild(f);this.addListener(f,"onclick",this.onCommentVideo);d.appendChild(document.createTextNode(" "));f=document.createElement("A");f.className="tLink";f.title=this.cfg.COMMENT_VIDEO;f.appendChild(document.createTextNode(this.cfg.COMMENT_VIDEO));d.appendChild(f);this.addListener(f,"onclick",this.onCommentVideo);h=document.createElement("TR");k.appendChild(h);d=document.createElement("TD");h.appendChild(d);d.align="right";d.colSpan="2";d.className="commentsHeadSeperator";c.setPosition(0,0,0);c.render(d);c.setPosition(this._pageNum*a.cfg.COMMENTS_PER_PAGE,this.cfg.COMMENTS_PER_PAGE,this._count);d.appendChild(document.createTextNode(" "));h=document.createElement("TR");k.appendChild(h);d=document.createElement("TD");h.appendChild(d);d.align="right";d.colSpan="2";d.className="commentsPadding";d.appendChild(document.createTextNode(" "));j.appendChild(l);f=document.createElement("DIV");_elComment=f;i=document.createElement("DIV");for(var p=0;p<this._comments.length;p++){var g=this._comments[p];if(checkString(g.Comment)&&g.Comment.length>0&&checkString(g.Cid)&&g.Cid!="0"){var m=this.cfg.ANONYMOUS;if(checkString(g.Nickname)&&g.Nickname.trim().length>0)m=g.Nickname;e=document.createElement("A");e.className="tLink";e.appendChild(document.createTextNode(ll(m,this.cfg.NICKNAME_MAX_LENGTH)));e.title=m;this.addListener(e,"onclick",this.onUserProfileClick,g.Cid,m);i.appendChild(e);i.appendChild(document.createTextNode(" ("+this.cfg.POSTED+" "+formatDate(g.TimeElapsed)+")"));var v=g.Cid==Msn.Passport.getCid()||this._ownerCid!=0&&this._ownerCid==Msn.Passport.getCid();if(v){i.appendChild(document.createTextNode(" "));e=document.createElement("IMG");Msn.ImageLoader.Load(this.cfg.IMG_DELETE,e);e.alt=e.title=this.cfg.ALT_DELETE;e.style.cursor="pointer";e.style.valign="middle";i.appendChild(e);this.addListener(e,"onclick",this.deleteLinkClick,g.Id,g.VideoId)}else{e=document.createElement("SPAN");e.className="commentsFlagSeperator";e.appendChild(document.createTextNode(" | "));i.appendChild(e);e=document.createElement("A");e.href=this.getLinkHref();e.alt=e.title=this.cfg.ALT_OFFENSIVE;e.appendChild(document.createTextNode(this.cfg.REPORT));i.appendChild(e);this.addListener(e,"onclick",this.flagLinkClick,g.Id,g.VideoId)}var r=g.Comment.split("\r\n");for(var q=0;q<r.length;q++){i.appendChild(document.createElement("BR"));i.appendChild(document.createTextNode(limitString(r[q],this.cfg.COMMENT_MAX_LENGTH)))}i.appendChild(document.createElement("BR"));i.appendChild(document.createElement("BR"))}}f.appendChild(i);this._commentsDiv.appendChild(f);this.setLoading(false)}else this.setLoading(true);j.appendChild(this._commentsDiv);n=document.createElement("DIV");b.setPosition(0,0,0);b.render(n);b.setPosition(this._pageNum*a.cfg.COMMENTS_PER_PAGE,this.cfg.COMMENTS_PER_PAGE,this._count);j.appendChild(n);t.appendChild(j)}}};Msn.Controls.Comments.prototype=Msn.Controls;Msn.Controls.CommentsContainer=function(j){var a=this;this.cfg={NO_COMMENTS_ON_YOUR_VIDEOS:$["IDS_CLI_NoCommentsOnYourVideos"],LOADING:$["IDS_CLI_Loading"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],NO_COMMENTS_NICKNAME_VIDEO:$["IDS_CLI_NoCommentsNicknameVideo"],NO_COMMENTS_ON_YOUR_VIDEOS:$["IDS_CLI_NoCommentsOnYourVideos"],COMMENTS_PER_PAGE:2,SHOW_PAGINATION:true};this.cfg.COMMENTS_PER_PAGE=j;var c,o,h,l,n=0,k=null,i=new Array(j),m=document.createElement("DIV"),f=document.createElement("DIV"),b=new Msn.Controls.LiteralHTML(this.cfg.NO_COMMENTS_ON_YOUR_VIDEOS),e=new Msn.Controls.LiteralHTML(this.cfg.LOADING),g=new Msn.Controls.LiteralHTML(this.cfg.DATA_NOT_AVAILABLE);this.onPageClick=function(c,b){n=b;a.refresh();return false};var d=new Msn.Controls.Pagination(this.onPageClick,this.cfg.COMMENTS_PER_PAGE,false);this.setOnComplete=function(a){k=a};this.setCid=function(b){if(checkDefined(b)&&c!=b){c=b;a.refresh()}};this.setNickname=function(d){if(checkString(d)){this._nickname=d;if(checkDefined(c)&&(c!=Msn.Passport.getCid()||!Msn.Passport.isUserLoggedIn()))b.setHTML(a.cfg.NO_COMMENTS_NICKNAME_VIDEO.format(this._nickname))}};this.showPagination=function(b){if(checkDefined(b)){a.cfg.SHOW_PAGINATION=b;d.setVisibility(a.cfg.SHOW_PAGINATION);d.setDisplay(a.cfg.SHOW_PAGINATION)}};this.refresh=function(){if(checkDefined(c)&&0!=c)Msn.SoapboxServiceManager.GetUserComments(c,this.cfg.COMMENTS_PER_PAGE,n*this.cfg.COMMENTS_PER_PAGE,a.refreshCb,a.onError)};this.refreshCb=function(b){h=b.Videos;l=b.Comments;d.setPosition(n*a.cfg.COMMENTS_PER_PAGE,a.cfg.COMMENTS_PER_PAGE,b.Count);a.bindData();if(checkFunction(k))k(b)};this.setData=function(a){if(checkDefined(a)){l=a.Comments;h=a.Videos;d.setPosition(0,this.cfg.COMMENTS_PER_PAGE,a.Count);this.bindData()}};this.setError=function(){this.hideCommentCtrls();b.setVisibility(false);b.setDisplay(false);e.setDisplay(false);e.setVisibility(false);g.setDisplay(true);g.setVisibility(true)};this.onError=function(){a.setError()};this.hideCommentCtrls=function(){for(var b=0;b<j;b++){var a=i[b];if(null!=a){a.setVisibility(false);a.setDisplay(false)}}f.style.display="block"};this.bindData=function(){f.style.display="none";if(c!=Msn.Passport.getCid()||!Msn.Passport.isUserLoggedIn())b.setHTML(a.cfg.NO_COMMENTS_NICKNAME_VIDEO.format(this._nickname));else b.setHTML(a.cfg.NO_COMMENTS_ON_YOUR_VIDEOS);if(null!=h){e.setVisibility(false);e.setDisplay(false);g.setVisibility(false);g.setDisplay(false);var n=h.length;if(n>0){b.setVisibility(false);b.setDisplay(false);for(var k=0;k<j;k++)if(k<h.length){var d=i[k];if(null==d){i[k]=new Msn.Controls.CommentsControl;d=i[k];d.render(m)}d.setCommentVideo(l[k],h[k]);d.setVisibility(true);d.setDisplay(true)}else{d=i[k];if(null!=d){d.setVisibility(false);d.setDisplay(false)}}}else{a.hideCommentCtrls();b.setVisibility(true);b.setDisplay(true)}}else{a.hideCommentCtrls();b.setVisibility(false);b.setDisplay(false);e.setDisplay(true);e.setVisibility(true);g.setDisplay(false);g.setVisibility(false)}};this._render=function(c){if(null!=c){f.className="searchContainerContentSpacing";b.render(f);e.render(f);g.render(f);c.appendChild(f);m.className="commentContainerContentSpacing";c.appendChild(m);d.render(c);d.setVisibility(a.cfg.SHOW_PAGINATION);d.setDisplay(a.cfg.SHOW_PAGINATION);a.bindData()}}};Msn.Controls.CommentsContainer.prototype=Msn.Controls;Msn.Controls.CommentsControl=function(){var g=this;this.cfg={VIDEO_TITLE:$["IDS_CLI_VideoTitle"],LAST_COMMENT_ADDED:$["IDS_CLI_LastCommentAdded"],COMMENT:$["IDS_CLI_Comment"],LABEL_BY:$["IDS_CLI_By"],VIEW_ALL_COMMENTS:$["IDS_CLI_ViewAllComments"],COMMENT_MAX_LENGTH:1000,TITLE_MAX_LENGTH:80};var c,a,j="",d=null,e=null,h=null,i=null,b,f;this.setCommentVideo=function(g,k){if(checkDefined(g)&&checkDefined(k)){c=g;a=k;h.innerText=ll(c.Comment,this.cfg.COMMENT_MAX_LENGTH);d.innerText=ll(a.Title,this.cfg.TITLE_MAX_LENGTH);d.title=a.Title;e.innerText=c.Nickname;i.innerText=formatDate(c.TimeElapsed);if(checkDefined(f))f.setVideo(a);if(checkDefined(b))b.src=a.Thumbnail;else j=a.Thumbnail}};this.onNicknameClick=function(){if(null!=c){var a={};a.cid=c.Cid;a.nickname=c.Nickname;g.fireEvent(Msn.Event.ViewProfile,a)}return false};this.navigateToVideo=function(){if(null!=a)g.fireEvent(Msn.Event.MediaPlay,a);return false};this.navigateToVideoComments=function(){if(null!=a){g.fireEvent(Msn.Event.MediaPlay,a);setTimeout(function(){g.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.Comment)},100)}return false};this._render=function(m){if(null!=m){var k=document.createElement("DIV");m.appendChild(k);m.style.backgroundColor="#e7e7e7";m.style.marginBottom="12px";k.className="commentsOnYourVideo";var c=document.createElement("DIV");k.appendChild(c);c.className="videoThumbYourComments";b=document.createElement("IMG");c.appendChild(b);b.className="smallThumb";b.style.cursor="pointer";b.src=j;this.addListener(b,"onclick",this.navigateToVideo);var g=document.createElement("DIV");c.appendChild(g);g.style.position="relative";g.style.top="-17px";g.style.left="-16px";this.setCSSFloat(g,"right");f=new Msn.Controls.AddToPlaylist;f.setVideo(a);f.render(g);c=document.createElement("DIV");k.appendChild(c);c.className="videoMetadataYourComments";c.appendChild(document.createTextNode(this.cfg.LABEL_BY+" "));e=document.createElement("A");e.href=this.getLinkHref();this.addListener(e,"onclick",this.onNicknameClick);c.appendChild(e);c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.VIDEO_TITLE+" "));d=document.createElement("A");d.href=this.getLinkHref();this.addListener(d,"onclick",this.navigateToVideo);c.appendChild(d);c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.LAST_COMMENT_ADDED+" "));i=document.createElement("SPAN");c.appendChild(i);c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.COMMENT+" "));h=document.createElement("SPAN");c.appendChild(h);c.appendChild(document.createTextNode(" ("));var l=document.createElement("A");l.href=this.getLinkHref();l.innerText=this.cfg.VIEW_ALL_COMMENTS;this.addListener(l,"onclick",this.navigateToVideoComments);c.appendChild(l);c.appendChild(document.createTextNode(")"));c.appendChild(document.createElement("BR"));c.appendChild(document.createElement("BR"));c=document.createElement("DIV");c.className="clear";k.appendChild(c)}}};Msn.Controls.CommentsControl.prototype=Msn.Controls;Msn.CommunityBits=SoapboxService.Utils.CreateEnum("Comments",0,"IMActivity",1,"Rating",2,"Favorites",3,"Embed",4,"Tagging",5,"Email",6,"Spaces",7,"Permalink",8,"Digg",9);Msn.Controls.CommunityHelper=function(a){var c=checkObject(a)&&a.CsId==Msn.Controls.config.SoapboxCsId;this.cfg={MSNVIDEO_BITMASK:$["IDS_COM_CommunityMappingMsnv"],SOAPBOX_BITMASK:$["IDS_COM_CommunityMappingSpbx"]};function b(b,a){return (b&1<<a)==0}this.featureEnabled=function(f){var d=false;if(checkObject(a))if(a.ViralSyndication&&f==Msn.CommunityBits.Embed)d=true;else{var g=parseHex(c?this.cfg.SOAPBOX_BITMASK:this.cfg.MSNVIDEO_BITMASK);if(checkArray(a.CommunityBits)){var h=a.CommunityBits.length;for(var e=0;e<h;e++)g|=parseHex(a.CommunityBits[e].Name)}d=b(g,f)}return d};this.featureEnabledMarket=function(c){var a=false,d=parseHex(this.cfg.SOAPBOX_BITMASK)&parseHex(this.cfg.MSNVIDEO_BITMASK);a=b(d,c);return a}};Msn.MediaFormat=SoapboxService.Utils.CreateEnum("WMV",0,"FLV",1);Msn.PlayerLoadState=SoapboxService.Utils.CreateEnum("Waiting",0,"Loading",1,"Loaded",2,"Unloaded",3);Msn.Controls.CompositeMediaPlayer=function(){this.cfg={VIDEOS_PLAYED:$["IDS_GMT_AdTriggerVideosPlayed"],TIME_PLAYING:$["IDS_GMT_AdTriggerTimePlaying"],TIME_ELAPSED:$["IDS_GMT_AdTriggerTimeElapsed"],RAD_URL:$["IDS_GMT_RadUrl"],MSG_VIDEOERRORPLAYING:$["IDS_CLI_MsgVideoerrorplaying"],MSG_VIDEOERRORQUEUING:$["IDS_CLI_MsgVideoerrorqueuing"],MSG_PROCESSING:$["IDS_CLI_MsgProcessing"],MSG_FAILED:$["IDS_CLI_MsgFailed"],MSG_REJECTED:$["IDS_CLI_MsgRejected"],ADVERTISEMENT:$["IDS_CLI_Advertisement"],PLAY_AD_BEFORE_FIRST_VID:$["IDS_GMT_PlayAdBeforeFirstVid"],PLAY_AD_AFTER_FIRST_VID:$["IDS_GMT_PlayAdAfterFirstVid"],ACTIVITY_PAGEGROUP:$["IDS_GMT_ActivityPageGroup"],GEO_COUNTRY:Msn.Controls.config.country};var a=this,h=Msn.PlayerLoadState.Waiting,q=false,i=null,l=null,g=getWindowContext()==Msn.WindowContext.DaughterWindow?408:432,f=getWindowContext()==Msn.WindowContext.DaughterWindow?346:364,p=false,o=[],c=null,u=null,t=null,b=null,n=null,m=false,d=null,j=null,r=false,e={};if(!checkDefined(Msn.Player))Msn.Player=this;this.subscribeEvent(Msn.Event.MediaPlay);this.subscribeEvent(Msn.Event.MediaQueue);this.subscribeEvent(Msn.Event.ControlsReqPause);this.subscribeEvent(Msn.Event.SetAutoProgress);this.subscribeEvent(Msn.Event.DefaultVideosLoaded);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.ControlsReqFullScreen);this.subscribeEvent(Msn.Event.TrackReplay);this.subscribeEvent(Msn.Event.WindowResize);this.subscribeEvent(Msn.Event.AdChanged);this.subscribeEvent(Msn.Event.CompanionAdDisplayed);this.subscribeEvent(Msn.Event.AdSurveyAvailable);this.subscribeEvent(Msn.Event.MediaLoaded);this.subscribeEvent(Msn.Event.QueuePermalinkPlaylist);this.subscribeEvent(Msn.Event.MediaAutoPlay);function w(a){if(checkDefined(a)&&!checkDefined(a.nudged)){var b=parseInt(a.style.zIndex);if(isNaN(b))b=0;a.style.zIndex=b+1;a.nudged="1"}}this.onEvent=function(f,c,b,e){this.log("mediaPlayer","[CompositeMediaPlayer] received event : "+c+", param :"+b);switch(c){case Msn.Event.AdChanged:if(checkDefined(b)&&checkDefined(b.ad)){_adObj=b.ad;if(checkString(_adObj.flashVidUrl))if(d&&checkDefined(d))d.style.visibility="visible"}else if(d&&checkDefined(d)&&checkObject(b))d.style.visibility="visible";if(a.getBrowser()==Msn.Browser.Firefox)w(n);break;case Msn.Event.MediaLoaded:if(d&&checkDefined(d)&&checkObject(b))d.style.visibility="hidden";break;case Msn.Event.TrackReplay:this.trackReplay();break;case Msn.Event.MediaPlay:case Msn.Event.MediaQueue:case Msn.Event.MediaAutoPlay:switch(b.Status){case SoapboxService.VideoStatus.New:case SoapboxService.VideoStatus.Processing:Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"videoplayerror"});customAlert(this.cfg.MSG_PROCESSING);break;case SoapboxService.VideoStatus.Failed:customAlert(this.cfg.MSG_FAILED);break;case SoapboxService.VideoStatus.Published:case SoapboxService.VideoStatus.Approved:case SoapboxService.VideoStatus.LockedForReview:case SoapboxService.VideoStatus.Pending:this.play(b,c);break;case SoapboxService.VideoStatus.Rejected:customAlert(this.cfg.MSG_REJECTED);break}break;case Msn.Event.DefaultVideosLoaded:this.loadDefaultVideo(b,e);break;case Msn.Event.ControlsReqPause:if(false==b)this.setAutoProgress(true);this.setPause(b);break;case Msn.Event.SetAutoProgress:this.setAutoProgress(b);break;case Msn.Event.ControlsReqFullScreen:this.exec("reqToggleFullscreen");break;case Msn.Event.ControlsAckFullScreen:this.toggleFullScreen(b);break;case Msn.Event.WindowResize:setTimeout(function(){a.onResize()},0);break;case Msn.Event.QueuePermalinkPlaylist:if(checkArray(b)&&b.length==0)a.exec("vidForceError","permalink");else this.loadPlaylist(b);break;default:break}};this.exec=function(b,e,d){if(p){var a=c.getObjectNode();if(checkDefined(a)&&checkFunction(a[b]))try{var f=a[b](e);if(checkFunction(d))d.call(this,f)}catch(g){}}else o.push({"name":b,"arg":e,"cb":d})};this.execQueuedCommands=function(){var b=o.clone();o.clear();for(var a=0;a<b.length;a++)this.exec(b[a].name,b[a].arg,b[a].cb)};this.play=function(a,d){if(d==Msn.Event.MediaPlay)this.setAutoProgress(true);if(checkObject(a)&&checkString(a.Id)){var c,b;switch(d){case Msn.Event.MediaPlay:c="pb";b="vidPlay";break;case Msn.Event.MediaQueue:c="add";b="queAddToPlaylistEnd";break;case Msn.Event.MediaAutoPlay:c="auto";b="vidAutoPlay";break}if(!checkString(a.AddSource))a.AddSource=c;s(a);var e=this.createPlayerVideoObject(a);this.exec(b,e)}};this.createPlayerVideoObject=function(b){var a={};a.Status=b.Status;a.Id=b.Id;a.Provider=b.Provider;a.CsId=b.CsId;a.Source=b.Source;a.SourceFriendlyName=b.SourceFriendlyName;a.PageGroup=b.PageGroup;a.Title=b.Title;a.Description=b.Description;a.StreamLength=b.StreamLength;a.ReleaseDate=b.ReleaseDate;a.Market=b.Market;a.AllTags=b.AllTags;a.MediaFiles=b.MediaFiles;a.Thumbnail=b.Thumbnail;a.MiniThumbnail=b.MiniThumbnail;a.MediumThumbnail=b.MediumThumbnail;a.PosterFrame=b.PosterFrame;a.PlayCount=b.PlayCount;a.AverageRating=b.AverageRating;a.NumComments=b.NumComments;a.NumFavorites=b.NumFavorites;a.AddSource=b.AddSource;a.ReportingData=b.ReportingData;return a};this.onChannelVideo=function(a){this.exec("vidPlayId",a)};this.setLoadState=function(a){p=a;if(p)this.execQueuedCommands()};this.setPause=function(b){var a=b?"vidPause":"vidResume";this.exec(a)};this.setAutoProgress=function(a){this.exec("queSetAutoProgress",a)};this.onVideoQueryComplete=function(c){if(checkArray(c,1)){h=Msn.PlayerLoadState.Loaded;for(var b=0;b<c.length;b++)if(checkDefined(c[b])){c[b].AddSource="qs";if(b==0&&!checkInt(i,0))Msn.Controls.fireEvent(Msn.Event.MediaPlay,c[b]);else Msn.Controls.fireEvent(Msn.Event.MediaQueue,c[b])}if(checkInt(i,0)){a.exec("queSetPlaylistPosition",i);i=null}}else a.onVideoQueryError();a.loadPermalinkVideos(false)};this.onVideoQueryError=function(){h=Msn.PlayerLoadState.Loaded;a.exec("vidForceError","permalink");a.loadPermalinkVideos(true);a.fireEvent(Msn.Event.MetadataError)};this.saveState=function(b){a.exec("queSavePlaylist",b)};this.loadState=function(){if(!checkDefined(Msn.PermalinkManager))a.loadPlaylist()};this.loadPlaylist=function(b){j=b;if(!q){q=true;a.exec("queLoadPlaylist",null,a.loadPlaylistCb)}else a.loadPlaylistCb()};this.loadPlaylistCb=function(d){var b=true,c=null;if(checkArray(d.playlist,1)){c=d.playlist;i=d.position;b=false;a.fireEvent(Msn.Event.MediaPlaylistLoaded,c);if(!Msn.Controls.IMMode){h=Msn.PlayerLoadState.Loading;var e=new Msn.Controls.VideoService(c);e.getVideos(null,a.onVideoQueryComplete,a.onVideoQueryError)}}else{var k=null,g=getUrlParam("vid");if(checkString(g)){b=false;var f=[];f.push(g);e=new Msn.Controls.VideoService(f);e.getVideos(null,a.onVideoQueryComplete,a.onVideoQueryError)}else if(checkArray(j,1)){b=false;a.loadPermalinkVideos(true)}}if(b){h=Msn.PlayerLoadState.Unloaded;a.loadDefaultVideo()}};this.loadPermalinkVideos=function(c){if(checkArray(j,1)){var e=j.length;for(var b=0;b<e;b++){var d=j[b];switch(d.Status){case SoapboxService.VideoStatus.Published:case SoapboxService.VideoStatus.Approved:case SoapboxService.VideoStatus.LockedForReview:case SoapboxService.VideoStatus.Pending:a.play(d,!c||b!=0?Msn.Event.MediaQueue:Msn.Event.MediaPlay);c=false;break}}}};this.loadDefaultVideo=function(a,b){if(b!=null)r=b;if(checkArray(a,1)){l=a[0];l.AddSource="dv"}if(checkDefined(l)&&h==Msn.PlayerLoadState.Unloaded){h=Msn.PlayerLoadState.Loaded;Msn.Controls.fireEvent(r?Msn.Event.MediaPlay:Msn.Event.MediaQueue,l)}};this.getFlashvars=function(){var a={};a.mkt=Msn.Controls.config.market;a.brand=Msn.Controls.config.brand;a.country=this.cfg.GEO_COUNTRY||"false";a.fs="true";a.cbprefix="Msn.Player.";if(getWindowContext()==Msn.WindowContext.IMActivity){a.mode="inline";a.ch="im";a.npl="1";a.playlistmin="2";a.c="empty";a.fr="IMinline";if(checkString(this.cfg.ACTIVITY_PAGEGROUP))a.pg=this.cfg.ACTIVITY_PAGEGROUP;else a.ad="false"}else{a.mode="destination";a.il=getWindowContext()==Msn.WindowContext.DaughterWindow?"dw":"dest";a.eap="true";a.affid=getUrlParam("ocid");a.fr=getUrlParam("fr");a.from=getUrlParam("from");a.fg=getUrlParam("fg")}var e="sl:version:";e=e+(isSilverlightInstalled()?Msn.Controls.config.silverlightMinVersion:"n/a");a.slversion=e;if(doNotScaleVideosEnabled())a.noScale="true";if(checkInt(this.cfg.VIDEOS_PLAYED))a.videosPlayed=this.cfg.VIDEOS_PLAYED;if(checkInt(this.cfg.TIME_PLAYING))a.timePlaying=this.cfg.TIME_PLAYING;if(checkInt(this.cfg.TIME_ELAPSED))a.timeElapsed=this.cfg.TIME_ELAPSED;a.playAdBeforeFirstVid=isTrue(this.cfg.PLAY_AD_BEFORE_FIRST_VID)?"true":"false";a.playAdAfterFirstVid=isTrue(this.cfg.PLAY_AD_AFTER_FIRST_VID)?"true":"false";a.radUrl=this.cfg.RAD_URL;a.anon=Msn.Controls.config.anon;a.mh=Msn.Controls.config.mh;a.rf=getReferrer();a.r=getDomains(getCDNPath(""));a.d=getDomains(getHostUrl());var g=new Msn.Controls.VCAdapterHelper;a.vc=getDomains(g.getServer());if(checkArray(Msn.Controls.config.VCServiceUrlsRandom,1))a.vce=getDomains(Msn.Controls.config.VCServiceUrlsRandom);if(checkArray(Msn.Controls.config.VCServiceImageUrlsRandom,1))a.vci=getDomains(Msn.Controls.config.VCServiceImageUrlsRandom);var d=[];for(var b=0;b<Msn.Controls.config.playbackSequence.length;b++)if(Msn.Controls.config.playbackSequence[b]=="wmp")d.push("WMP_");else if(Msn.Controls.config.playbackSequence[b]=="silverlight")d.push("SL_");else if(Msn.Controls.config.playbackSequence[b]=="flash")d.push("flash");if(checkArray(d,1))a.seq=d.join(",");if(Msn.Passport.isUserLoggedIn())a.login="true";var c=[];if(checkDefined(document.getElementById("fo"))){c.push("fo_ad_div,300,250");c.push("fo_ad_div,300,240")}if(checkDefined(document.getElementById("lb")))c.push("lb_ad_div,300,60");if(checkDefined(document.getElementById("ads")))c.push("ads,300,60");if(checkArray(c,1))a.adDivs=c.join(";");var f=[];for(b in a)if(checkString(a[b]))f.push(b+"="+a[b]);return f.join("&")};this.localToGlobal=function(c){var a=c,b={x:0,y:0};while(a){b.x-=a.offsetLeft;b.y-=a.offsetTop;a=a.offsetParent}return b};this.toggleFullScreen=function(d){if(m!=d){m=d;if(m){scrollTo(0,0);var e=a.localToGlobal(b.offsetParent);n.style.zIndex="1050";b.style.width=document.documentElement.clientWidth+"px";b.style.height=document.documentElement.clientHeight+"px";b.style.left=e.x+"px";b.style.top=e.y+"px";c.getObjectNode().width=document.documentElement.clientWidth;c.getObjectNode().height=document.documentElement.clientHeight}else{c.getObjectNode().width=g;c.getObjectNode().height=f;b.style.width=g+"px";b.style.height=f+"px";b.style.left="0px";b.style.top="0px";n.style.zIndex="100"}}};this.onResize=function(){if(m){var d=a.localToGlobal(b.offsetParent);b.style.width=document.documentElement.clientWidth+"px";b.style.height=document.documentElement.clientHeight+"px";b.style.left=d.x+"px";b.style.top=d.y+"px";c.getObjectNode().width=document.documentElement.clientWidth;c.getObjectNode().height=document.documentElement.clientHeight}};this.trackReplay=function(){a.exec("trackReplay")};var k=function(a,b){if(checkString(a)&&checkFunction(b)){var c=a.toLowerCase().replace(/-/g,"");if(checkObject(e[c]))b(e[c].video);else{Msn.Controls.log("mediaPlayer","[VideoCache] Video missing from cache: "+a);var d=new Msn.Controls.VideoService([a]);d.getVideos(null,v(b),null)}}},v=function(a){var b=function(b){if(checkArray(b,1)){s(b[0]);k(b[0].Id,a)}};return b},s=function(a){if(checkObject(a)&&checkString(a.Id)){var b=a.Id.toLowerCase().replace(/-/g,"");if(checkObject(e[b]))e[b].count++;else{e[b]={video:a,count:1};Msn.Controls.log("mediaPlayer","[VideoCache] Video added to cache: "+b)}}},A=function(b){if(checkString(b)){var a=b.toLowerCase().replace(/-/g,"");if(checkObject(e[a])){e[a].count--;if(e[a].count<1){delete e[a];Msn.Controls.log("mediaPlayer","[VideoCache] Video removed from cache: "+a)}}}};this.OnMediaChanged=function(a){k(a,x)};var x=function(a){if(checkObject(a)){Msn.Controls.log("mediaPlayer","[MediaPlayer] Media Changed");Msn.Controls.fireEvent(Msn.Event.MediaChangedBegin,a)}};this.OnMediaCompleted=function(){Msn.Controls.log("mediaPlayer","[MediaPlayer] Media Complete");Msn.Controls.fireEvent(Msn.Event.MediaCompleted)};this.OnVideoLoaded=function(a){if(checkString(a))k(a,y);else{Msn.Controls.log("mediaPlayer","[MediaPlayer] Ad Loaded");Msn.Controls.fireEvent(Msn.Event.MediaLoaded,null)}};var y=function(a){if(checkObject(a)){Msn.Controls.log("mediaPlayer","[MediaPlayer] Video Loaded: "+a.Id);Msn.Controls.fireEvent(Msn.Event.MediaLoaded,a);var b=new Msn.Controls.VideoServiceExtended(a);b.reportPlayback()}};this.OnExternalInterfaceLoaded=function(){a.setLoadState(true)};this.OnRequestAutoplay=function(){Msn.Controls.log("mediaPlayer","[MediaPlayer] RequestAutoplay");Msn.Controls.fireEvent(Msn.Event.RequestAutoplay)};this.OnAdChanged=function(b,c){Msn.Controls.log("mediaPlayer","[MediaPlayer] AdChanged");var a={};a.ad=b;k(c,z(a))};var z=function(a){var b=function(b){a.video=b;Msn.Controls.fireEvent(Msn.Event.AdChanged,a)};return b};this.OnCompanionAdDisplayed=function(a){Msn.Controls.log("mediaPlayer","[MediaPlayer] CompanionAdDisplayed");Msn.Controls.fireEvent(Msn.Event.CompanionAdDisplayed,a)};this.OnAdSurveyAvailable=function(a){Msn.Controls.log("mediaPlayer","[MediaPlayer] AdSurveyAvailable");Msn.Controls.fireEvent(Msn.Event.AdSurveyAvailable,a)};this.OnToggleFullscreen=function(a){Msn.Controls.fireEvent(Msn.Event.ControlsAckFullScreen,a)};this.OnInfo=function(a){Msn.Controls.log("mediaPlayer","[Player] "+a)};this.OnVideoLoadError=function(a){Msn.Controls.fireEvent(Msn.Event.MediaLoadError,a)};this._render=function(h){if(null!=h&&null==c){var e;h.style.position="relative";h.style.left="0px";h.style.top="0px";h.style.width=g+"px";h.style.height=f+14+"px";h.style.display="block";h.style.zIndex="100";n=h;d=document.createElement("DIV");d.style.visibility="hidden";this.setCSSFloat(d,"right");d.appendChild(document.createTextNode(a.cfg.ADVERTISEMENT));h.appendChild(d);var i=document.createElement("DIV");i.style.position="relative";i.style.clear="both";h.appendChild(i);b=document.createElement("DIV");b.style.position="absolute";b.style.left="0px";b.style.top="0px";b.style.width=g+"px";b.style.height=f+"px";i.appendChild(b);var j=Msn.Controls.config.playerUrl?Msn.Controls.config.playerUrl:getCDNPath("/flash/soapbox1_1.swf");c=new Msn.Controls.FlashObject("msnPlayer",j,g,f);c.setFlashVars(a.getFlashvars());c.setMenu(true);c.setInstallCtrl(new Msn.Controls.FlashInstall,9);if(Msn.Controls.config.showWmp){c.setWMode("transparent");e=document.createElement("DIV");e.style.position="absolute";e.style.left="0px";e.style.top="0px";b.appendChild(e);u=new Msn.Controls.WMPlayer(g,f,c);u.render(e)}if(Msn.Controls.config.showSilverlight){c.setWMode("transparent");e=document.createElement("DIV");e.style.position="absolute";e.style.left="0px";e.style.top="0px";b.appendChild(e);t=new Msn.Controls.SilverlightPlayer(g,f,c);t.render(e)}e=document.createElement("DIV");e.style.position="absolute";e.style.left="0px";e.style.top="0px";b.appendChild(e);c.render(e)}}};Msn.Controls.CompositeMediaPlayer.prototype=Msn.Controls;Msn.Controls.ContactControl=function(d){var e=this,b=null,a=null,c=null;this.setOnPhotoClick=function(b){if(checkFunction(b)){c=b;if(checkDefined(a))a.style.cursor="pointer"}};this.onPhotoClick=function(){if(checkFunction(c))c()};this.refresh=function(){b.style.display="block";b.style.visibility="visible"};this._render=function(c){if(null!=c){b=document.createElement("DIV");a=document.createElement("IMG");a.src=getCDNPath("/i/contactControl_"+d.toLowerCase()+".gif");a.border="0px";switch(d.toLowerCase()){case "large":b.style.width="100";b.style.height="100";a.style.left="10px";a.style.margin="10px 10px 10px 10px";break;case "small":b.style.width="60";b.style.height="50";a.style.top="11";a.style.left="16";a.style.margin="20px 20px 20px 20px";break}b.appendChild(a);c.appendChild(b);this.addListener(a,"onclick",e.onPhotoClick)}}};Msn.Controls.ContactControl.prototype=Msn.Controls;Msn.Controls.ContactPicker=function(h,j){var i=this,a,b,e,d,c,f,g;this.cfg={OK:$["IDS_CLI_Ok"],CANCEL:$["IDS_CLI_Cancel"],SELECT_PEOPLE:$["IDS_CLI_SelectPeople"]};this.setOnData=function(a){f=a};this.onLoad=function(){if(checkDefined(c.cp1))g=c.cp1.getSelectedContacts()};this.close=function(){if(checkDefined(a)){document.body.removeChild(a);a=null;this.fireEvent(Msn.Event.DialogClose)}};this.getDelta=function(g,h,e){var f=[],d=[];for(var a=0;a<g.length;a++){var b=g[a];if(e==b.isCategory)d.push(b.serverSideID)}for(a=0;a<h.length;a++){b=h[a];if(e==b.isCategory){var c=b.serverSideID;if(c&&!d.contains(c))f.push(c)}}return f};this.onOkButtonClick=function(){try{var e=g,d=c.cp1.getSelectedContacts(),j=[],h=[];if(checkDefined(c.autoComplete)){var b=c.autoComplete.selectedAbchElements;for(var a=0;a<b.length;a++)if(checkString(b[a].email)){h.push(HTMLDecodeString(b[a].email));if(!checkDefined(b[a].serverSideID))j.push(HTMLDecodeString(b[a].email))}}var k={"contactsToAdd":this.getDelta(e,d,false),"contactsToRemove":this.getDelta(d,e,false),"categoriesToAdd":this.getDelta(e,d,true),"categoriesToRemove":this.getDelta(d,e,true),"emailsToAdd":j,"allEmailsToAdd":h};f(k)}catch(l){}i.close()};this.onCancelButtonClick=function(){try{f(null)}catch(a){}i.close()};this._render=function(){var f="/contact/Default.aspx?mkt={0}&brand={1}";f=f.format(checkString(Msn.Controls.config.market)?Msn.Controls.config.market:"",checkString(Msn.Controls.config.brand)?Msn.Controls.config.brand:"");if(checkGuid(h))f+="&videoId="+h;if(j)f+="&peopleOnly=1";a=document.createElement("DIV");a.className="popUp";var g=document.createElement("DIV");g.className="headerContactPickerDiv";var i=document.createElement("SPAN");i.className="headerContactPicker";i.appendChild(document.createTextNode(this.cfg.SELECT_PEOPLE));g.appendChild(i);a.appendChild(g);b=document.createElement("IFRAME");b.setAttribute("id","contactPickerIframe");b.setAttribute("frameBorder","0");b.setAttribute("scrolling","auto");b.setAttribute("src",f);a.appendChild(b);_buttonDiv=document.createElement("DIV");_buttonDiv.className="contactPickerBottomControl";a.appendChild(_buttonDiv);var k=document.createElement("DIV");k.className="leftButton";e=document.createElement("BUTTON");e.className="popUpButton";this.addListener(e,"onclick",this.onOkButtonClick);var m=document.createElement("SPAN");m.appendChild(document.createTextNode(this.cfg.OK));e.appendChild(m);k.appendChild(e);_buttonDiv.appendChild(k);var l=document.createElement("DIV");l.className="rightButton";d=document.createElement("BUTTON");d.className="popUpButton";this.addListener(d,"onclick",this.onCancelButtonClick);var n=document.createElement("SPAN");n.appendChild(document.createTextNode(this.cfg.CANCEL));d.appendChild(n);l.appendChild(d);_buttonDiv.appendChild(l);document.body.appendChild(a);this.fireEvent(Msn.Event.DialogOpen);c=window.frames[2];this.addListener(b,"onload",this.onLoad)}};Msn.Controls.ContactPicker.prototype=Msn.Controls;Msn.Controls.Container=function(o,s,m,k){var E=this;this.cfg={VIEW_ALL:$["IDS_CLI_ViewAll"],RSS_ALT:$["IDS_CLI_RssAlt"],ADD_TO_PLAYLIST:$["IDS_CLI_PlayAll"],ADD_TO_PLAYLIST_IMG:getCDNPath("/i/addToPlaylist.gif"),TITLE_MAX_LENGTH:60};var A=0,z=0,p=false,t=false,q=false,n=true,l=new Msn.Controls.LiteralHTML,h,r=null,u=null,a,b,i,f,g,d,c,j,x="containerBody",w=new Msn.Controls.GenericActionLink,v=new Msn.Controls.RssLink,D,C,e,B,y=150;this._refresh=function(){this._setContainerDisplay();this._setHeaderDisplay();this._setPlayAllDisplay();this._setRssDisplay();this._setViewAllDisplay();this._setCustomHeaderDisplay();this._setSize()};this._setSize=function(){if(checkDefined(a)){if(checkInt(A,1)){a.style.width=width;b.style.width=width;j.style.width=width}if(checkInt(z,1))a.style.height=height;if(checkInt(y,1))c.style.width=y+"px"}};this._setContainerDisplay=function(){if(checkDefined(a)){if(checkDefined(o)&&o)a.style.display="block";else a.style.display="none";if(checkDefined(k)&&k)a.className="containerScrollable";else a.className="containerNonScrollable"}};this._setHeaderDisplay=function(){if(checkDefined(b))if(checkDefined(s)&&s)b.style.display="block";else b.style.display="none"};this._setPlayAllDisplay=function(){if(checkDefined(f))if(checkDefined(p)&&p)f.style.display="block";else f.style.display="none"};this._setRssDisplay=function(){if(checkDefined(g))if(checkDefined(t)&&t)g.style.display="block";else g.style.display="none"};this._setViewAllDisplay=function(){if(checkDefined(d))if(checkDefined(q)&&q){d.style.display="block";if(checkDefined(e))e.style.display="block"}else{d.style.display="none";if(checkDefined(e))e.style.display="none"}};this._setCustomHeaderDisplay=function(){if(checkDefined(c))if(checkDefined(n)&&n)c.style.display="block";else c.style.display="none"};this.showContainer=function(a){if(checkDefined(a)&&a)o=true;else o=false;this._setContainerDisplay()};this.showHeader=function(a){if(checkDefined(a)&&a)s=true;else s=false;this._setHeaderDisplay()};this.showRss=function(a){if(checkDefined(a)&&a)t=true;else t=false;this._setRssDisplay()};this.showPlayAll=function(a){if(checkDefined(a)&&a)p=true;else p=false;this._setPlayAllDisplay()};this.showViewAll=function(a){if(checkDefined(a)&&a)q=true;else q=false;this._setViewAllDisplay()};this.showCustomHeader=function(a){if(checkDefined(a)&&a)n=true;else n=false;this._setCustomHeaderDisplay()};this.setTitle=function(b,a){if(checkDefined(b))m=b;else m="";if(checkDefined(i)){i.innerText=ll(m,this.cfg.TITLE_MAX_LENGTH);i.title=checkString(a)?a:m}};this.setSize=function(b,a){A=b;z=a;this._setSize()};this.setOnViewAllClick=function(a,b){r=a;u=b};this.onViewAllClick=function(){if(checkDefined(r))if(checkDefined(u))r(u);else r();scrollTo(0,0);return false};this.onPlayAllClick=function(){if(checkObject(h)&&checkFunction(h.onPlayAll))h.onPlayAll();Msn.Reporting.linkTrack("gal",{name:"playall"})};this.setRssUrl=function(b,a){if(checkDefined(v))v.setRssUrl(b,a)};this.setCustomHeaderCtrl=function(a){if(checkDefined(a)){l=a;if(checkDefined(c)){c.innerText="";l.render(c)}}else l=new Msn.Controls.LiteralHTML};this.setContent=function(a){if(checkDefined(a))h=a;else h=null};this.setScrollable=function(a){if(checkDefined(a)&&a)k=true;else k=false};this.setContainerBodyClass=function(a){if(checkString(a,0))x=a};this._render=function(o){a=document.createElement("div");if(checkDefined(k)&&k)a.className="containerScrollable";else a.className="containerNonScrollable";b=document.createElement("DIV");b.className="containerHeader";i=document.createElement("DIV");i.className="containerTitle";this.setCSSFloat(i,"left");f=document.createElement("DIV");f.className="containerPlayAll";this.setCSSFloat(f,"right");g=document.createElement("DIV");g.className="containerRss";this.setCSSFloat(g,"right");d=document.createElement("DIV");d.className="containerViewAll";d.innerText=this.cfg.VIEW_ALL;d.title=this.cfg.VIEW_ALL;this.setCSSFloat(d,"left");c=document.createElement("DIV");c.className="containerCustomHeader";j=document.createElement("DIV");j.className=x;if(null!=o){o.appendChild(a);a.appendChild(b);b.appendChild(i);this.setTitle(m);e=document.createElement("A");e.href=this.getLinkHref();e.appendChild(d);b.appendChild(e);e.style.display="none";this.addListener(d,"onclick",this.onViewAllClick);this.addListener(d,"onkeydown",this.onViewAllClick);b.appendChild(g);v.render(g);w.setImage(this.cfg.ADD_TO_PLAYLIST_IMG,this.cfg.ADD_TO_PLAYLIST);w.setOnClickHandler(this.onPlayAllClick);w.render(f);b.appendChild(f);b.appendChild(c);if(checkDefined(l))l.render(c);a.appendChild(j);if(checkDefined(h))h.render(j);var n=document.createElement("SPAN");this.setCSSFloat(n,"right");n.style.height="1px";j.appendChild(n);this._refresh()}}};Msn.Controls.Container.prototype=Msn.Controls;Msn.DefaultPage=SoapboxService.Utils.CreateEnum("HomePage",0,"SearchResultsPage",1,"YourPage",2,"ChannelPage",3,"UploadQueuePage",4,"ProfilePage",5,"TopTagPage",6,"SplitSearchPage",7,"UploadPage",8,"EditPage",9,"BrowseVideosPage",10,"EmptyPage",11,"SmallShowcaseSearchResultsPage",12,"LargeShowcaseSearchResultsPage",13,"ProfileErrorPage",14);Msn.Controls.DefaultPage=function(){var u=this;this.cfg={EDIT_VIDEO:$["IDS_CLI_EditVideo"],ANONYMOUS:$["IDS_CLI_Anonymous"],USER_CREATED_VIDEOS:$["IDS_CLI_UserCreatedVideos"],CATEGORIES:$["IDS_CLI_Categories"],CURRENT_VIDEO_STATUS:$["IDS_CLI_CurrentVideoStatus"],PROFILE_NOT_AVAILABLE:$["IDS_CLI_NoProfile"],USE_WINDOW_MODE:$["IDS_UPL_UseWindowMode"],MIN_COLUMNS:4};this.subscribeEvent(Msn.Event.Navigate);this.subscribeEvent(Msn.Event.NavigateCategory);this.subscribeEvent(Msn.Event.Search);this.subscribeEvent(Msn.Event.SplitSearch);this.subscribeEvent(Msn.Event.VideoEdit);this.subscribeEvent(Msn.Event.ViewAllUpload);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.ViewProfile);this.subscribeEvent(Msn.Event.ViewAllProfileTags);this.subscribeEvent(Msn.Event.ViewAllProfileComments);this.subscribeEvent(Msn.Event.ViewErrorProfile);this.onEvent=function(i,h,a){switch(h){case Msn.Event.ControlsAckFullScreen:this.setVisibility(!a);this.setDisplay(!a);break;case Msn.Event.Navigate:if(checkDefined(a)&&checkInt(a.menuId)){var f=parseInt(a.menuId),c=SoapboxService.SortOrder.Default,b=a.page;if(!checkInt(b))b=0;if(checkDefined(a.sortOrder))c=a.sortOrder;switch(f){case Msn.Menu.Home:this.selectTab(Msn.DefaultPage.HomePage);break;case Msn.Menu.BrowseVideos:this.selectTab(Msn.DefaultPage.BrowseVideosPage);break;case Msn.Menu.MostRecent:var d=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListRecent,b,c);this.fireEvent(Msn.Event.Search,d);break;case Msn.Menu.MostViewed:d=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListPopular,b,c);this.fireEvent(Msn.Event.Search,d);break;case Msn.Menu.MostCommented:d=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListMostCommented,b,c);this.fireEvent(Msn.Event.Search,d);break;case Msn.Menu.TopFavorites:d=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListTopFavorites,b,c);this.fireEvent(Msn.Event.Search,d);break;case Msn.Menu.TopRated:d=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListTopRated,b,c);this.fireEvent(Msn.Event.Search,d);break;case Msn.Menu.TopTags:this.selectTab(Msn.DefaultPage.TopTagPage);break;case Msn.Menu.Categories:this.selectTab(Msn.DefaultPage.ChannelPage);break;case Msn.Menu.Upload:case Msn.Menu.UploadVideos:this.selectTab(Msn.DefaultPage.UploadPage);break}}break;case Msn.Event.NavigateCategory:if(checkObject(a)){d=Msn.Controls.SearchQueryFactory.create(a.menuId.categoryGuid,SoapboxService.SearchType.Channel,a.page,a.sortOrder);this.fireEvent(Msn.Event.Search,d)}break;case Msn.Event.ViewProfile:case Msn.Event.ViewAllProfileTags:case Msn.Event.ViewAllProfileComments:if(a.cid==Msn.Passport.getCid())this.selectTab(Msn.DefaultPage.YourPage);else this.selectTab(Msn.DefaultPage.ProfilePage);break;case Msn.Event.ViewAllUpload:this.fireEvent(Msn.Event.MenuSelect,{menuId:null});this.selectTab(Msn.DefaultPage.UploadQueuePage);break;case Msn.Event.Search:var e=Msn.DefaultPage.SearchResultsPage;if(checkDefined(a.showcaseData)&&checkDefined(a.showcaseData.showcaseSize))e=Msn.ShowcaseSize.Large==a.showcaseData.showcaseSize?Msn.DefaultPage.LargeShowcaseSearchResultsPage:Msn.DefaultPage.SmallShowcaseSearchResultsPage;this.selectTab(e,a.showcaseData);break;case Msn.Event.SplitSearch:this.selectTab(Msn.DefaultPage.SplitSearchPage);break;case Msn.Event.VideoEdit:this.selectTab(Msn.DefaultPage.EditPage);this.fireEvent(Msn.Event.FocusRequest,g);break;case Msn.Event.ViewErrorProfile:this.selectTab(Msn.DefaultPage.ProfileErrorPage);break}};var a=new Msn.Controls.FilterTab(null,null,"fadeFilter"),n=new Msn.Controls.Showcase,s=new Msn.Controls.HomePage,q=new Msn.Controls.SearchResultsPage,p=new Msn.Controls.SearchResultsPage(Msn.ShowcaseSize.Small),o=new Msn.Controls.SearchResultsPage(Msn.ShowcaseSize.Large),r=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.CATEGORIES,b=new Msn.Controls.Container(true,true,r,false),l=new Msn.Controls.ChannelsHome(4),d=null,h=null,e=null,i=null,c=null,m=null,j=null,k=null,g=null,f=null;b.showViewAll(false);b.showRss(false);b.setContent(l);l.setContainer(b);a.add(Msn.DefaultPage.EmptyPage,new Msn.Controls.Label(""));a.add(Msn.DefaultPage.ProfileErrorPage,new Msn.Controls.Label(this.cfg.PROFILE_NOT_AVAILABLE));a.add(Msn.DefaultPage.HomePage,s);a.add(Msn.DefaultPage.SearchResultsPage,q);a.add(Msn.DefaultPage.SmallShowcaseSearchResultsPage,p);a.add(Msn.DefaultPage.LargeShowcaseSearchResultsPage,o);h=new Msn.Controls.YourWarhol(true);d=new Msn.Controls.Container(true,false,"",false);d.setContainerBodyClass("yourWarholContainerBody");d.setContent(h);a.add(Msn.DefaultPage.YourPage,d);a.add(Msn.DefaultPage.ChannelPage,b);c=new Msn.Controls.Container(true,true,this.cfg.CURRENT_VIDEO_STATUS,false);var t=new Msn.Controls.UploadQueue(true);c.setContent(t);c.showViewAll(false);c.setScrollable(true);a.add(Msn.DefaultPage.UploadQueuePage,c);e=new Msn.Controls.Container(true,false,"",false);e.setContainerBodyClass("yourWarholContainerBody");i=new Msn.Controls.YourWarhol(false);e.setContent(i);a.add(Msn.DefaultPage.ProfilePage,e);m=new Msn.Controls.BrowseTagControl;a.add(Msn.DefaultPage.TopTagPage,m);j=new Msn.Controls.SplitSearchPage;a.add(Msn.DefaultPage.SplitSearchPage,j);k=new Msn.Controls.UploadPage;a.add(Msn.DefaultPage.UploadPage,k);g=new Msn.Controls.VideoEdit;f=new Msn.Controls.Container(true,true,this.cfg.EDIT_VIDEO,false);f.setContent(g);a.add(Msn.DefaultPage.EditPage,f);_browseVideosPageCtrl=new Msn.Controls.BrowseVideosPage;a.add(Msn.DefaultPage.BrowseVideosPage,_browseVideosPageCtrl);this.selectTab=function(b,c){n.setShowcaseData(c);if(checkInt(b))a.select(b)};this._render=function(b){n.render(b);a.render(b)}};Msn.Controls.DefaultPage.prototype=Msn.Controls;Msn.Controls.Dialog=function(){var a=this;this.type=Msn.Dialog.Alert;this.description="";this.onComplete=function(){};this.clone=function(){var a=new Msn.Controls.Dialog;a.type=this.type;a.description=this.description;a.onComplete=this.onComplete;return a};this.check=function(){return checkString(this.description)}};Msn.Dialog=SoapboxService.Utils.CreateEnum("Alert",0,"Confirm",1,"Info",2,"Custom",3);Msn.DialogMode=SoapboxService.Utils.CreateEnum("Native",0,"Custom",1);Msn.Controls.DialogManager=function(){var q=this,f,c,m,e,b,a,i,p=Msn.Dialog.Alert,d,h=[],j="",k="";this.cfg={OK:$["IDS_CLI_Ok"],CANCEL:$["IDS_CLI_CancelUpperCase"],ALERT:$["IDS_CLI_Alert"],CONFIRM:$["IDS_CLI_Confirm"],INFO:$["IDS_CLI_Info"],QUESTION_CLASS:"dialogQuestionImgClass",QUESTION_IMAGE:getCDNPath("/i/info_icon.gif"),ALERT_CLASS:"dialogAlertImageClass",ALERT_IMAGE:Msn.ImageEnum.ALERT_ICON,INFO_CLASS:"dialogInfoImageClass",INFO_IMAGE:Msn.ImageEnum.INFO_ICON,BUTTON_FOCUS_CLASS:"dialogButtonInFocus",BUTTON_NOT_FOCUS_CLASS:"dialogButtonNotInFocus"};var l=this.cfg.ALERT_IMAGE,g=false,o=false,r=false,n=Msn.DialogMode.Custom;this.subscribeEvent(Msn.Event.DialogRequest);this.subscribeEvent(Msn.Event.DialogOpen);this.subscribeEvent(Msn.Event.DialogClose);this.subscribeEvent(Msn.Event.WindowResize);this.subscribeEvent(Msn.Event.WindowFocus);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.ChangeDialogMode);this.onEvent=function(c,b,a){switch(b){case Msn.Event.DialogRequest:if(n==Msn.DialogMode.Custom){if(checkObject(a)&&a.check()){h.push(a);this.invokeDialog()}}else if(checkObject(a)&&a.check())this.invokeNativeDialog(a);break;case Msn.Event.DialogOpen:if(n==Msn.DialogMode.Custom){this.fireEvent(Msn.Event.DialogBoxActive);this.fireEvent(Msn.Event.SetAutoProgress,false);this.setVisibility(true)}break;case Msn.Event.DialogClose:this.closeDialog();break;case Msn.Event.WindowResize:this.onResize();break;case Msn.Event.WindowFocus:this.onFocus();break;case Msn.Event.ControlsAckFullScreen:this.onFullScreen(a);break;case Msn.Event.ChangeDialogMode:this.setDialogMode(a);break}};this.dialogInProgress=function(){return g};this.setDialogMode=function(a){n=a};this.invokeDialog=function(){this.fireEvent(Msn.Event.DialogBoxActive);this.fireEvent(Msn.Event.SetAutoProgress,false);if(!g&&h.length>0){d=h[0];this.dataBind(d);if(checkDefined(b))b.focus()}};this.invokeNativeDialog=function(a){var b=a.description.format("\n");switch(a.type){case Msn.Dialog.Alert:case Msn.Dialog.Info:window.alert(b);break;case Msn.Dialog.Confirm:var c=window.confirm(b);a.onComplete(c);break}};this.closeDialog=function(){g=false;h=h.slice(1,h.length);if(h.length>0)this.invokeDialog();else{this.setVisibility(false);this.fireEvent(Msn.Event.DialogBoxInActive);this.fireEvent(Msn.Event.SetAutoProgress,true)}};this.onClicked=function(b,a){if(checkFunction(d.onComplete))d.onComplete(a);this.closeDialog()};this.onKeyDown=function(b,a){if(event.keyCode==27||event.keyCode==13){if(event.keyCode==27)a=false;this.onClicked(b,a)}};this.onOkFocus=function(e,c){if(checkDefined(b)&&checkDefined(a)&&g)if(c||!(d.type==Msn.Dialog.Confirm)){b.className=this.cfg.BUTTON_FOCUS_CLASS;a.className=this.cfg.BUTTON_NOT_FOCUS_CLASS}else{b.className=this.cfg.BUTTON_NOT_FOCUS_CLASS;a.className=this.cfg.BUTTON_FOCUS_CLASS}};this.onOkBlur=function(e,c){if(checkDefined(b)&&checkDefined(a)&&g&&event.keyCode==9)if(d.type==Msn.Dialog.Confirm&&c)a.focus();else b.focus()};this.dataBind=function(f){g=true;d=f;p=d.type;var c=true;switch(p){case Msn.Dialog.Confirm:l=this.cfg.QUESTION_IMAGE;j=this.cfg.QUESTION_CLASS;k=this.cfg.CONFIRM;a.style.display="inline";break;case Msn.Dialog.Info:l=this.cfg.INFO_IMAGE;j=this.cfg.INFO_CLASS;k=this.cfg.INFO;a.style.display="none";break;case Msn.Dialog.Custom:l=this.cfg.INFO_IMAGE;j=this.cfg.INFO_CLASS;k=this.cfg.INFO;a.style.display="none";c=false;break;case Msn.Dialog.Alert:default:l=this.cfg.ALERT_IMAGE;j=this.cfg.ALERT_CLASS;k=this.cfg.ALERT;a.style.display="none";break}Msn.ImageLoader.Load(l,e);e.className=j;e.alt=k;e.style.display=c?"inline":"none";b.value=checkString(d.OKLabel)?d.OKLabel:this.cfg.OK;a.value=checkString(d.CANCELLabel)?d.CANCELLabel:this.cfg.CANCEL;m.innerHTML=d.description.format("<BR>");this.setVisibility(true);this.onResize()};this.setVisibility=function(a,b){_visibility=a;if(checkDefined(f))if(a||o){f.style.visibility="visible";f.style.display="inline"}else{f.style.visibility="hidden";f.style.display="none"}if(checkDefined(c)&&!b)if(a){c.style.visibility="visible";c.style.display="inline"}else{c.style.visibility="hidden";c.style.display="none"}};this.onResize=function(){if(checkDefined(f)&&checkDefined(c)&&document.documentElement){var b=b<document.documentElement.clientHeight?document.documentElement.clientHeight:document.documentElement.scrollHeight,a=a<document.documentElement.clientWidth?a=document.documentElement.clientWidth:document.documentElement.scrollWidth,d=document.documentElement.scrollLeft+Math.floor(Math.max((document.documentElement.clientWidth-410)/2,10)),e=document.documentElement.scrollTop+Math.floor(Math.max((document.documentElement.clientHeight-60)/2,10));f.style.width=Math.max(a,1000)+"px";f.style.height=Math.max(b,800)+"px";c.style.top=e+"px";c.style.left=d+"px"}};this.onFocus=function(){if(checkDefined(b)&&g)b.focus()};this.onIconLoad=function(){if(checkDefined(e))e.style.visibility="visible"};this.onFullScreen=function(a){o=a;q.setVisibility(_visibility)};this._render=function(h){if(null!=h){f=document.createElement("DIV");f.className="dialogMain";f.style.visibility="hidden";c=document.createElement("DIV");c.className="dialogBox";c.style.visibility="hidden";var d=document.createElement("DIV");d.className="dialogImageDiv";e=document.createElement("IMG");e.border="0";Msn.ImageLoader.Load(l,e);e.className=j;e.alt=k;d.appendChild(e);c.appendChild(d);this.addListener(e,"onload",this.onIconLoad);var g=document.createElement("DIV");g.className="dialogDescDiv";m=document.createElement("SPAN");m.className="dialogDescription";g.appendChild(m);c.appendChild(g);c.appendChild(document.createElement("BR"));c.appendChild(document.createElement("BR"));i=document.createElement("DIV");i.className="dialogButtonDiv";b=document.createElement("INPUT");this.setGlobalizedUI(b);b.value=this.cfg.OK;b.type="button";b.id="OkButton";b.className=this.cfg.BUTTON_FOCUS_CLASS;this.addListener(b,"onclick",this.onClicked,true);this.addListener(b,"onkeydown",this.onKeyDown,true);if(this.getBrowser()!=Msn.Browser.Firefox){this.addListener(b,"onfocus",this.onOkFocus,true);this.addListener(b,"onblur",this.onOkBlur,true)}i.appendChild(b);i.appendChild(document.createTextNode("  "));a=document.createElement("INPUT");this.setGlobalizedUI(a);a.type="button";a.value=this.cfg.CANCEL;a.id="CancelButton";a.className=this.cfg.BUTTON_NOT_FOCUS_CLASS;this.addListener(a,"onclick",this.onClicked,false);this.addListener(a,"onkeydown",this.onKeyDown,false);if(this.getBrowser()!=Msn.Browser.Firefox){this.addListener(a,"onfocus",this.onOkFocus,false);this.addListener(a,"onblur",this.onOkBlur,false)}i.appendChild(a);c.appendChild(i);h.appendChild(f);h.appendChild(c);this.onResize();this.setVisibility(false)}}};Msn.Controls.DialogManager.prototype=Msn.Controls;Msn.Controls.DWVideoMetadata=function(){var a=this;this.cfg={VIDEOMETADATA:"videoMetadataArea",RELATED_VIDEOS:$["IDS_CLI_EditorsPicks"],RELATED_LINKS:$["IDS_CLI_RelatedLinks"],VIDEOLINK_TEXT:$["IDS_CLI_VideolinkText"],VIDEOLINK_TOOLTIP:$["IDS_CLI_DWVideolinkText"],EMAIL_TEXT:$["IDS_CLI_EmailText"],EMAIL_TOOLTIP:$["IDS_CLI_DWEmailText"],EMBED_TEXT:$["IDS_CLI_EmbedText"],EMBED_TOOLTIP:$["IDS_CLI_EmbedTooltip"],EMAIL_SPBX:$["IDS_GMT_EnableEmailVideoSpbx"],EMAIL_MSNV:$["IDS_GMT_EnableEmailVideoMsnv"],LINK_SPBX:$["IDS_GMT_EnableVideoLinkSpbx"],LINK_MSNV:$["IDS_GMT_EnableVideoLinkMsnv"],DISABLED_MESSAGE:$["IDS_CLI_CommunityFeatureDisabled"],MAX_ACTION_LENGTH:30};this.subscribeEvent(Msn.Event.MediaChangedBegin);this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.VideoPanelRemoteControl);this.subscribeEvent(Msn.Event.SetEditorsPlaylist);this.onEvent=function(d,c,b){switch(c){case Msn.Event.MediaChangedBegin:if(checkDefined(e)&&checkDefined(b)&&checkString(b.Id))if(b.CsId==Msn.Controls.config.SoapboxCsId){m.setActive(false);e.style.display="none"}else{m.setActive(true);e.style.display="inline"}this.fireEvent(Msn.Event.MediaChanged,b);break;case Msn.Event.MediaMetadata:a.setWebVideo(b);if(checkDefined(b)&&checkDefined(b.Video)){if(checkDefined(f))f.style.display="block";if(checkDefined(g))g.style.display=checkDefined(b.Video.RelatedLinks)&&b.Video.RelatedLinks.Length>0?"block":"none"}break;case Msn.Event.VideoPanelRemoteControl:j.style.visibility="hidden";k.style.visibility="hidden";l.style.visibility="hidden";break;case Msn.Event.SetEditorsPlaylist:t.setSearchQuery(b);break;default:break}};var j=null,n=new Msn.Controls.VideoLink,b=null,k=null,o=new Msn.Controls.Email,i=null,h=null,d=null,c=null,l=null,p=new Msn.Controls.EmbedVideo,t=new Msn.Controls.SearchResultPanel(4,1,false,true),f=null,r=new Msn.Controls.MSNVideoLinks,g=null,m=new Msn.Controls.MSNVideoMetadata(308,275),e=null,v=null,q=0,u=0,s=true;this.setWebVideo=function(a){if(checkDefined(a)&&checkDefined(a.Video)){r.setVideo(a);u=a.Video.CsId==Msn.Controls.config.SoapboxCsId?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog;q=a.Video.Id;n.setVideo(a.Video);o.setVideo(a.Video);p.setVideo(a.Video);s=a.Video.CsId==Msn.Controls.config.SoapboxCsId;var e=new Msn.Controls.CommunityHelper(a.Video);if(e.featureEnabled(Msn.CommunityBits.Email))b.setDisplay(true);else b.setDisplay(false);if(e.featureEnabled(Msn.CommunityBits.Embed))c.setDisplay(true);else c.setDisplay(false);if(e.featureEnabled(Msn.CommunityBits.Permalink))d.setDisplay(true);else d.setDisplay(false);if(e.featureEnabled(Msn.CommunityBits.Email)&&e.featureEnabled(Msn.CommunityBits.Permalink))i.style.display="inline";else i.style.display="none";if(e.featureEnabled(Msn.CommunityBits.Email)&&e.featureEnabled(Msn.CommunityBits.Embed))h.style.display="inline";else h.style.display="none";this.refresh()}};this.featureEnabled=function(a){return s?isTrue(this.cfg[a+"_SPBX"]):isTrue(this.cfg[a+"_MSNV"])};this.refresh=function(){if(checkString(q)){var a=Msn.Controls.SearchQueryFactory.create(q,SoapboxService.SearchType.Recommendations,0,SoapboxService.SortOrder.Default,u);a.disableMenuSelect();a.disableHistoryEntry()}};this.onVideoLinkClick=function(){j.style.visibility="visible";a.fireEvent(Msn.Event.FocusRequest,n)};this.onEmailClick=function(){k.style.visibility="visible";a.fireEvent(Msn.Event.FocusRequest,o)};this.onEmbedClick=function(){l.style.visibility="visible";a.fireEvent(Msn.Event.FocusRequest,p)};this._render=function(s){if(null!=s){var q=document.createElement("DIV");q.style.marginLeft="6px";e=document.createElement("DIV");e.className=this.cfg.VIDEOMETADATA;e.style.display="none";m.render(e);m.showTabs(false);q.appendChild(e);s.appendChild(q);var v,w;g=document.createElement("DIV");g.style.display="none";s.appendChild(g);q=document.createElement("DIV");q.className="relatedLinks";head=document.createElement("DIV");head.className="similarVideoHead";v=document.createElement("B");w=document.createTextNode(a.cfg.RELATED_LINKS+" ");v.appendChild(w);head.appendChild(v);q.appendChild(head);g.appendChild(q);q=document.createElement("DIV");r.render(q);r.setLogoDisplay(false);g.appendChild(q);s.appendChild(g);var u=document.createElement("DIV");u.className="shareActions";q=document.createElement("SPAN");q.style.margin="0px 5px 0px 10px";d=new Msn.Controls.GenericActionLink;d.setImage(Msn.ImageEnum.VIDEO_LINK,a.cfg.VIDEOLINK_TOOLTIP,"videoActionImage");d.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);d.setLinkText(a.cfg.VIDEOLINK_TEXT,"videoActionText");d.setOnClickHandler(a.onVideoLinkClick);d.render(q);d.setDisplay(false);u.appendChild(q);i=document.createElement("SPAN");i.className="actionmiddle";i.appendChild(document.createTextNode("  |  "));i.style.display="none";u.appendChild(i);q=document.createElement("SPAN");q.style.margin="0px 5px";b=new Msn.Controls.GenericActionLink;b.setImage(Msn.ImageEnum.EMAIL,a.cfg.EMAIL_TOOLTIP,"videoActionImage");b.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);b.setLinkText(a.cfg.EMAIL_TEXT,"videoActionText");b.setOnClickHandler(a.onEmailClick);b.render(q);b.setDisplay(false);u.appendChild(q);h=document.createElement("SPAN");h.className="actionmiddle";h.appendChild(document.createTextNode("  |  "));h.style.display="none";u.appendChild(h);q=document.createElement("SPAN");q.style.margin="0px 5px";c=new Msn.Controls.GenericActionLink;c.setImage(Msn.ImageEnum.EMBED,a.cfg.EMBED_TOOLTIP,"videoActionImage");c.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);c.setLinkText(a.cfg.EMBED_TEXT,"videoActionText");c.setOnClickHandler(a.onEmbedClick);c.render(q);c.setDisplay(false);u.appendChild(q);s.appendChild(u);s.appendChild(document.createElement("BR"));f=document.createElement("DIV");f.style.display="none";f.style.borderTop="1px solid #cdcdcd";q=document.createElement("DIV");q.className="editorsPicks";head=document.createElement("DIV");head.className="similarVideoHead";v=document.createElement("B");w=document.createTextNode(a.cfg.RELATED_VIDEOS+" ");v.appendChild(w);head.appendChild(v);q.appendChild(head);f.appendChild(q);q=document.createElement("DIV");q.className="editorsPicks";t.render(q);f.appendChild(q);s.appendChild(f);s.appendChild(q);j=document.createElement("DIV");j.className="actionPane";n.render(j);s.appendChild(j);k=document.createElement("DIV");k.className="actionPane";o.render(k);s.appendChild(k);l=document.createElement("DIV");l.className="actionPane";p.render(l);s.appendChild(l)}}};Msn.Controls.DWVideoMetadata.prototype=Msn.Controls;Msn.Controls.Email=function(){var d=this;this.onEvent=function(c,b){switch(b){case Msn.Event.FocusReceived:if(checkDefined(a))try{a.focus()}catch(e){}break}};this.cfg={NAME_MAX_LENGTH:50,ADDRESSES_MAX_LENGTH:255,BODY_MAX_LENGTH:1024,ENABLE_MAILTO_FOR_SIGNEDIN_USERS:$["IDS_GMT_EnableMailToForSignedInUsers"],CLOSE_TITLE:$["IDS_CLI_CloseTitle"],EMAIL_TO_LABEL:$["IDS_CLI_EmailToLabel"],PICK_FRIENDS:$["IDS_CLI_PickFriends"],EMAIL_TO_DESC:$["IDS_CLI_EmailToDesc"],EMAIL_BODY_LABEL:$["IDS_CLI_EmailBodyLabel"],EMAIL_BODY_DESC:$["IDS_CLI_EmailBodyDesc"],NAME_LABEL:$["IDS_CLI_NameLabel"],NAME_DESC:$["IDS_CLI_NameDesc"],SUBMIT_LABEL:$["IDS_CLI_SubmitLabel"],CANCEL_LABEL:$["IDS_CLI_CancelLabel"],ERR_EMPTY_EMAIL:$["IDS_CLI_ErrEmptyEmail"],ERR_EMAIL_TOO_LONG:$["IDS_CLI_ErrEmailTooLong"],ERR_BODY_TOO_LONG:$["IDS_CLI_ErrBodyTooLong"],ERR_EMAIL_INVALID_CHAR:$["IDS_CLI_ErrEmailInvalidChar"],ERR_NAME_INVALID_CHAR:$["IDS_CLI_ErrNameInvalidChar"],ERR_MSG_INVALID_CHAR:$["IDS_CLI_ErrMsgInvalidChar"],ERR_NO_EMAIL:$["IDS_CLI_ErrNoEmail"],STATUS_MSG:[$["IDS_CLI_EmailStatusMsg0"],$["IDS_CLI_EmailStatusMsg1"],$["IDS_CLI_EmailStatusMsg2"],$["IDS_CLI_EmailStatusMsg3"],$["IDS_CLI_EmailStatusMsg4"],$["IDS_CLI_EmailStatusMsg5"],$["IDS_CLI_EmailStatusMsg6"],$["IDS_CLI_EmailStatusMsg7"]]};var j=null,g=null,e=null,f=false,a=null,b=null,c=null,i=null,h=null,m,k,l;this.onSendButtonClicked=function(q,c,o,p){if(checkDefined(c)&&checkDefined(c.value)&&checkDefined(o)&&checkDefined(p)&&checkDefined(j)&&checkString(g)&&false==f){var a=c.value.trim(),h=o.value.trim(),b=p.value.trim();if(!checkString(a)){customAlert(this.cfg.ERR_EMPTY_EMAIL);return false}if(a.length>this.cfg.ADDRESSES_MAX_LENGTH){customAlert(this.cfg.ERR_EMAIL_TOO_LONG.format(this.cfg.ADDRESSES_MAX_LENGTH));return false}if(b.length>this.cfg.BODY_MAX_LENGTH){customAlert(this.cfg.ERR_BODY_TOO_LONG.format(this.cfg.BODY_MAX_LENGTH));return false}if(!validChar(a)){customAlert(this.cfg.ERR_EMAIL_INVALID_CHAR.format(gInvalidCharString));return false}if(!validChar(h)){customAlert(this.cfg.ERR_NAME_INVALID_CHAR.format(gInvalidCharString));return false}var n='< > "';if(!validChar(b,n)){customAlert(this.cfg.ERR_MSG_INVALID_CHAR.format(n));return false}var i=extractEmails(a);if(0==i.length){customAlert(this.cfg.ERR_NO_EMAIL);return false}e=i.join(", ");m=a;k=h;l=b;if(Msn.Passport.isUserLoggedIn()&&!isTrue(d.cfg.ENABLE_MAILTO_FOR_SIGNEDIN_USERS)){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"email:send:pass"});Msn.SoapboxServiceManager.EmailVideo(e,h,b,g,this.emailCb,this.onError);d.onClosePane(false);f=true}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"email:send:to"});d.popupEmailClient()}}return false};this.onContactPickerData=function(f){if(checkDefined(a)&&checkObject(f)){var c=a.value,e=f.allEmailsToAdd;for(var d=0;d<e.length;d++)if(checkString(e[d])&&c.toLowerCase().indexOf(e[d].toLowerCase())<0){c+=checkString(c)?", ":"";c+=e[d]}a.value=c}if(checkDefined(b))b.focus()};this.popupEmailClient=function(){var a=checkString(k)?k+" sent you a video!":"You received a video!",b=checkString(l)?"Message:%0A"+l.replace(/\n/g,"%0A"):"";window.location.href="mailto:"+e.replace(/,/g,";")+"?Subject="+a+"&body=Here's what I picked out for you. %0A%0A Video URL: "+getPermaLinkUrl(j).replace(/&/g,"%26")+"%0A           (If you are unable to click the link, please copy and paste the URL in the browser to watch the video.)%0A%0A"+b;this.onClosePane(false);this.clear()};this.setVideo=function(a){if(checkDefined(a)&&checkDefined(a.Id)&&checkString(a.Id)&&a.Id!=g){j=a;g=a.Id;this.clear()}};this.clear=function(){if(checkDefined(a))a.value="";if(checkDefined(b))b.value="";if(checkDefined(c))c.value=""};this.onClosePane=function(a){this.clear();if(checkDefined(a)&&a)Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"email:cancel"});this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL);return false};this.emailCb=function(a){if(checkDefined(a)){if(checkInt(a,SoapboxService.ResultCode.UnknownError,SoapboxService.ResultCode.FeatureNotAvailable))customAlert(d.cfg.STATUS_MSG[a]);if(SoapboxService.ResultCode.Success==a){var b=d.cfg.STATUS_MSG[a].format(e);e="";customAlert(b,true);d.render()}}f=false};this.onPickFriends=function(){i=new Msn.Controls.ContactPicker("",true);i.setOnData(d.onContactPickerData);i._render()};this.onError=function(){f=false;d.popupEmailClient()};this._render=function(g){var f,e,d;if(null!=g){e=document.createElement("DIV");e.className="closeLinkLocation";d=document.createElement("A");d.tabIndex=25;d.appendChild(document.createTextNode(this.cfg.CLOSE_TITLE));d.href=this.getLinkHref();e.appendChild(d);g.appendChild(e);this.addListener(d,"onclick",this.onClosePane,true);e=document.createElement("DIV");e.className="divPadding";d=document.createElement("DIV");d.className="divTitlePadding";d.appendChild(document.createTextNode(this.cfg.EMAIL_TO_LABEL));d.appendChild(document.createTextNode(this.cfg.EMAIL_TO_DESC));e.appendChild(d);a=document.createElement("TEXTAREA");this.setGlobalizedUI(a);a.maxLength=this.cfg.ADDRESSES_MAX_LENGTH;a.className="emailAddress";a.tabIndex=20;e.appendChild(a);if(Msn.Passport.isUserLoggedIn()){if(!checkDefined(h))h=new Msn.Controls.Link(this.cfg.PICK_FRIENDS,this.onPickFriends,"emailPickFriends");h.render(e)}e.appendChild(document.createElement("BR"));d=document.createElement("DIV");d.className="divEmailTitlePadding";d.appendChild(document.createTextNode(this.cfg.EMAIL_BODY_LABEL));d.appendChild(document.createTextNode(this.cfg.EMAIL_BODY_DESC));e.appendChild(d);b=document.createElement("TEXTAREA");this.setGlobalizedUI(b);b.maxLength=this.cfg.BODY_MAX_LENGTH;b.className="emailMessage";b.tabIndex=21;e.appendChild(b);e.appendChild(document.createElement("BR"));d=document.createElement("DIV");d.className="divEmailTitlePadding";d.appendChild(document.createTextNode(this.cfg.NAME_LABEL));d.appendChild(document.createTextNode(this.cfg.NAME_DESC));e.appendChild(d);c=document.createElement("INPUT");this.setGlobalizedUI(c);c.type="text";c.maxLength=this.cfg.NAME_MAX_LENGTH;c.className="emailName";c.tabIndex=22;e.appendChild(c);e.appendChild(document.createElement("BR"));d=document.createElement("DIV");d.className="divEmailTitlePadding";f=document.createElement("A");f.href=this.getLinkHref();f.title=this.cfg.SUBMIT_LABEL;f.className="tLink";f.tabIndex=23;f.appendChild(document.createTextNode(this.cfg.SUBMIT_LABEL));d.appendChild(f);this.addListener(f,"onclick",this.onSendButtonClicked,a,c,b);d.appendChild(document.createTextNode("  |  "));f=document.createElement("A");f.title=this.cfg.CANCEL_LABEL;f.href=this.getLinkHref();f.className="tLink";f.tabIndex=24;f.appendChild(document.createTextNode(this.cfg.CANCEL_LABEL));this.addListener(f,"onclick",this.onClosePane,true);d.appendChild(f);e.appendChild(d);g.appendChild(e)}}};Msn.Controls.Email.prototype=Msn.Controls;Msn.Controls.EmbedVideo=function(){var h=this;this.onEvent=function(b,a){switch(a){case Msn.Event.FocusReceived:if(checkDefined(d))try{d.focus()}catch(e){}break}};this.cfg={EMBED_INPUT_CLASS:"embedVideo",COPY_CLIPBOARD:getCDNPath("/i/videolink.jpg"),PANE_DESCRIPTION:$["IDS_CLI_PaneDescription"],PLAYER_SIZE:$["IDS_CLI_PlayerSize"],INPUTBOX_TOOLTIP:$["IDS_CLI_InputboxTooltip"],COPY_CLIPBOARD_TOOLTIP:$["IDS_CLI_CopyClipboardTooltip"],CLOSE_TITLE:$["IDS_CLI_CloseTitle"],EMBED_VIDEO:$["IDS_CLI_EmbedVideo"],PLAYER_SIZE_TYPES:["4:3 (432x415)","16:9 (596x425)"],PLAYER_SIZE_VALUES:["1","2"]};var g=null,a=null,d,c,b,f=this.cfg.PLAYER_SIZE_VALUES[0];this.setVideo=function(b){if(checkDefined(b)&&checkString(b.Id)&&b.Id!=g){a=b;g=b.Id;f=this.cfg.PLAYER_SIZE_VALUES[0];this.dataBind()}};this.dataBind=function(){if(checkDefined(a))this.setEmbed()};this.setEmbed=function(){if(checkDefined(d)&&checkDefined(c))d.value=this.getEmbed()};this.getEmbed=function(){if(checkDefined(a)&&checkString(g))if(checkDefined(a.ViralSyndication)&&a.ViralSyndication){if(checkDefined(b))b.style.display="block";return getSyndicationPlayerEmbedCode(a,f)}else{if(checkDefined(b))b.style.display="none";return getPlayerEmbedCode(a)}};this.onRadioSelect=function(b,a){if(checkDefined(a)){f=a;this.setEmbed()}};this.onClosePane=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"embed:close"});h.closePane();return false};this.closePane=function(){this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL)};this.onSelect=function(b,a){if(checkDefined(a))a.select()};this.onCopyEmbedToClip=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"embed:link"});copyToClip(this.getEmbed());return false};this._render=function(l){if(null!=l&&isTrue($["IDS_GMT_EnableEmbeddedPlayer"])){var a,i;a=document.createElement("DIV");a.className="closeLinkLocation";i=document.createElement("A");i.appendChild(document.createTextNode(this.cfg.CLOSE_TITLE));i.href=this.getLinkHref();a.appendChild(i);l.appendChild(a);this.addListener(i,"onclick",this.onClosePane);a=document.createElement("DIV");a.className="divPadding";var k=document.createElement("DIV");k.appendChild(document.createTextNode(this.cfg.PANE_DESCRIPTION));k.className="linkDescription";a.appendChild(k);var n,j,g,m;g=document.createElement("DIV");g.appendChild(document.createTextNode(this.cfg.PLAYER_SIZE));for(var f=0;f<h.cfg.PLAYER_SIZE_TYPES.length;f++){m=f==0?"CHECKED":"";j=document.createElement("SPAN");n=new Msn.Controls.LiteralHTML("<input type='radio' name='playerSize' class='flagRadio' "+m+" value='"+this.cfg.PLAYER_SIZE_VALUES[f]+"' /> "+this.cfg.PLAYER_SIZE_TYPES[f]);n.render(j);this.addListener(j,"onclick",this.onRadioSelect,this.cfg.PLAYER_SIZE_VALUES[f]);g.appendChild(j)}g.appendChild(document.createElement("BR"));g.appendChild(document.createElement("BR"));b=g;a.appendChild(b);c=document.createElement("SPAN");c.className="embedTitle";c.appendChild(document.createTextNode(this.cfg.EMBED_VIDEO));a.appendChild(c);_elCopyClip=document.createElement("A");e=new Msn.Controls.LiteralHTML("<img src='"+this.cfg.COPY_CLIPBOARD+"' width=15px height=13px class='copyClip' title='"+this.cfg.COPY_CLIPBOARD_TOOLTIP+"' />","");e.render(_elCopyClip);_elCopyClip.href=this.getLinkHref();this.addListener(_elCopyClip,"onclick",this.onCopyEmbedToClip);a.appendChild(_elCopyClip);a.appendChild(document.createElement("BR"));e2=document.createElement("TEXTAREA");this.setGlobalizedUI(e2);e2.className=this.cfg.EMBED_INPUT_CLASS;e2.title=this.cfg.INPUTBOX_TOOLTIP;e2.readOnly="true";this.addListener(e2,"onclick",this.onSelect,e2);this.addListener(e2,"onfocus",this.onSelect,e2);d=e2;a.appendChild(e2);l.appendChild(a);this.dataBind()}}};Msn.Controls.EmbedVideo.prototype=Msn.Controls;Msn.Event=SoapboxService.Utils.CreateEnum("MediaPlay",100,"MediaQueue",101,"MediaChangedBegin",102,"MediaChanged",103,"MediaLoaded",106,"MediaLoadError",107,"MediaMetadata",108,"MediaMetadataComplete",111,"MetadataError",112,"SetAutoProgress",115,"DefaultVideosLoaded",116,"RequestAutoplay",117,"MediaPlayByVideoId",118,"MediaPlaylistLoaded",119,"MediaQueueByVideoId",120,"SetEditorAutoPlay",121,"QueuePermalinkPlaylist",122,"MediaAutoPlay",123,"MediaCompleted",124,"MenuSelect",200,"MenuClick",201,"MenuContextChanged",202,"MenuActivated",203,"Navigate",250,"NavigateCategory",251,"VideoEdit",300,"VideoEdited",301,"VideoDeleted",302,"VideoUpdated",303,"FavsUpdated",304,"FavsUpdatedData",305,"TagsUpdated",306,"TagsUpdatedData",307,"CommentsUpdated",308,"CommentsUpdatedData",309,"VideoSharedUpdated",310,"VideoSharedUpdatedData",311,"Search",400,"SearchStarted",401,"SearchCompleted",402,"FullScreenSearch",403,"FullScreenSearchStarted",404,"FullScreenSearchCompleted",405,"SplitSearch",406,"SearchColumnCountChanged",407,"SearchColumnMarginChanged",408,"VideoPanelViewChange",500,"MetadataPanelHeaderClick",501,"UploadQueueChanged",600,"ApplicationTick",700,"ViewAllUpload",800,"ViewProfile",900,"ViewAllProfileTags",901,"ViewAllProfileComments",902,"ViewErrorProfile",903,"ViewProfileRequest",904,"VideoPanelRemoteControl",1000,"PageRefresh",1100,"FocusRequest",1200,"FocusReceived",1201,"CommentPageChanged",1300,"NicknameSet",1400,"ControlsReqPause",1500,"ControlsAckPause",1501,"ControlsReqLocation",1502,"ControlsAckLocation",1503,"ControlsReqMute",1504,"ControlsAckMute",1505,"ControlsReqVolume",1506,"ControlsAckVolume",1507,"ControlsReqFullScreen",1508,"ControlsAckFullScreen",1509,"ControlsAckShow",1510,"ControlsAckMouseOver",1511,"ControlsAckMouseOut",1512,"RequestProcessed",1600,"RequestCompleted",1601,"UserRating",1700,"SplashBegin",1800,"PromotionBegin",1801,"PanelTabChange",1900,"RelatedTagBrowse",2000,"NextPageSearch",2100,"PageView",2200,"HistoryAdd",2300,"HistoryChanged",2301,"HistoryData",2302,"EmbedPlayerVideoId",2400,"DialogRequest",2500,"DialogOpen",2501,"DialogClose",2502,"DialogBoxActive",2503,"DialogBoxInActive",2504,"WindowResize",2600,"WindowFocus",2601,"ChangeDialogMode",2602,"SilverlightInstall",2603,"UploadCancel",2700,"UploadRetry",2701,"DocumentTitle",2800,"SelectTopTag",2900,"AdChanged",3000,"AdCompleted",3001,"ShowFlyOver",3002,"TrackReplay",3004,"TrackLeaveBehindClick",3005,"TrackFlyOverClick",3006,"TrackCloseFlyOverClick",3007,"CompanionAdDisplayed",3008,"AdSurveyAvailable",3009,"ReportSearch",4000,"MediaClick",4001,"PanelSelect",4002,"MetaLink",4003,"SetEditorsPlaylist",5000,"TrackPageView",6000,"ShowCaseError",7000,"ShowCaseLoaded",7001,"FlashVersionDetect",8000,"SurveyCheck",9000,"WidgetFrameworkInitialized",10000);Msn.Controls.Experiment=function(){var d="recordTrigger",b="recordObservation",c="observName",g="data",f="expId",a="type",h=null,e=0,i=this;this.subscribeEvent(Msn.Event.TrackCloseFlyOverClick);this.isEnabled=function(){return Msn.Controls.config.ExperimentsEnabled};this.onEvent=function(c,b,a){switch(b){case Msn.Event.TrackFlyOverClick:if(checkDefined(a))this.reportEvent("ad:flyoutclick",a.ad,a.video);break;default:break}};this.recordObservation=function(c){var b=[];for(var a=1;a<arguments.length;a++)b.push(arguments[a]);this.recordObservationFromArray(c,b)};this.recordObservationFromObject=function(d,c){var a=[];for(var b in c){a.push(b);a.push(c[b])}this.recordObservationFromArray(d,a)};this.recordObservationFromArray=function(d,b){if(this.isEnabled())if(b.length%2==0){var c="";for(var a=0;a<b.length;a++){if(a>0)c+=",";c+=checkString(b[a])?b[a].replace(/,/g,"[comma]"):""}Msn.SoapboxServiceManager.RecordExpObservation(d,c,this.recordObservationCb,this.recordObservationError)}};this.recordTrigger=function(a){if(this.isEnabled())Msn.SoapboxServiceManager.RecordExpTrigger(a,this.recordTriggerCb,this.recordTriggerError)};this.recordTriggerAll=function(){if(this.isEnabled())Msn.SoapboxServiceManager.RecordExpTrigger("",this.recordTriggerCb,this.recordTriggerError)};this.reportEvent=function(d,e,b){var c="";if(checkString(Msn.Controls.config.market))c=Msn.Controls.config.market.toLowerCase();var a={};a.pageName="lnk:ad";a.channel="MSN Video";a.server=window.location.hostname;a.mk=c;a.title=b.Title;a.source=b.Source;a.provider=b.Provider;a.csid=b.CsId;a.pageGroup=b.PageGroup;a.affid=getUrlParam("ocid");a.guid=b.Id;this.recordObservationFromObject(d,a)};this.getAttributes=function(){if(this.isEnabled())return Msn.Controls.config.ExperimentData;else return new Object};this.getAttribute=function(b,d){var c=null,a=Msn.Controls.config.ExperimentData;if(this.isEnabled())if(null!=a[b])c=a[b][d];return c};this.recordObservationCb=function(){};this.recordObservationError=function(){};this.recordTriggerCb=function(){};this.recordTriggerError=function(){};this.dataToString=function(d,c){var b=d+" = [";for(var a in c)b+=a+": "+c[a]+", ";b+="]";return b}};Msn.Controls.Experiment.prototype=Msn.Controls;ExpMgr=new Msn.Controls.Experiment;Msn.Controls.ExternalInterface=function(){var a=this;this.onShowcaseLoaded=function(){Msn.Controls.fireEvent(Msn.Event.ShowCaseLoaded)};this.onPlayVideo=function(f,h,e,i){var g=b(f);if(checkObject(g))d(g,h,e);else{var j=new Msn.Controls.VideoService([f]),k=function(b){a.onVideoQueryComplete(d,b,h,e)};j.getVideos(null,k)}var c=new Object;c.action="play";c.extra=i;a.onReport(e,c);return true};function d(a,c,b){if(checkObject(a)){a.AddSource="externalInterface:play:"+(checkString(b)?b:"");setTimeout(function(){Msn.Controls.fireEvent(Msn.Event.MediaPlay,a)},10);if("communitywidget"!=b.toLowerCase())OPPlat.reportClick(a.Id)}}this.onQueueVideo=function(f,h,e,i){var g=b(f);if(checkObject(g))c(g,h,e);else{var j=new Msn.Controls.VideoService([f]),k=function(b){a.onVideoQueryComplete(c,b,h,e)};j.getVideos(null,k)}var d=new Object;d.action="queue";d.extra=i;a.onReport(e,d);return true};function c(a,c,b){if(checkObject(a)){a.AddSource="externalInterface:queue:"+(checkString(b)?b:"");setTimeout(function(){Msn.Controls.fireEvent(Msn.Event.MediaQueue,a)},10);if("communitywidget"!=b.toLowerCase())OPPlat.reportClick(a.Id)}}this.onVideoQueryComplete=function(c,a,d,b){if(checkArray(a)&&a.length>0)c(a[0],d,b)};this.getString=function(a){return ResMgr.getString(a)};this.onReport=function(c,a){if(checkDefined(c)&&checkDefined(a)&&checkDefined(a.action)){var b="ms:"+c+":"+a.action+"^"+Msn.MenuManager.getCurrentMenuName();if(checkDefined(a.extra)&&checkString(a.extra))b=b+"^"+a.extra;Msn.Reporting.showcase(b)}return true};function b(b){var a="Video|"+b.toLowerCase().replace(/-/g,"");return Msn.Cache.get(a)}this.onSilverlightInstall=function(e,d,c){var b=new Object;b.action="SLInstall";b.extra=c;a.onReport(d,b);Msn.Controls.fireEvent(Msn.Event.SilverlightInstall);return true}};Msn.ExternalInterface=new Msn.Controls.ExternalInterface;Msn.Controls.Favorites=function(){var a=this;this.cfg={ADDTOFAVORITE:$["IDS_CLI_Addtofavorite"],REMOVEFROMFAVORITE:$["IDS_CLI_Removefromfavorite"],DISABLED_MESSAGE:$["IDS_CLI_CommunityFeatureDisabled"],FAILED_ADD:$["IDS_CLI_FailedAddToFavorites"],FAILED_REMOVE:$["IDS_CLI_FailedRemoveFromFavorites"],SIGN_IN_REQD_FOR_FAVORITES:$["IDS_CLI_SignInReqdForFavorites"],ADD_TO_FAVORITES:getCDNPath("/i/addToFav.jpg"),REMOVE_FROM_FAVORITES:getCDNPath("/i/remFav.gif"),MAX_ACTION_LENGTH:15};var d=0,b=null,e=new Msn.Controls.LiteralHTML("<img src='"+this.cfg.REMOVE_FROM_FAVORITES+"' width=13 height=11 class='removeFromFav' title='"+this.cfg.REMOVEFROMFAVORITE+"' />",""),f=new Msn.Controls.LiteralHTML("<img src='"+this.cfg.ADD_TO_FAVORITES+"' width=13 height=11 class='addToFav' title='"+this.cfg.ADDTOFAVORITE+"' />",""),c=new Msn.Controls.GenericActionLink;this.setVideo=function(c){b=c;if(null!=b)a.setUI(b.Video.IsFavorite);else a.disable("White",null,null,"16",a.cfg.DISABLED_MESSAGE)};this.setUI=function(b){if(b){c.setImage(a.cfg.REMOVE_FROM_FAVORITES,a.cfg.REMOVEFROMFAVORITE,"videoActionImage");c.setLinkText(a.cfg.REMOVEFROMFAVORITE,"videoActionText")}else{c.setImage(a.cfg.ADD_TO_FAVORITES,a.cfg.ADDTOFAVORITE,"videoActionImage");c.setLinkText(a.cfg.ADDTOFAVORITE,"videoActionText")}var d=function(){a.onClick(b)};c.setOnClickHandler(d)};this.onClick=function(c){this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL);if(Msn.Passport.isUserLoggedIn()){if(null!=b&&null!=b.Video&&b.Video.Id!=0&&d==0){d=1;if(c){Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b.Video,type:"meta:rr",name:"favorite:remove"});Msn.SoapboxServiceManager.RemoveFavorite(b.Video.Id,a.removeFavoriteCb,a.removeFavoriteErrorCb);b.Video.IsFavorite=false}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b.Video,type:"meta:rr",name:"favorite:add"});Msn.SoapboxServiceManager.AddFavorite(b.Video.Id,a.addFavoriteCb,a.addFavoriteErrorCb);b.Video.IsFavorite=true}}}else{if(null!=b&&null!=b.Video)Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b.Video,type:"meta",name:"favorite:signinerror"});Msn.Passport.loginDialog(a.cfg.SIGN_IN_REQD_FOR_FAVORITES)}return false};this.setFavoriteCb=function(e,c){var b=true;d=0;if(e==SoapboxService.ResultCode.Success){a.setUI(c);a.fireEvent(Msn.Event.FavsUpdated)}else b=false;return b};this.addFavoriteCb=function(b){if(!a.setFavoriteCb(b,true))a.addFavoriteErrorCb(b)};this.addFavoriteErrorCb=function(){d=0;customAlert(a.cfg.FAILED_ADD)};this.removeFavoriteCb=function(b){if(!a.setFavoriteCb(b,false))a.removeFavoriteErrorCb(b)};this.removeFavoriteErrorCb=function(){d=0;customAlert(a.cfg.FAILED_REMOVE)};this._render=function(d){if(null!=d){c.setImage(a.cfg.ADD_TO_FAVORITES,this.cfg.ADDTOFAVORITE,"videoActionImage");c.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);c.setLinkText(this.cfg.ADDTOFAVORITE,"videoActionText");c.render(d);a.setVideo(b)}}};Msn.Controls.Favorites.prototype=Msn.Controls;Msn.FilterBy=SoapboxService.Utils.CreateEnum("Today",0,"ThisWeek",1,"ThisMonth","2","AllTime","3");Msn.Controls.FilterResults=function(){var h=this,g=null,f=null,e=null,d=null,b=null,c=false;this.cfg={LABEL_DROP_DOWN:$["IDS_CLI_LabelDropDown"],TODAY:$["IDS_CLI_Today"],THIS_WEEK:$["IDS_CLI_ThisWeek"],THIS_MONTH:$["IDS_CLI_ThisMonth"],ALL_TIME:$["IDS_CLI_AllTimes"],FILTER_BY:$["IDS_CLI_FilterBy"],IMG_DROP_DOWN:getCDNPath("/i/down.gif")};this.setSearchQuery=function(a){_query=a;if(checkInt(_query.type)&&checkString(_query.term)){g=parseInt(_query.type);f=_query.term;e=_query.sort;c=false;this.render()}};this.toggleFilterListDisplay=function(){if(c)h.hideFilterBy();else h.showFilterBy()};this.showFilterBy=function(){if(checkDefined(b)){b.style.visibility="visible";b.style.display="inline";c=true}};this.hideFilterBy=function(){if(checkDefined(b)){b.style.visibility="hidden";b.style.display="none";c=false}};this.onMouseOverLink=function(b,a){if(checkDefined(a))a.className="filterByLinkMouseOver"};this.onMouseOutLink=function(b,a){if(checkDefined(a))a.className="filterByLinkNormal"};this.onFilterRequested=function(c,b,a){_query.setSort(a);this.fireEvent(Msn.Event.Search,_query);return false};this.addToFilterList=function(c,d){if(checkDefined(b)){var e=b;d2=document.createElement("DIV");a=document.createElement("A");a.href=this.getLinkHref();a.title=c;a.appendChild(document.createTextNode(c));d2.appendChild(a);d2.className="filterByLinkNormal";this.addListener(d2,"onclick",this.onFilterRequested,d2,d);this.addListener(d2,"onmouseover",this.onMouseOverLink,d2);this.addListener(d2,"onmouseout",this.onMouseOutLink,d2);e.appendChild(d2)}};this.onBuildFilterList=function(){this.addToFilterList(this.cfg.TODAY,Msn.FilterBy.Today);this.addToFilterList(this.cfg.THIS_WEEK,Msn.FilterBy.ThisWeek);this.addToFilterList(this.cfg.THIS_MONTH,Msn.FilterBy.ThisMonth);this.addToFilterList(this.cfg.ALL_TIME,Msn.FilterBy.AllTime)};this.setDefaultFilter=function(){if(checkDefined(e)&&checkDefined(d)){var a="";switch(e){case Msn.FilterBy.Today:a=this.cfg.TODAY;break;case Msn.FilterBy.ThisWeek:a=this.cfg.THIS_WEEK;break;case Msn.FilterBy.ThisMonth:a=this.cfg.THIS_MONTH;break;case Msn.FilterBy.AllTime:a=this.cfg.ALL_TIME;break}d.innerText=a}};this._render=function(i){if(null!=i&&checkInt(g)&&checkString(f)){var k,a,j,h,e,c;h=document.createElement("DIV");h.className="filterByParent";a=document.createElement("DIV");a.className="filterByStatic";a.appendChild(document.createTextNode(this.cfg.FILTER_BY));h.appendChild(a);a=document.createElement("DIV");a.className="filterByDefault";c=document.createElement("DIV");c.className="defaultFilterValue";c.title=this.cfg.LABEL_DROP_DOWN;d=c;a.appendChild(c);c=document.createElement("DIV");c.className="filterDropDown";e=document.createElement("IMG");e.src=this.cfg.IMG_DROP_DOWN;e.alt=e.title=this.cfg.LABEL_DROP_DOWN;e.style.cursor="pointer";e.style.valign="middle";e.width="7";e.height="4";c.appendChild(e);a.appendChild(c);h.appendChild(a);this.addListener(a,"onclick",this.toggleFilterListDisplay);a=document.createElement("DIV");a.className="filterByList";b=a;h.appendChild(a);i.appendChild(h);this.onBuildFilterList();this.setDefaultFilter()}}};Msn.Controls.FilterResults.prototype=Msn.Controls;Msn.Controls.FilterTab=function(e,d,g){var h=this,a=null,b={},c=-1,f=g;this.add=function(a,d){if(checkDefined(a)&&checkDefined(d))b[a]={id:a,control:d,divElt:null,rendered:false};if(-1==c)c=a};this.select=function(d){if(checkDefined(d)&&checkDefined(b[d])&&d!=c)if(checkDefined(a)){if(this.getBrowser()==Msn.Browser.IE&&checkDefined(a.filters[0]))a.filters[0].Apply();b[c].divElt.style.display="none";c=d;if(!b[d].rendered){b[d].control.render(b[d].divElt);b[d].rendered=true}b[c].divElt.style.display="inline";if(this.getBrowser()==Msn.Browser.IE&&checkDefined(a.filters[0]))a.filters[0].Play()}else c=d};this.setFilterClass=function(b){if(checkString(b)){f=b;if(checkDefined(a))a.className=f}};this.setHeight=function(b){if(checkDefined(a)&&checkInt(b,0))a.style.height=b+"px"};this._render=function(i){if(null!=i){if(!checkDefined(a)){a=document.createElement("DIV");a.className=f;if(checkDefined(e))a.style.width=e+"px";if(checkDefined(d))a.style.height=d+"px";for(var h in b)if(checkObject(b[h].control)){var g=b[h];g.divElt=document.createElement("DIV");if(checkDefined(e))g.divElt.style.width=e+"px";if(checkDefined(d))g.divElt.style.height=d+"px";a.appendChild(g.divElt);if(g.id==c){if(!g.rendered){g.control.render(g.divElt);g.rendered=true}g.divElt.style.display="inline"}else g.divElt.style.display="none"}}i.appendChild(a)}}};Msn.Controls.FilterTab.prototype=Msn.Controls;Msn.Controls.FlashInstall=function(){var a=this;this.cfg={REQUIRE_FLASH:$["IDS_CLI_RequireFlash"],HELP_FLASH:$["IDS_CLI_HelpFlash"],FLASH_INSTALL_URL:$["IDS_GMT_FlashInstallUrl"],FLASH_HELP_URL:$["IDS_GMT_FlashHelpUrl"]};this.onFlashInstall=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"REQ:Flash:download"});setTimeout(a.onFlashInstallComplete,1000)};this.onFlashInstallComplete=function(){a.openPage(a.cfg.FLASH_INSTALL_URL)};this.onFlashHelp=function(){a.openPage(a.cfg.FLASH_HELP_URL)};this.openPage=function(a){if(getWindowContext()==Msn.WindowContext.DestinationPage)window.location.href=a;else openStandardWindow(a,"_blank")};var b=new Msn.Controls.Link(this.cfg.REQUIRE_FLASH,this.onFlashInstall,"",true),c=new Msn.Controls.Link(this.cfg.HELP_FLASH,this.onFlashHelp,"",true);this._render=function(e){if(null!=e){var d=document.createElement("DIV");d.className="flashInstallParent";e.appendChild(d);var a=document.createElement("DIV");a.className="flashInstall";d.appendChild(a);b.render(a);a.appendChild(document.createElement("BR"));a.appendChild(document.createElement("BR"));c.render(a);Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"REQ:Flash"})}}};Msn.Controls.FlashInstall.prototype=Msn.Controls;Msn.Controls.FlashObject=function(q,r,o,n){var p=this,u=[],t=[],a=null,c=null,s=false,b=q,d=r,i="",k="opaque",j="#000000",l=".",m="false",e=false,g=0,h=0,f=0;this.cfg={};this.subscribeEvent(Msn.Event.FlashVersionDetect);this.onEvent=function(c,a){switch(a){case Msn.Event.FlashVersionDetect:if(!Msn.FlashVersionDetect.checkVersion(g,h,f))this.onVersionDetectionFailure();default:break}};this.changeDimensions=function(c,b){if(this.getBrowser()==Msn.Browser.IE){a.width=c;a.height=b}else{a.setAttribute("width",c);a.setAttribute("height",b)}};this.getObjectNode=function(){return a};this.setFlashSrc=function(a){if(checkString(a))d=a};this.setFlashVars=function(a){if(checkString(a))i=a};this.setWMode=function(a){if(checkString(a))k=a};this.setBgColor=function(a){if(checkString(a))j=a};this.setBase=function(a){if(checkString(a))l=a};this.setMenu=function(a){m=a?"true":"false"};this.setInstallCtrl=function(e,b,d,a){if(checkObject(e))c=e;g=b!=undefined?b:0;h=d!=undefined?d:0;f=a!=undefined?a:0};this.onDispose=function(){if(this.getBrowser()==Msn.Browser.IE)try{for(var b in a)if(checkFunction(a[b]))a[b]=empty}catch(c){}a=null};this.onVersionDetectionFailure=function(){e=true;this.render()};this.verifyIEInstall=function(){var a=document.getElementById(b+"Install");if(a)p.onVersionDetectionFailure()};this._render=function(p){if(null!=p&&checkInt(o,0)&&checkInt(n,0)&&checkString(d)){if(Msn.FlashVersionDetect&&!Msn.FlashVersionDetect.checkVersion(g,h,f))e=true;if(e&&c)c.render(p);else if(this.getBrowser()==Msn.Browser.IE){p.innerHTML='<object id="'+b+'" '+'name="'+b+'" '+'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+'height="'+n+'" '+'width="'+o+'"> '+'<param name="Movie" value="'+d+'">'+'<param name="flashvars" value="'+i+'"/> '+'<param name="menu" value="'+m+'">'+'<param name="WMode" value="'+k+'">'+'<param name="Quality" value="High">'+'<param name="AllowScriptAccess" value="always">'+'<param name="BGColor" value="'+j+'">'+'<param name="base" value="'+l+'">'+'<div id="'+b+'Install"></div>'+"</object>";a=p.childNodes[0];if(c)setTimeout(this.verifyIEInstall,1000)}else{a=document.createElement("EMBED");a.id=b;a.setAttribute("name",b);a.setAttribute("bgcolor",j);a.setAttribute("allowScriptAccess","always");a.setAttribute("menu",m);a.setAttribute("quality","high");a.setAttribute("type","application/x-shockwave-flash");a.setAttribute("src",d);a.setAttribute("width",o);a.setAttribute("height",n);a.setAttribute("flashVars",i);a.setAttribute("wmode",k);a.setAttribute("base",l);p.appendChild(a)}}else a=null}};Msn.Controls.FlashObject.prototype=Msn.Controls;Msn.Controls.FlashVersionDetect=function(){var c=this,a,b,d;this._render=function(b){if(null!=b){b.style.position="absolute";var d="versiondetect",f=getCDNPath("/flash/versionDetect.swf"),a=new Msn.Controls.FlashObject(d,f,1,1);a.setWMode("transparent");a.render(b);var e=a.getObjectNode();c.addListener(e,"fscommand",c.onVersion);window[d+"_DoFSCommand"]=c.onVersion}};this.checkVersion=function(c,e,f){if(a>c||a==undefined)return true;else if(a==c)if(b>e||b==undefined)return true;else if(b==e&&(d>=f||d==undefined))return true;return false};this.onVersion=function(f){try{var e=f.split(" ")[1];e=e.split(",");a=checkInt(e[0])?e[0]:0;b=checkInt(e[1])?e[1]:0;d=checkInt(e[2])?e[2]:0;if(!checkDefined(Msn.FlashVersionDetect))Msn.FlashVersionDetect=c;Msn.Controls.fireEvent(Msn.Event.FlashVersionDetect,f)}catch(g){}}};Msn.Controls.FlashVersionDetect.prototype=Msn.Controls;Msn.Controls.FlyOver=function(){var a=this,f=null,c={},i=null,k=null,j=null,e=null,b=null,g=false,d=null,h=false;this.cfg={MIN_LEFT:0,MAX_LEFT:-325,FLIGHT_TIME:1000,REFRESH_INTERVAL_IE:10,REFRESH_INTERVAL_NONIE:100,CLOSE_BTN:getCDNPath("/i/close.jpg"),LABEL_CLOSE:$["IDS_CLI_Close"],VIDEO_BEGIN_AFTER_MSG:$["IDS_CLI_VideoBeginAfterMsg"],AD_DIV_ID:"fo_ad_div",AD_PORTABLE_WIDTH:300,AD_PORTABLE_HEIGHT:250,AD_NON_PORTABLE_WIDTH:300,AD_NON_PORTABLE_HEIGHT:240};this.subscribeEvent(Msn.Event.AdChanged);this.subscribeEvent(Msn.Event.CompanionAdDisplayed);this.subscribeEvent(Msn.Event.AdSurveyAvailable);this.subscribeEvent(Msn.Event.MediaLoaded);this.subscribeEvent(Msn.Event.MediaCompleted);this.subscribeEvent(Msn.Event.ShowFlyOver);this.onEvent=function(q,p,b){switch(p){case Msn.Event.AdChanged:if(checkObject(b))i=b.video;if(checkDefined(b.ad)){c=b.ad;var j=null,k=false,m=c.flashUrls;if(m.length>0)for(var n=0;n<m.length;n++){var l=m[n];if(parseInt(l.width)==300&&parseInt(l.height)==250){j=l.url;k=true;break}}if(null==j){j=c.flashUrl;k=false}if(null!=j){if(checkDefined(f)){d.style.visibility="visible";g=false;h=false;f.changeMovie(j,k);if(k)f.changeDimensions(300,250);else f.changeDimensions(300,240);if(checkStringNull(c.trackingScript)&&checkDefined(e))this.attachScript(c.trackingScript,e)}a.showAd(!c.isBSBAd)}else a.showAd(false);if(checkStringNull(c.trackingImg)){var o=document.createElement("IMG");o.src=c.trackingImg;e.appendChild(o)}}break;case Msn.Event.CompanionAdDisplayed:if(checkObject(b)&&b.id==a.cfg.AD_DIV_ID){g=false;d.style.visibility="visible";a.showAd(!b.isBSBAd)}break;case Msn.Event.MediaLoaded:if(checkObject(b)){d.style.visibility="hidden";if(!g)this.showAd(false)}break;case Msn.Event.MediaCompleted:d.style.visibility="hidden";this.showAd(false);break;case Msn.Event.ShowFlyOver:g=true;this.showAd(true);break;case Msn.Event.AdSurveyAvailable:if(checkObject(b))if(checkDefined(e))this.attachScript(b.url,e);break;default:break}};this.showAd=function(c){if(checkDefined(b))b.style.visibility="visible";if(c){clearTimeout(k);a.transitionX(b,a.cfg.MIN_LEFT,a.cfg.MAX_LEFT)}else a.transitionX(b,a.cfg.MAX_LEFT,a.cfg.MIN_LEFT)};this.hideAd=function(){a.trackCloseFlyOver();a.showAd(false)};this.trackCloseFlyOver=function(){var b={};b.video=i;b.ad=c;a.fireEvent(Msn.Event.TrackCloseFlyOverClick,b)};this.transitionX=function(b,g,d){if(checkDefined(b)){clearTimeout(j);var c;if(this.getBrowser()==Msn.Browser.IE)c=a.cfg.REFRESH_INTERVAL_IE;else c=a.cfg.REFRESH_INTERVAL_NONIE;var i=a.cfg.FLIGHT_TIME/c,e=(d-g)/i;if(Math.abs(b.style.pixelLeft-d)>Math.abs(e)){b.style.pixelLeft+=e;j=setTimeout(function(){a.transitionX(b,g,d)},c)}else{b.style.pixelLeft=d;if(!h){h=true;f.playExpanded()}}}};this.handleEvent=function(b){if(b.indexOf("URL")>=0){var d={};d.video=i;d.ad=c;a.fireEvent(Msn.Event.TrackFlyOverClick,d);var f=b.substring(3,4),e=c.clickUrls[parseInt(f)];if(checkString(e))openStandardWindow(e,"_blank")}else switch(b){case "NGAPReplay":break;case "NGAPCollapse":break;default:break}};this._render=function(k){if(null!=k){var j=k;j.className="flyOverContainer";e=document.createElement("DIV");e.style.position="absolute";e.style.visibility="hidden";j.appendChild(e);b=document.createElement("DIV");b.className="flyOver";b.style.visibility="hidden";b.style.pixelLeft=a.cfg.MIN_LEFT;j.appendChild(b);d=document.createElement("SPAN");d.style.color="White";d.style.width="270px";d.appendChild(document.createTextNode(a.cfg.VIDEO_BEGIN_AFTER_MSG));a.setCSSFloat(d,"left");b.appendChild(d);var c=document.createElement("IMG");b.appendChild(c);c.src=a.cfg.CLOSE_BTN;c.className="flyOverImg";c.title=c.alt=this.cfg.LABEL_CLOSE;this.addListener(c,"onclick",a.hideAd);a.setCSSFloat(c,"right");var g=document.createElement("SPAN");b.appendChild(g);g.style.color="White";g.style.cursor="pointer";g.style.display="block";a.setCSSFloat(g,"right");this.addListener(g,"onclick",a.hideAd);var h=document.createElement("DIV");h.style.paddingTop="5px";h.style.clear="both";h.style.width="300px";b.appendChild(h);f=new Msn.Controls.AdModule("flyOver",true,"transparent");f.setHandler(a.handleEvent);f.render(h);var i=document.createElement("DIV");i.id=a.cfg.AD_DIV_ID;i.style.clear="both";i.style.width="300px";b.appendChild(i)}}};Msn.Controls.FlyOver.prototype=Msn.Controls;Msn.Controls.GenericActionLink=function(){var e=this,f=null,b=document.createElement("IMG"),a=document.createElement("SPAN"),c=null,d=20;this.displayValue="inline";this.setImage=function(a,d,c){Msn.ImageLoader.Load(a,b);b.className=c;b.title=d;b.style.cursor="pointer";b.style.display=checkString(a)?"inline":"none"};this.setLinkText=function(b,c){a.innerText=ll(b,d);a.title=b;a.className=c};this.setMaxTextLength=function(b){d=b;a.innerText=ll(a.innerText,d)};this.setOnClickHandler=function(a){c=a};this.onClick=function(){if(checkDefined(c))c()};this.onMouseOver=function(){a.style.textDecoration="underline"};this.onMouseOut=function(){a.style.textDecoration="none"};this._render=function(f){if(null!=f){var g,c=document.createElement("SPAN"),d=document.createElement("SPAN");d.className="videoActionImageHolder";d.appendChild(b);c.appendChild(d);this.addListener(a,"onmouseover",e.onMouseOver);this.addListener(a,"onmouseout",e.onMouseOut);c.appendChild(a);this.addListener(c,"onclick",this.onClick);f.appendChild(c)}}};Msn.Controls.GenericActionLink.prototype=Msn.Controls;Msn.Controls.HistoryController=function(){var b=this,a=false;this.cfg={TODAY:$["IDS_CLI_Today"],THIS_WEEK:$["IDS_CLI_ThisWeek"],THIS_MONTH:$["IDS_CLI_ThisMonth"],ALL_TIME:$["IDS_CLI_AllTimes"],FILTER_BY:$["IDS_CLI_FilterBy"],SEARCH_RESULTS_FOR:$["IDS_CLI_SearchResultsFor"],HOME:$["IDS_CLI_Home"],BROWSE_VIDEOS:$["IDS_CLI_BrowseVideos"],TOP_TAGS:$["IDS_CLI_TopTags"],CATEGORIES:$["IDS_CLI_Categories"],UPLOAD_VIDEO:$["IDS_CLI_UploadVideo"],HELP:$["IDS_CLI_Help"],BY_RELEVANCE:$["IDS_CLI_ByRelevance"],BY_RATING:$["IDS_CLI_ByRating"],BY_DATE:$["IDS_CLI_ByDate"],BY_VIEWS:$["IDS_CLI_ByViews"],LAST_HOUR:$["IDS_CLI_LastHour"],LAST_DAY:$["IDS_CLI_LastDay"],LAST_WEEK:$["IDS_CLI_LastWeek"],LAST_MONTH:$["IDS_CLI_LastMonth"],ALL_TIMES:$["IDS_CLI_AllTimes"],SEARCH_LABEL:$["IDS_CLI_SearchLabel"],RELATED_VIDEOS:$["IDS_CLI_RelatedVideos"],MOST_POPULAR:$["IDS_CLI_MostPopular"],MOST_RECENT:$["IDS_CLI_MostRecent"],FEATURED:$["IDS_CLI_Featured"],TOP_RATED:$["IDS_CLI_TopRated"],MOST_COMMENTED:$["IDS_CLI_MostCommented"],TOP_FAVORITES_VIDEOS:$["IDS_CLI_TopFavoritesVideos"],MYSOAPBOX:$["IDS_CLI_Mysoapbox"],VIDEOS:$["IDS_CLI_Videos"],FAVORITES:$["IDS_CLI_Favorites"],SHARED:$["IDS_CLI_Shared"],USER:$["IDS_CLI_User"],USERS_PAGE:$["IDS_CLI_UsersPage"],PAGE_NUMBER:$["IDS_CLI_PageNumber"],SEARCH_RESULTS:$["IDS_CLI_SearchResults"],UPLOAD_VIDEO:$["IDS_CLI_UploadVideo"],STATUS:$["IDS_CLI_Status"],EDITVIDEO:$["IDS_CLI_EditVideo"],IMG_DROP_DOWN:getCDNPath("/i/down.gif")};this.subscribeEvent(Msn.Event.HistoryData);this.subscribeEvent(Msn.Event.Navigate);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.Search);this.subscribeEvent(Msn.Event.SplitSearch);this.subscribeEvent(Msn.Event.NextPageSearch);this.subscribeEvent(Msn.Event.ViewAllUpload);this.subscribeEvent(Msn.Event.VideoEdit);this.subscribeEvent(Msn.Event.PageRefresh);this.onEvent=function(x,k,b){if(k==Msn.Event.HistoryData){if(checkObject(b)){if(!a&&b.root&&b.direction==-1)history.go(-1);if(a&&!b.refresh){this.fireEvent(Msn.Event.ControlsReqFullScreen);if(b.direction==-1){history.go(1);return}}switch(b.action){case "home":if(checkDefined(Msn.MenuManager))Msn.MenuManager.loadDefaultMenuItem();break;case "navigation":if(checkInt(b.destination))if(Msn.Menu.Help==b.destination)this.skipEntry(b.direction);else this.fireEvent(Msn.Event.MenuClick,{menuId:b.destination});break;case "search":var l=parseInt(b.type),j=b.term,h=parseInt(b.page),i=parseInt(b.sort),p=b.domain,u=b.menuId,q=b.extra;switch(l){case SoapboxService.SearchType.Taxonomy:var f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Taxonomy,h,i,u);f.refresh=b.refresh;this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.Keyword:var w=this.cfg.SEARCH_RESULTS_FOR.format(ll(j,28).trim()),f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Keyword,h,i,p);f.setCloudTerm(b.cloudTerm);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.Tag:f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Tag,h,i,p);f.setCloudTerm(b.cloudTerm);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.Source:f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Source,h,i,q);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.Recommendations:f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Recommendations,h,i,p);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.ListRecent:f=Msn.Controls.SearchQueryFactory.create(null,l,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.ListPopular:f=Msn.Controls.SearchQueryFactory.create(null,l,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.ListTopRated:f=Msn.Controls.SearchQueryFactory.create(null,l,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.ListMostCommented:f=Msn.Controls.SearchQueryFactory.create(null,l,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.ListTopFavorites:f=Msn.Controls.SearchQueryFactory.create(null,l,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.Channel:if(checkDefined(Msn.MenuManager)){var m=Msn.MenuManager.getCategoryDataFromGuid(j);if(checkDefined(m)&&checkInt(m.categoryMenuId))this.fireEvent(Msn.Event.MenuSelect,{menuId:m.categoryMenuId})}f=Msn.Controls.SearchQueryFactory.create(j,SoapboxService.SearchType.Channel,h,i);this.fireEvent(Msn.Event.Search,f);break;case SoapboxService.SearchType.AllVideos:case SoapboxService.SearchType.User:case SoapboxService.SearchType.Favorites:case SoapboxService.SearchType.Shared:f=Msn.Controls.SearchQueryFactory.create(j,l,h,i,q);this.fireEvent(Msn.Event.Search,f);break}break;case "splitSearch":this.fireEvent(Msn.Event.SplitSearch,b.term);break;case "profile":var v=parseInt(b.evt);if(b.cid==0){b.cid=Msn.Passport.getCid();b.nickname=Msn.Passport.getNickname()}this.fireEvent(v,b);break;case "uploadQueue":if(Msn.Passport.isUserLoggedIn())this.fireEvent(Msn.Event.ViewAllUpload);else Msn.MenuManager.loadDefaultMenuItem();break;case "edit":if(Msn.Passport.isUserLoggedIn())this.fireEvent(Msn.Event.VideoEdit,b.videoId);else Msn.MenuManager.loadDefaultMenuItem();break;default:break}}}else if(k==Msn.Event.PageRefresh){if(checkDefined(Msn.HistoryManager)){var e=Msn.HistoryManager.getCurrentKey();if(checkDefined(e)){var o=true;switch(e.action){case "edit":case "uploadQueue":o=false;break;case "navigation":if(checkInt(e.destination))if(Msn.Menu.Help==e.destination||Msn.Menu.UploadVideos==e.destination||Msn.Menu.Upload==e.destination)o=false;break;case "profile":if(e.evt==Msn.Event.ViewProfile)if(Msn.Passport.isUserLoggedIn()&&e.cid==Msn.Passport.getCid()){this.fireEvent(Msn.Event.VideoEdited);this.fireEvent(Msn.Event.FavsUpdated);this.fireEvent(Msn.Event.VideoSharedUpdated)}else e.forceRefresh=true;break;default:break}if(o){e.refresh=true;this.fireEvent(Msn.Event.HistoryData,e)}}}}else if(k==Msn.Event.Navigate){if(checkDefined(b)&&checkInt(b.menuId)){var c=null;switch(parseInt(b.menuId)){case Msn.Menu.Home:c=this.cfg.HOME;break;case Msn.Menu.BrowseVideos:c=this.cfg.BROWSE_VIDEOS;break;case Msn.Menu.TopTags:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.TOP_TAGS;break;case Msn.Menu.Categories:c=this.cfg.CATEGORIES;break;case Msn.Menu.Upload:case Msn.Menu.UploadVideos:c=this.cfg.UPLOAD_VIDEO;break;case Msn.Menu.Help:c=this.cfg.HELP;break}if(checkString(c))e={title:c,action:"navigation",destination:parseInt(b.menuId)};if(checkDefined(e))this.fireEvent(Msn.Event.HistoryAdd,e)}}else if(k==Msn.Event.ControlsAckFullScreen)a=b;else if(k==Msn.Event.Search||k==Msn.Event.NextPageSearch){var d=b;if(checkDefined(d)&&checkString(d.term)&&d.addHistoryEntry){var c=null,r=null,g="",n="",t;if(checkInt(d.sort))switch(parseInt(d.sort)){case SoapboxService.SortOrder.Relevance:g=" > "+this.cfg.BY_RELEVANCE;break;case SoapboxService.SortOrder.Rating:g=" > "+this.cfg.BY_RATING;break;case SoapboxService.SortOrder.DateUploaded:g=" > "+this.cfg.BY_DATE;break;case SoapboxService.SortOrder.Playcount:g=" > "+this.cfg.BY_VIEWS;break;case SoapboxService.SortOrder.LastHour:g=" > "+this.cfg.LAST_HOUR;break;case SoapboxService.SortOrder.LastDay:g=" > "+this.cfg.LAST_DAY;break;case SoapboxService.SortOrder.LastWeek:g=" > "+this.cfg.LAST_WEEK;break;case SoapboxService.SortOrder.LastMonth:g=" > "+this.cfg.LAST_MONTH;break;case SoapboxService.SortOrder.AllTimes:g=" > "+this.cfg.ALL_TIMES;break;case SoapboxService.SortOrder.Default:break}switch(d.type){case SoapboxService.SearchType.Taxonomy:c=d.header+g;t=d.menuId;break;case SoapboxService.SearchType.Keyword:case SoapboxService.SearchType.Tag:c=this.cfg.SEARCH_LABEL+g;r=d.cloudTerm;break;case SoapboxService.SearchType.Source:c=d.extra;n=d.extra;break;case SoapboxService.SearchType.Recommendations:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.RELATED_VIDEOS;break;case SoapboxService.SearchType.ListPopular:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.MOST_POPULAR;break;case SoapboxService.SearchType.ListRecent:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.MOST_RECENT;break;case SoapboxService.SearchType.ListFeatured:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.FEATURED;break;case SoapboxService.SearchType.ListTopRated:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.TOP_RATED;break;case SoapboxService.SearchType.ListMostCommented:c=this.cfg.BROWSE_VIDEOS+" > "+this.cfg.MOST_COMMENTED;break;case SoapboxService.SearchType.ListTopFavorites:c=this.cfg.TOP_FAVORITES_VIDEOS;break;case SoapboxService.SearchType.Channel:c=this.cfg.CATEGORIES+" "+g;if(checkDefined(Msn.MenuManager)){m=Msn.MenuManager.getCategoryDataFromGuid(d.term);if(checkDefined(m)&&checkString(m.categoryFriendlyName))c=this.cfg.CATEGORIES+" > "+m.categoryFriendlyName.toLowerCase()+g}break;case SoapboxService.SearchType.AllVideos:c=this.cfg.MYSOAPBOX+" > "+this.cfg.VIDEOS;n=d.extra;break;case SoapboxService.SearchType.User:var s=checkString(d.extra)?d.extra:this.cfg.USER;c=this.cfg.USERS_PAGE.format(s)+" > "+this.cfg.VIDEOS;n=d.extra;break;case SoapboxService.SearchType.Favorites:s=checkString(d.extra)?d.extra:this.cfg.USER;if(Msn.Passport.getCid()==d.term)c=this.cfg.MYSOAPBOX+" > "+this.cfg.FAVORITES;else c=this.cfg.USERS_PAGE.format(s)+" > "+this.cfg.FAVORITES;n=d.extra;break;case SoapboxService.SearchType.Shared:c=this.cfg.MYSOAPBOX+" > "+this.cfg.SHARED;n=d.extra;break}if(checkString(c)){c+=" > "+this.cfg.PAGE_NUMBER.format(d.page+1);e={"title":c,"action":"search","type":d.type,"term":d.term,"page":d.page,"sort":d.sort,"domain":d.videoDomain,"extra":n,"cloudTerm":r,"menuId":t};this.fireEvent(Msn.Event.HistoryAdd,e)}}}else if(Msn.Event.SplitSearch==k){c=this.cfg.SEARCH_RESULTS;e={title:c,action:"splitSearch",term:b};this.fireEvent(Msn.Event.HistoryAdd,e)}else if(Msn.Event.ViewAllUpload==k){e={title:this.cfg.UPLOAD_VIDEO+" > "+this.cfg.STATUS,action:"uploadQueue"};this.fireEvent(Msn.Event.HistoryAdd,e)}else if(Msn.Event.VideoEdit==k){e={title:this.cfg.EDITVIDEO,action:"edit",videoId:b};this.fireEvent(Msn.Event.HistoryAdd,e)}};this.skipEntry=function(a){history.go(a>0?1:-1)}};Msn.Controls.HistoryController.prototype=Msn.Controls;Msn.Controls.HistoryManager=function(){var that=this,_iFrame,_currentKey,_currentIndex=-1,_keysArray={},_historyFrozen=false;this.subscribeEvent(Msn.Event.HistoryAdd);this.subscribeEvent(Msn.Event.DialogBoxActive);this.subscribeEvent(Msn.Event.DialogBoxInActive);this.onEvent=function(g,c,b){if(Msn.Event.HistoryAdd==c){if(checkDefined(_iFrame)&&checkObject(b)){var e=checkString(b.title)?b.title:"soapbox",d=serialize(b);if(_currentKey!=d){var a=_iFrame.contentDocument||_iFrame.contentWindow.document;if(checkDefined(a)){_currentKey=d;_currentIndex++;_keysArray[_currentIndex.toString()]=d;if(this.getBrowser()==Msn.Browser.IE){a.open();a.write("<title>"+e+"</title>");a.write("<script type='text/javascript' language='javascript'>parent.Msn.HistoryManager.onHistoryIndexData("+_currentIndex+");</script>");a.close()}else if(this.getBrowser()==Msn.Browser.Firefox){var f=(checkDefined(Msn.Application)?Msn.Application.getDocumentTitle()+" > ":"")+e;this.fireEvent(Msn.Event.DocumentTitle,f);_iFrame.src="/history.html#"+escape(_currentIndex)}}}}}else if(Msn.Event.DialogBoxActive==c)_historyFrozen=true;else if(Msn.Event.DialogBoxInActive==c)_historyFrozen=false};this.onHistoryData=function(a,b){if(checkObject(a)){var c=serialize(a);if(_currentKey!=c)if(_historyFrozen){var e=b-_currentIndex;history.go(e*-1)}else{a.direction=b-_currentIndex;a.root=b==0;_currentKey=c;_currentIndex=b;this.fireEvent(Msn.Event.HistoryChanged);this.fireEvent(Msn.Event.HistoryData,a);if(this.getBrowser()==Msn.Browser.Firefox&&checkString(a.title)){var d=(checkDefined(Msn.Application)?Msn.Application.getDocumentTitle()+" > ":"")+a.title;this.fireEvent(Msn.Event.DocumentTitle,d)}}}};this.onHistoryIndexData=function(index){if(checkInt(index,0)){eval("var obj = "+_keysArray[index.toString()]+";");this.onHistoryData(obj,index)}};this._render=function(a){if(null!=a&&!checkDefined(_iFrame)){if(!checkDefined(Msn.HistoryManager))Msn.HistoryManager=this;_iFrame=document.createElement("IFRAME");_iFrame.id=_iFrame.name="histFrame";_iFrame.style.display="none";a.appendChild(_iFrame);var b={title:"Welcome",action:"home"};this.fireEvent(Msn.Event.HistoryAdd,b)}};this.saveState=function(){if(checkDefined(this.uniqueId)&&checkString(_currentKey))cookieSet("st_"+this.uniqueId,_currentKey,1)};this.restoreLastState=function(){var retValue=false;if(checkDefined(this.uniqueId))try{var lastKey=cookieGet("st_"+this.uniqueId);cookieClear("st_"+this.uniqueId);if(checkString(lastKey)){eval("var obj = "+lastKey+";");this.onHistoryData(obj,0);retValue=true}}catch(a){}return retValue};this.getCurrentKey=function(){if(checkString(_currentKey))try{eval("var obj = "+_currentKey+";");return obj}catch(a){}}};Msn.Controls.HistoryManager.prototype=Msn.Controls;Msn.Controls.HomePage=function(){var c=this;this.cfg={FEATURED_VIDEOS:$["IDS_CLI_FeaturedVideos"]};var b=new Msn.Controls.SearchResultPanel(4,4,true,false,true),a=new Msn.Controls.Container(true,true,this.cfg.FEATURED_VIDEOS,false);this._render=function(d){if(null!=d){var c=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.ListFeatured,0,SoapboxService.SortOrder.Default);c.disableMenuSelect();c.disableHistoryEntry();a.showRss(true);a.showViewAll(false);a.setContent(b);b.setContainerProperty(a,this.cfg.FEATURED_VIDEOS);a.render(d);b.setSearchQuery(c);a.setRssUrl(c.rssUrl,c.zuneUrl)}}};Msn.Controls.HomePage.prototype=Msn.Controls;Msn.Controls.IM=function(){var b=this,a=null;this.cfg={UNKNOWN_ERROR:$["IDS_CLI_UnknownError"],NOIE_ERROR:$["IDS_CLI_NoieError"],NOMSGR_ERROR:$["IDS_CLI_NomsgrError"],LAUNCH_ID:$["IDS_GMT_ActivityLaunchId"]};this.Launch=function(b,c){if(checkString(b)&&checkInt(this.cfg.LAUNCH_ID)){if(this.getBrowser()!=Msn.Browser.IE)customAlert(this.cfg.NOIE_ERROR);else{if(!checkObject(a))try{a=new ActiveXObject("MSNMessenger.P4QuickLaunch")}catch(d){a=null}if(!checkObject(a))customAlert(this.cfg.NOMSGR_ERROR);else try{if(checkDefined(Msn.Player))Msn.Player.saveState(b);a.LaunchApp(this.cfg.LAUNCH_ID,"");this.fireEvent(Msn.Event.ControlsReqPause,true);return true}catch(d){a=null;if(!c)this.Launch(b,true);else customAlert(this.cfg.UNKNOWN_ERROR)}}return false}}};Msn.Controls.IM.prototype=Msn.Controls;Msn.Controls.Image=function(b,g,d,c,i,f,e){var k=this,a=null,j=false,h=checkString(b)&&b.toLowerCase().indexOf(".png")>0&&this.getBrowser()==Msn.Browser.IE;h=false;this.getImageNode=function(){return a};this.setSrc=function(a){if(checkString(a)&&b!=a){b=a;this.refresh()}};this.setHoverSrc=function(a){if(checkString(a)&&g!=a){g=a;this.refresh()}};this.refresh=function(){if(checkObject(a)){var c=b;if(j&&checkString(g))c=g;if(checkString(c))if(h)a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"', sizingMethod='scale')";else a.src=c}};this.setTitle=function(b){if(checkString(b)){d=b;if(checkObject(a))a.alt=a.title=d}};this.setClassName=function(b){if(checkString(b)){c=b;if(checkObject(a))a.className=c}};this.onMouse=function(b,a){j=a;this.refresh()};this._render=function(g){if(null!=g){if(h){a=document.createElement("SPAN");if(checkString(c))a.className=c;if(checkInt(f,0))a.style.width=f+"px";if(checkInt(e,0))a.style.height=e+"px";if(checkString(d))a.alt=a.title=d;a.style.display="inline-block";if(checkString(b))a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"', sizingMethod='scale')"}else{a=document.createElement("IMG");if(checkString(c))a.className=c;if(checkString(b))a.src=b;if(checkString(d))a.alt=a.title=d;if(checkInt(f,0))a.width=f;if(checkInt(e,0))a.height=e}g.appendChild(a);if(checkFunction(i)){this.addListener(a,"onmousedown",i,a);a.style.cursor="pointer"}this.addListener(a,"onmouseover",this.onMouse,true);this.addListener(a,"onmouseout",this.onMouse,false)}}};Msn.Controls.Image.prototype=Msn.Controls;Msn.ImageEnum=SoapboxService.Utils.CreateEnum("ADD_TO_PLAYLIST","/i/addToPlaylist.gif","VIDEO_ADDED","/i/addToPlaylistDown.gif","RSS_MINI","/i/rssMini.gif","ZUNE_ICON","/i/zuneIcon.jpg","INFO_ICON","/i/info_icon.gif","ALERT_ICON","/i/alert_icon.gif","VIDEO_LINK","/i/videolink.jpg","EMAIL","/i/email.jpg","ADD_COMMENT","/i/AddComment.gif","DEL_COMMENT","/i/cl.gif","NAV_ARROW_OFF_STATE","/i/nav/nav-arrow-off-state.gif","EMBED","/i/embed.gif");Msn.Controls.ImageLoader=function(){var b=new Array(Msn.ImageEnum.ADD_TO_PLAYLIST,Msn.ImageEnum.VIDEO_ADDED,Msn.ImageEnum.RSS_MINI,Msn.ImageEnum.ZUNE_ICON,Msn.ImageEnum.INFO_ICON,Msn.ImageEnum.ALERT_ICON,Msn.ImageEnum.VIDEO_LINK,Msn.ImageEnum.EMAIL,Msn.ImageEnum.NAV_ARROW_OFF_STATE),a={},c=this;if(!checkDefined(Msn.ImageLoader))Msn.ImageLoader=this;this.loadState=function(){var c=[];for(var a=0;a<b.length;a++){c[a]=new Image(1,1);this.Load(b[a],c[a])}};this.Load=function(b,d){if(null!=a[b]){if(checkArray(a[b]))a[b].push(d)}else{a[b]=[];a[b].push(d);var c=new Image(1,1);this.addListener(c,"onload",this.onLoadComplete,b);c.src=getCDNPath(b)}};this.onLoadComplete=function(e,b){var c=a[b];a[b]=null;while(checkArray(c)&&c.length>0){var d=c.shift();this.setImage(d,b)}};this.setImage=function(a,c){var b=getCDNPath(c);if(checkDefined(a.tagName))if(a.tagName.toLowerCase()=="img")a.src=b;else a.style.backgroundImage="url('"+b+"')"}};Msn.Controls.ImageLoader.prototype=Msn.Controls;Msn.Controls.Label=function(d,c,b,e){var f=this,a=null;this.setText=function(b){a.innerText=b};this.setClassName=function(b){a.className=b};this._render=function(f){if(null!=f){a=document.createElement("SPAN");if(checkDefined(d))a.innerText=d;if(checkDefined(c))a.className=c;if(checkFunction(b)){a.style.cursor="pointer";this.addListener(a,"onclick",b,e)}f.appendChild(a)}}};Msn.Controls.Label.prototype=Msn.Controls;Msn.Controls.LeaveBehind=function(){var i=this,g=null,a=null,j={id:0},d=null,b=null,e=null,f=null,h=null;this.cfg={AD_DIV_ID:"lb_ad_div",AD_WIDTH:300,AD_HEIGHT:60};this.subscribeEvent(Msn.Event.AdChanged);this.subscribeEvent(Msn.Event.MediaLoaded);this.onEvent=function(q,o,k){switch(o){case Msn.Event.AdChanged:if(checkDefined(k)){a=k.ad;j=k.video;var i=null,h=false,m=checkDefined(a)?a.flashUrls:{};if(m.length>0)for(var n=0;n<m.length;n++){var l=m[n];if(parseInt(l.width)==300&&parseInt(l.height)==60){i=l.url;h=true;break}}if(null==i&&checkDefined(a)&&checkString(a.flashUrl)){i=a.flashUrl;h=false}if(null!=i){g.changeMovie(i,h);d.style.top=h?"5px":"-175px";if(h)g.changeDimensions(300,60);else g.changeDimensions(300,250);c(b,false);c(d,true)}else if(checkDefined(a)){f.src=a.imageUrl;if(checkArray(a.clickUrls)&&checkString(a.clickUrls[1])&&checkDefined(e))e.href=a.clickUrls[1];c(d,false);c(b,true)}else{c(d,false);c(b,false)}}break;case Msn.Event.MediaLoaded:if(checkObject(k)){var p=k;if(p.Id!=j.Id){c(d,false);c(b,false)}}break;default:break}};function c(a,b){if(a&&checkDefined(a))if(b)a.style.visibility="visible";else a.style.visibility="hidden"}this.trackLeaveBehindClick=function(){var b={};b.video=j;b.ad=a;i.fireEvent(Msn.Event.TrackLeaveBehindClick,b)};this.onImageError=function(){c(b,false)};this.onImageClick=function(){i.trackLeaveBehindClick()};this.handleEvent=function(b){if(b.indexOf("URL")>=0){i.trackLeaveBehindClick();var e=b.substring(3,4),d=a.clickUrls[parseInt(e)];if(checkString(d))openStandardWindow(d,"_blank")}else switch(b){case "NGAPReplay":var c={};c.video=j;c.ad=a;i.fireEvent(Msn.Event.ShowFlyOver);i.fireEvent(Msn.Event.TrackReplay,c);g.collapseStatic();break;case "NGAPCollapse":break;default:break}};this._render=function(j){if(null!=j&&h==null){var k=j;j.className="leaveBehindContainer";h=document.createElement("DIV");h.style.visibility="visible";k.appendChild(h);b=document.createElement("DIV");b.className="leaveBehindImg";e=document.createElement("A");b.appendChild(e);e.href=this.getLinkHref();e.target="_blank";this.addListener(e,"onclick",this.onImageClick);f=document.createElement("IMG");e.appendChild(f);f.style.border="0px";f.style.width="300px";f.style.height="60px";c(b,false);this.addListener(f,"onerror",this.onImageError);h.appendChild(b);d=document.createElement("DIV");d.className="leaveBehindPlayer";h.appendChild(d);g=new Msn.Controls.AdModule("leaveBehind",false,"transparent");g.setHandler(i.handleEvent);g.render(d);var a=document.createElement("DIV");a.id=i.cfg.AD_DIV_ID;a.className="leaveBehindImg";h.appendChild(a)}}};Msn.Controls.LeaveBehind.prototype=Msn.Controls;Msn.Controls.Link=function(g,e,c,f,d){var h=this,a=null,b=null;this.setText=function(c){if(checkDefined(c)&&checkDefined(a)&&checkDefined(b)){var e=c.indexOf("{0}"),g=c.indexOf("{1}");if(f&&e!=-1&&g!=-1){b.appendChild(document.createTextNode(c.substring(0,e)));if(checkString(d))a.innerText=d;else a.innerText=c.substring(e+3,g);b.appendChild(a);b.appendChild(document.createTextNode(c.substring(g+3)))}else{a.innerText=c;b.appendChild(a)}}};this.setClassName=function(a){b.className=a};this._render=function(d){if(null!=d){b=document.createElement("SPAN");a=document.createElement("A");a.href=this.getLinkHref();a.style.cursor="pointer";this.setText(g);if(checkDefined(c))b.className=c;if(checkDefined(e))this.addListener(a,"onclick",e);d.appendChild(b)}}};Msn.Controls.Link.prototype=Msn.Controls;Msn.Controls.LiteralHTML=function(b,c,d){var e=this,a=null;this.setHTML=function(c){if(checkDefined(a))a.innerHTML=c;else b=c};this.setText=function(c){if(checkDefined(a))a.innerText=c;b=c};this.setClassName=function(b){if(checkDefined(a))a.className=b;c=b};this.setTitle=function(b){if(checkDefined(a))a.title=b;d=b};this._render=function(e){if(null!=e){a=e;if(checkDefined(b))a.innerHTML=b;if(checkDefined(c))a.className=c;if(checkDefined(d))a.title=d}}};Msn.Controls.LiteralHTML.prototype=Msn.Controls;Msn.Controls.LiveSearchAdapter=function(){this.convertSearchResult=function(d,c){var e=null;if(checkObject(d)&&checkObject(d.SearchResponse)&&checkObject(d.SearchResponse.Video)){var a=d.SearchResponse.Video,b=this.convertVideoList(a.Results);if(checkDefined(b)){var h=checkDefined(c)?c.term:0,f=checkInt(a.Total)?a.Total:b.length,g=checkInt(a.Offset)?a.Offset:0;e={"SearchKey":h,"Videos":b,"Count":b.length,"Offset":g,"TotalCount":f,"SearchType":checkDefined(c)?c.type:0,"AltSearchText":""}}}return e};this.convertVideoList=function(a){var c=[];if(checkArray(a))for(var b=0;b<a.length;b++){var d=this.convertVideo(a[b]);if(d)c.push(d)}return c};this.convertVideo=function(b){var a={};try{a.IsWeb=true;a.Url=b.Url;a.PlayUrl=b.PlayUrl;a.Title=b.Title;a.Description=b.Title;a.Source=b.SourceTitle;a.SourceFriendlyName=b.SourceTitle;a.Provider=b.SourceTitle;a.StreamLength=b.RunTime;a.Status=SoapboxService.VideoStatus.Published;var c=checkArray(b.StaticThumbnails,1)?b.StaticThumbnails[0]:b.StaticThumbnail;a.Thumbnail=checkObject(c)&&checkString(c.Url)?c.Url:null}catch(d){a=null}return a}};Msn.Controls.LiveSearchRequestManager=function(){var c=this,a=[],b=null,d=0;this.cfg={SERVER:Msn.Controls.config.liveSearchUrl,APPID:Msn.Controls.config.liveSearchAppId,MKT:Msn.Controls.config.market,PARAMS:"?jsonType=callback&jsonCallback=Msn.LiveSearchRequestManager.{0}&query={1} -site:video.msn.com -site:soapbox.msn.com&sources=video+web&appId={2}&video.offset={3}&video.count={4}&mkt={5}",REQUEST_TIMEOUT:15000};this.subscribeEvent(Msn.Event.ApplicationTick);this.onEvent=function(b,a){if(a==Msn.Event.ApplicationTick&&checkDefined(Msn.LiveSearchRequestManager))Msn.LiveSearchRequestManager.clearTimedOutRequest()};function e(a,e,d,c,b){this.id=a;this.url=e;this.callbackFunc=d;this.callbackData=c;this.callbackErrorFunc=b;this.nodeName="LiveSearchRequest"+a;this.cancelled=false;this.requestStartTime=(new Date).getTime()}this.makeRequest=function(n,p,o,h,m,l){var f;if(checkFunction(h)){if(b==null){b=document.createElement("div");document.body.appendChild(b)}f=d++;var j="cb"+f;this[j]=function(a){c.doCallback(a,f)};var k=this.cfg.SERVER+this.cfg.PARAMS.format(j,encodeURIComponent(n),this.cfg.APPID,o,p,this.cfg.MKT),i=new e(f,k,h,m,l);a.push(i);var g=document.createElement("script");g.id=i.nodeName;b.appendChild(g);g.src=k}return f};this.clearTimedOutRequest=function(){var d=(new Date).getTime();for(var c=0;c<a.length;c++){var b=a[c];if(checkDefined(b.requestStartTime)&&d-b.requestStartTime>this.cfg.REQUEST_TIMEOUT){this.cancelRequest(b.id);if(checkFunction(b.callbackErrorFunc))b.callbackErrorFunc(b.callbackData);break}}};this.cancelRequest=function(c){for(var b=0;b<a.length;b++)if(a[b].id==c){a[b].cancelled=true;break}};this.doCallback=function(g,f){for(var b=0;b<a.length;b++)if(a[b].id==f){var e=a[b];a.splice(b,1);if(!e.cancelled)e.callbackFunc(g,e.callbackData);c["cb"+f]=null;var d=document.getElementById(e.nodeName);if(d&&d.parentNode)setTimeout(function(){d.parentNode.removeChild(d)},100);g=null;break}}};Msn.Controls.LiveSearchRequestManager.prototype=Msn.Controls;Msn.LiveSearchRequestManager=new Msn.Controls.LiveSearchRequestManager;Msn.Controls.MainSpinner=function(){var b=this,a=new Msn.Controls.WorkInProgress(Msn.Spinner.MainPanel);this.subscribeEvent(Msn.Event.RequestProcessed);this.subscribeEvent(Msn.Event.RequestCompleted);this.onEvent=function(c,b){switch(b){case Msn.Event.RequestProcessed:a.showWIP();break;case Msn.Event.RequestCompleted:a.hideWIP();break}};this.cfg={};this._render=function(b){if(null!=b)a.render(b)}};Msn.Controls.MainSpinner.prototype=Msn.Controls;Msn.Menu=SoapboxService.Utils.CreateEnum("BrowseVideos",0,"MostRecent",1,"MostViewed",2,"MostCommented",3,"TopFavorites",4,"TopRated",5,"TopTags",6,"Categories",100,"Animals",101,"Animation",102,"Autos",103,"Blogs",104,"Comedy",105,"Commercials",106,"Entertainment",107,"Games",108,"Movies",109,"Music",110,"People",111,"Politics",112,"Screencast",113,"Sports",114,"Technology",115,"Travel",116,"MySoapbox",200,"Upload",201,"Videos",202,"Tags",203,"Favorites",204,"Comments",205,"UploadVideos",300,"Help",400,"Home",500,"Search",600,"SearchMSNVideo",601,"SearchSoapbox",602);Msn.MenuItemType=SoapboxService.Utils.CreateEnum("TopicCategory","topcat","Query","query","Search","search","Market","market","Supplier","supplier","Custom","custom","SoapboxCategory","soapboxcat","NoRender","norender");Msn.Controls.MenuManager=function(){var _this=this,_menuControls=[],_defaultMenuItem=null;this.defaultSoapboxMenuItem=null;var _menuContext=[];this.setDefaultMenuItem=function(a){_defaultMenuItem=a};this.setDefaultSoapboxMenuItem=function(a){this.defaultSoapboxMenuItem=a};this.loadDefaultMenuItem=function(){if(checkObject(_defaultMenuItem))_this.fireEvent(Msn.Event.MenuClick,{menuId:_defaultMenuItem.$id})};this.loadDefaultSoapboxMenuItem=function(){if(checkObject(this.defaultSoapboxMenuItem))_this.fireEvent(Msn.Event.MenuClick,{menuId:this.defaultSoapboxMenuItem.$id})};this.initDefault=function(){_this.loadDefaultMenuItem()};this.getMenuLevel=function(b,a){if(!checkInt(a))if(b instanceof Msn.Controls.RootMenu)a=0;else if(b instanceof Msn.Controls.PopupMenu)a=1;else a=0;return a};this.addMenuControl=function(c,a){a=_this.getMenuLevel(c,a);var b=_menuControls[a];if(!checkArray(b)){b=[];_menuControls[a]=b}b.push(c)};this.setMenuContext=function(b,a){a=_this.getMenuLevel(b,a);var c=_menuContext[a];_menuContext[a]=b;if(checkObject(c)&&c!=b)c.deselect();this.fireEvent(Msn.Event.MenuContextChanged,a);return true};this.getMenuContext=function(b){if(!checkInt(b))for(var a=_menuContext.length-1;a>=0;a--)if(checkObject(_menuContext[a]))return _menuContext[a];return _menuContext[b]};this.getSelectedMenuItem=function(){var a=null,b=_this.getMenuContext();if(checkObject(b))a=b.getSelectedItem();return a};this.getCurrentMenuName=function(){var b="",a=_this.getSelectedMenuItem();if(checkObject(a)&&checkString(a.$label))b=a.$label;return b};this.getMatchingMenuControl=function(b,g){if(checkDefined(b)){var a=_this.getMenuContext();while(checkObject(a)){if(a.getMenuItem(b)!=null)return a;a=a.getParentMenu()}if(g)for(var d=0;d<_menuControls.length;d++){var c=_menuControls[d];if(checkArray(c))for(var e=0;e<c.length;e++){var f=c[e];if(f.getMenuItem(b)!=null)return f}}}return null};this.isSoapboxCategory=function(a){if(checkInt(a))switch(parseInt(a)){case Msn.Menu.Animals:case Msn.Menu.Animation:case Msn.Menu.Autos:case Msn.Menu.Blogs:case Msn.Menu.Comedy:case Msn.Menu.Commercials:case Msn.Menu.Entertainment:case Msn.Menu.Games:case Msn.Menu.Movies:case Msn.Menu.Music:case Msn.Menu.People:case Msn.Menu.Politics:case Msn.Menu.Screencast:case Msn.Menu.Sports:case Msn.Menu.Technology:case Msn.Menu.Travel:return true}return false};this.getCustomMenuIdFromMenuClickParam=function(a){var c=null;if(checkInt(a))c=parseInt(a);else if(checkObject(a)&&a.$type==Msn.MenuItemType.Custom&&checkInt(a.$menuId))c=parseInt(a.$menuId);else if(checkString(a)){var d=Msn.Controls.config.taxonomy;if(checkObject(d)){var b=d.getHashNode(a);if(checkObject(b)&&b.$type==Msn.MenuItemType.Custom&&checkInt(b.$menuId))c=parseInt(b.$menuId)}}return c};this.onDefaultVideoListLoaded=function(a){if(checkArray(a))_this.fireEvent(Msn.Event.DefaultVideosLoaded,a)};this.subscribeEvent(Msn.Event.MenuSelect);this.subscribeEvent(Msn.Event.MenuClick);this.onEvent=function(p,j,a){if(j==Msn.Event.MenuSelect||j==Msn.Event.MenuClick){var i=SoapboxService.SortOrder.Default,e=0;if(null!=a.sortOrder)i=a.sortOrder;if(null!=a.page)e=a.page;if(checkDefined(a)&&checkDefined(a.loadDefaultPlaylist)&&a.loadDefaultPlaylist){var m=Msn.Controls.config.taxonomy;if(checkObject(m)){var b=m.getHashNode(a.menuId);if(checkDefined(b)&&checkDefined(b.defaultVideos)){var k=b.defaultVideos.$videosUrl;if(checkString(k)){var q=new Msn.Controls.VideoService;q.getVideosFromServiceUrl(k,null,_this.onDefaultVideoListLoaded,null)}}}}var f,g;if(checkDefined(a)){f=_this.getCustomMenuIdFromMenuClickParam(a.menuId);g=_this.isSoapboxCategory(a.menuId)}var b=null,d=null;if(checkDefined(a)&&(checkInt(a.menuId)||checkString(a.menuId))){var h=_this.getSelectedMenuItem();if(checkObject(h)&&(h.$menuId==a.menuId||h.$id==a.menuId)){b=h;d=_this.getMatchingMenuControl(a.menuId,false)}else{d=_this.getMatchingMenuControl(a.menuId,true);if(checkObject(d)&&checkFunction(d.getMenuItem))b=d.getMenuItem(a.menuId)}}else if(checkDefined(a)&&checkObject(a.menuId)&&checkString(a.menuId.$id)){b=a.menuId;d=_this.getMatchingMenuControl(a.menuId.$id,true)}a.menuFound=false;if(p!=d&&checkObject(d)&&checkFunction(d.selectMenuItem)&&checkObject(b)){d.selectMenuItem(b,false);a.menuFound=true}if(!checkObject(b)){var l=_this.getMenuContext(1);if(checkObject(l))l.deselect()}var r=true;if(j==Msn.Event.MenuClick)if(g&&!checkObject(b)||g&&checkObject(b)&&b.$type==Msn.MenuItemType.Custom||!g&&checkInt(f)){var c={cid:Msn.Passport.getCid(),nickname:Msn.Passport.getNickname()};switch(f){case Msn.Menu.Home:case Msn.Menu.BrowseVideos:case Msn.Menu.MostRecent:case Msn.Menu.MostViewed:case Msn.Menu.MostCommented:case Msn.Menu.TopFavorites:case Msn.Menu.TopRated:case Msn.Menu.TopTags:case Msn.Menu.Categories:case Msn.Menu.Upload:case Msn.Menu.UploadVideos:case Msn.Menu.Help:this.fireEvent(Msn.Event.Navigate,{menuId:f,sortOrder:i,page:e});break;case Msn.Menu.Animals:case Msn.Menu.Animation:case Msn.Menu.Autos:case Msn.Menu.Blogs:case Msn.Menu.Comedy:case Msn.Menu.Commercials:case Msn.Menu.Entertainment:case Msn.Menu.Games:case Msn.Menu.Movies:case Msn.Menu.Music:case Msn.Menu.People:case Msn.Menu.Politics:case Msn.Menu.Screencast:case Msn.Menu.Sports:case Msn.Menu.Technology:case Msn.Menu.Travel:this.fireEvent(Msn.Event.NavigateCategory,{menuId:this.getCategoryDataFromMenuId(f),sortOrder:SoapboxService.SortOrder.Default,page:e});break;case Msn.Menu.MySoapbox:setTimeout(function(){_this.fireEvent(Msn.Event.ViewProfile,c)},20);break;case Msn.Menu.Videos:if(c.cid!=0){var n=Msn.Controls.SearchQueryFactory.create(c.cid,SoapboxService.SearchType.User,e,SoapboxService.SortOrder.Default,c.nickname);this.fireEvent(Msn.Event.Search,n)}else setTimeout(function(){_this.fireEvent(Msn.Event.ViewProfile,c)},20);break;case Msn.Menu.Favorites:if(c.cid!=0){n=Msn.Controls.SearchQueryFactory.create(c.cid,SoapboxService.SearchType.Favorites,e,SoapboxService.SortOrder.Default,c.nickname);this.fireEvent(Msn.Event.Search,n)}else setTimeout(function(){_this.fireEvent(Msn.Event.ViewProfile,c)},20);break;case Msn.Menu.Tags:this.fireEvent(Msn.Event.ViewAllProfileTags,c);break;case Msn.Menu.Comments:this.fireEvent(Msn.Event.ViewAllProfileComments,c);break}}else if(checkObject(b)){var o=Msn.Controls.SearchQueryFactory.create(null,SoapboxService.SearchType.Taxonomy,e,i,b.$id);this.fireEvent(Msn.Event.Search,o)}}};function getVideosUrlFromTopicCategory(b,c){var a="VideoByTag.aspx?tag="+c+"&mk="+b+"&ns=MSNVideo_Top_Cat";return a}this.getCategoryDataFromMenuId=function(menuId){var retObj=null,categories=Msn.Cache.get("Categories");if(checkDefined(categories))for(var n=0;n<categories.length;n++){var categoryMenuId=eval("Msn.Menu."+categories[n].Name.replace(/ /g,""));if(categoryMenuId==menuId){retObj={"categoryMenuId":menuId,"categoryName":categories[n].Name,"categoryGuid":categories[n].IdString};break}}return retObj};this.getCategoryDataFromGuid=function(catGuid){var retObj=null,categories=Msn.Cache.get("Categories");if(checkDefined(categories))for(var n=0;n<categories.length;n++)if(catGuid.toLowerCase()==categories[n].IdString.toLowerCase()){retObj={"categoryMenuId":eval("Msn.Menu."+categories[n].Name.replace(/ /g,"")),"categoryName":categories[n].Name,"categoryFriendlyName":categories[n].FriendlyName,"categoryGuid":categories[n].IdString};break}return retObj};function normalizeTaxonomyData(a){if(!checkDefined(a)||!checkDefined(a.menuTaxonomy)||!checkDefined(a.menuTaxonomy.subjects)||!checkArray(a.menuTaxonomy.subjects.subject))return;var e;a.idHash={};a.addHashNode=function(a){q(a);var b=a.$id;if(checkDefined(b)&&!checkDefined(this.idHash[b]))this.idHash[b]=a;if(checkInt(a.$menuId)&&(a.tagName=="subject"||a.tagName=="group"||a.tagName=="member")){b=a.$menuId;if(checkDefined(b)&&!checkDefined(this.idHash[b]))this.idHash[b]=a}};a.getHashNode=function(d,c){if(checkDefined(d)&&checkDefined(this.idHash[d])){var a=this.idHash[d];if(checkObject(c)&&checkDefined(c.$id)&&checkObject(a)){var b=a;while(b!=null){if(b.$id==c.$id)return a;b=b.parentNode}return null}return a}return null};function q(a){if(!checkString(a.$videosUrl)&&checkString(a.$topic)&&checkString(a.$cat)){var f=_this.getMenuContext();if(checkObject(f)){var h=f.getMarket();a.$videosUrl=getVideosUrlFromTopicCategory(h,a.$topic+"_"+a.$cat)}}var b=null;if(a.template!=null&&a.template["default"]!=null&&a.template["default"].videosRef!=null)b=a.template["default"].videosRef;else if(checkString(a.$videosUrl))b=a;else if(a.$type==Msn.MenuItemType.Custom||a.$type==Msn.MenuItemType.SoapboxCategory)b=a;if(checkObject(b)){if(checkString(b.$type)&&a.$type!=b.$type)a.$type=b.$type;if(checkString(b.$videosUrl)){if(b.$type!=Msn.MenuItemType.Custom&&!checkString(getUrlValue(b.$videosUrl,"sf"))){b.$videosUrl=setUrlValue(b.$videosUrl,"sf","VideoId");b.$videosUrl=setUrlValue(b.$videosUrl,"sd","1")}if(b.$type==Msn.MenuItemType.Custom){var g=Msn.Menu[b.$videosUrl];if(checkInt(g)){a.$menuId=parseInt(g);e=true}}else if(b.$type==Msn.MenuItemType.SoapboxCategory){var d=getUrlValue(b.$videosUrl,"tag");if(checkString(d)){var c=Msn.MenuManager.getCategoryDataFromGuid(d);if(checkObject(c)&&checkInt(c["categoryMenuId"])){a.$menuId=parseInt(c["categoryMenuId"]);e=true}}}}}}function p(c,d){if(d instanceof Array&&d.length>0){var b=d[0];if(checkString(b.$type))c.$type=b.$type;if(checkString(b.$videosUrl))c.$videosUrl=b.$videosUrl;else if(checkString(b.$topic)&&checkString(b.$cat))c.$videosUrl=getVideosUrlFromTopicCategory(a.$market,b.$topic+"_"+b.$cat);if(checkDefined(b.defaultVideos))c.defaultVideos=b.defaultVideos}}var m=a.menuTaxonomy.subjects.subject,l=false;for(var k=0;k<m.length;k++){e=false;var b=m[k];b.parentNode=a.menuTaxonomy;b.tagName="subject";a.addHashNode(b);if(!checkDefined(b.groups)||!checkArray(b.groups.group))continue;var o=b.groups.group;for(var i=0;i<o.length;i++){var d=o[i];d.parentNode=b;d.tagName="group";a.addHashNode(d);if(!checkDefined(d.members)||!checkArray(d.members.member))continue;var n=d.members.member;for(var j=0;j<n.length;j++){var c=n[j];if(!checkArray(c.content)||c.content.length<=0)continue;var f=c.content;p(c,f);c.parentNode=d;c.tagName="member";a.addHashNode(c);for(var h=0;h<f.length;h++){var g=f[h];g.parentNode=c;g.tagName="content";a.addHashNode(g)}}}if(e){l=true;if(isSoapboxEnabled())Msn.MenuManager.setDefaultSoapboxMenuItem(b);else b.isDisabled=true}}if(!l)Msn.Controls.config.soapboxDisabled=true}if(!checkDefined(Msn.MenuManager)){Msn.MenuManager=this;normalizeTaxonomyData(Msn.Controls.config.taxonomy)}};Msn.Controls.MenuManager.prototype=Msn.Controls;function setTaxonomy(a){if(checkObject(a))a.$market=Msn.Controls.config.VCMarket;Msn.Controls.config.taxonomy=a}Msn.Controls.MenuStrip=function(i){var l=this,d=null,b=null,g=null,f=null,a=null,c={},h=i;if(!checkDefined(Msn.MenuStrip))Msn.MenuStrip=this;this.subscribeEvent(Msn.Event.MenuClick);this.subscribeEvent(Msn.Event.MenuSelect);this.subscribeEvent(Msn.Event.MenuContextChanged);this.onEvent=function(e,c){if(c==Msn.Event.MenuClick||c==Msn.Event.MenuSelect||c==Msn.Event.MenuContextChanged){var d=Msn.MenuManager.getMenuContext(0);if(d!=a){b=a;a=d;k()}}};this._render=function(a){d=a};function k(){var c=Msn.MenuManager.getMenuContext(0);if(checkObject(c)){var d=c.getSelectedItem(),h=c.getMainMenuItem();if(b!=c)if(checkObject(b))e(b,false);if(g!=h||f!=d){g=h;f=d;if(checkObject(a))e(a,true)}}}this.prerenderSubItems=function(a){e(a,false,true)};function e(b,i,m){if(checkDefined(b)){var f=c[b.uniqueId];if(checkDefined(f))for(var a=0;a<f.length;a++)f[a].setDisplay(i);else if((i||m)&&!checkDefined(f))if(checkDefined(d)&&checkFunction(b.getSubMenuItems)&&checkFunction(b.getSelectedItem)){var n=b.getSelectedItem(),e=b.getSubMenuItems();if(checkArray(e)){for(a=0;a<e.length;a++){if(e[a].isDisabled)continue;var g=new Msn.Controls.PopupMenu(e[a],b,h,a,e.length),k=e[a].tagName=="subject"&&e[a].groups!=null&&checkArray(e[a].groups.group,1);g.node=addElement(d,"div",null,(a==0?"MenuStripItemFirst":"MenuStripItem")+(k?" Expandable":""));if(!i)g.setDisplay(false);g.render();j(g,b)}var l=new Msn.Controls.UploadButton;l.render(d)}}}}function j(b,a){if(!checkDefined(b)||!checkDefined(a))return;if(!checkDefined(a.uniqueId))a.uniqueId=(new Date).getTime().toString();if(!checkArray(c[a.uniqueId]))c[a.uniqueId]=[];c[a.uniqueId].push(b)}};Msn.Controls.MenuStrip.prototype=Msn.Controls;Msn.Controls.MinWidthConstraint=function(g,h,b){var f=this,a=document.getElementById(h),c=document.getElementById(g),d=isNaN(parseInt(b))?null:parseInt(b);if(e())if(Msn.Controls.getBrowser()==Msn.Browser.IE)this.subscribeEvent(Msn.Event.WindowResize);else a.style.minWidth=d+"px";function e(){var b=a!=null&&checkInt(d);if(Msn.Controls.getBrowser()==Msn.Browser.IE)b=b&&c!=null;return b}this.loadState=function(){if(this.getBrowser()==Msn.Browser.IE&&e())f.onEvent(f,Msn.Event.WindowResize)};this.onEvent=function(e,d){if(d==Msn.Event.WindowResize)if(c.offsetWidth>b)a.style.width="auto";else a.style.width=b+"px"}};Msn.Controls.MinWidthConstraint.prototype=Msn.Controls;Msn.Controls.MSNVideoFlashMetadata=function(){var d=this,c=null,a=null,b=new Msn.Controls.FlashObject("flashHole",null,300,190);this.cfg={IMAGE_LOGO:"http://img.video.msn.com/s/"};this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};this.setActive=function(){this.render()};this.setVideo=function(f){if(checkDefined(f)&&checkString(f.Video.Id)&&f.Video.CsId!=Msn.Controls.config.SoapboxCsId&&checkDefined(f.Video.FlashMetadata)&&checkString(f.Video.FlashMetadata)){c=f;a=f.Video;var h="";if(checkDefined(a.RelatedLinks))for(var g=0;g<a.RelatedLinks.length;g++){h+="&link"+(g+1)+"text="+encodeURIComponent(a.RelatedLinks[g].text);h+="&link"+(g+1)+"url="+a.RelatedLinks[g].url.replace(/&amp;/gi,"%26").replace(/&/gi,"%26")}var e="";e+="mediaDate="+a.StartDate;e+="&guid="+a.Id;e+="&headline="+encodeURIComponent(a.Title);e+="&caption="+encodeURIComponent(a.Description);e+="&affid=";e+="&imageLogo="+this.cfg.IMAGE_LOGO+a.Market+"/sc/l/"+a.Source+".swf";e+="&imageTease="+h;var i=c.Video.FlashMetadata;b.setBgColor("#ffffff");b.setFlashSrc(i);b.setFlashVars(e)}else c=null;setTimeout(function(){d.render()},0)};this._render=function(d){if(null!=d&&null!=c){var a=document.createElement("DIV");b.render(a);d.appendChild(a)}}};Msn.Controls.MSNVideoFlashMetadata.prototype=Msn.Controls;Msn.Controls.MSNVideoInfo=function(){var o=this,n=new Msn.Controls.MSNVideoFlashMetadata;this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};var f={TITLE_LENGTH:80,DESC_LENGTH:200,CONTENT_SOURCE_URL:"getcontentsource.aspx?csid={0}&name={1}",MORE:$["IDS_CLI_More"],LESS:$["IDS_CLI_Less"],RELATED_VIDEOS:$["IDS_CLI_RelatedLinks"],THIS_VIDEO:$["IDS_CLI_ThisVideo"]},m=null,a=null,b=null,h=new Msn.Controls.MSNVideoFlashMetadata,d=null,i=null,e=null,c=null,j=true,k=getWindowContext()==Msn.WindowContext.DaughterWindow?true:false,l=new Msn.Controls.SimilarVideos(!k),g=null;this.onRefreshDescriptionDisplay=function(g,d){if(null!=e&&checkDefined(a))if(a.Description.length>f.DESC_LENGTH&&checkDefined(c)){c.style.visibility="visible";c.style.display="inline";var b="";if(j){e.innerText=ll(a.Description,f.DESC_LENGTH);e.title=a.Description;c.innerText="("+f.MORE+")";j=false;b=f.LESS}else{e.innerText=a.Description;e.title=a.Description;c.innerText="("+f.LESS+")";j=true;b=f.MORE}if(d)ReportTracking(a,b,Msn.Event.MetaLink,"meta")}else{e.innerText=ll(a.Description,f.DESC_LENGTH);e.title=a.Description;if(checkDefined(c)){c.style.visibility="hidden";c.style.display="none"}}return false};this.setVideo=function(c){if(checkDefined(c)&&checkString(c.Video.Id)&&c.Video.CsId!=Msn.Controls.config.SoapboxCsId){m=c;a=c.Video;if(checkDefined(a.FlashMetadata)&&checkString(a.FlashMetadata)){if(checkDefined(d))d.style.display="none";if(checkDefined(h))h.style.display="inline"}else{if(checkDefined(d))d.style.display="inline";if(checkDefined(h))h.style.display="none";if(checkDefined(b)&&checkDefined(a.CsId)&&checkString(a.Source)){b.style.display="none";var p=f.CONTENT_SOURCE_URL.format(a.CsId,a.Source);Msn.VCRequestManager.makeRequest(p,o.setSourceLogoCB)}if(checkDefined(i)){i.innerText=ll(a.Title,f.TITLE_LENGTH);i.title=a.Title}j=true;this.onRefreshDescriptionDisplay();if(checkDefined(g)){g.innerHTML="";if(checkDefined(a.RelatedLinks)&&a.RelatedLinks.length>0){var n=document.createElement("SPAN");n.appendChild(document.createTextNode(f.RELATED_VIDEOS));n.className="headerBold";g.appendChild(n);g.appendChild(document.createElement("br"));for(var k=0;k<a.RelatedLinks.length;k++){var e=document.createElement("a");e.target="_msnVideoLinks";e.href=a.RelatedLinks[k].url;e.title=HTMLEncodeString(a.RelatedLinks[k].text);e.innerHTML=HTMLEncodeString(a.RelatedLinks[k].text);this.addListener(e,"onclick",this.onLinkClick,a.RelatedLinks[k].text);g.appendChild(e);g.appendChild(document.createElement("br"))}}}}l.setWebVideo(c)}};this.setSourceLogoCB=function(a){if(checkDefined(b)&&checkDefined(a)&&checkDefined(a.contentSource)&&checkString(a.contentSource.$logoUrl)){b.src=a.contentSource.$logoUrl;b.alt=b.title=a.contentSource.$friendlyName;b.style.display="inline"}};this.onLinkClick=function(c,b){ReportTracking(a,"related links",Msn.Event.MetaLink,"meta",b);return true};this.onImageError=function(b,a){a.style.display="none"};this.onSourceLogoClick=function(){if(checkDefined(a)&&checkDefined(a.VCSourceTag)){var b=a.VCSourceTag;if(checkDefined(a.SourceFriendlyName)&&checkString(a.SourceFriendlyName))b=a.SourceFriendlyName;var c=Msn.Controls.SearchQueryFactory.create(a.VCSourceTag,SoapboxService.SearchType.Source,0,SoapboxService.SortOrder.Default,b);Msn.Controls.fireEvent(Msn.Event.Search,c)}};this._render=function(j){var o,p,f,a,q;if(null!=j){f=document.createElement("DIV");f.className="metadataPadding";h=document.createElement("DIV");n.render(h);f.appendChild(h);d=document.createElement("DIV");b=document.createElement("IMG");this.addListener(b,"onerror",this.onImageError,b);if(!k){b.className="sourceLogo";this.addListener(b,"onclick",this.onSourceLogoClick)}b.style.display="none";d.appendChild(b);d.appendChild(document.createElement("BR"));a=document.createElement("DIV");a.className="msnVideoInfo";i=document.createElement("DIV");i.className="headerBold";a.appendChild(i);e=document.createElement("SPAN");a.appendChild(e);e.className="videoDetailsDescription";a.appendChild(document.createTextNode(" "));c=document.createElement("A");c.href=this.getLinkHref();c.className="tLink";a.appendChild(c);this.addListener(c,"onclick",this.onRefreshDescriptionDisplay,true);d.appendChild(a);g=document.createElement("DIV");g.className="msnVideoLinks";d.appendChild(g);f.appendChild(d);a=document.createElement("DIV");a.className="similarVideos";l.render(a);f.appendChild(a);j.appendChild(f);this.setVideo(m)}}};Msn.Controls.MSNVideoInfo.prototype=Msn.Controls;Msn.Controls.MSNVideoLinks=function(){var e=this;this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};var h={CONTENT_SOURCE_URL:"getcontentsource.aspx?csid={0}&name={1}"},f=null,a=null,b=null,c=null,g=true,d=null;this.setLogoDisplay=function(a){if(null!=a)g=a;if(d)d.style.display=g?"inline":"none"};this.setVideo=function(i){if(checkDefined(i)&&checkString(i.Video.Id)&&i.Video.CsId!=Msn.Controls.config.SoapboxCsId){f=i;a=i.Video;if(checkDefined(b)&&checkDefined(a.CsId)&&checkString(a.Source)){e.setLogoDisplay(false);var j=h.CONTENT_SOURCE_URL.format(a.CsId,a.Source);Msn.VCRequestManager.makeRequest(j,e.setSourceLogoCB)}if(checkDefined(c)&&checkDefined(a.RelatedLinks)){c.innerHTML="";for(var g=0;g<a.RelatedLinks.length;g++){var d=document.createElement("a");d.target="_msnVideoLinks";d.href=a.RelatedLinks[g].url;d.title=HTMLEncodeString(a.RelatedLinks[g].text);d.innerHTML=HTMLEncodeString(a.RelatedLinks[g].text);this.addListener(d,"onclick",this.onLinkClick,a.RelatedLinks[g].text);c.appendChild(d);c.appendChild(document.createElement("br"))}}}};this.setSourceLogoCB=function(a){if(checkDefined(b)&&checkDefined(a)&&checkDefined(a.contentSource)&&checkString(a.contentSource.$logoUrl)){b.src=a.contentSource.$logoUrl;b.alt=b.title=a.contentSource.$friendlyName;e.setLogoDisplay()}};this.onLinkClick=function(c,b){ReportTracking(a,"related links",Msn.Event.MetaLink,"meta",b);return true};this.onImageError=function(b,a){a.style.display="none"};this._render=function(g){var a;if(null!=g){a=document.createElement("DIV");a.className="metadataPadding";d=document.createElement("DIV");b=document.createElement("IMG");this.addListener(b,"onerror",this.onImageError,b);b.style.display="none";d.appendChild(b);d.appendChild(document.createElement("BR"));a.appendChild(d);e.setLogoDisplay();c=document.createElement("DIV");c.className="msnVideoLinks";a.appendChild(c);g.appendChild(a);if(null!=f)this.setVideo(f)}}};Msn.Controls.MSNVideoLinks.prototype=Msn.Controls;Msn.MSNVideoPanel=SoapboxService.Utils.CreateEnum("NULL",-1,"VideoInfo",0,"Flash",1,"Loading",2,"Error",3);Msn.MSNVideoPanelHeader=SoapboxService.Utils.CreateEnum("ThisVideo",0);Msn.Controls.MSNVideoMetadata=function(p,o){var e=this,f=true,h=true;this.cfg={THIS_VIDEO:$["IDS_CLI_ThisVideo"],LOADING:$["IDS_CLI_Loading"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"]};this.subscribeEvent(Msn.Event.VideoPanelViewChange);this.subscribeEvent(Msn.Event.MediaChanged);this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.MetadataError);this.onEvent=function(e,d,b){if(h)switch(d){case Msn.Event.MetadataError:this.setLoadingMode(true,true);break;case Msn.Event.ControlsAckFullScreen:this.setVisibility(!b);this.setDisplay(!b);break;case Msn.Event.MediaChanged:if(b.Id!=g){g=b.Id;c=false;this.setLoadingMode(true)}break;case Msn.Event.MediaMetadata:l=b;this.setLoadingMode(false);if(!c){this.onVideoInfoSelect();this.onVideoInfoPanelSelect()}a.setVisibility(true);break;case Msn.Event.VideoPanelViewChange:switch(b){case Msn.MSNVideoPanel.VideoInfo:this.onVideoInfoSelect();break;case Msn.MSNVideoPanel.Loading:this.setLoadingMode(true);break;default:break}c=true;break}};this.setActive=function(a){h=a};this.setLoadingMode=function(c,d){f=c;a.setLoadingMode(c);if(c){var e=checkDefined(d)&&d;b.select(e?Msn.MSNVideoPanel.Error:Msn.MSNVideoPanel.Loading)}};this.showTabs=function(b){a.setHeaderDisplay(b)};this.onVideoInfoSelect=function(){if(f)return;b.select(Msn.MSNVideoPanel.VideoInfo)};this.onVideoInfoPanelSelect=function(){a.selectPanel(Msn.MSNVideoPanelHeader.ThisVideo)};var c=false,a=new Msn.Controls.Panel,d=new Msn.Controls.PanelHead;d.title=e.cfg.THIS_VIDEO;d.onPanelSelect=this.onVideoInfoSelect;a.addPanel(d);var g=0,l=null,n=p,m=o,b=new Msn.Controls.FilterTab(n,m,"metadataTabs"),i=new Msn.Controls.MSNVideoInfo,j=new Msn.Controls.Label(e.cfg.LOADING,"metadataPadding"),k=new Msn.Controls.Label(e.cfg.DATA_NOT_AVAILABLE,"metadataPadding");b.add(Msn.MSNVideoPanel.Loading,j);b.add(Msn.MSNVideoPanel.VideoInfo,i);b.add(Msn.MSNVideoPanel.Error,k);a.bodyCtrl=b;this._render=function(b){if(null!=b)a.render(b)}};Msn.Controls.MSNVideoMetadata.prototype=Msn.Controls;Msn.Controls.Nickname=function(f){var c=this;this.cfg={CHOOSE_LABEL:$["IDS_CLI_ChooseLabel"],TAKEN_LABEL:$["IDS_CLI_TakenLabel"],SUBMIT_LABEL:$["IDS_CLI_SubmitLabel"],STATUS_MSG_SUCCESS:$["IDS_CLI_StatusMsgSuccess"],STATUS_MSG_TAKEN:$["IDS_CLI_StatusMsgTaken"],STATUS_MSG_SUGGEST:$["IDS_CLI_StatusMsgSuggest"],STATUS_MSG_OFFENSIVE:$["IDS_CLI_StatusMsgOffensive"],STATUS_MSG_ERROR:$["IDS_CLI_StatusMsgError"],STATUS_MSG_DOWN:$["IDS_CLI_StatusMsgDown"],ERROR_NICKNAME_EMPTY:$["IDS_CLI_ErrorNicknameEmpty"],ERROR_NICKNAME_TOO_SMALL:$["IDS_CLI_ErrorNicknameTooSmall"],ERROR_NICKNAME_TOO_LONG:$["IDS_CLI_ErrorNicknameTooLong"],ERROR_NICKNAME_INVALID_CHARS:$["IDS_CLI_ErrorNicknameInvalidChars"],ERROR_NICKNAME_SPACE:$["IDS_CLI_ErrorNicknameSpace"],NICKNAME_MIN_LENGTH:3,NICKNAME_MAX_LENGTH:24};var b=null,d=null,e=false,a=null,g=null;this.onEvent=function(c,b){if(Msn.Event.FocusReceived==b)if(checkDefined(a))try{a.focus()}catch(e){}};this.onSendButtonKeyDown=function(b,a){if(b.keyCode==13&&checkDefined(a))setTimeout(function(){c.onSendButtonClicked(b,a)},100)};this.onSendButtonClicked=function(f,b){if(checkDefined(b)&&checkDefined(b.value)&&false==e){var a=b.value.trim();if(!checkString(a)){customAlert(c.cfg.ERROR_NICKNAME_EMPTY);return false}if(a.length<this.cfg.NICKNAME_MIN_LENGTH){customAlert(c.cfg.ERROR_NICKNAME_TOO_SMALL.format(this.cfg.NICKNAME_MIN_LENGTH));return false}if(a.length>this.cfg.NICKNAME_MAX_LENGTH){customAlert(c.cfg.ERROR_NICKNAME_TOO_LONG.format(this.cfg.NICKNAME_MAX_LENGTH));return false}var d="* ? > < @ $ ! & \" ' : ; = + ( ) % # . , \\ / [ ]";if(!validChar(a,d)){customAlert(c.cfg.ERROR_NICKNAME_INVALID_CHARS.format(d));return false}if(a.indexOf(" ")!=-1){customAlert(c.cfg.ERROR_NICKNAME_SPACE);return false}Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"upload",section:"sendnickname"});Msn.SoapboxServiceManager.SetNickname(a,this.nicknameCb,this.nicknameErrorCb);g=a;e=true}return false};this.nicknameCb=function(a){if(checkDefined(a)&&checkInt(a.StatusCode)){b=a.StatusCode;d=a.Suggestions;c.render()}e=false};this.nicknameErrorCb=function(){customAlert(c.cfg.STATUS_MSG_ERROR);e=false};this._render=function(i){var e,c;if(null!=i){c=document.createElement("DIV");c.className="divPadding";if(SoapboxService.NicknameCode.Success==b){Msn.Passport.setNickname(g);c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_SUCCESS));this.fireEvent(Msn.Event.NicknameSet)}else if(SoapboxService.NicknameCode.AlreadyTaken!=b&&SoapboxService.NicknameCode.Offensive!=b&&SoapboxService.NicknameCode.ServiceDown!=b&&null!=b)c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_ERROR));else{e=document.createElement("SPAN");if(!checkDefined(f))f="<B>"+this.cfg.CHOOSE_LABEL+"</B>";e.innerHTML=f;c.appendChild(e);a=document.createElement("INPUT");this.setGlobalizedUI(a);a.type="text";a.className="b1g";a.maxLength=this.cfg.NICKNAME_MAX_LENGTH;c.appendChild(a);this.addListener(a,"onkeydown",this.onSendButtonKeyDown,a);this.fireEvent(Msn.Event.FocusRequest,this);c.appendChild(document.createTextNode(" "));e=document.createElement("A");e.href=this.getLinkHref();e.className="bt";e.appendChild(document.createTextNode(this.cfg.SUBMIT_LABEL));c.appendChild(e);this.addListener(e,"onclick",this.onSendButtonClicked,a);this.addListener(e,"onkeydown",this.onSendButtonKeyDown,a);if(SoapboxService.NicknameCode.AlreadyTaken==b){c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_TAKEN));c.appendChild(document.createElement("BR"));if(checkObject(d)&&checkInt(d.length)&&d.length>0){c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_SUGGEST));for(var h=0;h<d.length;h++){c.appendChild(document.createTextNode(" "+d[h]));if(h<d.length-1)c.appendChild(document.createTextNode(","));else c.appendChild(document.createTextNode("."))}}}else if(SoapboxService.NicknameCode.Offensive==b){c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_OFFENSIVE))}else if(SoapboxService.NicknameCode.ServiceDown==b){c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.STATUS_MSG_DOWN))}}i.appendChild(c)}}};Msn.Controls.Nickname.prototype=Msn.Controls;Msn.Controls.Offensive=function(){var a=this;this.subscribeEvent(Msn.Event.NicknameSet);this.onEvent=function(d,a){if(Msn.Event.NicknameSet==a){c.dispose();c=null;this.render()}else if(Msn.Event.FocusReceived==a)if(checkDefined(c))c.onEvent(this,a);else if(checkDefined(b))try{b.focus()}catch(f){}};this.cfg={COMMENT_MAX_LENGTH:1000,COMMENT_MAX_LENGTH_ERROR:$["IDS_CLI_CommentMaxLengthError"],COPYRIGHT_VIOLATION_URL:$["IDS_GMT_CopyrightViolationUrl"],CLOSE_TITLE:$["IDS_CLI_CloseTitle"],SEND:$["IDS_CLI_Send"],CANCEL:$["IDS_CLI_Cancel"],ENTER_COMMENT:$["IDS_CLI_EnterComment"],FAILED_FLAG:$["IDS_CLI_FailedFlag"],SET_NICKNAME:$["IDS_CLI_SetNickname"],NICKNAME_MAX_LENGTH:24,COPYRIGHT_VIOLATION:$["IDS_CLI_CopyrightViolation"],VIDEO_OFFENSIVE_CONFIRMATION:$["IDS_CLI_VideoOffensiveConfirmation"],REASON_TO_FLAG_VIDEO:$["IDS_CLI_ReasonToFlagVideo"],SIGN_IN_REQD_TO_REPORT_OFFENSIVE:$["IDS_CLI_SignInReqdToReportOffensive"],VIDEO_ALREADY_FLAGGED:$["IDS_CLI_VideoAlreadyFlagged"],DISPLAY_FLAG_TYPES:[$["IDS_CLI_DisplayFlagTypes0"],$["IDS_CLI_DisplayFlagTypes1"],$["IDS_CLI_DisplayFlagTypes2"],$["IDS_CLI_DisplayFlagTypes3"],$["IDS_CLI_DisplayFlagTypes4"]],DISPLAY_FLAG_VALUES:["1","2","3","7","0"]};var f=0,g=0,d=0,e=-1,b=null,c=null;this.setVideoId=function(c){if(checkString(c)&&c!=f){f=c;g=0;e=-1;b.value="";a.render()}};this.onVideoOffensive=function(){if(Msn.Passport.isUserLoggedIn()){if(b.value.trim().length>a.cfg.COMMENT_MAX_LENGTH)customAlert(a.cfg.COMMENT_MAX_LENGTH_ERROR.format(a.cfg.COMMENT_MAX_LENGTH));else if(f!=0&&d==0)if(e!=-1){Msn.Controls.fireEvent(Msn.Event.MetaLink,{page:"meta",section:"report:post"});var c=new Msn.Controls.Dialog;c.description=a.cfg.VIDEO_OFFENSIVE_CONFIRMATION;c.type=Msn.Dialog.Confirm;c.onComplete=function(b){a.videoOffensiveConfirmed(b,f)};a.fireEvent(Msn.Event.DialogRequest,c)}else customAlert(a.cfg.REASON_TO_FLAG_VIDEO)}else Msn.Passport.loginDialog(a.cfg.SIGN_IN_REQD_TO_REPORT_OFFENSIVE);return false};this.videoOffensiveConfirmed=function(c,f){if(c){d=1;Msn.SoapboxServiceManager.FlagOffensive(f,e,b.value.trim(),a.flagOffensiveCb,a.flagOffensiveErrorCb);a.closePane();a.fireEvent(Msn.Event.PageView,"report:video:submit")}};this.onCopyrightViolation=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"report:copyright"});openStandardWindow(this.cfg.COPYRIGHT_VIOLATION_URL,"_blank")};this.onRadioSelect=function(b,a){if(checkDefined(a))e=a};this.onCancel=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"report:cancel"});a.closePane();return false};this.onClose=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"report:close"});a.closePane();return false};this.closePane=function(){this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL)};this.flagOffensiveCb=function(b){d=0;if(checkInt(b))if(SoapboxService.ResultCode.Success==b)g=1;else if(SoapboxService.ResultCode.NotSignedIn==b)Msn.Passport.loginDialog(a.cfg.SIGN_IN_REQD_TO_REPORT_OFFENSIVE);a.render()};this.flagOffensiveErrorCb=function(){customAlert(a.cfg.FAILED_FLAG);d=0};this._render=function(j){if(null==j)return;var d,f,k,e,h;d=document.createElement("DIV");d.className="closeLinkLocation";h=document.createElement("A");h.appendChild(document.createTextNode(this.cfg.CLOSE_TITLE));h.href=this.getLinkHref();d.appendChild(h);j.appendChild(d);this.addListener(h,"onclick",this.onClose);if(g==0)if(!Msn.Passport.getHasNickname()){if(!checkDefined(c))c=new Msn.Controls.Nickname(this.cfg.SET_NICKNAME+"<BR />",this.onNicknameComplete);c.render(j)}else{d=document.createElement("DIV");d.className="divPadding";for(var i=0;i<a.cfg.DISPLAY_FLAG_TYPES.length;i++){f=document.createElement("SPAN");k=new Msn.Controls.LiteralHTML("<input type='radio' name='flagOffensive' class='flagRadio' value='"+this.cfg.DISPLAY_FLAG_VALUES[i]+"' /> "+this.cfg.DISPLAY_FLAG_TYPES[i]);k.render(f);this.addListener(f,"onclick",this.onRadioSelect,this.cfg.DISPLAY_FLAG_VALUES[i]);d.appendChild(f);d.appendChild(document.createElement("BR"))}d.appendChild(document.createElement("BR"));f=document.createElement("SPAN");f.appendChild(document.createTextNode(this.cfg.ENTER_COMMENT));d.appendChild(f);d.appendChild(document.createElement("BR"));b=document.createElement("TEXTAREA");this.setGlobalizedUI(b);b.maxLength=this.cfg.COMMENT_MAX_LENGTH;b.className="commentReporting";d.appendChild(b);d.appendChild(document.createElement("BR"));e=document.createElement("A");e.href=this.getLinkHref();e.title=this.cfg.SEND;e.className="tLink";e.appendChild(document.createTextNode(this.cfg.SEND));this.addListener(e,"onclick",this.onVideoOffensive);d.appendChild(e);d.appendChild(document.createTextNode(" / "));e=document.createElement("A");e.href=this.getLinkHref();e.title=this.cfg.CANCEL;e.className="tLink";e.appendChild(document.createTextNode(this.cfg.CANCEL));this.addListener(e,"onclick",this.onCancel);d.appendChild(e);d.appendChild(document.createElement("BR"));d.appendChild(document.createElement("BR"));e=document.createElement("A");e.title=this.cfg.COPYRIGHT_VIOLATION;e.href=this.getLinkHref();e.className="tLink";e.appendChild(document.createTextNode(this.cfg.COPYRIGHT_VIOLATION));this.addListener(e,"onclick",this.onCopyrightViolation);d.appendChild(e);j.appendChild(d)}else{d=document.createElement("DIV");d.className="divPadding";d.appendChild(document.createTextNode(a.cfg.VIDEO_ALREADY_FLAGGED));j.appendChild(d)}}};Msn.Controls.Offensive.prototype=Msn.Controls;Msn.Controls.OptimizationPlatform=function(){var a=this;this.opLookup=new Object;this.bucketKey="";this.clickKeys=null;this.clickedKeys=new Object;this.viewKeys=null;this.viewedKeys=new Object;this.lazyReportTimer=null;this.setBucketKey=function(b){a.bucketKey=b};this.add=function(c,b){a.opLookup[c]=b};this.clear=function(){a.bucketKey="";a.opLookup=new Object;a.clickedKeys=new Object;a.viewedKeys=new Object;b()};this.reportView=function(d){if(a.opLookup[d]){var c=a.opLookup[d];if(!a.viewedKeys[c]){a.viewedKeys[c]=true;if(null==a.viewKeys)a.viewKeys=c;else a.viewKeys+=","+c;if(null==a.lazyReportTimer)a.lazyReportTimer=setTimeout(b,10000)}}};this.reportClick=function(d){if(a.opLookup[d]){var c=a.opLookup[d];if(!a.clickedKeys[c]){a.clickedKeys[c]=true;if(null==a.clickKeys)a.clickKeys=c;else a.clickKeys+=","+c;if(null==a.lazyReportTimer)a.lazyReportTimer=setTimeout(b,10000)}}};function b(){a.lazyReportTimer=null;if(null!=a.viewKeys||null!=a.clickKeys){Msn.SoapboxServiceManager.ReportActivity(a.bucketKey,a.viewKeys,a.clickKeys,null,null);a.viewKeys=null;a.clickKeys=null}}};Msn.Controls.OptimizationPlatform.prototype=Msn.Controls;var OPPlat=new Msn.Controls.OptimizationPlatform;Msn.Controls.Pagination=function(n,m,l){var o=this;this.cfg={FIRST:"&laquo;",PREVIOUS:"&lsaquo;",NEXT:"&rsaquo;",LAST:"&raquo;",FONT_SIZE_INCREASE:2,FONT_SIZE:$["IDS_GMT_FontSize"],LABEL_OF:$["IDS_CLI_LabelOf"],LABEL_PAGE:$["IDS_CLI_LabelPage"],FIRST_TOOLTIP:$["IDS_CLI_FirstTooltip"],PREVIOUS_TOOLTIP:$["IDS_CLI_PreviousTooltip"],NEXT_TOOLTIP:$["IDS_CLI_NextTooltip"],LAST_TOOLTIP:$["IDS_CLI_LastTooltip"],PAGE:$["IDS_CLI_Page"]};var e=n,b=m,g=0,c=0,h=true,j=false,k=new Msn.Controls.SortResults,d=null,a=null,f=null,i=l;this.setPosition=function(e,a,d){if(checkInt(e,0)&&checkInt(a,0)&&checkInt(d,0)&&(b!=a||e!=g||d!=c)){g=e;b=a;c=d;if(g>c)g=0;this.render()}};this.setSort=function(a){k.setSearchQuery(a)};this.showPagination=function(a){h=a;this.bindVisibility()};this.showSort=function(a){j=a&&isTrue($["IDS_GMT_EnableSortDropDown"]);this.bindVisibility()};this.showVideoCount=function(a){i=a;this.bindVisibility()};this.bindVisibility=function(){if(checkDefined(d)){d.style.visibility=h&&i?"visible":"hidden";d.style.display=h&&i?"inline":"none"}if(checkDefined(f)){f.style.visibility=j?"visible":"hidden";f.style.display=j?"inline":"none"}if(checkDefined(a))a.style.visibility=h?"visible":"hidden"};this.formEntry=function(c,e,f,d,b){var a=document.createElement("SPAN");if(checkInt(c))a.className=b?"paginationEntrySelected":"paginationEntry";else{a.className="paginationEntryLimit";if(checkInt(this.cfg.FONT_SIZE))a.style.fontSize=parseInt(this.cfg.FONT_SIZE)+this.cfg.FONT_SIZE_INCREASE+"pt"}a.title=d;a.innerHTML=c;if(!b)this.addListener(a,"onclick",e,f);return a};this._render=function(o){if(null!=o&&checkFunction(e)&&checkInt(b,0)&&checkInt(c,0)&&b>0){var l=Math.ceil(c/b),h=Math.ceil(g/b),n=0,p=l-h<4?h-l+5:2,q=g+1,r=Math.min(g+b,c),m,s,j;m=document.createElement("DIV");m.className="paginationContainer";o.appendChild(m);d=document.createElement("DIV");d.className="miniPaginationContainer";this.setCSSFloat(d,"left");m.appendChild(d);a=document.createElement("DIV");a.className="paginationEntriesContainer";m.appendChild(a);f=document.createElement("DIV");f.className="paginationLeft";this.setCSSFloat(f,"left");k.render(f);m.appendChild(f);if(l>1){d.appendChild(document.createTextNode(this.cfg.LABEL_OF.format(q,r,c)));a.appendChild(document.createTextNode(this.cfg.LABEL_PAGE));a.appendChild(document.createTextNode(" "));if(h>0){a.appendChild(this.formEntry(this.cfg.FIRST,e,0,this.cfg.FIRST_TOOLTIP));a.appendChild(this.formEntry(this.cfg.PREVIOUS,e,h-1,this.cfg.PREVIOUS_TOOLTIP))}if(h>p){j=document.createElement("SPAN");j.className="paginationEntryStatic";j.innerText="... ";a.appendChild(j)}for(var i=Math.max(h-p,0);i<h;i++){n++;a.appendChild(this.formEntry(i+1,e,i,this.cfg.LABEL_OF.format(i*b+1,Math.min((i+1)*b,c),c),false))}a.appendChild(this.formEntry(h+1,e,h,this.cfg.LABEL_OF.format(h*b+1,Math.min((h+1)*b,c),c),true));for(i=h+1;n<4&&i<l;i++){n++;a.appendChild(this.formEntry(i+1,e,i,this.cfg.LABEL_OF.format(i*b+1,Math.min((i+1)*b,c),c),false))}if(i<l){j=document.createElement("SPAN");j.className="paginationEntryStatic";j.innerText="... ";a.appendChild(j)}if(h<l-1){a.appendChild(this.formEntry(this.cfg.NEXT,e,h+1,this.cfg.NEXT_TOOLTIP));a.appendChild(this.formEntry(this.cfg.LAST,e,l-1,this.cfg.LAST_TOOLTIP))}}o.appendChild(document.createElement("BR"));this.bindVisibility()}}};Msn.Controls.Pagination.prototype=Msn.Controls;Msn.Controls.Panel=function(){var a=this,b=true;this.cfg={PANEL_TITLE_S_CLASS:"selPanelTitle",PANEL_TITLE_NS_CLASS:"nonSelPanelTitle"};this.headers=[];this.headContainer=null;this.showHeader=true;this.selected=0;this.bodyCtrl;this.addPanel=function(b){b.active=true;a.headers.push(b)};this.setHeaderDisplay=function(b){if(null!=b)a.showHeader=b;if(a.headContainer)a.headContainer.style.display=a.showHeader?"block":"none"};this.onPanelSelect=function(b){if(b>=a.headers.length)return false;if(checkDefined(a.headers[b].onPanelSelect)){a.fireEvent(Msn.Event.PanelTabChange,{id:b,name:a.headers[b].title});return a.headers[b].onPanelSelect()}return true};this.onPanelClick=function(d,b){a.selectPanel(b)};this.selectPanel=function(b){if(checkInt(b,0)){if(false==a.onPanelSelect(b))return;if(a.selected!=b){a.headers[a.selected].panelTitleElement.className=this.cfg.PANEL_TITLE_NS_CLASS;a.fireEvent(Msn.Event.MetadataPanelHeaderClick)}a.selected=b;a.headers[a.selected].panelTitleElement.className=this.cfg.PANEL_TITLE_S_CLASS}};this.setActive=function(c,b){if(checkInt(b,0))a.headers[b].active=c};this.setPanelHeader=function(c,b){if(checkInt(b,0))a.headers[b].panelTitleElement.innerText=c};this.setLoadingMode=function(a){b=a};this._render=function(j){if(checkDefined(a.headers)){var f=-1;for(var b=0;b<a.headers.length;b++)if(checkDefined(a.headers[b])&&a.headers[b].active&&f==-1){f=b;break}if(f==-1)a.selected=-1;else if(a.headers.length<a.selected||!checkDefined(a.headers[a.selected]))a.selected=f;if(a.selected>-1){var h,d,k,i,g,e;h=document.createElement("DIV");e=document.createElement("DIV");this.headContainer=e;e.className="panelHeadContainer";for(b=0;b<a.headers.length;b++){var c=a.headers[b];if(c.active){c.panelHeaderClass=b==a.selected?this.cfg.PANEL_TITLE_S_CLASS:this.cfg.PANEL_TITLE_NS_CLASS;d=document.createElement("DIV");d.className=c.panelHeaderClass;d.appendChild(document.createTextNode(c.title));c.panelTitleElement=d;this.addListener(d,"onclick",this.onPanelClick,b,c.title);this.addListener(d,"onkeydown",this.onPanelClick,b,c.title);e.appendChild(d)}else c.panelTitleElement={}}a.setHeaderDisplay();h.appendChild(e);g=document.createElement("DIV");g.className="panelContentContainer";i=document.createElement("DIV");if(checkDefined(this.bodyCtrl))this.bodyCtrl.render(i);g.appendChild(i);h.appendChild(g);j.appendChild(h)}}}};Msn.Controls.Panel.prototype=Msn.Controls;Msn.Controls.PanelHead=function(){var a=this;this.cfg={};this.title="";this.toolTip="";this.body=""};Msn.Controls.PanelHead.prototype=Msn.Controls;Msn.Passport=new function(){var a=this;this.isUserLoggedIn=function(){return Msn.Controls.config.ppIsUserLoggedIn};this.getHasNickname=function(){return Msn.Controls.config.ppNicknameUnavailable||checkString(Msn.Controls.config.ppNickname)};this.getCid=function(){return Msn.Controls.config.ppUserCid};this.getNickname=function(){return Msn.Controls.config.ppNickname};this.setNickname=function(a){Msn.Controls.config.ppNickname=a};this.login=function(){Msn.Controls.save();setTimeout(a.loginInternal,100);return false};this.logout=function(){Msn.Controls.save();setTimeout(a.logoutInternal,100)};this.loginInternal=function(){try{window.location.href=Msn.Controls.config.ppLoginUrl}catch(a){}};this.logoutInternal=function(){try{window.location.href=Msn.Controls.config.ppLogoutUrl}catch(a){}};this.loginDialog=function(b){var a=new Msn.Controls.Dialog;a.description=checkString(b)?b:$["IDS_CLI_SignInDefaultMsg"];a.type=Msn.Dialog.Confirm;a.onComplete=this.loginConfirmed;a.OKLabel=$["IDS_CLI_SignIn"];Msn.Controls.fireEvent(Msn.Event.DialogRequest,a)};this.loginConfirmed=function(b){if(b)a.login()}};Msn.Controls.PermaLinkEmbed=function(){var i=this;this.cfg={PERMALINK_EMBED:"permalinkEmbed",PERMALINK_EMBED_INPUT:"permalinkEmbedInput",INPUTBOX_TOOLTIP:$["IDS_CLI_InputboxTooltip"]};this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};var d=null,a=null,g,c,h,e,b,f;this.setVideo=function(b){if(checkDefined(b)&&checkDefined(b.Video)&&checkString(b.Video.Id)&&b.Video.Id!=d){a=b;d=b.Video.Id;this.dataBind()}};this.dataBind=function(){if(checkDefined(a)){this.setPermaLink();this.setPermaLinkImage();this.setEmbed()}};this.setPermaLink=function(){if(checkString(d))if(checkDefined(g)&&checkDefined(e)){g.value=getPermaLinkUrl(a.Video);g.style.visibility="visible";e.style.visibility="visible"}};this.setPermaLinkImage=function(){if(checkString(d)&&checkDefined(a))if(checkDefined(c)&&checkDefined(b))if(checkString(a.Video.Thumbnail)){var e=a.Video.Title;c.value='<a href="'+getPermaLinkUrl(a.Video)+'" target="_new" title="'+e+'"><img src="'+a.Video.Thumbnail+'" border=0 alt="'+e+'" width=112 height=84><br />'+e+"</a>";c.style.visibility="visible";b.style.visibility="visible"}else{c.style.visibility="hidden";b.style.visibility="hidden"}};this.setEmbed=function(){if(checkString(d))if(checkDefined(h)&&checkDefined(f)){h.value=getPlayerEmbedCode(a.Video);h.style.visibility="visible";f.style.visibility="visible"}};this.onSelect=function(b,a){if(checkDefined(a))a.select()};this._render=function(i){var d,a;if(null!=i){d=document.createElement("DIV");d.className=this.cfg.PERMALINK_EMBED;if(isTrue($["IDS_GMT_EnablePermalink"])){a=document.createElement("div");a.className="permalinkEmbedTitle";a.align="right";a.appendChild(document.createTextNode("link: "));e=document.createElement("SPAN");a.appendChild(e);e2=document.createElement("INPUT");this.setGlobalizedUI(e2);e2.className=this.cfg.PERMALINK_EMBED_INPUT;e2.title=this.cfg.INPUTBOX_TOOLTIP;this.addListener(e2,"onclick",this.onSelect,e2);this.addListener(e2,"onfocus",this.onSelect,e2);g=e2;a.appendChild(e2);d.appendChild(a)}if(isTrue($["IDS_GMT_EnablePermalinkWithImage"])){a=document.createElement("div");a.className="permalinkEmbedTitle";a.align="right";a.appendChild(document.createTextNode("link with image: "));b=document.createElement("SPAN");a.appendChild(b);e2=document.createElement("INPUT");this.setGlobalizedUI(e2);e2.className=this.cfg.PERMALINK_EMBED_INPUT;e2.title=this.cfg.INPUTBOX_TOOLTIP;this.addListener(e2,"onclick",this.onSelect,e2);this.addListener(e2,"onfocus",this.onSelect,e2);c=e2;a.appendChild(e2);d.appendChild(a)}if(isTrue($["IDS_GMT_EnableEmbeddedPlayer"])){a=document.createElement("div");a.className="permalinkEmbedTitle";a.align="right";a.appendChild(document.createTextNode("embed player: "));f=document.createElement("SPAN");a.appendChild(f);e2=document.createElement("INPUT");this.setGlobalizedUI(e2);e2.className=this.cfg.PERMALINK_EMBED_INPUT;e2.title=this.cfg.INPUTBOX_TOOLTIP;this.addListener(e2,"onclick",this.onSelect,e2);this.addListener(e2,"onfocus",this.onSelect,e2);h=e2;a.appendChild(e2);d.appendChild(a)}i.appendChild(d);this.dataBind()}}};Msn.Controls.PermaLinkEmbed.prototype=Msn.Controls;Msn.Controls.PermalinkManager=function(){var a=this;this.cfg={SOAPBOX_UNAVAILABLE:$["IDS_CLI_SoapboxUnavailable"],ANONYMOUS:$["IDS_CLI_Anonymous"]};this.subscribeEvent(Msn.Event.MediaMetadataComplete);this.subscribeEvent(Msn.Event.DefaultVideosLoaded);this.onEvent=function(c,b){switch(b){case Msn.Event.MediaMetadataComplete:if(checkFunction(g)){g();g=null}break;case Msn.Event.DefaultVideosLoaded:if(!a.initialized)a.initialized=true;break}};var g=null,m,i=null,j=null,r=null,d=null,p=null,h=null,c=null,b=null,f=0,e=null,k=false,q=null;this.initialized=false;function n(g){var e="";if(checkString(g)){var a=g.split(":");for(var b=0;b<a.length;b++)a[b]=unescape(a[b]);if(a.length>0){e=a[0]+".aspx";a.removeAt(0);var f,d,c,h=Math.floor(a.length/2)*2;for(b=0;b<h;b+=2){f=b>0?"&":"?";d=a[b];switch(d.toLowerCase()){case "uuids":c=t(a[b+1]);break;default:c=a[b+1];break}e+=f+d+"="+c}}}return e}function t(a){return extractGuids(a,",").join(",")}function s(){j=getUrlParam("cid");p=getUrlParam("user");r=getUrlParam("favcid");i=getUrlParam("action");h=getUrlParam("channel");e=getUrlParam("playlist",true);k=getUrlParam("showPlaylist").toLowerCase()=="true";q=getUrlParam("editor");c=getUrlParam("tab");if(!checkString(c)){c=getUrlParam("tabId");if(!checkString(c))c=getUrlParam("menuId")}d=getUrlParam("search",true);if(!checkString(d)){d=getUrlParam("searchTerm",true);if(!checkString(d)&&isSoapboxEnabled())d=getUrlParam("soapboxSearchTerm",true)}d=decodeURIComponent(d);if(!isSoapboxEnabled())if(checkString(j)||checkString(i)||checkString(h)||c.toString().toLowerCase().trim()=="soapbox"){j=i=c=h="";customAlert(a.cfg.SOAPBOX_UNAVAILABLE)}f=checkInt(getUrlParam("page"))?parseInt(getUrlParam("page")):f;switch(getUrlParam("sort").toLowerCase()){case "relevance":b=SoapboxService.SortOrder.Relevance;break;case "rating":b=SoapboxService.SortOrder.Rating;break;case "dateadded":b=SoapboxService.SortOrder.DateUploaded;break;case "views-hour":case "time-hour":b=SoapboxService.SortOrder.LastHour;break;case "views-today":case "time-today":b=SoapboxService.SortOrder.LastDay;break;case "views-week":case "time-week":b=SoapboxService.SortOrder.LastWeek;break;case "views-month":case "time-month":b=SoapboxService.SortOrder.LastMonth;break;case "views-all":case "time-all":b=SoapboxService.SortOrder.AllTimes;break;default:b=SoapboxService.SortOrder.Default}}function o(a,c,b){m=a;Msn.SoapboxServiceManager.GetNickname(a,c,b)}this.viewProfileCb=function(c){var b={};b.cid=m;b.nickname=checkObject(c)&&checkString(c.Nickname)?c.Nickname:this.cfg.ANONYMOUS;a.fireEvent(Msn.Event.ViewProfile,b)};this.viewUserVideos=function(b){var c=checkObject(b)&&checkString(b.Nickname)?b.Nickname:this.cfg.ANONYMOUS;a.viewVideos(m,SoapboxService.SearchType.User,0,c)};this.viewUserFavVideos=function(b){var c=checkObject(b)&&checkString(b.Nickname)?b.Nickname:this.cfg.ANONYMOUS;a.viewVideos(m,SoapboxService.SearchType.Favorites,0,c)};this.viewVideos=function(d,b,a,c){if(!l(Msn.Event.Search,d,b,a,c,null)&&checkDefined(Msn.MenuManager))Msn.MenuManager.initDefault()};this.viewProfileErrorCb=function(){a.fireEvent(Msn.Event.ViewErrorProfile)};this.viewUserVideosErrorCb=function(){};function l(i,d,e,c,g,h){if(checkString(d)&&checkInt(e,0)&&checkInt(c,0)){var f=Msn.Controls.SearchQueryFactory.create(d,e,c,b,g);f.onComplete=h;a.fireEvent(i,f);return true}else return false}this.onHiddenPlayListLoaded=function(b){if(!a.initialized&&checkArray(b)){a.fireEvent(Msn.Event.SetEditorAutoPlay,b);a.fireEvent(Msn.Event.DefaultVideosLoaded,b,true);a.initialized=true}};this.onVisiblePlayListLoadedSR=function(b){if(!a.initialized&&checkDefined(b)&&checkArray(b.Videos)){a.onVisiblePlayListLoaded(b.Videos);a.initialized=true}};this.onVisiblePlayListLoaded=function(b){if(!a.initialized&&checkArray(b)){a.fireEvent(Msn.Event.QueuePermalinkPlaylist,b);a.initialized=true}};this.onDefaultVideoListLoadedSR=function(b){if(!a.initialized&&checkDefined(b)&&checkArray(b.Videos)){a.onDefaultVideoListLoaded(b.Videos);a.initialized=true}};this.onDefaultVideoListLoaded=function(b){if(!a.initialized&&checkArray(b)){a.fireEvent(Msn.Event.DefaultVideosLoaded,b);a.initialized=true}};this.loadState=function(){var t=null,w=null,v=null,z=null,x=null,m=false;if(checkDefined(this.uniqueId)){if(checkDefined(Msn.HistoryManager))if(Msn.HistoryManager.restoreLastState()){a.fireEvent(Msn.Event.QueuePermalinkPlaylist,null);return}s();if(!checkString(e)||!k)a.fireEvent(Msn.Event.QueuePermalinkPlaylist,null);if(checkString(d)){m=true;if(isSoapboxEnabled()||isLiveSearchEnabled())Msn.Controls.fireEvent(Msn.Event.SplitSearch,d);else{var C=Msn.Controls.SearchQueryFactory.create(d,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.VideoCatalog);Msn.Controls.fireEvent(Msn.Event.Search,C)}}else if(checkString(i))switch(i.toLowerCase()){case "upload":this.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.Upload});m=true;break;case "manage":a.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.Videos});m=true;break;case "rate":g=function(){Msn.Controls.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.Share)};m=false;break;case "tag":g=function(){Msn.Controls.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.PopularTags)};m=false;break;case "comment":g=function(){Msn.Controls.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.Comment)};m=false;break;default:m=false;break}else if(checkString(p)){m=true;o(p,this.viewProfileCb,this.viewProfileErrorCb)}else if(checkString(j)){m=true;o(j,this.viewUserVideos,this.viewUserVideosErrorCb)}else if(checkString(r)){m=true;o(r,this.viewUserFavVideos,this.viewUserVideosErrorCb)}else if(checkString(h)){t=h;w=SoapboxService.SearchType.Channel;v=f;if(l(Msn.Event.Search,t,w,v,z,x))m=true}if(checkString(e))if(k&&!m&&e.toLowerCase().indexOf("videobyuuids")<0&&getWindowContext()!=Msn.WindowContext.DaughterWindow){t=n(e);w=SoapboxService.SearchType.Taxonomy;v=f;x=a.onVisiblePlayListLoadedSR;if(l(Msn.Event.Search,t,w,v,z,x))m=true}else{var B=a.onHiddenPlayListLoaded;if(k)B=a.onVisiblePlayListLoaded;t=n(e);var D=new Msn.Controls.VideoService;D.getVideosFromServiceUrl(t,null,B,null)}if(checkString(c)&&!m){var A,u;switch(c.toLowerCase()){case "mostpopular":u=Msn.Menu.MostViewed;break;case "mostrecent":u=Msn.Menu.MostRecent;break;case "mostcommented":u=Msn.Menu.MostCommented;break;case "topfavorites":u=Msn.Menu.TopFavorites;break;case "toprated":u=Msn.Menu.TopRated;break;case "featured":u=Msn.Menu.Home;break;case "soapbox":if(checkDefined(Msn.MenuManager.defaultSoapboxMenuItem))u=Msn.MenuManager.defaultSoapboxMenuItem;else u=c;break;default:u=c;break}A={menuId:u,sortOrder:b,page:f,loadDefaultPlaylist:true};this.fireEvent(Msn.Event.MenuClick,A);m=A.menuFound}if(!m&&checkDefined(Msn.MenuManager))Msn.MenuManager.initDefault();var y=Msn.Controls.config.taxonomy;x=null;if(checkString(q)){t=n(q);w=SoapboxService.SearchType.Taxonomy;v=f}else if(checkObject(y.menuTaxonomy)&&checkObject(y.menuTaxonomy.defaultVideos)&&checkString(y.menuTaxonomy.defaultVideos.$videosUrl)){t=y.menuTaxonomy.defaultVideos.$videosUrl;w=SoapboxService.SearchType.Taxonomy;v=f}if(getWindowContext()==Msn.WindowContext.DaughterWindow){x=checkString(e)?null:a.onDefaultVideoListLoadedSR;l(Msn.Event.SetEditorsPlaylist,t,w,v,z,x)}else if(!checkString(e)&&!a.initialized)setTimeout(function(){var b=new Msn.Controls.VideoService;b.getVideosFromServiceUrl(t,null,a.onDefaultVideoListLoaded,null)},10);this.fireEvent(Msn.Event.SurveyCheck)}};this._render=function(a){if(null!=a)if(!checkDefined(Msn.PermalinkManager))Msn.PermalinkManager=this}};Msn.Controls.PermalinkManager.prototype=Msn.Controls;Msn.Controls.PopupMenu=function(I,x,C,G,F){var a=this,e=I,q=x instanceof Msn.Controls.RootMenu?x:null,L=G,K=F,c=null,o=null,B={},b=null,m=null,h=null,p=null,d=null,k=null,i=null,f=Msn.Controls.PopupMenu.MenuStatus.Closed,w=document.getElementById(C),z=1,s=false,D=200,A=7,H=5;this.subscribeEvent(Msn.Event.MenuClick);this.subscribeEvent(Msn.Event.MenuSelect);this.subscribeEvent(Msn.Event.MenuActivated);Msn.MenuManager.addMenuControl(this,z);this.getMenuObject=function(){return q.getMenuObject()};this.getMarket=function(){return q.getMarket()};this.getParentMenu=function(){return q};this.onEvent=function(l,j,d){if(l==a)return;if(j==Msn.Event.MenuClick||j==Msn.Event.MenuSelect){if(checkObject(d)&&(d.menuId==null||checkObject(d.menuId)&&checkString(d.menuId.$id))){var b=y(c);if(b!=null&&checkString(b._className))b.className=b._className;var g=null,i=d.menuId;if(!checkObject(i))o=null;var k=false;if(i!=null){g=a.getMenuObject().getHashNode(i.$id,e);if(g!=null){c=g;b=y(c);if(b!=null&&checkString(b._classNameSelected))b.className=b._classNameSelected;if(c.tagName=="subject")o=c;else if(c.tagName=="group")o=c.parentNode;else if(c.tagName=="member")o=c.parentNode.parentNode;k=true}}h.className=k?"popupMenuButtonSelected":"popupMenuButton";if(f==Msn.Controls.PopupMenu.MenuStatus.Open)a.onActivateMenu(null,false)}}else if(j==Msn.Event.MenuActivated)if((f==Msn.Controls.PopupMenu.MenuStatus.Open||f==Msn.Controls.PopupMenu.MenuStatus.Closing)&&d!=a&&d instanceof Msn.Controls.PopupMenu&&d.getParentMenu()==a.getParentMenu())a.onActivateMenu(null,false)};this.onItemClicked=function(d,c,b){if(!checkDefined(b))b=true;if(checkObject(c))if(Msn.MenuManager.setMenuContext(a,z)){a.onEvent(null,Msn.Event.MenuClick,{menuId:c});if(b)a.fireEvent(Msn.Event.MenuClick,{menuId:c})}if(checkDefined(d)&&checkDefined(d.srcElement))d.srcElement.blur();return false};function n(c){f=c;if(d==null)return;var a=d,b=a.className;if(f==Msn.Controls.PopupMenu.MenuStatus.Open){if(a.className.indexOf("_Hovering")<0)b+=" "+a.className+"_Hovering"}else if(f==Msn.Controls.PopupMenu.MenuStatus.Closed||f==Msn.Controls.PopupMenu.MenuStatus.Closing)if(a.className.indexOf("_Hovering")>=0)b=a.className.replace(/\s*\S+_Hovering/,"");a.className=b}function j(c,n){if(n){var k=c.style.display=="block",d=c._savedX;c.style.visibility="hidden";c.style.display="block";if(!k||!checkDefined(d)){var g=document.getElementById("menustrip"),f=getX(g)+(a.getBrowser()==Msn.Browser.IE?0:-1),j=getWidth(g)+f,l=getX(h)+parseInt(getWidth(h)/2),e=getWidth(b),i=l-parseInt(e/2),m=i+e;d=i;if(d<f)d=f;else if(m>j)d=j-e;c._savedX=d}setX(c,d,false);c.style.visibility="visible"}else c.style.display="none"}function v(){}function r(c){if(c){if(!m)a.renderPopupNode();if(b!=null){b.fading=false;v(b,100);j(b,true)}n(Msn.Controls.PopupMenu.MenuStatus.Open)}else if(b!=null){b.fading=true;n(Msn.Controls.PopupMenu.MenuStatus.Closed);j(b,false)}else n(Msn.Controls.PopupMenu.MenuStatus.Closed)}function g(b,d){if(i!=null){clearTimeout(i);i=null}function c(){var e=typeof b.srcElement,c=null;if(e=="unknown"||e=="undefined")c=null;else c=b.srcElement;var f=b!=null?{"srcElement":c,"target":b.target}:null;a.onActivateMenu(f,d)}i=setTimeout(c,D)}this.onActivateMenu=function(c,d){var b=c!=null?c.srcElement?c.srcElement:c.target:null;if(d){if(k!=null){clearTimeout(k);k=null}if(b==null||b==h||b==p){r(true);a.fireEvent(Msn.Event.MenuActivated,a)}}else if(b==null)r(false);else k=setTimeout(function(){r(false)},40)};function y(a){var b=null;if(checkObject(a)&&checkDefined(a.$id))b=B["node_"+a.$id];return b}function t(h,b,i){if(checkObject(b)){var f=b.tagName=="subject"?"popupMenuButton":b.tagName=="group"?"popupMenuMainItem":"popupMenuSubItem",e=b.tagName=="subject"?"popupMenuButtonSelected":b.tagName=="group"?"popupMenuMainItemSelected":"popupMenuSubItemSelected",d=null;if(b.tagName=="group")d=addElement(h,"span",b.$label,b==c?e:f,true);else{d=addElement(h,"a",b.$label,b==c?e:f,true);d.href=a.getLinkHref();a.addListener(d,"onclick",a.onItemClicked,b);d._className=f;d._classNameSelected=e}if(i&&b.tagName=="subject"){p=addElement(d,"div",null,"popupButtonImage");a.addListener(p,"onmouseover",g,true)}B["node_"+b.$id]=d;return d}else return null}function u(f,e,b){var a=e.members.member,k=Math.max(1,parseInt(a.length/b)+(a.length%b>0?1:0));t(f,e);var i=addElement(addElement(addElement(f,"table",null,"popupMenuGroupBox"),"tbody"),"tr"),a=e.members.member,h=parseInt(a.length/b)+(a.length%b>0?1:0),g=parseInt(100/h),c=null;for(var d=0;d<a.length;d++){var j=a[d];if(d%b==0){c=addElement(i,"td",null,"popupMenuGroupColumn");c.style.width=g+"%"}if(c!=null)t(c,j)}}function l(a,b,d){if(a!=null&&b>0&&(d||a.childNodes.length>0))for(var c=0;c<b;c++)var e=addElement(a,"td")}this._render=function(a){if(a!=null)if(checkObject(e)){var b=e.groups.group;s=b.length>0;d=addElement(a,"div",null,"popupMenuContainer");this.addListener(d,"onmouseover",g,true);this.addListener(d,"onmouseout",g,false);addElement(a,"div",null,"MenuStripItemSeparator");h=t(d,e,s);m=false}};this.renderPopupNode=function(){if(!m&&s){var B=checkDefined(w)?w:d;b=addElement(B,"div",null,"popupMenu");if(B!=d){this.addListener(b,"onmouseover",g,true);this.addListener(b,"onmouseout",g,false)}var J=0,c=A,i=H,v=120,h=addElement(addElement(b,"table",null,"popupMenuTable"),"tbody"),a=addElement(h,"tr");l(a,c,true);a=null;var j=c,D=e.groups.group;for(var y=0;y<D.length;y++){var r=D[y],k=r.members.member,C=Math.max(1,k.length);if(C>=c*i){l(a,j);a=addElement(h,"tr");var f=addElement(a,"td",null,"popupMenuCell");f.setAttribute("colspan",c);var q=addElement(f,"div",null,"popupMenuCellStrut");q.style.width=v*c+"px";var F=parseInt(k.length/c)+(k.length%c>0?1:0);u(f,r,F);j=c}else if(C>j*i){l(a,j);a=addElement(h,"tr");var f=addElement(a,"td",null,"popupMenuCell"),n=Math.max(1,parseInt(k.length/i)+(k.length%i>0?1:0));f.setAttribute("colspan",n);q=addElement(f,"div",null,"popupMenuCellStrut");q.style.width=v*n+"px";u(f,r,i);j=c-n}else{if(a==null)a=addElement(h,"tr");n=Math.max(1,parseInt(k.length/i)+(k.length%i>0?1:0));j-=n;f=addElement(a,"td",null,"popupMenuCell");f.setAttribute("colspan",n);q=addElement(f,"div",null,"popupMenuCellStrut");q.style.width=q.style.width=v*n+"px";u(f,r,i)}}l(a,j);var p=c;for(var o=0;o<h.childNodes.length;o++){var a=h.childNodes[o],t=0;for(var x=a.childNodes.length-1;x>=0;x--){var I=a.childNodes[x];if(I.childNodes.length>0)break;t++}if(t<p){p=t;if(p<=0)break}}if(p>0)for(o=0;o<h.childNodes.length;o++){a=h.childNodes[o];for(var E=0;E<p;E++){var z=a.childNodes.length-1;if(z>=0){var G=a.childNodes[z];a.removeChild(G)}}}}m=true};this.deselect=function(){a.onEvent(null,Msn.Event.MenuSelect,{menuId:null})};this.select=function(b){if(!checkDefined(b))b=true;a.getParentMenu().select();a.onItemClicked(null,e,b)};this.selectMenuItem=function(c,b){if(!checkDefined(b))b=true;a.getParentMenu().select();a.onItemClicked(null,c,b)};this.getMenuItem=function(c){var b=a.getMenuObject().getHashNode(c,e);return b};this.getSelectedItem=function(){return c};this.getMainMenuItem=function(){return e};this.getSubMenuItems=function(){var a=this.getMainMenuItem();if(checkDefined(a)&&checkDefined(a.groups)&&checkArray(a.groups.group))return a.groups.group;return []}};Msn.Controls.PopupMenu.prototype=Msn.Controls;Msn.Controls.PopupMenu.MenuStatus=SoapboxService.Utils.CreateEnum("Open",0,"Closing",1,"Closed",2);function getWidth(a){return a.offsetWidth}function getHeight(a){return a.offsetHeight}function getPosition(d){var b=0,c=0,a=d;while(a!=null){b+=a.offsetLeft;c+=a.offsetTop;a=a.offsetParent}return {"x":b,"y":c}}function getX(c){var b=0,a=c;while(a!=null){b+=a.offsetLeft;a=a.offsetParent}return b}function getY(c){var b=0,a=c;while(a!=null){b+=a.offsetLeft;a=a.offsetParent}return b}function getSize(a){return {width:a.offsetWidth,height:a.offsetHeight}}function setPosition(b,c,d){var a=getPosition(b.offsetParent);c-=a.x;d-=a.y;setAbsolutePosition(b,c,d)}function setAbsolutePosition(a,b,c){a.style.left=b+"px";a.style.top=c+"px"}function setX(a,b,c){if(c==false)b-=getX(a.offsetParent);a.style.left=b+"px"}function setY(a,b,c){if(c==false)b-=getY(a.offsetParent);a.style.top=b+"px"}function setWidth(b,a){b.style.width=a+"px"}function setHeight(b,a){b.style.height=a+"px"}Msn.Controls.ProfileControl=function(){var a=this;this.cfg={ANONYMOUS:$["IDS_CLI_Anonymous"],LOADING:$["IDS_CLI_Loading"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],USER_VIDEO_SUMMARY_PUBLIC:$["IDS_CLI_UserVideoSummaryPublic"],USER_VIDEO_SUMMARY_PRIVATE:$["IDS_CLI_UserVideoSummaryPrivate"],LINK_TO_PROFILE:$["IDS_CLI_LinkToProfile"]};var b=this.cfg.ANONYMOUS,e="0",g=0,h=0,j=new Msn.Controls.ContactControl("large"),i=new Msn.Controls.LiteralHTML(b.bold(),"",b),f=new Msn.Controls.LiteralHTML(isSoapboxEnabled()?this.cfg.LOADING:""),c=document.createElement("A"),d;c.innerText=this.cfg.LOADING;this.setCid=function(h){var f=43;if(checkDefined(h)&&e!=h){e=h;d=getHostUrl()+"/?user="+e;var j=d.length,b=d,i="",g=d;if(j>f)if(this.getBrowser()!=Msn.Browser.IE){b=d.substring(0,f);i=d.substring(f,j);g=b+i}else g=b;c.innerText=g;c.href=d;c.target="profile";a.refresh()}};this.setNickname=function(a){if(checkString(a)&&b!=a){b=a;i.setHTML(b.bold());i.setTitle(b)}};this.refresh=function(){if(checkDefined(e)&&0!=e&&isSoapboxEnabled())Msn.SoapboxServiceManager.GetUserProperties(e,a.userPropertiesCb,a.userPropertiesErrorCb)};this.userPropertiesCb=function(b){if(checkInt(b.NetworkViews,0)&&checkInt(b.NetworkFavorites,0)){g=b.NetworkViews;h=b.NetworkFavorites;a.updateUserProperties()}else a.userPropertiesErrorCb()};this.userPropertiesErrorCb=function(){g=-1;h=-1;a.updateUserProperties()};this.updateUserProperties=function(){if(isSoapboxEnabled())if(g<0||h<0)f.setHTML(a.cfg.DATA_NOT_AVAILABLE);else{var i=Msn.Passport.isUserLoggedIn()&&Msn.Passport.getCid()==e,c=i?a.cfg.USER_VIDEO_SUMMARY_PRIVATE:a.cfg.USER_VIDEO_SUMMARY_PUBLIC,d=c.format(b,g,h,b);f.setHTML(d)}else f.setHTML("")};this._render=function(h){if(null!=h){var d,g,e,b,k,l;d=document.createElement("TABLE");d.cellSpacing="0";d.cellPadding="0";g=document.createElement("TBODY");d.appendChild(g);e=document.createElement("TR");b=document.createElement("TD");j.render(b);e.appendChild(b);b=document.createElement("TD");b.style.verticalAlign="middle";i.render(b);b.appendChild(document.createElement("BR"));f.render(b);b.appendChild(document.createElement("BR"));b.appendChild(document.createTextNode(a.cfg.LINK_TO_PROFILE));b.appendChild(document.createElement("BR"));c.style.cursor="pointer";c.href=this.getLinkHref();b.appendChild(c);e.appendChild(b);g.appendChild(e);h.appendChild(d)}}};Msn.Controls.ProfileControl.prototype=Msn.Controls;Msn.Controls.ProfileHeader=function(){var a=this;this.cfg={SHOW_EDIT_LINK:false,EDIT_PROFILE:$["IDS_CLI_EditProfile"],EDIT_PROFILE_URL:$["IDS_GMT_EditProfileUrl"]};this.showEditLink=function(b){if(checkDefined(b)&&b!=a.cfg.SHOW_EDIT_LINK){a.cfg.SHOW_EDIT_LINK=b;a.render()}};this.onEditProfile=function(){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"editprofile"});openStandardWindow(a.cfg.EDIT_PROFILE_URL.format(Msn.Controls.config.envDomainSuffix,Msn.Controls.config.market,window.location),"profileWindow");return false};this._render=function(c){if(null!=c){var b,d;if(a.cfg.SHOW_EDIT_LINK){b=document.createElement("A");b.className="containerEditProfile";b.href=this.getLinkHref();b.title=this.cfg.EDIT_PROFILE;b.appendChild(document.createTextNode(this.cfg.EDIT_PROFILE));this.addListener(b,"onclick",this.onEditProfile);c.appendChild(b)}}}};Msn.Controls.ProfileHeader.prototype=Msn.Controls;Msn.Controls.ProfileModule=function(d){var e=this;this.cfg={HEADER_PROFILE:$["IDS_CLI_HeaderProfile"],HEADER_PROFILE_PRIVATE:$["IDS_CLI_HeaderProfilePrivate"]};var a=new Msn.Controls.Container(true,true,d?this.cfg.HEADER_PROFILE_PRIVATE:this.cfg.HEADER_PROFILE,false),b=new Msn.Controls.ProfileControl,c=new Msn.Controls.ProfileHeader;a.setCustomHeaderCtrl(c);a.showCustomHeader(true);a.setContent(b);this.showEditLink=function(a){c.showEditLink(a)};this.setCid=function(a){b.setCid(a)};this.setNickname=function(a){b.setNickname(a)};this._render=function(b){if(null!=b)a.render(b)}};Msn.Controls.ProfileModule.prototype=Msn.Controls;Msn.Controls.ProgressBar=function(g,h,c,f,j,i,e){var k=this,d=0,b=null,a=null;this.setProgress=function(b){if(!isNaN(b)&&b>=0&&b<=100){d=Math.floor(b);if(checkDefined(a))a.width=d*c/100}};this._render=function(k){if(null!=k&&checkInt(g)&&checkInt(h)&&checkInt(c,0)&&checkInt(f,0)&&checkString(j)&&checkString(i)){if(!checkDefined(b)||!checkDefined(a)){b=document.createElement("IMG");a=document.createElement("IMG")}if(checkString(e)){b.className=e;a.className=e}b.style.position="absolute";b.style.left=g+"px";b.style.top=h+"px";b.src=j;b.width=c;b.height=f;k.appendChild(b);a.style.position="absolute";a.style.left=g+"px";a.style.top=h+"px";a.src=i;a.width=d*c/100;a.height=f;k.appendChild(a)}}};Msn.Controls.ProgressBar.prototype=Msn.Controls;Msn.Controls.QuickMenu=function(){var c=this,b=null,a=null,d=null,e=null;this.onItemClicked=function(b,a){if(Msn.MenuManager.setMenuContext(e))if(a.$type==Msn.MenuItemType.Custom&&checkInt(a.$menuId))c.fireEvent(Msn.Event.MenuClick,{menuId:a.$menuId});else c.fireEvent(Msn.Event.MenuClick,{menuId:a});return false};this.subscribeEvent(Msn.Event.MenuClick);this.subscribeEvent(Msn.Event.MenuSelect);this.subscribeEvent(Msn.Event.MenuContextChanged);this.onEvent=function(j,g){if(g==Msn.Event.MenuClick||g==Msn.Event.MenuSelect||g==Msn.Event.MenuContextChanged){var f=Msn.MenuManager.getMenuContext(),h=f.getSelectedItem(),i=f.getMainMenuItem();if(h!=d||i!=b){d=null;b=null;a=null;e=f;if(checkObject(f)){d=h;b=i;a=f.getSubMenuItems()}c.render()}}};function f(g,b,f,j,i){var e=b==d?i:j,a=null,h=b.$label+(checkArray(f)&&f.length>0?":":"");if(checkDefined(b.$id)){a=addElement(g,"a",h,e,true);a.href=this.getLinkHref();c.addListener(a,"onclick",c.onItemClicked,b,false)}else a=addElement(g,"span",h,e,true);return a}this._render=function(d){if(d!=null){var g,c,h;d.innerHTML="";c=addElement(d,"div",null,"quickMenuContainerEmpty");if(checkObject(b)){c.className="quickMenuContainer";f(c,b,a,"quickMenuMainItem","quickMenuMainItemSelected");if(checkArray(a))for(var e=0;e<a.length;e++)f(c,a[e],null,"quickMenuSubItem","quickMenuSubItemSelected")}}}};Msn.Controls.QuickMenu.prototype=Msn.Controls;Msn.Controls.Rating=function(l){var c=this;this.subscribeEvent(Msn.Event.UserRating);this.onEvent=function(c,b,a){switch(b){case Msn.Event.UserRating:if(f==a.videoId&&h&&d!=a.userRating){d=a.userRating;this.refresh()}break;default:break}};this.cfg={AVG_RATING_IMG:getCDNPath("/i/ra/r_sc_wh_"),AVG_RATING_IMG_INACTIVE:getCDNPath("/i/ra/r_sc_wh_"),USR_RATING_IMG:getCDNPath("/i/ra/r_su_wh_"),CLEAR_IMG:getCDNPath("/i/cl.gif"),ALT_INACTIVE:$["IDS_CLI_AltInactive"],ALT_SET:$["IDS_CLI_AltSet"],ALT_CLEAR:$["IDS_CLI_AltClear"],FAILED_RATING:$["IDS_CLI_FailedRating"],FAILED_CLEARING:$["IDS_CLI_FailedClearing"],NOT_SIGNED_IN:$["IDS_CLI_NotSignedIn"],TOOLTIP:[$["IDS_CLI_Tooltip0"],$["IDS_CLI_Tooltip1"],$["IDS_CLI_Tooltip2"],$["IDS_CLI_Tooltip3"],$["IDS_CLI_Tooltip4"]]};var b=null,f=0,d=-1,g=-1,j=false,h=checkDefined(l)?l:false,a=null,e=null,i,k=true;this.setVisibility=function(a){k=a;if(null!=i)if(k){i.style.visibility="visible";i.style.display="inline"}else{i.style.visibility="hidden";i.style.display="none"}};this.setVideo=function(a){b=a;f=a.Id;d=-1;this.refresh()};this.setWebVideo=function(a){if(f!=a.Video.Id){b=a.Video;f=b.Id;d=checkInt(b.UserRating,-1,5)?b.UserRating:-1;this.refresh()}};this.clear=function(){b=null;f=null;d=-1;g=-1;j=false;this.refresh()};this.onMouseOver=function(){j=true;c.refresh()};this.onMouseOut=function(){j=false;g=-1;c.refresh()};this.onRatingOut=function(){g=-1;c.refresh()};this.onRatingMove=function(){g=Math.ceil(event.offsetX/13);c.refresh()};this.onRatingInput=function(){if(h)if(Msn.Passport.isUserLoggedIn()){var a=Math.ceil(event.offsetX/13);if(checkInt(a,0,5)&&null!=b&&a!=d){Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"rating"});Msn.SoapboxServiceManager.SetVideoRating(f,a,this.videoRatingCb,this.videoRatingErrorCb);d=a}}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta",name:"rate:signinerror"});Msn.Passport.loginDialog(c.cfg.NOT_SIGNED_IN)}};this.onUsrClearRating=function(){if(h)if(0!=f&&-1!=d){Msn.SoapboxServiceManager.ClearVideoRating(f,c.videoRatingCb,c.clearVideoRatingErrorCb);d=-1}};this.videoRatingCb=function(a){if(checkDefined(a)&&checkInt(a.StatusCode))if(SoapboxService.ResultCode.Success==a.StatusCode){var d={videoId:a.VideoId,userRating:a.Rating};c.fireEvent(Msn.Event.UserRating,d)}else if(SoapboxService.ResultCode.NotSignedIn==a.StatusCode){Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta",name:"rate:signinerror"});Msn.Passport.loginDialog(c.cfg.NOT_SIGNED_IN)}else customAlert(c.cfg.FAILED_RATING)};this.videoRatingErrorCb=function(){customAlert(c.cfg.FAILED_RATING)};this.clearVideoRatingErrorCb=function(){customAlert(c.cfg.FAILED_CLEARING)};this.refresh=function(){var k=null,i=null;if(checkInt(g,1,5)){var c=Math.floor(g);k=this.cfg.USR_RATING_IMG+c+".gif";i=this.cfg.TOOLTIP[c-1]}else if(checkInt(d,1,5)){c=Math.floor(d);k=this.cfg.USR_RATING_IMG+c+".gif";i=this.cfg.TOOLTIP[c-1]}else if(null!=b&&checkFloat(b.AverageRating)){var f=b.AverageRating;if(f>5)f=5;if(f<=0)f=2.5;c=(Math.round(f*4)/4).toFixed(2);c=c<1?0:c;k=(h?this.cfg.AVG_RATING_IMG:this.cfg.AVG_RATING_IMG_INACTIVE)+c.toString().replace(".","_")+".gif";i=h?this.cfg.ALT_SET:this.cfg.ALT_INACTIVE+" : "+f.toFixed(2)}if(checkDefined(a)){if(checkString(k)){a.src=k;a.style.visibility="visible"}else a.style.visibility="hidden";if(checkString(i))a.alt=a.title=i}if(checkDefined(e))e.style.visibility=j?"visible":"hidden"};this._render=function(c){var f,d,b;if(c){b=document.createElement("SPAN");b.style.width="76px";a=document.createElement("IMG");a.height="11";b.appendChild(a);if(h){a.style.cursor="pointer";this.addListener(a,"onmouseout",this.onRatingOut);this.addListener(a,"onmousemove",this.onRatingMove);this.addListener(a,"onclick",this.onRatingInput);b.appendChild(document.createTextNode(" "));e=document.createElement("IMG");e.style.visibility="hidden";e.style.cursor="pointer";e.alt=e.title=this.cfg.ALT_CLEAR;e.src=this.cfg.CLEAR_IMG;b.appendChild(e);this.addListener(e,"onclick",this.onUsrClearRating);this.addListener(c,"onmouseover",this.onMouseOver);this.addListener(c,"onmouseout",this.onMouseOut)}this.refresh();i=b;this.setVisibility(k);c.appendChild(b)}}};Msn.Controls.Rating.prototype=Msn.Controls;Msn.Reporting=new function(){var a=this,b=false;this.pageView=function(b,c,d,e){if(c!=null&&c!="undefined"&&c!="")s.pageName=c+":"+b;else s.pageName=b;if(d!=null&&d!="undefined"&&d!="")s.prop5=b+":"+d;else s.prop5=b;if(checkInt(e))s.prop5+=":"+e;a.sendReport()};this.linkTrack=function(c,b){if(typeof window.s=="undefined"||!checkDefined(b))return;if(checkString(b.name))s.prop5=c+":"+b.name;else s.prop5=c;if(checkDefined(b.video)){if(checkString(b.video.Title))s.prop17=b.video.Title;if(checkString(b.video.Source))s.prop4=b.video.Source;if(checkString(b.video.Id))s.prop32=b.video.Id;if(checkString(b.video.CsId))s.prop11=b.video.CsId}if(checkString(b.text))s.prop15=b.text;s.pageName="lnk:"+c;a.sendReport()};this.search=function(b,i,g,h){if(typeof window.s=="undefined"||!checkDefined(b))return;if(b.length>=1){var e=false,d=new RegExp("^[a-d](.+)","i"),c=d.exec(b);if(c!=null){s.prop36=b.toLowerCase();e=true}d=new RegExp("^[e-k](.+)","i");c=d.exec(b);if(c!=null){s.prop37=b.toLowerCase();e=true}d=new RegExp("^[l-p](.+)","i");c=d.exec(b);if(c!=null){s.prop38=b.toLowerCase();e=true}d=new RegExp("^[q-u](.+)","i");c=d.exec(b);if(c!=null){s.prop39=b.toLowerCase();e=true}if(!e)s.prop40=b.toLowerCase()}if(checkInt(g))g++;var f="";if(h=="gal")f=h;else f="search";a.pageView(f,"pag",i,g)};this.dw=function(b){if(typeof window.s=="undefined")return;s.pagename="lnk:dw";s.prop5=b;a.sendReport()};this.showcase=function(b){if(typeof window.s=="undefined")return;s.pagename="pag:minishow";s.prop5=b;a.sendReport()};this.silverlightInstall=function(b){if(typeof window.s=="undefined")return;s.pagename="pag:SLinstall";s.prop5=b;a.sendReport()};this.mediaClick=function(b){if(typeof window.s=="undefined"||!checkDefined(b))return;if(checkDefined(b.video)){if(checkString(b.video.Title))s.prop17=b.video.Title;if(checkString(b.video.Source))s.prop4=b.video.Source;if(checkString(b.video.Id))s.prop32=b.video.Id;if(checkInt(b.video.Permission))s.prop42=b.video.Permission}a.pageView("gal","pag",b.type)};this.upload=function(c,e){if(typeof window.s=="undefined")return;s.pageName="lnk:upload";var b={};b[Msn.UploadManager.Status.New]="new";b[Msn.UploadManager.Status.Uploading]="uploading";b[Msn.UploadManager.Status.Completed]="success";b[Msn.UploadManager.Status.Failed]="error";b[Msn.UploadManager.Status.Cancelled]="cancelled";b[Msn.UploadManager.Status.Deleted]="deleted";if(c!=""){var d=c;if(checkDefined(b[c])&&checkString(b[c]))d=b[c];s.prop5="upload:"+d}else s.prop5=e+":button";a.sendReport()};this.im=function(b){if(typeof window.s=="undefined")return;if(b){s.pageName="lnk:IM";s.prop5="IM:error"}else{s.pageName="pag:IM";s.prop5="IM:pageload"}a.sendReport()};this.adAction=function(d,b,c){if(typeof window.s=="undefined"||!checkDefined(b)||!checkDefined(d)||!checkString(c))return;s.pageName="lnk:ad";s.prop5=c;if(checkString(b.Title))s.prop17=b.Title;if(checkString(b.Source))s.prop4=b.Source;if(checkDefined(b.CsId))s.prop11=b.CsId;if(checkDefined(b.PageGroup))s.prop8=b.PageGroup;if(checkString(b.Id))s.prop32=b.Id;a.sendReport()};this.initialize=function(){b=true;s.linkInternalFilters=Msn.Controls.config.omnitureFilter;s.trackExternalLinks=false;s.trackInlineStats=false;s.trackDownloadLinks=false;s.charSet="ISO8859-1";s.server=window.location.hostname;s.channel="MSNvideo^"+(getWindowContext()==Msn.WindowContext.DaughterWindow?"dw":getWindowContext()==Msn.WindowContext.IMActivity?"im":"dest");s.ns="msnportal";s.prop1="MSNvideo^"+(checkString(Msn.Controls.config.brand)?Msn.Controls.config.brand.toLowerCase():"v4");s.prop2=checkString(Msn.Controls.config.market)?Msn.Controls.config.market.toLowerCase():"en-us";s.prop3=s.channel;var a=getUrlParam("ocid");if(checkString(a))s.campaign=a};this.sendReport=function(){if(typeof window.s=="undefined")return;if(!b)a.initialize();try{s.t()}catch(c){Msn.Controls.log("rpt","Error reporting!")}a.clearProps()};this.clearProps=function(){s.prop4=null;s.prop5=null;s.prop8=null;s.prop11=null;s.prop15=null;s.prop17=null;s.prop32=null;s.prop36=null;s.prop37=null;s.prop38=null;s.prop39=null;s.prop40=null}};Msn.Controls.ReportingLogger=function(){var a=this;this.subscribeEvent(Msn.Event.Search);this.subscribeEvent(Msn.Event.PanelSelect);this.subscribeEvent(Msn.Event.RelatedTagBrowse);this.subscribeEvent(Msn.Event.NextPageSearch);this.subscribeEvent(Msn.Event.PageView);this.subscribeEvent(Msn.Event.MenuClick);this.subscribeEvent(Msn.Event.ReportSearch);this.subscribeEvent(Msn.Event.MediaClick);this.subscribeEvent(Msn.Event.MetaLink);this.subscribeEvent(Msn.Event.TrackCloseFlyOverClick);this.subscribeEvent(Msn.Event.TrackPageView);this.subscribeEvent(Msn.Event.ViewProfileRequest);this.onEvent=function(f,e,a){switch(e){case Msn.Event.MenuClick:if(checkObject(a)&&checkObject(a.menuId)){var c="",b=null;if(a.menuId.tagName=="subject")c=a.menuId.$label;else if(a.menuId.tagName=="group"){b=a.menuId.parentNode;if(b!=null)c=b.$label+":"+a.menuId.$label}else if(a.menuId.tagName=="member"){b=a.menuId.parentNode;if(b!=null)c=b.$label+":"+a.menuId.$label;b=b.parentNode;if(b!=null)c=b.$label+":"+c}if(c!=""){c="nav:"+c;Msn.Reporting.pageView(c,"pag","")}}break;case Msn.Event.Search:switch(a.type){case SoapboxService.SearchType.Tag:Msn.Reporting.search(a.term,"tag","","gal");break;case SoapboxService.SearchType.Recommendations:Msn.Reporting.search(a.term,"recommendations","","");break}break;case Msn.Event.ReportSearch:if(checkDefined(a)&&checkString(a.srchtype))if(checkString(a.sect))Msn.Reporting.search(a.term,a.srchtype,"",a.sect);else Msn.Reporting.search(a.term,a.srchtype,"","");break;case Msn.Event.NextPageSearch:switch(a.type){case SoapboxService.SearchType.Keyword:Msn.Reporting.search(a.term,"site:pagin",a.page,"gal");break;case SoapboxService.SearchType.Tag:Msn.Reporting.search(a.term,"tag:pagin",a.page,"gal");break;case SoapboxService.SearchType.Taxonomy:case SoapboxService.SearchType.ListRecent:case SoapboxService.SearchType.ListPopular:case SoapboxService.SearchType.ListMostCommented:case SoapboxService.SearchType.ListTopFavorites:case SoapboxService.SearchType.ListTopRated:Msn.Reporting.search("","pagin",a.page,"gal");break;default:var d=checkString(a.term)?a.term:"";Msn.Reporting.search(d,"pagin",a.page,"gal");break}break;case Msn.Event.PageView:Msn.Reporting.pageView(a,"pag","");break;case Msn.Event.RelatedTagBrowse:Msn.Reporting.search(a.term,"tag:related","","gal");break;case Msn.Event.PanelSelect:Msn.Reporting.linkTrack("meta",a);break;case Msn.Event.MetaLink:if(checkString(a.type))Msn.Reporting.linkTrack(a.type,a);break;case Msn.Event.MediaClick:if(checkDefined(a))Msn.Reporting.mediaClick(a);break;case Msn.Event.TrackCloseFlyOverClick:if(checkDefined(a))Msn.Reporting.adAction(a.ad,a.video,"ad:close");break;case Msn.Event.TrackPageView:if(checkDefined(a)&&checkDefined(a.page))if(checkDefined(a.section))Msn.Reporting.pageView(a.page,"pag",a.section);else Msn.Reporting.pageView(a.page,"pag","");break;case Msn.Event.ViewProfileRequest:Msn.Reporting.linkTrack("header",{name:"gtprofile"});break}}};Msn.Controls.ReportingLogger.prototype=Msn.Controls;Msn.Controls.ResourceManager=function(){var a=false,b=false;this.getString=function(b){if(!a)this.buildStrings();var c=_res[b];if(this.debugMode&&typeof c=="undefined")alert("Missing resource for key : "+b);return c};this.getStrings=function(){if(!a)this.buildStrings();return _res};this.buildStrings=function(){if(!a){var d,c,g;a=true;if(b)for(c in _res){d=_res[c];if(c.indexOf("IDS_GMT")<0)d+="["+d.substring(0,d.length*60/100)+"]";_res[c]=d}if(Msn.Controls.config.ExperimentsEnabled){var e=Msn.Controls.config.ExperimentData;for(g in e){var f=e[g];for(c in f)if(typeof _res[c]!="undefined")_res[c]=f[c]}}}return _res}};var ResMgr=new Msn.Controls.ResourceManager,$=ResMgr.buildStrings();Msn.Controls.RootMenu=function(){var b=this,a=Msn.Controls.config.taxonomy,g=0,f=null,c=null,e=false,d=null;this.subscribeEvent(Msn.Event.DefaultVideosLoaded);this.onEvent=function(f,c,b){switch(c){case Msn.Event.DefaultVideosLoaded:var a=b;if(checkArray(a))if(!e)d=a;break}};this.getMenuObject=function(){return a};this.getMarket=function(){return a.$market};this.getParentMenu=function(){return null};this.loadState=function(){e=true;if(checkArray(d)){b.fireEvent(Msn.Event.DefaultVideosLoaded,defaultVideos);d=null}};this.init=function(){Msn.MenuStrip.prerenderSubItems(b);if(checkObject(a)&&checkObject(a.menuTaxonomy)&&checkObject(a.menuTaxonomy.subjects)&&checkArray(a.menuTaxonomy.subjects.subject)){var d=a.menuTaxonomy.subjects.subject;if(!checkObject(c)&&d.length>0)c=d[0];b.select(true)}if(checkObject(c))Msn.MenuManager.setDefaultMenuItem(c)};this._render=function(){b.init()};this.deselect=function(){var a=Msn.MenuManager.getMenuContext(1);if(checkObject(a)&&a.getMenuObject()==b.getMenuObject())f=a.getSelectedItem()};this.select=function(a){if(!checkDefined(a))a=true;if(a)Msn.MenuManager.setMenuContext(b,g)};this.selectMenuItem=function(c,a){if(!checkDefined(a))a=true;b.select(a)};this.getMenuItem=function(){return null};this.getSelectedItem=function(){return null};this.getMainMenuItem=function(){return a};this.getSubMenuItems=function(){if(checkDefined(a)&&checkDefined(a.menuTaxonomy)&&checkDefined(a.menuTaxonomy.subjects)&&checkArray(a.menuTaxonomy.subjects.subject))return a.menuTaxonomy.subjects.subject;return []}};Msn.Controls.RootMenu.prototype=Msn.Controls;Msn.Controls.RssLink=function(){var a=this,b=null,c=null;this.cfg={IMG_RSS:Msn.ImageEnum.RSS_MINI,ZUNE_ICON:Msn.ImageEnum.ZUNE_ICON,ZUNE_TOOLTIP:$["IDS_CLI_AddToZuneTooltip"],ADD_TO_LIVE:$["IDS_CLI_AddToLive"],ADD_TO_MYMSN:$["IDS_CLI_AddToMymsn"],RSS:$["IDS_CLI_Rss"],LIVE_URL:$["IDS_GMT_AddToLiveLink"].format(Msn.Controls.config.envDomainSuffix,Msn.Controls.config.market),MY_MSN_URL:$["IDS_GMT_AddToMyMsnLink"].format(Msn.Controls.config.envDomainSuffix),ZUNE_ENABLED:$["IDS_GMT_EnableZunePodcast"],ZUNE_INSTALL_URL:$["IDS_GMT_ZuneClientInstallUrl"],SIGN_IN_TO_MYMSN:$["IDS_CLI_SignInReqdForMyMSN"]};this.setRssUrl=function(d,a){b=d;c=a;this.render()};this.showRssPanel=function(b,a){if(checkDefined(a)){a.style.visibility="visible";a.style.display="inline"}};this.hideRssPanel=function(b,a){if(checkDefined(a)){a.style.visibility="hidden";a.style.display="none"}};this.onMouseOverLink=function(b,a){if(checkDefined(a))a.className="rssLinkMouseOver"};this.onMouseOutLink=function(b,a){if(checkDefined(a))a.className="rssLinkNormal"};this.onLinkClick=function(d,b){if(checkString(b)){openStandardWindow(b,"rssWindow");var c="";if(b.indexOf(a.cfg.LIVE_URL)>=0)c="live";if(b.indexOf(a.cfg.MY_MSN_URL)>=0)c="my";a.fireEvent(Msn.Event.MetaLink,{type:"rss",name:c})}return false};this.onZuneClick=function(){var e=navigator.userAgent.indexOf("Zune")>-1||a.getBrowser()!=Msn.Browser.IE;if(e&&checkString(c)){var f=getUrlValue(c,"title","Soapbox"),d="zune://subscribe/?"+f+"="+c;d=d.replace(/"/g,"'");openStandardWindow(d,"zune");a.fireEvent(Msn.Event.MetaLink,{type:"zune",name:"feed"})}else{var b=new Msn.Controls.Dialog;b.description=$["IDS_CLI_ZuneNotInstalledMsg"];b.type=Msn.Dialog.Confirm;b.onComplete=this.installConfirmed;a.fireEvent(Msn.Event.DialogRequest,b);a.fireEvent(Msn.Event.MetaLink,{type:"zune",name:"install"})}};this.installConfirmed=function(b){if(b)openStandardWindow(a.cfg.ZUNE_INSTALL_URL,"zune")};this.onMyMSN=function(){if(Msn.Passport.isUserLoggedIn()){var d=this.cfg.MY_MSN_URL+encodeURIComponent(b),c=null;a.onLinkClick(c,d)}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"mymsn:signinerror"});Msn.Passport.loginDialog(a.cfg.SIGN_IN_TO_MYMSN)}return false};this._render=function(j){if(null!=j&&checkString(b)){var d,e,k,g,l,a,f,h,i;h=this.cfg.LIVE_URL;i=this.cfg.MY_MSN_URL;g=document.createElement("DIV");e=document.createElement("SPAN");e.className="rssPanel";this.addListener(e,"onmouseover",this.showRssPanel,e);this.addListener(e,"onmouseout",this.hideRssPanel,e);d2=document.createElement("DIV");a=document.createElement("IMG");a.className="rssImage";Msn.ImageLoader.Load(this.cfg.IMG_RSS,a);this.addListener(d2,"onmouseover",this.onMouseOverLink,d2);this.addListener(d2,"onmouseout",this.onMouseOutLink,d2);this.addListener(a,"onclick",this.onLinkClick,b);d2.appendChild(a);e.appendChild(d2);d2=document.createElement("DIV");d=document.createElement("A");d.href=this.getLinkHref();d.title=this.cfg.ADD_TO_LIVE;d.appendChild(document.createTextNode(this.cfg.ADD_TO_LIVE));d2.appendChild(d);d2.className="rssLinkNormal";this.addListener(d2,"onmouseover",this.onMouseOverLink,d2);this.addListener(d2,"onmouseout",this.onMouseOutLink,d2);if(checkString(h))this.addListener(d2,"onclick",this.onLinkClick,h+escape(b));e.appendChild(d2);d2=document.createElement("DIV");d=document.createElement("A");d.href=this.getLinkHref();d.title=this.cfg.ADD_TO_MYMSN;d.appendChild(document.createTextNode(this.cfg.ADD_TO_MYMSN));d2.appendChild(d);d2.className="rssLinkNormal";this.addListener(d2,"onmouseover",this.onMouseOverLink,d2);this.addListener(d2,"onmouseout",this.onMouseOutLink,d2);if(checkString(i))this.addListener(d2,"onmousedown",this.onMyMSN);e.appendChild(d2);d2=document.createElement("DIV");d=document.createElement("A");d.href=this.getLinkHref();d.title=this.cfg.RSS;d.appendChild(document.createTextNode(this.cfg.RSS));d2.appendChild(d);d2.className="rssLinkNormal";this.addListener(d2,"onmouseover",this.onMouseOverLink,d2);this.addListener(d2,"onmouseout",this.onMouseOutLink,d2);this.addListener(d2,"onclick",this.onLinkClick,b);e.appendChild(d2);if(isTrue(this.cfg.ZUNE_ENABLED)&&checkString(c)){a=document.createElement("IMG");a.alt=a.title=this.cfg.ZUNE_TOOLTIP;a.style.paddingTop="2px";a.style.paddingRight="3px";Msn.ImageLoader.Load(this.cfg.ZUNE_ICON,a);this.addListener(a,"onclick",this.onZuneClick);g.appendChild(a);if(this.getBrowser()!=Msn.Browser.IE)e.style.top="-18px"}f=document.createElement("SPAN");f.style.position="relative";a=document.createElement("IMG");a.style.verticalAlign="top";a.style.paddingTop="4px";Msn.ImageLoader.Load(this.cfg.IMG_RSS,a);this.addListener(a,"onmouseover",this.showRssPanel,e);this.addListener(a,"onmouseout",this.hideRssPanel,e);this.addListener(a,"onclick",this.onLinkClick,b);f.appendChild(e);f.appendChild(a);g.appendChild(f);j.appendChild(g)}}};Msn.Controls.RssLink.prototype=Msn.Controls;Msn.Controls.SearchMenu=function(){var a=this,g=null,c=null,d=null,e=null;this.cfg={SEARCH_RESULTS:$["IDS_CLI_SearchResults"],SEARCH_RESULTS_FOR:$["IDS_CLI_SearchResultsFor"],ALL_RESULTS:$["IDS_CLI_AllResults"],MSN_VIDEOS_RESULTS:$["IDS_CLI_MsnVideosResults"],SOAPBOX_RESULTS:$["IDS_CLI_SoapboxResults"]};var h={"$label":this.cfg.SEARCH_RESULTS},f=[{"$label":this.cfg.ALL_RESULTS,"$id":Msn.Menu.Search,"$type":Msn.MenuItemType.Custom,"$videosUrl":"Search","$menuId":Msn.Menu.Search},{"$label":this.cfg.MSN_VIDEOS_RESULTS,"$id":Msn.Menu.SearchMSNVideo,"$type":Msn.MenuItemType.Custom,"$videosUrl":"SearchMSNVideo","$menuId":Msn.Menu.SearchMSNVideo},{"$label":this.cfg.SOAPBOX_RESULTS,"$id":Msn.Menu.SearchSoapbox,"$type":Msn.MenuItemType.Custom,"$videosUrl":"SearchSoapbox","$menuId":Msn.Menu.SearchSoapbox}],b={};b[Msn.Menu.Search]=0;b[Msn.Menu.SearchMSNVideo]=1;b[Msn.Menu.SearchSoapbox]=2;Msn.MenuManager.addMenuControl(this);this.subscribeEvent(Msn.Event.Search);this.subscribeEvent(Msn.Event.SplitSearch);this.subscribeEvent(Msn.Event.MenuClick);this.subscribeEvent(Msn.Event.MenuSelect);this.onEvent=function(l,f,b){if(f==Msn.Event.Search||f==Msn.Event.SplitSearch){var i=false;e=Msn.Menu.Search;if(f==Msn.Event.Search){var h=b;if(checkDefined(h)&&h.type==SoapboxService.SearchType.Keyword){d=h.term;i=true;if(h.videoDomain==Msn.Domain.VideoCatalog)e=Msn.Menu.SearchMSNVideo;else if(h.videoDomain==Msn.Domain.Soapbox)e=Msn.Menu.SearchSoapbox}}else if(f==Msn.Event.SplitSearch){d=b;i=true}if(i){c.innerText=this.cfg.SEARCH_RESULTS_FOR.format(ll(d,20));c.title=this.cfg.SEARCH_RESULTS_FOR.format(d);a.onActivateMenu(true)}}else if(f==Msn.Event.MenuClick||f==Msn.Event.MenuSelect){var g=null;if(checkObject(b)&&checkInt(b.menuId))g=b.menuId;else if(checkObject(b)&&checkObject(b.menuId)&&b.menuId.$type==Msn.MenuItemType.Custom&&checkInt(b.menuId.$menuId))g=b.menuId.$menuId;if(g==Msn.Menu.Search)if(f==Msn.Event.MenuClick)a.fireEvent(Msn.Event.SplitSearch,d);else a.onEvent(a,Msn.Event.SplitSearch,d);else if(g==Msn.Menu.SearchMSNVideo||g==Msn.Menu.SearchSoapbox){var k=g==Msn.Menu.SearchMSNVideo?Msn.Domain.VideoCatalog:Msn.Domain.Soapbox,j=Msn.Controls.SearchQueryFactory.create(d,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,k);if(f==Msn.Event.MenuClick)a.fireEvent(Msn.Event.Search,j);else a.onEvent(a,Msn.Event.Search,j)}}};this.onItemClicked=function(e,c){if(!checkObject(c))a.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.Search});else if(checkDefined(c.$menuId)){var d=b[c.$menuId];if(checkObject(f[d]))a.fireEvent(Msn.Event.MenuClick,{menuId:f[d]})}return false};this.onActivateMenu=function(b){if(c==null)return;if(b){Msn.MenuManager.setMenuContext(a);c.className="popupMenuButtonSelected";g.style.display="block"}else{c.className="popupMenuButton";e=null}};this._render=function(a){if(a!=null){g=addElement(a,"div",null,"popupMenuContainer");this.addListener(g,"onclick",this.onItemClicked,f[b[Msn.Menu.Search]]);g.style.display="none";c=addElement(g,"a",this.cfg.SEARCH_RESULTS,"popupMenuButton");c.href=this.getLinkHref()}};this.deselect=function(){a.onActivateMenu(false)};this.selectMenuItem=function(b){a.onItemClicked(null,b)};this.getMenuItem=function(c){var a=b[c];if(checkInt(a))return f[a];return null};this.getSelectedItem=function(){if(e!=null)return f[b[e]];return null};this.getMainMenuItem=function(){return h};this.getSubMenuItems=function(){return f}};Msn.Controls.SearchMenu.prototype=Msn.Controls;Msn.Domain=SoapboxService.Utils.CreateEnum("Soapbox",0,"VideoCatalog",1,"LiveSearch",2);SoapboxService.SearchType.Taxonomy=100;SoapboxService.SearchType.ListPopular=101;SoapboxService.SearchType.ListRecent=102;SoapboxService.SearchType.ListMostCommented=103;SoapboxService.SearchType.ListTopFavorites=104;SoapboxService.SearchType.ListTopRated=105;SoapboxService.SearchType.ListFeatured=106;SoapboxService.SearchType.Optimization=107;SoapboxService.SortOrder.LastHour=100;SoapboxService.SortOrder.LastDay=101;SoapboxService.SortOrder.LastWeek=102;SoapboxService.SortOrder.LastMonth=103;SoapboxService.SortOrder.AllTimes=104;SoapboxService.SortOrder.parseFromUrl=function(d,b){var a=b!=null?b:SoapboxService.SortOrder.Default,c=getUrlValue(d,"sf");if(checkString(c))switch(c.toLowerCase()){case "activestartdate":a=SoapboxService.SortOrder.DateUploaded;break;case "relevance":a=SoapboxService.SortOrder.Relevance;break;case "hourlycount":a=SoapboxService.SortOrder.LastHour;break;case "dailycount":a=SoapboxService.SortOrder.LastDay;break;case "weeklycount":a=SoapboxService.SortOrder.LastWeek;break;case "monthlycount":a=SoapboxService.SortOrder.LastMonth;break;case "totalcount":a=SoapboxService.SortOrder.AllTimes;break;case "totalaverage":a=SoapboxService.SortOrder.Rating;break}return a};Msn.Controls.SearchQuery=function(){var a=this;this.cfg={LOADING:$["IDS_CLI_Loading"],NO_RESULTS:$["IDS_CLI_NoResults"],SEARCH_RESULTS:$["IDS_CLI_SearchResults"]};this.queryDomain=Msn.Domain.Soapbox;this.videoDomain=Msn.Domain.Soapbox;this.term=null;this.cloudTerm=null;this.type=SoapboxService.SearchType.Keyword;this.page=0;this.messageFound=this.cfg.SEARCH_RESULTS;this.messageNotFound=this.cfg.NO_RESULTS;this.messageLoading=this.cfg.LOADING;this.onBegin=function(){};this.onComplete=function(){};this.onCloudData=null;this.cloudEntryType=Msn.CloudEntryType.None;this.cloudData=null;this.showEditControls=false;this.showSharedControls=false;this.showFavControls=false;this.clearResultsOnBegin=true;this.header=null;this.headerTooltip=null;this.headerShowCount=true;this.sort=SoapboxService.SortOrder.Default;this.sortEntries=[];this.sortLabelHash={};this.playAll=true;this.rssUrl=null;this.zuneUrl=null;this.zuneTitle=null;this.showcaseData=null;this.updateSearchBox=false;this.menuId=null;this.addHistoryEntry=true;this.extra=null;this.useCache=true;this.setCloudTerm=function(a){this.cloudTerm=a};this.setSort=function(b){this.sort=b;switch(this.type){case SoapboxService.SearchType.Tag:case SoapboxService.SearchType.Source:case SoapboxService.SearchType.Keyword:case SoapboxService.SearchType.Taxonomy:case SoapboxService.SearchType.Channel:var a=this.secondaryMetadata;if(this.sort==SoapboxService.SortOrder.DateUploaded)this.secondaryMetadata=Msn.VideoMetadata.ReleaseDate;else this.secondaryMetadata=Msn.VideoMetadata.Views;if(this.primaryMetadata==this.secondaryMetadata)this.primaryMetadata=a;break;case SoapboxService.SearchType.ListPopular:case SoapboxService.SearchType.ListMostCommented:if(this.sort==SoapboxService.SortOrder.Default)this.sort=SoapboxService.SortOrder.LastDay;break;case SoapboxService.SearchType.ListTopFavorites:case SoapboxService.SearchType.ListTopRated:if(this.sort==SoapboxService.SortOrder.Default)this.sort=SoapboxService.SortOrder.AllTimes;break;default:break}};this.setOnBegin=function(a){if(checkFunction(a))this.onBegin=a};this.setOnComplete=function(a){if(checkFunction(a))this.onComplete=a};this.setOnCloudData=function(a){this.onCloudData=a};this.disableMenuSelect=function(){this.menuId=undefined};this.disableHistoryEntry=function(){this.addHistoryEntry=false};this.clone=function(){var a=new Msn.Controls.SearchQuery;a.queryDomain=this.queryDomain;a.videoDomain=this.videoDomain;a.term=this.term;a.cloudTerm=this.cloudTerm;a.type=this.type;a.page=this.page;a.messageFound=this.messageFound;a.messageNotFound=this.messageNotFound;a.messageLoading=this.messageLoading;a.onBegin=this.onBegin;a.onComplete=this.onComplete;a.onCloudData=this.onCloudData;a.cloudEntryType=this.cloudEntryType;a.cloudData=this.cloudData;a.showEditControls=this.showEditControls;a.showSharedControls=this.showSharedControls;a.showFavControls=this.showFavControls;a.clearResultsOnBegin=this.clearResultsOnBegin;a.header=this.header;a.headerShowCount=this.headerShowCount;a.headerTooltip=this.headerTooltip;a.sort=this.sort;a.sortEntries=this.sortEntries.clone();a.sortLabelHash=cloneObject(this.sortLabelHash);a.primaryMetadata=this.primaryMetadata;a.secondaryMetadata=this.secondaryMetadata;a.playAll=this.playAll;a.rssUrl=this.rssUrl;a.zuneUrl=this.zuneUrl;a.zuneTitle=this.zuneTitle;a.showcaseData=this.showcaseData;a.updateSearchBox=this.updateSearchBox;a.menuId=this.menuId;a.addHistoryEntry=this.addHistoryEntry;a.extra=this.extra;a.useCache=this.useCache;return a};this.check=function(){return checkDefined(this.term)&&checkInt(this.type,0)&&checkInt(this.page,0)};this.getCacheKey=function(){var a="Search|"+parseInt(this.videoDomain)+"|"+this.term+"|"+this.type+"|"+this.sort;return a}};Msn.Controls.SearchQueryFactory=new function(){var b="00000000-0000-0000-0000-000000000000",c=getHostUrl();this.cfg={MAX_TERM_LENGTH:40,MAX_BREADCRUMB_ENTRY_LENGTH:30,TOP_RESULTS:$["IDS_CLI_TopResults"],SOAPBOX_RESULTS:$["IDS_CLI_SoapboxResults"],MSN_VIDEO_RESULTS:$["IDS_CLI_MsnVideosResults"],VIEW_TOP_RESULTS:$["IDS_CLI_ViewTopResults"],VIEW_MSN_VIDEO_RESULTS:$["IDS_CLI_ViewMsnVideoResults"],VIEW_SOAPBOX_RESULTS:$["IDS_CLI_ViewSoapboxResults"],VIEW_LIVESEARCH_RESULTS:Msn.Controls.config.msnWebSearchBrand,MSN_VIDEOS_TAGGED:$["IDS_CLI_MsnVideosTagged"],MSN_VIDEOS_SOURCE_CONTENT:$["IDS_CLI_MsnVideosSourceContent"],SOAPBOX_VIDEOS_TAGGED:$["IDS_CLI_SoapboxVideosTagged"],COULD_NOT_FIND_RESULTS:$["IDS_CLI_CouldNotFindResults"],SEARCH_RESULTS_FOR:$["IDS_CLI_SearchResultsFor"],USER_CREATED_VIDEOS:$["IDS_CLI_UserCreatedVideos"],MSN_VIDEOS:$["IDS_CLI_MsnVideos"],CATEGORIES:$["IDS_CLI_Categories"],BROWSE_SOAPBOX_VIDEOS:$["IDS_CLI_BrowseSoapboxVideos"],MOST_VIEWED:$["IDS_CLI_MostViewed"],MOST_RECENT:$["IDS_CLI_MostRecent"],MOST_COMMENTED:$["IDS_CLI_MostCommented"],TOP_FAVORITES:$["IDS_CLI_TopFavorites"],TOP_RATED:$["IDS_CLI_TopRated"],FEATURED_VIDEOS:$["IDS_CLI_FeaturedVideos"],NO_FEATURED_VIDEOS:$["IDS_CLI_NoFeaturedVideos"],LOADING:$["IDS_CLI_Loading"],RELATED_VIDEOS:$["IDS_CLI_RelatedVideos"],NO_RELATED_VIDEOS:$["IDS_CLI_NoRelatedVideos"],MY_FAVORITES:$["IDS_CLI_MyFavorites"],YOUR_FAVORITES:$["IDS_CLI_YourFavorites"],YOU_NO_FAVORITES:$["IDS_CLI_YouNoFavorites"],FAVORITES_BY_NICKNAME:$["IDS_CLI_FavoritesByNickname"],NO_FAVORITES_BY_NICKNAME:$["IDS_CLI_NoFavoritesByNickname"],NICKNAME_FAVORITES:$["IDS_CLI_NicknameFavorites"],SHARED_VIDEOS_PRIVATE:$["IDS_CLI_HeaderSharedVideos"],ANONYMOUS:$["IDS_CLI_Anonymous"],YOUR_VIDEOS:$["IDS_CLI_YourVideos"],YOU_HAVE_NO_UPLOADED_VIDEOS:$["IDS_CLI_YouHaveNoUploadedVideos"],YOU_HAVE_NO_SHARED_VIDEOS:$["IDS_CLI_YouHaveNoSharedVideos"],MY_VIDEOS:$["IDS_CLI_MyVideos"],VIDEOS_UPLOADED_NICKNAME:$["IDS_CLI_VideosUploadedNickname"],NO_VIDEOS_UPLOADED_NICKNAME:$["IDS_CLI_NoVideosUploadedNickname"],NICKNAME_VIDEOS:$["IDS_CLI_NicknameVideos"],TODAY:$["IDS_CLI_Today"],THIS_WEEK:$["IDS_CLI_ThisWeek"],THIS_MONTH:$["IDS_CLI_ThisMonth"],ALL_TIME:$["IDS_CLI_AllTimes"],VIEWS:$["IDS_CLI_ViewsColon"],ORIGINAL_ORDER:$["IDS_CLI_OriginalOrder"],RELEVANCE:$["IDS_CLI_Relevance"],POSTED_DATE:$["IDS_CLI_PostedDate"],LAST_HOUR:$["IDS_CLI_LastHour"],TIME:$["IDS_CLI_Time"],EXP_SHOWCASE_ENABLED:isTrue($["IDS_GMT_ExpTaxonomyShowcaseEnabled"]),EXP_SHOWCASE_MENU_ID:$["IDS_GMT_ExpTaxonomyShowcaseId"],EXP_SHOWCASE_VAL:d($["IDS_GMT_ExpTaxonomyShowcaseValue"])};function d(d){var c={};if(checkString(d)){var b=d.split("|"),e=b.length;for(var a=0;a+1<e;a+=2)c[b[a]]=b[a+1]}return c}function a(e,b,c,d){var a=d;if(e&&checkDefined(c))a=c;else if(checkDefined(b))a=b;return a}this.create=function(q,G,D,e,g){var d=new Msn.Controls.SearchQuery,p=[SoapboxService.SortOrder.LastHour,SoapboxService.SortOrder.LastDay,SoapboxService.SortOrder.LastWeek,SoapboxService.SortOrder.LastMonth,SoapboxService.SortOrder.AllTimes],J=SoapboxService.SortOrder.LastHour;d.queryDomain=Msn.Domain.VideoCatalog;d.videoDomain=Msn.Domain.Soapbox;d.term=q;d.type=G;d.page=checkInt(D,0)?D:0;switch(d.type){case SoapboxService.SearchType.Optimization:d.queryDomain=Msn.Domain.Soapbox;d.useCache=true;d.menuId=Msn.Menu.Videos;d.type=SoapboxService.SearchType.Optimization;break;case SoapboxService.SearchType.Taxonomy:d.videoDomain=Msn.Domain.VideoCatalog;var w=g,f=null;if(checkString(w)&&checkDefined(Msn.MenuManager)){var A=Msn.MenuManager.getMatchingMenuControl(w,true);if(checkDefined(A)){var B=A.getMenuObject();if(checkDefined(B)){f=B.getHashNode(w);if(checkObject(f)){d.menuId=f.$id;var m=null;if(checkObject(f.template)){var i=f.template,E=new Msn.Controls.AdapterFactory,u=E.create(Msn.Domain.VideoCatalog);if(checkDefined(u)&&checkFunction(u.convertTemplate))i=u.convertTemplate(f);if(i.type=="default")m=i.videosUrl;else if(i.section.length>1){var k=i.section[0],j=this.cfg.EXP_SHOWCASE_ENABLED&&ExpMgr.isEnabled();j=j&&checkString(this.cfg.EXP_SHOWCASE_MENU_ID)&&(this.cfg.EXP_SHOWCASE_MENU_ID=="*"||i.menuId.toLowerCase()==this.cfg.EXP_SHOWCASE_MENU_ID.toLowerCase());d.showcaseData={"type":a(j,k.type,this.cfg.EXP_SHOWCASE_VAL.type),"showcaseSize":a(j,k.showcaseSize,this.cfg.EXP_SHOWCASE_VAL.showcaseSize,Msn.ShowcaseSize.Small),"showcaseDesign":a(j,k.showcaseDesign,this.cfg.EXP_SHOWCASE_VAL.showcaseDesign,Msn.ShowcaseDesign.PosterFrame),"showcaseMediaUrl":a(j,k.showcaseMediaUrl,this.cfg.EXP_SHOWCASE_VAL.showcaseMediaUrl),"showcaseFallbackMediaUrl":a(j,k.showcaseFallbackMediaUrl,this.cfg.EXP_SHOWCASE_VAL.showcaseFallbackMediaUrl),"url":a(j,k.videosUrl,this.cfg.EXP_SHOWCASE_VAL.videosUrl)};m=i.section[1].videosUrl}else if(i.section.length>0)m=i.section[0].videosUrl}else if(checkString(f.$videosUrl)&&f.$type!=Msn.MenuItemType.Custom)m=f.$videosUrl;else if(checkString(f.$topic)&&checkString(f.$cat)){var z=this.getMenuContext();if(checkObject(z)){var H=z.getMarket();m=getVideosUrlFromTopicCategory(H,f.$topic+"_"+f.$cat)}}d.term=checkString(d.term)?d.term:m;if(!checkString(d.header)){var o="",y="",n=f;while(checkDefined(n)){if(checkString(n.$label)){var C=o.length>0?" > ":"";o=ll(n.$label,this.cfg.MAX_BREADCRUMB_ENTRY_LENGTH)+C+o;y=n.$label+C+o}n=n.parentNode}d.header=o;d.headerTooltip=y}if(checkInt(f.$menuId)&&Msn.MenuManager.isSoapboxCategory(f.$menuId))d.videoDomain=Msn.Domain.Soapbox}}}}if(d.videoDomain==Msn.Domain.Soapbox){d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Views}else{d.primaryMetadata=Msn.VideoMetadata.Source;d.secondaryMetadata=Msn.VideoMetadata.ReleaseDate}d.setSort(e);this.setExtendedSortEntries(d,e);if(!checkString(d.header))d.header="Playlist";break;case SoapboxService.SearchType.Keyword:d.cloudEntryType=Msn.CloudEntryType.Search;d.updateSearchBox=true;d.videoDomain=checkDefined(g)?g:d.videoDomain;if(d.videoDomain==Msn.Domain.Soapbox){d.sortEntries=[SoapboxService.SortOrder.Relevance,SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Playcount,SoapboxService.SortOrder.Rating];d.header=this.cfg.SOAPBOX_RESULTS;d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);this.setExtendedSortEntries(d,e)}else if(d.videoDomain==Msn.Domain.VideoCatalog){d.header=this.cfg.MSN_VIDEO_RESULTS;d.primaryMetadata=Msn.VideoMetadata.Source;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);this.setExtendedSortEntries(d,e)}else if(d.videoDomain==Msn.Domain.LiveSearch){d.header=this.cfg.VIEW_LIVESEARCH_RESULTS;d.queryDomain=Msn.Domain.LiveSearch;d.primaryMetadata=Msn.VideoMetadata.Source;d.secondaryMetadata=Msn.VideoMetadata.Length;d.playAll=false}var I=this.cfg.TOP_RESULTS.format(ll(d.term,this.cfg.MAX_TERM_LENGTH).trim()),t=this.cfg.VIEW_MSN_VIDEO_RESULTS,l=[];l.push({"Type":Msn.CloudEntryType.Search,"Name":this.cfg.VIEW_TOP_RESULTS,"Data":{"term":d.term}});l.push({"Type":Msn.CloudEntryType.Search,"Name":this.cfg.VIEW_MSN_VIDEO_RESULTS,"Data":{"term":d.term,"domain":Msn.Domain.VideoCatalog}});if(isSoapboxEnabled()){l.push({"Type":Msn.CloudEntryType.Search,"Name":this.cfg.VIEW_SOAPBOX_RESULTS,"Data":{"term":d.term,"domain":Msn.Domain.Soapbox}});if(d.videoDomain==Msn.Domain.Soapbox)t=this.cfg.VIEW_SOAPBOX_RESULTS}if(isLiveSearchEnabled()){l.push({"Type":Msn.CloudEntryType.Search,"Name":this.cfg.VIEW_LIVESEARCH_RESULTS,"Data":{"term":d.term,"domain":Msn.Domain.LiveSearch}});if(d.videoDomain==Msn.Domain.LiveSearch)t=this.cfg.VIEW_LIVESEARCH_RESULTS}if(l.length>2){var F={"name":t,"UIOnly":true};d.cloudData={"title":I,"entries":l,"selection":F}}else d.cloudEntryType=Msn.CloudEntryType.Tags;break;case SoapboxService.SearchType.Tag:d.cloudEntryType=Msn.CloudEntryType.Tags;d.updateSearchBox=true;d.videoDomain=checkDefined(g)?g:d.videoDomain;if(d.videoDomain==Msn.Domain.Soapbox){d.sortEntries=[SoapboxService.SortOrder.Relevance,SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Playcount,SoapboxService.SortOrder.Rating];d.primaryMetadata=Msn.VideoMetadata.Rating;d.header=this.cfg.SOAPBOX_VIDEOS_TAGGED.format(ll(d.term,this.cfg.MAX_TERM_LENGTH));d.headerTooltip=this.cfg.SOAPBOX_VIDEOS_TAGGED.format(d.term);d.secondaryMetadata=Msn.VideoMetadata.Views}else{d.primaryMetadata=Msn.VideoMetadata.Source;d.header=this.cfg.MSN_VIDEOS_TAGGED.format(ll(d.term,this.cfg.MAX_TERM_LENGTH));d.headerTooltip=this.cfg.MSN_VIDEOS_TAGGED.format(d.term);d.secondaryMetadata=Msn.VideoMetadata.Views}d.setSort(e);this.setExtendedSortEntries(d,e);d.messageNotFound=this.cfg.COULD_NOT_FIND_RESULTS.format(ll(d.term,this.cfg.MAX_TERM_LENGTH*2));d.messageFound=this.cfg.SEARCH_RESULTS_FOR.format(ll(d.term,this.cfg.MAX_TERM_LENGTH));break;case SoapboxService.SearchType.Source:d.videoDomain=Msn.Domain.VideoCatalog;var x=checkDefined(g)?g:d.term;d.extra=x;d.header=this.cfg.MSN_VIDEOS_SOURCE_CONTENT.format(ll(x,this.cfg.MAX_TERM_LENGTH));d.headerTooltip=this.cfg.MSN_VIDEOS_SOURCE_CONTENT.format(x);d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);this.setExtendedSortEntries(d,e);break;case SoapboxService.SearchType.Channel:var r="";if(checkDefined(Msn.MenuManager)){var s=Msn.MenuManager.getCategoryDataFromGuid(d.term);if(checkDefined(s)&&checkString(s.categoryFriendlyName))r=s.categoryFriendlyName}d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.CATEGORIES+" > "+r;d.headerShowCount=false;F={"name":r,"UIOnly":true};d.menuId=Msn.Menu.Categories;d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);this.setExtendedSortEntries(d,e);break;case SoapboxService.SearchType.ListPopular:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.MOST_VIEWED;d.headerShowCount=false;d.menuId=Msn.Menu.MostViewed;d.term=b;d.sortEntries=p;d.sortLabelHash["sortByLabel"]=this.cfg.TIME;d.primaryMetadata=Msn.VideoMetadata.Views;d.secondaryMetadata=Msn.VideoMetadata.ReleaseDate;d.setSort(e);break;case SoapboxService.SearchType.ListRecent:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.MOST_RECENT;d.headerShowCount=false;d.menuId=Msn.Menu.MostRecent;d.term=b;d.primaryMetadata=Msn.VideoMetadata.Views;d.secondaryMetadata=Msn.VideoMetadata.ReleaseDate;d.setSort(e);break;case SoapboxService.SearchType.ListMostCommented:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.MOST_COMMENTED;d.headerShowCount=false;d.menuId=Msn.Menu.MostCommented;d.term=b;d.sortEntries=p;d.sortLabelHash["sortByLabel"]=this.cfg.TIME;d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Comments;d.setSort(e);break;case SoapboxService.SearchType.ListTopFavorites:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.TOP_FAVORITES;d.headerShowCount=false;d.menuId=Msn.Menu.TopFavorites;d.term=b;d.sortEntries=p;d.sortLabelHash["sortByLabel"]=this.cfg.TIME;d.primaryMetadata=Msn.VideoMetadata.Favorites;d.secondaryMetadata=Msn.VideoMetadata.Comments;d.setSort(e);break;case SoapboxService.SearchType.ListTopRated:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.TOP_RATED;d.headerShowCount=false;d.menuId=Msn.Menu.TopRated;d.term=b;d.sortEntries=p;d.sortLabelHash["sortByLabel"]=this.cfg.TIME;d.primaryMetadata=Msn.VideoMetadata.Comments;d.secondaryMetadata=Msn.VideoMetadata.Rating;d.setSort(e);break;case SoapboxService.SearchType.ListFeatured:d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.FEATURED_VIDEOS;d.queryDomain=Msn.Domain.Soapbox;d.type=SoapboxService.SearchType.List;d.term="featured";d.messageFound="";d.messageNotFound=this.cfg.NO_FEATURED_VIDEOS;d.messageLoading=this.cfg.LOADING;d.primaryMetadata=Msn.VideoMetadata.Rating;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);d.rssUrl=c+"/rss.aspx?listId=featured";break;case SoapboxService.SearchType.Recommendations:d.header=this.cfg.RELATED_VIDEOS;d.videoDomain=checkDefined(g)?g:d.videoDomain;d.header=(d.videoDomain==Msn.Domain.Soapbox?this.cfg.USER_CREATED_VIDEOS:this.cfg.MSN_VIDEOS)+" > "+this.cfg.RELATED_VIDEOS;d.messageFound="";d.messageNotFound=this.cfg.NO_RELATED_VIDEOS;d.messageLoading=this.cfg.LOADING;d.primaryMetadata=d.videoDomain==Msn.Domain.Soapbox?Msn.VideoMetadata.Rating:Msn.VideoMetadata.Source;d.secondaryMetadata=Msn.VideoMetadata.Views;d.setSort(e);break;case SoapboxService.SearchType.Favorites:d.queryDomain=Msn.Domain.Soapbox;var v=q,h=checkString(g)?g:this.cfg.ANONYMOUS;if(v==Msn.Passport.getCid()&&Msn.Passport.isUserLoggedIn()){d.menuId=Msn.Menu.Favorites;d.messageFound=this.cfg.YOUR_FAVORITES;d.messageNotFound=this.cfg.YOU_NO_FAVORITES;d.header=this.cfg.MY_FAVORITES;d.showFavControls=true}else{d.messageFound=this.cfg.FAVORITES_BY_NICKNAME.format(h);d.messageNotFound=this.cfg.NO_FAVORITES_BY_NICKNAME.format(h);d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.NICKNAME_FAVORITES.format(h);d.extra=h}d.primaryMetadata=Msn.VideoMetadata.Views;d.secondaryMetadata=Msn.VideoMetadata.Favorites;d.setSort(e);d.rssUrl=c+"/rss.aspx?userFavId="+d.term;break;case SoapboxService.SearchType.User:case SoapboxService.SearchType.AllVideos:d.queryDomain=Msn.Domain.Soapbox;v=q;h=checkString(g)?g:this.cfg.ANONYMOUS;if(v==Msn.Passport.getCid()&&Msn.Passport.isUserLoggedIn()){d.useCache=false;d.menuId=Msn.Menu.Videos;d.type=SoapboxService.SearchType.AllVideos;d.messageFound=this.cfg.YOUR_VIDEOS;d.messageNotFound=this.cfg.YOU_HAVE_NO_UPLOADED_VIDEOS;d.header=this.cfg.MY_VIDEOS;d.zuneTitle=this.cfg.NICKNAME_VIDEOS.format(h);d.showEditControls=true}else{d.type=SoapboxService.SearchType.User;d.messageFound=this.cfg.VIDEOS_UPLOADED_NICKNAME.format(h);d.messageNotFound=this.cfg.NO_VIDEOS_UPLOADED_NICKNAME.format(h);d.header=this.cfg.USER_CREATED_VIDEOS+" > "+this.cfg.BROWSE_SOAPBOX_VIDEOS+" > "+this.cfg.NICKNAME_VIDEOS.format(h);d.zuneTitle=this.cfg.NICKNAME_VIDEOS.format(h)}d.primaryMetadata=Msn.VideoMetadata.Views;d.secondaryMetadata=Msn.VideoMetadata.ReleaseDate;d.setSort(e);d.rssUrl=c+"/rss.aspx?userId="+d.term;d.extra=h;break;case SoapboxService.SearchType.Shared:d.queryDomain=Msn.Domain.Soapbox;v=q;h=checkString(g)?g:this.cfg.ANONYMOUS;if(v==Msn.Passport.getCid()&&Msn.Passport.isUserLoggedIn()){d.useCache=false;d.menuId=Msn.Menu.Videos;d.type=SoapboxService.SearchType.Shared;d.messageFound=this.cfg.SHARED_VIDEOS_PRIVATE;d.messageNotFound=this.cfg.YOU_HAVE_NO_SHARED_VIDEOS;d.header=this.cfg.SHARED_VIDEOS_PRIVATE;d.showSharedControls=true}d.primaryMetadata=Msn.VideoMetadata.Views;d.secondaryMetadata=Msn.VideoMetadata.ReleaseDate;d.setSort(e);d.extra=h;break}if(!checkString(d.headerToolTip))d.headerToolTip=d.header;return d};this.setExtendedSortEntries=function(a,c){if(c==SoapboxService.SortOrder.Default)if(a.type==SoapboxService.SearchType.Channel)a.setSort(SoapboxService.SortOrder.DateUploaded);else a.setSort(SoapboxService.SortOrder.parseFromUrl(a.term,c));var b=this.cfg.VIEWS+" ";a.sortLabelHash[SoapboxService.SortOrder.LastHour]=b+this.cfg.LAST_HOUR;a.sortLabelHash[SoapboxService.SortOrder.LastDay]={label:b+this.cfg.TODAY,choiceLabel:this.cfg.TODAY,indentLabel:b};a.sortLabelHash[SoapboxService.SortOrder.LastWeek]={label:b+this.cfg.THIS_WEEK,choiceLabel:this.cfg.THIS_WEEK,indentLabel:b};a.sortLabelHash[SoapboxService.SortOrder.LastMonth]={label:b+this.cfg.THIS_MONTH,choiceLabel:this.cfg.THIS_MONTH,indentLabel:b};a.sortLabelHash[SoapboxService.SortOrder.AllTimes]={label:b+this.cfg.ALL_TIME,choiceLabel:this.cfg.ALL_TIME,indentLabel:b};if(a.type==SoapboxService.SearchType.Taxonomy||a.type==SoapboxService.SearchType.Channel)if(a.videoDomain==Msn.Domain.Soapbox)a.sortEntries=[SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Rating,SoapboxService.SortOrder.LastHour,SoapboxService.SortOrder.LastDay,SoapboxService.SortOrder.LastWeek,SoapboxService.SortOrder.LastMonth,SoapboxService.SortOrder.AllTimes];else{a.sortEntries=[SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Default,SoapboxService.SortOrder.LastHour,SoapboxService.SortOrder.LastDay,SoapboxService.SortOrder.LastWeek,SoapboxService.SortOrder.LastMonth,SoapboxService.SortOrder.AllTimes];a.sortLabelHash[SoapboxService.SortOrder.Default]=this.cfg.ORIGINAL_ORDER}else if(a.videoDomain==Msn.Domain.Soapbox)a.sortEntries=[SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Rating,SoapboxService.SortOrder.Relevance,SoapboxService.SortOrder.LastHour,SoapboxService.SortOrder.LastDay,SoapboxService.SortOrder.LastWeek,SoapboxService.SortOrder.LastMonth,SoapboxService.SortOrder.AllTimes];else if(a.videoDomain==Msn.Domain.VideoCatalog)a.sortEntries=[SoapboxService.SortOrder.DateUploaded,SoapboxService.SortOrder.Relevance,SoapboxService.SortOrder.LastHour,SoapboxService.SortOrder.LastDay,SoapboxService.SortOrder.LastWeek,SoapboxService.SortOrder.LastMonth,SoapboxService.SortOrder.AllTimes]}};Msn.Domain=SoapboxService.Utils.CreateEnum("Soapbox",0,"VideoCatalog",1,"LiveSearch",2);Msn.UsageEventType=SoapboxService.Utils.CreateEnum("Played",1,"Emailed",2,"Rated",3,"Blogged",4,"Reviewed",5,"Bookmarked",6,"PlaybackFailed",7,"TimeSpent",8,"Recommended",9);Msn.UsageCounterType=SoapboxService.Utils.CreateEnum("Total",0,"Average",1,"Extended",2);Msn.FilterType=SoapboxService.Utils.CreateEnum("HasWmv",1,"HasFlash",2,"HasThumbnail",8,"HasMediumImg",16,"IsPublished",128);Msn.VideoTypeEnum=SoapboxService.Utils.CreateEnum("SoapboxAndMSNVideo",0,"SoapboxOnly",1,"MSNVideoOnly",2);Msn.Controls.SearchQueryService=function(a){var c=this,b=new Msn.Controls.VCAdapterHelper;this.cfg={SEARCH_NODE_ID:"searchInput",TAGS_RELATED_TO:$["IDS_CLI_TagsRelatedTo"],NO_RELATED_TAGS:$["IDS_CLI_NoRelatedTags"],RELATED_VIDEOS_ALG:$["IDS_GMT_RelatedVideosAlg"],ZUNE_PODCAST_IMG:getCDNPath("/i/zunePodcastCover.gif")};var f=0,d=null,e=null;this.getSearchResultFromCache=function(f){var d=Msn.Cache.get(a.getCacheKey());if(checkArray(d))for(var h=0;h<d.length;h++){var c=d[h],i=c.Offset,j=c.Offset+c.Count-1,e=a.page*f,l=(a.page+1)*f-1,k=j==c.TotalCount-1,b={};b.Videos=[];b.SearchKey=a.term;b.Offset=e;b.TotalCount=c.TotalCount;b.AltSearchText=c.AltSearchText;b.SearchType=a.type;if(e>=i){var g=e-i;if(l<=j)b.Videos=c.Videos.slice(g,g+f);else if(k)b.Videos=c.Videos.slice(g)}b.Count=b.Videos.length;if(b.TotalCount==0||b.Videos.length>0)return b}return null};this.updateSearchBox=function(){var b=document.getElementById(this.cfg.SEARCH_NODE_ID);if(b&&checkString(a.term))b.value=a.term};this.getPaginationParam=function(c){var b=a.page*c+1;if(a.type==SoapboxService.SearchType.ListRecent&&checkInt(Msn.Controls.config.RecentOffset,0))b+=Msn.Controls.config.RecentOffset;return "&ind="+b};this.getResultsPerPageParam=function(a){return "&ps="+a};this.getVCSortParam=function(){var d=this.getPrimaryVCSortParam(),c=this.getSecondaryVCSortParam(),b=this.getSortDirectionParam(),a="";a+=checkInt(d)?"&st="+d:"";a+=checkString(c)?"&sf="+c:"";a+=checkInt(b)?"&sd="+b:"";return a};this.getSortDirectionParam=function(){var b="";switch(a.type){case SoapboxService.SearchType.ListMostCommented:case SoapboxService.SearchType.ListTopFavorites:case SoapboxService.SearchType.ListTopRated:case SoapboxService.SearchType.ListPopular:case SoapboxService.SearchType.ListRecent:b=-1;break;default:var d=getUrlValue(a.term,"sf","Relevance"),c=this.getSecondaryVCSortParam();if(d==c)b=getUrlValue(a.term,"sd",-1);else b=-1;break}return b};this.getPrimaryVCSortParam=function(){switch(a.type){case SoapboxService.SearchType.ListMostCommented:return Msn.UsageEventType.Reviewed;case SoapboxService.SearchType.ListTopFavorites:return Msn.UsageEventType.Bookmarked;case SoapboxService.SearchType.ListTopRated:return Msn.UsageEventType.Rated;case SoapboxService.SearchType.ListPopular:return Msn.UsageEventType.Played;case SoapboxService.SearchType.Tag:if(SoapboxService.SortOrder.Default==a.sort)return Msn.UsageEventType.Recommended;default:switch(a.sort){case SoapboxService.SortOrder.LastHour:case SoapboxService.SortOrder.LastDay:case SoapboxService.SortOrder.LastWeek:case SoapboxService.SortOrder.LastMonth:case SoapboxService.SortOrder.AllTimes:var b=getUrlValue(a.term,"st",Msn.UsageEventType.Played);return b;case SoapboxService.SortOrder.Playcount:return Msn.UsageEventType.Played;case SoapboxService.SortOrder.Rating:return Msn.UsageEventType.Rated}break}return ""};this.getSecondaryVCSortParam=function(){switch(a.type){case SoapboxService.SearchType.ListRecent:return "ActiveStartDate";case SoapboxService.SearchType.Tag:if(SoapboxService.SortOrder.Default==a.sort)return "DailyCount";default:switch(a.sort){case SoapboxService.SortOrder.Playcount:return "TotalCount";case SoapboxService.SortOrder.Rating:return "TotalAverage";case SoapboxService.SortOrder.DateUploaded:return "ActiveStartDate";case SoapboxService.SortOrder.LastHour:return "HourlyCount";case SoapboxService.SortOrder.LastDay:return "DailyCount";case SoapboxService.SortOrder.LastWeek:return "WeeklyCount";case SoapboxService.SortOrder.LastMonth:return "MonthlyCount";case SoapboxService.SortOrder.AllTimes:if(a.type==SoapboxService.SearchType.ListTopRated)return "TotalAverage";return "TotalCount";case SoapboxService.SortOrder.Relevance:default:var b=getUrlValue(a.term,"sf","Relevance");return b}break}return ""};this.getUrlValue=function(c,b,a){return getUrlValue(c,b,a)};this.setUrlValue=function(c,b,a){return setUrlValue(c,b,a)};this.getUserZuneUrl=function(c){var e=new Msn.Controls.VCAdapterHelper,b=checkDefined(Msn.Application)?Msn.Application.getDocumentTitle()+": ":"";b+=checkString(a.zuneTitle)?a.zuneTitle:a.header;var d="{0}/videoByTag.aspx?mk={1}&ns=VC_Source&tag={2}&vs=0&sf=DateUploaded&sd=-1&ff=88&responseEncoding=rss&title={3}&template=zune&img={4}";return d.format(e.getRandomServer(c),encodeURIComponent(Msn.Controls.config.SoapboxMarket),encodeURIComponent(Msn.Controls.config.SoapboxCsId+":"+c),encodeURIComponent(b),encodeURIComponent(this.cfg.ZUNE_PODCAST_IMG))};this.makeRequest=function(g,z,l,H){var j=false;if(!checkInt(g,0))return;if(checkFunction(z))z();f=g;d=l;e=H;switch(a.queryDomain){case Msn.Domain.LiveSearch:Msn.LiveSearchRequestManager.makeRequest(a.term,g,a.page*g,this.searchCb,null,this.searchErrorCb);j=true;break;case Msn.Domain.Soapbox:var L=this.getPrimaryVCSortParam(),K=this.getSecondaryVCSortParam(),J=this.getSortDirectionParam();switch(a.type){case SoapboxService.SearchType.Optimization:var i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else Msn.SoapboxServiceManager.GetActivities(a.term,"",a.page*g,g,this.searchCb,this.searchErrorCb);j=true;break;case SoapboxService.SearchType.Favorites:i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else{var E=a.term==Msn.Passport.getCid()&&Msn.Passport.isUserLoggedIn()?true:false;Msn.SoapboxServiceManager.GetUserVideoListPrivate(a.term,E,VCService.UsageEventType.Bookmarked,g,a.page*g,isSoapboxEnabled()?Msn.VideoTypeEnum.SoapboxAndMSNVideo:Msn.VideoTypeEnum.MSNVideoOnly,this.searchCb,this.searchErrorCb)}j=true;break;case SoapboxService.SearchType.User:i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else Msn.SoapboxServiceManager.GetPublicUserVideos(a.term,g,a.page*g,this.searchCb,this.searchErrorCb);j=true;a.zuneUrl=this.getUserZuneUrl(a.term);break;case SoapboxService.SearchType.Shared:i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else Msn.SoapboxServiceManager.GetSharedUserVideos(g,a.page*g,this.searchCb,this.searchErrorCb);j=true;break;case SoapboxService.SearchType.AllVideos:i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else Msn.SoapboxServiceManager.GetAllUserVideos(g,a.page*g,this.searchCb,this.searchErrorCb);a.zuneUrl=this.getUserZuneUrl(Msn.Passport.getCid());j=true;break;default:break}break;case Msn.Domain.VideoCatalog:var h=null,A=b.getMarket(a.videoDomain),o="",m=a.term,t=this.getPaginationParam(g),s=this.getResultsPerPageParam(g),y=this.getVCSortParam(),w=b.getFilterParam(),D=b.getUsageParam(),F=b.getLCIDParam(),r=false;a.rssUrl=null;a.zuneUrl=null;switch(a.type){case SoapboxService.SearchType.Taxonomy:if(checkString(m)){h=m;if(!checkDefined(getUrlValue(m,"vs")))o="&vs=0";if(checkDefined(getUrlValue(m,"ff")))w="";if(checkDefined(getUrlValue(m,"ps")))s="";h=mergeUrlValue(h,y);h=mergeUrlValue(h,t);h+="{2}{4}{6}{7}"}break;case SoapboxService.SearchType.Keyword:if(m.trim()==""){var C={"SearchKey":"","Videos":new Array,"Count":0,"Offset":0,"TotalCount":0,"SearchType":a.type};l(C);j=true}else h="Search.aspx?mk={0}&q={1}{2}{3}{4}{5}{6}{7}{8}";o="";break;case SoapboxService.SearchType.Tag:var v=a.videoDomain==Msn.Domain.Soapbox?"User":"Public";h="VideoByTag.aspx?mk={0}&ns="+v+"&tag={1}{2}{3}{4}{5}{6}{7}";o="&vs=0";break;case SoapboxService.SearchType.Source:h="VideoByTag.aspx?mk={0}&ns=VC_Source&tag={1}{2}{3}{4}{5}{6}{7}";o="&vs=0";break;case SoapboxService.SearchType.Channel:h="VideoByTag.aspx?mk={0}&ns=Category,VideoScrubber&tag={1},done{2}{3}{4}{5}{6}{7}";o="&vs=0";break;case SoapboxService.SearchType.ListRecent:r=true;case SoapboxService.SearchType.ListMostCommented:case SoapboxService.SearchType.ListTopFavorites:case SoapboxService.SearchType.ListTopRated:case SoapboxService.SearchType.ListPopular:h="VideoByTag.aspx?mk={0}&ns=VideoScrubber&tag={1}{2}{3}{4}{5}{6}{7}";m="done";o="&vs=0";r=true;break;case SoapboxService.SearchType.Recommendations:h="RelatedVideos.aspx?mk={0}&uuids={1}"+c.cfg.RELATED_VIDEOS_ALG+"{2}{3}{4}{5}{6}{7}";break;case SoapboxService.SearchType.ListFeatured:case SoapboxService.SearchType.AllVideos:case SoapboxService.SearchType.User:case SoapboxService.SearchType.Shared:case SoapboxService.SearchType.Favorites:break}if(checkString(h)){h=h.format(A,encodeURIComponent(m),s,t,D,y,w,o,F);if(!checkDefined(a.rssUrl)){var B=checkDefined(Msn.Application)?Msn.Application.getDocumentTitle():"",k=this.setUrlValue(h,"rct","");k=this.setUrlValue(k,"ind","");k=this.setUrlValue(k,"ps","");k=this.setUrlValue(k,"responseEncoding","rss");k=this.setUrlValue(k,"title",encodeURIComponent(B+": "+a.header));a.rssUrl=Msn.VCRequestManager.makeRequestUrl(k)}if(!checkDefined(a.zuneUrl)&&!r&&a.videoDomain==Msn.Domain.Soapbox){var n=a.rssUrl;if(checkString(n)){var I=checkString(a.zuneTitle)?a.zuneTitle:a.header;n=this.setUrlValue(n,"title",B+": "+I);n=this.setUrlValue(n,"template","zune");n=this.setUrlValue(n,"img",this.cfg.ZUNE_PODCAST_IMG);a.zuneUrl=n}}i=this.getSearchResultFromCache(g);if(a.useCache&&checkDefined(i))l(i);else Msn.VCRequestManager.makeRequest(h,this.searchCb);j=true}else{a.rssUrl=null;a.zuneUrl=null}break}if(j){if(a.updateSearchBox)this.updateSearchBox();if(a.menuId!=undefined)Msn.Controls.fireEvent(Msn.Event.MenuSelect,{menuId:a.menuId});if(checkFunction(a.onCloudData))switch(a.cloudEntryType){case Msn.CloudEntryType.None:a.onCloudData(null);break;case Msn.CloudEntryType.Tags:var u=checkString(a.cloudTerm),x=u?a.cloudTerm:a.term,G="RelatedTags|"+parseInt(a.videoDomain)+"|"+x,q=Msn.Cache.get(G);if(checkDefined(q)){q.selection=u?{"name":a.term,"UIOnly":true}:null;a.onCloudData(q)}else{var v=a.videoDomain==Msn.Domain.Soapbox?"User":"Public",p="RelatedTags.aspx?mk={0}&tag={1}&ns={2}{3}";p=p.format(A,encodeURIComponent(x),v,b.getFilterParam());Msn.VCRequestManager.makeRequest(p,this.completeRelatedTagsCb)}break;case Msn.CloudEntryType.Categories:case Msn.CloudEntryType.Taxonomy:case Msn.CloudEntryType.Search:a.onCloudData(a.cloudData);break}}};this.searchCb=function(b){var j=new Msn.Controls.AdapterFactory,h=j.create(a.queryDomain);if(checkDefined(h)&&checkFunction(h.convertSearchResult))b=h.convertSearchResult(b,a);if(checkObject(b))if(b.Offset>0&&parseInt(b.Offset)>=parseInt(b.TotalCount)){a.page=b.TotalCount>0?Math.floor((b.TotalCount-1)/f):0;c.makeRequest(f,null,d,e)}else{var i=a.getCacheKey(),g=Msn.Cache.get(i);if(checkDefined(g)&&checkArray(g)&&a.useCache)g.push(g,b);else Msn.Cache.insert(i,[b]);if(checkFunction(d))d(b)}else c.searchErrorCb()};this.completeRelatedTagsCb=function(b){var f=new Msn.Controls.AdapterFactory,e=f.create(a.queryDomain);if(checkDefined(e)&&checkFunction(e.convertRelatedTagsResult))b=e.convertRelatedTagsResult(b,a);var h="RelatedTags|"+parseInt(a.videoDomain)+"|"+a.term,d={"title":c.cfg.TAGS_RELATED_TO.format(a.term),"noEntryLabel":c.cfg.NO_RELATED_TAGS,"entries":b};Msn.Cache.insert(h,d);if(checkFunction(a.onCloudData)){var g=checkString(a.cloudTerm);d.selection=g?{"name":a.term,"UIOnly":true}:null;a.onCloudData(d)}};this.searchErrorCb=function(){if(checkFunction(e))e()}};Msn.Controls.SearchResultPanel=function(s,x,m,u,o,n,w){var e=this,t=false,p,d,r=false,v=false,i=0,a=null,b=null,q="",h=new Msn.Controls.LiteralHTML("","searchContainerContentSpacing"),f=null,k=null,l=null,c=[];this.cfg={ENABLE_PLAYALL:$["IDS_GMT_EnablePlayAll"],ERROR_MSG:$["IDS_CLI_ErrorMsg"],FAILED_DELETE:$["IDS_CLI_RemoveFailed"],VIDEO:$["IDS_CLI_Video"],VIDEOS:$["IDS_CLI_Videos"]};this.subscribeEvent(Msn.Event.VideoUpdated);this.subscribeEvent(Msn.Event.FavsUpdatedData);this.subscribeEvent(Msn.Event.VideoSharedUpdatedData);this.subscribeEvent(Msn.Event.SearchColumnCountChanged);this.subscribeEvent(Msn.Event.SearchColumnMarginChanged);this.onEvent=function(d,c,b){switch(c){case Msn.Event.VideoUpdated:if(checkDefined(a)&&a.type==SoapboxService.SearchType.AllVideos&&a.term==Msn.Passport.getCid())this.refresh();break;case Msn.Event.FavsUpdatedData:if(checkDefined(a)&&a.type==SoapboxService.SearchType.Favorites&&a.term==Msn.Passport.getCid())this.refresh();break;case Msn.Event.VideoSharedUpdatedData:if(checkDefined(a)&&a.type==SoapboxService.SearchType.Shared&&a.term==Msn.Passport.getCid())this.refresh();break;case Msn.Event.SearchColumnCountChanged:if(o&&!n)this.refreshColumnCount(b.columnCount);case Msn.Event.SearchColumnMarginChanged:if(o&&!n)this.refreshColumnMargin(b.marginWidth);break}};this.refreshPreviews=function(){for(var a=0;a<d;a++){if(!checkDefined(c[a])){c[a]=new Msn.Controls.VideoPreview(u,w);if(checkDefined(k)){c[a].render(k);c[a].clear()}}var b=(a+1)%p==0;c[a].setLastColumnItem(b)}for(a=d;a<c.length;a++)c[a].clear()};this.refreshColumnCount=function(a){p=o?checkInt(a)?a:getColumnData().columnCount:s;d=p*x;this.refreshPreviews()};this.refreshColumnMargin=function(b){b=checkDefined(b)?b:getColumnData().marginWidth;if(o)for(var a=0;a<d;a++)if(checkDefined(c[a])){var e=a%p==0;c[a].setLeftMargin(e?0:b)}};this.onPageClick=function(d,c){var b=a.clone();b.page=c;b.addHistoryEntry=true;e.setSearchQuery(b);e.fireEvent(Msn.Event.NextPageSearch,b);return false};var g=new Msn.Controls.Pagination(this.onPageClick,d,false),j=new Msn.Controls.Pagination(this.onPageClick,d,true);this.getSearchQuery=function(){return a};this.refresh=function(){if(checkDefined(a)){var b=a.clone();b.disableMenuSelect();b.disableHistoryEntry();this.setSearchQuery(b)}};this.setContainerProperty=function(e,a,c,d){if(checkDefined(e))b=e;if(checkString(a))q=a;if(checkDefined(c))r=c;if(checkDefined(d))v=d};this.clear=function(b){for(var a=0;a<b.length;a++)b[a].clear();this.refreshColumnCount()};this.setSearchQuery=function(b){if(!t){t=true;this.refreshColumnCount(n?s:undefined);this.refreshColumnMargin(n?0:undefined)}if(checkObject(b)&&b.check()){a=b;var c=new Msn.Controls.SearchQueryService(a);c.makeRequest(d,this.onSearchBegin,this.onSearchComplete,this.onSearchError)}};this.onSearchBegin=function(){if(a.clearResultsOnBegin){for(var e=0;e<d;e++)c[e].clear();if(m){g.showPagination(false);g.showSort(false);j.showPagination(false)}if(checkDefined(b)){if(checkString(a.header))b.setTitle(a.header,a.headerTooltip);if(checkFunction(b.showPlayAll))b.showPlayAll(false)}if(checkString(a.messageLoading)){h.setText(a.messageLoading);h.setVisibility(true)}}if(checkFunction(a.onBegin))a.onBegin()};this.onSearchComplete=function(k){if(checkDefined(l))l.style.display="inline";if(checkDefined(f))f.style.display="inline";if(checkDefined(k)){if(checkFunction(a.onComplete))a.onComplete(k);i=k.TotalCount;var s=a.clone();s.term=k.AltSearchText;s.page=0;Msn.Controls.fireEvent(Msn.Event.SearchCompleted,{originalTerm:a.term,alternateSearchQuery:s});for(var o=0;o<d;o++){var n=c[o];if(checkDefined(k.Videos)&&o<k.Videos.length){n.setShowEditControls(a.showEditControls);n.setShowSharedControl(a.showSharedControls);n.setShowFavControls(a.showFavControls);n.setOnItemEdit(e.onItemEdit);n.setOnItemDelete(e.onItemDelete);n.setMetadataData(a.primaryMetadata,a.secondaryMetadata,a.sort);n.setVideo(k.Videos[o])}else c[o].clear()}if(checkDefined(b)){if(checkString(q)){var u=a.header,t=checkString(a.headerTooltip)?a.headerTooltip:a.header;if(!checkFunction(b.setCount)&&a.headerShowCount&&checkInt(i)){var v=i==1?e.cfg.VIDEO:e.cfg.VIDEOS,p=" ({0} {1})";p=p.format(i,v);u+=p;t+=p}b.setTitle(u,t)}if(checkFunction(b.setCount))b.setCount(i);b.setRssUrl(a.rssUrl,a.zuneUrl);if(checkFunction(b.showPlayAll))b.showPlayAll(a.playAll&&isTrue(e.cfg.ENABLE_PLAYALL))}if(r&&a.sortEntries.length>0){g.setSort(a);g.showSort(true)}else g.showSort(false);if(m){g.setPosition(k.Offset,d,i);g.showPagination(true);j.setPosition(k.Offset,d,i);j.showPagination(true)}if(0==i)if(checkString(a.messageNotFound)){h.setText(a.messageNotFound);h.setVisibility(true);if(checkDefined(f))f.style.display="none"}else{if(checkDefined(l))l.style.display="none";h.setVisibility(false)}else{h.setText("");h.setVisibility(false)}}else{h.setText(e.cfg.ERROR_MSG);h.setVisibility(true);if(checkDefined(b)){if(checkString(q))b.setTitle(a.header,a.headerTooltip);b.setRssUrl(a.rssUrl,a.zuneUrl);if(checkFunction(b.showPlayAll))b.showPlayAll(false)}g.showPagination(false);g.showSort(false);j.showPagination(false);if(checkDefined(f))f.style.display="none"}};this.onPlayAll=function(){for(var a=0;a<d;a++){var b=c[a];if(b)b.addToPlaylist(true)}};this.onSearchError=function(){e.onSearchComplete()};this.onItemEdit=function(a){if(checkDefined(a)&&checkString(a.Id)){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"videoedit"});Msn.Controls.fireEvent(Msn.Event.VideoEdit,a.Id)}};this.onItemDelete=function(a){if(checkDefined(a)&&checkString(a.Id)){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"videodelete"});Msn.SoapboxServiceManager.DeleteVideo(a.Id,e.onDeleteCb,e.onDeleteErrorCb)}};this.onDeleteCb=function(a){if(checkDefined(a)&&checkDefined(a.StatusCode))if(SoapboxService.ResultCode.Success==a.StatusCode||SoapboxService.ResultCode.ABCHServiceDownRetry==a.StatusCode)Msn.Controls.fireEvent(Msn.Event.VideoDeleted,a.VideoId);else e.onDeleteErrorCb()};this.onDeleteErrorCb=function(){customAlert(e.cfg.FAILED_DELETE)};this._render=function(b){if(null!=b){l=b;h.render(b);f=document.createElement("DIV");if(m)g.render(f);var e=document.createElement("DIV");k=document.createElement("DIV");e.appendChild(k);f.appendChild(e);var a=0;while(a<d&&a<c.length){c[a].render(k);a++}if(m){e.appendChild(document.createElement("BR"));j.render(f)}b.appendChild(f)}}};Msn.Controls.SearchResultPanel.prototype=Msn.Controls;Msn.Controls.SearchResultsPage=function(showcaseSize){var that=this,_numSearchResultsRow=4;this.subscribeEvent(Msn.Event.Search);this.onEvent=function(f,e,d){if(e==Msn.Event.Search){var a=d,b=a.showcaseData,c=checkDefined(b)?b.showcaseSize:undefined;if(c==showcaseSize){a.setOnCloudData(this.onCloudData);_srp.setContainerProperty(_srpContainer,a.header,true,true);_srp.setSearchQuery(a);_srpContainer.setRssUrl(a.rssUrl,a.zuneUrl)}}};this.cfg={RELATED_TAGS:$["IDS_CLI_RelatedTags"]};switch(showcaseSize){case Msn.ShowcaseSize.Large:_numSearchResultsRow=2;break;case Msn.ShowcaseSize.Small:_numSearchResultsRow=3;break}var _srp=new Msn.Controls.SearchResultPanel(4,_numSearchResultsRow,true,false,true,false,false),_srpContainer=new Msn.Controls.Container(true,true,"",false,false),_cloudContainer=new Msn.Controls.SplitContainer(true,true,this.cfg.RELATED_TAGS,false),_cloud=new Msn.Controls.Cloud;_cloud.setAlphaSort(false);_cloud.setEntryClassname("searchTypeSelected","searchTypeUnselected");_cloud.setDelimiter("|");var _cloudElt=null,_vc=new Msn.Controls.VideoService,_videos=null,_videosUrl=null;this.getSearchQuery=function(){return _srp.getSearchQuery()};this.onCloudEntryClick=function(type,name,data){if(checkDefined(type)&&checkDefined(name))switch(type){case Msn.CloudEntryType.Tags:var query=Msn.Controls.SearchQueryFactory.create(name,SoapboxService.SearchType.Tag,0,SoapboxService.SortOrder.Default,data),currentQuery=_srp.getSearchQuery();if(checkDefined(currentQuery)){var cloudTerm=checkString(currentQuery.cloudTerm)?currentQuery.cloudTerm:currentQuery.term;query.setCloudTerm(cloudTerm)}that.fireEvent(Msn.Event.Search,query);break;case Msn.CloudEntryType.Categories:var categoryMenuId=eval("Msn.Menu."+name.replace(/ /g,""));if(checkInt(categoryMenuId,0))that.fireEvent(Msn.Event.MenuClick,{menuId:categoryMenuId});break;case Msn.CloudEntryType.Taxonomy:var menuId=data;if(checkString(menuId)&&checkDefined(Msn.MenuManager)){var menuControl=Msn.MenuManager.getMatchingMenuControl(menuId,true);if(checkDefined(menuControl)){var menuObject=menuControl.getMenuObject();if(checkDefined(menuObject)){menuItem=menuObject.getHashNode(menuId);that.fireEvent(Msn.Event.MenuClick,{menuId:menuItem})}}}break;case Msn.CloudEntryType.Search:var term=data.term;if(checkDefined(term)){var domain=data.domain;if(checkInt(domain)){query=Msn.Controls.SearchQueryFactory.create(term,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,domain);that.fireEvent(Msn.Event.Search,query)}else that.fireEvent(Msn.Event.SplitSearch,term)}break}};this.onCloudData=function(a){var c=false;if(checkObject(a)&&checkString(a.title)&&checkObject(a.entries)){c=true;_cloudContainer.setTitle(a.title);_cloud.setEntries(a.entries,a.noEntryLabel);if(checkObject(a.selection)){var b=a.selection;if(checkString(b.name))_cloud.selectByName(b.name,b.UIOnly);else if(checkInt(a.selection.index))_cloud.selectByIndex(b.index,b.UIOnly)}}if(checkDefined(_cloudElt))_cloudElt.style.display=c?"block":"none"};_srpContainer.showRss(true);_srpContainer.showViewAll(false);_srpContainer.setContent(_srp);_cloud.setOnEntryClick(this.onCloudEntryClick);_cloudContainer.setContent(_cloud);_cloudContainer.showViewAll(false);this._render=function(a){if(null!=a){_cloudElt=document.createElement("SPAN");_cloudContainer.render(_cloudElt);_cloudElt.appendChild(document.createElement("BR"));_cloudElt.style.display="none";a.appendChild(_cloudElt);var b=document.createElement("DIV");_srpContainer.render(b);a.appendChild(b)}}};Msn.Controls.SearchResultsPage.prototype=Msn.Controls;Msn.Controls.Share=function(){var i=this;this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};this.cfg={NICKNAME_LENGTH:24,FROM:$["IDS_CLI_From"],ADDED:$["IDS_CLI_Added"],VIEWS:$["IDS_CLI_Views"],RATE_THIS_VIDEO:$["IDS_CLI_RateThisVideo"]};var e=null,a=null,h=new Msn.Controls.VideoPanelRemoteControl,g=new Msn.Controls.PermaLinkEmbed,f=new Msn.Controls.Rating(true),c=null,b=null,d=null;this.setVideo=function(g){if(checkDefined(g)&&checkString(g.Video.Id)&&g.Video.CsId==Msn.Controls.config.SoapboxCsId){e=g;a=g.Video;f.setWebVideo(g);if(null!=b){b.innerText=ll(a.OwnerNickname,this.cfg.NICKNAME_LENGTH);b.title=a.OwnerNickname}if(null!=c)c.innerText=formatDate(a.ReleaseDate);if(null!=d)d.innerText=a.PlayCount+" "}};this.onUserProfileClick=function(){if(null!=a){var b={};b.cid=a.OwnerId;b.nickname=a.OwnerNickname;i.fireEvent(Msn.Event.ViewProfile,b)}return false};this._render=function(k){var j,i,a;if(null!=k){a=document.createElement("DIV");if(this.getBrowser()!=Msn.Browser.IE)a.style.paddingLeft="5px";i=document.createElement("B");i.appendChild(document.createTextNode(this.cfg.FROM));a.appendChild(i);j=document.createElement("A");j.style.cursor="pointer";j.href=this.getLinkHref();b=document.createElement("B");j.appendChild(b);a.appendChild(j);this.addListener(j,"onclick",this.onUserProfileClick);a.appendChild(document.createElement("BR"));i=document.createElement("B");j=document.createTextNode(this.cfg.ADDED);i.appendChild(j);a.appendChild(i);c=document.createElement("SPAN");a.appendChild(c);a.appendChild(document.createElement("BR"));i=document.createElement("B");j=document.createTextNode(this.cfg.VIEWS);i.appendChild(j);a.appendChild(i);d=document.createElement("SPAN");a.appendChild(d);a.appendChild(document.createElement("BR"));i=document.createElement("B");j=document.createTextNode(this.cfg.RATE_THIS_VIDEO);i.appendChild(j);a.appendChild(i);f.render(a);a.appendChild(document.createElement("BR"));g.render(a);h.render(a);k.appendChild(a);if(null!=e)this.setVideo(e)}}};Msn.Controls.Share.prototype=Msn.Controls;Msn.ShowcaseSize=SoapboxService.Utils.CreateEnum("Small","small","Large","large");Msn.ShowcaseDesign=SoapboxService.Utils.CreateEnum("BlueFlash","blue","PosterFrame","posterframe","CommunityWidget","communitywidget","GenericFlash","genericflash","GenericSilverlight","genericsilverlight");Msn.ShowcaseObjectType=SoapboxService.Utils.CreateEnum("Flash",0,"Silverlight",1);Msn.Controls.Showcase=function(){var a=this;this.subscribeEvent(Msn.Event.WindowResize);this.subscribeEvent(Msn.Event.ShowCaseLoaded);this.subscribeEvent(Msn.Event.MenuSelect);this.onEvent=function(c,b,a){switch(b){case Msn.Event.WindowResize:this.resize();break;case Msn.Event.ShowCaseLoaded:this.onShowcaseLoaded();break;case Msn.Event.MenuSelect:if(o&&a.menuId!=l){Msn.WidgetFramework.sendMessage("TAB_CHANGED",a,null,null);l=a.menuId}break}};this.onWidgetEvent=function(d,b,e){switch(d){case "LOADED":if("flashShowcase"==e){o=true;var c=a.getTabId();if(c!=i){i=null;Msn.WidgetFramework.sendMessage("TAB_CHANGED",{menuId:c},null,null);l=c}}break;case "PLAY":Msn.ExternalInterface.onPlayVideo(b.videoId,b.cbData,b.reportingSrc);if("comment"==b.panel)setTimeout(function(){a.fireEvent(Msn.Event.VideoPanelViewChange,Msn.VideoPanel.Comment)},500);break;case "QUEUE":Msn.ExternalInterface.onQueueVideo(b.videoId,b.cbData,b.reportingSrc);break}};Msn.WidgetFramework.addListener("LOADED",this.onWidgetEvent);Msn.WidgetFramework.addListener("PLAY",this.onWidgetEvent);Msn.WidgetFramework.addListener("QUEUE",this.onWidgetEvent);this.cfg={RELATED_TAGS:$["IDS_CLI_RelatedTags"],SHOWCASE_SMALL_HEIGHT:208,SHOWCASE_LARGE_HEIGHT:414,SHOWCASE_POSTERFRAME_URI:Msn.Controls.config.posterFrameShowcaseUri,SHOWCASE_COMMUNITYWIDGET_URI:Msn.Controls.config.communityWidgetShowcaseUri,SHOWCASE_BLUEFLASH_URI:Msn.Controls.config.blueShowcaseUri};var b=null,e=null,j,m,g,d,c,p,f,o=false,i,l,v=new Msn.Controls.VideoService,n=true,k=null,s=null,u=new Msn.Controls.VCAdapterHelper,t=u.getServer(),q="",r="";if(checkArray(Msn.Controls.config.VCServiceUrlsRandom,1))for(var h=0;h<Msn.Controls.config.VCServiceUrlsRandom.length;h++){q+=(h>0?",":"")+Msn.Controls.config.VCServiceUrlsRandom[h];r+=(h>0?" ":"")+Msn.Controls.config.VCServiceUrlsRandom[h]}this.hideShowcase=function(){if(checkDefined(e)){n=false;e.style.display="none"}};this.showShowcase=function(){if(checkDefined(e)){n=true;e.style.display="block"}};this.getTabId=function(){var b="";if(checkDefined(Msn.MenuManager)){var a=Msn.MenuManager.getSelectedMenuItem();if(checkObject(a))b=a.$id}return b};this.setShowcaseProperty=function(b){if(checkDefined(b)){c=checkString(b.showcaseMediaUrl)?b.showcaseMediaUrl:a.cfg.SHOWCASE_POSTERFRAME_URI;c=c.replace(/activitywidget.swf/i,"ActivityWidget2.swf");p=checkString(b.showcaseFallbackMediaUrl)?b.showcaseFallbackMediaUrl:a.cfg.SHOWCASE_POSTERFRAME_URI;var i=checkDefined(b.showcaseSize)?b.showcaseSize.toLowerCase():Msn.ShowcaseSize.Small;switch(i){case Msn.ShowcaseSize.Large:j=Msn.ShowcaseSize.Large;m=a.cfg.SHOWCASE_LARGE_HEIGHT;break;case Msn.ShowcaseSize.Small:default:j=Msn.ShowcaseSize.Small;m=a.cfg.SHOWCASE_SMALL_HEIGHT;break}var h=checkDefined(b.showcaseDesign)?b.showcaseDesign.toLowerCase():Msn.ShowcaseDesign.PosterFrame;switch(h){case Msn.ShowcaseDesign.BlueFlash:g=Msn.ShowcaseDesign.BlueFlash;d=Msn.ShowcaseObjectType.Flash;c=a.cfg.SHOWCASE_BLUEFLASH_URI;f=10;break;case Msn.ShowcaseDesign.CommunityWidget:g=Msn.ShowcaseDesign.CommunityWidget;d=Msn.ShowcaseObjectType.Flash;c=a.cfg.SHOWCASE_COMMUNITYWIDGET_URI;f=100;break;case Msn.ShowcaseDesign.GenericFlash:g=Msn.ShowcaseDesign.GenericFlash;d=Msn.ShowcaseObjectType.Flash;f=5;break;case Msn.ShowcaseDesign.GenericSilverlight:if(isSilverlightInstalled()){g=Msn.ShowcaseDesign.GenericSilverlight;d=Msn.ShowcaseObjectType.Silverlight;f=20}else{c=p;g=Msn.ShowcaseDesign.GenericFlash;d=Msn.ShowcaseObjectType.Flash;f=5}break;case Msn.ShowcaseDesign.PosterFrame:default:g=Msn.ShowcaseDesign.PosterFrame;d=Msn.ShowcaseObjectType.Flash;c=a.cfg.SHOWCASE_POSTERFRAME_URI;f=5;break}var e=getUrlParam("showcaseUrl");if(checkString(e)){c=e;g=Msn.ShowcaseDesign.GenericSilverlight;d=Msn.ShowcaseObjectType.Silverlight;j=Msn.ShowcaseSize.Small;m=a.cfg.SHOWCASE_SMALL_HEIGHT;f=20}}else c=null};this.setShowcaseData=function(b){var l=c,i=j;this.setShowcaseProperty(b);if(l!=c||i!=j)this.render();if(checkDefined(b)){OPPlat.clear();if(b.url.toLowerCase()=="optimize"){OPPlat.setBucketKey(g);var f=Msn.Controls.config.market,h=a.getTabId();if(checkDefined(h))f=f+"|"+h;var d=Msn.Controls.SearchQueryFactory.create(f,SoapboxService.SearchType.Optimization,0,SoapboxService.SortOrder.Default);d.disableMenuSelect();d.disableHistoryEntry();d.useCache=true;var m=new Msn.Controls.SearchQueryService(d);m.makeRequest(10,null,this.onActivityDataLoaded,null)}else if(checkString(b.url)){var e=a.wrapVCUrl(b.url);if(e!=s){s=e;k=null;v.getVideosFromServiceUrl(e,null,a.onShowcaseDataLoaded,a.hideShowcase)}}}};this.renderSilverlightShowcase=function(a,d,c){b=new Msn.Controls.SilverlightObject("silverlightShowcase",a,d,c,"",true);b.setInitParams("mkt="+Msn.Controls.config.market+",brand="+Msn.Controls.config.brand+",vc="+t+",vce="+r+",cbprefix=Msn.ExternalInterface."+",cbdata=silverlightShowcase"+",affid="+getUrlParam("ocid"));b.render(e)};this.renderFlashShowcase=function(j,m,k){o=false;b=new Msn.Controls.FlashObject("flashShowcase",j,m,k);i=this.getTabId();l=i;var a="mkt="+Msn.Controls.config.market+"&brand="+Msn.Controls.config.brand+"&id=flashShowcase"+"&tab="+i+"&vc="+t+"&vce="+q+"&cbprefix=Msn.ExternalInterface."+"&cbdata=flashShowcase"+"&affid="+getUrlParam("ocid")+"&referrer="+document.referrer,f=getUrlParam("from");if(checkString(f))a+="&from="+f;var g=getUrlParam("fg");if(checkString(g))a+="&fg="+g;var h=getUrlParam("tk");if(checkString(h))a+="&tk="+h;var c=getUrlParam("d");if(!checkString(c))c=location.host;if(checkString(c)&&c!="/")a+="&d="+c;var d=getUrlParam("r");if(!checkString(d))d=getCDNPath("/");if(checkString(d)&&d!="/")a+="&r="+d;b.setFlashVars(a);b.render(e)};this.onActivityDataLoaded=function(h){var c=h.Videos;for(var b=0;b<c.length;b++){var g=c[b].Tags;for(var f=0;f<g.length;f++){var d=g[f].Name.toLowerCase(),e=d.indexOf("op:");if(e==0){OPPlat.add(c[b].Id,d.substring(3));if(b<5)OPPlat.reportView(c[b].Id)}else{e=d.indexOf("opsource:");if(e==0)c[b].Source=d.substring(9)}}}a.onShowcaseDataLoaded(h.Videos)};this.onShowcaseDataLoaded=function(c){k=c;if(checkDefined(e))if(checkArray(c,1))try{if(d==Msn.ShowcaseObjectType.Silverlight){if(checkDefined(b.getObjectNode().childNodes[0].Content.Page))b.getObjectNode().childNodes[0].Content.Page.loadVideoObjects(c)}else if(checkFunction(b.getObjectNode().loadVideoObjects))b.getObjectNode().loadVideoObjects(c)}catch(f){}else{k=[];a.hideShowcase()}};this.onShowcaseLoaded=function(){setTimeout(function(){if(k!=null)a.onShowcaseDataLoaded(k)},10)};this.wrapVCUrl=function(a){var d=getUrlValue(a,"ps",f);a=setUrlValue(a,"ps",d);var b=new Msn.Controls.VCAdapterHelper,c=parseInt(getUrlValue(a,"ff","0"),16)|b.getFilterParamNum()|Msn.FilterType.HasMediumImg;return setUrlValue(a,"ff",c.toString(16))};this.resize=function(){if(checkDefined(b))if(this.getBrowser()==Msn.Browser.IE)b.getObjectNode().width=getColumnData().availWidth;else{var a=n;if(a)this.hideShowcase();b.getObjectNode().width=getColumnData().availWidth;if(a)this.showShowcase()}};this._render=function(g){if(null!=g){if(checkDefined(b))b.dispose();e=document.createElement("DIV");g.appendChild(e);if(checkString(c)){var h=getColumnData().availWidth,f=m,a=c;switch(d){case Msn.ShowcaseObjectType.Flash:this.renderFlashShowcase(a,h,f);break;case Msn.ShowcaseObjectType.Silverlight:this.renderSilverlightShowcase(a,h,f);break}}}}};Msn.Controls.Showcase.prototype=Msn.Controls;Msn.Controls.SilverlightInstallDialog=function(){var f=this,d=false,c,a,g,k,b,e,h,i="",j="";this.cfg={LEARN_MORE_LINK:$["IDS_GMT_SL_LearnMoreLink"],LICENSE_AGREEMENT_LINK:$["IDS_GMT_SL_LicenseAgreementLink"],DOWNLOAD_NOW:$["IDS_CLI_DownloadNow"],SL_DESC1:$["IDS_CLI_SL_Description1"],SL_DESC2:$["IDS_CLI_SL_Description2"],SL_DESC3:$["IDS_CLI_SL_Description3"],PAGE_REFRESH:$["IDS_CLI_SL_InstallPageRefresh"],LEARN_MORE_TEXT:$["IDS_CLI_SL_LearnMore"],LICENSE_AGREEMENT_TEXT:$["IDS_CLI_SL_LicenseAgreement"],TITLE:$["IDS_CLI_SL_Title"],CLOSE_BUTTON:getCDNPath("/i/slInstallClose.jpg"),CLOSE:$["IDS_CLI_Close"]};this.subscribeEvent(Msn.Event.SilverlightInstall);this.subscribeEvent(Msn.Event.WindowResize);this.onEvent=function(b,a){switch(a){case Msn.Event.SilverlightInstall:this.show();break;case Msn.Event.WindowResize:this.onResize();break}};this.show=function(){if(!d){this.fireEvent(Msn.Event.DialogBoxActive);this.fireEvent(Msn.Event.SetAutoProgress,false);this.setVisibility(true);if(checkDefined(b))b.focus()}};this.hide=function(){if(d){this.setVisibility(false);this.fireEvent(Msn.Event.DialogBoxInActive);this.fireEvent(Msn.Event.SetAutoProgress,true)}};this.onClicked=function(b,a){if(a){f.onReport("DownloadClick");installSilverlight()}else f.onReport("CloseClick");f.hide()};this.onKeyDown=function(b,a){if(event.keyCode==27||event.keyCode==13){if(event.keyCode==27)a=false;this.onClicked(b,a)}};this.setVisibility=function(b){d=b;if(checkDefined(c)&&checkDefined(a)){c.style.visibility=d?"visible":"hidden";c.style.display=d?"inline":"none";a.style.visibility=d?"visible":"hidden";a.style.display=d?"inline":"none"}else if(d)this.render()};this.onResize=function(){if(checkDefined(c)&&checkDefined(a)&&document.documentElement){var d=d<document.documentElement.clientHeight?document.documentElement.clientHeight:document.documentElement.scrollHeight,b=b<document.documentElement.clientWidth?b=document.documentElement.clientWidth:document.documentElement.scrollWidth,e=document.documentElement.scrollLeft+Math.floor(Math.max((document.documentElement.clientWidth-907)/2,10)),f=document.documentElement.scrollTop+Math.floor(Math.max((document.documentElement.clientHeight-599)/2,10));c.style.width=Math.max(b,1000)+"px";c.style.height=Math.max(d,800)+"px";a.style.top=f+"px";a.style.left=e+"px"}};this.onReport=function(a){if(checkDefined(a)){var b="ms:SLinstall:"+a;Msn.Reporting.silverlightInstall(b)}return true};this._render=function(j){if(null!=j&&d){c=document.createElement("DIV");c.className="slInstallDialogMain";c.style.visibility="visible";a=document.createElement("DIV");a.className="slInstallDialogBox";a.style.visibility="visible";e=document.createElement("IMG");Msn.ImageLoader.Load(this.cfg.CLOSE_BUTTON,e);e.alt=e.title=this.cfg.CLOSE;e.className="slCloseButton";this.addListener(e,"onclick",this.onClicked,false);this.addListener(e,"onkeydown",this.onKeyDown,false);var i=document.createElement("DIV");i.className="slInstallTitle";i.appendChild(document.createTextNode(this.cfg.TITLE));var g=document.createElement("DIV");g.className="slInstallDesc";g.appendChild(document.createTextNode(this.cfg.SL_DESC1));g.appendChild(document.createElement("BR"));g.appendChild(document.createTextNode(this.cfg.SL_DESC2));g.appendChild(document.createElement("BR"));g.appendChild(document.createTextNode(this.cfg.SL_DESC3));b=document.createElement("DIV");b.className="slDownloadButton";b.appendChild(document.createTextNode(this.cfg.DOWNLOAD_NOW));b.alt=b.title=this.cfg.DOWNLOAD_NOW;this.addListener(b,"onclick",this.onClicked,true);this.addListener(b,"onkeydown",this.onKeyDown,true);var h=document.createElement("DIV");h.className="slFooterText";if(checkString(this.cfg.LEARN_MORE_TEXT)&&checkString(this.cfg.LEARN_MORE_LINK)){learnMoreLinkCtrl=new Msn.Controls.Link(this.cfg.LEARN_MORE_TEXT,function(){f.onReport("LearnMore");openStandardWindow(f.cfg.LEARN_MORE_LINK,"_blank")},"",true);learnMoreLinkCtrl.render(h);h.appendChild(document.createElement("BR"))}if(checkString(this.cfg.LICENSE_AGREEMENT_TEXT)&&checkString(this.cfg.LICENSE_AGREEMENT_LINK)){licenseAgreementLinkCtrl=new Msn.Controls.Link(this.cfg.LICENSE_AGREEMENT_TEXT,function(){f.onReport("License");openStandardWindow(f.cfg.LICENSE_AGREEMENT_LINK,"_blank")},"",true);licenseAgreementLinkCtrl.render(h)}a.appendChild(e);a.appendChild(i);a.appendChild(g);a.appendChild(b);a.appendChild(h);j.appendChild(c);j.appendChild(a);this.onResize()}}};Msn.Controls.SilverlightInstallDialog.prototype=Msn.Controls;Msn.Controls.SilverlightObject=function(g,p,d,c,h,n){this.cfg={INPLACE_INSTALL_PROMPT:true,WINDOWLESS:"true",BACKGROUND:"#000000",FRAMERATE:"30",SILVERLIGHT_MIN_VERSION:Msn.Controls.config.silverlightMinVersion};var r=this,a=null,b=p,l=this.cfg.FRAMERATE,j=checkString(h)?h:this.cfg.BACKGROUND,k=this.cfg.WINDOWLESS,i=this.cfg.INPLACE_INSTALL_PROMPT,e="",f="",o="onSilverlightError",m=this.cfg.SILVERLIGHT_MIN_VERSION;this.getObjectNode=function(){return a};this.setOnLoad=function(a){if(checkString(a))f=a};this.setInitParams=function(a){if(checkString(a))e=a};var q=function(c){var a,b="";if(checkString(c))for(var d=0;d<c.length;d++){a=c.charCodeAt(d);if(a>96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};this.createSilverlight=function(){if(checkInt(d,0)&&checkInt(c,0)&&checkString(b)&&checkString(g)){var h=""+d+"",p=""+c+"";if(n)h="100%";Silverlight.createObject(b,a,g,{width:h,height:p,inplaceInstallPrompt:i,background:j,isWindowless:k,framerate:l,version:m,enableHtmlAccess:"true"},{onError:o,onLoad:f},e,null)}};this._render=function(e){if(null!=e&&checkInt(d,0)&&checkInt(c,0)&&checkString(b)){a=document.createElement("DIV");this.createSilverlight();e.appendChild(a)}}};Msn.Controls.SilverlightObject.prototype=Msn.Controls;function onSilverlightError(e,b){var d=b.ErrorCode,c=b.ErrorType,a="\nSilverlight error message     \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+"       \n";a+="Message: "+b.ErrorMessage+"     \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+"     \n";a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}a+="MethodName: "+b.methodName+"     \n"}Msn.Controls.log("silverlight",a)}Msn.Controls.SilverlightPlayer=function(p,o,n){var b=this,g=p,f=o,m=true,l=1,c=n,q,k=null,d,a,e,h=false,i=true,j=false;if(!checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer=this;this.subscribeEvent(Msn.Event.ApplicationTick);this.onEvent=function(){if(checkDefined(a)){var b=a.Position.Seconds;if(checkInt(b))c.getObjectNode().SL_broadcast("onPlayheadUpdate",b)}};this.load=function(n){if(checkObject(n)&&checkDefined(d)){b.close();b.log("mediaPlayer","[SilverlightPlayer] loading video: "+n.Id+", "+n.Url);h=true;i=true;j=false;e=[];var c=function(c,d){var f=a.addEventListener(c,delegate(b,b[d]));e.push({evt:c,id:f})};a=k.content.createFromXaml("<MediaElement Source=''></MediaElement>");d.children.add(a);a.Width=g;a.Height=f;a.Stretch=m?"Uniform":"None";a.AutoPlay=false;a.Volume=l;c("MediaOpened","onMediaOpened");c("MediaEnded","onMediaEnded");c("MediaFailed","onMediaFailed");c("CurrentStateChanged","onCurrentStateChanged");c("DownloadProgressChanged","onDownload");c("MarkerReached","onMarkerReached");a.Source=n.Url}};this.close=function(){if(checkDefined(a)){b.log("mediaPlayer","[SilverlightPlayer] closing");if(checkArray(e)){for(var c=0;c<e.length;c++)a.removeEventListener(e[c].evt,e[c].id);delete e}a.Stop();a.Source=null;d.children.clear();delete a;a=null}};this.pause=function(){if(checkDefined(a))if(h)i=false;else a.Pause()};this.play=function(){if(checkDefined(a))if(h)i=true;else a.Play()};this.setVolume=function(b){l=b/100;if(checkDefined(a))a.Volume=l};this.getTotalTime=function(){var b;if(checkDefined(a))b=a.NaturalDuration.Seconds;return checkInt(b)?b:0};this.getPlayheadTime=function(){var b;if(checkDefined(a))b=a.Position.Seconds;return checkInt(b)?b:0};this.seek=function(b){if(checkDefined(a))a.Position=formatPosition(b)};this.setSize=function(e,c,b){g=e;f=c;m=b;k.width=g;k.height=f;if(checkDefined(d)){d.Width=g;d.Height=f}if(checkDefined(a)){a.Stretch=m?"Uniform":"None";a.Width=g;a.Height=f}};this._render=function(c){if(null!=c){var a=document.createElement("DIV");c.appendChild(a);_silverlightObject=new Msn.Controls.SilverlightObject("silverlightPlayer","/xaml/player.xaml",g,f);_silverlightObject.setOnLoad(makeCallback(b,b.onLoaded));_silverlightObject._render(a);k=_silverlightObject.getObjectNode()}};this.onLoaded=function(a){d=a;d.Width=g;d.Height=f};this.onMediaOpened=function(){if(checkDefined(a)){b.log("mediaPlayer","[SilverlightPlayer] MediaOpened");c.getObjectNode().SL_broadcast("onMetadata",a.NaturalDuration.Seconds);c.getObjectNode().SL_broadcast("onPlayState",true);setTimeout(function(){if(h){h=false;c.getObjectNode().SL_broadcast("onLoadComplete");if(i)a.Play()}},10)}};this.onMediaEnded=function(){if(checkDefined(a)){b.log("mediaPlayer","[SilverlightPlayer] MediaEnded");c.getObjectNode().SL_broadcast("onComplete")}};this.onMediaFailed=function(){if(checkDefined(a)){b.log("mediaPlayer","[SilverlightPlayer] error");b.close();c.getObjectNode().SL_broadcast("onLoadError","silverlight")}};this.onCurrentStateChanged=function(){if(checkDefined(a)){var d=a.CurrentState;b.log("mediaPlayer","[SilverlightPlayer] changed state to: "+d);if(d=="Buffering"){j=true;c.getObjectNode().SL_broadcast("onBuffering",true)}else if(j){j=false;c.getObjectNode().SL_broadcast("onBuffering",false)}if(d=="Playing"&&!a.CanPause)c.getObjectNode().SL_broadcast("disablePause")}};this.onDownload=function(){if(checkDefined(a))c.getObjectNode().SL_broadcast("onLoading",a.DownloadProgress)};this.onMarkerReached=function(d,a){if(checkDefined(a)&&checkDefined(a.marker)&&a.marker.type=="LC_SPOTBREAK"&&checkGuid(a.marker.text)){c.getObjectNode().vidRequestAd();b.fireEvent(Msn.Event.MediaPlayByVideoId,a.marker.text)}}};Msn.Controls.SilverlightPlayer.prototype=Msn.Controls;function SL_setSize(c,a,b){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.setSize(c,a,b)}function SL_load(b,a){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.load({Id:b,Url:a})}function SL_play(){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.play()}function SL_pause(){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.pause()}function SL_seek(a){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.seek(a)}function SL_close(){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.close()}function SL_setVolume(a){if(checkDefined(Msn.SilverlightPlayer))Msn.SilverlightPlayer.setVolume(a)}function SL_getPlayheadTime(){if(checkDefined(Msn.SilverlightPlayer))return Msn.SilverlightPlayer.getPlayheadTime();else return null}function SL_getTotalTime(){if(checkDefined(Msn.SilverlightPlayer))return Msn.SilverlightPlayer.getTotalTime();else return null}Msn.Controls.SimilarVideos=function(f){var g=this,b=0,c=0,d=new Msn.Controls.SearchResultPanel(4,1,false,true),a,e=f;this.cfg={VIEW_ALL:$["IDS_CLI_ViewAll"],RELATED_VIDEOS:$["IDS_CLI_RelatedVideos"]};this.setWebVideo=function(a){if(checkDefined(a)&&checkDefined(a.Video)){c=a.Video.CsId==Msn.Controls.config.SoapboxCsId?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog;b=a.Video.Id;this.refresh()}};this.onSimilarVideoViewAllClick=function(){if(checkString(b)){var a=Msn.Controls.SearchQueryFactory.create(b,SoapboxService.SearchType.Recommendations,0,SoapboxService.SortOrder.Default,c);this.fireEvent(Msn.Event.Search,a)}return false};this.refresh=function(){if(checkString(b)){var a=Msn.Controls.SearchQueryFactory.create(b,SoapboxService.SearchType.Recommendations,0,SoapboxService.SortOrder.Default,c);a.disableMenuSelect();a.disableHistoryEntry();a.setOnComplete(this.onSearchComplete);d.setSearchQuery(a)}};this.onSearchComplete=function(b){if(checkDefined(a))if(b.TotalCount>0)a.style.display="inline";else a.style.display="none"};this._render=function(h){if(null!=h){var f,b,c;c=document.createElement("DIV");head=document.createElement("DIV");head.className="similarVideoHead";f=document.createElement("B");b=document.createTextNode(g.cfg.RELATED_VIDEOS);f.appendChild(b);head.appendChild(f);if(e){a=document.createElement("SPAN");a.className="similarVideosViewAll";a.appendChild(document.createTextNode(" ("));b=document.createElement("A");b.href=this.getLinkHref();b.title=this.cfg.VIEW_ALL;b.className="tLink";b.appendChild(document.createTextNode(this.cfg.VIEW_ALL));this.addListener(b,"onclick",this.onSimilarVideoViewAllClick);a.appendChild(b);a.appendChild(document.createTextNode(")"));head.appendChild(a)}c.appendChild(head);h.appendChild(c);c=document.createElement("DIV");d.render(c);h.appendChild(c)}}};Msn.Controls.SimilarVideos.prototype=Msn.Controls;function SumQueue(d,e){var b=this,a=[],c=0,f=isNaN(parseInt(e))?0:parseInt(e);this.getSum=function(){var b=c;if(a.length>0)b+=(a.length-1)*f;return b};this.getItemCount=function(){return a.length};this.getFirstItem=function(){if(a.length>0)return a[0];return 0};this.toArray=function(){var c=[];for(var a=0;a<b.length;a++)c.push(b[a]);return c};this.enqueue=function(d){if(d instanceof Array)for(var f=d.length;f>=0;f--)b.enqueue(d[f]);else{var e=parseInt(d);if(!isNaN(e)){a.push(e);c+=e}}};this.dequeue=function(){if(a.length>0){var b=a[0];a.splice(0,1);c-=b;return b}else return null};this.toString=function(){return a.toString()};if(d instanceof Array)b.enqueue(d)}function SlidingPartition(d){var c=d instanceof Array?d:new Array;function b(a,e){var h=999999,i=[];if(e<1||isNaN(parseInt(e)))e=1;while(true){var c=-1,k=0,g=0;for(var b=0;b<a.length;b++){var f=a[b].getSum();if(a[b].getItemCount()>1){var j=f-a[b].getFirstItem();if(j>k){k=j;c=b}}if(f>g)g=f}var d=0;for(b=0;b<a.length;b++){d+=g-a[b].getSum();if(a[b].getItemCount()<=0)d+=0.001}if(d<h){h=d;for(b=0;b<a.length;b++)i[b]=a[b].getItemCount()}if(c<0||c==a.length-1)break;else{if(c+1<a.length){var l=a[c].dequeue();a[c+1].enqueue(l)}if(c==0&&a[0].getSum()<e)break}}return i}function a(a){if(a<1||isNaN(parseInt(a)))a=1;var b=0,d=[new SumQueue(c,b)];for(var e=1;e<a;e++)d.push(new SumQueue(null,b));return d}this.calculate=function(c){var d=a(c);return b(d,1)};this.calculatePartitions=function(g,d){d=isNaN(parseInt(d))?c.length:d;var h=a(d),e=b(h,g);for(var f=e.length-1;f>=0;f--)if(e[f]==0)e.splice(f,1);return e}}Msn.Controls.SoapboxAdapter=function(){this.convertSearchResult=function(a){var e=null;if(typeof a!="undefined"&&null!=a&&null!=a.Videos){var d=a.Videos,f=d.length;for(var c=0;c<f;c++){var b=d[c];if(null==b.CsId)b.CsId=Msn.Controls.config.SoapboxCsId;if(null==b.Provider)b.Provider=b.Id}}e=a;return e};this.convertRelatedTagsResult=function(){return null};this.convertTemplate=function(){return null};this.convertExtendedMetadata=function(a){return a};this.convertVideoList=function(a){var b=null;if(checkObject(a)&&checkObject(a.Video)&&isSoapboxEnabled())b=[a.Video];return b}};createNamespace("Msn");Msn.VcConfig=new function(){this.cfg={MAX_RELATED_TAGS:25,MSNVIDEO_BSB_PAGE_GROUP:$["IDS_GMT_BSBPageGroupMsnVideo"],SOAPBOX_BSB_PAGE_GROUP:$["IDS_GMT_BSBPageGroupSpbx"],SOAPBOX_PAGE_GROUP:$["IDS_GMT_PageGroupSpbx"],MSNVIDEO_PAGE_GROUP:$["IDS_GMT_PageGroupMsnVideo"]};this.Build=function(){var a=new VCService.Config;a.AddFilter(VCService.FilterType.HasThumbnail);a.AddFilter(VCService.FilterType.IsPublished);if(!Msn.Controls.config.showWmp&&!Msn.Controls.config.showSilverlight)a.AddFilter(VCService.FilterType.HasFlash);a.AddUsageCounter(VCService.UsageEventType.Played);a.AddUsageCounter(VCService.UsageEventType.Rated);a.AddUsageCounter(VCService.UsageEventType.Reviewed);a.AddUsageCounter(VCService.UsageEventType.Bookmarked);a.Lcid=Msn.Controls.config.lcid;a.SoapboxCsId=Msn.Controls.config.SoapboxCsId;a.IsSoapboxEnabled=isSoapboxEnabled();a.UseImageScaling=Msn.Controls.config.UseImageScaling;a.MaxRelatedTags=this.cfg.MAX_RELATED_TAGS;a.MsnVideoPageGroup=this.cfg.MSN_VIDEO_PAGE_GROUP;a.SoapboxPageGroup=this.cfg.SOAPBOX_PAGE_GROUP;a.MsnVideoBsbPageGroup=this.cfg.MSN_VIDEO_BSB_PAGE_GROUP;a.SoapboxBsbPageGroup=this.cfg.SOAPBOX_BSB_PAGE_GROUP;a.StreamingHostUrl=getHostUrl();a.SoapboxMarket=checkString(Msn.Controls.config.SoapboxMarket)?Msn.Controls.config.SoapboxMarket:"uv-en-us";a.VCMarket=checkString(Msn.Controls.config.VCMarket)?Msn.Controls.config.VCMarket:"us";a.VCServiceUrl=checkString(Msn.Controls.config.VCServiceUrl)?Msn.Controls.config.VCServiceUrl:"http://catalog.video.msn.com";a.RandomServerArray=Msn.Controls.config.VCServiceUrlsRandom;a.RandomImageUrlArray=Msn.Controls.config.VCServiceImageUrlsRandom;return a}};var spbxConfig=new SoapboxService.Config(Msn.Controls.config.applicationId,getHostUrl(),VideoService.HandlerType.XMLHTTP);Msn.SoapboxServiceManager=new VideoService.Proxy(spbxConfig,Msn.VcConfig.Build());Msn.Controls.SortResults=function(){var f=this,a=null,d=null,c=null,e=false;this.cfg={WIDTH:checkInt($["IDS_GMT_SortMenuWidth"],1)?$["IDS_GMT_SortMenuWidth"]:100,IMG_DROP_DOWN:getCDNPath("/i/down.gif"),LABEL_DROP_DOWN:$["IDS_CLI_LabelDropDown"],RELEVANCE:$["IDS_CLI_Relevance"],RATING:$["IDS_CLI_Rating"],DATE_UPLOADED:$["IDS_CLI_DateUploaded"],PLAY_COUNT:$["IDS_CLI_PlayCount"],LAST_HOUR:$["IDS_CLI_LastHour"],LAST_DAY:$["IDS_CLI_LastDay"],LAST_WEEK:$["IDS_CLI_LastWeek"],LAST_MONTH:$["IDS_CLI_LastMonth"],ALL_TIMES:$["IDS_CLI_AllTimes"],SORT_BY:$["IDS_CLI_SortBy"]};var b={};b[SoapboxService.SortOrder.Relevance]=this.cfg.RELEVANCE;b[SoapboxService.SortOrder.Rating]=this.cfg.RATING;b[SoapboxService.SortOrder.DateUploaded]=this.cfg.DATE_UPLOADED;b[SoapboxService.SortOrder.Playcount]=this.cfg.PLAY_COUNT;b[SoapboxService.SortOrder.LastHour]=this.cfg.LAST_HOUR;b[SoapboxService.SortOrder.LastDay]=this.cfg.LAST_DAY;b[SoapboxService.SortOrder.LastWeek]=this.cfg.LAST_WEEK;b[SoapboxService.SortOrder.LastMonth]=this.cfg.LAST_MONTH;b[SoapboxService.SortOrder.AllTimes]=this.cfg.ALL_TIMES;this.setSearchQuery=function(b){if(checkObject(b)){a=b;e=false;this.render()}};this.toggleSortMenuVisibility=function(){f.showSortMenu(!e)};this.showSortMenu=function(a){if(checkDefined(c)){c.style.visibility=a?"visible":"hidden";c.style.display=a?"inline":"none";e=a}};this.onMouseOverLink=function(b,a){if(checkDefined(a))a.className="sortByLinkMouseOver"};this.onMouseOutLink=function(b,a){if(checkDefined(a))a.className="sortByLinkNormal"};this.onSortRequested=function(f,c){a.setSort(c);a.page=0;var d="";switch(a.videoDomain){case Msn.Domain.VideoCatalog:d="msnvideo";break;case Msn.Domain.Soapbox:d="soapbox";break;case Msn.Domain.LiveSearch:d="web";break}this.fireEvent(Msn.Event.Search,a);var e=checkString(a.sortLabelHash[c])?a.sortLabelHash[c]:b[c];ReportTracking("","",Msn.Event.MediaClick,"sort:"+e);return false};this.setSortLabel=function(g,i,h){var c=document.createElement("A");c.href=this.getLinkHref();if(!h){c=document.createElement("SPAN");c.className="defaultSortValue"}var e=null;if(checkDefined(g)){if(checkDefined(a.sortLabelHash)){var d=a.sortLabelHash[g];if(checkString(d))e=d;else if(checkObject(d))if(h){e=checkString(d.choiceLabel)?d.choiceLabel:d.label;if(checkString(d.indentLabel)){c=document.createElement("SPAN");var f=document.createElement("SPAN");f.style.visibility="hidden";f.innerText=d.indentLabel;c.appendChild(f);f=document.createElement("A");f.href=this.getLinkHref();f.innerText=e;c.appendChild(f)}}else e=d.label}if(!checkString(e))e=b[g]}if(c.childNodes.length==0)c.innerText=e;c.title=checkString(i)?i:e;return c};this._render=function(i){if(null!=i&&checkObject(a)){var b,g,f,j,e,k;b=document.createElement("SPAN");b.appendChild(document.createTextNode(checkString(a.sortLabelHash["sortByLabel"])?a.sortLabelHash["sortByLabel"]:this.cfg.SORT_BY));b.className="sortByText";i.appendChild(b);g=document.createElement("SPAN");g.className="sortByParent";i.appendChild(g);b=document.createElement("DIV");b.className="sortByDefault";b.style.width=this.cfg.WIDTH+"px";d=this.setSortLabel(a.sort,this.cfg.LABEL_DROP_DOWN,false);b.appendChild(d);d=document.createElement("SPAN");d.className="sortDropDown";f=document.createElement("IMG");f.src=this.cfg.IMG_DROP_DOWN;f.alt=f.title=this.cfg.LABEL_DROP_DOWN;f.style.cursor="pointer";f.width="7";f.height="4";d.appendChild(f);b.appendChild(d);g.appendChild(b);this.addListener(b,"onclick",this.toggleSortMenuVisibility);c=document.createElement("DIV");c.className="sortByList";c.style.width=this.cfg.WIDTH+"px";for(var h=0;h<a.sortEntries.length;h++){e=document.createElement("DIV");j=this.setSortLabel(a.sortEntries[h],null,true);e.appendChild(j);e.className="sortByLinkNormal";this.addListener(e,"onclick",this.onSortRequested,a.sortEntries[h]);this.addListener(e,"onmouseover",this.onMouseOverLink,e);this.addListener(e,"onmouseout",this.onMouseOutLink,e);c.appendChild(e)}g.appendChild(c)}}};Msn.Controls.SortResults.prototype=Msn.Controls;Msn.Controls.SplitContainer=function(r,u,p,F){var G=this;this.cfg={VIEW_ALL:$["IDS_CLI_ViewAll"],RSS_ALT:$["IDS_CLI_RssAlt"],RSS_IMAGE:getCDNPath("/i/rssMini.gif"),TITLE_MAX_LENGTH:80,DISCLAIMER_MAX_LENGTH:400,VIEW_ALL_COUNT:$["IDS_CLI_ViewAllCount"]};var l=0,C=0,w=false,s=false,q=true,A=false,x=false,y=false,n="",m=new Msn.Controls.LiteralHTML,v,t=null,z=null,b,e,j,i,a,d,f,h,c,k,D="containerBody",B=new Msn.Controls.RssLink,J,I,g,H,E=150,o="";this._refresh=function(){this._setContainerDisplay();this._setHeaderDisplay();this._setFooterDisplay();this._setRssDisplay();this._setViewAllDisplay();this._setCustomHeaderDisplay();this._setSize()};this._setSize=function(){if(checkDefined(b)){if(checkInt(l,1)){b.style.width=l+"px";e.style.width=l+"px";f.style.width=l+"px";k.style.width=l+"px"}if(checkInt(C,1))b.style.height=C+"px";if(checkInt(E,1))d.style.width=E+"px"}};this._setContainerDisplay=function(){if(checkDefined(b)){if(checkDefined(r)&&r)b.style.display="block";else b.style.display="none";b.className="splitContainer"}};this._setHeaderDisplay=function(){if(checkDefined(e))if(checkDefined(u)&&u)e.style.display="block";else e.style.display="none"};this._setFooterDisplay=function(){if(checkDefined(f))if(checkDefined(A)&&A){f.style.display="block";h.style.display=checkDefined(y)&&y?"inline":"none";c.style.display=checkDefined(x)&&x?"inline":"none";this.setDisclaimer(n)}else f.style.display="none"};this._setRssDisplay=function(){if(checkDefined(i))if(checkDefined(w)&&w)i.style.display="block";else i.style.display="none"};this._setViewAllDisplay=function(){if(checkDefined(a))if(checkDefined(s)&&s){a.style.display="block";if(checkDefined(g))g.style.display="block"}else{a.style.display="none";if(checkDefined(g))g.style.display="none"}};this._setCustomHeaderDisplay=function(){if(checkDefined(d))if(checkDefined(q)&&q)d.style.display="block";else d.style.display="none"};this.showContainer=function(a){if(checkDefined(a)&&a)r=true;else r=false;this._setContainerDisplay()};this.showHeader=function(a){if(checkDefined(a)&&a)u=true;else u=false;this._setHeaderDisplay()};this.setReportId=function(a){o=a};this.showFooter=function(c,b,a){A=checkDefined(c)&&c?true:false;x=checkDefined(b)&&b?true:false;y=checkDefined(a)&&a?true:false;this._setFooterDisplay()};this.showRss=function(a){if(checkDefined(a)&&a)w=true;else w=false;this._setRssDisplay()};this.showViewAll=function(a){if(checkDefined(a)&&a)s=true;else s=false;this._setViewAllDisplay()};this.showCustomHeader=function(a){if(checkDefined(a)&&a)q=true;else q=false;this._setCustomHeaderDisplay()};this.setTitle=function(b,a){if(checkDefined(b))p=b;else p="";if(checkDefined(j)){j.innerText=ll(p,this.cfg.TITLE_MAX_LENGTH);j.title=checkString(a)?a:p}};this.setDisclaimer=function(a){if(checkDefined(a))n=a;else n="";if(checkDefined(h)){h.innerText=ll(n,this.cfg.DISCLAIMER_MAX_LENGTH);h.title=n}};this.setCount=function(d){if(checkDefined(d))_count=d;else _count=0;if(checkDefined(c)&&checkDefined(a))if(_count>0){var b=this.cfg.VIEW_ALL_COUNT.format(_count);c.innerText="> "+b;c.title=b;c.style.display="inline";a.style.display="inline"}else{c.style.display="none";a.style.display="none"}};this.setSize=function(b,a){l=b;C=a;this._setSize()};this.setOnViewAllClick=function(a,b){t=a;z=b};this.onViewAll=function(){if(checkDefined(t))if(checkDefined(z))t(z);else t();scrollTo(0,0);return false};this.onViewAllCountClick=function(){if(checkString(o))Msn.Controls.fireEvent(Msn.Event.ReportSearch,{term:"",srchtype:o+":va"});G.onViewAll()};this.onViewAllClick=function(){if(checkString(o))Msn.Controls.fireEvent(Msn.Event.ReportSearch,{term:"",srchtype:o+":va"});G.onViewAll()};this.setRssUrl=function(b,a){if(checkDefined(B))B.setRssUrl(b,a)};this.setCustomHeaderCtrl=function(a){if(checkDefined(a)){m=a;if(checkDefined(d)){d.innerText="";m.render(d)}}else m=new Msn.Controls.LiteralHTML};this.setContent=function(a){if(checkDefined(a))v=a;else v=null};this.setScrollable=function(a){if(checkDefined(a)&&a)F=true;else F=false};this.setContainerBodyClass=function(a){if(checkString(a,0))D=a};this._render=function(n){b=document.createElement("div");b.className="splitContainer";e=document.createElement("DIV");e.className="containerHeader";j=document.createElement("DIV");j.className="containerTitle";this.setCSSFloat(j,"left");i=document.createElement("DIV");i.className="containerRss";this.setCSSFloat(i,"right");a=document.createElement("DIV");a.className="splitContainerViewAll";a.innerText=this.cfg.VIEW_ALL;a.title=this.cfg.VIEW_ALL;this.setCSSFloat(a,"right");d=document.createElement("DIV");d.className="containerCustomHeader";k=document.createElement("DIV");k.className=D;if(null!=n){n.appendChild(b);b.appendChild(e);e.appendChild(j);this.setTitle(p);g=document.createElement("A");g.appendChild(a);e.appendChild(g);g.style.display="none";this.addListener(a,"onclick",this.onViewAllClick);this.addListener(a,"onkeydown",this.onViewAllClick);e.appendChild(i);B.render(i);e.appendChild(d);if(checkDefined(m))m.render(d);b.appendChild(k);if(checkDefined(v))v.render(k);var l=document.createElement("SPAN");this.setCSSFloat(l,"right");l.style.height="1px";k.appendChild(l);f=document.createElement("DIV");f.className="containerFooter";b.appendChild(f);h=document.createElement("DIV");h.className="containerDisclaimer";this.setCSSFloat(h,"left");f.appendChild(h);c=document.createElement("DIV");c.className="containerViewAllCount";this.setCSSFloat(c,"right");f.appendChild(c);this.addListener(c,"onclick",this.onViewAllCountClick);this.addListener(c,"onkeydown",this.onViewAllCountClick);this._refresh()}}};Msn.Controls.SplitContainer.prototype=Msn.Controls;Msn.Controls.SplitSearchPage=function(){var that=this;this.cfg={RELATED_TAGS:$["IDS_CLI_RelatedTags"],MSN_VIDEOS_SEARCH_RESULTS:$["IDS_CLI_MsnVideosSearchResults"],SOAPBOX_SEARCH_RESULTS:$["IDS_CLI_SoapboxSearchResults"],LIVESEARCH_SEARCH_RESULTS:Msn.Controls.config.msnWebSearchBrand,WEB_DISCLAIMER:$["IDS_CLI_WebDisclaimer"]};var _searchTerm=null,_cloudContainer=new Msn.Controls.SplitContainer(true,true,this.cfg.RELATED_TAGS,false),_cloud=new Msn.Controls.Cloud;_cloud.setAlphaSort(false);_cloud.setEntryClassname("searchTypeSelected","searchTypeUnselected");_cloud.setDelimiter("|");var _cloudElt=null,_vcPanelContainer=new Msn.Controls.SplitContainer(true,true,this.cfg.MSN_VIDEOS_SEARCH_RESULTS,false),_vcPanel=new Msn.Controls.SearchResultPanel(4,2,false,false,true,false,false);_vcPanel.setContainerProperty(_vcPanelContainer,this.cfg.MSN_VIDEOS_SEARCH_RESULTS);_vcPanelContainer.setReportId("Top Video Results:Msn Video");_vcPanelContainer.setContent(_vcPanel);_vcPanelContainer.showViewAll(true);_vcPanelContainer.showFooter(true,true);_vcPanelContainer.setScrollable(false);var _soapboxPanelContainer=new Msn.Controls.SplitContainer(true,true,this.cfg.SOAPBOX_SEARCH_RESULTS,false),_soapboxPanel=new Msn.Controls.SearchResultPanel(4,1,false,false,true,false,false);_soapboxPanel.setContainerProperty(_soapboxPanelContainer,this.cfg.SOAPBOX_SEARCH_RESULTS);_soapboxPanelContainer.setReportId("Top Video Results:Soapbox User Videos");_soapboxPanelContainer.setContent(_soapboxPanel);_soapboxPanelContainer.showViewAll(true);_soapboxPanelContainer.showFooter(true,true);_soapboxPanelContainer.setScrollable(false);var _liveSearchPanelContainer=new Msn.Controls.SplitContainer(true,true,this.cfg.LIVESEARCH_SEARCH_RESULTS,false),_liveSearchPanel=new Msn.Controls.SearchResultPanel(4,1,false,false,true,false,false);_liveSearchPanel.setContainerProperty(_liveSearchPanelContainer,this.cfg.LIVESEARCH_SEARCH_RESULTS);_liveSearchPanelContainer.setReportId("Top Video Results:Web");_liveSearchPanelContainer.setContent(_liveSearchPanel);_liveSearchPanelContainer.showViewAll(true);_liveSearchPanelContainer.showFooter(true,true,true);_liveSearchPanelContainer.setDisclaimer(this.cfg.WEB_DISCLAIMER);_liveSearchPanelContainer.setScrollable(false);this.subscribeEvent(Msn.Event.SplitSearch);this.onEvent=function(g,f,d){switch(f){case Msn.Event.SplitSearch:var c=d;if(checkString(c)){_searchTerm=c;var a=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.VideoCatalog);a.setOnCloudData(this.onCloudData);a.disableMenuSelect();a.disableHistoryEntry();_vcPanel.setSearchQuery(a);_vcPanelContainer.setRssUrl(a.rssUrl,a.zuneUrl);if(isSoapboxEnabled()){_soapboxPanelContainer.showContainer(true);var b=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.Soapbox);b.disableMenuSelect();b.disableHistoryEntry();_soapboxPanel.setSearchQuery(b);_soapboxPanelContainer.setRssUrl(b.rssUrl,b.zuneUrl)}else _soapboxPanelContainer.showContainer(false);if(isLiveSearchEnabled()){_liveSearchPanelContainer.showContainer(true);var e=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.LiveSearch);_liveSearchPanel.setSearchQuery(e)}else _liveSearchPanelContainer.showContainer(false)}break}};this.onViewAll=function(b){if(checkString(_searchTerm)){var a;switch(b){case Msn.Domain.VideoCatalog:a=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.VideoCatalog);Msn.Controls.fireEvent(Msn.Event.Search,a);break;case Msn.Domain.Soapbox:a=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.Soapbox);Msn.Controls.fireEvent(Msn.Event.Search,a);break;case Msn.Domain.LiveSearch:a=Msn.Controls.SearchQueryFactory.create(_searchTerm,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.LiveSearch);Msn.Controls.fireEvent(Msn.Event.Search,a);break}}};this.onVCViewAll=function(){that.onViewAll(Msn.Domain.VideoCatalog)};this.onSoapboxViewAll=function(){that.onViewAll(Msn.Domain.Soapbox)};this.onLiveSearchViewAll=function(){that.onViewAll(Msn.Domain.LiveSearch)};this.onCloudData=function(a){var b=false;if(checkObject(a)&&checkString(a.title)&&checkObject(a.entries)){b=true;_cloudContainer.setTitle(a.title);_cloud.setEntries(a.entries,a.noEntryLabel);_cloud.selectByIndex(0,true)}if(checkDefined(_cloudElt))_cloudElt.style.display=b?"block":"none"};this.onCloudEntryClick=function(type,name,data){if(checkDefined(type)&&checkDefined(name))switch(type){case Msn.CloudEntryType.Tags:var query=Msn.Controls.SearchQueryFactory.create(name,SoapboxService.SearchType.Tag,0,SoapboxService.SortOrder.Default);that.fireEvent(Msn.Event.Search,query);break;case Msn.CloudEntryType.Categories:var categoryMenuId=eval("Msn.Menu."+name.replace(/ /g,""));if(checkInt(categoryMenuId,0))that.fireEvent(Msn.Event.MenuClick,{menuId:categoryMenuId});break;case Msn.CloudEntryType.Taxonomy:var taxonomyUrl=data;if(checkString(taxonomyUrl)){query=Msn.Controls.SearchQueryFactory.create(taxonomyUrl,SoapboxService.SearchType.Taxonomy,0,SoapboxService.SortOrder.Default);that.fireEvent(Msn.Event.Search,query)}break;case Msn.CloudEntryType.Search:var term=data.term;if(checkDefined(term)){var domain=data.domain;if(checkInt(domain)){query=Msn.Controls.SearchQueryFactory.create(term,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,domain);that.fireEvent(Msn.Event.Search,query)}else that.fireEvent(Msn.Event.SplitSearch,term)}break}};_vcPanelContainer.setOnViewAllClick(this.onVCViewAll);_soapboxPanelContainer.setOnViewAllClick(this.onSoapboxViewAll);_liveSearchPanelContainer.setOnViewAllClick(this.onLiveSearchViewAll);_cloud.setOnEntryClick(this.onCloudEntryClick);_cloudContainer.setContent(_cloud);_cloudContainer.showViewAll(false);this._render=function(a){var b;if(null!=a){_cloudElt=document.createElement("SPAN");_cloudContainer.render(_cloudElt);_cloudElt.appendChild(document.createElement("BR"));_cloudElt.style.display="none";a.appendChild(_cloudElt);_vcPanelContainer.render(a);a.appendChild(document.createElement("BR"));_soapboxPanelContainer.render(a);a.appendChild(document.createElement("BR"));_liveSearchPanelContainer.render(a)}}};Msn.Controls.SplitSearchPage.prototype=Msn.Controls;Msn.Controls.Survey=function(){var a=this;this.cfg={SURVEY_REQUEST_TEXT:$["IDS_CLI_SurveyRequestText"],SURVEY_URL:$["IDS_GMT_SurveyUrl"],SURVEY_FREQUENCY:$["IDS_GMT_SurveyFrequency"],SURVEY_COOKIE_NAME:"MSN_Video_Survey",YES_LABEL:$["IDS_CLI_YES"],NO_LABEL:$["IDS_CLI_NO"],SURVEY_COOKIE_EXPIRY:60*24*365};var b=false;this.subscribeEvent(Msn.Event.SurveyCheck);this.subscribeEvent(Msn.Event.MediaPlay);this.onEvent=function(d,c){if(Msn.Event.SurveyCheck==c)setTimeout(function(){a.checkSurvey()},1000);else if(Msn.Event.MediaPlay==c)b=true};this.checkSurvey=function(){var a=cookieGet(this.cfg.SURVEY_COOKIE_NAME);if(!b&&checkString(this.cfg.SURVEY_URL)&&checkFloat(this.cfg.SURVEY_FREQUENCY,0,100)&&!checkDefined(a)){var c=Math.random()*100;if(c<=parseFloat(this.cfg.SURVEY_FREQUENCY))this.requestSurvey()}};this.requestSurvey=function(){var b=new Msn.Controls.Dialog;b.description=a.cfg.SURVEY_REQUEST_TEXT;b.type=Msn.Dialog.Confirm;b.OKLabel=a.cfg.YES_LABEL;b.CANCELLabel=a.cfg.NO_LABEL;b.onComplete=function(b){a.surveyConfirmed(b)};setTimeout(a.fireEvent(Msn.Event.DialogRequest,b),3000)};this.surveyConfirmed=function(b){cookieSet(this.cfg.SURVEY_COOKIE_NAME,b,a.cfg.SURVEY_COOKIE_EXPIRY);if(b&&checkString(this.cfg.SURVEY_URL))openWindow(this.cfg.SURVEY_URL,"_blank",640,480,"resizable=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,location=yes")}};Msn.Controls.Survey.prototype=Msn.Controls;Msn.Controls.TagList=function(){var h=this,a=null,c=null,e=null,b=null,g="tagSelected",f="myTagUnselected";this.cfg={MAX_TAGS:5,IMG_DELETE:getCDNPath("/i/cl.gif"),LABEL_DELETE:$["IDS_CLI_LabelDelete"],LABEL_ENTERTAG:$["IDS_CLI_LabelEntertag"],LABEL_NOTAG:$["IDS_CLI_LabelNotag"]};this.setTags=function(b){if(checkDefined(b)){a=b.clone();a.sort(this.alphaCompare);this.render()}};this.alphaCompare=function(a,b){if(a.Name.toLowerCase()>b.Name.toLowerCase())return 1;else if(a.Name.toLowerCase()<b.Name.toLowerCase())return -1;return 0};this.setOnTagClicked=function(a){c=a};this.setOnTagRemove=function(a){e=a};this.onTagClicked=function(e,a,d){if(checkDefined(a)&&checkString(a.innerText)){if(checkDefined(b))b.className=f;b=a;b.className=g}if(checkDefined(c))c(e,d)};this.onTagRemove=function(b,a){if(checkDefined(e))e(b,a)};this._render=function(g){var c;if(null!=g&&null!=a){d=document.createElement("DIV");d.className="containerContentSpacing";b=null;if(a.length>0)for(var e=0;e<a.length&&e<this.cfg.MAX_TAGS;e++){c=document.createElement("SPAN");c.className=f;c.innerText=a[e].Name+" ";d.appendChild(c);this.addListener(c,"onclick",this.onTagClicked,c,a[e].Name);c=document.createElement("IMG");c.src=this.cfg.IMG_DELETE;c.alt=c.title=this.cfg.LABEL_DELETE;c.style.cursor="pointer";c.style.valign="middle";d.appendChild(c);this.addListener(c,"onclick",this.onTagRemove,a[e].Name);d.appendChild(document.createElement("BR"))}else{d.appendChild(document.createElement("BR"));d.appendChild(document.createElement("BR"));c=document.createElement("SPAN");c.style.display="block";c.style.textAlign="center";c.appendChild(document.createTextNode(this.cfg.LABEL_NOTAG));c.appendChild(document.createElement("BR"));c.appendChild(document.createTextNode(this.cfg.LABEL_ENTERTAG));d.appendChild(c)}g.appendChild(d)}}};Msn.Controls.TagList.prototype=Msn.Controls;Msn.Controls.TagModule=function(r,q){var a=this,e=false,l=null;this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.VideoPanelViewChange);this.onEvent=function(d,c,a){switch(c){case Msn.Event.MediaMetadata:this.setVideoData(a.Video);this.select(0);break;case Msn.Event.VideoPanelViewChange:switch(a){case Msn.VideoPanel.PopularTags:this.select(0);break;case Msn.VideoPanel.YourTags:this.select(1);break}break;case Msn.Event.FocusReceived:if(checkDefined(b))try{b.focus()}catch(e){}break;default:break}};this.cfg={INPUT_SIZE:31,SOURCE_LOGO:getCDNPath($["IDS_GMT_SoapboxLogo"]),MAX_TAGS:10,MAX_USER_TAGS:5,TAG_LENGTH:40,MAX_LENGTH:208,TAGS:$["IDS_CLI_Tags"],LABEL_POPULARTAGS:$["IDS_CLI_LabelPopulartags"],LABEL_YOURTAGS:$["IDS_CLI_LabelYourtags"],LABEL_INPUT:$["IDS_CLI_LabelInput"],FAILED_ADD:$["IDS_CLI_FailedAdd"],INPUT_DEFAULT:$["IDS_CLI_InputDefault"],FAILED_REMOVE:$["IDS_CLI_FailedRemove"],SOURCE_TITLE:$["IDS_CLI_SourceTitle"],ENTER_TAGS_BELOW:$["IDS_CLI_EnterTagsBelow"],NO_TAGS_ON_VIDEO:$["IDS_CLI_NoTagsOnVideo"],DELETE_TAG_CONFIRMATION:$["IDS_CLI_DeleteTagConfirmation"],TAG_CANNOT_EMPTY:$["IDS_CLI_TagCannotEmpty"],ERROR_TAG_MAX_LENGTH:$["IDS_CLI_ErrorTagMaxLength"],TAG_INVALID_CHARACTERS:$["IDS_CLI_TagInvalidCharacters"],TAG_DUPLICATE:$["IDS_CLI_TagDuplicate"],SIGN_IN_TO_ADD_TAG:$["IDS_CLI_SignInToAddTag"],STATUS_MSG_ADD_TAG:["",$["IDS_CLI_StatusMsgAddTag1"],$["IDS_CLI_StatusMsgAddTag2"],$["IDS_CLI_StatusMsgAddTag3"],$["IDS_CLI_StatusMsgAddTag4"],"","",""],STATUS_MSG_REMOVE_TAG:["",$["IDS_CLI_StatusMsgRemoveTag1"],$["IDS_CLI_StatusMsgRemoveTag2"],"","","","",""]};this.onHeaderClicked=function(c,b){a.select(b)};this.select=function(a){if(checkInt(a)){if(checkDefined(c)){n.setClassName(a==0?"tagHeaderSelected":"tagHeaderNonSelected");o.setClassName(a==1?"tagHeaderSelected":"tagHeaderNonSelected");c.select(a)}this.fireEvent(Msn.Event.FocusRequest,this)}};var f=null,p=null,h=null,m=null,i=null,b=null,n=new Msn.Controls.Label(this.cfg.LABEL_POPULARTAGS,"tagHeaderSelected",a.onHeaderClicked,0),o=new Msn.Controls.Label(this.cfg.LABEL_YOURTAGS,"tagHeaderNonSelected",a.onHeaderClicked,1),d=null,g=null,c=null;this.setVideoData=function(a){if(checkObject(a)){f=a.Id;p=a.Title;h=a.CsId==Msn.Controls.config.SoapboxCsId;this.setPopularTagsData(f,a.PopularTags);this.setUserTagsData(f,a.UserTags);this.setHeader()}};this.setHeader=function(){if(checkDefined(d)&&checkDefined(g)){d.style.display=h?"block":"none";g.style.display=!h?"block":"none"}};this.setPopularTagsData=function(g,c){if(f==g){m=checkArray(c)?c:[];var d=[];for(var b=0;b<m.length;b++){var e={"Type":Msn.CloudEntryType.Tags,"Name":m[b].Name,"Data":h?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog};d.push(e)}k.setEntries(d,"<center><BR><BR>"+a.cfg.NO_TAGS_ON_VIDEO+"<BR>"+a.cfg.ENTER_TAGS_BELOW+"</center>")}};this.setUserTagsData=function(c,a){if(f==c){i=checkArray(a)?a:[];j.setTags(i);if(checkDefined(b))b.value=this.cfg.INPUT_DEFAULT}};this.onCloudEntryClick=function(e,b,d){if(Msn.CloudEntryType.Tags==e&&checkDefined(b)){var c=Msn.Controls.SearchQueryFactory.create(b,SoapboxService.SearchType.Tag,0,SoapboxService.SortOrder.Default,d);a.fireEvent(Msn.Event.Search,c)}};this.onFocus=function(){if(checkDefined(b))if(b.value==a.cfg.INPUT_DEFAULT)b.select()};this.onKeyUp=function(c){if(c.keyCode==13&&checkDefined(b)){a.onInputTag(c,b.value);a.fireEvent(Msn.Event.FocusRequest,a)}};this.onClick=function(){if(checkDefined(b))if(b.value==a.cfg.INPUT_DEFAULT)b.value=""};this.onTagClicked=function(c,b){a.onCloudEntryClick(Msn.CloudEntryType.Tags,b,h?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog)};this.onTagSubmit=function(c){if(checkDefined(b)){a.onInputTag(c,b.value);a.fireEvent(Msn.Event.FocusRequest,a)}return false};this.onTagRemove=function(d,c){if(checkString(c)){var b=new Msn.Controls.Dialog;b.description=a.cfg.DELETE_TAG_CONFIRMATION.format(c,p);b.type=Msn.Dialog.Confirm;b.onComplete=function(b){a.tagRemoveConfirmed(b,c,f)};a.fireEvent(Msn.Event.DialogRequest,b)}};this.tagRemoveConfirmed=function(b,c,d){if(b){e=true;Msn.SoapboxServiceManager.RemoveTag(d,c,a.RemoveTagCb,a.onTagRemoveErrorCb)}};this.onInputTag=function(h,b){b=checkString(b)?b.trim():null;if(!checkString(b)){customAlert(a.cfg.TAG_CANNOT_EMPTY);return}if(b!=a.cfg.INPUT_DEFAULT&&false==e){var d=b.split(",");for(var c=0;c<d.length;c++){d[c]=d[c].trim();if(d[c].length>a.cfg.TAG_LENGTH){customAlert(a.cfg.ERROR_TAG_MAX_LENGTH.format(a.cfg.TAG_LENGTH));return}if(!validChar(d[c])){customAlert(a.cfg.TAG_INVALID_CHARACTERS.format(gInvalidCharString));return}if(null!=i)for(var g=0;g<i.length;g++)if(d[c].toLowerCase()==i[g].Name.toLowerCase()){customAlert(a.cfg.TAG_DUPLICATE);return}}e=true;Msn.SoapboxServiceManager.AddTag(f,b,a.addTagCb,a.addTagErrorCb);a.select(1)}};this.RemoveTagCb=function(b){e=false;a.onTagCb(b,true)};this.addTagCb=function(b){e=false;a.onTagCb(b,false)};this.onTagCb=function(c,f){if(checkDefined(c)&&checkInt(c.StatusCode)){a.setPopularTagsData(c.VideoId,c.PopularTags);a.setUserTagsData(c.VideoId,c.UserTags);a.fireEvent(Msn.Event.TagsUpdated,c);if(SoapboxService.ResultCode.Success==c.StatusCode){if(checkDefined(b)){try{b.focus()}catch(g){}b.value=""}}else{var d=c.StatusCode==SoapboxService.ResultCode.InvalidTags?SoapboxService.ResultCode.OffendingInput:c.StatusCode,e=f?a.cfg.STATUS_MSG_REMOVE_TAG[d]:a.cfg.STATUS_MSG_ADD_TAG[d];if(checkString(e))customAlert(e)}}};this.onTagRemoveErrorCb=function(){e=false;customAlert(a.cfg.FAILED_REMOVE)};this.addTagErrorCb=function(){e=false;customAlert(a.cfg.FAILED_ADD)};this.onImageError=function(b,a){a.style.display="none"};var k=new Msn.Controls.Cloud;k.setOnEntryClick(this.onCloudEntryClick);var j=new Msn.Controls.TagList;j.setOnTagClicked(this.onTagClicked);j.setOnTagRemove(this.onTagRemove);this._render=function(f){var a,h,i;if(null!=f){var e=document.createElement("DIV");e.className="tagPanel";d=document.createElement("DIV");a=document.createElement("IMG");a.src=this.cfg.SOURCE_LOGO;a.alt=this.cfg.SOURCE_TITLE;this.addListener(a,"onerror",this.onImageError,d);d.appendChild(a);d.appendChild(document.createElement("BR"));e.appendChild(d);g=document.createElement("DIV");g.className="metadataLabel";g.innerText=this.cfg.TAGS;e.appendChild(g);n.render(e);e.appendChild(document.createTextNode(" / "));o.render(e);if(!checkDefined(c)){c=new Msn.Controls.FilterTab(r,q,"tagTabs");c.add(0,k);c.add(1,j)}c.render(e);if(Msn.Passport.isUserLoggedIn()){inputDiv=document.createElement("DIV");b=document.createElement("INPUT");this.setGlobalizedUI(b);b.type="text";b.className="tagInputBox";b.size=this.cfg.INPUT_SIZE;b.value=this.cfg.INPUT_DEFAULT;b.maxLength=this.cfg.MAX_LENGTH;b.tabIndex=15;inputDiv.appendChild(b);this.addListener(b,"onfocus",this.onFocus);this.addListener(b,"onkeyup",this.onKeyUp);this.addListener(b,"onclick",this.onClick);inputDiv.appendChild(document.createTextNode("  "));a=document.createElement("A");a.href=this.getLinkHref();a.className="tlink";a.alt=a.title=this.cfg.LABEL_INPUT;a.tabIndex=16;a.appendChild(document.createTextNode(this.cfg.LABEL_INPUT));this.addListener(a,"onclick",this.onTagSubmit);inputDiv.appendChild(a);e.appendChild(inputDiv)}else{if(!checkDefined(l))l=new Msn.Controls.Link(this.cfg.SIGN_IN_TO_ADD_TAG,Msn.Passport.login,"",true);l.render(e)}f.appendChild(e);this.setHeader()}}};Msn.Controls.TagModule.prototype=Msn.Controls;Msn.Controls.TruveoAdapter=function(){var a=this;this.convertSearchResult=function(a,b){var d=null;if(checkObject(a)){var c=this.convertVideoList(a);if(c){var e=Math.min(a.totalResultsAvailable,1000);d={"SearchKey":b.term,"Videos":c,"Count":a.totalResultsReturned,"Offset":a.firstResultPosition,"TotalCount":e,"SearchType":checkDefined(b)?b.type:0}}}return d};this.convertVideoList=function(a){var d=[];if(checkObject(a)&&checkArray(a.Video)){var c=a.Video;for(var b=0;b<c.length;b++){var e=this.convertVideo(c[b]);if(e)d.push(e)}}return d};this.convertVideo=function(b){var a={};a.Title=b.title;a.Description=b.description;a.SourceFriendlyName=b.channel;a.StartDate=b.dateFound;a.Url=b.videoUrl;return a}};Msn.Controls.TruveoService=function(){var d=this,i=null,e=null,g=null,a=null,n="-channel:MSN Video -channel:soapbox",o="sort:vrank",b=null,c=null,f=0,j=0,m=100,p=30000;function l(){if(typeof AOLVideoSearch!="undefined"){k();h()}}function q(){k();d.handleError()}function k(){if(checkInt(b)){clearInterval(b);b=null}if(checkInt(c)){clearTimeout(c);c=null}}function h(){try{a=new AOLVideoSearch(Msn.Controls.config.truveoAppId);a.attachEvent("onload","Msn.TruveoService.handleVSLoad()");a.attachEvent("onupdate","Msn.TruveoService.handleUpdate()");a.attachEvent("onerror","Msn.TruveoService.handleError()");a.showAdult=0;a.results=f;a.start=j;a.initialize()}catch(b){d.handleError()}}this.makeRequest=function(k,d,o,n,a){i=n;e=a;g=k;f=d;j=o;if(typeof AOLVideoSearch=="undefined"){if(!checkInt(b)&&!checkInt(c)){b=setInterval(l,m);c=setTimeout(q,p)}}else h()};this.handleVSLoad=function(){try{a.getVideos(g+" "+n+" "+o,a.start)}catch(b){d.handleError()}};this.handleUpdate=function(){i(a.VideoSet)};this.handleError=function(){e()}};Msn.TruveoService=new Msn.Controls.TruveoService;Msn.Controls.UploadButton=function(){var a=this;this.cfg={UPLOAD_VIDEO:$["IDS_CLI_UploadVideoButtonText"],UPLOAD_VIDEO_ALT:$["IDS_CLI_UploadVideoButtonAlt"],UPLOAD_BUTTON_NORMAL:"uploadButton uploadButtonNormal",UPLOAD_BUTTON_ACTIVE:"uploadButton uploadButtonActive",UPLOAD_BUTTON_TEXT:"uploadButtonText"};this.onUploadButtonMouseOut=function(c,b){if(checkDefined(b))b.className=a.cfg.UPLOAD_BUTTON_NORMAL};this.onUploadButtonMouseOver=function(c,b){if(checkDefined(b))b.className=a.cfg.UPLOAD_BUTTON_ACTIVE};this._render=function(c){if(c!=null&&isSoapboxEnabled()&&isVideoUploadEnabled()){var a=document.createElement("div");a.className=this.cfg.UPLOAD_BUTTON_NORMAL;this.addListener(a,"onclick",this.onUploadButtonClick);this.addListener(a,"onmouseover",this.onUploadButtonMouseOver,a);this.addListener(a,"onmouseout",this.onUploadButtonMouseOut,a);c.appendChild(a);var b=document.createElement("SPAN");b.className=this.cfg.UPLOAD_BUTTON_TEXT;b.appendChild(document.createTextNode(this.cfg.UPLOAD_VIDEO));b.title=this.cfg.UPLOAD_VIDEO_ALT;a.appendChild(b)}};this.onUploadButtonClick=function(){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"upload"});a.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.Upload})}};Msn.Controls.UploadButton.prototype=Msn.Controls;Msn.Controls.UploadItem=function(){var b=this,a=null,g=null,c=null,d=null,j=null,f=null,i=null,h=null,e=null;this.cfg={CANCEL_DIALOG:$["IDS_CLI_CancelDialog"],CANCEL_FAILED:$["IDS_CLI_CancelFailed"],REMOVE_DIALOG:$["IDS_CLI_RemoveDialog"],REMOVE_FAILED:$["IDS_CLI_RemoveFailed"],REMOVE_UPLOAD_DIALOG:$["IDS_CLI_RemoveUploadDialog"],PREFIX_TEXT:$["IDS_CLI_VideoTitle"],NO_VIDEO_TEXT:$["IDS_CLI_NoVideoText"],CANCEL_TEXT:$["IDS_CLI_CancelLabel"],CANCEL_TOOLTIP:$["IDS_CLI_CancelTooltip"],RETRY_TEXT:$["IDS_CLI_RetryText"],RETRY_TOOLTIP:$["IDS_CLI_RetryTooltip"],REMOVE_TEXT:$["IDS_CLI_RemoveText"],WAITING_TO_UPLOAD:$["IDS_CLI_WaitingToUpload"],UPLOADING:$["IDS_CLI_Uploading"],PERCENTAGE_UPLOAD:$["IDS_CLI_PercentageUpload"],QUEUED:$["IDS_CLI_Queued"],VIDEO_QUEUED_FOR_UPLOAD:$["IDS_CLI_VideoQueuedForUpload"],FAILED:$["IDS_CLI_Failed"],UPLOAD_FAILED:$["IDS_CLI_UploadFailed"],DELETED:$["IDS_CLI_Deleted"],VIDEO_DELETED:$["IDS_CLI_VideoDeleted"],CANCELLED:$["IDS_CLI_Cancelled"],UPLOAD_CANCELLED:$["IDS_CLI_UploadCancelled"],PROCESSING:$["IDS_CLI_Processing"],VIDEO_PROCESSED_AVAILABLE_SOON:$["IDS_CLI_VideoProcessedAvailableSoon"],PUBLISHED:$["IDS_CLI_Published"],REJECTED:$["IDS_CLI_Rejected"],FAILED_PROCESSING:$["IDS_CLI_FailedProcessing"],VIDEO_AVAILABLE_FOR_VIEWING:$["IDS_CLI_VideoAvailableForViewing"],VIDEO_REJECTED:$["IDS_CLI_VideoRejected"],VIDEO_FAILED_TO_PROCESS:$["IDS_CLI_VideoFailedToProcess"],TITLE_MAX_LENGTH:40,IMG_REMOVE:getCDNPath("/i/delete_icon.gif"),IMG_PROGBAR:[getCDNPath("/i/1px_blkBar.gif"),getCDNPath("/i/1px_greyBar.gif")]};this.setJob=function(b){if(b!==a||null!=b&&true==b.updateUI){a=b;this.dataBind()}};this.dataBind=function(){if(checkDefined(c)){var k=checkObject(a);if(k){d.innerText=ll(a.Title,this.cfg.TITLE_MAX_LENGTH);d.title=d.alt=a.Title;d.className=this.isLinkable()?"uploadItemClickable":"";d.style.cursor=this.isLinkable()?"pointer":"default";var n=this.getStatusLabels();j.innerText=n.primaryStatus;f.innerHTML=n.secondaryStatus;var b=this.isUploading(),l=this.getUploadProgress()<100,e=this.getUploadProgress()>0;h.style.visibility=b&&l?"visible":"hidden";h.style.display=b&&l?"inline":"none";g.setVisibility(b&&e);g.setDisplay(b&&e);if(b&&e){g.setProgress(this.getUploadProgress());f.style.left="220px"}else f.style.left="10px";var m=this.isRetryable();i.style.visibility=m?"visible":"hidden";i.style.display=m?"inline":"none"}c.style.visibility=k?"visible":"hidden";c.style.display=k?"inline":"none"}};this.isUploading=function(b){b=checkObject(b)?b:a;return null!=b&&(b.Status==Msn.UploadManager.Status.New||b.Status==Msn.UploadManager.Status.Uploading)};this.isLinkable=function(){return null!=a&&checkString(a.VideoId)&&a.Status!=Msn.UploadManager.Status.Deleted&&a.Status!=Msn.UploadManager.Status.Failed&&a.ProcessingStatus!=SoapboxService.VideoStatus.Failed};this.getUploadProgress=function(b){b=checkObject(b)?b:a;var c=0;if(null!=b&&checkInt(b.BytesLoaded,1)&&checkInt(b.BytesTotal,1)&&b.BytesLoaded<=a.BytesTotal)c=b.BytesLoaded*100/b.BytesTotal;return c};this.isRetryable=function(){return null!=a&&(a.Status==Msn.UploadManager.Status.Failed||a.Status==Msn.UploadManager.Status.Cancelled)};this.getStatusLabels=function(){var d="",c="";if(null!=a)switch(a.Status){case Msn.UploadManager.Status.New:d=b.cfg.WAITING_TO_UPLOAD;c="";break;case Msn.UploadManager.Status.Uploading:if(checkInt(a.BytesTotal,1)){d=this.cfg.UPLOADING;c="<b>"+b.cfg.PERCENTAGE_UPLOAD.format(Math.round(this.getUploadProgress()),Math.round(a.BytesTotal/(1024*100))/10)+"</b>"}else{d=b.cfg.QUEUED;c=b.cfg.VIDEO_QUEUED_FOR_UPLOAD}break;case Msn.UploadManager.Status.Failed:d=b.cfg.FAILED;c=b.cfg.UPLOAD_FAILED;break;case Msn.UploadManager.Status.Deleted:d=b.cfg.DELETED;c=b.cfg.VIDEO_DELETED;break;case Msn.UploadManager.Status.Cancelled:d=b.cfg.CANCELLED;c=b.cfg.UPLOAD_CANCELLED;break;case Msn.UploadManager.Status.Completed:switch(a.ProcessingStatus){case SoapboxService.VideoStatus.New:case SoapboxService.VideoStatus.Processing:d=b.cfg.PROCESSING;c=b.cfg.VIDEO_PROCESSED_AVAILABLE_SOON;break;case SoapboxService.VideoStatus.Published:case SoapboxService.VideoStatus.Approved:case SoapboxService.VideoStatus.LockedForReview:case SoapboxService.VideoStatus.Pending:d=b.cfg.PUBLISHED;c=b.cfg.VIDEO_AVAILABLE_FOR_VIEWING;break;case SoapboxService.VideoStatus.Rejected:d=b.cfg.REJECTED;c=b.cfg.VIDEO_REJECTED;break;case SoapboxService.VideoStatus.Failed:d=b.cfg.FAILED_PROCESSING;c=b.cfg.VIDEO_FAILED_TO_PROCESS;break}break}return {primaryStatus:d,secondaryStatus:c}};this.onTitleClick=function(){if(b.isLinkable()){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"upload",section:"edit"});b.fireEvent(Msn.Event.VideoEdit,a.VideoId)}};this.onRetry=function(){if(checkObject(a)&&checkInt(a.Id,0)&&b.isRetryable(a))b.fireEvent(Msn.Event.UploadRetry,a.Id)};this.onCancel=function(){if(checkObject(a)&&checkInt(a.Id,0)&&b.isUploading(a)){var c=new Msn.Controls.Dialog;c.description=b.cfg.CANCEL_DIALOG;c.type=Msn.Dialog.Confirm;c.onComplete=function(c){b.onCancelDialogCb(c,a)};b.fireEvent(Msn.Event.DialogRequest,c)}};this.onCancelDialogCb=function(c,a){if(c&&checkObject(a)&&checkInt(a.Id,0))if(b.isUploading(a)&&b.getUploadProgress(a)<100)b.fireEvent(Msn.Event.UploadCancel,a.Id);else customAlert(b.cfg.CANCEL_FAILED)};this.onRemove=function(){if(checkObject(a)&&a.Status!=Msn.UploadManager.Status.Deleted)if(checkString(a.VideoId))if(a.ProcessingStatus!=SoapboxService.VideoStatus.Failed){var c=new Msn.Controls.Dialog;c.description=b.cfg.REMOVE_DIALOG;c.type=Msn.Dialog.Confirm;c.onComplete=function(c){b.onRemoveDialogCb(c,a)};b.fireEvent(Msn.Event.DialogRequest,c)}else b.onRemoveDialogCb(true,a);else if(checkInt(a.Id))if(a.Status==Msn.UploadManager.Status.New||a.Status==Msn.UploadManager.Status.Uploading){c=new Msn.Controls.Dialog;c.description=b.cfg.REMOVE_UPLOAD_DIALOG;c.type=Msn.Dialog.Confirm;c.onComplete=function(c){b.onRemoveDialogCb(c,a)};b.fireEvent(Msn.Event.DialogRequest,c)}else Msn.UploadManager.onUploadDeleted(a.Id)};this.onRemoveDialogCb=function(d,c){if(d)if(checkString(c.VideoId)){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"upload",section:"delete"});Msn.SoapboxServiceManager.DeleteVideo(a.VideoId,b.onDeleteCb,b.onDeleteErrorCb)}else if(checkInt(c.Id,0))Msn.UploadManager.onUploadDeleted(a.Id);};this.onDeleteCb=function(a){if(checkDefined(a)&&checkDefined(a.VideoId))if(SoapboxService.ResultCode.Success==a.StatusCode||SoapboxService.ResultCode.ABCHServiceDownRetry==a.StatusCode)Msn.Controls.fireEvent(Msn.Event.VideoDeleted,a.VideoId);else customAlert(b.cfg.REMOVE_FAILED)};this.onDeleteTimeOutCb=function(){customAlert(b.cfg.REMOVE_FAILED)};this.onItemErrorCb=function(){customAlert(b.cfg.REMOVE_FAILED)};this.onTitleMouseOver=function(){if(b.isLinkable())d.style.textDecoration="underline"};this.onTitleMouseOut=function(){d.style.textDecoration="none"};this.onMouseOver=function(){var c=b.isUploading()&&b.getUploadProgress()==100;if(checkObject(a)&&a.Status!=Msn.UploadManager.Status.Deleted&&!c)e.style.visibility="visible"};this.onMouseOut=function(){e.style.visibility="hidden"};this._render=function(k){var a,l,b;if(null!=k){c=document.createElement("DIV");c.style.paddingLeft="10px";c.style.position="relative";c.style.top="3px";this.addListener(c,"onmouseover",this.onMouseOver);this.addListener(c,"onmouseout",this.onMouseOut);k.appendChild(c);a=document.createElement("SPAN");c.appendChild(a);b=document.createTextNode(this.cfg.PREFIX_TEXT+" ");a.appendChild(b);d=document.createElement("SPAN");this.addListener(d,"onmouseover",this.onTitleMouseOver);this.addListener(d,"onmouseout",this.onTitleMouseOut);this.addListener(d,"onclick",this.onTitleClick);a.appendChild(d);b=document.createTextNode(" - ");a.appendChild(b);j=document.createElement("SPAN");a.appendChild(j);a=document.createElement("SPAN");a.style.position="relative";a.style.paddingLeft="10px";c.appendChild(a);h=this.createLink(this.cfg.CANCEL_TEXT,this.onCancel,null,this.cfg.CANCEL_TOOLTIP);a.appendChild(h);i=this.createLink(this.cfg.RETRY_TEXT,this.onRetry,null,this.cfg.RETRY_TOOLTIP);a.appendChild(i);a=document.createElement("SPAN");a.style.paddingLeft="10px";c.appendChild(a);e=document.createElement("IMG");e.style.cursor="pointer";e.style.visibility="hidden";e.src=this.cfg.IMG_REMOVE;e.title=this.cfg.REMOVE_TEXT;this.addListener(e,"onclick",this.onRemove);a.appendChild(e);a=document.createElement("DIV");a.style.position="relative";a.style.height="35px";a.style.width="300px";a.style.top="4px";c.appendChild(a);if(!checkDefined(g))g=new Msn.Controls.ProgressBar(10,0,200,13,this.cfg.IMG_PROGBAR[0],this.cfg.IMG_PROGBAR[1],"uploadItemProgressBar");g.render(a);f=document.createElement("SPAN");f.style.position="absolute";f.style.width="500px";a.appendChild(f);this.dataBind()}}};Msn.Controls.UploadItem.prototype=Msn.Controls;Msn.Controls.UploadManager=function(){var a=this,b=[],o=false,p=false,n=false,t=-3,i=false,h=false,s=514,r=460,e=null,c=null,f=null,l=null,d=null,m,q=function(){},g=[],k=false,j=false;if(!checkDefined(Msn.UploadManager)){Msn.UploadManager=this;Msn.UploadManager.Status=SoapboxService.Utils.CreateEnum("New",0,"Uploading",1,"Completed",2,"Failed",3,"Cancelled",4,"Deleted",5)}this.cfg={MSG_VIDEOADDPERMISSIONERROR:$["IDS_CLI_MsgVideoAddPermmissionsError"]};this.subscribeEvent(Msn.Event.Navigate);this.subscribeEvent(Msn.Event.ApplicationTick);this.subscribeEvent(Msn.Event.VideoEdited);this.subscribeEvent(Msn.Event.VideoDeleted);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.FocusReceived);this.subscribeEvent(Msn.Event.UploadRetry);this.subscribeEvent(Msn.Event.UploadCancel);this.subscribeEvent(Msn.Event.VideoEdit);this.subscribeEvent(Msn.Event.ViewAllUpload);this.subscribeEvent(Msn.Event.WindowResize);this.subscribeEvent(Msn.Event.HistoryChanged);this.subscribeEvent(Msn.Event.Search);this.subscribeEvent(Msn.Event.SplitSearch);this.subscribeEvent(Msn.Event.NavigateCategory);this.subscribeEvent(Msn.Event.ViewProfile);this.subscribeEvent(Msn.Event.ViewAllProfileTags);this.subscribeEvent(Msn.Event.ViewAllProfileComments);this.onEvent=function(m,d,f){if(d==Msn.Event.ApplicationTick){if(Msn.Passport.isUserLoggedIn()){if(++t%30==0&&!p&&(!o||this.IsProcessing()))a.refreshProcessingStatus();if(h){h=false;this.fireEvent(Msn.Event.UploadQueueChanged,b.clone());for(var g=0;g<b.length;g++){var l=b[g];l.updateUI=false}}}}else if(d==Msn.Event.Navigate)if(checkDefined(f)&&checkDefined(f.menuId)&&(f.menuId==Msn.Menu.UploadVideos||f.menuId==Msn.Menu.Upload)){if(checkDefined(c)){try{c.reset()}catch(n){}k=false;j=true;this.setUploaderPosition();setTimeout(this.setUploaderPosition,500);this.fireEvent(Msn.Event.FocusRequest,this)}}else{j=false;this.hideUploader()}else if(d==Msn.Event.VideoDeleted){l=a.GetJobByVideoId(f);this.setJobStatus(l,Msn.UploadManager.Status.Deleted);i=true;this.refreshProcessingStatus()}else if(d==Msn.Event.VideoEdited){i=true;this.refreshProcessingStatus()}else if(d==Msn.Event.ControlsAckFullScreen){if(checkDefined(e)){if(isTrue(a.cfg.USE_WINDOW_MODE))if(f)a.hideUploader();else if(j){k=false;a.setUploaderPosition()}e.style.visibility=f?"hidden":"visible"}}else if(d==Msn.Event.UploadCancel){if(checkInt(f))this.uploadCancel(f)}else if(d==Msn.Event.UploadRetry){if(checkInt(f))this.uploadRetry(f)}else if(d==Msn.Event.FocusReceived)this.focus();else if(d==Msn.Event.VideoEdit||d==Msn.Event.ViewAllUpload||d==Msn.Event.HistoryChanged||d==Msn.Event.SplitSearch||d==Msn.Event.Search||d==Msn.Event.NavigateCategory||d==Msn.Event.ViewProfile||d==Msn.Event.ViewAllProfileTags||d==Msn.Event.ViewAllProfileComments){j=false;this.hideUploader()}else if(d==Msn.Event.WindowResize)this.setUploaderPosition()};this.addCallback=function(c,f,d,e,b){var a={};a.list=[];a.emailList=[];if(checkDefined(c))a.list=c;a.type=f;a.successCb=d;a.errorCb=e;if(checkDefined(b))a.emailList=b;g.push(a)};this.cfg={TITLE_MAX_LENGTH:35,REMOVE_FAILED:$["IDS_CLI_RemoveFailed"],UNKNOWN:$["IDS_CLI_Unknown"],UPLOAD_VIDEO:$["IDS_CLI_UploadVideo"],MAX_UPLOAD_SIZE:$["IDS_GMT_MaxUploadSize"],USE_WINDOW_MODE:$["IDS_UPL_UseWindowMode"]};this.CreateJob=function(d,g,e,c){var a={};a.Title=checkString(d)?d:this.cfg.UNKNOWN;a.BytesLoaded=0;a.BytesTotal=0;if(checkInt(c)){a.Id=-1;a.VideoId=e;a.Status=Msn.UploadManager.Status.Completed;a.ProcessingStatus=c}else{a.Id=g;a.VideoId=0;a.Status=Msn.UploadManager.Status.New;a.ProcessingStatus=SoapboxService.VideoStatus.New}var f=b.length;b[f]=a;return a};this.IsUploading=function(){var c=false;for(var a=0;a<b.length;a++){var d=b[a];if(d.Status<Msn.UploadManager.Status.Completed){c=true;break}}return c};this.IsProcessing=function(){var c=false;for(var a=0;a<b.length;a++){var d=b[a];if(Msn.UploadManager.Status.Completed==d.Status&&SoapboxService.VideoStatus.Processing>=d.ProcessingStatus){c=true;break}}return c};this.GetJobByVideoId=function(c){if(checkString(c))for(var a=0;a<b.length;a++)if(c==b[a].VideoId)return b[a];return null};this.GetJobById=function(c){if(checkInt(c))for(var a=0;a<b.length;a++)if(c==b[a].Id)return b[a];return null};this.refreshProcessingStatus=function(){var a=Msn.Controls.SearchQueryFactory.create(Msn.Passport.getCid(),SoapboxService.SearchType.AllVideos,0,SoapboxService.SortOrder.DateUploaded);a.disableMenuSelect();a.disableHistoryEntry();var b=new Msn.Controls.SearchQueryService(a);b.makeRequest(30,null,this.onRefreshJobsStatusCb,this.onRefreshJobsStatusErrorCb)};this.onRefreshJobsStatusCb=function(b,e){var f=false;n=false;e=typeof e=="boolean"&&e;e=e||!o;if(checkDefined(b)&&checkDefined(b.Videos))for(var c=b.Videos.length-1;c>=0;c--){var d=a.GetJobByVideoId(b.Videos[c].Id);if(null!=d){if(SoapboxService.VideoStatus.New==b.Videos[c].Status)b.Videos[c].Status=SoapboxService.VideoStatus.Processing;if(d.ProcessingStatus!=b.Videos[c].Status){d.ProcessingStatus=b.Videos[c].Status;d.updateUI=true;f=true}if(d.Title!=b.Videos[c].Title){d.Title=b.Videos[c].Title;d.updateUI=true;f=true}}else switch(b.Videos[c].Status){case SoapboxService.VideoStatus.New:case SoapboxService.VideoStatus.Processing:case SoapboxService.VideoStatus.Failed:if(e){a.CreateJob(b.Videos[c].Title,null,b.Videos[c].Id,b.Videos[c].Status);f=true}break;default:break}}if(f){h=true;a.fireEvent(Msn.Event.VideoUpdated,b.Videos)}else if(i)a.fireEvent(Msn.Event.VideoUpdated,b.Videos);o=true;i=false};this.onRefreshJobsStatusErrorCb=function(){if(n)p=true;else n=true};this.setJobStatus=function(a,d,b,c){if(checkObject(a)&&(a.Status!=d||checkInt(b,0)&&a.BytesLoaded!=b)){h=true;a.Status=d;a.updateUI=true;if(checkInt(b,0)&&checkInt(c,0)){a.BytesLoaded=b;a.BytesTotal=c}else Msn.Reporting.upload(a.Status,"")}};this.focus=function(){if(checkDefined(c))try{c.focus()}catch(a){}};this.onSharedOptionPicked=function(){m=new Msn.Controls.ContactPicker;m.setOnData(a.onContactPickerData);m._render()};this.onContactPickerData=function(b){g=[];var c=b.categoriesToAdd,d=b.contactsToAdd,e=b.emailsToAdd;if(c.length>0)a.addCallback(c,"Category",a.AddPermissionCb,a.AddPermissionErrorCb);if(d.length>0||e.length>0)a.addCallback(d,"Contact",a.AddPermissionCb,a.AddPermissionErrorCb,e)};this.onUploadStarted=function(b,d){this.log("uploadManager","[Uploader] : >> onUploadStarted() "+b+", "+d);var c=a.GetJobById(b);if(!checkDefined(c)&&checkInt(b,0)){c=this.CreateJob(d,b);Msn.Reporting.upload("","upload")}this.setJobStatus(c,Msn.UploadManager.Status.Uploading,0,0)};this.AddPermissionCb=function(b){if(checkObject(b)&&checkDefined(b.StatusCode)&&b.StatusCode==SoapboxService.ResultCode.Success)a.AddPermissions();else customAlert(a.cfg.MSG_VIDEOADDPERMISSIONERROR,true)};this.AddPermissionErrorCb=function(){customAlert(a.cfg.MSG_VIDEOADDPERMISSIONERROR,true)};this.AddPermissions=function(){if(g.length>0){var a=g.pop();q=this.AddPermissions;Msn.SoapboxServiceManager.AddPermissions(a.videoId,a.list.toString(),encodeURIComponent(a.emailList.toString()),a.type,a.successCb,a.errorCb)}};this.onUploadProgress=function(d,b,c){var e=a.GetJobById(d);this.setJobStatus(e,Msn.UploadManager.Status.Uploading,b,c)};this.onUploadSuccess=function(d,e,f){this.log("uploadManager","[Uploader] : >> onUploadSuccess() "+d);var b=a.GetJobById(d);if(checkDefined(b)){b.VideoId=e;b.ProcessingStatus=SoapboxService.VideoStatus.New}this.setJobStatus(b,Msn.UploadManager.Status.Completed);if(f==2){for(var c=0;c<g.length;c++)g[c].videoId=e;a.AddPermissions()}};this.onUploadFailure=function(c){this.log("uploadManager","[Uploader] : >> onUploadFailure() "+c);var b=a.GetJobById(c);if(Msn.UploadManager.Status.Cancelled!=b.Status&&Msn.UploadManager.Status.Deleted!=b.Status)this.setJobStatus(b,Msn.UploadManager.Status.Failed)};this.onUploadDeleted=function(d){a.log("uploadManager","[Uploader] : >> onUploadDeleted() "+d);var b=a.GetJobById(d);if(checkDefined(b)&&!checkString(b.VideoId))if(checkDefined(c)&&(b.Status==Msn.UploadManager.Status.New||b.Status==Msn.UploadManager.Status.Uploading))if(b.BytesLoaded==0||b.BytesLoaded<b.BytesTotal)try{if(c.cancelUpload(d))this.setJobStatus(b,Msn.UploadManager.Status.Deleted);else customAlert(this.cfg.REMOVE_FAILED)}catch(e){customAlert(this.cfg.REMOVE_FAILED)}else customAlert(this.cfg.REMOVE_FAILED);else this.setJobStatus(b,Msn.UploadManager.Status.Deleted)};this.onCancel=function(){Msn.Controls.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MySoapbox})};this.uploadRetry=function(b){a.log("uploadManager","[Uploader] : >> uploadRetry() "+b);var d=a.GetJobById(b);if(checkDefined(d)&&checkDefined(c)&&(d.Status==Msn.UploadManager.Status.Failed||d.Status==Msn.UploadManager.Status.Cancelled))c.retryUpload(b)};this.uploadCancel=function(d){a.log("uploadManager","[Uploader] : >> uploadCancel() "+d);var b=a.GetJobById(d);if(checkDefined(b)&&checkDefined(c)&&(b.Status==Msn.UploadManager.Status.New||b.Status==Msn.UploadManager.Status.Uploading)&&(b.BytesLoaded==0||b.BytesLoaded<b.BytesTotal))if(c.cancelUpload(d))a.setJobStatus(b,Msn.UploadManager.Status.Cancelled)};this.cancelAllUploads=function(){a.log("uploadManager","[Uploader] : >> cancelAllUploads()");for(var c=0;c<b.length;c++){var d=b[c];a.uploadCancel(d.Id)}};this.hideUploader=function(){k=true;if(isTrue(a.cfg.USE_WINDOW_MODE))a.fireEvent(Msn.Event.ChangeDialogMode,Msn.DialogMode.Custom);if(a.getBrowser()==Msn.Browser.Firefox&&checkDefined(d)){d.style.left="-1000px";d.style.top="-1000px"}};this.setUploaderPosition=function(){if(!k){if(isTrue(a.cfg.USE_WINDOW_MODE))a.fireEvent(Msn.Event.ChangeDialogMode,Msn.DialogMode.Native);if(a.getBrowser()==Msn.Browser.Firefox&&checkDefined(l)&&checkDefined(d)){var b=l,c={x:0,y:0};while(b){c.x+=b.offsetLeft;c.y+=b.offsetTop;b=b.offsetParent}c.y+=8;d.style.left=c.x+"px";d.style.top=c.y+"px"}}};this._render=function(b){if(null!=b)if(!checkDefined(f)){var g="mkt={0}&brand={1}&appId={2}&uplEnabled={3}&maxSize={4}&sb=1&cluster={5}";g=g.format(checkString(Msn.Controls.config.market)?Msn.Controls.config.market:"",checkString(Msn.Controls.config.brand)?Msn.Controls.config.brand:"",checkString(Msn.Controls.config.applicationId)?Msn.Controls.config.applicationId:"",checkDefined(Msn.Controls.config.uploadEnabled)?Msn.Controls.config.uploadEnabled:"true",checkInt(this.cfg.MAX_UPLOAD_SIZE,0)?this.cfg.MAX_UPLOAD_SIZE:"",checkDefined(Msn.Controls.config.uploadCluster)?Msn.Controls.config.uploadCluster:"");e=new Msn.Controls.FlashObject("uploader",Msn.Controls.config.uploaderUrl,s,r);e.setFlashVars(g);e.setBgColor("#ffffff");if(isTrue(a.cfg.USE_WINDOW_MODE))e.setWMode("window");f=new Msn.Controls.Container(true,true,this.cfg.UPLOAD_VIDEO,false);if(this.getBrowser()!=Msn.Browser.Firefox){f.setContent(e);f.render(b)}else{f.setContainerBodyClass("uploadContainerBody");f.render(b);l=document.createElement("DIV");b.appendChild(l);d=document.createElement("DIV");document.body.appendChild(d);d.style.position="absolute";e.render(d)}c=e.getObjectNode()}}};Msn.Controls.UploadManager.prototype=Msn.Controls;function sharedOptionPicked(){if(checkDefined(Msn.UploadManager))Msn.UploadManager.onSharedOptionPicked()}function uploadSelected(){if(checkDefined(Msn.UploadManager))Msn.UploadManager.focus()}function uploadStarted(a,c,b){if(checkDefined(Msn.UploadManager))Msn.UploadManager.onUploadStarted(a,c,b)}function uploadProgress(c,a,b){if(checkDefined(Msn.UploadManager))Msn.UploadManager.onUploadProgress(c,a,b)}function uploadSuccess(b,c,a){if(checkDefined(Msn.UploadManager))Msn.UploadManager.onUploadSuccess(b,c,a)}function uploadFailure(a,b){if(checkDefined(Msn.UploadManager))Msn.UploadManager.onUploadFailure(a,b)}function cancelClicked(){if(checkDefined(Msn.UploadManager))Msn.UploadManager.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MySoapbox})}function browseVideos(){if(checkDefined(Msn.UploadManager))Msn.UploadManager.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.BrowseVideos})}Msn.Controls.UploadPage=function(){var g=this,c=null,b=null,e=new Msn.Controls.UploadManager,f=new Msn.Controls.UploadQueue(false),a=null,d=false;this.cfg={UPLOAD_QUEUE_PREVIEW_LENGTH:1,SIGN_IN_REQD_TO_MODIFY:$["IDS_CLI_SignInReqdToModify"],UPLOAD_NOT_AVAILABLE:$["IDS_CLI_UploadNotAvailable"],NICKNAME_REQD_TO_UPLOAD:$["IDS_CLI_NicknameReqdToUpload"],CURRENT_VIDEO_STATUS:$["IDS_CLI_CurrentVideoStatus"]};this.subscribeEvent(Msn.Event.NicknameSet);this.subscribeEvent(Msn.Event.FocusReceived);this.subscribeEvent(Msn.Event.UploadQueueChanged);this.onEvent=function(g,c,f){if(c==Msn.Event.UploadQueueChanged){d=f.length>this.cfg.UPLOAD_QUEUE_PREVIEW_LENGTH;if(checkDefined(a))a.showViewAll(d)}if(c==Msn.Event.NicknameSet){b.dispose();b=null;this.render();if(this.getBrowser()==Msn.Browser.Firefox)this.fireEvent(Msn.Event.Navigate,{menuId:Msn.Menu.Upload})}else if(c==Msn.Event.FocusReceived)if(Msn.Passport.isUserLoggedIn())if(checkDefined(b))b.onEvent(this,c);else e.onEvent(this,c)};this._render=function(g){if(null!=g)if(!isVideoUploadEnabled()){var h=document.createElement("SPAN");h.className="headerText";h.innerText=this.cfg.UPLOAD_NOT_AVAILABLE;g.appendChild(h)}else if(!Msn.Passport.isUserLoggedIn()){if(!checkDefined(c))c=new Msn.Controls.Link(this.cfg.SIGN_IN_REQD_TO_MODIFY,Msn.Passport.login,"needSignin",true);c.render(g)}else if(!Msn.Passport.getHasNickname()){if(!checkDefined(c))b=new Msn.Controls.Nickname(this.cfg.NICKNAME_REQD_TO_UPLOAD+"<BR />");b.render(g)}else{if(!checkDefined(a)){a=new Msn.Controls.Container(true,true,this.cfg.CURRENT_VIDEO_STATUS,false);a.setContent(f);a.showViewAll(d);a.setOnViewAllClick(f.onViewAll)}a.render(g);g.appendChild(document.createElement("BR"));e.render(g)}}};Msn.Controls.UploadPage.prototype=Msn.Controls;Msn.Controls.UploadQueue=function(f){var g=this,a=null,b=true,d=f?30:1,c=[];for(var e=0;e<d;e++)c[e]=new Msn.Controls.UploadItem;this.subscribeEvent(Msn.Event.UploadQueueChanged);this.onEvent=function(j,h,g){if(h==Msn.Event.UploadQueueChanged){var f=g.clone();b=f.length==0;if(checkDefined(a)){a.style.visibility=b?"visible":"hidden";a.style.display=b?"inline":"none"}for(var e=0;e<f.length&&e<d;e++){var i=f[f.length-1-e];c[e].setJob(i)}}};this.cfg={NO_VIDEO_TEXT:$["IDS_CLI_NoVideoText"]};this.onViewAll=function(){g.fireEvent(Msn.Event.ViewAllUpload)};this._render=function(g){var e;if(null!=g){a=document.createElement("DIV");a.style.paddingTop="5px";a.style.paddingLeft="10px";a.style.visibility=b?"visible":"hidden";a.style.display=b?"inline":"none";e=document.createElement("SPAN");e.innerText=this.cfg.NO_VIDEO_TEXT;a.appendChild(e);e=document.createElement("SPAN");e.style.position="relative";e.style.top="4px";e.style.left="5px";a.appendChild(e);e=document.createElement("DIV");e.appendChild(document.createElement("BR"));a.appendChild(e);g.appendChild(a);for(var f=0;f<d;f++)c[f].render(g)}}};Msn.Controls.UploadQueue.prototype=Msn.Controls;Msn.Controls.UploadStatus=function(){var d=this,a=null,b=null,c=false;this.subscribeEvent(Msn.Event.UploadQueueChanged);this.onEvent=function(m,l,k){var e=false;if(l==Msn.Event.UploadQueueChanged){var j=k,g=0,f=0;for(var i=0;i<j.length;i++){var h=j[i];if(h.Status<Msn.UploadManager.Status.Completed)g++;else if(h.Status<Msn.UploadManager.Status.Failed&&h.ProcessingStatus<SoapboxService.VideoStatus.Published)f++}this.setData(g,true);this.setData(f,false);a.setDisplay(false);b.setDisplay(false);if(g>0){a.setDisplay(true);e=true}else if(f>0){b.setDisplay(true);e=true}else e=false;if(c!=e){if(e)d.fireEvent(Msn.Event.RequestProcessed,Msn.Spinner.MainPanel);else d.fireEvent(Msn.Event.RequestCompleted,Msn.Spinner.MainPanel);c=e}}};this.cfg={UPLOADING_ONE_TEXT:$["IDS_CLI_UploadingOneText"],UPLOADING_MANY_TEXT:$["IDS_CLI_UploadingManyText"],PROCESSING_ONE_TEXT:$["IDS_CLI_ProcessingOneText"],PROCESSING_MANY_TEXT:$["IDS_CLI_ProcessingManyText"]};this.setData=function(c,e){var f=e?a:b;if(checkDefined(f)){var d="";if(c>0)if(e)d=c>1?this.cfg.UPLOADING_MANY_TEXT.format(c):this.cfg.UPLOADING_ONE_TEXT.format(c);else d=c>1?this.cfg.PROCESSING_MANY_TEXT.format(c):this.cfg.PROCESSING_ONE_TEXT.format(c);f.setText(d)}};this._render=function(c){if(null!=c){if(!checkDefined(a)){a=new Msn.Controls.UploadStatusLabel;b=new Msn.Controls.UploadStatusLabel}a.render(c);b.render(c)}}};Msn.Controls.UploadStatus.prototype=Msn.Controls;Msn.Controls.UploadStatusLabel=function(){var d=this,c="",a=null,b=null;this.cfg={TXT_PREFIX:$["IDS_CLI_TxtPrefix"]};this.setText=function(d){if(checkDefined(b)&&checkDefined(a)){c=d;if(checkString(c)){b.innerText=" : "+c;a.style.visibility="visible"}else a.style.visibility="hidden"}else c=d};this.onLinkClicked=function(){d.fireEvent(Msn.Event.ViewAllUpload)};this.onLinkMouseOut=function(b,a){if(checkDefined(a))a.style.textDecoration="none"};this.onLinkMouseOver=function(b,a){if(checkDefined(a))a.style.textDecoration="underline"};this._render=function(e){var d;if(null!=e){a=document.createElement("DIV");d=document.createElement("SPAN");d.title=this.cfg.TXT_PREFIX;d.style.cursor="pointer";d.style.color="#ffffff";d.appendChild(document.createTextNode(this.cfg.TXT_PREFIX));this.addListener(d,"onclick",this.onLinkClicked);this.addListener(d,"onmouseover",this.onLinkMouseOver,d);this.addListener(d,"onmouseout",this.onLinkMouseOut,d);a.appendChild(d);b=document.createElement("SPAN");b.style.color="#ffffff";a.appendChild(b);this.setText(c);e.appendChild(a)}}};Msn.Controls.UploadStatusLabel.prototype=Msn.Controls;if(getBrowser()!=Msn.Browser.IE)attachMozillaCompatibility(window);function attachMozillaCompatibility(a){a.CollectGarbage=function(){};function k(a){window.event=a}function w(b,c,d){var a=c.slice(2);if(a=="mousewheel")a="DOMMouseScroll";if(a!="mouseenter"&&a!="mouseleave")b.addEventListener(a,k,true);else{b.addEventListener("mouseover",k,true);b.addEventListener("mouseout",k,true);b.addEventListener("mouseover",t,false);b.addEventListener("mouseout",u,false)}b.addEventListener(a,d,false)}function t(){if(!this.contains(event.fromElement)){var a=document.createEvent("MouseEvents");a.initEvent("mouseenter",false,false);this.dispatchEvent(a)}}function u(){if(!this.contains(event.toElement)){var a=document.createEvent("MouseEvents");a.initEvent("mouseleave",false,false);this.dispatchEvent(a)}}function v(d,b,c){var a=b.slice(2);if(b=="mousewheel")a="DOMMouseScroll";d.removeEventListener(a,c,false)}function g(a){try{while(a&&a.nodeType!=1)a=a.parentNode}catch(b){a=null}return a}var c=a.HTMLElement.prototype,x=a.HTMLDocument.prototype,b=a.Event.prototype,d=a.CSSStyleDeclaration.prototype,m=a.Document.prototype,h=a.Node.prototype;a.attachEvent=a.HTMLDocument.prototype.attachEvent=a.HTMLElement.prototype.attachEvent=function(b,a){w(this,b,a);return true};a.detachEvent=a.HTMLDocument.prototype.detachEvent=a.HTMLElement.prototype.detachEvent=function(b,a){v(this,b,a);return true};m.__proto__={__proto__:m.__proto__};m.__defineGetter__("xml",function(){return (new XMLSerializer).serializeToString(this)});a.Document.prototype.scripts=document.getElementsByTagName("script");a.Document.prototype.selection={};a.Document.prototype.selection.clear=function(){window.getSelection().deleteFromDocument()};a.Document.prototype.selection.empty=function(){window.getSelection().removeAllRanges()};a.Document.prototype.selection.createRange=function(){return window.getSelection().getRangeAt(0)};a.HTMLElement.prototype.removeNode=function(){return this.parentNode?this.parentNode.removeChild(this):this};a.HTMLElement.prototype.contains=function(a){while(a!=null&&a!=this)a=a.parentElement;return a!=null};function s(e){var d=new Array("Top","Left","Right","Bottom"),a=document.defaultView.getComputedStyle(e,null);for(var c=0;c<d.length;c++){var b=d[c];this["border"+b+"Width"]=a.getPropertyValue("border-"+b+"-width");this["margin"+b]=a.getPropertyValue("margin-"+b);this["padding"+b]=a.getPropertyValue("padding-"+b)}this["position"]=a.getPropertyValue("position");this["height"]=a.getPropertyValue("height");this["width"]=a.getPropertyValue("width");this["zIndex"]=a.getPropertyValue("z-index");this["color"]=a.getPropertyValue("color");this["direction"]=a.getPropertyValue("direction");this["overflowY"]=a.getPropertyValue("overflow-y");return this}var f=false,o=document.getElementsByTagName("HTML")[0];function i(a){if(f){a.preventDefault();a.returnValue=false;document.removeEventListener("mousemove",i,true);var b=document.createEvent("MouseEvents");b.initMouseEvent(a.type,a.bubbles,a.cancelable,a.view,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.button,a.relatedTarget);b._FixOffset=g(a.srcElement);if(b._FixOffset==o)b._FixOffset=document.body;f.dispatchEvent(b);document.addEventListener("mousemove",i,true);a.stopPropagation();a._FixOffset=null}}function l(a){if(f){document.removeEventListener("mouseup",l,true);document.removeEventListener("mousemove",i,true);var d=a.bubbles,c=a.cancelable;if(a.type=="mouseup"){d=false;c=false}var b=document.createEvent("MouseEvents");b.initMouseEvent(a.type,d,c,a.view,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.button,a.relatedTarget);b._FixOffset=g(a.srcElement);if(b._FixOffset==o)b._FixOffset=document.body;f.dispatchEvent(b);f=null;a.stopPropagation();a.preventDefault();a._FixOffset=null}}function e(a){a.stopPropagation();a.preventDefault()}function r(a){if(a.button!=0&&a.button!=1)a.stopPropagation()}a.document.addEventListener("click",r,true);a.HTMLElement.prototype.click=function(){var b=document.createEvent("MouseEvents");b.initEvent("click",true,true);var c=this.dispatchEvent(b);if(c||typeof event.returnValue=="boolean"&&event.returnValue){var a=this;while(a)if(a.tagName=="A"&&a.href!=""){if(a.target)window.open(a.href,a.target);else document.location=a.href;a=null}else a=a.parentElement}};a.HTMLElement.prototype.setCapture=function(){f=this;document.addEventListener("mousemove",i,true);document.addEventListener("mouseover",e,true);document.addEventListener("mouseout",e,true);document.addEventListener("mouseenter",e,true);document.addEventListener("mouseleave",e,true);document.addEventListener("mouseup",l,true)};a.HTMLElement.prototype.releaseCapture=function(){f=null;document.removeEventListener("mousemove",i,true);document.removeEventListener("mouseover",e,true);document.removeEventListener("mouseout",e,true);document.removeEventListener("mouseenter",e,true);document.removeEventListener("mouseleave",e,true);document.removeEventListener("mouseup",l,true)};a.HTMLElement.prototype.insertAdjacentElement=function(b,a){switch(b.toLowerCase()){case "beforebegin":return this.parentNode.insertBefore(a,this);break;case "beforeend":return this.appendChild(a);break;case "afterbegin":return this.insertBefore(a,this.firstChild);break;case "afterend":if(this.nextSibling)return this.parentNode.insertBefore(a,this.nextSibling);else return this.parentNode.appendChild(a);break;default:throw"Invalid Argument";break}return null};d.__proto__={__proto__:d.__proto__};d.__defineGetter__("pixelLeft",function(){return parseInt(this.left)||0});d.__defineSetter__("pixelLeft",function(a){this.left=a+"px"});d.__defineGetter__("pixelHeight",function(){return parseInt(this.height)||0});d.__defineSetter__("pixelHeight",function(a){this.height=a+"px"});d.__defineGetter__("pixelTop",function(){return parseInt(this.top)||0});d.__defineSetter__("pixelTop",function(a){this.top=a+"px"});d.__defineGetter__("pixelWidth",function(){return parseInt(this.width)||0});d.__defineSetter__("pixelWidth",function(a){this.width=a+"px"});d.__defineGetter__("cssText",function(){var b="";for(var a=0;a<this.cssRules.length;a++)b+=this.cssRules[a].cssText;return b});c.__proto__={__proto__:c.__proto__};c.__defineGetter__("children",function(){var b=[],d=this.childNodes.length;for(var a=0;a<d;a++){var c=this.childNodes[a];if(c.nodeType==1)b.add(c)}return b});c.__defineGetter__("parentElement",function(){return g(this.parentNode)});c.__defineGetter__("onfilterchange",function(){return this.filters.onfilterchange});c.__defineSetter__("onfilterchange",function(a){this.filters.onfilterchange=a});c.__defineGetter__("filters",function(){return []});c.__defineGetter__("innerText",function(){try{return this.textContent}catch(c){var b="";for(var a=0;a<this.childNodes.length;a++)if(this.childNodes[a].nodeType==3)b+=this.childNodes[a].textContent;return b}});function p(e){var a=[],f=e.length,d;for(var c=0;c<f;c++){var b=e.charAt(c);switch(b){case "<":a.push("&lt;");break;case ">":a.push("&gt;");break;case '"':a.push("&quot;");break;case "&":a.push("&amp;");break;case " ":if(d==" ")a.push("&nbsp;");else a.push(" ");break;case "\r":break;case "\n":a.push("\r\n\r\n<br />");break;default:a.push(b);break}d=b}return a.join("")}c.__defineSetter__("innerText",function(a){if(a)this.innerHTML=p(a);else this.innerHTML=""});c.__defineGetter__("currentStyle",function(){return new s(this)});c.swapNode=function(a){var b=this.nextSibling,c=this.parentNode;a.parentNode.replaceChild(this,a);c.insertBefore(a,b)};c.replaceNode=function(a){this.parentNode.replaceChild(a,this)};a.XMLDocument.prototype.transformNodeToObject=function(c){var a=new XSLTProcessor;a.importStylesheet(c);var b=document.implementation.createDocument("","",null);return a.transformToFragment(this,b)};a.XMLDocument.prototype.loadXML=function(c){var b=(new DOMParser).parseFromString(c,"text/xml");while(this.hasChildNodes())this.removeChild(this.lastChild);for(var a=0;a<b.childNodes.length;a++)this.appendChild(this.importNode(b.childNodes[a],true))};a.XMLDocument.prototype.transformNode=function(c){var a=new XSLTProcessor;a.importStylesheet(c);var d=document.implementation.createDocument("","",null),b=a.transformToDocument(this);return b.xml};a.XMLDocument.prototype.setProperty=function(){return null};a.XMLDOMParser=a.DOMParser;a.DocumentFragment.prototype.getElementById=function(e){var d=[],c=this.childNodes,a,b;for(b=0;b<c.length;b++){a=c[b];if(a.nodeType==1)d.queue(a)}while(d.length){a=d.dequeue();if(a.id==e)return a;c=a.childNodes;if(c.length!=0)for(b=0;b<c.length;b++){a=c[b];if(a.nodeType==1)d.queue(a)}}return null};a.DocumentFragment.prototype.createElement=function(a){return document.createElement(a)};function n(d,g,a){a=a?a:d;var f=new XPathEvaluator,c=f.evaluate(g,a,d.createNSResolver(d.documentElement),XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),e=new Array(c.snapshotLength);for(var b=0;b<c.snapshotLength;b++)e[b]=c.snapshotItem(b);return e}function q(e,c,d){c+="[1]";var a=n(e,c,d);if(a.length!=0)for(var b=0;b<a.length;b++)if(a[b])return a[b];return null}a.XMLDocument.prototype.selectNodes=function(b,a){return n(this,b,a)};a.XMLDocument.prototype.selectSingleNode=function(b,a){return q(this,b,a)};a.Node.prototype.selectNodes=function(a){var b=this.ownerDocument;return b.selectNodes(a,this)};a.Node.prototype.selectSingleNode=function(a){var b=this.ownerDocument;return b.selectSingleNode(a,this)};h.__proto__={__proto__:h.__proto__};h.__defineGetter__("baseName",function(){return this.localName});h.__defineGetter__("xml",function(){return (new XMLSerializer).serializeToString(this)});h.__defineGetter__("text",function(){return this.textContent});h.__defineSetter__("text",function(a){this.textContent=a});function j(a){var b={x:0,y:0};while(a){b.x+=a.offsetLeft;b.y+=a.offsetTop;a=a.offsetParent}return b}b.__proto__={__proto__:b.__proto__};b.__defineGetter__("srcElement",function(){var a=this._FixOffset;if(!a)a=g(this.target);return a});b.__defineSetter__("cancelBubble",function(a){if(a)this.stopPropagation()});b.__defineGetter__("offsetX",function(){return window.pageXOffset+this.clientX-(this._FixOffset?j(this._FixOffset).x:j(this.srcElement).x)});b.__defineGetter__("offsetY",function(){return window.pageYOffset+this.clientY-(this._FixOffset?j(this._FixOffset).y:j(this.srcElement).y)});b.__defineGetter__("x",function(){return this.offsetX});b.__defineGetter__("y",function(){return this.offsetY});b.__defineGetter__("returnValue",function(){return this.cancelDefault});b.__defineSetter__("returnValue",function(a){if(!a)this.preventDefault();this.cancelDefault=a;return a});b.__defineGetter__("button",function(){return this.which==1?1:this.which==3?2:0});b.__defineGetter__("fromElement",function(){var a;if(this.type=="mouseover")a=this.relatedTarget;else if(this.type=="mouseout")a=this.target;return g(a)});b.__defineGetter__("toElement",function(){var a=null,b;try{if(this.type=="mouseout")a=this.relatedTarget;else if(this.type=="mouseover")a=this.target}catch(c){}return g(a)})}var __ap=Array.prototype;__ap.add=__ap.queue=function(a){this.push(a)};__ap.addRange=function(a){if(a)this.push.apply(this,a);return this};__ap.clear=function(){if(this.length>0)this.splice(0,this.length)};__ap.clone=function(){return [].addRange(this)};__ap.contains=__ap.exists=function(b){var a=this.indexOf(b);return a>=0};__ap.dequeue=Array.prototype.shift;if(!__ap.indexOf)__ap.indexOf=function(d,a){var c=this.length;if(c!=0){a=a||0;if(a<0)a=Math.max(0,c+a);for(var b=a;b<c;b++)if(this[b]==d)return b}return -1};if(!__ap.forEach)__ap.forEach=function(d,b){var c=this.length;for(var a=0;a<c;a++)d.call(b,this[a],a,this)};__ap.insert=function(a,b){this.splice(a,0,b)};__ap.remove=function(b){var a=this.indexOf(b);if(a>=0)this.splice(a,1);return a>=0};__ap.removeAt=function(a){return this.splice(a,1)[0]};Array._typeName="Array";var __sp=String.prototype;__sp.endsWith=function(a){return this.substr(this.length-a.length)==a};__sp.startsWith=function(a){return this.substr(0,a.length)==a};__sp.lTrim=__sp.trimStart=function(){return this.replace(/^\s*/,"")};__sp.rTrim=__sp.trimEnd=function(){return this.replace(/\s*$/,"")};__sp.trim=function(){return this.trimStart().trimEnd()};__sp.format=function(){var c=this,b=__sp.format.aRegExp,e=arguments.length;for(var a=0;a<e;a++){if(!b[a])b[a]="{"+a+"}";var d=c.indexOf(b[a]);while(d!=-1){c=c.replace(b[a],arguments[a]);d=c.indexOf(b[a])}}return c};__sp.format.aRegExp=[];String.isEmpty=function(a){return Object.isNull(a)||""==a};String.format=function(b){var c=new Sys.StringBuilder;for(var a=0;true;){var d=b.indexOf("{",a);if(d<0){c.append(b.slice(a));break}c.append(b.slice(a,d));a=d+1;if(b.charAt(a)=="{"){c.append("{");a++;continue}var d=b.indexOf("}",a),f=b.slice(a,d).split(":"),g=Number.parse(f[0])+1,e=arguments[g];if(e==null)e="";if(e.toFormattedString)c.append(e.toFormattedString(f[1]?f[1]:""));else c.append(e.toString());a=d+1}return c.toString()};String.localeFormat=function(b){for(var a=1;a<arguments.length;a++){var c=arguments[a];if(c==null)c="";b=b.replace("{"+(a-1)+"}",c.toLocaleString())}return b};__sp.removeSpaces=function(){return this.replace(/ /gi,"")};__sp.removeExtraSpaces=function(){return this.replace(__sp.removeExtraSpaces.re," ")};__sp.removeExtraSpaces.re=new RegExp("\\s+","g");__sp.removeSpaceDelimitedString=function(a){var b=" "+this.trim()+" ";return b.replace(" "+a+" "," ").trim()};__sp.addSpaceDelimitedString=function(a){return this.removeSpaceDelimitedString(a)+" "+a};__sp.encodeURI=function(){return encodeURI(this)};__sp.encodeHtml=function(){return this.replace(/\&/g,"&amp;").replace(/\>/g,"&gt;").replace(/\</g,"&lt;").replace(/\'/g,"&#039;").replace(/\"/g,"&quot;")};__sp.decodeURI=function(){return unescape(this)};String._typeName="String";function cloneObject(b){var a={};for(i in b)a[i]=b[i];return a}function getHostUrl(){var a;try{a="http://"+document.location.hostname;if(document.location.port!=80&&document.location.port.length>0)a+=":"+document.location.port}catch(b){}return a}function parseUTCDate(a){var d=parseInt(a.substring(0,4),10),c=parseInt(a.substring(5,7),10)-1,e=parseInt(a.substring(8,10),10),b=parseInt(a.substring(11,13),10),f=parseInt(a.substring(14,16),10),g=parseInt(a.substring(17,19),10);return new Date(Date.UTC(d,c,e,b,f,g))}var gInvalidCharString="< > / \\";function validChar(e,b){var d=checkString(b)?b:gInvalidCharString,c=d.split(" ");for(var a=0;a<c.length;a++)if(e.indexOf(c[a])!=-1)return false;return true}function trimSpecialChar(a){if(checkString(a)){while(a.substring(0,1)==" "||a.substring(0,1)=="\r"||a.substring(0,1)=="\n"||a.substring(0,1)=="\b"||a.substring(0,1)=="\t")a=a.substring(1,a.length);while(a.substring(a.length-1,a.length)==" "||a.substring(a.length-1,a.length)=="\n"||a.substring(a.length-1,a.length)=="\r"||a.substring(a.length-1,a.length)=="\b"||a.substring(a.length-1,a.length)=="\t")a=a.substring(0,a.length-1)}return a}function extractGuids(d,c){var a=[];if(checkString(d)&&checkString(c)){a=d.split(c);for(var b=a.length;b>=0;b--)if(!checkGuid(a[b]))a.removeAt(b)}return a}function extractEmails(a){var d=[];if(checkString(a)){a=a.replace(/[;,]/g," ");var c=a.split(/\s/g),e=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;for(var b=0;b<c.length;b++)if(e.test(c[b]))d[d.length]=c[b]}return d}function openStandardWindow(b,a){return openWindow(b,a,1024,768,"resizable=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,location=yes")}function openWindow(f,e,b,a,d){try{b=!screen.width||checkInt(b,0,screen.width)?b:screen.width;a=!screen.height||checkInt(a,0,screen.height)?a:screen.height;var c=window.open(f,e,"width="+b+",height="+a+","+d);if(c){c.focus();return true}}catch(g){}return false}function formatTime(a){if(checkInt(a))return Math.floor(a/60)+":"+(Math.floor(a)%60<10?"0":"")+Math.floor(a)%60;else return "0:00"}function addElement(d,f,a,c,e){var b=document.createElement(f);if(checkString(a)){if(e)a=HTMLEncodeString(a);if(getBrowser()==Msn.Browser.IE)b.innerHTML=a+" ";else b.innerHTML=a}if(checkString(c))b.className=c;if(checkDefined(d))d.appendChild(b);return b}function limitString(a,b){if(checkString(a)){a=a.trim();if(a.length<=b)return a;else return a.substring(0,b-3)+"..."}else return ""}function ll(e,f){if(!checkString(e))return "";if(checkInt(f,0)){var c=e.split(/[\n\r]+/),d="";for(var a=0;a<c.length;a++)if(c[a].trim().length>0){sWordArray=c[a].split(/\s+/);for(var b=0;b<sWordArray.length;b++)if(sWordArray[b].trim().length>0)d=d+sWordArray[b]+" "}return limitString(d,f)}else return e.trim()}function getUrlParam(b,c){var a=null;b=b.toLowerCase();try{a=getParam(b,document.location.hash);if(null==a)a=getParam(b,document.location.search);if(null==a)a="";else if(!c)a=unescape(a)}catch(d){}return a}function getParam(g,f){var d=null,b=f.split("&"),i=b.length;for(var a=0;a<i;a++){var c=b[a].indexOf("="),e=a==0?1:0,h=b[a].slice(e,c).toLowerCase();if(h==g){d=b[a].slice(c+1);break}}return d}function cookieGet(d){var b=document.cookie.split("; ");for(var a=0;a<b.length;a++){var c=b[a].split("=");if(d==c[0])return unescape(c[1])}return null}function cookieSet(c,d,a){var b=checkDefined(a)?" expires="+(new Date((new Date).getTime()+a*60*1000)).toGMTString()+";":"";document.cookie=c+"="+escape(d)+";Path=/;"+b}function cookieClear(a){cookieSet(a,"",-60)}function removeChildren(a){if(checkDefined(a)&&checkDefined(a.childNodes)){var c=a.childNodes;for(var b=c.length-1;b>=0;b--)a.removeChild(c[b])}}function copyToClip(c){if(window.clipboardData)window.clipboardData.setData("Text",c);else if(window.netscape){var e,a,b,d;try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(f){customAlert($["IDS_CLI_NoCopyClipboard"]);return false}try{e=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);a=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);a.addDataFlavor("text/unicode");b=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);b.data=c;a.setTransferData("text/unicode",b,c.length*2);d=Components.interfaces.nsIClipboard;e.setData(a,null,d.kGlobalClipboard)}catch(f){return false}}else customAlert($["IDS_CLI_NoBrowserCopyClipboard"])}function installSilverlight(){Msn.Controls.save();Silverlight.getSilverlight(Msn.Controls.config.silverlightMinVersion);return false}function getCDNPath(a){try{if(checkString(Msn.Controls.config.baseCDNPath)&&a.toLowerCase().trim().indexOf("http://")!=0)return Msn.Controls.config.baseCDNPath+a;else return a}catch(b){return a}}function HTMLEncodeString(a){if(typeof a=="string"&&a.length>0){a=a.replace(/\&/g,"&amp;");a=a.replace(/\</g,"&lt;");a=a.replace(/\>/g,"&gt;");a=a.replace(/\"/g,"&quot;");a=a.replace(/\'/g,"&#39;")}return a}function HTMLDecodeString(b){var a="";try{tempDiv=document.createElement("DIV");tempDiv.innerHTML=b+"&nbsp;";a=tempDiv.innerText;a=a.replace("\\r\\n","");a=a.replace(/\s*$/g,"")}catch(c){}return a}function isSoapboxEnabled(){if(isTrue($["IDS_GEO_SoapboxDisabled"]))return false;if(Msn.Controls.config.soapboxDisabled)return false;return true}function isVideoUploadEnabled(){if(isTrue($["IDS_GMT_VideoUploadDisabled"])||(checkDefined(Msn.Controls.config.destinationUploadEnabled)?!Msn.Controls.config.destinationUploadEnabled:"false"))return false;return true}function isLiveSearchEnabled(){return isTrue($["IDS_GMT_EnableLiveSearchResults"])}function search(a,b){if(checkDefined(document.getElementById(a))){searchTerm=document.getElementById(a).value;siteSearch(searchTerm,b)}}function siteSearch(a,b){if(b){if(checkString(a)&&a.trim().length>0){a=a.replace(/</g,"<");a=a.replace(/>/g,">");if(isSoapboxEnabled()||isLiveSearchEnabled())Msn.Controls.fireEvent(Msn.Event.SplitSearch,a);else{var c=Msn.Controls.SearchQueryFactory.create(a,SoapboxService.SearchType.Keyword,0,SoapboxService.SortOrder.Default,Msn.Domain.VideoCatalog);Msn.Controls.fireEvent(Msn.Event.Search,c)}Msn.Controls.fireEvent(Msn.Event.ReportSearch,{term:a,srchtype:"site"})}}else if(checkString(Msn.Controls.config.msnWebSearchUrl)){Msn.Reporting.search(a,"web","","");window.top.location.href=Msn.Controls.config.msnWebSearchUrl.format(checkString(Msn.Controls.config.market)?Msn.Controls.config.market:"en-us")+encodeURIComponent(a)+"&FORM=CT"}}function ReportTracking(d,a,e,b,c){if(a==null)a="";if(b==null)b=="";Msn.Controls.fireEvent(e,{video:d,type:b,name:a,text:c})}function detectWmpVersion(a){try{var b=new ActiveXObject("WMPlayer.OCX");return parseInt(b.versionInfo)>=a}catch(c){return false}}function isSilverlightInstalled(){if(!checkDefined(Msn.Controls.config.silverlightInstalled))Msn.Controls.config.silverlightInstalled=Silverlight.isInstalled(Msn.Controls.config.silverlightMinVersion);return Msn.Controls.config.silverlightInstalled}function detectSilverlightVersion(a){return Silverlight.isInstalled(a)}function checkSupport(){var a=window.navigator.userAgent.toLowerCase();if(a.indexOf("opera")>=0||a.indexOf("safari")>=0||a.indexOf("netscape")>=0)return false;else{var b=a.indexOf("msie ");if(b>0){var c=parseInt(a.substring(b+5,a.indexOf(".",b)));if(c<6)return false}}return true}function getUrlValue(d,c,i){var h=i;if(checkString(d)&&checkString(c)){var a=d.indexOf("?");if(a>0){var b=d.substring(a+1);a=b.indexOf("#");if(a>0)b=b.substring(0,a);c=c.toLowerCase();var g=b.toLowerCase().split("&");for(var e=0;e<g.length;e++){var f=g[e].split("=");if(f[0]==c){h=f[1];break}}}}return h}function setUrlValue(a,e,d){if(a==null)return null;var g="([?&])("+e+")=([^&#]*)",f=new RegExp(g,"g"),c=f.exec(a);if(c!=null&&c.length>=4)a=a.replace(f,"$1$2="+d);else{var b="&";if(a.indexOf("?")<0)b="?";a+=b+e+"="+d}return a}function mergeUrlValue(b,a){if(!checkString(b))return a;if(!checkString(a))return b;a=a.replace(/^[^\?&]*[\?&]?/g,"");var e=a.split("&");for(var d=0;d<e.length;d++){var c=e[d].split("=");if(c.length>=2&&checkString(c[0]))b=setUrlValue(b,c[0],c[1])}return b}function joinArguments(b,e){var a,c=[];if(checkDefined(b)){for(var d=0;d<b.length;d++)c.push(b[d]);if(checkString(e))a=c.join(e);else a=c.join()}return a}function serialize(b){var a="",c;switch(typeof b){case "object":if(b)if(checkArray(b)){a+="[";for(c=0;c<b.length;++c){if(c>0)a+=",";a+=serialize(b[c])}a+="]"}else{if(typeof b.serialize=="function"){a+=b.serialize();break}a+="{";var g=false;for(var e in b){if(e.startsWith("$"))continue;var f=b[e];if(typeof f!="undefined"&&typeof f!="function"){if(g)a+=",";else g=true;a+=serialize(e);a+=":";a+=serialize(f)}}a+="}"}else a+="null";break;case "number":if(isFinite(b))a+=String(b);else a+="null";break;case "string":a+='"';var h=b.length;for(c=0;c<h;++c){var d=b.charAt(c);if(d>=" "){if(d=="\\"||d=='"')a+="\\";a+=d}else switch(d){case "\b":a+="\\b";break;case "\f":a+="\\f";break;case "\n":a+="\\n";break;case "\r":a+="\\r";break;case "\t":a+="\\t";break;default:a+="\\u00";a+=d.charCodeAt().toString(16)}}a+='"';break;case "boolean":a+=b.toString();break;default:a+="null";break}return a}function getColumnData(){var a=document.documentElement.clientWidth-494;a=Math.max(a,520);var b=Math.max(Math.floor(a/128,4)),c=a%128/Math.max(b-1,1);return {"columnCount":b,"marginWidth":c,"availWidth":a}}function isVista(){return navigator.userAgent.indexOf("Windows NT 6.0")>-1}function getWindowContext(){var a=window.location.pathname.toLowerCase();if(a.indexOf("dw.aspx")>=0)return Msn.WindowContext.DaughterWindow;else if(a.indexOf("im.aspx")>=0)return Msn.WindowContext.IMActivity;else return Msn.WindowContext.DestinationPage}function getBrowser(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("msie")!=-1)return Msn.Browser.IE;else if(a.indexOf("firefox")!=-1)return Msn.Browser.Firefox;else if(a.indexOf("mediacenter")>-1||a.indexOf("stb")>-1&&a.indexOf(" istb ")==-1)return Msn.Browser.MSNTV;else if(a.indexOf("safari")!=-1)return Msn.Browser.Safari;else return Msn.Browser.Other}function formatDate(i){var a="";try{var j=parseUTCDate(i).getTime(),k=(new Date).getTime(),c=Math.floor((k-j)/(60*1000)),d=Math.floor(c/60),b=Math.floor(d/24),f=Math.floor(b/30.5),g=Math.floor(b/365);if(c<1)a=$["IDS_CLI_Now"];else if(c<60){var e=1==c?$["IDS_CLI_MinAgo"]:$["IDS_CLI_MinsAgo"];a=e.format(c)}else if(d<24){var e="",h=c%60;if(1==d)e=h>1?$["IDS_CLI_HourMinAgo"]:$["IDS_CLI_HourMinsAgo"];else e=h>1?$["IDS_CLI_HoursMinAgo"]:$["IDS_CLI_HoursMinsAgo"];a=e.format(d,h)}else if(b<2)a=$["IDS_CLI_DayAgo"].format("1");else if(b<7)a=$["IDS_CLI_DaysAgo"].format(b);else if(b<14)a=$["IDS_CLI_WeekAgo"].format("1");else if(b<30)a=$["IDS_CLI_WeeksAgo"].format(Math.floor(b/7));else if(f<2)a=$["IDS_CLI_MonthAgo"].format("1");else if(f<12)a=$["IDS_CLI_MonthsAgo"].format(f);else if(g<2)a=$["IDS_CLI_YearAgo"].format("1");else if(g<4)a=$["IDS_CLI_YearsAgo"].format(g);else a=$["IDS_CLI_YearsPlusAgo"].format("3")}catch(l){}return a}function makeCallback(c,b){if(!window.uniqueID)window.uniqueID=0;var a="uniqueCallback_"+window.uniqueID++;window[a]=delegate(c,b);return a}function delegate(b,a){return function(){a.apply(b,arguments)}}function formatPosition(a){var c=parseInt(a/3600,10),b=parseInt(a%3600/60,10);a=parseInt(100*(a%60))/100;return c+":"+b+":"+a}function alphaCatCompare(a,b){if(a.FriendlyName.toLowerCase()>b.FriendlyName.toLowerCase())return 1;else if(a.FriendlyName.toLowerCase()<b.FriendlyName.toLowerCase())return -1;return 0}function parseHex(b){var a=parseInt(b,16);return checkInt(a)?a:0}function isAndNotZero(a,b){if(checkString(a)&&checkString(b)){var c,d,e;if(a.substr(0,2)=="0x")a=a.substr(2);if(b.substr(0,2)=="0x")b=b.substr(2);var f=Math.min(a.length,b.length);for(c=0;c<f;c++){d=parseInt(a.charAt(a.length-1-c),16);e=parseInt(b.charAt(b.length-1-c),16);if(checkInt(d)&&checkInt(e)&&(d&e)!=0)return true}}return false}function getPermaLinkUrl(b,d){var c="";if(checkDefined(b)){var e=d||!(b.CsId==Msn.Controls.config.SoapboxCsId),a=checkString(Msn.Controls.config.brand)?"mkt={0}&brand={1}":"mkt={0}";a=a.format(encodeURIComponent(Msn.Controls.config.market),encodeURIComponent(Msn.Controls.config.brand));var f=e?"/video.aspx?{0}&vid={1}":"/video.aspx?vid={1}";c=(getHostUrl()+f).format(a,b.Id)}return c}function getDomains(a){function d(b){if(!checkString(b))return "";var a=b.toLowerCase().indexOf("http://");a=a>=0?a+7:0;var c=b.indexOf("/",a);c=c>=a?c:b.length;return b.substring(a,c)}if(typeof a=="string")a=a.split(",");if(checkArray(a)){var c=[];for(var b in a){b=d(a[b]);if(checkString(b))c.push(b)}return c.join(",")}return ""}function getSyndicationPlayerEmbedCode(e,j){var f,d,p;if(checkString(j)&&j=="2"){f="596";d="425"}else{f="432";d="415"}var c=getCDNPath("");if(!checkString(c))c=getHostUrl();c+="/flash/customplayer/1_0/customplayer.swf";var g=getUrlParam("fg");g=checkString(g)?HTMLEncodeString(g):"";var l=HTMLEncodeString(e.Title),a={};a.configName="syndicationplayer";a.configCsid="msnvideo";a.fg=g;a.mkt=Msn.Controls.config.market;a.brand=Msn.Controls.config.brand;if(checkString(Msn.Controls.config.envDomainSuffix)&&Msn.Controls.config.envDomainSuffix.length>0){var o=new Msn.Controls.VCAdapterHelper;a.r=getDomains(getCDNPath(""));a.d=getDomains(getHostUrl());a.vc=getDomains(o.getRandomServer(e.Id))}var i=[];i.push("player.v="+e.Id);for(var h in a)if(checkString(a[h]))i.push(h+"="+a[h]);var k=i.join("&");function n(){return ((1+Math.random())*1048576|0).toString(32).substring(1)}var m=n()+n(),b="";b+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+m+'" width="'+f+'" height="'+d+' " >';b+='<param name="movie" value="'+c+'" /><param name="bgcolor" value="#ffffff" /><param name="base" value="." />';b+='<param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" />';b+='<param name="flashvars" value="'+k+'" />';b+='<embed src="'+c+'" width="'+f+'" height="'+d+'" id="'+m+'" type="application/x-shockwave-flash" ';b+='allowFullScreen="true" allowScriptAccess="always" wmode="transparent" pluginspage="http://macromedia.com/go/getflashplayer" base="." ';b+='flashvars="'+k+'"></embed></object>';b+='<noembed><br/><a href="'+getPermaLinkUrl(e)+'" target="_new" title="'+l+'">Video: '+l+"</a></noembed>";return b}function getPlayerEmbedCode(d){var c=getCDNPath("");if(!checkString(c))c=getHostUrl();c+="/flash/soapbox1_1.swf";var f=HTMLEncodeString(d.Title),a={};a.c="v";a.v=d.Id;a.ifs="true";a.fr="msnvideo";a.mkt=Msn.Controls.config.market;a.brand=Msn.Controls.config.brand;if(checkString(Msn.Controls.config.envDomainSuffix)&&Msn.Controls.config.envDomainSuffix.length>0){var j=new Msn.Controls.VCAdapterHelper;a.r=getDomains(getCDNPath(""));a.d=getDomains(getHostUrl());a.vc=getDomains(j.getRandomServer(d.Id))}var g=[];for(var e in a)if(checkString(a[e]))g.push(e+"="+a[e]);var i=g.join("&");function h(){return ((1+Math.random())*1048576|0).toString(32).substring(1)}var k=h()+h(),b="";b+='<embed src="'+c+'" width="432" height="364" id="'+k+'" type="application/x-shockwave-flash" ';b+='allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" ';b+='flashvars="'+i+'"></embed>';b+='<noembed><br/><a href="'+getPermaLinkUrl(d)+'" target="_new" title="'+f+'">Video: '+f+"</a></noembed>";return b}function getReferrer(){var a=getUrlParam("rf");if(!checkString(a))a=document.referrer;return a}function doNotScaleVideosEnabled(){if(isTrue($["IDS_GMT_DoNotScaleVideos"])||checkDefined(Msn.Controls.config.doNotScaleVideos)&&Msn.Controls.config.doNotScaleVideos)return true;return false}Msn.Controls.VCAdapter=function(){this.cfg={MAX_RELATED_TAGS:25,COUNTRY_MAPPING:$["IDS_GEO_CountryMapping"]};this.convertSearchResult=function(a,c){var d=null;if(checkObject(a)){var b=this.convertVideoList(a);if(checkDefined(b)){var g=c.type==SoapboxService.SearchType.Tag?a.$tag:a.$q,f=checkInt(a.$total)?a.$total:b.length,e=checkString(a.$alt)?a.$alt:"";d={"SearchKey":g,"Videos":b,"Count":b.length,"Offset":a.$ind-1,"TotalCount":f,"SearchType":checkDefined(c)?c.type:0,"AltSearchText":e}}}return d};this.convertVideoList=function(a){var d=[];if(checkObject(a)&&checkArray(a.video)){var c=a.video;for(var b=0;b<c.length;b++){var e=this.convertVideo(c[b]);if(e)d.push(e)}}return d};this.convertVideo=function(b){var a={};try{var d=new Msn.Controls.VCAdapterHelper;a.CsId=b.csId.$;a.GeoBlocked=this.getVideoGeoBlocked(b);a.Title=d.convertMetadata(b.title.$);a.Description=d.convertMetadata(b.description.$);a.Id=b.uuid.$;a.Source=b.source.$;a.SourceFriendlyName=d.convertMetadata(b.source.$friendlyName);a.Provider=b.providerId.$;a.MediaFiles=[this.getVideoFileUrl(b,1002),this.getVideoFileUrl(b,1003)];a.StreamLength=b.durationSecs.$;a.StartDate=b.startDate.$;a.ReleaseDate=b.startDate.$;a.RelatedLinks=this.getVideoRelatedLinks(b);a.PosterFrame=this.getFileUrl(b,2009);a.PageGroup=b.pageGroup.$;if(Msn.Controls.config.UseImageScaling){var c=d.getRandomServer(a.Id,true),f=b.$version;if(checkString(c)){var e="{0}/Image.aspx?uuid={1}&w={2}&h={3}";a.Thumbnail=e.format(c,a.Id,112,84);a.MiniThumbnail=e.format(c,a.Id,64,48);a.MediumThumbnail=e.format(c,a.Id,228,171);a.PosterFrame=e.format(c,a.Id,424,318)}}if(a.CsId==Msn.Controls.config.SoapboxCsId){if(!isSoapboxEnabled())return null;a.Status=this.getVideoStatus(b);a.OwnerId=a.Source;a.OwnerNickname=a.SourceFriendlyName;if(!checkString(a.MediaFiles[Msn.MediaFormat.WMV])&&checkString(a.Id))a.MediaFiles[Msn.MediaFormat.WMV]=getHostUrl()+"/StreamingUrl.aspx?vid="+a.Id;if(!checkString(a.MediaFiles[Msn.MediaFormat.FLV])&&checkString(a.Id))a.MediaFiles[Msn.MediaFormat.FLV]=getHostUrl()+"/StreamingUrl.aspx?vid="+a.Id+"&t=.flv";if(!checkString(a.Thumbnail)){a.Thumbnail=this.getFileUrl(b,2007);if(!checkString(a.Thumbnail))a.Thumbnail=this.getFileUrl(b,2008)}a.Channels=this.getVideoCategory(b);a.Market=Msn.Controls.config.SoapboxMarket}else{if(!checkString(a.Thumbnail))a.Thumbnail=this.getFileUrl(b,2007);a.FlashMetadata=this.getFileUrl(b,1201);a.Status=SoapboxService.VideoStatus.Published;a.Market=Msn.Controls.config.VCMarket}a.CommunityBits=this.getVideoTags(b,"community");a.ViralSyndication=this.hasViralSyndicationTag(b);a.Tags=this.getVideoTags(b,"User");a.VCSourceTag=this.getVideoVCSource(b);a.AllTags=this.getVideoTags(b);a.AverageRating=parseFloat(this.getUsage(b,Msn.UsageEventType.Rated,Msn.UsageCounterType.Average));a.PlayCount=this.getUsage(b,Msn.UsageEventType.Played,Msn.UsageCounterType.Total);a.NumComments=this.getUsage(b,Msn.UsageEventType.Reviewed,Msn.UsageCounterType.Total);a.NumFavorites=this.getUsage(b,Msn.UsageEventType.Bookmarked,Msn.UsageCounterType.Total);a.PlayCountExtended=this.getUsage(b,Msn.UsageEventType.Played,Msn.UsageCounterType.Extended);a.NumCommentsExtended=this.getUsage(b,Msn.UsageEventType.Reviewed,Msn.UsageCounterType.Extended);a.NumFavoritesExtended=this.getUsage(b,Msn.UsageEventType.Bookmarked,Msn.UsageCounterType.Extended);a.ReportingData=this.getReportingData(b)}catch(g){a=null}return a};this.getVideoVCSource=function(c){var b="";if(checkObject(c)){var a=this.getVideoTags(c,"VC_Source");if(checkObject(a)&&a.length>0)b=a[0].Name}return b};this.convertExtendedMetadata=function(a){return a};this.getVideoStatus=function(a){var c=null;if(checkObject(a)&&checkObject(a.tags))for(var b=0;b<a.tags.tag.length;b++){var d=a.tags.tag[b];if(d.$namespace=="UserVideoStatus"){c=parseInt(d.$);break}}return c};this.getVideoGeoBlocked=function(b){var a=false;if(b.csId.$==Msn.Controls.config.SoapboxCsId&&!isSoapboxEnabled())a=true;else{var c=this.getVideoTag(b,"geofence");a=isAndNotZero(this.cfg.COUNTRY_MAPPING,c)}return a};this.getVideoRelatedLinks=function(a){var d=[];if(checkObject(a)&&checkObject(a.extendedXml)&&checkObject(a.extendedXml.relatedLinks)&&checkObject(a.extendedXml.relatedLinks.link))if(checkDefined(a.extendedXml.relatedLinks.link.length))for(var c=0;c<a.extendedXml.relatedLinks.link.length;c++){var b={};b.url=a.extendedXml.relatedLinks.link[c].$url;b.text=a.extendedXml.relatedLinks.link[c].$;d[c]=b}else{b={};b.url=a.extendedXml.relatedLinks.link.$url;b.text=a.extendedXml.relatedLinks.link.$;d[0]=b}return d};this.getVideoTags=function(a,e){var g=[];if(checkObject(a)&&checkObject(a.tags)){var f=checkArray(a.tags.tag)?a.tags.tag:checkDefined(a.tags.tag)?[a.tags.tag]:[];for(var d=0;d<f.length;d++){var c=f[d];if(null==e||c.$namespace.toLowerCase()==e.toLowerCase()){var b={};b.Name=c.$;b.Namespace=c.$namespace;g.push(b)}}}return g};this.getVideoTag=function(a,f){var d=null;if(checkObject(a)&&checkObject(a.tags)){var c=checkArray(a.tags.tag)?a.tags.tag:checkDefined(a.tags.tag)?[a.tags.tag]:[];for(var b=0;b<c.length;b++){var e=c[b];if(e.$namespace.toLowerCase()==f.toLowerCase()){d=e.$;break}}}return d};this.getVideoCategory=function(a){var d=[];if(checkObject(a)&&checkObject(a.tags))for(var b=0;b<a.tags.tag.length;b++){var e=a.tags.tag[b];if(e.$namespace=="Category"){var c={};c.Id=e.$;d[0]=c;break}}return d};this.hasViralSyndicationTag=function(a){var c=false;if(checkObject(a)&&checkObject(a.tags))for(var b=0;b<a.tags.tag.length;b++){var d=a.tags.tag[b];if(d.$namespace.toLowerCase()=="feature"&&d.$.toLowerCase()=="syndication"){c=true;break}}return c};this.getVideoFileUrl=function(a,d){var c=null;if(checkObject(a)&&checkObject(a.videoFiles)&&checkObject(a.videoFiles.videoFile))for(var b=0;b<a.videoFiles.videoFile.length;b++)if(a.videoFiles.videoFile[b].$formatCode==d){c=a.videoFiles.videoFile[b].uri.$;break}return c};this.getFileUrl=function(a,d){var c=null;if(checkObject(a)&&checkObject(a.files)&&checkObject(a.files.file))for(var b=0;b<a.files.file.length;b++)if(a.files.file[b].$formatCode==d){c=a.files.file[b].uri.$;break}return c};this.getUsage=function(a,d,e){var c=null;if(checkObject(a)&&checkObject(a.usage)&&checkObject(a.usage.usageItem))for(var b=0;b<a.usage.usageItem.length;b++)if(a.usage.usageItem[b].$counterType==d){switch(e){case Msn.UsageCounterType.Total:c=a.usage.usageItem[b].$totalCount;break;case Msn.UsageCounterType.Average:c=a.usage.usageItem[b].$totalAverage;break;case Msn.UsageCounterType.Extended:c={hourlyCount:a.usage.usageItem[b].$hourlyCount,dailyCount:a.usage.usageItem[b].$dailyCount,weeklyCount:a.usage.usageItem[b].$weeklyCount,monthlyCount:a.usage.usageItem[b].$monthlyCount,allTimes:a.usage.usageItem[b].$totalCount};break}break}return c};this.getReportingData=function(a){var b=null;if(checkObject(a)&&checkObject(a.extendedXml)&&checkObject(a.extendedXml.reportingData))b=a.extendedXml.reportingData.$;return b};this.convertRelatedTagsResult=function(a){var d,c=null;if(checkObject(a)&&checkObject(a.tag)){d=a.$mk==Msn.Controls.config.SoapboxMarket?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog;c=[];for(var b=0;b<a.tag.length&&b<this.cfg.MAX_RELATED_TAGS;b++){var e={"Type":Msn.CloudEntryType.Tags,"Name":a.tag[b].$name,"Data":d};c.push(e)}}return c};this.convertTemplate=function(b){var a=null;if(checkObject(b)&&checkObject(b.template)){var c,g=b.template,f=["default","g0","g1","g2"];for(var e=0;e<f.length;e++){var d=f[e];if(checkDefined(g[d])){a={};a.type=d;c=g[d];break}}if(checkObject(a)&&checkObject(c)){a.label=b.$label;a.menuId=b.$id;switch(a.type){case "default":a.videosUrl=c.videosRef.$videosUrl;break;case "g0":case "g1":case "g2":a.header=this.convertTemplateHeader(c.header);a.section=this.convertTemplateSection(c.section);break}}}return a};this.convertTemplateHeader=function(c){var e=[];if(checkObject(c))for(var d=0;d<c.length;d++)try{var a={},b=c[d];a.imageUrl=b.$imageUrl;a.videoRef=b.$videoRef;a.caption=b.$caption;a.headline=b.$headline;a.copyright=b.$copyright;e.push(a)}catch(f){}return e};this.convertTemplateSection=function(a){var d=[];if(checkObject(a))for(var b=0;b<a.length;b++)try{var c={};c.title=a[b].$title;c.type=a[b].$type;c.showcaseSize=a[b].$showcaseSize;c.showcaseDesign=a[b].$showcaseDesign;c.showcaseMediaUrl=a[b].$showcaseMediaUrl;c.showcaseFallbackMediaUrl=a[b].$showcaseDownlevelMediaUrl;c.imageUrl=a[b].$imageUrl;c.videosUrl=a[b].videosRef.$videosUrl;d.push(c)}catch(e){}return d}};Msn.Controls.VCAdapterHelper=function(){this.cfg={REQUESTED_VC_COUNTERS:[Msn.UsageEventType.Played,Msn.UsageEventType.Rated,Msn.UsageEventType.Reviewed,Msn.UsageEventType.Bookmarked]};this.getServer=function(){return checkString(Msn.Controls.config.VCServiceUrl)?Msn.Controls.config.VCServiceUrl:"http://catalog.video.msn.com"};this.getRandomServer=function(d,c){var b=this.getServer(),a=c?Msn.Controls.config.VCServiceImageUrlsRandom:Msn.Controls.config.VCServiceUrlsRandom;if(checkArray(a)&&a.length>0){var e=Math.abs(SoapboxService.Utils.HashCodeFletcher(d));b=a[e%a.length]}return b};this.getUsageParam=function(){return "&rct="+this.cfg.REQUESTED_VC_COUNTERS.join(",")};this.getLCIDParam=function(){return "&lcid="+Msn.Controls.config.lcid};this.getFilterParamNum=function(){var a=Msn.FilterType.HasThumbnail|Msn.FilterType.IsPublished;if(this.getMarket(Msn.Domain.VideoCatalog).toLowerCase()=="us"||!Msn.Controls.config.showWmp&&!Msn.Controls.config.showSilverlight)a|=Msn.FilterType.HasFlash;return a};this.getFilterParam=function(){return "&ff="+this.getFilterParamNum().toString(16)};this.getMarket=function(a){switch(a){case Msn.Domain.Soapbox:if(checkString(Msn.Controls.config.SoapboxMarket))return Msn.Controls.config.SoapboxMarket;else return "uv-en-us";break;case Msn.Domain.VideoCatalog:if(checkString(Msn.Controls.config.VCMarket))return Msn.Controls.config.VCMarket;else return "us";break}};this.convertMetadata=function(a){return HTMLDecodeString(a)}};Msn.Controls.VCRequestManager=function(){var g=this,a=[],e=0,b=null;function f(c,e,d,b,a){this.intId=c;this.id=e;this.url=d;this.callbackFunc=b;this.callbackData=a;this.cancelled=false}function c(c){if(checkString(c)){var f=getUrlValue(c,"ps",50),h=getUrlValue(c,"ind",1)-1,g=c.split("?");if(g.length>1){var b=g[1].split("&"),l=b.length;for(var a=0;a<l;a++){var e="uuids=",j=b[a].toLowerCase().indexOf(e);if(null!=b[a]&&b[a].toLowerCase().indexOf(e)>=0){var d=b[a].toLowerCase().substring(j+e.length,b[a].length).split(","),i=Math.min(f*h,d.length),k=Math.min(f*h+f,d.length);return d.slice(i,k)}}}}return new Array}function d(e,d){if(null!=e){var b=e.video;if(null!=d&&checkArray(d,1)){var f=b.length,g=[];for(var a=0;a<f;a++){var c=b[a];if(checkDefined(c))g[c.uuid.$.toLowerCase()]=c}f=d.length;b=[];for(a=0;a<f;a++){c=g[d[a]];if(null!=c)b.push(c)}e.video=b}}return e}this.makeRequestUrl=function(a){if(a.toLowerCase().indexOf("http://")==0)a=a.substring(a.indexOf("/",8)+1);var d=new Msn.Controls.VCAdapterHelper,b=d.getRandomServer(a),c=b.substr(b.length-1)=="/"?"":"/",e=b+c+a;return e};this.makeRequest=function(n,m,o){var g=null;if(checkFunction(m)){if(b==null){b=document.createElement("div");document.body.appendChild(b)}var h=this.makeRequestUrl(n),l=null;if(h.toLowerCase().indexOf("videobyuuids")>=0)l=c(h);var j=e++;g=SoapboxService.Utils.HashCodeFletcher(n);for(var k=0;k<a.length;k++)if(a[k].id==g){g+="_"+j;break}var p=new f(j,g,h,function(a){m(d(a,l))},o),q=h+"&responseEncoding=json&callbackName=Msn.VCRequestManager.doCallback&cd="+encodeURIComponent(g);a.push(p);var i=document.createElement("script");i.id="VCRequest"+j;b.appendChild(i);i.src=q}return g};this.cancelRequest=function(c){for(var b=0;b<a.length;b++)if(a[b].id==c){a[b].cancelled=true;break}};this.doCallback=function(e,f){for(var b=0;b<a.length;b++)if(a[b].id==f){var d=a[b];a.splice(b,1);if(!d.cancelled)d.callbackFunc(e,d.callbackData);var c=document.getElementById("VCRequest"+d.intId);if(c&&c.parentNode)setTimeout(function(){c.parentNode.removeChild(c)},100);e=null;break}}};Msn.VCRequestManager=new Msn.Controls.VCRequestManager;Msn.Controls.VideoActionPane=function(m){var p=this,n=m;this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.VideoPanelRemoteControl);this.subscribeEvent(Msn.Event.MetadataPanelHeaderClick);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this._hideAllPanes();this.setVideo(a);break;case Msn.Event.VideoPanelRemoteControl:this._showPane(a);break;case Msn.Event.MetadataPanelHeaderClick:this._hideAllPanes();break;default:break}};var o=null,l=0,b=null,a=null,f=null,e=null,c=null,k=new Msn.Controls.Offensive,j=new Msn.Controls.Email,i=new Msn.Controls.AddComments,h=new Msn.Controls.VideoLink,g=new Msn.Controls.EmbedVideo;this._hideAllPanes=function(){if(checkDefined(b))b.style.visibility="hidden";if(checkDefined(a))a.style.visibility="hidden";if(checkDefined(f))f.style.visibility="hidden";if(checkDefined(e))e.style.visibility="hidden";if(checkDefined(c))c.style.visibility="hidden"};this._showPane=function(d){this.fireEvent(Msn.Event.SetAutoProgress,true);this._hideAllPanes();switch(d){case Msn.VideoPanel.Email:if(checkDefined(b)){b.style.visibility="visible";b.style.overflow="auto"}this.fireEvent(Msn.Event.FocusRequest,j);this.fireEvent(Msn.Event.SetAutoProgress,false);break;case Msn.VideoPanel.Comment:if(checkDefined(a)){a.style.visibility="visible";a.style.overflow="auto"}this.fireEvent(Msn.Event.FocusRequest,i);this.fireEvent(Msn.Event.SetAutoProgress,false);break;case Msn.VideoPanel.Flag:if(checkDefined(f))f.style.visibility="visible";this.fireEvent(Msn.Event.SetAutoProgress,false);break;case Msn.VideoPanel.VideoLink:if(checkDefined(e))e.style.visibility="visible";this.fireEvent(Msn.Event.FocusRequest,h);break;case Msn.VideoPanel.EmbedVideo:if(checkDefined(c))c.style.visibility="visible";this.fireEvent(Msn.Event.FocusRequest,g);break}};this.setVideo=function(a){if(checkDefined(a)&&checkString(a.Video.Id)){l=a.Video.Id;j.setVideo(a.Video);h.setVideo(a.Video);i.setVideo(a.Video);g.setVideo(a.Video);if(a.Video.CsId==Msn.Controls.config.SoapboxCsId)k.setVideoId(l)}};this._render=function(m){if(m){var o,n,l;l=document.createElement("div");l.className="videoRemoteCtrlParent";d=document.createElement("span");d2=document.createElement("span");b=d2;b.className="actionPane";j.render(d2);d.appendChild(d2);l.appendChild(d);d=document.createElement("span");d2=document.createElement("span");a=d2;a.className="actionPane";i.render(d2);d.appendChild(d2);l.appendChild(d);d=document.createElement("span");d2=document.createElement("span");f=d2;f.className="actionPane";k.render(d2);d.appendChild(d2);l.appendChild(d);d=document.createElement("span");d2=document.createElement("span");e=d2;e.className="actionPane";h.render(d2);d.appendChild(d2);l.appendChild(d);d=document.createElement("span");d2=document.createElement("span");c=d2;c.className="actionPane";g.render(d2);d.appendChild(d2);l.appendChild(d);m.appendChild(l)}}};Msn.Controls.VideoActionPane.prototype=Msn.Controls;Msn.Controls.VideoDetails=function(){var m=this;this.subscribeEvent(Msn.Event.MediaMetadata);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;default:break}};var b={SOURCE_TITLE:$["IDS_CLI_SourceTitle"],MORE:$["IDS_CLI_More"],LESS:$["IDS_CLI_Less"],MORE_VIDEOS:$["IDS_CLI_MoreVideos"],FROM:$["IDS_CLI_FromColon"],ADDED:$["IDS_CLI_Added"],VIEWS:$["IDS_CLI_ViewsColon"],FAVORITED:$["IDS_CLI_FavoritedColon"],TITLE_LENGTH:80,DESC_LENGTH:200,NICKNAME_LENGTH:24,SOURCE_LOGO:getCDNPath($["IDS_GMT_SoapboxLogo"])},n=null,a=null,p=new Msn.Controls.Category,q=new Msn.Controls.ContactControl("small"),o=new Msn.Controls.SimilarVideos(true),e=null,g=null,i=null,d=null,c=null,j=null,h=null,l=null,f=null,k=true;this.onUserProfileClick=function(){if(null!=a){var b={};b.cid=a.OwnerId;b.nickname=a.OwnerNickname;m.fireEvent(Msn.Event.ViewProfile,b)}return false};this.onMoreUserVideos=function(){if(null!=a){var b=Msn.Controls.SearchQueryFactory.create(a.OwnerId,SoapboxService.SearchType.User,0,SoapboxService.SortOrder.Default,a.OwnerNickname);m.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"morevideos"});m.fireEvent(Msn.Event.Search,b)}return false};this.onRefreshDescriptionDisplay=function(g,f){if(null!=d&&checkDefined(a))if(a.Description.length>b.DESC_LENGTH&&checkDefined(c)){c.style.visibility="visible";c.style.display="inline";var e="";if(k){d.innerText=ll(a.Description,b.DESC_LENGTH);d.title=a.Description;c.innerText="("+b.MORE+")";k=false;e=b.LESS}else{d.innerText=a.Description;d.title=a.Description;c.innerText="("+b.LESS+")";k=true;e=b.MORE}if(f)ReportTracking(a,e,Msn.Event.MetaLink,"meta")}else{d.innerText=ll(a.Description,b.DESC_LENGTH);d.title=a.Description;if(checkDefined(c)){c.style.visibility="hidden";c.style.display="none"}}return false};this.setVideo=function(c){if(checkDefined(c)&&checkString(c.Video.Id)&&c.Video.CsId==Msn.Controls.config.SoapboxCsId){n=c;a=c.Video;if(null!=h){h.innerText=ll(a.OwnerNickname,b.NICKNAME_LENGTH);h.title=a.OwnerNickname}if(null!=g){g.innerText=ll(a.Title,b.TITLE_LENGTH);g.title=a.Title}if(a.StreamLength>0&&null!=i){var d=Math.floor(a.StreamLength/60),e=(a.StreamLength%60<10?"0":"")+a.StreamLength%60;i.innerText=" ("+d+":"+e+")"}k=true;this.onRefreshDescriptionDisplay();if(null!=j)j.innerText=formatDate(a.ReleaseDate);if(null!=l)l.innerText=a.PlayCount+" ";if(null!=f)if(c.NumFavorites>0)f.innerText=c.NumFavorites+" ";else if(checkDefined(c)&&checkDefined(c.Video)&&checkDefined(c.Video.NumFavorites)&&c.Video.NumFavorites>0)f.innerText=c.Video.NumFavorites+" ";else f.innerText=0+" ";o.setWebVideo(c);q.setOnPhotoClick(m.onUserProfileClick);p.setVideo(c)}};this.onImageError=function(b,a){a.style.display="none"};this.onSourceLogoClick=function(){Msn.MenuManager.loadDefaultSoapboxMenuItem()};this._render=function(x){var k,y,z,m,a;if(null!=x){a=document.createElement("DIV");a.className="metadataPadding";e=document.createElement("IMG");e.src=b.SOURCE_LOGO;e.alt=b.SOURCE_TITLE;e.className="sourceLogo";this.addListener(e,"onerror",this.onImageError,e);this.addListener(e,"onclick",this.onSourceLogoClick);a.appendChild(e);m=document.createElement("DIV");m.className="headSpacing";g=document.createElement("SPAN");g.className="headerBold";m.appendChild(g);i=document.createElement("SPAN");m.appendChild(i);a.appendChild(m);d=document.createElement("SPAN");a.appendChild(d);d.className="videoDetailsDescription";a.appendChild(document.createTextNode(" "));c=document.createElement("A");c.href=this.getLinkHref();c.className="tLink";a.appendChild(c);this.addListener(c,"onclick",this.onRefreshDescriptionDisplay,true);a.appendChild(document.createElement("BR"));a.appendChild(document.createElement("BR"));var s,v,u,r;s=document.createElement("TABLE");v=document.createElement("TBODY");u=document.createElement("TR");r=document.createElement("TD");s.cellSpacing="0";s.cellPadding="0";s.appendChild(v);v.appendChild(u);u.appendChild(r);r.width="75px";q.render(r);r=document.createElement("TD");u.appendChild(r);vd=document.createElement("DIV");vd.appendChild(document.createTextNode(b.FROM));k=document.createElement("A");k.style.cursor="pointer";k.href=this.getLinkHref();h=document.createElement("B");k.appendChild(h);vd.appendChild(k);this.addListener(k,"onclick",this.onUserProfileClick);vd.appendChild(document.createTextNode(" ("));var t=document.createElement("A");t.href=this.getLinkHref();t.appendChild(document.createTextNode(b.MORE_VIDEOS));this.addListener(t,"onclick",this.onMoreUserVideos);vd.appendChild(t);vd.appendChild(document.createTextNode(")"));vd.appendChild(document.createElement("BR"));k=document.createTextNode(b.ADDED);vd.appendChild(k);j=document.createElement("SPAN");vd.appendChild(j);vd.appendChild(document.createElement("BR"));k=document.createTextNode(b.VIEWS);vd.appendChild(k);l=document.createElement("SPAN");vd.appendChild(l);vd.appendChild(document.createElement("BR"));k=document.createTextNode(b.FAVORITED);vd.appendChild(k);f=document.createElement("SPAN");vd.appendChild(f);vd.appendChild(document.createElement("BR"));p.render(vd);vd.appendChild(document.createElement("BR"));var w=document.createElement("DIV");w.className="videoDetailsSeperator";vd.appendChild(w);r.appendChild(vd);a.appendChild(s);m=document.createElement("DIV");m.className="similarVideos";o.render(m);a.appendChild(m);x.appendChild(a);if(null!=n)this.setVideo(n)}}};Msn.Controls.VideoDetails.prototype=Msn.Controls;Msn.Controls.VideoEdit=function(){var a=this,f=null,b=null,o=false,e=null,h=null,w=null,x=null,i=null,l=null,m=null,n=null,j=null,g=null,q=null,p=null,s=null,u=null,k=[];this.cfg={MAX_TITLE_LENGTH:80,MAX_DESC_LENGTH:400,MAX_TAG_LENGTH:40,TITLE_MAX_LENGTH:28,MISSING_THUMB:getCDNPath("/i/thumbnail.gif"),FONT_FAMILY:$["IDS_GMT_FontFamily"],FONT_SIZE:$["IDS_GMT_FontSize"],MSG_VIDEOERROR:$["IDS_CLI_MsgVideoerror"],MSG_VIDEOEDITERROR:$["IDS_CLI_MsgVideoediterror"],MSG_VIDEOEDITSUCCESS:$["IDS_CLI_MsgVideoeditsuccess"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],VIDEO_TITLE_COLON:$["IDS_CLI_VideoTitle"],ADDED_ON_COLON:$["IDS_CLI_Added"],EDIT_VIDEO_TITLE:$["IDS_CLI_EditVideoTitle"],EDIT_VIDEO_DESCRIPTION:$["IDS_CLI_EditVideoDescription"],EDIT_VIDEO_TAGS:$["IDS_CLI_EditVideoTags"],EDIT_CATEGORY:$["IDS_CLI_EditCategory"],EDIT_SELECT_CATEGORY:$["IDS_CLI_EditSelectCategory"],EDIT_SOAPBOX_PERMISSION:$["IDS_CLI_EditSoapboxPermission"],PUBLIC:$["IDS_CLI_Public"],HIDDEN:$["IDS_CLI_Hidden"],SHARED:$["IDS_CLI_Shared"],PICK_FRIENDS:$["IDS_CLI_PickFriends"],UPDATE_VIDEO:$["IDS_CLI_UpdateVideo"],CANCEL:$["IDS_CLI_Cancel"],REQUIRED_FIELDS:$["IDS_CLI_RequiredFields"],MSG_VIDEOEDIT_NICKNAMENOTSET:$["IDS_CLI_MsgVideoeditNicknamenotset"],MSG_VIDEOEDIT_BETANOTAUTHORIZED:$["IDS_CLI_MsgVideoeditBetanotauthorized"],MSG_VIDEOEDIT_INVALIDTITLE:$["IDS_CLI_MsgVideoeditInvalidtitle"],MSG_VIDEOEDIT_INVALIDDESCRIPTION:$["IDS_CLI_MsgVideoeditInvaliddescription"],MSG_VIDEOEDIT_INVALIDCATEGORY:$["IDS_CLI_MsgVideoeditInvalidcategory"],MSG_VIDEOEDIT_INVALIDTAGS:$["IDS_CLI_MsgVideoeditInvalidtags"],MSG_VIDEOEDIT_INVALIDPERMISSION:$["IDS_CLI_MsgVideoeditInvalidpermission"],MSG_VIDEOEDIT_OFFENDINGINPUT:$["IDS_CLI_MsgVideoeditOffendinginput"],EDIT_ERR_TITLE_MISSING:$["IDS_SHR_EditErrTitleMissing"],EDIT_ERR_TOO_LONG:$["IDS_SHR_EditErrTooLong"],EDIT_ERR_DESC_MISSING:$["IDS_SHR_EditErrDescMissing"],EDIT_ERR_DESC_TOO_LONG:$["IDS_SHR_EditErrDescTooLong"],EDIT_ERR_TAG_MISSING:$["IDS_SHR_EditErrTagMissing"],EDIT_ERR_TAG_TOO_MANY:$["IDS_SHR_EditErrTagTooMany"],EDIT_ERR_TAG_TOO_LONG:$["IDS_SHR_EditErrTagTooLong"],EDIT_ERR_CAT_MISSING:$["IDS_SHR_MissingCatError"],EDIT_ERR_PERMISSION_MISSING:$["IDS_SHR_EditErrPermissionMissing"],EDIT_ERR_TITLE_INVALID:$["IDS_SHR_EditErrTitleInvalid"],EDIT_ERR_DESC_INVALID:$["IDS_SHR_EditErrDescInvalid"],EDIT_ERR_TAG_INVALID:$["IDS_SHR_EditErrTagInvalid"],EDIT_ERR_UPDATE_PERMISSION_MSG:$["IDS_CLI_MsgVideoUpdatePermmissionsError"]};var c=new Msn.Controls.LiteralHTML(this.cfg.LOADING,"pt5 pl5"),d=new Msn.Controls.LiteralHTML(this.cfg.DATA_NOT_AVAILABLE,"pt5 pl5"),y=('<option value="0">{0}</option><option value="1">{1}</option><option value="2">{2}</option>').format(this.cfg.PUBLIC,this.cfg.HIDDEN,this.cfg.SHARED),r=Msn.Cache.get("Categories"),v="";if(checkDefined(r))for(var t=0;t<r.length;t++)v=v+'<option value="'+r[t].IdString+'">'+r[t].FriendlyName+"</option>";var z=('<table border="0" cellpadding="5" cellspacing="5">'+"<tr>"+"<td>"+'<table border="0">'+"<tr>"+"<td>"+'<img id="videoEditImg" style="border: solid 1px #ffffff; cursor: hand; width: 112px; height: 84px" /></td>'+"<td>"+'{0} <span id="videoEditLabel"></span><br />'+'{1} <span id="videoEditDate"></span></td>'+"</tr>"+"</table>"+"</td>"+"</tr>"+"<tr>"+"<td>"+"{2} *<br />"+'<input id="videoEditTitle" class="b1g" maxlength="80" name="title" size="50" value="" /></td>'+"</tr>"+"<tr>"+"<td>"+"{3} *<br />"+'<textarea id="videoEditDesc" class="uploadVideoDescription" cols="50" maxlength="400" name="desc"'+'rows="4"></textarea></td>'+"</tr>"+"<tr>"+"<td>"+"{4} *<br />"+'<input id="videoEditTags" class="b1g" maxlength="208" name="tag" size="50" value="" /></td>'+"</tr>"+"<tr>"+"<td>"+"{5} *<br />"+'<select id="videoEditCat" class="b1g" name="channel" style="width: 120px;" value="">'+'<option value="">{6}</option>'+"{7}"+"</select>"+"<br />"+"</td>"+"</tr>"+"<tr>"+"<td>"+"{8} *<br />"+'<select id="videoEditPerm" class="b1g" name="permission" style="width: 120px;" value="">'+"{9}"+"</select>"+'&nbsp;  <span id="contactPickerLink" class="videoActionText">{10}</span>'+"<br />"+"</td>"+"</tr>"+"<tr>"+"<td>"+"<span>"+'<input id="videoEditButton" alt="{11}" class="b2g ch" name="btupdate" type="button" value="{11}" />&nbsp;'+'<input id="videoEditButtonCancel" alt="{12}" class="b2g ch" name="btcancel" type="button" value="{12}" /></span><br />'+"{13} * </td>"+"</tr>"+"</table>").format(this.cfg.VIDEO_TITLE_COLON,this.cfg.ADDED_ON_COLON,this.cfg.EDIT_VIDEO_TITLE.format(this.cfg.MAX_TITLE_LENGTH),this.cfg.EDIT_VIDEO_DESCRIPTION.format(this.cfg.MAX_DESC_LENGTH),this.cfg.EDIT_VIDEO_TAGS,this.cfg.EDIT_CATEGORY,this.cfg.EDIT_SELECT_CATEGORY,v,this.cfg.EDIT_SOAPBOX_PERMISSION,y,this.cfg.PICK_FRIENDS,this.cfg.UPDATE_VIDEO,this.cfg.CANCEL,this.cfg.REQUIRED_FIELDS);this.subscribeEvent(Msn.Event.VideoEdit);this.subscribeEvent(Msn.Event.VideoUpdated);this.onEvent=function(g,e,a){switch(e){case Msn.Event.VideoEdit:if(checkGuid(a)){this.setVideoId(a);this.fireEvent(Msn.Event.MenuSelect,{menuId:null})}break;case Msn.Event.FocusReceived:if(checkDefined(i))try{i.focus()}catch(j){}break;case Msn.Event.VideoUpdated:if(checkObject(a)&&a.length>0&&checkDefined(b)&&checkString(f))for(var d=0;d<a.length;d++){var c=a[d];if(c.Id==f){b.Thumbnail=c.Thumbnail;b.Status=c.Status;b.MediaFiles=c.MediaFiles;if(checkDefined(h))h.src=this.getThumbUrl();break}}break}};this.onContactPickerData=function(b){if(checkObject(b)){k.clear();var f=b.contactsToAdd,d=b.contactsToRemove,e=b.categoriesToAdd,c=b.categoriesToRemove,g=b.emailsToAdd;if(e.length>0)a.addCallback(e,"Category",a.UpdatePermissionCb,a.UpdatePermissionErrorCb,"add");if(f.length>0||g.length>0)a.addCallback(f,"Contact",a.UpdatePermissionCb,a.UpdatePermissionErrorCb,"add",g);if(c.length>0)a.addCallback(c,"Category",a.UpdatePermissionCb,a.UpdatePermissionErrorCb,"remove");if(d.length>0)a.addCallback(d,"Contact",a.UpdatePermissionCb,a.UpdatePermissionErrorCb,"remove")}a.fireEvent(Msn.Event.FocusRequest,a)};this.addCallback=function(c,g,d,e,f,b){var a={};a.list=[];a.emailList=[];if(checkDefined(c))a.list=c;a.type=g;a.successCb=d;a.errorCb=e;a.action=f;if(checkDefined(b))a.emailList=b;k.push(a)};this.setError=function(){if(checkDefined(e))e.style.visibility="hidden";if(checkDefined(c)){c.setVisibility(false);c.setDisplay(false)}if(checkDefined(d)){d.setVisibility(true);d.setDisplay(true)}};this.dataBind=function(){if(checkObject(b)){if(!checkDefined(h)){h=document.getElementById("videoEditImg");w=document.getElementById("videoEditLabel");x=document.getElementById("videoEditDate");i=document.getElementById("videoEditTitle");l=document.getElementById("videoEditDesc");m=document.getElementById("videoEditTags");n=document.getElementById("videoEditCat");j=document.getElementById("videoEditPerm");g=document.getElementById("contactPickerLink");q=document.getElementById("videoEditButton");p=document.getElementById("videoEditButtonCancel");this.addListener(h,"onclick",this.onImageClick);this.addListener(h,"onerror",this.onThumbError,h);this.addListener(q,"onclick",this.onSubmitClick);this.addListener(p,"onclick",this.onCancelClick);this.addListener(j,"onchange",this.onPermissionChange);this.addListener(g,"onmouseover",this.onCplinkMouseOver);this.addListener(g,"onmouseout",this.onCplinkMouseOut);this.addListener(g,"onclick",this.onCplinkClick);l.style.fontFamily=i.style.fontFamily=m.style.fontFamily=n.style.fontFamily=j.style.fontFamily=q.style.fontFamily=p.style.fontFamily=this.cfg.FONT_FAMILY;l.style.fontSize=i.style.fontSize=m.style.fontSize=n.style.fontSize=j.style.fontSize=q.style.fontSize=p.style.fontSize=this.cfg.FONT_SIZE+"pt"}if(checkDefined(h)){h.src=this.getThumbUrl();w.innerText=ll(b.Title,this.cfg.TITLE_MAX_LENGTH);w.title=b.Title;x.innerText=formatDate(b.ReleaseDate);i.value=b.Title;l.value=b.Description;m.value=this.getUserTags();if(b.Channels.length>0)this.selectOptionByValue(n,b.Channels[0].Id);this.selectOptionByValue(j,b.Permission);if(checkDefined(e))e.style.visibility="visible";if(checkDefined(c)){c.setVisibility(false);c.setDisplay(false)}if(checkDefined(d)){d.setVisibility(false);d.setDisplay(false)}this.fireEvent(Msn.Event.FocusRequest,this)}}};this.selectOptionByValue=function(b,c){if(c==2)g.style.display="inline";else g.style.display="none";for(var a=0;a<b.options.length;a++)if(b.options[a].value==c){b.options[a].selected=true;return}};this.getUserTags=function(){var b="";if(checkDefined(s))for(var a=0;a<s.length;a++){if(a>0)b+=", ";b+=s[a].Name}return b};this.getThumbUrl=function(){var a=this.cfg.MISSING_THUMB;if(checkDefined(b))if(checkString(b.Thumbnail))a=b.Thumbnail;return a};this.onThumbError=function(c,b){if(checkDefined(b))b.src=a.cfg.MISSING_THUMB};this.setVideoId=function(a){if(checkString(a)&&(f!=a||o)){f=a;o=false;Msn.SoapboxServiceManager.LoadVideo(f,this.LoadVideoCb,this.LoadVideoErrorCb);if(checkDefined(e))e.style.visibility="hidden";if(checkDefined(c)){c.setVisibility(true);c.setDisplay(true)}if(checkDefined(d)){d.setVisibility(false);d.setDisplay(false)}}};this.setVideo=function(c){if(checkObject(c)){f=c.Id;o=false;b=c;k.clear();Msn.SoapboxServiceManager.LoadUserVideoData(f,a.LoadUserVideoDataCb,a.LoadUserVideoDataErrCb)}};this.onImageClick=function(){a.fireEvent(Msn.Event.MediaPlay,b)};this.onSubmitClick=function(){var a=this.validateVideo();if(checkDefined(a))Msn.SoapboxServiceManager.EditVideo(a.Id,a.Title,a.Description,a.Category,a.Tags,a.Permission,this.videoEditCb,this.videoEditErrorCb)};this.UpdatePermissions=function(){if(k.length>0){var c=k.pop();if(c.action=="add")Msn.SoapboxServiceManager.AddPermissions(b.Id,c.list.toString(),encodeURIComponent(c.emailList.toString()),c.type,c.successCb,c.errorCb);else if(c.action=="remove")Msn.SoapboxServiceManager.DeletePermissions(b.Id,c.list.toString(),c.type,c.successCb,c.errorCb)}else{customAlert(a.cfg.MSG_VIDEOEDITSUCCESS,true);a.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MySoapbox})}};this.UpdatePermissionCb=function(b){if(checkObject(b)&&checkDefined(b.StatusCode)&&(b.StatusCode==SoapboxService.ResultCode.Success||b.StatusCode==SoapboxService.ResultCode.ABCHServiceDownRetry))a.UpdatePermissions();else a.UpdatePermissionErrorCb()};this.UpdatePermissionErrorCb=function(){customAlert(a.cfg.EDIT_ERR_UPDATE_PERMISSION_MSG,true)};this.validateVideo=function(){var a;if(checkDefined(b)){var f=i.value,g=l.value,d=m.value,e=n.value,c=j.value;a=this.validateVideoMetadata(f,g,d,e,c);if(checkObject(a))a.Id=b.Id;if(c!=2)k.clear()}return a};this.validateVideoMetadata=function(b,c,i,j,h){var d=[],k=i.split(",");for(var a=0;a<k.length;a++){var f=trimSpecialChar(k[a]);if(f.length>0)if(f.length>this.cfg.MAX_TAG_LENGTH){customAlert(this.cfg.EDIT_ERR_TAG_TOO_LONG.format(this.cfg.MAX_TAG_LENGTH));return}else d.push(f)}b=trimSpecialChar(b);if(b.length<1){customAlert(this.cfg.EDIT_ERR_TITLE_MISSING);return}if(b.length>this.cfg.MAX_TITLE_LENGTH){customAlert(this.cfg.EDIT_ERR_TOO_LONG.format(this.cfg.MAX_TITLE_LENGTH));return}c=trimSpecialChar(c);if(c.length<1){customAlert(this.cfg.EDIT_ERR_DESC_MISSING);return}if(c.length>this.cfg.MAX_DESC_LENGTH){customAlert(this.cfg.EDIT_ERR_DESC_TOO_LONG.format(this.cfg.MAX_DESC_LENGTH));return}if(d.length<1){customAlert(this.cfg.EDIT_ERR_TAG_MISSING);return}if(d.length>5){customAlert(this.cfg.EDIT_ERR_TAG_TOO_MANY);return}if(!checkGuid(j)){customAlert(this.cfg.EDIT_ERR_CAT_MISSING);return}if(!checkInt(h,0)){customAlert(this.cfg.EDIT_ERR_PERMISSION_MISSING);return}var e=new Array("<",">","/","\\"),g="< > / \\";for(a=0;a<e.length;a++){if(b.indexOf(e[a])!=-1){customAlert(this.cfg.EDIT_ERR_TITLE_INVALID.format(g));return}if(c.indexOf(e[a])!=-1){customAlert(this.cfg.EDIT_ERR_DESC_INVALID.format(g));return}if(i.indexOf(e[a])!=-1){customAlert(this.cfg.EDIT_ERR_TAG_INVALID.format(g));return}}retValue={};retValue.Title=b;retValue.Description=c;retValue.Tags=d;retValue.Category=j;retValue.Permission=h;return retValue};this.videoEditCb=function(b){if(SoapboxService.ResultCode.Success==b){o=true;a.fireEvent(Msn.Event.VideoEdited);a.UpdatePermissions()}else if(SoapboxService.ResultCode.NotSignedIn==b)customAlert(a.cfg.MSG_VIDEOEDIT_NOTSIGNEDIN);else if(SoapboxService.ResultCode.VideoNotFound==b)customAlert(a.cfg.MSG_VIDEOEDIT_VIDEONOTFOUND);else if(SoapboxService.ResultCode.VideoNotEditable==b)customAlert(a.cfg.MSG_VIDEOEDIT_VIDEONOTEDITABLE);else if(SoapboxService.ResultCode.NicknameNotSet==b)customAlert(a.cfg.MSG_VIDEOEDIT_NICKNAMENOTSET);else if(SoapboxService.ResultCode.BetaNotAuthorized==b)customAlert(a.cfg.MSG_VIDEOEDIT_BETANOTAUTHORIZED);else if(SoapboxService.ResultCode.InvalidTitle==b)customAlert(a.cfg.MSG_VIDEOEDIT_INVALIDTITLE);else if(SoapboxService.ResultCode.InvalidDescription==b)customAlert(a.cfg.MSG_VIDEOEDIT_INVALIDDESCRIPTION);else if(SoapboxService.ResultCode.InvalidCategory==b)customAlert(a.cfg.MSG_VIDEOEDIT_INVALIDCATEGORY);else if(SoapboxService.ResultCode.InvalidTags==b)customAlert(a.cfg.MSG_VIDEOEDIT_INVALIDTAGS);else if(SoapboxService.ResultCode.InvalidPermission==b)customAlert(a.cfg.MSG_VIDEOEDIT_INVALIDPERMISSION);else if(SoapboxService.ResultCode.OffendingInput==b)customAlert(a.cfg.MSG_VIDEOEDIT_OFFENDINGINPUT);else customAlert(a.cfg.MSG_VIDEOEDITERROR)};this.videoEditErrorCb=function(){customAlert(a.cfg.MSG_VIDEOEDITERROR)};this.onCancelClick=function(){a.fireEvent(Msn.Event.MenuClick,{menuId:Msn.Menu.MySoapbox});a.dataBind()};this.onPermissionChange=function(){if(j.value==2)g.style.display="inline";else g.style.display="none"};this.onCplinkMouseOver=function(){g.style.textDecoration="underline"};this.onCplinkMouseOut=function(){g.style.textDecoration="none"};this.onCplinkClick=function(){u=new Msn.Controls.ContactPicker(f);u.setOnData(a.onContactPickerData);u._render()};this.LoadVideoCb=function(b){if(null==b)a.LoadVideoErrorCb();if(checkObject(b)&&checkObject(b.Video)&&checkString(b.Video.Id)&&b.Video.Id==f)a.setVideo(b.Video)};this.LoadVideoErrorCb=function(){a.setError()};this.LoadUserVideoDataCb=function(b){if(null==b)a.LoadUserVideoDataErrCb();if(checkObject(b)&&checkDefined(b.StatusCode)&&b.StatusCode==SoapboxService.ResultCode.Success&&checkObject(b.UserVideo)&&checkString(b.UserVideo.Id)&&b.UserVideo.Id==f){s=b.UserVideo.UserTags;a.dataBind()}};this.LoadUserVideoDataErrCb=function(){a.setError()};this._render=function(a){if(null!=a&&!checkDefined(e)){var b=document.createElement("DIV");b.style.display="block";b.style.backgroundColor="#e7e7e7";c.render(a);d.render(a);e=document.createElement("DIV");e.innerHTML=z;a.appendChild(e)}}};Msn.Controls.VideoEdit.prototype=Msn.Controls;Msn.Controls.VideoLink=function(){var g=this;this.onEvent=function(c,a){switch(a){case Msn.Event.FocusReceived:if(checkDefined(b))try{b.focus()}catch(e){}break}};this.cfg={PERMALINK_EMBED_INPUT:"permalinkEmbedInput",COPY_CLIPBOARD:getCDNPath("/i/videolink.jpg"),PANE_DESCRIPTION:$["IDS_CLI_PaneDescription"],INPUTBOX_TOOLTIP:$["IDS_CLI_InputboxTooltip"],COPY_CLIPBOARD_TOOLTIP:$["IDS_CLI_CopyClipboardTooltip"],CLOSE_TITLE:$["IDS_CLI_CloseTitle"],LINK:$["IDS_CLI_Link"],LINK_WITH_IMAGE:$["IDS_CLI_LinkWithImage"]};var c=null,a=null,b,e,f,d;this.setVideo=function(b){if(checkDefined(b)&&checkString(b.Id)&&b.Id!=c){a=b;c=b.Id;this.dataBind()}};this.dataBind=function(){if(checkDefined(a)){this.setPermaLink();this.setPermaLinkImage()}};this.setPermaLink=function(){if(checkString(c))if(checkDefined(b)&&checkDefined(f))b.value=getPermaLinkUrl(a)};this.setPermaLinkImage=function(){if(checkDefined(e)&&checkDefined(d))e.value=this.getPermaLinkImage()};this.getPermaLinkImage=function(){if(checkString(c)&&checkDefined(a))if(checkString(a.Thumbnail)){var b=HTMLEncodeString(a.Title.trim());return '<a href="'+getPermaLinkUrl(a)+'" target="_new" title="'+b+'"><img src="'+a.Thumbnail+'" border=0 alt="'+b+'" width=112 height=84><br />'+b+"</a>"}};this.getVideoLink=function(){if(checkString(c)&&checkDefined(a))if(checkString(a.Thumbnail)){var b=HTMLEncodeString(a.Title.trim());return "<a href='"+getPermaLinkUrl(a)+"' title='"+b+"'><img src='"+a.Thumbnail+"' border=0 hspace=10 alt='"+b+"' /></a><br />"+a.Description}};this.onClosePane=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"videolink:close"});g.closePane();return false};this.closePane=function(){this.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.NULL)};this.onSelect=function(b,a){if(checkDefined(a))a.select()};this.onCopyPermaLinkToClip=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"videolink:copy"});copyToClip(getPermaLinkUrl(a));return false};this.onCopyPermaLinkImageToClip=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{type:"meta",name:"videolink:copyhtm"});copyToClip(this.getPermaLinkImage());return false};this._render=function(k){if(null==k)return;var h,c,a,i;h=document.createElement("DIV");h.className="closeLinkLocation";c=document.createElement("A");c.appendChild(document.createTextNode(this.cfg.CLOSE_TITLE));c.href=this.getLinkHref();h.appendChild(c);k.appendChild(h);this.addListener(c,"onclick",this.onClosePane);h=document.createElement("DIV");h.className="divPadding";var j=document.createElement("DIV");j.appendChild(document.createTextNode(this.cfg.PANE_DESCRIPTION));j.className="linkDescription";h.appendChild(j);c=document.createElement("div");i=document.createElement("span");i.appendChild(document.createTextNode(g.cfg.LINK));c.appendChild(i);c.appendChild(document.createElement("BR"));f=document.createElement("SPAN");c.appendChild(f);a=document.createElement("INPUT");this.setGlobalizedUI(a);a.className=this.cfg.PERMALINK_EMBED_INPUT;a.title=this.cfg.INPUTBOX_TOOLTIP;a.readOnly="true";this.addListener(a,"onclick",this.onSelect,a);this.addListener(a,"onfocus",this.onSelect,a);b=a;c.appendChild(a);_elCopyClip=document.createElement("A");i=new Msn.Controls.LiteralHTML("<img src='"+this.cfg.COPY_CLIPBOARD+"' width=15px height=13px class='copyClip' title='"+this.cfg.COPY_CLIPBOARD_TOOLTIP+"' />","");i.render(_elCopyClip);_elCopyClip.href=this.getLinkHref();this.addListener(_elCopyClip,"onclick",this.onCopyPermaLinkToClip);c.appendChild(_elCopyClip);h.appendChild(c);h.appendChild(document.createElement("BR"));h.appendChild(document.createElement("BR"));c=document.createElement("div");i=document.createElement("span");i.appendChild(document.createTextNode(g.cfg.LINK_WITH_IMAGE));c.appendChild(i);c.appendChild(document.createElement("BR"));d=document.createElement("SPAN");c.appendChild(d);a=document.createElement("INPUT");this.setGlobalizedUI(a);a.className=this.cfg.PERMALINK_EMBED_INPUT;a.title=this.cfg.INPUTBOX_TOOLTIP;a.readOnly="ture";this.addListener(a,"onclick",this.onSelect,a);this.addListener(a,"onfocus",this.onSelect,a);e=a;c.appendChild(a);_elCopyClip=document.createElement("A");i=new Msn.Controls.LiteralHTML("<img src='"+this.cfg.COPY_CLIPBOARD+"' width=15px height=13px class='copyClip' title='"+this.cfg.COPY_CLIPBOARD_TOOLTIP+"' />","");i.render(_elCopyClip);_elCopyClip.href=this.getLinkHref();this.addListener(_elCopyClip,"onclick",this.onCopyPermaLinkImageToClip);c.appendChild(_elCopyClip);h.appendChild(c);k.appendChild(h);this.dataBind()}};Msn.Controls.VideoLink.prototype=Msn.Controls;Msn.Controls.VideoPanel=function(){var d=this,f=true;Msn.VideoPanelHeader=SoapboxService.Utils.CreateEnum("Details",0,"Comment",1,"Tags",2);this.cfg={COMMENTS:$["IDS_CLI_Comments"],TAGS:$["IDS_CLI_Tags"],THIS_VIDEO:$["IDS_CLI_ThisVideo"],LOADING:$["IDS_CLI_Loading"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],FEATURE_DISABLED:$["IDS_CLI_CommunityFeatureDisabled"]};this.subscribeEvent(Msn.Event.VideoPanelViewChange);this.subscribeEvent(Msn.Event.MediaChangedBegin);this.subscribeEvent(Msn.Event.MediaChanged);this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.CommentsUpdated);this.subscribeEvent(Msn.Event.TagsUpdated);this.subscribeEvent(Msn.Event.ControlsAckFullScreen);this.subscribeEvent(Msn.Event.MetadataError);this.onEvent=function(f,d,c){switch(d){case Msn.Event.MetadataError:this.setLoadingMode(true,true);break;case Msn.Event.ControlsAckFullScreen:this.setVisibility(!c);this.setDisplay(!c);break;case Msn.Event.MediaChangedBegin:this.fireEvent(Msn.Event.MediaChanged,c);break;case Msn.Event.MediaChanged:if(p!=c.Id){p=c.Id;e=false;this.setLoadingMode(true)}break;case Msn.Event.MediaMetadata:a=c;g=true;l=a.Video.CsId==Msn.Controls.config.SoapboxCsId;h=new Msn.Controls.CommunityHelper(a.Video);this.setLoadingMode(false);if(!e)this.onVideoInfoPanelSelect();b.setVisibility(true);this.setPanelHeaders();break;case Msn.Event.VideoPanelViewChange:switch(c){case Msn.VideoPanel.VideoDetails:this.onVideoInfoPanelSelect();break;case Msn.VideoPanel.Comment:if(!e)this.onCommentsDisplay(true);this.onCommentPanelSelect();break;case Msn.VideoPanel.PopularTags:case Msn.VideoPanel.YourTags:this.onTagsPanelSelect();break;case Msn.VideoPanel.Loading:this.setLoadingMode(true);break;default:break}e=true;break;case Msn.Event.CommentsUpdated:this.updateCommentsHead(c.Count);break;case Msn.Event.TagsUpdated:this.updateTagsHead(c.PopularTags.length);break}};this.setLoadingMode=function(a,d){f=a;b.setLoadingMode(a);if(a){var e=checkDefined(d)&&d;c.select(e?Msn.VideoPanel.Error:Msn.VideoPanel.Loading)}};this.onVideoTag=function(){if(!f)if(h.featureEnabled(Msn.CommunityBits.Tagging)){c.select(Msn.VideoPanel.PopularTags);this.fireEvent(Msn.Event.FocusRequest,n)}else c.select(Msn.VideoPanel.FeatureDisabled)};this.onVideoInfoSelect=function(){if(!f){var b=null;if(checkDefined(a)&&checkDefined(a.Video))b=a.Video;if(!g)ReportTracking(b,"videoinfo",Msn.Event.PanelSelect,"");g=false;c.select(l?Msn.VideoPanel.VideoDetails:Msn.VideoPanel.MSNVideoDetails)}};this.onCommentsDisplay=function(b){if(!f||b)if(h.featureEnabled(Msn.CommunityBits.Comments)){o.setVideo(a.Video);c.select(Msn.VideoPanel.Comment)}else c.select(Msn.VideoPanel.FeatureDisabled)};this.onCommentPanelSelect=function(){b.selectPanel(Msn.VideoPanelHeader.Comment)};this.showTabs=function(a){b.setHeaderDisplay(a)};this.onTagsPanelSelect=function(){b.selectPanel(Msn.VideoPanelHeader.Tags)};this.onVideoInfoPanelSelect=function(){b.selectPanel(Msn.VideoPanelHeader.Details)};this.updateCommentsHead=function(a){var c=d.cfg.COMMENTS;if(checkInt(a,1)){a=a<100?a:">99";c+="("+a+")"}b.setPanelHeader(c,Msn.VideoPanelHeader.Comment)};this.updateTagsHead=function(a){var c=d.cfg.TAGS;if(checkInt(a,1)){a=a<100?a:">99";c+="("+a+")"}b.setPanelHeader(c,Msn.VideoPanelHeader.Tags)};this.setPanelHeaders=function(){if(null!=a&&null!=a.Video){this.updateCommentsHead(a.Video.NoOfComments);if(null!=a.Video.PopularTags)this.updateTagsHead(a.Video.PopularTags.length);else this.updateTagsHead(0)}else{this.updateCommentsHead(0);this.updateTagsHead(0)}};this.commentsPanelSelectHandler=function(){var b=null;if(checkDefined(a)&&checkDefined(a.Video))b=a.Video;ReportTracking(b,"Comments",Msn.Event.PanelSelect,"");d.onCommentsDisplay()};this.tagsPanelSelectHandler=function(){var b=null;if(checkDefined(a)&&checkDefined(a.Video))b=a.Video;ReportTracking(b,"Tags",Msn.Event.PanelSelect,"");d.onVideoTag()};var e=false,b=new Msn.Controls.Panel,i=new Msn.Controls.PanelHead;i.title=d.cfg.COMMENTS;i.onPanelSelect=this.commentsPanelSelectHandler;var k=new Msn.Controls.PanelHead;k.title=d.cfg.TAGS;k.onPanelSelect=this.tagsPanelSelectHandler;var j=new Msn.Controls.PanelHead;j.title=d.cfg.THIS_VIDEO;j.onPanelSelect=this.onVideoInfoSelect;var m=new Msn.Controls.CommunityHelper;b.addPanel(j);b.addPanel(i);b.addPanel(k);if(!m.featureEnabledMarket(Msn.CommunityBits.Comments))b.setActive(false,Msn.VideoPanelHeader.Comment);if(!m.featureEnabledMarket(Msn.CommunityBits.Tagging))b.setActive(false,Msn.VideoPanelHeader.Tags);var p=0,a=null,g=true,h=null,l=false,w="314",v="295",c=new Msn.Controls.FilterTab(w,v,"metadataTabs"),s=new Msn.Controls.VideoDetails,o=new Msn.Controls.Comments,n=new Msn.Controls.TagModule(300,200),t=new Msn.Controls.Label(d.cfg.LOADING,"metadataPadding"),u=new Msn.Controls.Label(d.cfg.DATA_NOT_AVAILABLE,"metadataPadding"),q=new Msn.Controls.MSNVideoInfo,r=new Msn.Controls.Label(d.cfg.FEATURE_DISABLED,"metadataPadding");c.add(Msn.VideoPanel.Loading,t);c.add(Msn.VideoPanel.VideoDetails,s);c.add(Msn.VideoPanel.Comment,o);c.add(Msn.VideoPanel.PopularTags,n);c.add(Msn.VideoPanel.Error,u);c.add(Msn.VideoPanel.MSNVideoDetails,q);c.add(Msn.VideoPanel.FeatureDisabled,r);b.bodyCtrl=c;this._render=function(a){if(null!=a)b.render(a)}};Msn.Controls.VideoPanel.prototype=Msn.Controls;Msn.VideoPanel=SoapboxService.Utils.CreateEnum("NULL",-1,"VideoDetails",0,"Comment",1,"Email",2,"AddFavorite",3,"Flag",4,"IM",5,"PopularTags",6,"YourTags",7,"Loading",8,"Share",9,"VideoLink",10,"EmbedVideo",11,"Error",12,"MSNVideoDetails",13,"FeatureDisabled",14);Msn.Controls.VideoPanelRemoteControl=function(){var a=this;this.subscribeEvent(Msn.Event.MediaMetadata);this.subscribeEvent(Msn.Event.MetadataError);this.onEvent=function(c,b,a){switch(b){case Msn.Event.MediaMetadata:this.setVideo(a);break;case Msn.Event.MetadataError:this.displayLinks(false);break;default:break}};this.cfg={EMAIL_TOOLTIP:$["IDS_CLI_EmailTooltip"],EMAIL_TEXT:$["IDS_CLI_EmailText"],IM_TOOLTIP:$["IDS_CLI_ImTooltip"],IM_TEXT:$["IDS_CLI_ImText"],COMMENTS_TOOLTIP:$["IDS_CLI_CommentsTooltip"],COMMENTS_TEXT:$["IDS_CLI_CommentsText"],FLAG_TOOLTIP:$["IDS_CLI_FlagTooltip"],FLAG_TEXT:$["IDS_CLI_FlagText"],DIGG_TOOLTIP:$["IDS_CLI_DiggTooltip"],DIGG_TEXT:$["IDS_CLI_DiggText"],VIDEOLINK_TOOLTIP:$["IDS_CLI_VideolinkTooltip"],VIDEOLINK_TEXT:$["IDS_CLI_VideolinkText"],EMBED_TOOLTIP:$["IDS_CLI_EmbedTooltip"],EMBED_TEXT:$["IDS_CLI_EmbedText"],INVITE_TOOLTIP:$["IDS_CLI_InviteTooltip"],INVITE_TEXT:$["IDS_CLI_InviteText"],SIGN_IN_TO_COMMENT:$["IDS_CLI_SignInToAddComment"],SIGN_IN_TO_REPORT:$["IDS_CLI_SignInToReport"],RATE_VIDEO:$["IDS_CLI_RateVideo"],MAX_ACTION_LENGTH:15,PERMALINK_URL:"/video.aspx?vid=",EMAIL:getCDNPath("/i/email.jpg"),IM:getCDNPath("/i/im.jpg"),DIGG:getCDNPath("/i/digg.gif"),COMMENTS:getCDNPath("/i/AddComment.gif"),FLAG:getCDNPath("/i/report.jpg"),VIDEOLINK:getCDNPath("/i/videolink.jpg"),EMBED:getCDNPath("/i/embed.gif"),INVITE:getCDNPath("/i/invitefriend.gif"),VIDEOACTION:"videoActionControls",DISABLED_MESSAGE:$["IDS_CLI_CommunityFeatureDisabled"]};var b=null,q=true,s=0,k=null,r=null,o=null,t=null,u=null,h=null,i=null,j=null,f=null,e=null,g=null,d=null,m=new Msn.Controls.Blog,l=new Msn.Controls.Favorites,n=new Msn.Controls.Rating(true),p=null,c=null;this.setVideo=function(o){if(checkDefined(o)&&checkString(o.Video.Id)){this.displayLinks(true);s=o.Video.Id;b=o.Video;q=o.Video.CsId==Msn.Controls.config.SoapboxCsId;k=new Msn.Controls.CommunityHelper(b);if(checkDefined(h))k.featureEnabled(Msn.CommunityBits.Email)?h.enable():h.disable("White",null,h.node.parentElement.offsetWidth,h.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(checkDefined(m)&&checkDefined(m.node)){m.setVideo(o);if(k.featureEnabled(Msn.CommunityBits.Spaces))m.enable();else m.disable("White",null,m.node.parentElement.offsetWidth,m.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE)}if(checkDefined(f))k.featureEnabled(Msn.CommunityBits.Permalink)?f.enable():f.disable("White",null,f.node.parentElement.offsetWidth,f.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(checkDefined(j))k.featureEnabled(Msn.CommunityBits.IMActivity)?j.enable():j.disable("White",null,j.node.parentElement.offsetWidth,j.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(checkDefined(l)&&checkDefined(l.node)){l.setVideo(o);if(k.featureEnabled(Msn.CommunityBits.Favorites))l.enable();else l.disable("White",null,l.node.parentElement.offsetWidth,l.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE)}if(checkDefined(c)){n.setWebVideo(o);if(k.featureEnabled(Msn.CommunityBits.Rating))n.enable();else n.disable("White",c,"100","32",a.cfg.DISABLED_MESSAGE)}if(checkDefined(g))k.featureEnabled(Msn.CommunityBits.Comments)?g.enable():g.disable("White",null,g.node.parentElement.offsetWidth,g.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(checkDefined(e))k.featureEnabled(Msn.CommunityBits.Embed)?e.enable():e.disable("White",null,e.node.parentElement.offsetWidth,e.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(checkDefined(i))k.featureEnabled(Msn.CommunityBits.Digg)?i.enable():i.disable("White",null,i.node.parentElement.offsetWidth,i.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE);if(q){if(checkDefined(d))d.enable()}else if(checkDefined(d))d.disable("White",null,d.node.parentElement.offsetWidth,d.node.parentElement.offsetHeight,a.cfg.DISABLED_MESSAGE)}};this.displayLinks=function(a){if(checkDefined(c))if(a)c.style.display="inline";else c.style.display="none";if(checkDefined(o))if(a)o.style.visibility="visible";else o.style.visibility="hidden"};this.onSendEmail=function(){a.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.Email);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"email"});return false};this.onVideoLink=function(){a.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.VideoLink);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"videolink"});return false};this.onEmbedVideo=function(){a.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.EmbedVideo);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"embed"});return false};this.onIM=function(){if(!checkDefined(p))p=new Msn.Controls.IM;p.Launch(s);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"im"});return false};this.onAddComments=function(){if(Msn.Passport.isUserLoggedIn()){a.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.Comment);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"comment:add"})}else{Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta",name:"comment:signinerror"});Msn.Passport.loginDialog(a.cfg.SIGN_IN_TO_COMMENT.format("",""))}return false};this.onFlagVideo=function(){if(Msn.Passport.isUserLoggedIn()){a.fireEvent(Msn.Event.VideoPanelRemoteControl,Msn.VideoPanel.Flag);Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"report"})}else Msn.Passport.loginDialog(a.cfg.SIGN_IN_TO_REPORT);return false};this.onDiggVideo=function(){Msn.Controls.fireEvent(Msn.Event.MetaLink,{video:b,type:"meta:rr",name:"digg"});var a="http://digg.com/submit?phase=2&url={0}&title={1}&bodytext={2}&media=video",c=getPermaLinkUrl(b,true);a=a.format(encodeURIComponent(c),encodeURIComponent(b.Title),encodeURIComponent(b.Description));openWindow(a,"_blank",640,480,"resizable=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,location=yes");return false};this._render=function(s){if(s){r=s;r.className=a.cfg.VIDEOACTION;var o=new Msn.Controls.CommunityHelper,C,A,k,B,z,y,x,w,p=document.createElement("DIV"),v=document.createElement("DIV");v.className="actionItemMenuBuffer";p.appendChild(v);k=document.createElement("DIV");k.className="actionItemsDiv";p.appendChild(k);if(o.featureEnabledMarket(Msn.CommunityBits.Rating)){c=document.createElement("DIV");c.style.display="inline";var q=document.createElement("DIV");q.className="ratingHead";q.appendChild(document.createTextNode(a.cfg.RATE_VIDEO));c.appendChild(q);n.render(c);c.appendChild(document.createElement("BR"));var t=document.createElement("DIV");t.className="videoActionItemsSeperator";c.appendChild(t);k.appendChild(c)}var u=document.createElement("DIV");u.className="videoActionItemsPadding";k.appendChild(u);var b;if(o.featureEnabledMarket(Msn.CommunityBits.Email)){b=document.createElement("DIV");b.className="actionItemDiv";h=new Msn.Controls.GenericActionLink;h.setImage(a.cfg.EMAIL,this.cfg.EMAIL_TOOLTIP,"videoActionImage");h.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);h.setLinkText(this.cfg.EMAIL_TEXT,"videoActionText");h.setOnClickHandler(a.onSendEmail);h.render(b);k.appendChild(b)}if(o.featureEnabledMarket(Msn.CommunityBits.Spaces)){b=document.createElement("DIV");b.className="actionItemDiv";m.render(b);k.appendChild(b)}if(o.featureEnabledMarket(Msn.CommunityBits.Permalink)){b=document.createElement("DIV");b.className="actionItemDiv";f=new Msn.Controls.GenericActionLink;f.setImage(a.cfg.VIDEOLINK,this.cfg.VIDEOLINK_TOOLTIP,"videoActionImage");f.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);f.setLinkText(this.cfg.VIDEOLINK_TEXT,"videoActionText");f.setOnClickHandler(a.onVideoLink);f.render(b);k.appendChild(b)}if(o.featureEnabledMarket(Msn.CommunityBits.Digg)){b=document.createElement("DIV");b.className="actionItemDiv";i=new Msn.Controls.GenericActionLink;i.setImage(a.cfg.DIGG,this.cfg.DIGG_TOOLTIP,"videoActionImage");i.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);i.setLinkText(this.cfg.DIGG_TEXT,"videoActionText");i.setOnClickHandler(a.onDiggVideo);i.render(b);k.appendChild(b)}if(this.getBrowser()==Msn.Browser.IE&&o.featureEnabledMarket(Msn.CommunityBits.IMActivity)){b=document.createElement("DIV");b.className="actionItemDiv";j=new Msn.Controls.GenericActionLink;j.setImage(a.cfg.IM,this.cfg.IM_TOOLTIP,"videoActionImage");j.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);j.setLinkText(this.cfg.IM_TEXT,"videoActionText");j.setOnClickHandler(a.onIM);j.render(b);k.appendChild(b)}if(o.featureEnabledMarket(Msn.CommunityBits.Comments)){b=document.createElement("DIV");b.className="actionItemDiv";g=new Msn.Controls.GenericActionLink;g.setImage(a.cfg.COMMENTS,this.cfg.COMMENTS_TOOLTIP,"videoActionImage");g.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);g.setLinkText(this.cfg.COMMENTS_TEXT,"videoActionText");g.setOnClickHandler(a.onAddComments);g.render(b);k.appendChild(b)}if(o.featureEnabledMarket(Msn.CommunityBits.Favorites)){b=document.createElement("DIV");b.className="actionItemDiv";l.render(b);k.appendChild(b)}if(isTrue($["IDS_GMT_EnableEmbeddedPlayer"])&&o.featureEnabledMarket(Msn.CommunityBits.Embed)){b=document.createElement("DIV");b.className="actionItemDiv";e=new Msn.Controls.GenericActionLink;e.setImage(a.cfg.EMBED,this.cfg.EMBED_TOOLTIP,"videoActionImage");e.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);e.setLinkText(this.cfg.EMBED_TEXT,"videoActionText");e.setOnClickHandler(a.onEmbedVideo);e.render(b);k.appendChild(b)}b=document.createElement("DIV");b.className="actionItemDiv";d=new Msn.Controls.GenericActionLink;d.setImage(a.cfg.FLAG,this.cfg.FLAG_TOOLTIP,"videoActionImage");d.setMaxTextLength(a.cfg.MAX_ACTION_LENGTH);d.setLinkText(this.cfg.FLAG_TEXT,"videoActionText");d.setOnClickHandler(a.onFlagVideo);d.render(b);k.appendChild(b);s.appendChild(p)}}};Msn.Controls.VideoPanelRemoteControl.prototype=Msn.Controls;Msn.VideoMetadata=SoapboxService.Utils.CreateEnum("Rating","0","Views","1","ReleaseDate","2","Comments","3","Favorites","4","Source","5","StartDateMSNFormat","6","Length","7");Msn.Controls.VideoPreview=function(f,O){var b=this,m=false,r=false;this.subscribeEvent(Msn.Event.VideoSelected);this.subscribeEvent(Msn.Event.MediaLoaded);this.subscribeEvent(Msn.Event.MediaCompleted);this.subscribeEvent(Msn.Event.MediaLoadError);this.subscribeEvent(Msn.Event.AdChanged);this.onEvent=function(d,c,a){switch(c){case Msn.Event.VideoSelected:b.onCloseDetails();break;case Msn.Event.MediaLoaded:r=!checkObject(a);break;case Msn.Event.MediaLoadError:r=false;break;case Msn.Event.MediaCompleted:r=false;break;case Msn.Event.AdChanged:r=true;break}};this.cfg={METADATA_LENGTH:20,TITLE2_LENGTH:30,THUMBNAIL_SRC:getCDNPath("/i/thumbnail.gif"),THUMBNAIL_SRC_SMALL:getCDNPath("/i/thumbnailSmall.gif"),LABEL_PLAYDURINGAD:$["IDS_CLI_PLAYDURINGAD"],LABEL_PUBLIC:$["IDS_CLI_Public"],LABEL_HIDDEN:$["IDS_CLI_Hidden"],LABEL_SHARED:$["IDS_CLI_Shared"],LABEL_EDIT:$["IDS_CLI_Edit"],LABEL_DOWNLOAD:$["IDS_CLI_Download"],LABEL_DELETE:$["IDS_CLI_Delete"],LABEL_REMOVE:$["IDS_CLI_Remove"],LABEL_VIDEO_UNAVAILBLE:$["IDS_CLI_LabelVideoUnavailble"],LABEL_IMAGE_UNAVAILBLE:$["IDS_CLI_LabelImageUnavailble"],LABEL_PROCESSING:$["IDS_CLI_LabelProcessing"],LABEL_FAILED:$["IDS_CLI_LabelFailed"],LABEL_COPYRIGHT:$["IDS_CLI_LabelCopyright"],LABEL_CONDUCT:$["IDS_CLI_LabelConduct"],RATING:$["IDS_CLI_Rating"],FAILED_REMOVE:$["IDS_CLI_FailedRemoveFromFavorites"],FAILED_REMOVE_SHARED:$["IDS_CLI_FailedRemoveFromShared"],UNAVAILABLE_LABEL:$["IDS_CLI_UnavailableLabel"],GEO_UNAVAILABLE:$["IDS_CLI_GeoUnavailable"],ERROR_EDIT_FAILED:$["IDS_CLI_ErrorEditFailed"],ERROR_COPYRIGHT_VIDEO:$["IDS_CLI_ErrorCopyrightVideo"],ERROR_CODE_CONDUCT_VIOLATION:$["IDS_CLI_ErrorCodeConductViolation"],ERROR_GEO_UNAVAILABLE:$["IDS_CLI_ErrorGeoUnavailable"],COPYRIGHT_TEXT:$["IDS_CLI_CopyrightText"],COPYRIGHT_TEXT_FAQ:$["IDS_CLI_CopyrightTextFaq"],VIDEO_DELETE_CONFIRM:$["IDS_CLI_VideoDeleteConfirm"],VIEW_COUNT:$["IDS_CLI_ViewCount"],COMMENTS_COUNT:$["IDS_CLI_CommentsCount"],FAVORITES_COUNT:$["IDS_CLI_FavoritesCount"],LENGTH:$["IDS_CLI_MetadataLength"],SOAPBOX:$["IDS_CLI_Soapbox"],REMOVE_FAVORITES:$["IDS_CLI_RemoveFavorites"],REMOVE_SHARED:$["IDS_CLI_RemoveShared"],HOURLY:$["IDS_CLI_Hourly"],DAILY:$["IDS_CLI_Daily"],WEEKLY:$["IDS_CLI_Weekly"],MONTHLY:$["IDS_CLI_Monthly"],COPYRIGHT_MESSAGE:$["IDS_CLI_CopyrightMessage"],COPYRIGHT_MESSAGE_SONG:$["IDS_CLI_CopyrightDetailsSong"],COPYRIGHT_MESSAGE_VIDEO:$["IDS_CLI_CopyrightDetailsVideo"],COPYRIGHT_MESSAGE_UNKNOWN:$["IDS_CLI_CopyrightDetailsUnknown"],COPYRIGHT_TITLE:$["IDS_CLI_CopyrightTitle"],COPYRIGHT_ARTIST:$["IDS_CLI_CopyrightArtist"],COPYRIGHT_PERFORMER:$["IDS_CLI_CopyrightPerformer"],COPYRIGHT_LABEL:$["IDS_CLI_CopyrightLabel"]};var a=null,E=false,z=false,q=new Msn.Controls.Rating(false);q.setVisibility(false);var G=false,x=false,H=false,s=false,A=false,D=null,u=null,J=Msn.VideoMetadata.Rating,K=Msn.VideoMetadata.Views,I=SoapboxService.SortOrder.Default,y=false,C=0;this.setLastColumnItem=function(a){y=a;if(null!=p)p.className=y?"videoPreviewSeparatorLastColum":""};this.setLeftMargin=function(a){if(checkInt(a)){C=a;if(null!=c)c.style.marginLeft=C+"px"}};this.setMetadataData=function(b,a,c){if(checkDefined(b))J=b;if(checkDefined(a))K=a;I=c};this.setShowEditControls=function(a){H=a};this.setShowSharedControl=function(a){s=a};this.setShowFavControls=function(a){A=a};this.setOnItemEdit=function(a){D=a};this.setOnItemDelete=function(a){u=a};this.onDownload=function(){openWindow(getHostUrl()+"/StreamingUrl.aspx?dl=true&vid="+a.Id);m=true};this.onEdit=function(){if(null!=D){if(a.GeoBlocked)customAlert(b.cfg.ERROR_GEO_UNAVAILABLE);else if(a.Status==SoapboxService.VideoStatus.Failed)customAlert(b.cfg.ERROR_EDIT_FAILED);else if(a.IsCopyright)customAlert(b.cfg.ERROR_COPYRIGHT_VIDEO);else if(a.Status==SoapboxService.VideoStatus.Rejected)customAlert(b.cfg.ERROR_CODE_CONDUCT_VIOLATION);else D(a);m=true}return false};this.onDelete=function(){if(null!=u){if(SoapboxService.VideoStatus.Failed==a.Status)u(a);else{var c=new Msn.Controls.Dialog;c.description=b.cfg.VIDEO_DELETE_CONFIRM;c.type=Msn.Dialog.Confirm;c.onComplete=function(c){b.deleteVideoConfirmed(c,a)};b.fireEvent(Msn.Event.DialogRequest,c)}m=true}return false};this.deleteVideoConfirmed=function(a,b){if(a)u(b)};this.setVideo=function(b){a=b;if(checkDefined(d))d.setVideo(a);this.dataBind()};this.clear=function(){a=null;q.clear();if(null!=c){c.style.display="none";if(f)l.style.visibility="hidden";if(d)d.setVisibility(false)}};this.addToPlaylist=function(a){if(d)d.onAddToPlaylist(null,a)};this.copyrightHelp=function(){Msn.Application.displayHelp(true);return false};this.copyrightDetails=function(){Msn.SoapboxServiceManager.GetCopyRightResult(a.Id,b.getCopyrightCb,b.getCopyrightErrorCb)};this.getCopyrightCb=function(c){var d=false;if(checkDefined(c)&&checkObject(c.CopyRightInfo)&&SoapboxService.ResultCode.Success==c.StatusCode)if(c.VideoId==a.Id)if(c.CopyRightInfo.Match){var h,f,g,e;switch(c.CopyRightInfo.MatchContentType){case "Music":case "Song":d=checkString(c.CopyRightInfo.Song)&&checkString(c.CopyRightInfo.Artist);if(d){f="<br><b>"+b.cfg.COPYRIGHT_TITLE.format("</b>",c.CopyRightInfo.Song);e="<br><b>"+b.cfg.COPYRIGHT_ARTIST.format("</b>",c.CopyRightInfo.Artist);h=b.cfg.COPYRIGHT_MESSAGE_SONG.format(f+e+"<br/><br/>")}break;case "Video":case "SoundTrack":d=checkString(c.CopyRightInfo.Song)&&checkString(c.CopyRightInfo.Artist)&&checkString(c.CopyRightInfo.Label);if(d){f="<br><b>"+b.cfg.COPYRIGHT_TITLE.format("</b>",c.CopyRightInfo.Song);e="<br><b>"+b.cfg.COPYRIGHT_PERFORMER.format("</b>",c.CopyRightInfo.Artist);g="<br><b>"+b.cfg.COPYRIGHT_LABEL.format("</b>",c.CopyRightInfo.Label);h=b.cfg.COPYRIGHT_MESSAGE_VIDEO.format(f+e+g+"<br/><br/>")}break;default:d=checkString(c.CopyRightInfo.Song)&&checkString(c.CopyRightInfo.Artist)&&checkString(c.CopyRightInfo.Label);if(d){f="<br><b>"+b.cfg.COPYRIGHT_TITLE.format("</b>",c.CopyRightInfo.Song);e="<br><b>"+b.cfg.COPYRIGHT_PERFORMER.format("</b>",c.CopyRightInfo.Artist);g="<br><b>"+b.cfg.COPYRIGHT_LABEL.format("</b>",c.CopyRightInfo.Label);h=b.cfg.COPYRIGHT_MESSAGE_UNKNOWN.format(f+e+g+"<br/><br/>")}break}customAlert(h)}if(d==false)b.getCopyrightErrorCb()};this.getCopyrightErrorCb=function(){customAlert(b.cfg.COPYRIGHT_MESSAGE)};this.dataBind=function(){if(null==a)this.clear();else if(null!=c){var m=Msn.Passport.isUserLoggedIn()&&a!=null&&a.OwnerId==Msn.Passport.getCid();z=a.CsId==Msn.Controls.config.SoapboxCsId&&!isSoapboxEnabled();E=a.CsId==Msn.Controls.config.SoapboxCsId&&a.Status==SoapboxService.VideoStatus.Rejected||a.GeoBlocked||z;c.style.display="block";c.style.marginLeft=C+"px";if(null!=p)p.className=y?"videoPreviewSeparatorLastColum":"";this.dataBindThumbnail();if(f)l.title=a.Title;else{var j=m&&H&&!a.IsCopyright,o=!m&&s,r=ll(a.Title,b.cfg.TITLE2_LENGTH);F.innerText=r;F.title=a.Title;if(a.IsCopyright){h.style.display="none";e.style.display="inline"}else if(a.GeoBlocked){h.innerText=h.title=b.cfg.GEO_UNAVAILABLE;h.className="videoPreviewDescriptionTextLong";e.style.display="none"}else{if(checkDefined(a.Description))h.innerText=h.title=a.Description;h.className=j||A?"videoPreviewDescriptionTextShort":"videoPreviewDescriptionTextLong";e.style.display="none"}q.setVisibility(false);var d=b.getMetadataValue(J,a);if(d==""){k.style.visibility="hidden";k.style.display="none"}else{k.innerText=ll(d,this.cfg.METADATA_LENGTH);k.title=d;k.style.visibility="visible";k.style.display="inline"}d=b.getMetadataValue(K,a);if(getUrlParam("vf").length>0)d+=b.getVideoFormatDebug(a);if(d==""){g.style.visibility="hidden";g.style.display="none"}else{g.innerText=ll(d,this.cfg.METADATA_LENGTH);g.title=d;g.innerText=d;g.style.visibility="visible";g.style.display="inline"}if(j){if(null!=n)if(a.Permission==0)n.innerText=this.cfg.LABEL_PUBLIC;else if(a.Permission==1)n.innerText=this.cfg.LABEL_HIDDEN;else n.innerText=this.cfg.LABEL_SHARED;i.style.display="inline"}else i.style.display="none";v.style.display=o||A?"inline":"none"}}};this.getMetadataValue=function(g,a){if(null!=a)switch(g){case Msn.VideoMetadata.Rating:q.setVideo(a);q.setVisibility(true);return "";case Msn.VideoMetadata.Views:var c=this.getExtendedMetadataValue(a.PlayCountExtended,a.PlayCount);return (checkString(c.text)?c.text+" ":"")+b.cfg.VIEW_COUNT.format(c.value);case Msn.VideoMetadata.ReleaseDate:return formatDate(a.ReleaseDate);break;case Msn.VideoMetadata.Comments:var f=this.getExtendedMetadataValue(a.NumCommentsExtended,a.NumComments);return b.cfg.COMMENTS_COUNT.format(f.value);case Msn.VideoMetadata.Favorites:var e=this.getExtendedMetadataValue(a.NumFavoritesExtended,a.NumFavorites);return b.cfg.FAVORITES_COUNT.format(e.value);case Msn.VideoMetadata.Source:return checkDefined(a.SourceFriendlyName)?a.SourceFriendlyName:b.cfg.SOAPBOX;case Msn.VideoMetadata.Length:var d=Math.floor(a.StreamLength/1000),h=d%60<10?"0":"";return checkInt(a.StreamLength)?b.cfg.LENGTH.format(Math.floor(d/60),h+d%60):""}return ""};this.getExtendedMetadataValue=function(b,c){var a=null;if(checkDefined(b))switch(I){case SoapboxService.SortOrder.LastHour:a={value:b.hourlyCount,text:this.cfg.HOURLY};break;case SoapboxService.SortOrder.LastDay:a={value:b.dailyCount,text:this.cfg.DAILY};break;case SoapboxService.SortOrder.LastWeek:a={value:b.weeklyCount,text:this.cfg.WEEKLY};break;case SoapboxService.SortOrder.LastMonth:a={value:b.monthlyCount,text:this.cfg.MONTHLY};break;case SoapboxService.SortOrder.AllTimes:default:a={value:b.allTimes,text:""};break}else a={value:c,text:""};if(checkDefined(a))if(!checkInt(a.value,0))a.value=0;return a};this.getVideoFormatDebug=function(b){var c=" (";if(checkDefined(b)&&checkArray(b.MediaFiles))for(var a=0;a<Msn.Controls.config.playbackSequence.length;a++)if(Msn.Controls.config.playbackSequence[a]=="flash"&&checkDefined(b.MediaFiles[Msn.MediaFormat.FLV]))c+="F";else if((Msn.Controls.config.playbackSequence[a]=="wmp"||Msn.Controls.config.playbackSequence[a]=="silverlight")&&checkDefined(b.MediaFiles[Msn.MediaFormat.WMV]))c+="W";c+=")";return c};this.showPlayDuringAdMsg=function(){j.style.display="none";B.style.display="block";if(!x)setTimeout(b.hidePlayDuringAdMsg,3000)};this.hidePlayDuringAdMsg=function(){B.style.display="none"};this.onPlayTriggered=function(){if(r&&!f)b.showPlayDuringAdMsg();else if(m)m=false;else if(!E)if(a.IsWeb){if(checkString(a.PlayUrl))openStandardWindow(a.PlayUrl,"_blank");ReportTracking(a,"",Msn.Event.MediaClick,"web")}else{b.fireEvent(Msn.Event.MediaPlay,a);ReportTracking(a,"",Msn.Event.MediaClick,"media")}return false};this.onRemoveClick=function(){m=true;var a=new Msn.Controls.Dialog;a.type=Msn.Dialog.Confirm;a.description=s?b.cfg.REMOVE_SHARED:b.cfg.REMOVE_FAVORITES;a.onComplete=function(a){b.removeConfirm(a)};b.fireEvent(Msn.Event.DialogRequest,a);return false};this.removeConfirm=function(c){if(c)if(s)Msn.SoapboxServiceManager.DeleteSharedVideo(a.Id,a.OwnerId,b.sharedRemoveCb,b.sharedRemoveErrorCb);else Msn.SoapboxServiceManager.RemoveFavorite(a.Id,b.removeFavoriteCb,b.removeFavoriteErrorCb)};this.removeFavoriteCb=function(c){if(c==0)b.fireEvent(Msn.Event.FavsUpdated,a.Id);else b.fireEvent(Msn.Event.FavsUpdated)};this.removeFavoriteErrorCb=function(){b.fireEvent(b.cfg.FAILED_REMOVE)};this.sharedRemoveCb=function(a){if(checkObject(a))if(SoapboxService.ResultCode.Success==a.StatusCode||SoapboxService.ResultCode.ABCHServiceDownRetry==a.StatusCode)Msn.Controls.fireEvent(Msn.Event.VideoSharedUpdated);else b.onSharedRemoveErrorCb()};this.sharedRemoveErrorCb=function(){customAlert(b.cfg.FAILED_REMOVE_SHARED)};this.onQueueTriggered=function(){b.fireEvent(Msn.Event.MediaQueue,a)};this.setCursorOnSmallThumb=function(c,a){G=a;b.setVideoViewState()};this.setCursorOnVideodetails=function(c,a){x=a;b.setVideoViewState()};this.setVideoViewState=function(){if(G||x)b.onViewDetails();else b.onCloseDetails()};this.onViewDetails=function(){if(null!=a&&checkDefined(j)){j.style.visibility="visible";j.style.display="block";if(checkDefined(c))c.className="videoPreviewSelect"}};this.onCloseDetails=function(){if(null!=a&&checkDefined(j)){j.style.visibility="hidden";j.style.display="block";if(checkDefined(c))c.className="videoPreviewNormal"}};this.onSmallThumbLoad=function(e,c){c.style.visibility="visible";if(d){var b=!E;if(a&&a.IsWeb)b=false;d.setVisibility(b)}};this.onSmallThumbError=function(d,a){var c=f?b.cfg.THUMBNAIL_SRC_SMALL:b.cfg.THUMBNAIL_SRC;if(checkString(a.src)&&a.src.indexOf(c)<0){a.src=c;if(o)o.innerText=b.cfg.LABEL_IMAGE_UNAVAILBLE}};var F,P,h,e,k,g,t,l,i,c,n,Q,M,w,S,v,N,j,L,R,p,d,o,B;this.dataBindThumbnail=function(){var c=this.cfg.THUMBNAIL_SRC,b="";if(checkDefined(a))if(z)b=this.cfg.LABEL_VIDEO_UNAVAILBLE;else if(a.GeoBlocked)b=this.cfg.LABEL_VIDEO_UNAVAILBLE;else if(a.Status==SoapboxService.VideoStatus.Rejected)if(a.IsCopyright)b=this.cfg.LABEL_COPYRIGHT;else b=this.cfg.LABEL_CONDUCT;else if(checkString(a.Thumbnail))c=f&&checkString(a.MiniThumbnail)?a.MiniThumbnail:a.Thumbnail;else if(a.Status<=SoapboxService.VideoStatus.Processing)b=this.cfg.LABEL_PROCESSING;else b=this.cfg.LABEL_FAILED;if(d)d.setVisibility(false);if(f){l.style.visibility="hidden";l.src=c;l.title=b}else{t.style.visibility="hidden";t.src=c;o.innerText=b}};this._render=function(I){var r,m,K,z,s,u;if(null!=I){I.style.verticalAlign="top";z=document.createElement("SPAN");I.appendChild(z);if(f){c=z;c.style.width="74px";c.style.display="none";this.setCSSFloat(c,"left");r=document.createElement("A");r.href=this.getLinkHref();m=document.createElement("IMG");m.className="miniThumb";m.width="64";m.height="48";l=m;l.style.visibility="hidden";r.appendChild(m);z.appendChild(r);this.addListener(r,"onclick",this.onPlayTriggered);this.addListener(m,"onerror",this.onSmallThumbError,m);this.addListener(m,"onload",this.onSmallThumbLoad,m);var y=document.createElement("SPAN");y.className="addToPlaylistModule";this.setCSSFloat(y,"right");d=new Msn.Controls.AddToPlaylist(f);d.setVideo(a);d.render(y);z.appendChild(y)}else{var H=document.createElement("DIV");H.className="videoPreviewNormal";if(O||(this.getBrowser()==Msn.Browser.Firefox||this.getBrowser()==Msn.Browser.Safari))H.style.height="146px";u=document.createElement("DIV");H.appendChild(u);u.className="videoPreviewParent";s=document.createElement("DIV");s.className="smallVideoPreview";j=s;this.addListener(s,"onmouseover",this.setCursorOnVideodetails,true);this.addListener(s,"onmouseout",this.setCursorOnVideodetails,false);this.addListener(s,"onclick",this.onPlayTriggered);desc=document.createElement("DIV");P=desc;desc.className="videoPreviewDescription";h=document.createElement("DIV");desc.appendChild(h);e=document.createElement("DIV");var D=document.createElement("A");D.className="videoPreviewCopyright";D.href=this.getLinkHref();D.title=this.cfg.COPYRIGHT_TEXT;D.appendChild(document.createTextNode(this.cfg.COPYRIGHT_TEXT));this.addListener(D,"onclick",this.copyrightDetails);e.appendChild(D);var A=document.createElement("A");A.className="videoPreviewCopyright";A.href=this.getLinkHref();A.title=this.cfg.COPYRIGHT_TEXT_FAQ;A.appendChild(document.createTextNode(this.cfg.COPYRIGHT_TEXT_FAQ));this.addListener(A,"onclick",this.copyrightHelp);e.appendChild(A);var C=document.createElement("A");C.className="videoPreviewCopyright";C.href=this.getLinkHref();C.title=this.cfg.LABEL_DELETE;C.appendChild(document.createTextNode(this.cfg.LABEL_DELETE));this.addListener(C,"onclick",this.onDelete);e.appendChild(C);e.style.display="none";desc.appendChild(e);s.appendChild(desc);cd=document.createElement("DIV");L=cd;cd.className="videoPreviewActionControls";i=document.createElement("DIV");var x=document.createElement("A");Q=x;x.href=this.getLinkHref();if(isVideoUploadEnabled()){x.title=this.cfg.LABEL_EDIT;x.appendChild(document.createTextNode(this.cfg.LABEL_EDIT));this.addListener(x,"onclick",this.onEdit)}else{x.title=this.cfg.LABEL_DOWNLOAD;x.appendChild(document.createTextNode(this.cfg.LABEL_DOWNLOAD));this.addListener(x,"onclick",this.onDownload)}i.appendChild(x);var J=document.createElement("SPAN");w=J;w.appendChild(document.createTextNode(" | "));i.appendChild(w);var E=document.createElement("A");M=E;E.title=this.cfg.LABEL_DELETE;E.href=this.getLinkHref();E.appendChild(document.createTextNode(this.cfg.LABEL_DELETE));this.addListener(E,"onclick",this.onDelete);i.appendChild(E);i.appendChild(document.createElement("BR"));n=document.createElement("SPAN");i.appendChild(n);cd.appendChild(i);v=document.createElement("DIV");var G=document.createElement("A");N=G;G.title=this.cfg.LABEL_REMOVE;G.href=this.getLinkHref();G.appendChild(document.createTextNode(this.cfg.LABEL_REMOVE));v.appendChild(G);this.addListener(G,"onclick",this.onRemoveClick);cd.appendChild(v);s.appendChild(cd);u.appendChild(s);s=document.createElement("DIV");s.className="noPlayDuringAdMsg";s.style.visibility="visible";s.style.display="none";B=s;this.addListener(s,"onmouseout",this.hidePlayDuringAdMsg,false);this.addListener(s,"onclick",this.onPlayTriggered);s.appendChild(document.createTextNode(this.cfg.LABEL_PLAYDURINGAD));u.appendChild(s);u=document.createElement("div");u.className="videoPreviewParent";H.appendChild(u);r=document.createElement("A");r.style.position="relative";r.href=this.getLinkHref();m=document.createElement("IMG");m.className="smallThumb";m.width="112";m.height="84";o=document.createElement("span");o.className="videoPreviewThumbOver";r.appendChild(o);t=m;t.style.visibility="hidden";r.appendChild(m);u.appendChild(r);this.addListener(r,"onclick",this.onPlayTriggered);this.addListener(m,"onerror",this.onSmallThumbError,m);this.addListener(m,"onload",this.onSmallThumbLoad,m);this.addListener(r,"onmouseover",this.setCursorOnSmallThumb,true);this.addListener(r,"onmouseout",this.setCursorOnSmallThumb,false);u.appendChild(document.createElement("BR"));y=document.createElement("DIV");y.className="addToPlaylistModule";this.setCSSFloat(y,"right");d=new Msn.Controls.AddToPlaylist(f);d.setVideo(a);d.render(y);u.appendChild(y);_elTitleSpan=document.createElement("DIV");_elTitleSpan.style.width="110px";r=document.createElement("A");r.href=this.getLinkHref();m=document.createElement("SPAN");m.className="videoPreviewTitle";F=m;r.appendChild(m);_elTitleSpan.appendChild(r);u.appendChild(_elTitleSpan);this.addListener(r,"onclick",this.onPlayTriggered);d2=document.createElement("DIV");k=document.createElement("DIV");d2.appendChild(k);ratingDiv=document.createElement("DIV");q.render(ratingDiv);d2.appendChild(ratingDiv);g=document.createElement("DIV");d2.appendChild(g);u.appendChild(d2);c=H;c.style.display="none";z.appendChild(H);p=document.createElement("SPAN");z.appendChild(p)}b.dataBind()}}};Msn.Controls.VideoPreview.prototype=Msn.Controls;Msn.Controls.VideoService=function(h){var c=this,f=new Msn.Controls.VCAdapterHelper,b=h,g=Msn.Domain.VideoCatalog,e=[],a=null,d=null;this.getVideos=function(l,k,n){g=Msn.Domain.VideoCatalog;if(checkDefined(b)){if(checkFunction(l))l();var h=[];for(var c=0;c<b.length;c++){var m="Video|"+b[c].toLowerCase().replace(/-/g,""),i=Msn.Cache.get(m);if(checkDefined(i))e[i.Id.toLowerCase().replace(/-/g,"")]=i;else h.push(b[c])}a=k;d=n;if(h.length>0){var j="VideoByUuids.aspx?uuids={0}{1}{2}";j=j.format(joinArguments(h,","),f.getUsageParam(),f.getFilterParam());Msn.VCRequestManager.makeRequest(j,this.completeVCb)}else{a=k;this.buildReturnSet()}}};this.getVideosFromServiceUrl=function(e,g,b,h){if(checkString(e)&&checkFunction(b)){a=b;d=h;if(checkFunction(g))g();var i=setUrlValue(e,"rct",f.cfg.REQUESTED_VC_COUNTERS.join(","));Msn.VCRequestManager.makeRequest(i,c.completeNoCacheVCb)}};this.buildReturnSet=function(){var d=[];for(var c=0;c<b.length;c++)d.push(e[b[c].toLowerCase().replace(/-/g,"")]);if(checkFunction(a))a(d)};this.completeVCb=function(h){if(checkObject(h)){if(checkFunction(a)){var b=null,i=new Msn.Controls.AdapterFactory,f=i.create(g);if(checkDefined(f)&&checkFunction(f.convertVideoList)){b=f.convertVideoList(h);if(checkDefined(b)&&b.length>0){for(var d=0;d<b.length;d++)if(checkDefined(b[d])){e[b[d].Id.toLowerCase().replace(/-/g,"")]=b[d];var j="Video|"+b[d].Id.toLowerCase().replace(/-/g,"");Msn.Cache.insert(j,b[d])}c.buildReturnSet()}else c.errorVCb()}}}else c.errorVCb()};this.completeNoCacheVCb=function(e){if(checkObject(e)&&checkFunction(a)){var g=new Msn.Controls.VCAdapter,b=g.convertVideoList(e);if(checkDefined(b)&&b.length>0)for(var d=0;d<b.length;d++)if(checkDefined(b[d])){var f="Video|"+b[d].Id.toLowerCase().replace(/-/g,"");Msn.Cache.insert(f,b[d])}if(checkFunction(a))a(b)}else c.errorVCb()};this.errorVCb=function(){if(checkFunction(d))d()}};Msn.Controls.VideoServiceExtended=function(a){var c=this,g=new Msn.Controls.VCAdapterHelper,e=checkDefined(a)&&a.CsId==Msn.Controls.config.SoapboxCsId?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog,b=null,d=null,f=null;this.getExtendedMetadata=function(e,f,g){var h=false;if(checkFunction(e))e();b=f;d=g;Msn.SoapboxServiceManager.LoadUserVideoData(a.Id,c.completeEMCb,c.errorEMCb)};this.errorEMCb=function(){if(checkFunction(b))b({"Video":a})};this.completeEMCb=function(d){if(!checkObject(d)||!checkDefined(d.StatusCode)||d.StatusCode!=SoapboxService.ResultCode.Success)c.errorEMCb();else{if(checkObject(a)&&checkObject(d.UserVideo)){a.UserTags=d.UserVideo.UserTags;a.IsFavorite=d.UserVideo.IsFavorite;a.PopularTags=d.UserVideo.PopularTags;a.UserRating=d.UserVideo.UserRating;a.NoOfComments=d.UserVideo.NoOfComments}if(checkFunction(b))b({"Video":a})}};this.reportPlayback=function(){if(checkObject(a))switch(e){case Msn.Domain.Soapbox:Msn.SoapboxServiceManager.ReportPlayback(a.Id,false,c.reportCb);break;case Msn.Domain.VideoCatalog:break}};this.reportCb=function(){}};Msn.Controls.WidgetFramework=function(){var c=this,b=false,a=[];this.subscribeEvent(Msn.Event.WidgetFrameworkInitialized);this.onEvent=function(f,e){switch(e){case Msn.Event.WidgetFrameworkInitialized:b=true;while(a.length>0){var d=a.pop();c.addListener(d.eventType,d.funcCb)}break}};this.sendMessage=function(a,e,c,d){if(b)MsnVideo.sendMessage(a,e,c,d)};this.addListener=function(c,d){if(b)MsnVideo.addListener(c,d);else a.push({eventType:c,funcCb:d})}};Msn.Controls.WidgetFramework.prototype=Msn.Controls;Msn.WidgetFramework=new Msn.Controls.WidgetFramework;function MsnVideoInitialize(){Msn.Controls.fireEvent(Msn.Event.WidgetFrameworkInitialized)}Msn.Controls.WMPlayer=function(p,o,n){var b=this,m=p,k=o,l=true,c=n,a=null,j=false,h=false,e=false,d=false,g=-1,i=false,f=null,q=-1;if(!checkDefined(Msn.WMPlayer))Msn.WMPlayer=this;this.subscribeEvent(Msn.Event.ApplicationTick);this.onEvent=function(){if(j){var d=a.controls.currentPosition;if(checkInt(d)&&d!=g)c.getObjectNode().WMP_onPlayheadUpdate(d);if(d==g&&a.currentMedia.duration>0&&a.currentMedia.duration-d<0.1)b.onMediaEnded();g=d}};this.load=function(c){if(checkObject(c)){b.log("mediaPlayer","[WMPlayer] loading video: "+c.Id+", "+c.Url);clearTimeout(f);j=true;h=true;e=false;d=false;i=false;g=-1;a.URL=c.Url}};this.close=function(){b.log("mediaPlayer","[WMPlayer] closing");clearTimeout(f);c.getObjectNode().WMP_onBuffering(false);j=false;h=false;a.close();a.URL=""};this.pause=function(){e=false;if(a.playState!=3)d=true;else{d=false;a.controls.pause()}};this.play=function(){d=false;if(a.playState!=2&&a.playState!=10&&a.playState!=3)e=true;else{e=false;a.controls.play()}};this.setVolume=function(b){a.settings.volume=b};this.getTotalTime=function(){var b=checkObject(a.currentMedia)?a.currentMedia.duration:0;return checkInt(b)?b:0};this.getPlayheadTime=function(){var b=a.controls.currentPosition;return checkInt(b)?b:0};this.seek=function(b){a.controls.currentPosition=b};this.setSize=function(d,c,b){m=d;k=c;l=b;a.stretchToFit=l;a.width=m;a.height=k};this.setPause=function(){var d=a.controls.isAvailable("pause");c.getObjectNode().WMP_setPause(d);if(!d){clearTimeout(f);f=setTimeout(function(){b.setPause()},1000)}b.log("mediaPlayer","[WMPlayer] setting pause state: "+d)};this._render=function(b){if(null!=b){a=document.createElement("OBJECT");a.id="wmpPlayer";a.name="wmpPlayer";a.classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";a.width=m;a.height=k;a.enableContextMenu=false;a.stretchToFit=l;a.uiMode="none";a.windowlessVideo=true;a.settings.autoStart=false;a.settings.invokeURLs=false;a.network.bufferingTime=5000;b.appendChild(a);this.addListener(a,"playstatechange",this.onPlayStateChange);this.addListener(a,"openstatechange",this.onOpenStateChange);this.addListener(a,"buffering",this.onBuffering);this.addListener(a,"error",this.onError);this.addListener2(a,"scriptcommand",this.onScriptCommand)}};this.onPlayStateChange=function(j){var f;switch(j){case 0:f="Undefined";break;case 1:f="Stopped";setTimeout(function(){if(!i){a.controls.play();a.controls.currentPosition=g;if(lastState==2)d=true}},10);break;case 2:f="Paused";setTimeout(function(){if(e)b.play()},10);break;case 3:f="Playing";b.setPause();setTimeout(function(){if(d)b.pause()},10);break;case 4:f="ScanForward";break;case 5:f="ScanReverse";break;case 6:f="Buffering";break;case 7:f="Waiting";break;case 8:f="MediaEnded";b.onMediaEnded();break;case 9:f="Transitioning";break;case 10:f="Ready";setTimeout(function(){if(h){c.getObjectNode().WMP_onLoadComplete();h=false}if(e)b.play()},10);break;case 11:f="Reconnecting";break}b.log("mediaPlayer","[WMPlayer] changed state to: "+f);lastState=f};this.onMediaEnded=function(){clearTimeout(f);setTimeout(function(){if(!i){i=true;c.getObjectNode().WMP_onComplete()}},10)};this.onOpenStateChange=function(d){var b;switch(d){case 13:b="MediaOpen";c.getObjectNode().WMP_onMetadata(a.currentMedia.duration);break}};this.onBuffering=function(a){c.getObjectNode().WMP_onBuffering(a)};this.onError=function(){var d="";try{d+=a.error.errorCount+":";for(var e=0;e<a.error.errorCount;e++)d+=a.error.item(e).errorDescription+"|";a.error.clearErrorQueue()}catch(g){}b.log("mediaPlayer","[WMPlayer] error: "+d);c.getObjectNode().WMP_onBuffering(false);b.close();c.getObjectNode().WMP_onLoadError(d)};this.onScriptCommand=function(d,a){if(d=="LC_SPOTBREAK"&&checkGuid(a)){c.getObjectNode().vidRequestAd();b.fireEvent(Msn.Event.MediaPlayByVideoId,a)}}};Msn.Controls.WMPlayer.prototype=Msn.Controls;function WMP_setSize(c,a,b){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.setSize(c,a,b)}function WMP_load(b,a){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.load({Id:b,Url:a})}function WMP_play(){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.play()}function WMP_pause(){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.pause()}function WMP_seek(a){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.seek(a)}function WMP_close(){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.close()}function WMP_setVolume(a){if(checkDefined(Msn.WMPlayer))Msn.WMPlayer.setVolume(a)}function WMP_getPlayheadTime(){if(checkDefined(Msn.WMPlayer))return Msn.WMPlayer.getPlayheadTime();else return null}function WMP_getTotalTime(){if(checkDefined(Msn.WMPlayer))return Msn.WMPlayer.getTotalTime();else return null}Msn.Spinner=SoapboxService.Utils.CreateEnum("MainPanel",0,"VideoPanel",1);Msn.Controls.WorkInProgress=function(e){var f=this,d=getCDNPath("/i/spinWhite.gif"),a=null,c=false,b=0;this.cfg={WORKING:$["IDS_CLI_Working"]};if(checkInt(e))switch(e){case Msn.Spinner.MainPanel:d=getCDNPath("/i/spinGray.gif");break;case Msn.Spinner.VideoPanel:default:d=getCDNPath("/i/spinBlack.gif");break}this.inProgress=function(){return c};this.showWIP=function(){if(checkDefined(a))a.style.visibility="visible";c=true;b++};this.hideWIP=function(){if(b>=0)b--;else b=0;if(b<=0){if(checkDefined(a))a.style.visibility="hidden";c=false}};this._render=function(b){if(null!=b){a=document.createElement("IMG");a.style.verticalAlign="middle";a.border="0";a.src=d;a.width="16";a.height="16";a.alt=this.cfg.WORKING;a.style.visibility=c?"visible":"hidden";b.appendChild(a)}}};Msn.Controls.WorkInProgress.prototype=Msn.Controls;Msn.Controls.YourPage=function(b){var a=this;this.cfg={TAGS_DISPLAYED_COUNT:10,NICKNAME_LENGTH:20,HEADER_VIDEOS:$["IDS_CLI_HeaderVideos"],HEADER_VIDEOS_PRIVATE:$["IDS_CLI_HeaderVideosPrivate"],HEADER_TAG:$["IDS_CLI_HeaderTag"],HEADER_TAGS:$["IDS_CLI_HeaderTags"],HEADER_TAGS_PRIVATE:$["IDS_CLI_HeaderTagsPrivate"],HEADER_FAVS:$["IDS_CLI_HeaderFavs"],ANONYMOUS:$["IDS_CLI_Anonymous"],HEADER_FAVS_PRIVATE:$["IDS_CLI_HeaderFavsPrivate"],HEADER_COMS:$["IDS_CLI_HeaderComs"],HEADER_COMS_PRIVATE:$["IDS_CLI_HeaderComsPrivate"],NOT_TAGGED_ANY_VIDEOS:$["IDS_CLI_NotTaggedAnyVideos"],NO_TAGS_FOR_NICKNAME:$["IDS_CLI_NoTagsForNickname"],SHARED_VIDEOS_PRIVATE:$["IDS_CLI_HeaderSharedVideos"]};this.subscribeEvent(Msn.Event.TagsUpdatedData);this.subscribeEvent(Msn.Event.CommentsUpdatedData);this.subscribeEvent(Msn.Event.VideoSharedUpdatedData);this.subscribeEvent(Msn.Event.ViewProfile);this.onEvent=function(d,c,a){switch(c){case Msn.Event.TagsUpdatedData:if(b&&checkDefined(a))this.getTagsCb(a);break;case Msn.Event.CommentsUpdatedData:if(b&&checkDefined(a))g.setData(a);break;case Msn.Event.VideoSharedUpdatedData:if(b)q();break;case Msn.Event.ViewProfile:if(a.forceRefresh&&!b){n.refresh();l.refresh()}break}};var d="",c,m=new Msn.Controls.ProfileModule(b);r();var f=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_VIDEOS_PRIVATE:a.cfg.HEADER_VIDEOS,false),n=new Msn.Controls.SearchResultPanel(4,1,false,false,true);n.setContainerProperty(f,b?a.cfg.HEADER_VIDEOS_PRIVATE:a.cfg.HEADER_VIDEOS);f.setContent(n);this.onCloudEntryClick=function(d,b){if(Msn.CloudEntryType.Tags==d&&checkDefined(b)){var c=Msn.Controls.SearchQueryFactory.create(b,SoapboxService.SearchType.Tag,0,SoapboxService.SortOrder.Default,isSoapboxEnabled()?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog);a.fireEvent(Msn.Event.Search,c)}};if(b){var j=new Msn.Controls.Container(true,true,a.cfg.SHARED_VIDEOS_PRIVATE,false),p=new Msn.Controls.SearchResultPanel(4,1,false,false,true);p.setContainerProperty(j,a.cfg.SHARED_VIDEOS_PRIVATE);j.setContent(p)}var h=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_TAGS_PRIVATE:a.cfg.HEADER_TAGS,false),k=new Msn.Controls.Cloud;k.setOnEntryClick(this.onCloudEntryClick);k.setMaxEntries(this.cfg.TAGS_DISPLAYED_COUNT);h.setContent(k);h.showViewAll(true);h.setOnViewAllClick(z);var e=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_FAVS_PRIVATE:a.cfg.HEADER_FAVS,false),l=new Msn.Controls.SearchResultPanel(4,1,false,false,true);l.setContainerProperty(e,b?a.cfg.HEADER_FAVS_PRIVATE:a.cfg.HEADER_FAVS);e.setContent(l);var o=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_COMS_PRIVATE:a.cfg.HEADER_COMS,false),g=new Msn.Controls.CommentsContainer(2);w();this.getTotalComments=function(a){var b=0;if(checkDefined(a.Videos))if(checkDefined(a.Videos.get_length))for(i=0;i<a.Videos.get_length();i++)if(checkDefined(a.Videos[i]))b+=a.Videos[i].NumComments;return b};this.setCid=function(a){if(checkDefined(a)&&c!=a){c=a;if(0!=c){this.refreshTags();m.setCid(c);r();t();if(isSoapboxEnabled()){g.setCid(c);x();if(b)q()}}}};this.refreshTags=function(){if(checkDefined(c)&&0!=c)Msn.SoapboxServiceManager.LoadUserTags(c,0,0,false,this.getTagsCb,this.getTagsErrorCb)};this.setNickname=function(a){a=checkString(a)?a:this.cfg.ANONYMOUS;m.setNickname(a);g.setNickname(a);d=a};function y(){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"videoall"});var b=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.User,0,SoapboxService.SortOrder.Default,d);a.fireEvent(Msn.Event.Search,b)}function s(){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"sharedall"});var b=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.Shared,0,SoapboxService.SortOrder.Default,d);a.fireEvent(Msn.Event.Search,b)}function u(){Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"favall"});var b=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.Favorites,0,SoapboxService.SortOrder.Default,d);a.fireEvent(Msn.Event.Search,b)}function r(){m.showEditLink(b)}function x(){var b=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.User,0,SoapboxService.SortOrder.Default,d);b.header=a.cfg.HEADER_VIDEOS;n.setSearchQuery(b);f.showViewAll(true);f.setRssUrl(b.rssUrl,b.zuneUrl);f.showRss(true);f.setOnViewAllClick(y)}function q(){var b=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.Shared,0,SoapboxService.SortOrder.Default,d);b.header=a.cfg.SHARED_VIDEOS_PRIVATE;p.setSearchQuery(b);j.showViewAll(true);j.setOnViewAllClick(s)}function t(){var f=Msn.Controls.SearchQueryFactory.create(c,SoapboxService.SearchType.Favorites,0,SoapboxService.SortOrder.Default,d);if(!b)f.header=a.cfg.HEADER_FAVS;l.setSearchQuery(f);e.showViewAll(true);e.setRssUrl(f.rssUrl,f.zuneUrl);e.showRss(true);e.setOnViewAllClick(u)}function z(){var b={cid:c,nickname:d};Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"tagall"});a.fireEvent(Msn.Event.ViewAllProfileTags,b)}this.getTagsCb=function(c){if(checkDefined(c)){var g=b?a.cfg.HEADER_TAGS_PRIVATE:a.cfg.HEADER_TAGS,f=[];if(checkDefined(c.UserTags)&&checkInt(c.UserTags.length,0)){var l=c.UserTags.length>1?a.cfg.HEADER_TAGS:a.cfg.HEADER_TAG,j=" ({0} {1})";g+=j.format(c.UserTags.length,l);for(var e=0;e<c.UserTags.length;e++){var i={"Type":Msn.CloudEntryType.Tags,"Name":c.UserTags[e].Name,"Data":null};f.push(i)}}h.setTitle(g);k.setEntries(f,b?a.cfg.NOT_TAGGED_ANY_VIDEOS:a.cfg.NO_TAGS_FOR_NICKNAME.format(d))}};this.getTagsErrorCb=function(){h.setTitle(b?a.cfg.HEADER_TAGS_PRIVATE:a.cfg.HEADER_TAGS);k.setEntries(null)};function v(){var b={cid:c,nickname:d};Msn.Controls.fireEvent(Msn.Event.TrackPageView,{page:"mypages",section:"commentsall"});a.fireEvent(Msn.Event.ViewAllProfileComments,b)}function w(){g.showPagination(false);g.setNickname(d);o.setContent(g);o.showViewAll(true);o.setOnViewAllClick(v)}this._render=function(a){if(null!=a){m.render(a);if(isSoapboxEnabled()){a.appendChild(document.createElement("BR"));f.render(a);if(b){a.appendChild(document.createElement("BR"));j.render(a)}}a.appendChild(document.createElement("BR"));h.render(a);a.appendChild(document.createElement("BR"));e.render(a);if(isSoapboxEnabled()){a.appendChild(document.createElement("BR"));o.render(a)}}}};Msn.Controls.YourPage.prototype=Msn.Controls;Msn.Controls.YourTags=function(){var f=this;this.cfg={ANONYMOUS:$["IDS_CLI_Anonymous"],CLICK_TAG_FOR_RELATED_VIDEO:$["IDS_CLI_ClickTagForRelatedVideo"],NOT_TAGGED_ANY_VIDEOS:$["IDS_CLI_NotTaggedAnyVideos"],DATA_NOT_AVAILABLE:$["IDS_CLI_DataNotAvailable"],LOADING:$["IDS_CLI_Loading"],NO_TAGS_FOR_NICKNAME:$["IDS_CLI_NoTagsForNickname"]};var b,a,e=false,c=null,g=new Msn.Controls.LiteralHTML("");this.setOnComplete=function(a){c=a};this.setCid=function(a){if(checkInt(a)&&b!=a){b=a;this.refresh()}};this.setNickname=function(a){a=checkString(a)?a:this.cfg.ANONYMOUS;this._nickname=a;g.setHTML(this._nickname)};this.setError=function(){e=true;this.render()};this.refresh=function(){if(checkDefined(b)&&b!=0){e=false;Msn.SoapboxServiceManager.LoadUserTags(b,0,0,true,this.getTagsCb,this.getTagsErrorCb)}};this.getTagsCb=function(b){if(checkDefined(b)){a=b.UserTags.clone();if(a.length>0)a=a.sort(f.alphaCompare);f.render();if(checkFunction(c))c(b)}};this.alphaCompare=function(a,b){if(a.Name.toLowerCase()>b.Name.toLowerCase())return 1;else if(a.Name.toLowerCase()<b.Name.toLowerCase())return -1;return 0};this.getTagsErrorCb=function(){f.setError()};this.onTagClicked=function(c,a){if(checkDefined(a)){var b=Msn.Controls.SearchQueryFactory.create(a,SoapboxService.SearchType.Tag,0,SoapboxService.SortOrder.Default,isSoapboxEnabled()?Msn.Domain.Soapbox:Msn.Domain.VideoCatalog);this.fireEvent(Msn.Event.Search,b)}return false};this._render=function(k){if(null!=k){d=document.createElement("DIV");d.className="containerContentSpacing";if(null!=a){var j=a.length;if(0!=j){d.style.backgroundColor="#e7e7e7";d.appendChild(document.createTextNode(this.cfg.CLICK_TAG_FOR_RELATED_VIDEO));d.appendChild(document.createElement("BR"));for(var f=0;f<j;f++){var h=document.createElement("DIV");h.className="yourTag";var c=document.createElement("A");c.href=this.getLinkHref();var i=a[f].Name;c.appendChild(document.createTextNode(i));this.addListener(c,"onclick",this.onTagClicked,i);h.appendChild(c);d.appendChild(h)}}else{d.style.backgroundColor="#ffffff";if(b==Msn.Passport.getCid()&&Msn.Passport.isUserLoggedIn())d.appendChild(document.createTextNode(this.cfg.NOT_TAGGED_ANY_VIDEOS));else if(checkString(_nickname)){d.appendChild(document.createTextNode(this.cfg.NO_TAGS_FOR_NICKNAME));g.render(d)}}}else d.appendChild(document.createTextNode(e?this.cfg.DATA_NOT_AVAILABLE:this.cfg.LOADING));k.appendChild(d)}}};Msn.Controls.YourTags.prototype=Msn.Controls;Msn.YourWarhol=SoapboxService.Utils.CreateEnum("HomePage",0,"TagPage",1,"CommentPage",2);Msn.Controls.YourWarhol=function(b){var a=this;this.subscribeEvent(Msn.Event.Navigate);this.subscribeEvent(Msn.Event.TagsUpdatedData);this.subscribeEvent(Msn.Event.CommentsUpdatedData);this.subscribeEvent(Msn.Event.ViewProfile);this.subscribeEvent(Msn.Event.ViewAllProfileTags);this.subscribeEvent(Msn.Event.ViewAllProfileComments);this.onEvent=function(i,e,a){var c=null;switch(e){case Msn.Event.TagsUpdatedData:if(b&&checkDefined(a))h.getTagsCb(a);break;case Msn.Event.CommentsUpdatedData:if(b&&checkDefined(a))g.setData(a);break;case Msn.Event.ViewProfile:c=Msn.Menu.MySoapbox;break;case Msn.Event.ViewAllProfileTags:c=Msn.Menu.Tags;break;case Msn.Event.ViewAllProfileComments:c=Msn.Menu.Comments;break}if(checkInt(c)&&(b&&Msn.Passport.getCid()==a.cid||!b&&Msn.Passport.getCid()!=a.cid)){var d=checkInt(a.page)?parseInt(a.page):0;this.setCid(a.cid);this.setNickname(a.nickname);this.selectTab(c,d);this.fireEvent(Msn.Event.MenuSelect,{menuId:b?c:null});var f={title:this.getHistoryTitle(e,a.nickname,d),action:"profile",cid:a.cid,nickname:a.nickname,evt:e,page:d};this.fireEvent(Msn.Event.HistoryAdd,f)}};this.getHistoryTitle=function(d,c){var a="";if(checkInt(d))switch(parseInt(d)){case Msn.Event.ViewProfile:a=b?this.cfg.MYSOAPBOX:this.cfg.NICKNAME_PAGE.format(c);break;case Msn.Event.ViewAllProfileTags:a=b?this.cfg.MYSOAPBOX+this.cfg.SEPERATOR+this.cfg.HEADER_TAGS:this.cfg.NICKNAME_PAGE.format(c)+this.cfg.SEPERATOR+this.cfg.HEADER_TAGS;break;case Msn.Event.ViewAllProfileComments:a=b?this.cfg.MYSOAPBOX+this.cfg.SEPERATOR+this.cfg.COMMENTS_ON_MY_VIDEOS:this.cfg.NICKNAME_PAGE.format(c)+this.cfg.SEPERATOR+this.cfg.COMMENTS_ON_VIDEOS;break}return a};this.cfg={NICKNAME_LENGTH:20,SEPERATOR:" > ",PROFILE_NOT_AVAILABLE:$["IDS_CLI_NoProfile"],HEADER_VIDEOS:$["IDS_CLI_HeaderVideos"],HEADER_VIDEOS_PRIVATE:$["IDS_CLI_HeaderVideosPrivate"],HEADER_TAG:$["IDS_CLI_HeaderTag"],HEADER_TAGS:$["IDS_CLI_HeaderTags"],COMMENTS:$["IDS_CLI_Comments"].toLowerCase(),NICKNAME_HEADER_TAGS:$["IDS_CLI_NicknameHeaderTags"],HEADER_TAGS_PRIVATE:$["IDS_CLI_HeaderTagsPrivate"],HEADER_FAVS:$["IDS_CLI_HeaderFavs"],HEADER_FAVS_PRIVATE:$["IDS_CLI_HeaderFavsPrivate"],HEADER_COMS:$["IDS_CLI_HeaderComs"],NICKNAME_HEADER_COMS:$["IDS_CLI_NicknameHeaderComs"],HEADER_COMS_PRIVATE:$["IDS_CLI_HeaderComsPrivate"],MYSOAPBOX:$["IDS_CLI_Mysoapbox"],COMMENTS_ON_MY_VIDEOS:$["IDS_CLI_CommentsOnMyVideos"],NICKNAME_PAGE:$["IDS_CLI_NicknamePage"],COMMENTS_ON_VIDEOS:$["IDS_CLI_CommentsOnVideos"],ANONYMOUS:$["IDS_CLI_Anonymous"],SIGN_IN_UPLOAD:$["IDS_CLI_SignInUpload"]};var c="",e="",d,k,j=false,m,l=false,r="",q=b?new Msn.Controls.Link(this.cfg.SIGN_IN_UPLOAD,Msn.Passport.login,"needSignin",true):new Msn.Controls.Label(this.cfg.PROFILE_NOT_AVAILABLE),f=new Msn.Controls.FilterTab(null,null,""),p=new Msn.Controls.YourPage(b),n=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_TAGS_PRIVATE:a.cfg.HEADER_TAGS,false),h=new Msn.Controls.YourTags;n.setContent(h);var o=new Msn.Controls.Container(true,true,b?a.cfg.HEADER_COMS_PRIVATE:a.cfg.HEADER_COMS,false),g=new Msn.Controls.CommentsContainer(10);g.showPagination(true);o.setContent(g);f.add(Msn.YourWarhol.HomePage,p);f.add(Msn.YourWarhol.TagPage,n);f.add(Msn.YourWarhol.CommentPage,o);this.onTagsComplete=function(d){var e=b?a.cfg.HEADER_TAGS_PRIVATE:a.cfg.NICKNAME_HEADER_TAGS.format(c);if(checkDefined(d)&&checkInt(d.UserTags.length,0)){var g=d.UserTags.length>1?a.cfg.HEADER_TAGS:a.cfg.HEADER_TAG,f=" ({0} {1})";e+=f.format(d.UserTags.length,g)}n.setTitle(e)};h.setOnComplete(this.onTagsComplete);this.getTotalComments=function(a){var b=0;if(checkDefined(a.Videos))if(checkDefined(a.Videos.get_length))for(i=0;i<a.Videos.get_length();i++)if(checkDefined(a.Videos[i]))b+=a.Videos[i].NumComments;return b};this.setCid=function(b){if(checkDefined(b)&&b!=d){d=b;if(Msn.Passport.isUserLoggedIn()&&Msn.Passport.getCid()==d){j=false;l=true}else if(!checkDefined(d)||0==d){j=true;l=false}else{j=false;l=true}a.bindSpans()}};this.showSpan=function(a,b){if(checkDefined(a))if(b){a.style.display="inline";a.style.visibility="visible"}else{a.style.display="none";a.style.visibility="hidden"}};this.bindSpans=function(){a.showSpan(k,j);a.showSpan(m,l)};this.setNickname=function(a){c=checkString(a)?a:this.cfg.ANONYMOUS;if(!b)o.setTitle(this.cfg.NICKNAME_HEADER_COMS.format(c))};this._render=function(a){if(null!=a){k=document.createElement("SPAN");q.render(k);a.appendChild(k);m=document.createElement("SPAN");f.render(m);a.appendChild(m);this.bindSpans()}};this.selectTab=function(l){var k=true,i,j;if(b)i=a.cfg.MYSOAPBOX;else{i=a.cfg.NICKNAME_PAGE.format(ll(c,a.cfg.NICKNAME_LENGTH));j=a.cfg.NICKNAME_PAGE.format(c)}switch(l){case Msn.Menu.MySoapbox:e=i;e.title=j;p.setNickname(c);p.setCid(d);f.select(Msn.YourWarhol.HomePage);break;case Msn.Menu.Tags:e=i+" > "+a.cfg.HEADER_TAGS;e.title=j+" > "+a.cfg.HEADER_TAGS;h.setNickname(c);h.setCid(d);f.select(Msn.YourWarhol.TagPage);break;case Msn.Menu.Comments:e=i+" > "+a.cfg.COMMENTS;e.title=j+" > "+a.cfg.COMMENTS;g.setNickname(c);g.setCid(d);f.select(Msn.YourWarhol.CommentPage);break;default:k=false;break}if(k)a.fireEvent(Msn.Event.UpdateHeader,e)}};Msn.Controls.YourWarhol.prototype=Msn.Controls;if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(e){var a=false,j=null;try{var i=null;try{i=new ActiveXObject("AgControl.AgControl");if(e==null)a=true;else if(i.IsVersionSupported(e))a=true;i=null}catch(l){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(e===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var b=h.split(".");while(b.length>3)b.pop();while(b.length<4)b.push(0);var d=e.split(".");while(d.length>4)d.pop();var c,g,f=0;do{c=parseInt(d[f]);g=parseInt(b[f]);f++}while(f<d.length&&c===g);if(c<=g&&!isNaN(c))a=true}}}catch(l){a=false}if(j)document.body.removeChild(j);return a};Silverlight.WaitForInstallCompletion=function(){if(!Silverlight.isBrowserRestartRequired&&Silverlight.onSilverlightInstalled){try{navigator.plugins.refresh()}catch(a){}if(Silverlight.isInstalled(null))Silverlight.onSilverlightInstalled();else setTimeout(Silverlight.WaitForInstallCompletion,5000)}};Silverlight.__startup=function(){Silverlight.isBrowserRestartRequired=Silverlight.isInstalled(null);if(!Silverlight.isBrowserRestartRequired)setTimeout(function(){Silverlight.WaitForInstallCompletion()},5000);if(window.removeEventListener)window.removeEventListener("load",Silverlight.__startup,false);else window.detachEvent("onload",Silverlight.__startup)};if(window.addEventListener)window.addEventListener("load",Silverlight.__startup,false);else window.attachEvent("onload",Silverlight.__startup);Silverlight.createObject=function(m,f,e,k,l,h,j){var d=new Object,a=k,c=l;d.version=a.version;a.source=m;d.alt=a.alt;if(h)a.initParams=h;if(a.isWindowless&&!a.windowless)a.windowless=a.isWindowless;if(a.framerate&&!a.maxFramerate)a.maxFramerate=a.framerate;if(e&&!a.id)a.id=e;delete a.ignoreBrowserVer;delete a.inplaceInstallPrompt;delete a.version;delete a.isWindowless;delete a.framerate;delete a.data;delete a.src;delete a.alt;if(Silverlight.isInstalled(d.version)){for(var b in c)if(c[b]){if(b=="onLoad"&&typeof c[b]=="function"&&c[b].length!=1){var i=c[b];c[b]=function(a){return i(document.getElementById(e),j,a)}}var g=Silverlight.__getHandlerName(c[b]);if(g!=null){a[b]=g;c[b]=null}else throw"typeof events."+b+" must be 'function' or 'string'"}slPluginHTML=Silverlight.buildHTML(a)}else slPluginHTML=Silverlight.buildPromptHTML(d);if(f)f.innerHTML=slPluginHTML;else return slPluginHTML};Silverlight.buildHTML=function(a){var b=[];b.push('<object type="application/x-silverlight" data="data:application/x-silverlight,"');if(a.id!=null)b.push(' id="'+a.id+'"');if(a.width!=null)b.push(' width="'+a.width+'"');if(a.height!=null)b.push(' height="'+a.height+'"');b.push(" >");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('<param name="'+Silverlight.HtmlAttributeEncode(c)+'" value="'+Silverlight.HtmlAttributeEncode(a[c])+'" />');b.push("</object>");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("114576"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);if(a>96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message     \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+"       \n";a+="Message: "+b.ErrorMessage+"     \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+"     \n";a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}a+="MethodName: "+b.methodName+"     \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a}