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.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.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.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.CloudEntryType=SoapboxService.Utils.CreateEnum("None",0,"Tags",1,"Categories",2,"Taxonomy",3,"Search",4);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.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.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.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.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.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.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.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.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.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.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;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.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.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.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.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;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;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.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.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.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.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;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}