var AppBeaconEnum={ec_gallery:3,ec_canvas:4,ec_userhome:5,ec_profile:6,ec_appsetting:8,ec_addpopup:10,ec_blockpopup:11,ec_unblockpopup:12,ec_uninstallpopup:13,ec_reportabuse:22,ec_updateapppermissionspopup:24,em_appprofile:200,em_devprofile:201,em_gallery:202,em_canvas:203,em_report:204,em_appsettings:205,em_close:206,em_addapp:207,em_blockapp:208,em_unblockapp:209,em_removeapp:210,em_sortfilter:212,em_culturefilter:213,em_categoryfilter:214,em_paging:215,em_search:216,em_settingspopupclick:217,em_sendmessage:227,em_updateclick:233};var currentAppId="";Type.registerNamespace("MySpace.Web.Services.Apps");MySpace.Web.Services.Apps.Apps=function(){MySpace.Web.Services.Apps.Apps.initializeBase(this);this._timeout=0;this._userContext=null;this._succeeded=null;this._failed=null};MySpace.Web.Services.Apps.Apps.prototype={MoveAppUp:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"MoveAppUp",false,{token:C,surfaceId:A},D,B,E)},MoveAppDown:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"MoveAppDown",false,{token:C,surfaceId:A},D,B,E)},SetBookmarksDisplayOrder:function(A,C,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"SetBookmarksDisplayOrder",false,{bookmarkOrder:A,userId:C},D,B,E)},UninstallApplication:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"UninstallApplication",false,{token:B},C,A,D)},UninstallApplicationEx:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"UninstallApplicationEx",false,{token:C,callbackParams:A},D,B,E)},IsAppInstallable:function(C,E,B,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"IsAppInstallable",false,{appId:C,viewerId:E},B,A,D)},GetAddAppFooterText:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"GetAddAppFooterText",false,{appid:B},C,A,D)},InstallApplication:function(B,C,D,A,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"InstallApplication",false,{token:B,permissions:C},D,A,E)},InstallApplicationEx:function(C,D,A,E,B,F){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"InstallApplicationEx",false,{token:C,permissions:D,callbackParams:A},E,B,F)},RevokeApplicationToken:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"RevokeApplicationToken",false,{token:B},C,A,D)},RevokeApplicationTokenEx:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"RevokeApplicationTokenEx",false,{token:C,callbackParams:A},D,B,E)},UpdateApplicationSettings:function(C,E,A,D,B,F){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"UpdateApplicationSettings",false,{appid:C,setpermissions:E,unsetpermissions:A},D,B,F)},UpdateGlobalAppEmailSettings:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"UpdateGlobalAppEmailSettings",false,{appid:C,enable:A},D,B,E)},GetApplicationPermissionsString:function(C,A,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"GetApplicationPermissionsString",false,{appid:C,unsetpermissions:A},D,B,E)},BlockApplication:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockApplication",false,{token:B},C,A,D)},UnblockApplication:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"UnblockApplication",false,{token:B},C,A,D)},BlockApplicationFromNotifications:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockApplicationFromNotifications",false,{token:B},C,A,D)},BlockApplicationFromActivities:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockApplicationFromActivities",false,{token:B},C,A,D)},BlockApplicationFromInvites:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockApplicationFromInvites",false,{token:B},C,A,D)},BlockNotifications:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockNotifications",false,{token:B},C,A,D)},BlockActivities:function(B,C,A,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockActivities",false,{token:B},C,A,D)},SetUserPreferences:function(E,B,A,D,C,F){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"SetUserPreferences",false,{appId:E,userPreferenceKeys:B,userPreferenceValues:A},D,C,F)}};MySpace.Web.Services.Apps.Apps.registerClass("MySpace.Web.Services.Apps.Apps",Sys.Net.WebServiceProxy);MySpace.Web.Services.Apps.Apps._staticInstance=new MySpace.Web.Services.Apps.Apps();MySpace.Web.Services.Apps.Apps.set_path=function(A){MySpace.Web.Services.Apps.Apps._staticInstance._path=A};MySpace.Web.Services.Apps.Apps.get_path=function(){return MySpace.Web.Services.Apps.Apps._staticInstance._path};MySpace.Web.Services.Apps.Apps.set_timeout=function(A){if(A<0){throw Error.argumentOutOfRange("value",A,Sys.Res.invalidTimeout)}MySpace.Web.Services.Apps.Apps._staticInstance._timeout=A};MySpace.Web.Services.Apps.Apps.get_timeout=function(){return MySpace.Web.Services.Apps.Apps._staticInstance._timeout};MySpace.Web.Services.Apps.Apps.set_defaultUserContext=function(A){MySpace.Web.Services.Apps.Apps._staticInstance._userContext=A};MySpace.Web.Services.Apps.Apps.get_defaultUserContext=function(){return MySpace.Web.Services.Apps.Apps._staticInstance._userContext};MySpace.Web.Services.Apps.Apps.set_defaultSucceededCallback=function(A){MySpace.Web.Services.Apps.Apps._staticInstance._succeeded=A};MySpace.Web.Services.Apps.Apps.get_defaultSucceededCallback=function(){return MySpace.Web.Services.Apps.Apps._staticInstance._succeeded};MySpace.Web.Services.Apps.Apps.set_defaultFailedCallback=function(A){MySpace.Web.Services.Apps.Apps._staticInstance._failed=A};MySpace.Web.Services.Apps.Apps.get_defaultFailedCallback=function(){return MySpace.Web.Services.Apps.Apps._staticInstance._failed};MySpace.Web.Services.Apps.Apps.set_path("/Services/Apps/Apps.asmx");MySpace.Web.Services.Apps.Apps.MoveAppUp=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.MoveAppUp(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.MoveAppDown=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.MoveAppDown(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.SetBookmarksDisplayOrder=function(A,C,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.SetBookmarksDisplayOrder(A,C,D,B,E)};MySpace.Web.Services.Apps.Apps.UninstallApplication=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.UninstallApplication(B,C,A,D)};MySpace.Web.Services.Apps.Apps.UninstallApplicationEx=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.UninstallApplicationEx(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.IsAppInstallable=function(B,E,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.IsAppInstallable(B,E,C,A,D)};MySpace.Web.Services.Apps.Apps.GetAddAppFooterText=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.GetAddAppFooterText(B,C,A,D)};MySpace.Web.Services.Apps.Apps.InstallApplication=function(B,C,D,A,E){MySpace.Web.Services.Apps.Apps._staticInstance.InstallApplication(B,C,D,A,E)};MySpace.Web.Services.Apps.Apps.InstallApplicationEx=function(C,D,A,E,B,F){MySpace.Web.Services.Apps.Apps._staticInstance.InstallApplicationEx(C,D,A,E,B,F)};MySpace.Web.Services.Apps.Apps.RevokeApplicationToken=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.RevokeApplicationToken(B,C,A,D)};MySpace.Web.Services.Apps.Apps.RevokeApplicationTokenEx=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.RevokeApplicationTokenEx(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.UpdateApplicationSettings=function(C,D,A,E,B,F){MySpace.Web.Services.Apps.Apps._staticInstance.UpdateApplicationSettings(C,D,A,E,B,F)};MySpace.Web.Services.Apps.Apps.UpdateGlobalAppEmailSettings=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.UpdateGlobalAppEmailSettings(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.GetApplicationPermissionsString=function(C,A,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.GetApplicationPermissionsString(C,A,D,B,E)};MySpace.Web.Services.Apps.Apps.BlockApplication=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockApplication(B,C,A,D)};MySpace.Web.Services.Apps.Apps.UnblockApplication=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.UnblockApplication(B,C,A,D)};MySpace.Web.Services.Apps.Apps.BlockApplicationFromNotifications=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockApplicationFromNotifications(B,C,A,D)};MySpace.Web.Services.Apps.Apps.BlockApplicationFromActivities=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockApplicationFromActivities(B,C,A,D)};MySpace.Web.Services.Apps.Apps.BlockApplicationFromInvites=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockApplicationFromInvites(B,C,A,D)};MySpace.Web.Services.Apps.Apps.BlockNotifications=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockNotifications(B,C,A,D)};MySpace.Web.Services.Apps.Apps.BlockActivities=function(B,C,A,D){MySpace.Web.Services.Apps.Apps._staticInstance.BlockActivities(B,C,A,D)};MySpace.Web.Services.Apps.Apps.SetUserPreferences=function(D,B,A,E,C,F){MySpace.Web.Services.Apps.Apps._staticInstance.SetUserPreferences(D,B,A,E,C,F)};var gtc=Sys.Net.WebServiceProxy._generateTypedConstructor;if(typeof(MySpace.Web.Services.Apps.AppsReturn)==="undefined"){MySpace.Web.Services.Apps.AppsReturn=gtc("MySpace.Web.Services.Apps.AppsReturn");MySpace.Web.Services.Apps.AppsReturn.registerClass("MySpace.Web.Services.Apps.AppsReturn")}Type.registerNamespace("MySpace");Type.registerNamespace("MySpace.Apps");MySpace.Apps.executeUrl=function(B){if(B==null||B.length==0){return}var A=new Image();A.src=B};MySpace.Apps.executeInstallCallback=function(A){MySpace.Apps.executeUrl(A)};MySpace.Apps.executeUninstallCallback=function(A){MySpace.Apps.executeUrl(A)};MySpace.Apps.getFIMAdvParameter=function(){var A="[\\?&]adv=([^&#]*)";var C=new RegExp(A);var B=C.exec(window.location.href);if(B==null){return null}else{return B[1]}};MySpace.Apps.makeFIMAdvCallback=function(B,A){var C="http://conv.opt.fimserve.com/conv/"+B+"/?rnd="+Math.floor(Math.random()*9999999+1);if(FIM_advAppId){C+="&offid="+A+"-"+FIM_advAppId}MySpace.Apps.executeUrl(C)};MySpace.Apps.tryFIMAdvCallback=function(){var A=MySpace.Apps.getFIMAdvParameter();if(A){if(FIM_baseAdvId){MySpace.Apps.makeFIMAdvCallback(FIM_baseAdvId,A)}else{MySpace.Apps.makeFIMAdvCallback(A,A)}}else{if(FIM_baseAdvId){MySpace.Apps.makeFIMAdvCallback(FIM_baseAdvId,0)}else{return false}}return true};MySpace.Apps.tryInstallCallback=function(){if(window.Applications_InstallCallbackUrl){MySpace.Apps.executeInstallCallback(Applications_InstallCallbackUrl)}};MySpace.Apps.uninstallApplication=function(A,B,C){MySpace.Web.Services.Apps.Apps.UninstallApplicationEx(A,"sourceURL="+escape(window.location),function(D){if(typeof(D)=="object"){if(D.status==0){if(D.callbackUrl!=null&&D.callbackUrl!=""){MySpace.Apps.executeUninstallCallback(D.callbackUrl);setTimeout(B,2*1000)}else{B()}}else{C()}}else{B()}},function(D){C()})};MySpace.Apps.FindContext=function(){if(MySpace.ClientContext.FunctionalContext=="AppCanvas"){return AppBeaconEnum.ec_canvas}if(MySpace.ClientContext.FunctionalContext=="UserViewProfile"){return AppBeaconEnum.ec_profile}if(MySpace.ClientContext.FunctionalContext=="AppSplash"){return AppBeaconEnum.ec_gallery}if(MySpace.ClientContext.FunctionalContext=="User"){return AppBeaconEnum.ec_userhome}if(MySpace.ClientContext.FunctionalContext=="ApplicationSettings"){return AppBeaconEnum.ec_appsetting}return -1};MySpace.Apps.bindTrackClick=function(selector,context,message,detail,appid){var links=$q(selector);for(var i=0;i<links.length;i++){$addHandler(links[i],"click",function(evt){MySpace.Apps.trackClick(evt.target,context,message,eval(detail),eval(appid))})}};MySpace.Apps.trackClick=function(E,A,D,B,C){if(typeof(C)=="undefined"){C=-1}else{currentAppId=C}if(typeof(B)=="undefined"){B=""}if(!MySpace.Application.keyDisabled("DWBeaconAppClicks")){MySpace.Beacon.Request({ec:A,em:D,ed:B,appid:currentAppId,pd:"mop_analytics"})}};MySpace.Apps.trackSettingClick=function(A){MySpace.Apps.trackClick(A,MySpace.Apps.FindContext(),AppBeaconEnum.em_appsettings)};MySpace.Apps.trackCultureClick=function(A){MySpace.Apps.trackClick(A,MySpace.Apps.FindContext(),AppBeaconEnum.em_culturefilter,A.options[A.selectedIndex].value)};MySpace.Apps.trackPagerClick=function(A){MySpace.Apps.trackClick(A,MySpace.Apps.FindContext(),AppBeaconEnum.em_paging,A.innerText)};Type.registerNamespace("MySpace.Apps.JSONP");MySpace.Apps.JSONP.timeoutIds={};MySpace.Apps.JSONP.request=function(E,A,F,C){var H=E;var B=setTimeout(F,C);MySpace.Apps.JSONP.timeoutIds[H]=B;var G=document.createElement("script");G.setAttribute("type","text/javascript");var D="?";if(A.indexOf("?")>0){D="&"}D+='jsonp=clearTimeout(MySpace.Apps.JSONP.timeoutIds["'+H+'"]);'+E;G.setAttribute("src",A+D);document.getElementsByTagName("head")[0].appendChild(G)};MySpace.Apps.JSONP.context={};MySpace.Apps.JSONP.setContext=function(A,B){MySpace.Apps.JSONP.context[A]=B};MySpace.Apps.JSONP.getContext=function(A){if(MySpace.Apps.JSONP.context.hasOwnProperty(A)){return MySpace.Apps.JSONP.context[A]}return null};Type.registerNamespace("MySpace");Type.registerNamespace("MySpace.UI");MySpace.UI.AppsPopup=function(){throw"Cannot instantiate static class."};MySpace.UI.AppsPopup._contentHolders={};MySpace.UI.AppsPopup.create=function(B,C,D){var A=MySpace.UI.Popup.create(B,C);A.set_top(60);return A};MySpace.UI.AppsPopup.createPopupV2=function(C,E,D,G,F){var B=document.createElement("div");B.innerHTML="<div class='addapp_popup_wrapper' style='z-index:1000201;left:0px;width:100%;display:none;visibility:hidden;'><div class='addapp_popup_box'><a class='addapp_popup_x'><div id='addappv2_close_x' style='float: left; margin-right: 4px; height: 17px;'>"+D+"</div><img id='addappv2_close_x' src='http://x.myspace.com/modules/applications/static/img/addappv2_close_icon.gif' /></a><div class='addapp_popup_title'></div><div class='addapp_popup_content'></div><div class='addapp_popup_buttons'><span style='margin-right: 10px;'>"+G+"</span></div></div></div>";var A=$create(MySpace.UI._Popup,{title:E,content:C,callback:F},null,null,B.firstChild);return A};MySpace.UI.AppsPopup.createWidePopupV2=function(C,E,D,G,F){var B=document.createElement("div");B.innerHTML="<div class='addapp_popup_wrapper' style='z-index:1000201;left:0px;width:100%;display:none;visibility:hidden;'><div class='wideaddapp_popup_box'><a class='addapp_popup_x'><div id='addappv2_close_x' style='float: left; margin-right: 4px; height: 17px;'>"+D+"</div><img id='addappv2_close_x' src='http://x.myspace.com/modules/applications/static/img/addappv2_close_icon.gif' /></a><div class='addapp_popup_title'></div><div class='addapp_popup_content'></div><div class='apppref_popup_buttons'><span style='margin-right: 25px;'>"+G+"</span></div></div></div>";var A=$create(MySpace.UI._Popup,{title:E,content:C,callback:F},null,null,B.firstChild);return A};MySpace.UI.AppsPopup.ajaxPermissions=function(D,A,C,E,B){return MySpace.UI.AppsPopup.ajaxPermissionsEx(D,A,C,E,B,null,null)};MySpace.UI.AppsPopup.ajaxPermissionsEx=function(H,I,E,F,J,A,K){if(typeof(A)==undefined){A=null}if(typeof(K)==undefined){K=null}var C=H.toString();var G="appid="+C+"&checkuser=true";if(A!=null){G+="&cat="+escape(A)}if(K!=null){G+="&perm="+escape(K)}MySpace.WebRequest.invoke("/Modules/Applications/Pages/AppPermissions.aspx",false,G,B,D,null,0);function B(M,L){var N=MySpace.UI.AppsPopup.create(M,F);J(true,N);MySpace.Apps.bindTrackClick(".appSettings",AppBeaconEnum.ec_updateapppermissionspopup,AppBeaconEnum.em_appsettings,"",'evt.target.parentNode.getAttribute("appid")')}function D(){J(false,null)}return};MySpace.UI.AppsPopup.ajaxPermissionsExternalApp=function(H,I,E,F,J,A,K){if(typeof(A)==undefined){A=null}if(typeof(K)==undefined){K=null}var C=H.toString();var G="appid="+C+"&checkuser=true";if(A!=null){G+="&cat="+escape(A)}if(K!=null){G+="&perm="+escape(K)}MySpace.WebRequest.invoke("/Modules/Applications/Pages/ExternalAppPermissions.aspx",false,G,B,D,null,0);function B(M,L){var N=MySpace.UI.AppsPopup.create(M,F);J(true,N)}function D(){J(false,null)}return};MySpace.UI.AppsPopup.getPermissions=function(A,C){var B=new Array();var D=A._box.getElementsByTagName("input");for(i=0;i<D.length;i++){if(Sys.UI.DomElement.containsCssClass(D[i],"userAppPermission")&&D[i].checked==C){B.push(D[i].value)}}return B};MySpace.UI.AppsPopup.getSelectedPermissions=function(A){return MySpace.UI.AppsPopup.getPermissions(A,true)};MySpace.UI.AppsPopup.getUnselectedPermissions=function(A){return MySpace.UI.AppsPopup.getPermissions(A,false)};MySpace.UI.AppsPopup.ajaxBlockConfirmation=function(I,G,L){var C=I.toString();var H="appid="+C;currentAppId=I;MySpace.WebRequest.invoke("/Modules/Applications/Pages/BlockApplication.aspx",false,H,B,E,null,0);function B(N,M){var O=N;var P=MySpace.UI.AppsPopup.create(O,G);L(true,P);$addHandler($q(".popup_wrapper:last-child .popup_x")[0],"click",F);$addHandler($q(".popup_wrapper:last-child .popup_buttons input")[0],"click",A);$addHandler($q(".popup_wrapper:last-child .popup_buttons input")[1],"click",F);$addHandler($q(".popup_wrapper:last-child .blockappsetting")[0],"click",J);$addHandler($q(".popup_wrapper:last-child .blockappprofile")[0],"click",K);$addHandler($q(".popup_wrapper:last-child .blockappcanvas")[0],"click",D)}function D(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_canvas,MySpace.ClientContext.FunctionalContext,currentAppId)}function K(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appprofile,MySpace.ClientContext.FunctionalContext,currentAppId)}function J(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appsettings,MySpace.ClientContext.FunctionalContext,currentAppId)}function F(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_close,MySpace.ClientContext.FunctionalContext,currentAppId)}function A(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_blockapp,MySpace.ClientContext.FunctionalContext,currentAppId);$removeHandler($q(".popup_wrapper:last-child .popup_x")[0],"click",F)}function E(){L(false,null)}return};MySpace.UI.AppsPopup.ajaxRequestPermission=function(E,A,D,C){var B=function(F){var J="appid="+E+"&perm="+escape(A)+"&reason="+escape(D);var K=F;var H="<center style='margin-top: 25px; margin-bottom: 25px;'>"+MySpaceRes.AppManagement.AppsPopup_Loading+"<br /><img style='margin-top: 15px;' src='/modules/common/static/img/fhloadercircles.gif' /></center>";p=MySpace.UI.AppsPopup.createPopupV2(H,MySpaceRes.AppManagement.RequestPermissionV2PopupTitle,MySpaceRes.AppManagement.AppsPopupV2Close,K);p.add_button(MySpaceRes.AppManagement.RequestPermissionV2AllowPermission);p.add_button(MySpaceRes.AppManagement.RequestPermissionV2Deny);p.show(C);MySpace.WebRequest.invoke("/Modules/Applications/Pages/RequestPermissionV2.aspx",false,J,I,G,null,0);function I(M,L){var N=M;p.set_content(N);MySpace.UI.AppsPopup.checkForHidePermissionButtons();$create(MySpace.UI._Popup,null,null,null,p._element)}function G(){}};MySpace.Web.Services.Apps.Apps.GetAddAppFooterText(E,B);return};MySpace.UI.AppsPopup.checkForHidePermissionButtons=function(){var C=document.getElementById("hideRequestPermButton");if(C!=null){var B=document.getElementsByTagName("input");for(var A=0;A<B.length;A++){if((B[A].value==MySpaceRes.AppManagement.RequestPermissionV2Deny)||(B[A].value==MySpaceRes.AppManagement.RequestPermissionV2AllowPermission)){B[A].style.visibility="hidden"}}}else{var B=document.getElementsByTagName("input");for(var A=0;A<B.length;A++){if((B[A].value==MySpaceRes.AppManagement.RequestPermissionV2Deny)||(B[A].value==MySpaceRes.AppManagement.RequestPermissionV2AllowPermission)){B[A].style.visibility="visible"}}}};MySpace.UI.AppsPopup.ajaxAddApp=function(J,G,K){var H=MySpace.Application.keyDisabled("Applications_EnableV2AddAppPopup");var B=J.toString();var C=window.location.href;var I="appid="+B+"&cat=2&nexturl="+escape(C);var A;var E="<center style='margin-top: 25px; margin-bottom: 25px;'>"+MySpaceRes.AppManagement.AppsPopup_Loading+"<br /><img style='margin-top: 15px;' src='/modules/common/static/img/fhloadercircles.gif' /></center>";var D=new Array();var F=function(M){var S=M;currentAppId=B;if(H){A=MySpace.UI.AppsPopup.create(E,G);A.add_button(MySpaceRes.ProfileDisplay.AppInstallPopupButtonInstall);A.add_button(MySpaceRes.ProfileDisplay.AppInstallPopupButtonCancel,true).isCancel=true;A.show(K);MySpace.WebRequest.invoke("/Modules/Applications/Pages/AddApp.aspx",false,I,O,N,null,0)}else{A=MySpace.UI.AppsPopup.createPopupV2(E,MySpaceRes.AppManagement.AppsPopupV2AddApp,MySpaceRes.AppManagement.AppsPopupV2Close,S);A.add_button(MySpaceRes.ProfileDisplay.AppInstallPopupButtonInstall);A.show(K);MySpace.WebRequest.invoke("/Modules/Applications/Pages/AddAppV2.aspx",false,I,O,N,null,0)}function O(U,T){var V=U;A.set_content(V);MySpace.UI.AppsPopup.checkForHideAddButton();$addHandler($q(".addapp_popup_wrapper:last-child .addapp_popup_x")[0],"click",R);$addHandler($q(".addapp_popup_wrapper:last-child .addapp_popup_buttons input")[0],"click",L);$addHandler($q(".addapp_popup_wrapper:last-child .addappv2_addcanvas")[0],"click",P);$addHandler($q(".addapp_popup_wrapper:last-child .addappv2_addprofile")[0],"click",Q)}function R(T){MySpace.Apps.trackClick(T,AppBeaconEnum.ec_addpopup,AppBeaconEnum.em_close,MySpace.ClientContext.FunctionalContext,currentAppId)}function Q(T){MySpace.Apps.trackClick(T,AppBeaconEnum.ec_addpopup,AppBeaconEnum.em_appprofile,MySpace.ClientContext.FunctionalContext,currentAppId)}function P(T){MySpace.Apps.trackClick(T,AppBeaconEnum.ec_addpopup,AppBeaconEnum.em_canvas,MySpace.ClientContext.FunctionalContext,currentAppId)}function L(T){MySpace.Apps.trackClick(T,AppBeaconEnum.ec_addpopup,AppBeaconEnum.em_addapp,MySpace.ClientContext.FunctionalContext,currentAppId)}function N(){}MySpace.UI.AppsPopup.checkForHideAddButton()};MySpace.Web.Services.Apps.Apps.GetAddAppFooterText(J,F);return};MySpace.UI.AppsPopup.checkForHideAddButton=function(){var C=document.getElementById("hideAddAppButton");if(C!=null){var B=document.getElementsByTagName("input");for(var A=0;A<B.length;A++){if(B[A].value==MySpaceRes.ProfileDisplay.AppInstallPopupButtonInstall){B[A].style.visibility="hidden"}}}else{var B=document.getElementsByTagName("input");for(var A=0;A<B.length;A++){if(B[A].value==MySpaceRes.ProfileDisplay.AppInstallPopupButtonInstall){B[A].style.visibility="visible"}}}};function getElementsByClassName(G,F){if(!F){F=document.getElementsByTagName("body")[0]}var A=[];var E=new RegExp("\\b"+G+"\\b");var D=F.getElementsByTagName("*");for(var C=0,B=D.length;C<B;C++){if(E.test(D[C].className)){A.push(D[C])}}return A}MySpace.UI.AppsPopup.ajaxPreferences=function(E,G,D){var A=E.toString();var F="appid="+A;var C="<center style='margin-top: 25px; margin-bottom: 25px;'>"+MySpaceRes.AppManagement.AppsPopup_Loading+"<br /><img style='margin-top: 15px;' src='/modules/common/static/img/fhloadercircles.gif' /></center>";var B=function(H){var L=H;var K=MySpace.UI.AppsPopup.createWidePopupV2(C,G,MySpaceRes.AppManagement.AppsPopupV2Close,L);K.add_button(MySpaceRes.ProfileDisplay.AppInstallPopupButtonInstall);K.show(function(R,P){if(P.target.isCancel){R.set_content("");if(typeof opt_callback==="function"){opt_callback(null)}return}var Q=[];var O=[];var T=getElementsByClassName("preferenceDefinition");for(var M=0;M<T.length;M++){Q.push(T[M].name);if(T[M].type=="checkbox"){O.push(T[M].checked)}else{O.push(T[M].value)}}prefList=getElementsByClassName("preferenceListText")[0];if(prefList){Q.push(prefList.name);var S=getElementsByClassName("preferenceListItem");var N="";for(var M=0;M<S.length;M++){N=N+S[M].innerHTML.substr(0,S[M].innerHTML.indexOf("<"))+"|"}N=N.substr(0,N.length-1);O.push(N)}R.set_content("");MySpace.Web.Services.Apps.Apps.SetUserPreferences(E,Q,O,function(U){switch(U.status){case 0:if(typeof opt_callback==="function"){opt_callback(null)}return;default:if(typeof opt_callback==="function"){opt_callback(null)}return}},function(U){if(typeof opt_callback==="function"){opt_callback(null)}})});MySpace.WebRequest.invoke("/Modules/Applications/Pages/UserAppPreferences.aspx",false,F,J,I,null,0);function J(N,M){var O=N;K.set_content(O);$create(MySpace.UI.AppPreferenceContainer,{rootElement:K._element},null,null,K._element);D(true,K)}function I(){D(false,null)}};MySpace.Web.Services.Apps.Apps.GetAddAppFooterText(E,B);return};MySpace.UI.AppsPopup.registerClass("MySpace.UI.AppsPopup");MySpace.UI.AppPreferenceContainer=function(A){MySpace.UI.AppPreferenceContainer.initializeBase(this,[A])};MySpace.UI.AppPreferenceContainer.prototype={_rootElement:null,get_rootElement:function(){return this._rootElement},set_rootElement:function(A){this._rootElement=A},initialize:function(){var C=this._rootElement.getElementsByTagName("form");for(var A=0;A<C.length;A++){if(Sys.UI.DomElement.containsCssClass(C[A],"preferenceList")){var B="apppreflist_"+A;C[A].id=B;$create(MySpace.UI.AppPreferenceList,{rootElement:C[A]},null,null,$get(B))}}}};MySpace.UI.AppPreferenceContainer.registerClass("MySpace.UI.AppPreferenceContainer",Sys.UI.Control);MySpace.UI.AppPreferenceList=function(A){MySpace.UI.AppPreferenceList.initializeBase(this,[A])};MySpace.UI.AppPreferenceList.prototype={_rootElement:null,_textInputElement:null,get_rootElement:function(){return this._rootElement},set_rootElement:function(A){this._rootElement=A},initialize:function(){var D=this._rootElement.getElementsByTagName("input");for(var E=0;E<D.length;E++){if(Sys.UI.DomElement.containsCssClass(D[E],"preferenceListText")){this._textInputElement=D[E]}else{if(Sys.UI.DomElement.containsCssClass(D[E],"preferenceListButton")){$addHandler(D[E],"click",Function.createDelegate(this,function(J){if(this._textInputElement.value!=""){var L=J.target.parentNode.getElementsByTagName("span");var G=null;for(var I=0;I<L.length;I++){if(Sys.UI.DomElement.containsCssClass(L[I],"preferenceListValues")){G=L[I];break}}var K=document.createElement("span");K.className="preferenceListItem";K.appendChild(document.createTextNode(this._textInputElement.value));this._textInputElement.value="";var H=document.createElement("a");H.className="preferenceListItemRemove";H.innerHTML="X";$addHandler(H,"click",function(M){M.target.parentNode.parentNode.removeChild(M.target.parentNode)});K.appendChild(H);G.appendChild(K);G.appendChild(document.createElement("wbr"))}}));break}}}var F=this._rootElement.getElementsByTagName("span");for(var C=0;C<F.length;C++){if(Sys.UI.DomElement.containsCssClass(F[C],"preferenceListItem")){var A=F[C].getElementsByTagName("a");for(var B=0;B<A.length;B++){if(Sys.UI.DomElement.containsCssClass(A[B],"preferenceListItemRemove")){$addHandler(A[B],"click",function(G){G.target.parentNode.parentNode.removeChild(G.target.parentNode)});break}}}}}};MySpace.UI.AppPreferenceList.registerClass("MySpace.UI.AppPreferenceList",Sys.UI.Control);if(typeof(Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()}MySpace.UI.AppsPopup.ajaxBlockConfirmation=function(I,G,L){var C=I.toString();currentAppId=C;var H="appid="+C;MySpace.WebRequest.invoke("/Modules/Applications/Pages/BlockApplication.aspx",false,H,B,E,null,0);function B(N,M){var O=N;var P=MySpace.UI.AppsPopup.create(O,G);L(true,P);$addHandler($q(".popup_wrapper:last-child .popup_x")[0],"click",F);$addHandler($q(".popup_wrapper:last-child .popup_buttons input")[0],"click",A);$addHandler($q(".popup_wrapper:last-child .popup_buttons input")[1],"click",F);$addHandler($q(".popup_wrapper:last-child .blockappsetting")[0],"click",J);$addHandler($q(".popup_wrapper:last-child .blockappprofile")[0],"click",K);$addHandler($q(".popup_wrapper:last-child .blockappcanvas")[0],"click",D)}function A(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_blockapp,MySpace.ClientContext.FunctionalContext,currentAppId);$removeHandler($q(".popup_wrapper:last-child .popup_x")[0],"click",F)}function K(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appprofile,MySpace.ClientContext.FunctionalContext,currentAppId)}function J(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appsettings,MySpace.ClientContext.FunctionalContext,currentAppId)}function F(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_close,MySpace.ClientContext.FunctionalContext,currentAppId)}function D(M){MySpace.Apps.trackClick(M,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_canvas,MySpace.ClientContext.FunctionalContext,currentAppId)}function E(){L(false,null)}return};MySpace.UI.AppsPopup.ajaxBlockAppWithOptions=function(J,B,H,M){var D=J.toString();currentAppId=D;var I="appid="+D+"&block_source="+B;MySpace.WebRequest.invoke("/Modules/Applications/Pages/BlockAppWithOptions.aspx",false,I,C,F,null,0);function C(O,N){var P=O;var Q=MySpace.UI.AppsPopup.create(P,H);M(true,Q);$addHandler($q(".popup_wrapper:last-child .popup_x")[0],"click",G);$addHandler($q(".popup_wrapper:last-child .popup_buttons input")[0],"click",A);$addHandler($q(".popup_wrapper:last-child .blockappsetting")[0],"click",K);$addHandler($q(".popup_wrapper:last-child .blockappprofile")[0],"click",L);$addHandler($q(".popup_wrapper:last-child .blockappcanvas")[0],"click",E)}function G(N){MySpace.Apps.trackClick(N,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_close,MySpace.ClientContext.FunctionalContext,currentAppId)}function A(N){MySpace.Apps.trackClick(N,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_blockapp,MySpace.ClientContext.FunctionalContext,currentAppId)}function E(N){MySpace.Apps.trackClick(N,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_canvas,MySpace.ClientContext.FunctionalContext,currentAppId)}function L(N){MySpace.Apps.trackClick(N,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appprofile,MySpace.ClientContext.FunctionalContext,currentAppId)}function K(N){MySpace.Apps.trackClick(N,AppBeaconEnum.ec_blockpopup,AppBeaconEnum.em_appsettings,MySpace.ClientContext.FunctionalContext,currentAppId)}function F(){M(false,null)}return};MySpace.UI.AppsPopup.BlockActivities=function(G,D,B){var I=function(J){if(J!=undefined){switch(J.status){case 0:if(MySpace.HomeDisplay&&MySpace.HomeDisplay.activitiesModule){MySpace.HomeDisplay.activitiesModule.getData(0)}else{location.reload(true)}break;case 1:break}}};var H=function(J){};var A=function(){var J=function(K){MySpace.Web.Services.Apps.Apps.BlockApplicationFromActivities(D,I,H)};MySpace.Apps.uninstallApplication(D,J)};var E=function(J){if(J){J.parentNode.removeChild(J)}};var F="Block App";var C="none";if(B){C="activities"}MySpace.UI.AppsPopup.ajaxBlockAppWithOptions(G,C,F,function(J,K){var L=function(M,P){if(P.target.isCancel||!J){E(M.get_element());return}var N=document.getElementById("block_options_all_"+G);if(N&&N.checked){E(M.get_element());A();return}var O=document.getElementById("block_options_activities_"+G);if(O&&O.checked){E(M.get_element());MySpace.Web.Services.Apps.Apps.BlockActivities(D,I,H);return}E(M.get_element())};K.add_button("Confirm");K.set_width(500);K.show(L)})};Type.registerNamespace("MySpace.MDP");Type.registerNamespace("MySpace.MDP.Apps");Type.registerNamespace("MySpace.MDP.Util");MySpace.MDP.Util.isArray=function(A){if(A==null){return false}return A.constructor==(new Array).constructor};MySpace.MDP.Apps.API_RESOURCE_TIMEOUT=3*1000;MySpace.MDP.Apps.VIEWER_APPS_RESOURCE=-1;MySpace.MDP.Apps.OWNER_APPS_RESOURCE=-1;MySpace.MDP.Apps.setViewerAppsResource=function(A){MySpace.MDP.Apps.VIEWER_APPS_RESOURCE=A};MySpace.MDP.Apps.setListAppsResource=function(A){MySpace.MDP.Apps.setViewerAppsResource(A)};MySpace.MDP.Apps.setOwnerAppsResource=function(A){MySpace.MDP.Apps.OWNER_APPS_RESOURCE=A};MySpace.MDP.Apps.AppCache=function(){MySpace.MDP.Apps.AppCache.initializeBase(this);this._initialized=false;this._cache={};this._apps=null;this._viewerInfo=null;this._viewerGlobalPermissions=null;this._bookmarkedApps=null};MySpace.MDP.Apps.AppCache.prototype={clear:function(){this._cache={};this._initialized=false},populate:function(B){this.clear();if(!MySpace.MDP.Util.isArray(B)&&MySpace.MDP.Util.isArray(B.userInstalledApplications)){if(B.hasOwnProperty("viewer")){this._viewerInfo=B.viewer}if(B.hasOwnProperty("bookmarkedApplications")){this._bookmarkedApps=B.bookmarkedApplications}if(B.hasOwnProperty("globalPermissions")){this._viewerGlobalPermissions=B.globalPermissions}B=B.userInstalledApplications}if(B==null){B=[]}this._apps=B;for(var A in B){this._cache[B[A].id]=B[A]}this._initialized=true;return B},getApp:function(A){return this._cache[A]},getApps:function(){return this._apps},getBookmarkedApps:function(){return this._bookmarkedApps},getViewerInfo:function(){return this._viewerInfo},checkViewerGlobalPermission:function(A){if(this._viewerGlobalPermissions!=null&&(typeof A=="string")){A=A.toUpperCase();for(var B=0;B<this._viewerGlobalPermissions.length;B++){if(A==this._viewerGlobalPermissions[B]){return true}}}return false},checkApplicationPermission:function(D,A){var E=this._cache[D];if(!E||(typeof A!="string")){return false}A=A.toUpperCase();if(A=="BI"){return true}if(E.hasOwnProperty("applicationPermissions")){var C=E.applicationPermissions;for(var B=0;B<C.length;B++){if(A==C[B]){return true}}}return false},isInitialized:function(){return this._initialized}};MySpace.MDP.Apps.AppCache.registerClass("MySpace.MDP.Apps.AppCache");var mdpAppCache=new MySpace.MDP.Apps.AppCache();var mdpOwnerAppCache=new MySpace.MDP.Apps.AppCache();MySpace.MDP.Apps.CallbackProxy=function(D,C,A,B){MySpace.MDP.Apps.AppCache.initializeBase(this);this.cache=C;this.callbackProxyId=D;this.successCallback=A;this.errorCallback=B};MySpace.MDP.Apps.CallbackProxy.prototype={invokeCallback:function(B){var A=this.cache.populate(B);this.successCallback(A);delete MySpace.MDP.Apps.callbackProxies[this.callbackProxyId]}};MySpace.MDP.Apps.callbackProxies={};MySpace.MDP.Apps._listApps=function(G,L,C,E,K,F,B,A){if(typeof F!="string"){K()}if(B.isInitialized()){E(B.getApps());return}var N=F;var H="?";if(N.indexOf("?")>0){H="&"}if(G!=null&&G!=""){N+=H+"token="+G;H="&"}if(L!=null&&L!=""){N+=H+"timestamp="+L}var J=K;if(typeof(K)=="function"){J=K.name+"();"}var M=MySpace.MDP.Apps.API_RESOURCE_TIMEOUT;var I=A;if(!I||I===""){I=C}MySpace.MDP.Apps.callbackProxies[I]=new MySpace.MDP.Apps.CallbackProxy(I,B,E,K,47);var D="MySpace.MDP.Apps.callbackProxies['"+I+"'].invokeCallback";MySpace.Apps.JSONP.request(D,N,J,M)};MySpace.MDP.Apps.listOwnerApps=function(D,E,B,A,C){MySpace.MDP.Apps._listApps(D,E,B,A,C,MySpace.MDP.Apps.OWNER_APPS_RESOURCE,mdpOwnerAppCache,"owner")};MySpace.MDP.Apps.listViewerApps=function(D,E,B,A,C){MySpace.MDP.Apps._listApps(D,E,B,A,C,MySpace.MDP.Apps.VIEWER_APPS_RESOURCE,mdpAppCache,"viewer")};MySpace.MDP.Apps.listApps=function(D,E,B,A,C){MySpace.MDP.Apps.listViewerApps(D,E,B,A,C)};MySpace.MDP.Apps.getOwnerAppFromCache=function(B,A){MySpace.MDP.Apps._getAppFromCache(B,A,mdpOwnerAppCache)};MySpace.MDP.Apps.getViewerAppFromCache=function(B,A){MySpace.MDP.Apps._getAppFromCache(B,A,mdpAppCache)};MySpace.MDP.Apps.getAppFromCache=function(B,A){MySpace.MDP.Apps.getViewerAppFromCache(B,A)};MySpace.MDP.Apps._getAppFromCache=function(C,A,B){if(B.getApp(C)!=null){var D=B.getApp(C);A(D);return true}return false};MySpace.MDP.Apps.getViewerInfoFromCache=function(C,B){if(mdpAppCache.getViewerInfo()!=null){var A=mdpAppCache.getViewerInfo();if(mdpAppCache.checkApplicationPermission(C,"BI")){B(A)}else{if(ifpc_current_surface=="canvas"&&mdpAppCache.checkViewerGlobalPermission("BI")){B(A)}else{B({errorCode:"unauthorized",errorMessage:"Gadget does not have access to the requested data."})}}return true}return false};MySpace.MDP.Apps.getViewerApp=function(F,D,E,B,A,C){if(MySpace.MDP.Apps.getViewerAppFromCache(F,A)){return}function G(H){if(!MySpace.MDP.Apps.getViewerAppFromCache(F,A)){C()}}MySpace.MDP.Apps.listViewerApps(D,E,B,G,C)};MySpace.MDP.Apps.getOwnerApp=function(F,D,E,B,A,C){if(MySpace.MDP.Apps.getOwnerAppFromCache(F,A)){return}function G(H){if(!MySpace.MDP.Apps.getOwnerAppFromCache(F,A)){C()}}MySpace.MDP.Apps.listOwnerApps(D,E,B,G,C)};MySpace.MDP.Apps.getApp=function(F,D,E,B,A,C){MySpace.MDP.Apps.getViewerApp(F,D,E,B,A,C)};MySpace.MDP.Apps.getViewerInfo=function(E,C,D,A,B){if(MySpace.MDP.Apps.VIEWER_APPS_RESOURCE==-1){A({errorCode:"badRequest",errorMessage:"The current viewer is not logged in."});return}if(MySpace.MDP.Apps.getViewerInfoFromCache(E,A)){return}function F(G){if(!MySpace.MDP.Apps.getViewerInfoFromCache(E,A)){B()}}MySpace.MDP.Apps.listApps(C,D,ifpc_current_surface,F,B)};MySpace.MDP.Apps.generateAppMarkup=function(B,A){return MySpace.MDP.Apps.generateAppMarkupInternal(B,A)};MySpace.MDP.Apps.generateAppMarkupInternal=function(D,C){if(C.indexOf("profile")>-1){C="profile"}var B="apppanel_"+D.id+"_"+C;var E=null;if(D.hasOwnProperty("innerHTML")){E=D.innerHTML}else{var B="apppanel_"+D.id+"_"+C;var A;if(D.panelType.toLowerCase()=="opensocial"){A=document.createElement("iframe");A.id=B;A.name=B;A.allowtransparency="true";A.frameborder=0;A.style.border=0;A.height=D.height;A.width=D.width;A.src=D.iframeUrl;A.scrolling="no"}else{if(D.panelType.toLowerCase()=="flash"){var A=document.createElement("object");A.id=B;A.allowscriptaccess="never";A.allownetworking="all";A.type="application/x-shockwave-flash";A.data=D.flashUrl;A.height=D.height;A.width=D.width;var G=document.createElement("param");G.name="movie";G.value=D.flashUrl;A.appendChild(G);var H=document.createElement("param");H.name="FlashVars";H.value="";A.appendChild(H);var F=document.createElement("param");F.name="quality";F.value="high";A.appendChild(F);var J=document.createElement("param");J.name="wmode";J.value="transparent";A.appendChild(J)}}var I=document.createElement("div");I.appendChild(A);E=I.innerHTML}return E};MySpace.MDP.Apps.loadApp=function(B,A,C){if(C&&C.className=="mdp_app_placeholder"){C.innerHTML='<div style="background: transparent url(/Modules/Common/Static/img/loadercircles.gif) no-repeat; margin: 10px; padding: 3px 0 0 28px; height: 30px;">App loading...</div>';MySpace.MDP.Apps.getApp(B,"","",A,function(F){var D=document.createElement("div");D.innerHTML=MySpace.MDP.Apps.generateAppMarkupInternal(F,A);var E=D.firstChild;E.style.display="none";C.appendChild(E);MySpace.MDP.Apps.loadAppPlaceholders[B+A]=C},function(){C.innerHTML='<div style="margin: 10px; padding: 3px 0 0 3px; height: 30px;">Error loading app.</div>'})}};MySpace.MDP.Apps.loadAppPlaceholders={};MySpace.MDP.Apps.appLoadedCallback=function(C,A){var B=C+A;if(MySpace.MDP.Apps.loadAppPlaceholders.hasOwnProperty(B)){var D=MySpace.MDP.Apps.loadAppPlaceholders[B];D.removeChild(D.firstChild);D.firstChild.style.display="block";if(D.className=="mdp_app_placeholder"){D.style.height="auto";D.style.width="auto"}}};if(!window._IFPC){window._IFPC={registerService:function(){}}}function ifpc_widget_requestNavigateTo(C,B,A,E,D){ifpc_widget_requestNavigateToEx(C,B,A,E,D,false,false)}function ifpc_widget_requestNavigateToEx(I,G,B,D,A,C,H){var F=encodeURIComponent(gadgets.json_.stringify(D));var E=null;switch(B){case"canvas":E=ifpc_canvas_urltemplate;break;case"profile":E=ifpc_profile_urltemplate;break;case"home":E=ifpc_home_urltemplate;break}if(E!=null){if(-1===ifpc_ownerid){if(MySpace&&MySpace.ClientContext&&MySpace.ClientContext.DisplayFriendId){ifpc_ownerid=MySpace.ClientContext.DisplayFriendId}}E=E.replace("{0}",I);E=E.replace("{1}",ifpc_ownerid);E=E.replace("{2}",F);if(C){E+="&newinstall=1"}if(H){E+="&"+H}top.location=E}}_IFPC.registerService("requestNavigateTo",ifpc_widget_requestNavigateTo);function ifpc_requestInstallAndPermission(D,B,C,A){headerContent=MySpaceRes.ProfileDisplay.AppInstallHeader+MySpaceAppProfileContext.appDisplayName;MySpace.UI.AppsPopup.ajaxAddApp(MySpaceAppProfileContext.appId,headerContent,function(F,H){if(H.target.parentNode.isCancel||H.target.isCancel){var E={installed:false};A(E);return}var G=MySpace.UI.AppsPopup.getSelectedPermissions(F);MySpace.Web.Services.Apps.Apps.InstallApplication(MySpaceAppProfileContext.token,G,function(K){if(K!=undefined){switch(K.status){case 0:if(K.callbackUrl!=null){MySpace.Apps.executeInstallCallback(K.callbackUrl)}if(mdpAppCache!=null){mdpAppCache[D]={}}var I=function(N){for(i=0;i<G.length;i++){N[G[i]]=true}A(N)};var L=false;for(i=0;i<G.length;i++){if(B instanceof Array&&B.length>0){if(B[0].toLowerCase()==G[i].toLowerCase()){L=true}}}var M=function(){ifpc_widget_requestPermission(D,B,C,I)};$clearHandlers(appinstall_link);appinstall_link.id="apptopnav_appuninstall_link";appinstall_link.innerHTML="Remove App";appinstall_link.style.visibility="hidden";$addHandler(appinstall_link,"click",canvas_appuninstall);appinstall_link=false;if(L){J={};J.installed=true;I(J)}else{setTimeout(M,2*1000)}return;case 1:default:canvas_appinstall_failed(K.content);var J={installed:false};A(J);return}}},function(I){canvas_appinstall_failed(null)})})}function ifpc_widget_requestPermission(E,C,D,A){if(C instanceof Array&&C.length>0){if(appinstall_link){ifpc_requestInstallAndPermission(E,C,D,A);return}var B=function(I,H){if(H.target.isCancel||H.target.id=="addappv2_close_x"){if(typeof A==="function"){A(null)}return}var G={};var F=new Array();var J=new Array();if(H.target.value==MySpaceRes.AppManagement.RequestPermissionV2Deny){G[C[0]]=false;J.push(C[0])}else{G[C[0]]=true;F.push(C[0])}G.installed=true;MySpace.Web.Services.Apps.Apps.UpdateApplicationSettings(E,F,J,function(K){switch(K.status){case 0:if(typeof A==="function"){A(G)}return;default:if(typeof A==="function"){A(null)}return}},function(K){if(typeof A==="function"){A(null)}})};MySpace.UI.AppsPopup.ajaxRequestPermission(E,C[0],D,B)}}_IFPC.registerService("requestPermission",ifpc_widget_requestPermission);var ifpc_widget_postTo_data={};var ifpc_widget_iframe_popup=null;function ifpc_widget_postTo(U,T,D,N,I,L,G,O,V,J,M,F){ifpc_widget_postTo_data.os_token=U;ifpc_widget_postTo_data.post_type=T;ifpc_widget_postTo_data.subject=D;ifpc_widget_postTo_data.content=N;ifpc_widget_postTo_data.opt_recipientId=I;ifpc_widget_postTo_data.opt_recipientImage=L;ifpc_widget_postTo_data.opt_recipientName=G;ifpc_widget_postTo_data.opt_recipientProfile=O;ifpc_widget_postTo_data.app_id=M;ifpc_widget_postTo_data.callback=F;if(T==="ACTIVITY"){ifpc_widget_postTo_data.activity={};ifpc_widget_postTo_data.activity.priority=J;ifpc_widget_postTo_data.activity.template_id=V;ifpc_widget_postTo_data.activity.template_parameters=D;ifpc_widget_postTo_data.activity.media_items=N}var Q=false;for(var P=0;P<ifpc_supported_postto_targets.length;P++){if(ifpc_supported_postto_targets[P]===T){Q=true;break}}if(Q){var C="/Modules/MDPPostTo/Pages/MDPPostTo.aspx?opensocial_token="+U+"&p=MDPPostTo",R="appspopup_pt_";switch(T){case"PROFILE":C+="Profile";R+="pro";break;case"SEND_MESSAGE":C+="SendMessage";R+="send";break;case"COMMENTS":C+="Comment";R+="comm";break;case"BULLETINS":C+="Bulletin";R+="bull";break;case"BLOG":C+="Blog";R+="blog";break;case"SHARE_APP":C+="AppInvite";R+="appinvite";break;case"ACTIVITY":C+="Activity";R+="act appspopup_pt_act_width";break;case"PHOTOS":C+="Photos&albumId="+N;R+="photos"}if(null===L&&null===G&&typeof(I)==="string"){C+="&ids="+I}if(T=="ACTIVITY"){var C="/Modules/MDPPostTo/Pages/MDPPopup.aspx?opensocial_token="+U+"&p=MDPPostToActivity",R="appspopup_pt_";PostToPopupV2("_onPostToComplete",ifpc_widget_postTo_data.app_id,C)}else{if("appspopup_pt_"!==R){var H=document.getElementById("post_to_container");if(H){var E=document.getElementById("post_to_iframe");if(E&&R!==E.className){H.parentNode.removeChild(H);ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",R)}else{if(C.indexOf("&ids=")>=0){var B=ifpc_widget_iframe_popup._iFrameSrc;if(ifpc_widget_iframe_popup&&B.indexOf("&ids=")>=0){var K=B.substr(B.indexOf("&ids=")).split("&")[1];var A=C.substr(C.indexOf("&ids=")).split("&")[1];if(A!==K){H.parentNode.removeChild(H);ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",R)}}}}}else{ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",R)}ifpc_widget_iframe_popup.show();if(document.getElementById("post_to_container")){document.getElementById("post_to_container").style.position="absolute";var S=0;if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){S=document.body.scrollTop}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){S=document.documentElement.scrollTop}}document.getElementById("post_to_container").style.top=125+S+"px"}}}}}_IFPC.registerService("postTo",ifpc_widget_postTo);_IFPC.registerService("requestShowApp",MySpace.MDP.Apps.appLoadedCallback);function ifpc_widget_requestUserBasicInfo(C,D,A){if(C=="VIEWER"){var B=function(){A({errorCode:"internalError",errorMessage:"Unexpected error."})};MySpace.MDP.Apps.getViewerInfo(D,"","",A,B);return}A(null)}_IFPC.registerService("parentPageBasicInfoRequest",ifpc_widget_requestUserBasicInfo);function ifpc_widget_requestUserAppData(A){A(userAppData);return}_IFPC.registerService("userAppDataRequest",ifpc_widget_requestUserAppData);Sys.Application.add_init(function(){if($get("profilerightApps")||$get("profileleftApps")){MySpace.MDP.Apps.listOwnerApps("",null,"profile",MySpace.UI.AppChrome.profileLoad,Function.emptyFunction)}});function PostToPopupV2(C,E,B){var D="appid="+E+"&cat=2";var F=parent.getElementsByClassName("addapp_popup_wrapper");var A=0;while(A<F.length){F[A].parentNode.removeChild(F[A]);A++}MySpace.WebRequest.invoke(B,false,D,_onPostToComplete,_onPostToFail,null,0)}function _onPostToComplete(B,A){var C="loading";var E=function(){if(ifpc_widget_postTo_data&&ifpc_widget_postTo_data.callback){if(ifpc_widget_postTo_data.returnValue){ifpc_widget_postTo_data.callback(ifpc_widget_postTo_data.returnValue)}else{ifpc_widget_postTo_data.callback(0)}}};p=MySpace.UI.AppsPopup.createPopupV2(C,"Publish Friend Update","close","",E);p.show();var D=B;p.set_content(D)}function _onPostToFail(){};
