MySpace.UI.AutoCompleteBehavior=function(A){MySpace.UI.AutoCompleteBehavior.initializeBase(this,[A]);this._servicePath=null;this._serviceMethod=null;this._serviceParams=null;this._isJsonpService=false;this._contextKey=null;this._useContextKey=false;this._minimumPrefixLength=3;this._triggerPrefix="";this._completionItems=null;this._completionInterval=1000;this._completionListWrapperID=null;this._completionListElementID=null;this._completionListAlwaysVisible=false;this._closeObsoleteResults=true;this._currentPrefix=null;this._selectIndex=-1;this._enableCaching=true;this._enableCacheSubstrings=false;this._flyoutHasFocus=false;this._textBoxHasFocus=false;this._completionListCssClass=null;this._completionListItemCssClass=null;this._completionListFixedHeight=null;this._completionListMaxHeight=200;this._completionListWidth=null;this._lazyLoadPlaceholderHeight=null;this._groupHeaderCssClass=null;this._highlightedItemCssClass=null;this._delimiterCharacters=null;this._firstRowSelected=false;this._showOnlyCurrentWordInCompletionListItem=false;this._webRequest=null;this._postParameterName="prefixText"};MySpace.UI.AutoCompleteBehavior.prototype={initialize:function(){MySpace.UI.AutoCompleteBehavior.callBaseMethod(this,"initialize");this._popupBehaviorHiddenHandler=Function.createDelegate(this,this._popupHidden);this._tickHandler=Function.createDelegate(this,this._onTimerTick);this._focusHandler=Function.createDelegate(this,this._onGotFocus);this._blurHandler=Function.createDelegate(this,this._onLostFocus);this._keyDownHandler=Function.createDelegate(this,this._onKeyDown);this._mouseDownHandler=Function.createDelegate(this,this._onListMouseDown);this._mouseUpHandler=Function.createDelegate(this,this._onListMouseUp);this._mouseOverHandler=Function.createDelegate(this,this._onListMouseOver);this._mouseOutHandler=Function.createDelegate(this,this._onListMouseOut);this._completionListBlurHandler=Function.createDelegate(this,this._onCompletionListBlur);this._completionListScrollHandler=Function.createDelegate(this,this._drawMissingItems);this._bodyClickHandler=Function.createDelegate(this,this._onBodyClick);this.initializeTextBox();if(this._completionListElementID!==null){this._completionListElement=$get(this._completionListElementID)}if(this._completionListElement==null){this._completionListElement=document.createElement("div");this._completionListElement.id=this.get_id()+"_completionListElem";this._getOuterEl().parentNode.insertBefore(this._completionListElement,this._getOuterEl().nextSibling)}if(this._completionListWrapperID){this._completionListWrapper=$get(this._completionListWrapperID)}else{this._completionListWrapper=this._completionListElement}this.initializeCompletionList();if(this._completionListAlwaysVisible){this._onTimerTick()}else{this._popupBehavior=$create(MySpace.UI.PopupBehavior,{id:this.get_id()+"PopupBehavior",parentElement:this._getOuterEl(),positioningMode:MySpace.UI.PositioningMode.BottomLeft},null,null,this._completionListWrapper);this._popupBehavior.add_hidden(this._popupBehaviorHiddenHandler);if(this._onShow){this._popupBehavior.set_onShow(this._onShow)}if(this._onHide){this._popupBehavior.set_onHide(this._onHide)}}},dispose:function(){if(this._popupBehavior){if(this._popupBehaviorHiddenHandler){this._popupBehavior.remove_hidden(this._popupBehaviorHiddenHandler)}this._popupBehavior.dispose();this._popupBehavior=null}this._stopTimer();if(this._completionListElement){$removeHandler(this._completionListElement,"blur",this._completionListBlurHandler);$removeHandler(this._completionListElement,"scroll",this._completionListScrollHandler);$removeHandler(this._completionListElement,"mousedown",this._mouseDownHandler);$removeHandler(this._completionListElement,"mouseup",this._mouseUpHandler);$removeHandler(this._completionListElement,"mouseover",this._mouseOverHandler);$removeHandler(this._completionListElement,"mouseout",this._mouseOutHandler)}if(this._bodyClickHandler){$removeHandler(document.body,"click",this._bodyClickHandler);this._bodyClickHandler=null}this._popupBehaviorHiddenHandler=null;this._tickHandler=null;this._focusHandler=null;this._blurHandler=null;this._keyDownHandler=null;this._completionListBlurHandler=null;this._mouseDownHandler=null;this._mouseUpHandler=null;this._mouseOverHandler=null;this._mouseOutHandler=null;MySpace.UI.AutoCompleteBehavior.callBaseMethod(this,"dispose")},_startTimer:function(){this._intervalId=window.setInterval(this._tickHandler,this._completionInterval)},_stopTimer:function(){window.clearInterval(this._intervalId)},initializeTextBox:function(){var A=this._getInnerEl();A.autocomplete="off";A.setAttribute("autocomplete","off");$addHandler(A,"focus",this._focusHandler);$addHandler(A,"blur",this._blurHandler);$addHandler(A,"keydown",this._keyDownHandler)},initializeCompletionList:function(){var B=this._completionListElement;var D=this._completionListWrapper;var C=B.style;if(this._completionListCssClass){Sys.UI.DomElement.addCssClass(B,this._completionListCssClass)}else{C.textAlign="left";C.overflow="auto";C.overflowX="hidden";C.cursor="default";C.padding="0px";C.margin="0px! important";if(Sys.Browser.agent===Sys.Browser.Safari){C.border="solid 1px gray";C.backgroundColor="white";C.color="black"}else{C.border="solid 1px buttonshadow";C.backgroundColor="window";C.color="windowtext"}if(this._completionListAlwaysVisible){if(this.get_servicePath()){C.background='url("'+MySpace.StaticContentBase+'/modules/common/static/img/loadercircles.gif") center center no-repeat'}}else{D.style.visibility="hidden"}var A=Sys.UI.DomElement.getBounds(this._getOuterEl());this._completionListElement.style.width=(this.get_completionListWidth()||Math.max(1,A.width-2))+"px"}if(this._completionListFixedHeight){C.height=this._completionListFixedHeight+"px"}$addHandler(B,"mousedown",this._mouseDownHandler);$addHandler(B,"mouseup",this._mouseUpHandler);$addHandler(B,"mouseover",this._mouseOverHandler);$addHandler(B,"mouseout",this._mouseOutHandler);$addHandler(B,"blur",this._completionListBlurHandler);$addHandler(B,"scroll",this._completionListScrollHandler);$addHandler(document.body,"click",this._bodyClickHandler)},_currentCompletionWord:function(){var E=this.get_value();var C=E;if(this.get_isMultiWord()){var D=this._getCurrentWordStartIndex();var B=this._getCurrentWordEndIndex(D);if(B<=D){C=E.substring(D)}else{C=E.substring(D,B)}}var A=this.get_triggerPrefix().toLowerCase();if(A){if(!C.toLowerCase().startsWith(A)){return""}else{return C.substring(A.length)}}else{return C}},_getCursorIndex:function(){return this.get_element().selectionStart},_getCurrentWordStartIndex:function(){var D=this.get_value().substring(0,this._getCursorIndex());var A=0;var E=-1;for(var C=0;C<this._delimiterCharacters.length;++C){var B=D.lastIndexOf(this._delimiterCharacters.charAt(C));if(B>E){E=B}}A=E;if(A>=this._getCursorIndex()){A=0}return A<0?0:A+1},_getCurrentWordEndIndex:function(A){var F=this.get_value();var E=F.substring(A);var B=0;for(var D=0;D<this._delimiterCharacters.length;++D){var C=E.indexOf(this._delimiterCharacters.charAt(D));if(C>0&&(C<B||B==0)){B=C}}return B<=0?F.length:B+A},get_isMultiWord:function(){return(this._delimiterCharacters!=null)&&(this._delimiterCharacters!="")},_getTextWithInsertedWord:function(A){var H=A;var G=0;var F=this.get_value();if(this.get_isMultiWord()){var E=this._getCurrentWordStartIndex();var C=this._getCurrentWordEndIndex(E);var B="";var D="";if(E>0){B=F.substring(0,E)}if(C>E){D=F.substring(C)}H=B+A+D}return H},_hideCompletionList:function(){if(!(this._popupBehavior&&this._popupBehavior.get_visible())){return}var A=new Sys.CancelEventArgs();this.raiseHiding(A);if(A.get_cancel()){return}this.hidePopup()},showPopup:function(){if(this._popupBehavior){this._popupBehavior.show();this.raiseShown(Sys.EventArgs.Empty)}},hidePopup:function(){if(this._popupBehavior){this._popupBehavior.hide()}else{this._popupHidden()}},_popupHidden:function(){this._completionListElement.innerHTML="";this._selectIndex=-1;this._flyoutHasFocus=false;this.raiseHidden(Sys.EventArgs.Empty)},_highlightItem:function(C){var B=this._completionListElement.childNodes;for(var A=0;A<B.length;A++){var D=B[A];if(D._highlighted){D._highlighted=false;if(this._completionListItemCssClass){Sys.UI.DomElement.removeCssClass(D,this._highlightedItemCssClass);Sys.UI.DomElement.addCssClass(D,this._completionListItemCssClass)}else{if(Sys.Browser.agent===Sys.Browser.Safari){D.style.backgroundColor="white";D.style.color="black"}else{D.style.backgroundColor="window";D.style.color="windowtext"}}this.raiseItemOut(new MySpace.UI.AutoCompleteItemEventArgs(D,D.firstChild.nodeValue,D._value))}}if(C){if(this._highlightedItemCssClass){Sys.UI.DomElement.removeCssClass(C,this._completionListItemCssClass);Sys.UI.DomElement.addCssClass(C,this._highlightedItemCssClass)}else{if(Sys.Browser.agent===Sys.Browser.Safari){C.style.backgroundColor="lemonchiffon"}else{C.style.backgroundColor="highlight";C.style.color="highlighttext"}}C._highlighted=true;if(!C._isPlaceholder){this.raiseItemOver(new MySpace.UI.AutoCompleteItemEventArgs(C,C.firstChild.nodeValue,C._value))}}},_onBodyClick:function(A){var B=A.target;while(B){if(B==this._completionListWrapper){return}B=B.parentNode}this._onCompletionListBlur(A)},_onCompletionListBlur:function(A){this._hideCompletionList()},_getCompletionItem:function(A){while(A){if(A.parentNode==this._completionListElement&&!A._isGroupHeader){return A}A=A.parentNode}},_onListMouseDown:function(B){var A=this._getCompletionItem(B.target);if(A){this._setText(A);this._flyoutHasFocus=false;B.stopPropagation()}else{this._flyoutHasFocus=true}},_onListMouseUp:function(A){if(!this._flyoutHasFocus){try{this._getInnerEl().focus()}catch(B){}}},_onListMouseOver:function(B){var A=B.target;if(A!==this._completionListElement){A=this._getCompletionItem(A);if(A){this._highlightItem(A);this._selectIndex=Array.indexOf(A.parentNode.childNodes,A)}}},_onListMouseOut:function(B){if(B.target==this._completionListElement){this._highlightItem(null)}else{var A=this._getCompletionItem(B.target);if(A&&A._highlighted){this._highlightItem(null)}}},_onGotFocus:function(A){this._textBoxHasFocus=true;if(this._flyoutHasFocus){this._hideCompletionList()}if((this._minimumPrefixLength==0)&&(!this.get_value())){this._startTimer()}},_onKeyDown:function(C){this._stopTimer();var A=C.keyCode?C.keyCode:C.rawEvent.keyCode;if(A===Sys.UI.Key.esc){if(this._popupBehavior&&this._popupBehavior.get_visible()){this._hideCompletionList();C.preventDefault();C.stopPropagation()}}else{if(A===Sys.UI.Key.up){var B=this._getAdjacentItemIndex(this._selectIndex,-1);if(B>=0){this._selectIndex=B;this._handleScroll(this._completionListElement.childNodes[B],B);this._highlightItem(this._completionListElement.childNodes[B]);C.stopPropagation();C.preventDefault()}}else{if(A===Sys.UI.Key.down){var B=this._getAdjacentItemIndex(this._selectIndex,1);if(B<this._completionListElement.childNodes.length){this._selectIndex=B;this._handleScroll(this._completionListElement.childNodes[B],B);this._highlightItem(this._completionListElement.childNodes[B]);C.stopPropagation();C.preventDefault()}}else{if(A===Sys.UI.Key.enter){if(this._selectIndex!==-1){this._setText(this._completionListElement.childNodes[this._selectIndex]);C.preventDefault();C.stopPropagation()}else{this.hidePopup()}}else{if(A===Sys.UI.Key.tab){if(this._selectIndex!==-1){this._setText(this._completionListElement.childNodes[this._selectIndex]);if(this.get_isMultiWord()){C.preventDefault();C.stopPropagation()}}}else{this._startTimer()}}}}}},_getAdjacentItemIndex:function(A,C){var B=this._completionListElement.childNodes;do{A+=C}while(A>=0&&A<B.length&&B[A]._isGroupHeader);return A},_handleScroll:function(F,E){var C=this._completionListElement,B=F.offsetHeight||0,G=F.offsetParent==C,H=G?0:C.offsetTop;var A=F.offsetTop-H+B-C.scrollTop-C.offsetHeight;if(A>0){C.scrollTop+=A}var D=C.scrollTop-F.offsetTop+H;if(D>0){C.scrollTop-=D}},_handleFlyoutFocus:function(){if(!this._textBoxHasFocus){if(!this._flyoutHasFocus){if(this._webRequest){this._webRequest.get_executor().abort();this._webRequest=null}this._hideCompletionList()}else{}}},_onLostFocus:function(){this._textBoxHasFocus=false;this._stopTimer();window.setTimeout(Function.createDelegate(this,this._handleFlyoutFocus),500)},_onMethodComplete:function(A,B){this._webRequest=null;if(this._completionListElement){this._completionListElement.style.backgroundImage=""}this._update(B,A,true)},_onMethodFailed:function(C,A,B){this._webRequest=null},_onTimerTick:function(D,C){this._stopTimer();var E=this._currentCompletionWord();if(E.trim().length<this._minimumPrefixLength){this._currentPrefix=null;this._update("",null,false);return}var A=(!this._popupBehavior||this._popupBehavior.get_visible());if((this._currentPrefix!==E||!A)||((E=="")&&(this._minimumPrefixLength==0)&&!this._webRequest)){this._currentPrefix=E;if(this._cache){var B=this._getCachedItems(E);if(B){this._update(E,B,false);return}}var C=new Sys.CancelEventArgs();this.raisePopulating(C);if(C.get_cancel()){return}this._fetchCompletionItems(E)}},_getCachedItems:function(B){if(!this._cache){return null}if(this._cache[B]){return this._cache[B]}if(this.get_enableCacheSubstrings()){for(var A in this._cache){if(B.startsWith(A)){this._completionItems=this._cache[A];return this.getCompletionItems(B)}}}return null},_fetchCompletionItems:function(C){if(this._servicePath&&(this._isJsonpService||this._serviceMethod)){var D={};D[this._postParameterName]=this._currentPrefix;if(this._serviceParams){for(var A in this._serviceParams){D[A]=this._serviceParams[A]}}if(this._useContextKey){D.contextKey=this._contextKey}if(this._isJsonpService){MySpace.Net.JsonpWebServiceProxy.invoke(this.get_servicePath(),D,Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodFailed),null,C)}else{if(this._webRequest){this._webRequest.get_executor().abort();this._webRequest=null}this._webRequest=Sys.Net.WebServiceProxy.invoke(this.get_servicePath(),this.get_serviceMethod(),false,D,Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodFailed),C)}}else{var B=this.getCompletionItems(C);if(B){this._update(C,B)}}},getCompletionItems:function(D){D=D.toLowerCase();var C=[];for(var A=0;A<this._completionItems.length;A++){var B=this._completionItems[A];if((B.text||B).toLowerCase().startsWith(D)){C.push(this._completionItems[A])}}return C},_setText:function(A){var C=null;if(A){C=A._text||(A.firstChild?A.firstChild.nodeValue:null)}this._stopTimer();var B=this._showOnlyCurrentWordInCompletionListItem?this._getTextWithInsertedWord(C):C;this.set_value(B,true);this.raiseItemSelected(new MySpace.UI.AutoCompleteItemEventArgs(A,C,A?A._value:null));this._currentPrefix=this._currentCompletionWord();this._hideCompletionList()},_update:function(E,H,J){if(J&&this.get_enableCaching()){if(!this._cache){this._cache={}}this._cache[E]=H}this._currentCompletionItems=H;if((!this._completionListAlwaysVisible&&!this._textBoxHasFocus)||(this._closeObsoleteResults&&E!=this._currentCompletionWord())){this._hideCompletionList();return}if(this._completionListAlwaysVisible||(H&&H.length)){this._completionListElement.innerHTML="";this._selectIndex=-1;var L=null,K=null,I=null,C=null,B=this._lazyLoadPlaceholderHeight;for(var D=0;D<H.length;D++){if(H[D]&&H[D].groupHeader){C=this.createGroupHeader(H[D])}else{if(B){C=document.createElement("div");C.style.height=B+"px";C._isPlaceholder=true}else{C=this.createCompletionItem(H[D]);if(L==null){L=C}}}this._completionListElement.appendChild(C)}var G=Sys.UI.DomElement.getBounds(this._getOuterEl());this._completionListElement.style.width=(this.get_completionListWidth()||Math.max(1,G.width-2))+"px";var F=new Sys.EventArgs();F.completionItems=H;F.completionListElement=this._completionListElement;this.raisePopulated(F);var A=new Sys.CancelEventArgs();this.raiseShowing(A);if(!A.get_cancel()){if(!this._completionListFixedHeight){this._completionListElement.style.height="1px"}this.showPopup();if(!this._completionListFixedHeight){this._completionListElement.style.height="";if(this._completionListElement.offsetHeight>this._completionListMaxHeight){this._completionListElement.style.height=this._completionListMaxHeight+"px"}}this._completionListElement.scrollTop=0;if(this._firstRowSelected&&(L!=null)){this._highlightItem(L);this._selectIndex=0}this._drawMissingItems()}}else{this._hideCompletionList()}},_drawMissingItems:function(){var F=this._completionListElement,D=F.childNodes[0]&&(F.childNodes[0].offsetParent==F),E=D?0:F.offsetTop,I=E+F.scrollTop-4*this._lazyLoadPlaceholderHeight,G=I+F.offsetHeight+8*this._lazyLoadPlaceholderHeight,H=F.childNodes.length,A=null;for(var C=0;C<H;C++){A=F.childNodes[C];if(A.offsetTop<I){continue}if(A.offsetTop>G){break}if(A._isPlaceholder){var B=this.createCompletionItem(this._currentCompletionItems[C]);F.replaceChild(B,A);if(this._selectIndex==-1&&this._firstRowSelected){this._highlightItem(B);this._selectIndex=C}}}},createCompletionItem:function(C){var B=document.createElement("div");var E,D;if(C&&C.text){E=C.text;D=C.value}else{E=C;D=C}var F=this._showOnlyCurrentWordInCompletionListItem?E:this._getTextWithInsertedWord(E);B.innerHTML=F;B._value=D;if(this._completionListItemCssClass){Sys.UI.DomElement.addCssClass(B,this._completionListItemCssClass)}else{var A=B.style;A.padding="0px";A.textAlign="left";A.textOverflow="ellipsis";A.cursor="pointer";if(Sys.Browser.agent===Sys.Browser.Safari){A.backgroundColor="white";A.color="black"}else{A.backgroundColor="window";A.color="windowtext"}}return B},createGroupHeader:function(C){var B=document.createElement("div");B.appendChild(document.createTextNode(C.groupHeader));B._isGroupHeader=true;if(this._groupHeaderCssClass){Sys.UI.DomElement.addCssClass(B,this._groupHeaderCssClass)}else{var A=B.style;A.fontWeight="bold";A.fontStyle="italic"}return B},_getInnerEl:function(){return this.get_element()},_getOuterEl:function(){return this.get_element()},get_value:function(){var B=this.get_element();var A=Sys.UI.Behavior.getBehaviorByName(B,"DefaultTextboxBehavior");return A?A.get_value():B.value},set_value:function(D,C){var B=this.get_element();var A=Sys.UI.Behavior.getBehaviorByName(B,"DefaultTextboxBehavior");if(A){A.set_value(D)}else{B.value=D||""}if(!C){this._onTimerTick()}},get_onShow:function(){return this._popupBehavior?this._popupBehavior.get_onShow():this._onShow},set_onShow:function(A){if(this._popupBehavior){this._popupBehavior.set_onShow(A)}else{this._onShow=A}},onShow:function(){if(this._popupBehavior){this._popupBehavior.onShow()}},get_onHide:function(){return this._popupBehavior?this._popupBehavior.get_onHide():this._onHide},set_onHide:function(A){if(this._popupBehavior){this._popupBehavior.set_onHide(A)}else{this._onHide=A}},onHide:function(){if(this._popupBehavior){this._popupBehavior.onHide()}},get_visible:function(){return this._popupBehavior&&this._popupBehavior.get_visible()},get_completionItems:function(){return this._completionItems},set_completionItems:function(A){this._completionItems=A},get_completionInterval:function(){return this._completionInterval},set_completionInterval:function(A){this._completionInterval=A},get_completionList:function(){return this._completionListElement},set_completionList:function(A){this._completionListElement=A},get_minimumPrefixLength:function(){return this._minimumPrefixLength},set_minimumPrefixLength:function(A){this._minimumPrefixLength=A},get_triggerPrefix:function(){return this._triggerPrefix},set_triggerPrefix:function(A){this._triggerPrefix=A},get_serviceMethod:function(){return this._serviceMethod},set_serviceMethod:function(A){this._serviceMethod=A},get_servicePath:function(){return this._servicePath},set_servicePath:function(A){this._servicePath=A},get_serviceParams:function(){return this._serviceParams},set_serviceParams:function(A){this._serviceParams=A},get_isJsonpService:function(){return this._isJsonpService},set_isJsonpService:function(A){this._isJsonpService=A},get_contextKey:function(){return this._contextKey},set_contextKey:function(A){this._contextKey=A;this.set_useContextKey(true)},get_useContextKey:function(){return this._useContextKey},set_useContextKey:function(A){this._useContextKey=A},get_enableCaching:function(){return this._enableCaching},set_enableCaching:function(A){this._enableCaching=A},get_enableCacheSubstrings:function(){return this._enableCacheSubstrings},set_enableCacheSubstrings:function(A){this._enableCacheSubstrings=A},get_completionListWrapperID:function(){return this._completionListWrapperID},set_completionListWrapperID:function(A){this._completionListWrapperID=A},get_completionListElementID:function(){return this._completionListElementID},set_completionListElementID:function(A){this._completionListElementID=A},get_completionListAlwaysVisible:function(){return this._completionListAlwaysVisible},set_completionListAlwaysVisible:function(A){this._completionListAlwaysVisible=A},get_completionListCssClass:function(){return this._completionListCssClass},set_completionListCssClass:function(A){this._completionListCssClass=A},get_completionListItemCssClass:function(){return this._completionListItemCssClass},set_completionListItemCssClass:function(A){this._completionListItemCssClass=A},get_completionListFixedHeight:function(){return this._completionListFixedHeight},set_completionListFixedHeight:function(A){this._completionListFixedHeight=A},get_completionListMaxHeight:function(){return this._completionListMaxHeight},set_completionListMaxHeight:function(A){this._completionListMaxHeight=A},get_completionListWidth:function(){return this._completionListWidth},set_completionListWidth:function(A){this._completionListWidth=A},get_lazyLoadPlaceholderHeight:function(){return this._lazyLoadPlaceholderHeight},set_lazyLoadPlaceholderHeight:function(A){this._lazyLoadPlaceholderHeight=A},get_groupHeaderCssClass:function(){return this._groupHeaderCssClass},set_groupHeaderCssClass:function(A){this._groupHeaderCssClass=A},get_highlightedItemCssClass:function(){return this._highlightedItemCssClass},set_highlightedItemCssClass:function(A){this._highlightedItemCssClass=A},get_delimiterCharacters:function(){return this._delimiterCharacters},set_delimiterCharacters:function(A){this._delimiterCharacters=A},get_firstRowSelected:function(){return this._firstRowSelected},set_firstRowSelected:function(A){this._firstRowSelected=A},get_showOnlyCurrentWordInCompletionListItem:function(){return this._showOnlyCurrentWordInCompletionListItem},set_showOnlyCurrentWordInCompletionListItem:function(A){this._showOnlyCurrentWordInCompletionListItem=A},get_closeObsoleteResults:function(){return this._closeObsoleteResults},set_closeObsoleteResults:function(A){this._closeObsoleteResults=A},get_postParameterName:function(){return this._postParameterName},set_postParameterName:function(A){this._postParameterName=A},add_populating:function(A){this.get_events().addHandler("populating",A)},remove_populating:function(A){this.get_events().removeHandler("populating",A)},raisePopulating:function(A){var B=this.get_events().getHandler("populating");if(B){B(this,A)}},add_populated:function(A){this.get_events().addHandler("populated",A)},remove_populated:function(A){this.get_events().removeHandler("populated",A)},raisePopulated:function(A){var B=this.get_events().getHandler("populated");if(B){B(this,A)}},add_showing:function(A){this.get_events().addHandler("showing",A)},remove_showing:function(A){this.get_events().removeHandler("showing",A)},raiseShowing:function(A){var B=this.get_events().getHandler("showing");if(B){B(this,A)}},add_shown:function(A){this.get_events().addHandler("shown",A)},remove_shown:function(A){this.get_events().removeHandler("shown",A)},raiseShown:function(A){var B=this.get_events().getHandler("shown");if(B){B(this,A)}},add_hiding:function(A){this.get_events().addHandler("hiding",A)},remove_hiding:function(A){this.get_events().removeHandler("hiding",A)},raiseHiding:function(A){var B=this.get_events().getHandler("hiding");if(B){B(this,A)}},add_hidden:function(A){this.get_events().addHandler("hidden",A)},remove_hidden:function(A){this.get_events().removeHandler("hidden",A)},raiseHidden:function(A){var B=this.get_events().getHandler("hidden");if(B){B(this,A)}},add_itemSelected:function(A){this.get_events().addHandler("itemSelected",A)},remove_itemSelected:function(A){this.get_events().removeHandler("itemSelected",A)},raiseItemSelected:function(A){var B=this.get_events().getHandler("itemSelected");if(B){B(this,A)}},add_itemOver:function(A){this.get_events().addHandler("itemOver",A)},remove_itemOver:function(A){this.get_events().removeHandler("itemOver",A)},raiseItemOver:function(A){var B=this.get_events().getHandler("itemOver");if(B){B(this,A)}},add_itemOut:function(A){this.get_events().addHandler("itemOut",A)},remove_itemOut:function(A){this.get_events().removeHandler("itemOut",A)},raiseItemOut:function(A){var B=this.get_events().getHandler("itemOut");if(B){B(this,A)}}};MySpace.UI.AutoCompleteBehavior.registerClass("MySpace.UI.AutoCompleteBehavior",Sys.UI.Behavior);MySpace.UI.AutoCompleteItemEventArgs=function(A,C,B){MySpace.UI.AutoCompleteItemEventArgs.initializeBase(this);this._item=A;this._text=C;this._value=(B!==undefined)?B:null};MySpace.UI.AutoCompleteItemEventArgs.prototype={get_item:function(){return this._item},set_item:function(A){this._item=A},get_text:function(){return this._text},set_text:function(A){this._text=A},get_value:function(){return this._value},set_value:function(A){this._value=A}};MySpace.UI.AutoCompleteItemEventArgs.registerClass("MySpace.UI.AutoCompleteItemEventArgs",Sys.EventArgs);MySpace.UI.PopupBehavior=function(A){MySpace.UI.PopupBehavior.initializeBase(this,[A]);this._x=0;this._y=0;this._positioningMode=MySpace.UI.PositioningMode.Absolute;this._parentElement=null;this._parentElementID=null;this._moveHandler=null;this._firstPopup=true;this._originalParent=null;this._visible=false;this._hideOnDocumentClick=false;this._onShow=null;this._onShowEndedHandler=null;this._onHide=null;this._onHideEndedHandler=null};MySpace.UI.PopupBehavior.prototype={initialize:function(){MySpace.UI.PopupBehavior.callBaseMethod(this,"initialize");this._hidePopup();this.get_element().style.position="absolute";this._onShowEndedHandler=Function.createDelegate(this,this._onShowEnded);this._onHideEndedHandler=Function.createDelegate(this,this._onHideEnded);$addHandler(document.body,"mousedown",Function.createDelegate(this,this._onDocumentClick))},dispose:function(){var A=this.get_element();if(A){if(this._visible){this.hide()}if(this._originalParent){A.parentNode.removeChild(A);this._originalParent.appendChild(A);this._originalParent=null}A._hideWindowedElementsIFrame=null}this._parentElement=null;if(this._onShow&&this._onShowEndedHandler){this._onShow.remove_ended(this._onShowEndedHandler)}this._onShowEndedHandler=null;this._onShow=null;if(this._onHide&&this._onHideEndedHandler){this._onHide.remove_ended(this._onHideEndedHandler)}this._onHideEndedHandler=null;this._onHide=null;MySpace.UI.PopupBehavior.callBaseMethod(this,"dispose")},show:function(){if(this._visible){return}var A=new Sys.CancelEventArgs();this.raiseShowing(A);if(A.get_cancel()){return}this._visible=true;var B=this.get_element();B.style.visibility="visible";this.setupPopup();if(this._onShow){B.style.visibility="hidden";this.onShow()}else{this.raiseShown(Sys.EventArgs.Empty)}},hide:function(){if(!this._visible){return}var A=new Sys.CancelEventArgs();this.raiseHiding(A);if(A.get_cancel()){return}this._visible=false;if(this._onHide){this.onHide()}else{this._hidePopup();this._hideCleanup()}},getBounds:function(){var D=this.get_element();var F=D.offsetParent;if(!F||(F==document.documentElement)){F=document.body}var G;var H;if(this._parentElement){H=Sys.UI.DomElement.getBounds(this._parentElement);var C=Sys.UI.DomElement.getLocation(F);G={x:H.x-C.x,y:H.y-C.y}}else{H=Sys.UI.DomElement.getBounds(F);G={x:0,y:0}}var E=D.offsetWidth-(D.clientLeft?D.clientLeft*2:0);var B=D.offsetHeight-(D.clientTop?D.clientTop*2:0);if(this._firstpopup){D.style.width=E+"px";this._firstpopup=false}var A;switch(this._positioningMode){case MySpace.UI.PositioningMode.Center:A={x:Math.round(H.width/2-E/2),y:Math.round(H.height/2-B/2)};break;case MySpace.UI.PositioningMode.BottomLeft:A={x:0,y:H.height};break;case MySpace.UI.PositioningMode.BottomRight:A={x:H.width-E,y:H.height};break;case MySpace.UI.PositioningMode.TopLeft:A={x:0,y:-D.offsetHeight};break;case MySpace.UI.PositioningMode.TopRight:A={x:H.width-E,y:-D.offsetHeight};break;case MySpace.UI.PositioningMode.Right:A={x:H.width,y:0};break;case MySpace.UI.PositioningMode.Left:A={x:-D.offsetWidth,y:0};break;default:A={x:0,y:0}}A.x+=this._x+G.x;A.y+=this._y+G.y;return new Sys.UI.Bounds(A.x,A.y,E,B)},adjustPopupPosition:function(D){var B=this.get_element();if(!D){D=this.getBounds()}var A=Sys.UI.DomElement.getBounds(B);var C=false;if(A.x<0){D.x-=A.x;C=true}if(A.y<0){D.y-=A.y;C=true}if(C){Sys.UI.DomElement.setLocation(B,D.x,D.y)}},addBackgroundIFrame:function(){var A=this.get_element();if((Sys.Browser.agent===Sys.Browser.InternetExplorer)&&(Sys.Browser.version<7)){var B=A._hideWindowedElementsIFrame;if(!B){B=document.createElement("iframe");B.src="javascript:'<html></html>';";B.style.position="absolute";B.style.display="none";B.scrolling="no";B.frameBorder="0";B.tabIndex="-1";B.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";A.parentNode.insertBefore(B,A);A._hideWindowedElementsIFrame=B;this._moveHandler=Function.createDelegate(this,this._onMove);Sys.UI.DomEvent.addHandler(A,"move",this._moveHandler)}B.style.width=A.offsetWidth+"px";B.style.height=A.offsetHeight+"px";B.style.display=A.style.display;if(A.currentStyle&&A.currentStyle.zIndex){B.style.zIndex=A.currentStyle.zIndex}else{if(A.style.zIndex){B.style.zIndex=A.style.zIndex}}}},setupPopup:function(){var A=this.get_element();var B=this.getBounds();Sys.UI.DomElement.setLocation(A,B.x,B.y);this.adjustPopupPosition(B);A.style.zIndex=1000;this.addBackgroundIFrame()},_hidePopup:function(){var A=this.get_element();A.style.visibility="hidden";if(A.originalWidth){A.style.width=A.originalWidth+"px";A.originalWidth=null}},_hideCleanup:function(){var A=this.get_element();if(this._moveHandler){Sys.UI.DomEvent.removeHandler(A,"move",this._moveHandler);this._moveHandler=null}if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var B=A._hideWindowedElementsIFrame;if(B){B.style.display="none"}}this.raiseHidden(Sys.EventArgs.Empty)},_onDocumentClick:function(B){if(!this._hideOnDocumentClick||!this._visible){return}for(var A=B.target;A;A=A.parentNode){if(A==this.get_element()){return}}this.hide()},_onMove:function(){var A=this.get_element();if(A._hideWindowedElementsIFrame){A.parentNode.insertBefore(A._hideWindowedElementsIFrame,A);A._hideWindowedElementsIFrame.style.top=A.style.top;A._hideWindowedElementsIFrame.style.left=A.style.left}},get_onShow:function(){return this._onShow},set_onShow:function(A){this._onShow=A;if(A){A.set_target(this.get_element());A.add_ended(this._onShowEndedHandler)}},onShow:function(){if(this._onShow){if(this._onHide){this._onHide.stop()}this._onShow.play()}},_onShowEnded:function(){this.adjustPopupPosition();this.addBackgroundIFrame();this.raiseShown(Sys.EventArgs.Empty)},get_onHide:function(){return this._onHide},set_onHide:function(A){this._onHide=A;if(A){A.set_target(this.get_element());A.add_ended(this._onHideEndedHandler)}},onHide:function(){if(this._onHide){if(this._onShow){this._onShow.stop()}this._onHide.play()}},_onHideEnded:function(){this._hideCleanup()},get_parentElement:function(){if(!this._parentElement&&this._parentElementID){this.set_parentElement($get(this._parentElementID))}return this._parentElement},set_parentElement:function(A){this._parentElement=A},get_parentElementID:function(){if(this._parentElement){return this._parentElement.id}return this._parentElementID},set_parentElementID:function(A){this._parentElementID=A;if(this.get_isInitialized()){this.set_parentElement($get(A))}},get_positioningMode:function(){return this._positioningMode},set_positioningMode:function(A){this._positioningMode=A},get_x:function(){return this._x},set_x:function(A){if(A!=this._x){this._x=A;if(this._visible){this.setupPopup()}}},get_y:function(){return this._y},set_y:function(A){if(A!=this._y){this._y=A;if(this._visible){this.setupPopup()}}},get_visible:function(){return this._visible},get_hideOnDocumentClick:function(){return this._hideOnDocumentClick},set_hideOnDocumentClick:function(A){this._hideOnDocumentClick=A},add_showing:function(A){this.get_events().addHandler("showing",A)},remove_showing:function(A){this.get_events().removeHandler("showing",A)},raiseShowing:function(A){var B=this.get_events().getHandler("showing");if(B){B(this,A)}},add_shown:function(A){this.get_events().addHandler("shown",A)},remove_shown:function(A){this.get_events().removeHandler("shown",A)},raiseShown:function(A){var B=this.get_events().getHandler("shown");if(B){B(this,A)}},add_hiding:function(A){this.get_events().addHandler("hiding",A)},remove_hiding:function(A){this.get_events().removeHandler("hiding",A)},raiseHiding:function(A){var B=this.get_events().getHandler("hiding");if(B){B(this,A)}},add_hidden:function(A){this.get_events().addHandler("hidden",A)},remove_hidden:function(A){this.get_events().removeHandler("hidden",A)},raiseHidden:function(A){var B=this.get_events().getHandler("hidden");if(B){B(this,A)}}};MySpace.UI.PopupBehavior.registerClass("MySpace.UI.PopupBehavior",Sys.UI.Behavior);MySpace.UI.PositioningMode=function(){throw Error.invalidOperation()};MySpace.UI.PositioningMode.prototype={Absolute:0,Center:1,BottomLeft:2,BottomRight:3,TopLeft:4,TopRight:5,Right:6,Left:7};MySpace.UI.PositioningMode.registerEnum("MySpace.UI.PositioningMode");MySpace.UI.FriendSelector=function(A){MySpace.UI.FriendSelector.initializeBase(this,[A]);this._userId=null;this._minimumPrefixLength=1;this._lazyLoadPlaceholderHeight=25;this._firstRowSelected=true;this._completionInterval=300;this._completionListItemCssClass="friendSelectItem";this._highlightedItemCssClass="friendSelectItem friendSelectHighlighted";this._groupHeaderCssClass="friendSelectHeader";this._showUserImg=true;this._showUserName=true;this._showRealName=true;this._showSelectedUserImg=true;this._selectedFriend=null;this._enableCaching=true;this._enableCacheSubstrings=true};MySpace.UI.FriendSelector.prototype={initialize:function(){MySpace.UI.FriendSelector.callBaseMethod(this,"initialize");this.addStyles();this._createSelectedFriendNode()},_createSelectedFriendNode:function(){var C=this.get_element();var E=this.wrapperDiv=document.createElement("div");var B=C.offsetWidth;E.style.width=B+"px";E.className="friendSelect";this._selectedNode=document.createElement("div");this._selectedNode.className="selected";E.appendChild(this._selectedNode);if(this.get_showSelectedUserImg()){this._selectedImage=document.createElement("img");this._selectedNode.appendChild(this._selectedImage)}this._selectedDisplayNameNode=document.createElement("div");this._selectedDisplayNameNode.className="displayName";this._selectedNode.appendChild(this._selectedDisplayNameNode);var A=document.createElement("div");A.className="close";$addHandler(A,"click",Function.createDelegate(this,this._clearSelection));this._selectedNode.appendChild(A);var D=document.createElement("div");D.style.clear="both";this._selectedNode.appendChild(D);C.parentNode.replaceChild(E,this.get_element());C.style.width=(B-2)+"px";E.appendChild(C);if(this._popupBehavior){this._popupBehavior.set_parentElement(E)}},addStyles:function(){MySpace.UI.addStyles(".friendSelect { padding:1px; background:#fff; border:1px solid #A5ACB2; width:200px; }.friendSelect input { border:none; width:100%; margin:-1px 0 0; padding-top:1px; }.friendSelect .selected { display:none; background:#BCD2E9; font-weight:bold; width:80% }.friendSelect .selected img { float:left; margin:4px 8px 0 4px; height:30px; }.friendSelect .selected .displayName { float:left; height:28px; padding:12px 0 0 4px; }.friendSelect .selected .close { float:right; height:38px; width:32px; cursor:pointer; background:url('http://x.myspacecdn.com/modules/common/static/img/friendSelectorClose.gif') center no-repeat; }.friendSelectHeader { background:#608BC1; color:#FFF; font-weight:bold; padding:2px }.friendSelectItem { padding:2px !important; border-bottom:1px solid #CCC; cursor:pointer; line-height:1.2em; }.friendSelectItem td { vertical-align:middle; }.friendSelectItem img { width:28px; height:28px; vertical-align:middle; margin-right:3px; }.friendSelectItem .prefix { background-color:#E8F1FA; font-weight:bold; }.friendSelectItem .userName { color:#999; }.friendSelectItem .realName { display:block; }.friendSelectHighlighted { background:#E8F1FA }",true,"FriendSelector")},createCompletionItem:function(D){var C=document.createElement("div");C._value=D;C._text=D.UserId;C.className="friendSelectItem";var A=D.DisplayName?this._highlightPrefix(D.DisplayName):"",E=(this._showUserName&&D.UserName&&D.UserName!=D.UserId)?("("+this._highlightPrefix(D.UserName)+")"):"",B=(this._showRealName&&D.RealName)?this._highlightPrefix(D.RealName):"";var F=this._showUserImg?String.format("<td><img src='{0}'></td>",D.ImageUri):"";C.innerHTML=String.format("<table><tr>{0}<td>{1} <span class='userName'>{2}</span> <span class='realName'>{3}</span></td></tr></table>",F,A,E,B);return C},getCompletionItems:function(E){if(!E){if(this._recentFriends&&this._recentFriends.length){return[].concat([{groupHeader:this._recentFriendsLabel}],this._recentFriends,[{groupHeader:this._allFriendsLabel}],this._completionItems)}else{return this._completionItems}}var D=E.toLowerCase().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;");var C=[],B=null;for(var A=0;A<this._completionItems.length;A++){B=this._completionItems[A];if((B.DisplayName&&B.DisplayName.toLowerCase().startsWith(D))||(this._showUserName&&B.UserName&&(B.UserName!=B.UserId)&&B.UserName.toLowerCase().startsWith(D))||(this._showRealName&&B.RealName&&B.RealName.toLowerCase().startsWith(D))){C.push(B)}}return C},addRecentFriend:function(C,A){for(var B=0;B<this._recentFriends.length;B++){if(this._recentFriends[B].UserId==C.UserId){this._recentFriends.splice(B,1);break}}this._recentFriends.unshift(C);this._recentFriends.splice(A||5)},_highlightPrefix:function(A){if(this._currentPrefix&&A.toLowerCase().startsWith(this._currentPrefix.toLowerCase())){return"<span class='prefix'>"+A.substring(0,this._currentPrefix.length)+"</span>"+A.substring(this._currentPrefix.length)}else{return A}},_setText:function(B){var A=B?B._value:null;this._selectedFriend=A;if(A){this.get_element().style.display="none";this.get_element().value=A.UserId;this._selectedNode.style.display="block";if(this.get_showSelectedUserImg()){this._selectedImage.onload=this._onImageLoad;this._selectedImage.style.visibility="hidden";this._selectedImage.src=A.ImageUri}this._selectedDisplayNameNode.innerHTML=A.DisplayName}else{this.set_value("")}this._stopTimer();this.raiseItemSelected(new MySpace.UI.AutoCompleteItemEventArgs(B,B?B._text:null,A));this._currentPrefix=this._currentCompletionWord();this._hideCompletionList()},_clearSelection:function(A){this._setText(null);this.get_element().focus()},_onImageLoad:function(A){this.style.height="";if(this.offsetWidth>30){this.style.height=Math.round(30*30/this.offsetWidth)+"px"}this.style.marginTop=(4+(30-this.offsetHeight)/2)+"px";this.style.marginRight=(8+(30-this.offsetWidth))+"px";this.style.visibility="";this.onload=null},selectFriendById:function(B){if(B){for(var A=0;A<this._completionItems.length;A++){if(this._completionItems[A].UserId==B){this._setText({_value:this._completionItems[A]});return}}}this._setText()},set_value:function(A){this.get_element().style.display="";this._selectedNode.style.display="none";this._selectedFriend=null;MySpace.UI.FriendSelector.callBaseMethod(this,"set_value")},get_showUserImg:function(){return this._showUserImg},set_showUserImg:function(A){this._showUserImg=A},get_showUserName:function(){return this._showUserName},set_showUserName:function(A){this._showUserName=A},get_showRealName:function(){return this._showRealName},set_showRealName:function(A){this._showRealName=A},get_showSelectedUserImg:function(){return this._showSelectedUserImg},set_showSelectedUserImg:function(A){this._showSelectedUserImg=A},get_selectedFriend:function(){return this._selectedFriend},get_recentFriends:function(){return this._recentFriends},set_recentFriends:function(A){this._recentFriends=A},get_recentFriendsLabel:function(){return this._recentFriendsLabel},set_recentFriendsLabel:function(A){this._recentFriendsLabel=A},get_allFriendsLabel:function(){return this._allFriendsLabel},set_allFriendsLabel:function(A){this._allFriendsLabel=A},get_userId:function(){return this._userId},set_userId:function(A){this._userId=A},get_useWebService:function(A){return !!this.get_servicePath()},set_useWebService:function(A){this.set_servicePath(A?"/Modules/Common/Services/FriendAutocomplete.asmx":null);this.set_serviceMethod(A?"GetFriends":null);this.set_serviceParams(A?{userId:this._userId}:null)},get_completionListWidth:function(){return this._completionListWidth||(this.wrapperDiv&&Math.max(1,this.wrapperDiv.offsetWidth-2))}};MySpace.UI.FriendSelector.registerClass("MySpace.UI.FriendSelector",MySpace.UI.AutoCompleteBehavior);MySpace.UI.FriendSelector.showPopup=(function(){var B,A,D,E,C;return function(F){E=F;if(B){B.show();A.set_value("");C.focus();return}var G=document.createElement("div");C=document.createElement("input");C.style.width="375px";G.appendChild(C);B=MySpace.UI.Popup.create(G,"");B.set_width(400);B.set_top(50);B.show();A=$create(MySpace.UI.FriendSelector,{useWebService:true,completionListAlwaysVisible:true,completionListFixedHeight:300,minimumPrefixLength:0},{itemSelected:function(I,H){B._hide();if(E){E(H.get_value())}}},null,C);C.focus()}})();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,ec_signup:28,ec_gameshub:29,ec_appshub:36,ec_appssearch:43,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_ignoreapp:211,em_sortfilter:212,em_culturefilter:213,em_categoryfilter:214,em_paging:215,em_search:216,em_settingspopupclick:217,em_sendmessage:227,em_updateclick:233,em_viewallclick:237,em_notificationlinkinmessageclick:241,em_notificationactionitemclick:242,em_findfriendsclick:243,em_viewmyappsclick:244};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)},InstallApplicationExWithAppParams:function(C,D,A,E,F,B,G){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"InstallApplicationExWithAppParams",false,{token:C,permissions:D,callbackParams:A,appParams:E},F,B,G)},InstallApplicationExWithAppParamsAndClickTracking:function(B,E,F,A,C,H,I,J,G,D){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"InstallApplicationExWithAppParamsAndClickTracking",false,{token:B,permissions:E,callbackParams:F,appParams:A,clickTrackingParams:C,appCookie:H,useAppCookie:I},J,G,D)},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)},BlockApplicationFromRequests:function(A,C,D,B,E){return this._invoke(MySpace.Web.Services.Apps.Apps.get_path(),"BlockApplicationFromRequests",false,{token:C,messageID:A},D,B,E)},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.InstallApplicationExWithAppParams=function(C,D,A,E,F,B,G){MySpace.Web.Services.Apps.Apps._staticInstance.InstallApplicationExWithAppParams(C,D,A,E,F,B,G)};MySpace.Web.Services.Apps.Apps.InstallApplicationExWithAppParamsAndClickTracking=function(B,G,H,A,D,I,J,F,C,E){MySpace.Web.Services.Apps.Apps._staticInstance.InstallApplicationExWithAppParamsAndClickTracking(B,G,H,A,D,I,J,F,C,E)};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.BlockApplicationFromRequests=function(A,C,D,B,E){MySpace.Web.Services.Apps.Apps._staticInstance.BlockApplicationFromRequests(A,C,D,B,E)};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"||MySpace.ClientContext.FunctionalContext=="SitesProfile"){return AppBeaconEnum.ec_profile}if(MySpace.ClientContext.FunctionalContext=="AppsSplash"){return AppBeaconEnum.ec_gallery}if(MySpace.ClientContext.FunctionalContext=="User"){return AppBeaconEnum.ec_userhome}if(MySpace.ClientContext.FunctionalContext=="ApplicationSettings"){return AppBeaconEnum.ec_appsetting}if(MySpace.ClientContext.FunctionalContext=="AppsSearch"){return AppBeaconEnum.ec_appssearch}if(MySpace.ClientContext.FunctionalContext=="AppsGame"){return AppBeaconEnum.ec_gameshub}if(MySpace.ClientContext.FunctionalContext=="Apps"){return AppBeaconEnum.ec_appshub}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.bindTrackClickEval=function(selector,context,message,detail,appid){var links=$q(selector);for(var i=0;i<links.length;i++){$addHandler(links[i],"click",function(evt){var ec=eval(context);if(typeof(ec)=="undefined"){ec=MySpace.Apps.FindContext()}MySpace.Apps.trackClick(evt.target,ec,eval(message),eval(detail),eval(appid))})}};MySpace.Apps.trackClick=function(A,C,I,E,G){if(typeof(G)=="undefined"){G=-1}else{currentAppId=G}if(typeof(E)=="undefined"){E=""}if(!MySpace.Application.keyDisabled("DWBeaconAppClicks")){var F=new Date();var H=F.getTime();var D=MySpace.ClientContext.UserId;if(typeof(MySpace.BeaconData)!="undefined"){D=MySpace.BeaconData.pid}var B=String.format("http://apps.myspace.com/Services/Apps/TrackAnalytics.asmx/TrackApp?pid={0}&userId={1}&appId={2}&eventType={3}&eventContext={4}&eventDetail={5}&time={6}&count={7}",D,parseInt(MySpace.ClientContext.UserId),parseInt(G),I,C,E,H,1);MySpace.Apps.executeUrl(B)}};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 W=U;A.set_content(W);MySpace.UI.AppsPopup.checkForHideAddButton();var V=$q("a.addapp_popup_x").length-1;$addHandler($q("a.addapp_popup_x")[V],"click",R);$addHandler($q(".addapp_popup_buttons input")[V],"click",L);$addHandler($q(".addappv2_addcanvas")[V],"click",P);$addHandler($q(".addappv2_addprofile")[V],"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)};if(!MySpace.Application.keyDisabled("Applications_KeepInstalledWhenBlocked")){J()}else{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_postToV2(M,J){ifpc_widget_postTo_data=M;ifpc_widget_postTo_data.callback=J;var H=false;for(var E=0;E<ifpc_supported_postto_targets.length;E++){if(ifpc_supported_postto_targets[E]===ifpc_widget_postTo_data.post_type){H=true;break}}if(H){var C="/Modules/MDPPostTo/Pages/MDPPostTo.aspx?opensocial_token="+ifpc_widget_postTo_data.os_token+"&p=MDPPostTo",B="appspopup_pt_";switch(ifpc_widget_postTo_data.post_type){case"PROFILE":C+="Profile";B+="pro";break;case"SEND_MESSAGE":C+="SendMessage";B+="send";break;case"COMMENTS":C+="Comment";B+="comm";break;case"BULLETINS":C+="Bulletin";B+="bull";break;case"BLOG":C+="Blog";B+="blog";break;case"SHARE_APP":C+="AppInvite";B+="appinvite";break;case"ACTIVITY":C+="Activity";B+="act appspopup_pt_act_width";break;case"PHOTOS":C+="Photos&albumId="+content;B+="photos";break;case"APP_MESSAGE":C+="AppMessage";C+="&recipientlist="+encodeURI(ifpc_widget_postTo_data.appMessageParams.recipients);B+="appmessage";break}function I(N){return null===N||"undefined"===typeof(N)}if(I(ifpc_widget_postTo_data.opt_recipientImage)&&I(ifpc_widget_postTo_data.opt_recipientName)&&typeof(ifpc_widget_postTo_data.opt_recipientId)==="string"){C+="&ids="+ifpc_widget_postTo_data.opt_recipientId}if(ifpc_widget_postTo_data.post_type=="ACTIVITY"){var C="/Modules/MDPPostTo/Pages/MDPPopup.aspx?opensocial_token="+ifpc_widget_postTo_data.os_token+"&p=MDPPostToActivity",B="appspopup_pt_";PostToPopupV2("_onPostToComplete",ifpc_widget_postTo_data.app_id,C)}else{if("appspopup_pt_"!==B){var A=document.getElementById("post_to_container");if(A){var D=document.getElementById("post_to_iframe");if(D&&B!==D.className){A.parentNode.removeChild(A);ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",B)}else{if(C.indexOf("&ids=")>=0){var L=ifpc_widget_iframe_popup._iFrameSrc;if(ifpc_widget_iframe_popup&&L.indexOf("&ids=")>=0){var K=L.substr(L.indexOf("&ids=")).split("&")[1];var F=C.substr(C.indexOf("&ids=")).split("&")[1];if(F!==K){A.parentNode.removeChild(A);ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",B)}}}}}else{ifpc_widget_iframe_popup=new MySpace.UI.IframePopup("post_to_container","","post_to_iframe",C,"appspopup_box_pt",B)}if(ifpc_widget_postTo_data.post_type=="APP_MESSAGE"&&ifpc_widget_iframe_popup._iFrameSrc!=C){ifpc_widget_iframe_popup._iFrameSrc=C}ifpc_widget_iframe_popup.show();if(document.getElementById("post_to_container")){document.getElementById("post_to_container").style.position="absolute";var G=0;if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){G=document.body.scrollTop}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){G=document.documentElement.scrollTop}}document.getElementById("post_to_container").style.top=125+G+"px"}}}}}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";break;case"APP_MESSAGE":C+="AppMessage";R+="appmessage";break}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"}}}}}var ifpc_widget_AddToFriends_data={};function ifpc_addFriend(B,A){ifpc_widget_AddToFriends_data=B;ifpc_widget_AddToFriends_data.callback=A;MySpace.UI.AddFriendPopup.show({friendId:B.friendId,preventDefault:false})}_IFPC.registerService("postTo",ifpc_widget_postTo);_IFPC.registerService("postToV2",ifpc_widget_postToV2);_IFPC.registerService("addFriend",ifpc_addFriend);_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(){};
