var WebIM=WebIM||{};WebIM.Config=WebIM.Config=WebIM.Config||{};WebIM.Config.defaultImageURL="http://x.myspace.com/images/no_pic.gif";WebIM.Config.GET_FIREFOX_URL="http://mozilla.com/firefox";WebIM.Config.UPGRADE_IE_URL="http://www.microsoft.com/windows/ie/default.mspx";WebIM.Config.MIM_WHOIS_SERVER=WebIM.Config.MIM_WHOIS_SERVER||WebIM.Config.WIMAPP_SERVER;WebIM.Config.MIM_HOST=WebIM.Config.WIMAPP_REQUESTBASE.substring("http://".length);WebIM.Config.WIM_API_VERSION="v1";WebIM.Config.DEFAULT_FORMAT="json";WebIM.Config.devSubDomainRange=10;WebIM.Config.prodSubDomainRange=500;WebIM.Config.MAX_CONV_HISTORY=10;WebIM.Config.TYPING_STATUS_STOP_DELAY=7000;WebIM.Config.TYPING_STATUS_STOP_EMPTY_DELAY=3000;WebIM.Config.MSSESSION_COOKIE="MSSession";WebIM.Config.MSCULTURE_COOKIE="MSCulture";WebIM.Config.HOST_COOKIE="WIMHOSTNAME";WebIM.Config.ReservedWindows={FRIENDS_LIST:0,CONSOLE:-10,POPOUT:-20};WebIM.Config.STATE_COOKIE="WIMIMSTATE";WebIM.Config.MESSAGE_RESOURCE="message";WebIM.Config.CONTACT_LIST_RESOURCE="contactlist";WebIM.Config.BLOCK_LIST_RESOURCE="blocklist";WebIM.Config.EVENTS_RESOURCE="events";WebIM.Config.HISTORY_RESOURCE="history";WebIM.Config.WINDOW_STATE_RESOURCE="windowstate";WebIM.Config.IM_SETTINGS_RESOURCE="settings";WebIM.Config.HELP_MESSAGE_RESOURCE="helpmessage";WebIM.Config.PRIVACY_SETTINGS_RESOURCE="privacySettings";WebIM.Config.PRESENCE_RESOURCE="presence";WebIM.Config.TYPING_STATUS_RESOURCE="typingstatus";WebIM.Config.STATUS_MOODS_RESOURCE="statusmoods";WebIM.Config.INDICATORS_RESOURCE="indicators";WebIM.Config.RESTActions={CREATE:"c",RETRIEVE:"r",UPDATE:"u",DELETE:"d"};WebIM.Config.WHOIS_URI=WebIM.Config.MIM_WHOIS_SERVER+"/api/"+WebIM.Config.WIM_API_VERSION+"/whois."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.EVENTS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.EVENTS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.MESSAGE_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.MESSAGE_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.CONTACT_LIST_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.CONTACT_LIST_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.BLOCK_LIST_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.BLOCK_LIST_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.HISTORY_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.HISTORY_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.WINDOW_STATE_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.WINDOW_STATE_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.IM_SETTINGS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.IM_SETTINGS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.HELP_MESSAGE_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.HELP_MESSAGE_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.PRIVACY_SETTINGS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.PRIVACY_SETTINGS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.PRESENCE_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.PRESENCE_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.TYPING_STATUS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.TYPING_STATUS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.STATUS_MOODS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.STATUS_MOODS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.INDICATORS_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/"+WebIM.Config.INDICATORS_RESOURCE+"."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.SIGNOUT_URI="/api/"+WebIM.Config.WIM_API_VERSION+"/signout."+WebIM.Config.DEFAULT_FORMAT;WebIM.Config.friendTabNameLength=10;WebIM.Config.chatWindowNameLength=14;WebIM.Config.conversationNameLength=11;WebIM.Config.friendsListItemNameLength=13;WebIM.Config.conversationListItemNameLength=15;WebIM.Config.conversationDisplayNameLength=35;WebIM.Config.rteBottomBuffer=177;WebIM.Config.MIMSTATE_COOKIE="WIMSTATE";WebIM.Config.MIMDISABLED_COOKIE="WEBIMDISABLED";WebIM.Config.showDebugMenus=0;WebIM.Config.Debug=0;WebIM.Config.WindowStates={CLOSE:"Close",MINIMIZE:"Minimize",OPEN:"Open"};WebIM.Config.PresenceTypes={ONLINE:"online",OFFLINE:"offline",HIDDEN:"hidden",IDLE:"idle"};WebIM.Config.PresenceEnums={online:0,offline:1,hidden:2,idle:3};WebIM.Config.FriendGroups={CONTACT:"RegularContact",RECENT:"RecentContact",NON_CONTACT:"NonContact"};WebIM.Config.ConsoleStates={COLLAPSED:"COLLAPSED",COLLAPSED_OFFLINE:"COLLAPSED_OFFLINE",POPPED_OUT:"POPPED_OUT",OFFLINE:"OFFLINE",DEFAULT:"DEFAULT",LOADING:"LOADING",COLLAPSED_LOADING:"COLLAPSED_LOADING",UNAVAILABLE:"UNAVAILABLE",COLLAPSED_UNAVAILABLE:"COLLAPSED_UNAVAILABLE",LOGGED_IN_OTHER_LOCATION:"LOGGED_IN_OTHER_LOCATION",COLLAPSED_LOGGED_IN_OTHER_LOCATION:"COLLAPSED_LOGGED_IN_OTHER_LOCATION",NOT_SUPPORTED:"NOT_SUPPORTED",COLLAPSED_NOT_SUPPORTED:"COLLAPSED_NOT_SUPPORTED"};WebIM.Config.PopoutStates={OFFLINE:"OFFLINE",ONLINE:"ONLINE",LOADING:"LOADING",UNAVAILABLE:"UNAVAILABLE",LOGGED_IN_OTHER_LOCATION:"LOGGED_IN_OTHER_LOCATION",HIDDEN:"HIDDEN"};WebIM.Config.Sounds={MESSAGE_RECEIVED:"MESSAGE_RECEIVED",NEW_ONLINE_FRIEND:"NEW_ONLINE_FRIEND"};WebIM.Config.Sender={NONE:"none",USER:"user",BUDDY:"buddy"};WebIM.Config.SenderDateTimeFlag={SHOW_NAME_AND_TIME:1,SHOW_DATE:2};WebIM.Config.flashVersion="9.0.28";WebIM.Config.noPicURL=WebIM.Config.staticImageRoot+"no_pic.gif";WebIM.Config.ifpcRelayURL=location.protocol+"//"+location.host+WebIM.Config.ifpcRelayPath+"?feature=webim";if(WebIM.Config.ifpcScriptURL&&WebIM.Config.ifpcScriptURL.search(/http:\/\//)==-1){WebIM.Config.ifpcScriptURL=WebIM.Config.dotNetBaseURL+WebIM.Config.ifpcScriptURL}if(WebIM.Config.jsonScriptURL&&WebIM.Config.jsonScriptURL.search(/http:\/\//)==-1){WebIM.Config.jsonScriptURL=WebIM.Config.dotNetBaseURL+WebIM.Config.jsonScriptURL}WebIM.Config.friendAttributeSortKey="name";WebIM.Config.BACKSPACE_KEY=8;WebIM.Config.ENTER_KEY=13;WebIM.Config.SHIFT_KEY=16;WebIM.Config.DELETE_KEY=46;WebIM.Config.maxMessageLength=1000;var WebIM=WebIM||{};WebIM.Util=WebIM.Util||{};WebIM.Util.WindowState=function(A,C,B){if(A==undefined||A==null){return}this.id=A;this.state=C;this.index=parseInt(B);if(isNaN(this.index)){this.index=-1}};WebIM.Util.getWindowWidth=function(){return(browser.isIE&&document.compatMode=="BackCompat")?document.body.clientWidth:document.documentElement.clientWidth};WebIM.Util.getRelativePosition=function(A,F){var E=0;var D=0;var C=A;while(C.nodeName.search(/body/i)==-1){var B=Sys.UI.DomElement.getBounds(C);E+=B.x;D+=B.y;if(C==F){break}return{top:D,left:"left"}}};WebIM.Util.getPosition=function(A){var B=Sys.UI.DomElement.getLocation(A);return{left:B.x,top:B.y}};WebIM.Util.getTotalDimensions=function(C){var H=Sys.UI.DomElement.getBounds(C);var E=H.width;var A=H.height;var G="margin,margin,padding,padding,borderWidth,borderWidth".split(",");var F=function(I){return C.style[I]&&C.style[I].search(/\d+/)!=-1?parseInt(C.style[I]):0};for(var B=G.length-1;B>=0;B--){var D=G[B];E+=F(D+"Left");E+=F(D+"Right");A+=F(D+"Top");A+=F(D+"Bottom")}return{width:E,height:A}};WebIM.Util.setStyles=function(B,C){if(!B||!B.style||!C){return this}for(var A in C){B.style[A]=C[A]}return this};WebIM.Util.setAttributes=function(C,A){if(!C||!A){return this}for(var B in A){C[B]=A[B]}return this};WebIM.Util.addCssClass=function(B,C){if(!B||!C){return}var A=B.className;if(!A||A.length==0){B.className=C;return}else{B.className+=" "+C}};WebIM.Util.removeCssClass=function(D,E){if(!D||!E){return}var C=D.className;if(!C||C.length==0){return}else{if(C.indexOf(E)==-1){return}else{var A=C.split(" ");var B=0;C="";for(B=0;B<A.length;B++){if(E!=A[B]){C+=A[B];if(B<A.length-1){C+=" "}}}D.className=C}}};WebIM.Util.attachEvent=function(B,A,C){if(!B||!C){return}if(B.addEventListener){B.addEventListener(A,C,false)}else{if(B.attachEvent){B.attachEvent("on"+A,C)}else{WebIM.Util.error("event attach not supported")}}};WebIM.Util.stopEventBubble=function(A){A.cancelBubble=true;if(A.stopPropagation){A.stopPropagation()}};WebIM.Util.createElement=function(A,D,E){D=D?D:document;try{if(!D.createElement){return null}var B=D.createElement(A);if(E){if(E.id){B.id=E.id}if(E.content){B.innerHTML=E.content}if(E.className){B.className=E.className}}return B}catch(C){return null}};WebIM.Util.createIframe=function(D,F,B,A,G,H){var E;var I=(Math.random()+"").replace(/\./,"");if(typeof B=="function"){WebIM.Util._frameOnloadCallbacks[I]=B;var C=WebIM.Util.createElement("div",G);C.innerHTML='<iframe name="'+I+'" SCROLLING="auto" onload="WebIM.Util._onFrameLoaded.call(this, null)" '+(H?"ALLOWTRANSPARENCY=true":"")+"></iframe>";E=C.getElementsByTagName("iframe")[0];C.removeChild(E);C=null}else{E=WebIM.Util.createElement("iframe",G)}if(D){E.src=D}if(F){E.style.display="none"}return E};WebIM.Util._onFrameLoaded=function(A){var B=WebIM.Util._frameOnloadCallbacks[this.name];this.onload=null;if(typeof B=="function"){B.call(this,null)}};WebIM.Util._frameContentCallbacks={};WebIM.Util._frameOnloadCallbacks={};WebIM.Util.appendQueryParam=function(A,B,C,E){if(!A){return null}var D;if(E){D=A.search(/#/)!=-1?"&":"#"}else{D=A.search(/\?/)!=-1?"&":"?"}return A+D+B+"="+C};WebIM.Util.createParamString=function(A){var B="";for(var C in A){B+=C+"="+A[C]+"&"}return B.length>=1?B.substr(0,B.length-1):B};WebIM.Util.search=function(B,D,F){var E=B.childNodes.length;var A=-1;var C;while(E-A>1){if(B.childNodes[C=E+A>>1][F]<D[F]){A=C}else{E=C}}return B.childNodes[E]};WebIM.Util.insert=function(B,C,D){var A=WebIM.Util.search(B,C,D);if(A){B.insertBefore(C,A)}else{B.appendChild(C)}};WebIM.Util._pulsing={};WebIM.Util.alert=function(C,E,D,B,G){if(WebIM.Util._pulsing[C]){return}WebIM.Util._pulsing[C]=true;var F=0;var G=typeof G==0?G:7;var A=function(){if(++F%2){E()}else{D()}if(F>=G){clearInterval(WebIM.Util._pulsing[C]);WebIM.Util._pulsing[C]=false;typeof B=="function"?B():E()}};WebIM.Util._pulsing[C]=setInterval(A,700)};WebIM.Util.stopAlert=function(A){clearInterval(WebIM.Util._pulsing[A]);WebIM.Util._pulsing[A]=false};WebIM.Util.alertIsPulsing=function(A){return WebIM.Util._pulsing[A]};WebIM.Util.getGeneralizedDomain=function(){var B=document.domain;if(B[B.length-1]!=="."){var A=B.split(".");if(A.length>=2){return A[A.length-2]+"."+A[A.length-1]}}return B};WebIM.Util.useNoPicImage=function(A){A.onerror="";A.src=WebIM.Config.noPicURL};WebIM.Util._onReady=function(){if(WebIM&&WebIM.Manager&&typeof WebIM.Manager.init=="function"){WebIM.Manager.init()}WebIM.Util.ready=true;if(document.addEventListener){document.removeEventListener("DOMContentLoaded",WebIM.Util._onReady,false)}};WebIM.Util.bindReady=function(){if(WebIM.Util.readyBound){return}WebIM.Util.readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",WebIM.Util._onReady,false);return}if(browser.isIE&&window==top){(function(){try{document.documentElement.doScroll("left")}catch(B){setTimeout(arguments.callee,0);return}WebIM.Util._onReady()})()}if(browser.isSafari){var A;(function(){if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return}if(A==="undefined"){var C=document.getElementsByTagName("link");for(var D=0,B=C.length;D<B;D++){if(C[D].rel=="stylesheet"){A++}}var E=document.getElementsByTagName("style");A+=E.length}if(document.styleSheets.length!=A){setTimeout(arguments.callee,0);return}WebIM.Util._onReady()})()}$addHandler(window,"load",WebIM.Util._onReady)};if(window.loadWebIMBeforeWindowLoad||WebIM.Popout){WebIM.Util.bindReady()}else{$addHandler(window,"load",function(){setTimeout(WebIM.Util._onReady,1)})}WebIM.Util.toHex=function(B){try{B=parseInt(B);return B.toString(16)}catch(A){}};WebIM.Util.conversationSortFunc=function(B,A){return B.index>A.index?1:-1};String.prototype.format=function(){var B=/\{\d+\}/g;var A=arguments;return this.replace(B,function(C){return A[C.match(/\d+/)]})};WebIM.Util.getLocalTimeMinFormat=function(A){var B=new Date(A);return B.format(WebIM.Strings.TIMESTAMP_MIN_FORMAT)};WebIM.Util.getLocalDateOnly=function(A){var B=new Date(A);return B.format(WebIM.Strings.TIMESTAMP_DATE_ONLY)};WebIM.Util.getLocalTimeFullFormat=function(A){var B=new Date(A);return B.format(WebIM.Strings.TIMESTAMP_FULL_FORMAT)};WebIM.Util.getLocalTimeLongFormat=function(A){var B=new Date(A);return B.format(WebIM.Strings.TIMESTAMP_LONG_FORMAT)};WebIM.Util.createLimit=function(B,A){if(B.length>A){newText=B.substring(0,A)+"&hellip;";return newText}return B};WebIM.Util.addEllipsis=function(B,A){if(browser&&browser.isGecko&&B.length>A){return B.substring(0,A)+"..."}return B};WebIM.Util.Log={info:function(A){if(typeof console!="undefined"&&typeof console.log=="function"&&WebIM.Config.Debug){console.log(A)}if(WebIM.Config.Debug&&WebIM.Util.DebugConsole){WebIM.Util.DebugConsole.logInfo(A)}},error:function(A){if(typeof console!="undefined"&&typeof console.error=="function"&&WebIM.Config.Debug){console.error(A)}if(WebIM.Config.Debug&&WebIM.Util.DebugConsole){WebIM.Util.DebugConsole.logError(A)}}};WebIM.Util.log=WebIM.Util.Log.info;WebIM.Util.error=WebIM.Util.Log.error;WebIM.Util.toggleDebug=function(){if(WebIM.Config.Debug){WebIM.Config.Debug=false}else{WebIM.Config.Debug=true}if(WebIM.Util.DebugConsole){WebIM.Util.DebugConsole.toggleVisible()}if(WebIM.Config.Debug){window.setTimeout(function(){WebIM.Util.log("Debug Console Enabled")},200)}};WebIM.Util.Cookie={delim:"&",setMVCookieValue:function(C,A,B){if(MySpace.Cookies[C]){MySpace.Cookies[C].get_values()[A]=B;MySpace.Cookies.save(MySpace.Cookies.MSSession,WebIM.Config.COOKIE_DOMAIN)}else{MySpace.Cookies.save(new MySpace.Cookie(C,A+"="+B),WebIM.Config.COOKIE_DOMAIN)}},getMVCookieValue:function(C,B){var A=null;if(MySpace.Cookies[C]){A=MySpace.Cookies[C].get_values()[B]}return A},_defaultStateCookie:["DEFAULT","0","ONLINE","","","",0,"","","",""],_saveUIState:function(A,C){if(!WebIM.Config.genConsoleFromS&&A>0){return}var B=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);if(B&&B.indexOf("|")==-1){B=decodeURI(B)}B=B?B.split("|"):this._defaultStateCookie;if(B.length<this._defaultStateCookie.length){B=this._defaultStateCookie}B[A]=C;B=B.join("|");WebIM.Util.Cookie.setMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE,B)},getUIState:function(A){var B=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);return B?unescape(B).split("|")[A]:null},saveConsoleState:function(A){this._saveUIState(0,A)},getConsoleState:function(){var A=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);return A?unescape(A).split("|")[0]:null},saveFriendCount:function(A){this._saveUIState(1,A)},getFriendCount:function(){return this.getUIState(1)},saveViewerPresence:function(A){this._saveUIState(2,WebIM.Config.PresenceEnums[A.toLowerCase()])},saveFriends:function(D){if(MySpace.Application.keyDisabled("WebIMTabsGenerateFromServer")){return}var F=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);F=F?F.split("|"):[];var H=origFriendsCookie=F[3]?F[3]:"";for(var C=0,B=D.length;C<B;C++){var E=D[C];var G=this._getFriend(E.id,F);if(G){var A=this._getFriendStr(E);if(G.replace(/(^,|,$)/g,"")!=A){H=H.replace(G,A)}}else{H=H+this._getFriendStr(E)+","}}if(H&&H!=origFriendsCookie){this._saveUIState(3,H)}},removeFriend:function(A){if(MySpace.Application.keyDisabled("WebIMTabsGenerateFromServer")){return}var B=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);B=B?B.split("|"):[];var C=this._getFriend(A,B);if(C){var D=B[3].replace(C+",","");this._saveUIState(3,D)}},updateFriend:function(A){if(A&&this._getFriend(A.id)){this.saveFriends([A])}},removeFriends:function(){this._saveUIState(3,"")},_getFriend:function(B,D){if(!D){D=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);D=D?D.split("|"):null}var E;if(D&&D[3]){var F=D[3];F=F.split(",");B=WebIM.Util.toHex(B);for(var C=0,A=F.length;C<A;C++){if(F[C].indexOf(B)==0){return F[C]}}}return E},_getFriendStr:function(A){var B=WebIM.Util.toHex(A.id);return B+"#"+encodeURIComponent(A.getDisplayName(WebIM.Config.friendTabNameLength))+"#"+WebIM.Config.PresenceEnums[A.presence.toLowerCase()]+"#"+(A.tab.alerted?"1":"0")+"#"+((WebIM.Conversation.active&&(WebIM.Conversation.active.friend===A))?"1":"0")},saveConversationPosition:function(B,A){if(MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){return}this._saveUIState(4,B+"#"+A)},getConversationPosition:function(){return this.getUIState(4)},removeConversationPosition:function(){this._saveUIState(4,"")},saveShiftButtonState:function(E,D,F,C,G,A){if(MySpace.Application.keyDisabled("WebIMTabsGenerateFromServer")){return}if(E){E=parseInt(E)}if(C){C=parseInt(C)}var B=E+"#"+(D?"1":"0")+"#"+F+"#"+C+"#"+(G?"1":"0")+"#"+A;this._saveUIState(5,B)},removeShiftButtonState:function(){this._saveUIState(5,"")},saveFriendsListState:function(A){if(MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){return}this._saveUIState(6,A?1:0)},isFriendsListOpen:function(){return this.getUIState(6)=="1"?true:false},_history:[],saveHistory:function(D){if(MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){return}if(D){this._history=D}var H="";var J=[];for(var F=0,C=this._history.length;F<C;F++){var B=(this._history[F].fromFriend?"1":"0")+":"+WebIM.Util.toHex(this._history[F].utc)+":"+encodeURIComponent(this._history[F].message);J.push(B)}var G=null;while(J.join(",").length>300||J.length>WebIM.Config.MAX_CONV_HISTORY){G=this._history.shift();J.shift()}if(this._history.length>0){if(G!=null){var I=0;var A=new Date(G.utc);var E=new Date(this._history[0].utc);if(G.fromFriend!=this._history[0].fromFriend){I|=WebIM.Config.SenderDateTimeFlag.SHOW_NAME_AND_TIME}if(WebIM.Util.getLocalDateOnly(G.utc)!=WebIM.Util.getLocalDateOnly(this._history[0].utc)){I|=WebIM.Config.SenderDateTimeFlag.SHOW_NAME_AND_TIME;I|=WebIM.Config.SenderDateTimeFlag.SHOW_DATE}if(E.getUTCSeconds()-A.getUTCSeconds()>WebIM.Config.displayTimestampDelayInSeconds){I|=WebIM.Config.SenderDateTimeFlag.SHOW_NAME_AND_TIME}J[0]=(this._history[0].fromFriend?"1":"0")+":"+WebIM.Util.toHex(this._history[0].utc)+":"+encodeURIComponent(this._history[0].message)+":"+I}H=this._history[0].ts+","+J.join(",");this._saveUIState(7,H)}},getLastMessageTS:function(){if(MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){return 0}var B=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMSTATE_COOKIE);var A=0;if(B){B=B.split("|");A=B.length>7&&B[7]?parseInt(B[7]):0}return A},removeConversationHistory:function(){if(MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){return}if(WebIM.Manager.firstEventsResponse){return}this._history=[];this._saveUIState(7,"")},getServerErrorTimeout:function(){var A=this.getUIState(8);A=A?A.split("#"):null;if(A&&A.length>=2&&A[0].search(/^\d/)!=-1&&A[1].search(/^\d/)!=-1){A[0]=parseInt(A[0]);A[1]=parseInt(A[1])}else{A=null}return A},setServerErrorTimeout:function(B,C){var A=B+"#"+C;this._saveUIState(8,A)},saveHideHelpMessage:function(A){this._saveUIState(9,A)},saveIndicator:function(A){this._saveUIState(10,A)},getIndicatorFromCookie:function(){return this.getUIState(10)}};WebIM.PrivacySettings={privacy:null,PrivacyTypes:{Everyone:"e",FriendsOnly:"fo",ContactsOnly:"clo",NoOne:"no"},init:function(){WebIM.API.retrievePrivacySettings(this.retrieveCallback)},retrieveCallback:function(A){if(A.statusCode==200){this.update(A.privacy)}},update:function(A){switch(A){case"e":this.privacy=this.PrivacyTypes.Everyone;break;case"fo":this.privacy=this.PrivacyTypes.FriendsOnly;break;case"clo":this.privacy=this.PrivacyTypes.ContactsOnly;break;case"no":this.privacy=this.PrivacyTypes.NoOne;break;default:break}}};WebIM.Settings={idle:WebIM.Config.defaultIdleTime,popNewIM:0,soundNewIM:0,popOnline:0,soundOnline:0,hideHelpMsg:0,indicators:0,soundIndicators:0,update:function(A){this.idle=this.idle=parseInt(A.idle,10);this.popNewIM=this.popNewIM=A.popNewIM;this.soundNewIM=this.soundNewIM=A.soundNewIM;this.popOnline=this.popOnline=A.popOnline;this.soundOnline=this.soundOnline=A.soundOnline;this.enabled=!!A.enabled;this.hideHelpMsg=!!A.hideHelpMsg;this.indicators=A.indicators;this.soundIndicators=A.soundIndicators}};WebIM.Urls={getReportAbuseUrl:function(B){var C;var A=WebIM.Config.reportAbuseURL;var E=A.indexOf("//");if(-1==E){C=WebIM.Config.WIMAPP_SERVER+A}else{var F=A.indexOf("/",E+2);if(-1==F){throw"Bad URL for reportAbuse"}else{C=WebIM.API.wimHostName+A.substring(F)}}var D=WebIM.Urls.urlEncode(document.location);C+="?ru="+B+"&p="+D;return C},getStaticImageUrl:function(A){return WebIM.Config.staticImageRoot+A},urlEncode:function(A){return escape(A).replace(/\+/g,"%2B").replace(/%20/g,"+").replace(/\*/g,"%2A").replace(/\//g,"%2F").replace(/@/g,"%40")},urlDecode:function(A){return unescape(A.replace("+"," ","g"))}};WebIM.API={WIMAPP_LOOP_TIMEOUT:32*1000,MAX_POLL_WAIT:45*1000,WIMAPP_UNAVAILABLE_TIMEOUT:30*1000,NEXT_RETRY:-1,NUMBER_OF_RETRIES:0,MAX_RETRIES:7,WIMAPPHOST_COOKIE:"WIMAPPHOST",STICKY_SERVER_KEY:"WIMHOSTNAME",TOTAL_SERVERS:420,MAX_WIMAPP_SERVER_NUM_TO_IGNORE:200,wimHostName:null,forceEventsRequest:false,lastEventsRequest:null,requestsBelowOneSecond:0,eventRetries:0,_rateProtectedFunctions:{retrieveEvents:{lastCall:null,callsBelowOneSecond:0},jsonpRequest:{lastCall:null,callsBelowOneSecond:0},init:{lastCall:null,callsBelowOneSecond:0}},offline:false,activity:false,_currentXHR:null,ID:(Math.random()*10000000000000000),STATES:{C:"C",D:"D",U:"U"},_initCookieDomain:function(){var C=document.location.host;var B=C.lastIndexOf(".");if(-1==B){WebIM.Config.COOKIE_DOMAIN="."+C}else{var A=C.substring(0,B).lastIndexOf(".");if(A>-1){WebIM.Config.COOKIE_DOMAIN=C.substring(A)}else{WebIM.Config.COOKIE_DOMAIN="."+C}}WebIM.Util.log("Cookie domain set: "+WebIM.Config.COOKIE_DOMAIN)},errorTimeout:1,state:"D",connected:false,initialized:false,initCalled:false,pendingRequests:[],adviseTS:0,initializationTimeout:0,init:function(H,F){if(this._killFunction("init")){this._onServerError("Rate limit reached on WebIM.API.init requests.  Maybe due to issue w/ who is request.",true);return}this._optOnReadyCallback=this._optOnReadyCallback?this._optOnReadyCallback:F;this._eventsCallback=H?function(K){try{H(K)}catch(L){WebIM.Util.log(L)}}:this._eventsCallback;if(!WebIM.Config.COOKIE_DOMAIN){WebIM.API._initCookieDomain()}var E=WebIM.Util.Cookie.getServerErrorTimeout();if(E){var J=E[0];this.NUMBER_OF_RETRIES=E[1];var B=(new Date()).getTime();if(J>B||this.NUMBER_OF_RETRIES>=this.MAX_RETRIES){var I=J-B;this._onServerError("Client not ready to initialize yet.  Sleeping.",true,I);return}}var A=this._getAJAXHost();if(!A&&WebIM.Config.wimappServerName){WebIM.API.whoIsCallback({wimHost:WebIM.Config.wimappServerName});return}if(!A){var G=WebIM.Config.WHOIS_URI+"?callback=MIMWhoIsCallback";this.jsonpRequestTimeout=setTimeout(function(){var K=Math.ceil(Math.random()*(WebIM.API.TOTAL_SERVERS-WebIM.API.MAX_WIMAPP_SERVER_NUM_TO_IGNORE))+WebIM.API.MAX_WIMAPP_SERVER_NUM_TO_IGNORE;K=K+"";while(K.length<4){K="0"+K}K="webim"+K;WebIM.API.whoIsCallback({wimHost:K})},2000);this.jsonpRequest(G);return}else{if(!WebIM.Config.devUseSameStickyHost){var D;if(A.toLowerCase().search(/^http:\/\/webim\d{4}/)!=-1){D=WebIM.Config.prodSubDomainRange}else{D=WebIM.Config.devSubDomainRange}this.wimHostName=A.replace(/http:\/\//,"http://"+Math.floor(Math.random()*D)+".")}else{this.wimHostName=A}}WebIM.Util.log("(init) Ajax Host: "+this.wimHostName);if(this.initCalled&&this.initialized){return}var C=function(){if(!WebIM.API.activity){WebIM.API.onActive()}WebIM.API.activity=true};if(!this.initCalled){$addHandlers(document.body,{keydown:C,mousedown:C})}this.initCalled=true;this._createAJAXIframe()},_resetAjaxHost:function(){this._setAJAXHost("");this.initialized=false;WebIM.API.init()},onActive:function(){},_removeAjaxFrame:function(){if(this._ajaxIframe){this._ajaxIframe.onload=null;document.body.removeChild(this._ajaxIframe);this._ajaxIframe=null}},_createAJAXIframe:function(){this.state="U";this._removeAjaxFrame();var B=WebIM.API._buildAjaxFrameUrl();if(!WebIM.Manager.domainGeneralized){B=WebIM.Util.appendQueryParam(B,"loadifpc",true);B=WebIM.Util.appendQueryParam(B,"jsonscripturl",WebIM.Config.jsonScriptURL);B=WebIM.Util.appendQueryParam(B,"ifpcscripturl",WebIM.Config.ifpcScriptURL)}WebIM.API.ajaxIframeRequestTimeout=setTimeout(function(){WebIM.API._ajaxIframe.onload=null;document.body.removeChild(WebIM.API._ajaxIframe);WebIM.API._ajaxIframe=null;WebIM.API._onServerError("Ajax Iframe Request did not complete in 5 seconds.  Request URL:"+B,true)},5*1000);var A;this._ajaxIframe=WebIM.Util.createIframe(B,true,function(){var C=WebIM.API;clearTimeout(C.ajaxIframeRequestTimeout);try{if(WebIM.Manager.domainGeneralized){if(C._ajaxIframe.contentWindow&&C._ajaxIframe.contentWindow.XHR){C._ajaxRequest=C._ajaxIframe.contentWindow.XHR;C.state="D";if(typeof C._optOnReadyCallback=="function"){C._optOnReadyCallback()}}}else{WebIM.Util.log("Domain is not generalized so use IFPC.");C.jsonpRequest(WebIM.Config.jsonScriptURL,function(){C.jsonpRequest(WebIM.Config.ifpcScriptURL,function(){var F=WebIM.Util.appendQueryParam(WebIM.Config.ifpcRelayURL,"ifpc_suppressGeneralizeDomain",true);var E=WebIM.Util.appendQueryParam(C.wimHostName+WebIM.Config.ifpcRelayPath,"ifpc_suppressGeneralizeDomain",true);C._ajaxRequest=function(G){_IFPC.call(A,"ajaxRequest",[G],WebIM.Config.ifpcRelayURL,G.callback,F,false)};C.state="D";if(typeof C._optOnReadyCallback=="function"){C._optOnReadyCallback()}})})}}catch(D){WebIM.Manager.error(D)}});A=this._ajaxIframe.name;document.body.appendChild(this._ajaxIframe);this._ajaxIframe.name=A;this._ajaxIframe.id=A},_buildAjaxFrameUrl:function(){if(WebIM.Config.MIM_AJAX_HTML_URI.substring(0,4)=="http"){var B=WebIM.Config.MIM_AJAX_HTML_URI.indexOf("://");if(B>-1){B=WebIM.Config.MIM_AJAX_HTML_URI.indexOf("/",B+3);var A=WebIM.Config.MIM_AJAX_HTML_URI.substring(0,B);if(A==this.wimHostName){return WebIM.Config.MIM_AJAX_HTML_URI}else{return this.wimHostName+WebIM.Config.MIM_AJAX_HTML_URI.substring(B)}}else{return this.wimHostName+WebIM.Config.MIM_AJAX_HTML_URI}}else{return this.wimHostName+WebIM.Config.MIM_AJAX_HTML_URI}},ajaxRequest:function(args){if(!WebIM.API.initCalled){return}var _c=typeof args.callback=="function"?args.callback:function(){};var input=args.input;if(args.url.indexOf(WebIM.Config.EVENTS_URI)==-1&&((this._blockNonEventsRequests)||!this.initialized)){this.pendingRequests.push(args);return}var _callback=function(xhr){if(typeof xhr=="undefined"||xhr.status===0){return}if(xhr.responseText){try{if(window.WebIM!==undefined&&WebIM.Util){WebIM.Util.log(xhr.responseText)}}catch(ex){}}if(xhr.status==200){var jsonResponse;try{jsonResponse=eval("("+xhr.responseText+")")}catch(e){}try{if(jsonResponse.statusCode==403){WebIM.API._removeAjaxFrame();WebIM.API.state="U";WebIM.Manager.dispatchEvent("error",{error:{message:"Security hash code is invalid.",fatal:true}});return}else{_c.call(WebIM.API,jsonResponse,input)}}catch(ex){if(window.WebIM!==undefined&&WebIM&&WebIM.Util){}}}else{var fatal=false,errorMessage="Server Error: "+xhr.status;if(args.url.indexOf(WebIM.Config.EVENTS_URI!=-1)){errorMessage="Events Request returned status code: "+xhr.status;fatal=true}WebIM.API._onServerError(errorMessage,fatal)}if(window.WebIM!==undefined&&WebIM.API){WebIM.API._blockNonEventsRequests=false}try{if(WebIM.API.pendingRequests.length>0){WebIM.API.ajaxRequest(WebIM.API.pendingRequests.shift())}}catch(ex){}};args.callback=_callback;args.userID=WebIM.Viewer.id;if(args.url.search(/http:\/\//)==-1){args.url=this.wimHostName+args.url}args.Security={hash:WebIM.Config.Security.pageHash,header:WebIM.Config.Security.header};if(this.offline&&args.url.indexOf(WebIM.Config.PRESENCE_URI)==-1){WebIM.Util.log("Blocking Ajax request due to viewer being offline.");return}if(args.url.indexOf(WebIM.Config.EVENTS_URI)==-1){this._blockNonEventsRequests=true}this._ajaxRequest(args)},jsonpRequest:function(C,F){if(this._killFunction("jsonpRequest")){return}var D=document.getElementsByTagName("head")[0];var B=document.createElement("script");var A=false;var E=new Date().getTime()+(Math.random()*10000000000000000);C+=C.search(/\?/)==-1?"?rand="+E:"&rand="+E;B.src=C;B.onload=B.onreadystatechange=function(){if(!A&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){A=true;if(typeof F=="function"){F()}B.onload=B.onreadystatechange=null;D.removeChild(B)}};D.appendChild(B)},whoIsCallback:function(A){clearTimeout(WebIM.API.jsonpRequestTimeout);var B;if(WebIM.Config.devUseSameStickyHost){B="http://"+WebIM.Config.MIM_HOST}else{B="http://"+A.wimHost+"."+WebIM.Config.MIM_HOST}WebIM.API._setAJAXHost(B);setTimeout(function(){WebIM.API.init()},10)},_getAJAXHost:function(){var A=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.API.STICKY_SERVER_KEY);if(!A){return null}else{A=decodeURIComponent(A);WebIM.Util.log("Found Host: "+A);return A}},_setAJAXHost:function(A){A=encodeURIComponent(A);WebIM.Util.Cookie.setMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.API.STICKY_SERVER_KEY,A)},updateIMSettings:function(C,D){var A={action:WebIM.Config.RESTActions.UPDATE,idle:WebIM.Settings.idle,popNewIM:WebIM.Settings.popNewIM,soundNewIM:WebIM.Settings.soundNewIM,popOnline:WebIM.Settings.popOnline,soundOnline:WebIM.Settings.soundOnline,alphaSort:WebIM.Settings.alphaSort,enable:1,hideHelpMsg:WebIM.Settings.hideHelpMsg,indicators:WebIM.Settings.indicators,soundIndicators:WebIM.Settings.soundIndicators};for(var B in C){A[B]=C[B]}this.ajaxRequest({url:WebIM.Config.IM_SETTINGS_URI,callback:function(F,E){if(F.statusCode!=200){F.method="updateSettings";WebIM.Manager.error(F)}typeof D=="function"?D(F,E):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},updateHelpMessage:function(C,D){var A={action:WebIM.Config.RESTActions.UPDATE,hideHelpMsg:WebIM.Settings.hideHelpMsg};for(var B in C){A[B]=C[B]}this.ajaxRequest({url:WebIM.Config.HELP_MESSAGE_URI,callback:function(F,E){if(F.statusCode!=200){F.method="updateHelpMessage";WebIM.Manager.error(F)}typeof D=="function"?D(F,E):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},retrievePrivacySettings:function(A){this.ajaxRequest({url:WebIM.Config.PRIVACY_SETTINGS_URI,callback:function(B){if(B.statusCode!=200){B.method="retrievePrivaceSettings";WebIM.Manager.error(B)}else{B.privacySettings.statusCode=B.statusCode}typeof A=="function"?A(B.privacySettings?B.privacySettings:B):""},params:"",addHash:false})},updatePrivacySettings:function(C,D){var A={action:WebIM.Config.RESTActions.UPDATE,privacy:null};for(var B in C){A[B]=C[B]}this.ajaxRequest({url:WebIM.Config.PRIVACY_SETTINGS_URI,callback:function(F,E){if(F.statusCode!=200){F.method="updatePrivacySettings";WebIM.Manager.error(F)}typeof D=="function"?D(F,E):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},updatePresence:function(B,C){if(WebIM.API._cookieExpired){if(MySpace.enforceLogin){MySpace.ClientContext.IsLoggedIn=false;MySpace.enforceLogin();return}}var A={action:WebIM.Config.RESTActions.UPDATE,presence:B};this.ajaxRequest({url:WebIM.Config.PRESENCE_URI,callback:function(E,D){if(E.statusCode!=200){E.method="updatePresence";WebIM.Manager.error(E)}else{if(B!=WebIM.Config.PresenceTypes.OFFLINE){this.offline=false}}typeof C=="function"?C(E,D):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},retrievePresence:function(B){var A={action:WebIM.Config.RESTActions.RETRIEVE};this.ajaxRequest({url:WebIM.Config.PRESENCE_URI,callback:function(C){if(C.statusCode!=200){C.method="retrievePresence";WebIM.Manager.error(C)}else{C.presence.statusCode=C.statusCode}typeof B=="function"?B(C.presence?C.presence:C):""},params:WebIM.Util.createParamString(A),input:A})},addUserToContactList:function(B,C){var A={action:WebIM.Config.RESTActions.CREATE,tid:B};this.ajaxRequest({url:WebIM.Config.CONTACT_LIST_URI,callback:function(E,D){if(E.statusCode!=200){E.method="addUserToContactList";WebIM.Manager.error(E)}typeof C=="function"?C(E,D):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},removeUserFromContactList:function(B,C){var A={action:WebIM.Config.RESTActions.DELETE,tid:B};this.ajaxRequest({url:WebIM.Config.CONTACT_LIST_URI,callback:function(D){if(D.statusCode!=200){D.method="removeUserFromContactList";WebIM.Manager.error(D)}typeof C=="function"?C(D):""},params:WebIM.Util.createParamString(A),addHash:true})},getUserFromContactList:function(B,C){var A={action:WebIM.Config.RESTActions.RETRIEVE,tid:B};this.ajaxRequest({url:WebIM.Config.CONTACT_LIST_URI,callback:function(D){if(D.statusCode!=200){D.method="getUserFromContactList";WebIM.Manager.error(D)}typeof C=="function"?C(D):""},params:WebIM.Util.createParamString(A),addHash:false})},retrieveBlockList:function(B){var A={action:WebIM.Config.RESTActions.RETRIEVE};this.ajaxRequest({url:WebIM.Config.BLOCK_LIST_URI,callback:function(C){if(C.statusCode!=200){C.method="retrieveBlockList";WebIM.Manager.error(C)}typeof B=="function"?B(C):""},params:WebIM.Util.createParamString(A)})},addUserToBlockList:function(C,B,D,E){var A={action:"c",tid:C,site:D?1:0,temp:B?1:0};this.ajaxRequest({url:WebIM.Config.BLOCK_LIST_URI,callback:function(F){if(F.statusCode!=200){F.method="addUserToBlockList";WebIM.Manager.error(F)}typeof E=="function"?E(F):""},params:WebIM.Util.createParamString(A),addHash:true})},removeUserFromBlockList:function(B,C){var A={action:"d",tid:B,site:1};this.ajaxRequest({url:WebIM.Config.BLOCK_LIST_URI,callback:function(D){if(D.statusCode!=200){D.method="removeUserFromBlockList";WebIM.Manager.error(D)}typeof C=="function"?C(D):""},params:WebIM.Util.createParamString(A),addHash:true})},updateWindowState:function(B,F,E,G){var D={action:WebIM.Config.RESTActions.UPDATE,rid:F?F:(Math.ceil(1000000*Math.random())),windowids:null};var C="";for(var A in B){C+=A+"."+B[A].state+"."+B[A].index+","}C=C.substring(0,C.length-1);D.windowids=C;this.ajaxRequest({url:WebIM.Config.WINDOW_STATE_URI,callback:function(H){if(H.statusCode!=200){H.method="updateWindowState";WebIM.Manager.error(H)}typeof G=="function"?G(H):""},params:WebIM.Util.createParamString(D),addHash:true,async:!E})},sendMessage:function(C,B,D){var A={tid:C,msg:B,action:WebIM.Config.RESTActions.CREATE};A.msg=encodeURIComponent(A.msg);this.ajaxRequest({url:WebIM.Config.MESSAGE_URI,callback:function(F,E){if(F.statusCode!=200){F.method="sendMessage";WebIM.Manager.error(F)}typeof D=="function"?D(F,E):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},deleteHistory:function(B,C){var A={tid:B,action:WebIM.Config.RESTActions.DELETE};this.ajaxRequest({url:WebIM.Config.HISTORY_URI,callback:function(E,D){if(E.statusCode!=200){E.method="deleteHistory";WebIM.Manager.error(E)}typeof C=="function"?C(E,D):""},params:WebIM.Util.createParamString(A),addHash:true})},getHistory:function(C,D,E,B){var A={tid:C,ts:D,action:WebIM.Config.RESTActions.RETRIEVE};this.ajaxRequest({url:WebIM.Config.HISTORY_URI,callback:function(G,F){if(G.statusCode!=200){G.method="retrieveHistory";WebIM.Manager.error(G)}typeof E=="function"?E(G,B):""},params:WebIM.Util.createParamString(A)})},getStatusAndMoods:function(C,D,B){var A={tid:C,ts:WebIM.API.adviseTS,action:WebIM.Config.RESTActions.RETRIEVE};this.ajaxRequest({url:WebIM.Config.STATUS_MOODS_URI,callback:function(F,E){if(F.statusCode!=200){F.method="retrieveStatusAndMoods";WebIM.Manager.error(F)}typeof D=="function"?D(F,B):""},params:WebIM.Util.createParamString(A)})},startTypingStatus:function(B,C){var A={tid:B,action:WebIM.Config.RESTActions.CREATE};this.ajaxRequest({url:WebIM.Config.TYPING_STATUS_URI,callback:function(E,D){if(E.statusCode!=200){E.method="startTypingStatus";WebIM.Manager.error(E)}typeof C=="function"?C(E,D):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},stopTypingStatus:function(B,C){var A={tid:B,action:WebIM.Config.RESTActions.DELETE};this.ajaxRequest({url:WebIM.Config.TYPING_STATUS_URI,callback:function(E,D){if(E.statusCode!=200){E.method="stopTypingStatus";WebIM.Manager.error(E)}typeof C=="function"?C(E,D):""},params:WebIM.Util.createParamString(A),input:A,addHash:true})},setIndicatorRead:function(){var A={ts:WebIM.API.adviseTS,action:WebIM.Config.RESTActions.UPDATE};this.ajaxRequest({url:WebIM.Config.INDICATORS_URI,callback:function(C,B){if(C.statusCode!=200){C.method="setIndicatorRead";WebIM.Manager.error(C)}},params:WebIM.Util.createParamString(A),addHash:true})},signOut:function(B){WebIM.API.signedOut=true;var A={action:WebIM.Config.RESTActions.UPDATE};this.ajaxRequest({url:WebIM.Config.SIGNOUT_URI,params:WebIM.Util.createParamString(A),callback:function(C){if(C.statusCode!=200){C.method="signOut";WebIM.Manager.error(C)}typeof B=="function"?B(C):""},addHash:true})},retrieveEvents:function(C){if(this.state!="D"){return}var A={ts:this.adviseTS,action:WebIM.Config.RESTActions.RETRIEVE,active:WebIM.API.activity?1:0};WebIM.API.activity=false;if(WebIM.API.forceEventsRequest){A.force=1;WebIM.API.forceEventsRequest=false}this.state="C";this._cb=function(D){WebIM.API.initialized=true;WebIM.API.state="D";if(D){if(D.ts){this.adviseTS=D.ts}else{this.adviseTS=0}switch(D.statusCode){case 200:WebIM.API.offline=false;WebIM.API._eventsCallback(D);setTimeout(function(){WebIM.API.retrieveEvents()},WebIM.API.firstEventsRequest?1:1000);WebIM.API.firstEventsRequest=true;WebIM.Util.Cookie.setServerErrorTimeout("","");break;case 401:WebIM.API.offline=true;WebIM.Viewer.presence=WebIM.Config.PresenceTypes.OFFLINE;WebIM.Manager.dispatchEvent("goOffline");WebIM.API._cookieExpired=true;break;case 603:this.initialized=false;this.whoIsCallback(D);break;case 604:this._eventsCallback(D);this._pollPresence();break;case 605:this.adviseTS=0;WebIM.API._onServerError("Session has failed.",true);break;case 607:if(!WebIM.API.signedOut){WebIM.API._pollPresence()}case 608:this.offline=true;WebIM.API._eventsCallback(D);break;case 609:this.adviseTS=0;if(WebIM.API.eventRetries++<WebIM.Config.eventsRequestMaxRetries){setTimeout(function(){WebIM.API.retrieveEvents()},WebIM.Config.eventsRequestDelta*1000)}else{this.eventRetries=0;WebIM.API._onServerError("Too many 609 responses.",true,WebIM.API.WIMAPP_UNAVAILABLE_TIMEOUT)}break;default:WebIM.API._onServerError(D.statusMessage,true)}}else{WebIM.API._onServerError("Error in events response.",true)}};var B=WebIM.Config.EVENTS_URI;this.ajaxRequest({url:B,callback:this._cb,params:WebIM.Util.createParamString(A)})},_killFunction:function(C){var B=new Date();var A=this._rateProtectedFunctions[C].lastCall?B.getTime()-this._rateProtectedFunctions[C].lastCall:30;if(A<500){if(++this._rateProtectedFunctions[C].callsBelowOneSecond>10){WebIM.API._onServerError(C+" rate-limit violation.");this.state="U";this._rateProtectedFunctions[C].callsBelowOneSecond=0;return true}}else{if(A>500){this._rateProtectedFunctions[C].callsBelowOneSecond=0}}this._rateProtectedFunctions[C].lastCall=B.getTime();return false},_onServerError:function(A,B,D){A=A?A:"Server error.";WebIM.Manager.error({message:A,fatal:WebIM.Config.wimappServerName?false:B});if(B){this.state="U";this._setAJAXHost("");if(this.NUMBER_OF_RETRIES>=this.MAX_RETRIES){return}var C;if(D){C=D}else{if(WebIM.Config.wimappServerName){C=1}else{C=this.WIMAPP_UNAVAILABLE_TIMEOUT*Math.pow(2,this.NUMBER_OF_RETRIES);this.NEXT_RETRY=(new Date()).getTime()+C;this.NUMBER_OF_RETRIES++;WebIM.Util.Cookie.setServerErrorTimeout(this.NEXT_RETRY,this.NUMBER_OF_RETRIES)}}this.errorTimeout=setTimeout(function(){WebIM.API.state="D";WebIM.API._resetAjaxHost()},C+100);WebIM.Util.error("WebIM Fatal Error.  Timing out for "+(C/1000)+"s");WebIM.Config.wimappServerName=null}},clearTimeouts:function(){clearTimeout(this.errorTimeout)},resetTimestamp:function(){this.adviseTS=0},stopPollingPresence:function(){clearTimeout(WebIM.API.presencePollTimeout)},_pollPresence:function(){WebIM.API.retrievePresence(function(A){if(A.presence==WebIM.Config.PresenceTypes.OFFLINE||A.statusCode==500){WebIM.API.presencePollTimeout=setTimeout(WebIM.API._pollPresence,WebIM.Config.presencePollInterval*1000)}else{if(WebIM.API.offline||(A.presence==WebIM.Config.PresenceTypes.ONLINE)){WebIM.API.adviseTS=0;WebIM.API.offline=false;WebIM.API.retrieveEvents()}}})},setHideHelpMsg:function(){WebIM.Util.Cookie.saveHideHelpMessage("1");this.updateHelpMessage({hideHelpMsg:"1"},this.updateHelpMessageCallback)},updateHelpMessageCallback:function(){if(jsonResponse.statusCode!=200){alert(WebIM.Strings.SETTINGS_SAVE_ERROR)}else{WebIM.Settings.update(input)}}};WebIM.API._initCookieDomain();MIMWhoIsCallback=function(A){WebIM.API.whoIsCallback(A)};WebIM.ModalDialog={blockUserID:null,blockListUserArray:null,previousExist:null,waitingForBlocklist:false,genericPrompt:function(G,I,H,F){if(!I||!G){return}var A='<div class="webim-genericPrompt">'+I+"</div>";var D=[];if(F==undefined){D=[{text:WebIM.Strings.OK,isDefault:false},{text:WebIM.Strings.CANCEL,isDefault:true}]}else{for(var C=0,B=F.length;C<B;C++){D.push({text:F[C],isDefault:false})}if(D!=undefined&&D.length>0){D[F.length-1].isDefault=true}}var E={title:G,content:A,callback:function(K,L){var J=L.target.value.trim();if(J===WebIM.Strings.OK){H(true,J)}else{H(false,J)}WebIM.ModalDialog.cleanPopUpOverlays()}};this.createGenericDialog(E,D)},confirmBlockUser:function(A,E){if(!A){WebIM.Util.error("pass UserId to block")}var D="<div id='webim-confirmBlockUser'>		"+String.format(WebIM.Strings.MODAL_DIALOGS_RA_CONFIRM,"<b>","</b>")+"		<div class='webim-blockOptionsWrapper'>			<div class='webim-blockUserInnerContainer'> <b>- "+String.format(WebIM.Strings.MODAL_DIALOGS_BLOCK_USER,"<b>","</b>","<b>","</b>")+"</b><div>			<div class='webim-blockOptions'>				<form name='form1' class='form1'>					<input type='radio' name='blockIM' value='IM' checked/> "+WebIM.Strings.MODAL_DIALOGS_BLOCK_CONTACT+" <br></br>					<input type='radio' name='blockIM' value='ALL' /> "+WebIM.Strings.MODAL_DIALOGS_BLOCK_ALL+"				</form>			</div>			- <span class='webim-hitCancel'>"+String.format(WebIM.Strings.MODAL_DIALOGS_HIT_CANCEL,"<b>","</b>")+"</span>		<div>		</div>";WebIM.ModalDialog.blockUserID=A;var C=[{text:WebIM.Strings.OK,isDefault:true},{text:WebIM.Strings.CANCEL,isDefault:false}];var B={title:WebIM.Strings.MODAL_DIALOGS_CONFIRM_BLOCK_TITLE,content:D,callback:function(F,G){WebIM.ModalDialog.sendBlockUserRequest(F,G,E)}};this.createGenericDialog(B,C)},blockUser:function(A,E){if(!A){WebIM.Util.error("pass UserId to block")}var D="<div id='webim-BlockUser'>		"+String.format(WebIM.Strings.MODAL_DIALOGS_CONFIRM_BLOCK,"<b>","</b>")+"		<div class='webim-blockOptionsWrapper'>			<div class='webim-blockUserInnerContainer'> - "+String.format(WebIM.Strings.MODAL_DIALOGS_BLOCK_USER,"<b>","</b>","<b>","</b>")+"<div>			<div class='webim-blockOptions'>				<form name='form1' class='form1'>					<input type='radio' name='blockIM'  value='IM' id='webim-blockIM' checked/> "+WebIM.Strings.MODAL_DIALOGS_BLOCK_CONTACT+"<br></br>					<input type='radio' name='blockIM' value='ALL' id='webim-blockAll'/> "+WebIM.Strings.MODAL_DIALOGS_BLOCK_ALL+"				</form>			</div>			- <span class='webim-hitCancel'>"+String.format(WebIM.Strings.MODAL_DIALOGS_HIT_CANCEL,"<b>","</b>")+"</span>		<div>		</div>";WebIM.ModalDialog.blockUserID=A;var C=[{text:WebIM.Strings.OK,isDefault:true},{text:WebIM.Strings.CANCEL,isDefault:false}];var B={title:WebIM.Strings.BLOCK_USER,content:D,callback:function(F,G){WebIM.ModalDialog.sendBlockUserRequest(F,G,E)}};this.createGenericDialog(B,C)},editBlockList:function(){this.waitingForBlocklist=true;var D=WebIM.CurrentWindow===WebIM.ConsoleWindow?"_top":"_blank";var C="<div id='webim-editBlockList'>				<div id='webim-editBlockListInnerWrapper'>					<div id='webim-editBlockListInnerContainer'>						<div id='webim-blockListMessage'>"+WebIM.Strings.MODAL_DIALOGS_NEVER_CONTACT_ME+": </div>						<div id='webim-blockListContainer'>						</div>						<div id='webim-blockListClickableOptions'>							<input disabled='true' id='webim-blockListViewProfile'  type='button' value ='"+WebIM.Strings.VIEW_PROFILE+"' onClick='WebIM.ModalDialog.viewUserProfile()' />							<input disabled='true' id='webim-blockListUnblock' type='button' value ='"+WebIM.Strings.MODAL_DIALOGS_UNBLOCK+"' onClick='WebIM.ModalDialog.unblockUser()'/>							<div class='webim-blockDisabled' id='addafterunblockContainer'><br><input id='addafterunblockCheck' type='checkbox'  disabled='true' />&nbsp;"+WebIM.Strings.UNBLOCKUSER_ADDTOCONTACT+"</div>							</div>						<div id='webim-noteMessage'>"+WebIM.Strings.MODAL_DIALOGS_EDIT_BLOCK_LIST+"</div>						<a href='"+WebIM.Config.blockUsersURL+"' target='"+D+"' id='webim-editMyspaceBlockList' >"+WebIM.Strings.EDIT_MYSPACE_BLOCK_LIST+"</a>					</div>				</div>			</div>";var B=[{text:WebIM.Strings.OK,isDefault:true}];var A={title:WebIM.Strings.EDIT_IM_BLOCK_LIST+"<span id='webim-blockListLoading'><img src='"+WebIM.Config.sendingImageURL+"' style='padding-right: 5px'></img>"+WebIM.Strings.SETTINGS_LOADING+"</span>",content:C,callback:WebIM.ModalDialog.cleanPopUpOverlays};WebIM.API.retrieveBlockList(function(E){if(E.statusCode!=200){WebIM.ModalDialog.waitingForBlocklist=false;WebIM.ModalDialog.removeFromBlockListUI();alert(WebIM.Strings.BLOCK_LIST_ERROR)}else{WebIM.ModalDialog.createGenericDialog(A,B)}})},viewUserProfile:function(){if(!WebIM.ModalDialog.previousExist){return}window.open(String.format(WebIM.Config.profileURL,WebIM.ModalDialog.previousExist))},unblockUser:function(){var B;if(!WebIM.ModalDialog.previousExist){return}if(document.getElementById("webim-ifBlock_all_"+WebIM.ModalDialog.previousExist).value!="0"){B=confirm(WebIM.Strings.EDIT_BLOCK_ALL);if(!B){return}}else{B=confirm(WebIM.Strings.EDIT_BLOCK_IM);if(!B){return}}WebIM.API.removeUserFromBlockList(WebIM.ModalDialog.previousExist);this.removeFromBlockListUI();var A=$get("addafterunblockCheck");if(A&&A.checked){WebIM.API.addUserToContactList(WebIM.ModalDialog.previousExist)}WebIM.ModalDialog.previousExist=null},removeFromBlockListUI:function(){try{document.getElementById("webim-blockListContainer").removeChild(document.getElementById("webim-block_list_user_"+this.previousExist))}catch(A){WebIM.Util.error("Unable to remove the element from the UI :"+A)}},addBlockedUsersToList:function(G){this.waitingForBlocklist=false;WebIM.ModalDialog.blockListUserArray=G.users;var D=G.users.length;if(G.users.length<=0){var F=document.createElement("div");F.style.cursor="default";F.className="webim-user_block_list";F.innerHTML=WebIM.Strings.BLOCK_LIST_EMPTY;var C=$get("webim-blockListContainer");C.style.backgroundColor="#f3f3f3";C.appendChild(F);return}else{var B=$get("webim-blockListViewProfile");var A=$get("webim-blockListUnblock");if(B){B.disabled=false}if(A){A.disabled=false}this.enableUnblockCheck()}for(var E=0;E<D;E++){blockedRow=document.createElement("div");blockedRow.id="webim-block_list_user_"+WebIM.ModalDialog.blockListUserArray[E].id;blockedRow.className="webim-user_block_list";blockedRow.innerHTML=WebIM.ModalDialog.blockListUserArray[E].name+"<input id='webim-ifBlock_all_"+WebIM.ModalDialog.blockListUserArray[E].id+"' type='hidden' value='"+WebIM.ModalDialog.blockListUserArray[E].site_wide+"'>";document.getElementById("webim-blockListContainer").appendChild(blockedRow);if(blockedRow.addEventListener){blockedRow.addEventListener("mouseover",function(){if(WebIM.ModalDialog.ifBlockedUserSelected(this.id)){return}WebIM.ModalDialog.addClass(document.getElementById(this.id),"webim-user_block_list_hover");WebIM.ModalDialog.removeClass(document.getElementById(this.id),"webim-user_block_list")},false);blockedRow.addEventListener("mouseout",function(){if(WebIM.ModalDialog.ifBlockedUserSelected(this.id)){return}WebIM.ModalDialog.addClass(document.getElementById(this.id),"webim-user_block_list");WebIM.ModalDialog.removeClass(document.getElementById(this.id),"webim-user_block_list_hover")},false);blockedRow.addEventListener("click",function(){if(WebIM.ModalDialog.previousExist){WebIM.ModalDialog.doUnclick("webim-block_list_user_"+WebIM.ModalDialog.previousExist)}if(WebIM.ModalDialog.previousExist==this.id.split("_")[3]){WebIM.ModalDialog.previousExist=null;return}WebIM.ModalDialog.previousExist=this.id.split("_")[3];if(WebIM.ModalDialog.ifBlockedUserSelected(this.id)){WebIM.ModalDialog.doUnclick(this.id)}else{WebIM.ModalDialog.doClick(this.id)}},false)}else{blockedRow.attachEvent("onmouseover",function(){id=window.event.srcElement.id;if(WebIM.ModalDialog.ifBlockedUserSelected(id)){return}WebIM.ModalDialog.addClass(document.getElementById(id),"webim-user_block_list_hover");WebIM.ModalDialog.removeClass(document.getElementById(id),"webim-user_block_list")});blockedRow.attachEvent("onmouseout",function(){id=window.event.srcElement.id;if(WebIM.ModalDialog.ifBlockedUserSelected(id)){return}WebIM.ModalDialog.addClass(document.getElementById(id),"webim-user_block_list");WebIM.ModalDialog.removeClass(document.getElementById(id),"webim-user_block_list_hover")});blockedRow.attachEvent("onclick",function(){id=window.event.srcElement.id;if(WebIM.ModalDialog.previousExist){WebIM.ModalDialog.doUnclick("webim-block_list_user_"+WebIM.ModalDialog.previousExist)}if(WebIM.ModalDialog.previousExist==id.split("_")[3]){WebIM.ModalDialog.previousExist=null;return}WebIM.ModalDialog.previousExist=id.split("_")[3];if(WebIM.ModalDialog.ifBlockedUserSelected(id)){WebIM.ModalDialog.doUnclick(id)}else{WebIM.ModalDialog.doClick(id)}})}}},doClick:function(A){document.getElementById(A).style.backgroundColor="#cccccc";WebIM.ModalDialog.addClass(document.getElementById(A),"webim-user_block_list");WebIM.ModalDialog.removeClass(document.getElementById(A),"webim-user_block_list_hover")},doUnclick:function(A){document.getElementById(A).style.backgroundColor="#ffffff";WebIM.ModalDialog.addClass(document.getElementById(A),"webim-user_block_list")},ifBlockedUserSelected:function(A){return(document.getElementById(A).style.backgroundColor=="#cccccc"||document.getElementById(A).style.backgroundColor=="rgb(204, 204, 204)")},createGenericDialog:function(C,D){var A;var E=document.createElement("div");E.innerHTML="<div id='webim-appspopup_wrapper' class='popup_wrapper' style='z-index:1000201;left:0px;width:100%;display:none;visibility:hidden;'><div class='popup_box'><a></a><div class='popup_title'></div><div class='popup_content'></div><div class='popup_buttons'></div></div></div>";var A=$create(MySpace.UI._Popup,{title:C.title,content:C.content},null,null,E.firstChild);A.set_width(500);for(var B=0;B<D.length;B++){A.add_button(D[B].text,D[B].isDefault)}A.show(C.callback)},sendBlockUserRequest:function(A,G,H){H=typeof H=="function"?H:function(){};if(G.target.value==WebIM.Strings.CANCEL){H(false);return}var E=null;if(A._box){var F=A._box.getElementsByTagName("FORM");if(F.length>0){E=F[0]}}if(!E){E=document.form1;if(!E){WebIM.Util.error("failed to get form hook on block request");return}}var B=E.blockIM.length;var D;for(var C=0;C<B;C++){if(E.blockIM[C].checked){D=E.blockIM[C].value;break}}if(D=="IM"){WebIM.API.addUserToBlockList(WebIM.ModalDialog.blockUserID)}else{WebIM.API.addUserToBlockList(WebIM.ModalDialog.blockUserID,null,1,null)}H(true);WebIM.ModalDialog.blockUserID=null;WebIM.ModalDialog.cleanPopUpOverlays()},cleanPopUpOverlays:function(){var C=document.getElementById("webim-appspopup_wrapper");if(!C){return}var A=C.parentNode;var B;B=document.getElementById("webim-appspopup_wrapper");if(B){A.removeChild(B)}B=document.getElementById("window-overlay");if(B){A.removeChild(B)}},hasClass:function(B,A){return B.className.match(new RegExp("(\\s|^)"+A+"(\\s|$)"))},addClass:function(B,A){if(!this.hasClass(B,A)){B.className+=" "+A}},removeClass:function(C,A){if(this.hasClass(C,A)){var B=new RegExp("(\\s|^)"+A+"(\\s|$)");C.className=C.className.replace(B," ")}},blockListCallback:function(B){if(!this.waitingForBlocklist){return}var A=$get("webim-blockListLoading");if(A){A.style.display="none"}WebIM.ModalDialog.addBlockedUsersToList(B)},enableUnblockCheck:function(){var B=$get("addafterunblockCheck");B.disabled=false;var A=$get("addafterunblockContainer");A.className="webim-blockEnabled"}};var WebIM=WebIM||{};WebIM.EventTarget=function(C){this._eventListeners={};for(var B=0,A=C.length;B<A;B++){this._eventListeners[C[B]]=[]}};WebIM.EventTarget.prototype={addEventListener:function(A,B){if(typeof B!="function"){return}if(!this._eventListeners[A]){this._eventListeners[A]=[]}this._eventListeners[A].push(B)},removeEventListener:function(B,D){if(typeof D!="function"||!this._eventListeners[B]){return}var C=this._eventListeners[B];if(C.length==0){return}for(var A=C.length;A--;){if(C[A]===D){C.splice(A,1);return}}},dispatchEvent:function(C,A){if(!this._eventListeners[C]){return}A=A?A:{};var D=this._eventListeners[C];if(D.length==0){return}A.target=this;for(var B=D.length;B--;){D[B](A)}}};WebIM.EventTarget.registerClass("WebIM.EventTarget",null);var WebIM=WebIM||{};WebIM.CommonWindow=function(A){A=A?A:[];this._eventTypes="open,minimize,close,updateWindowState".split(",").concat(A);WebIM.CommonWindow.initializeBase(this,[this._eventTypes]);this.state=WebIM.Config.WindowStates.CLOSE};WebIM.CommonWindow.prototype={toggle:function(){if(this.state==WebIM.Config.WindowStates.OPEN){this.minimize()}else{this.open()}},updateWindowState:function(A){switch(A.state){case"Open":this.open(A);break;case"Close":this.close(A);break;case"Minimize":this.minimize(A);break}this.dispatchEvent("updateWindowState",{windowState:A})},open:function(A){this.state=WebIM.Config.WindowStates.OPEN;this.dispatchEvent("open",{windowState:A})},close:function(A){this.state=WebIM.Config.WindowStates.CLOSE;this.dispatchEvent("close",{windowState:A})},minimize:function(A){this.state=WebIM.Config.WindowStates.MINIMIZE;this.dispatchEvent("minimize",{windowState:A})}};WebIM.CommonWindow.registerClass("WebIM.CommonWindow",WebIM.EventTarget);WebIM=WebIM||{};WebIM._Manager=function(){this._eventTypes="createConversation,createFriend,processEvents,goOffline,goOnline,error,updateWindowStates,init,goHidden,loggedOnFromAnotherLocation".split(",");WebIM._Manager.initializeBase(this,[this._eventTypes]);this._queuedWindowStates={};this._currentWindowStates={};this.friends={};this.conversations={};this._queuedMessages=[];this.commitTimeout=0;this.contactListFull=false;this.firstEventsResponse=true;this._conversationCount=0;this.domainGeneralized=document.domain==WebIM.Util.getGeneralizedDomain();if(this.domainGeneralized){WebIM.Config.genericFrameURL=WebIM.Config.dotNetBaseURL+WebIM.Config.genericFramePath;WebIM.Config.sponsorFrameURL=WebIM.Config.dotNetBaseURL+WebIM.Config.sponsorFrameURL;WebIM.Config.consoleFrameURL=WebIM.Config.genericFrameURL+"&sponsor=t"}else{WebIM.Config.genericFrameURL=location.protocol+"//"+location.hostname+WebIM.Config.genericFramePath;WebIM.Config.sponsorFrameURL=location.protocol+"//"+location.hostname+WebIM.Config.sponsorFrameURL;WebIM.Config.consoleFrameURL=WebIM.Config.genericFrameURL+"&sponsor=t"}};WebIM._Manager.prototype={startIM:function(D,A){A=A||{};var G=false;if(A){if(A.useDesktopClient){G=true}}var H;if(typeof(D)==="object"){var C=D.displayName;if(!C&&D.name){C=D.name}H={type:"user",name:C,id:D.id,imageUrl:D.img_s,group:D.group||"RegularContact",presence:D.presence?D.presence:WebIM.Config.PresenceTypes.OFFLINE}}else{if(typeof(D)==="string"||typeof(D)==="number"){if(!/^\d+$/.test(D)){WebIM.Util.error("Invalid contact id");return}else{if(!WebIM.Manager.friends[D]){WebIM.API.getUserFromContactList(D,function(J){if(J.statusCode==200){WebIM.Manager._processFriends([J.user])}})}}}H={type:"user",name:WebIM.Strings.NO_DISPLAY_NAME,id:D,imageUrl:"",group:WebIM.Config.FriendGroups.NON_CONTACT,presence:WebIM.Config.PresenceTypes.OFFLINE}}if(!WebIM.Manager.friends[H.id]){this._processFriends([H])}var F=WebIM.Manager.friends[H.id];if(WebIM.CurrentWindow===WebIM.ConsoleWindow){var B=function(){if(WebIM.Manager.firstEventsResponse){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT);WebIM.Manager.getConversation(F.id).open();WebIM.Manager.removeEventListener("processEvents",B)}};var I=[];var E=function(){H.img_s=H.imageUrl;var J=Sys.Serialization.JavaScriptSerializer.serialize(H);J=encodeURIComponent(J);WebIM.Console.Manager.popOutIM({userJSON:J})};if(A.forcePopout){E();return}switch(WebIM.Console.ConsoleUI.state){case"COLLAPSED_LOGGED_IN_OTHER_LOCATION":case"LOGGED_IN_OTHER_LOCATION":if(!WebIM.Manager.launchDesktopClient(F.id)){WebIM.Manager.addEventListener("processEvents",B);WebIM.Manager.forceOnline()}break;case"COLLAPSED_OFFLINE":case"OFFLINE":if(!WebIM.Manager.launchDesktopClient(F.id)){WebIM.Manager.goOnline(function(){WebIM.Manager.addEventListener("processEvents",B)})}break;case"COLLAPSED_NOT_SUPPORTED":case"NOT_SUPPORTED":if(!WebIM.Manager.launchDesktopClient()){E()}break;case"POPPED_OUT":WebIM.Manager.commitPoppedOut(false,function(){if(WebIM.Conversation.active){WebIM.Conversation.active.minimize()}WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT);WebIM.Manager.getConversation(F.id).open()});break;case"COLLAPSED_UNAVAILABLE":case"UNAVAILABLE":WebIM.Manager.launchDesktopClient();break;default:WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT);WebIM.Manager.getConversation(F.id).open()}}else{WebIM.Manager.getConversation(F.id).open()}},playSound:function(A){if(this.playingSound||this.soundPlayerNotFound){return}this.playingSound=true;setTimeout(function(){WebIM.Manager.playingSound=false},100);if(!this.soundPlayer){this.soundPlayer=$get("WebIMSoundPlayer")}if(!this.soundPlayer||!this.soundPlayer.playSound){WebIM.Util.error("Could not find sound player.");this.soundPlayerNotFound=true;return}switch(A){case"MESSAGE_RECEIVED":if(this.soundPlayer&&this.soundPlayer.playSound){this.soundPlayer.playSound(WebIM.Config.incomingSoundURL)}break;case"NEW_ONLINE_FRIEND":if(this.soundPlayer&&this.soundPlayer.playSound){this.soundPlayer.playSound(WebIM.Config.popSoundURL)}break}},_processMessages:function(I){var F={},D=false;for(var C=0,B=I.length;C<B;C++){var E,A=I[C];if(A.tid==WebIM.Viewer.id&&(E=this.friends[A.sid])){A.fromFriend=true}else{if(E=this.friends[A.tid]){A.fromFriend=false}}if(E){var H=this.getConversation(E.id);if(!F[E.id]){F[E.id]=H}H._messageQueue.push(A);if(A.fromFriend&&!WebIM.Manager.firstEventsResponse&&(WebIM.PopoutWindow.state==WebIM.Config.WindowStates.CLOSE||WebIM.CurrentWindow!==WebIM.ConsoleWindow)){D=true}}else{this._queuedMessages[this._queuedMessages.length]=A}}for(var G in F){var H=F[G];H.displayMessages()}if(D&&WebIM.Settings.soundNewIM){WebIM.Manager.playSound(WebIM.Config.Sounds.MESSAGE_RECEIVED)}},_processFriends:function(J){var B=WebIM.Config.MAX_FRIEND_DISPLAY_COUNT<J.length?WebIM.Config.maxClientContactList:J.length;for(var D=0;D<B;D++){var I=J[D];if(I.id==WebIM.Viewer.id){continue}var E=this.friends[I.id];if(E){E.updateAttributes(I)}else{var F=[],H=[];E=this.friends[I.id]=this.createFriend(I);for(var C=0,G=this._queuedMessages.length;C<G;C++){var A=this._queuedMessages[C];if(A.tid==E.id||A.sid==E.id){H.push(A);F.push(C)}}this._processMessages(H);for(var C=F.length-1;C>=0;C--){this._queuedMessages.splice(F[C],1)}}}},_windowUpdateFromThis:false,updateWindowStates:function(){if(this._windowUpdateFromThis){this._windowUpdateFromThis=false;return}var E=[];for(var B in this._currentWindowStates){var D=this._currentWindowStates[B];if(B==WebIM.Config.ReservedWindows.FRIENDS_LIST){WebIM.FriendsList.updateWindowState(D)}else{if(B==WebIM.Config.ReservedWindows.CONSOLE){WebIM.ConsoleWindow.updateWindowState(D)}else{if(B==WebIM.Config.ReservedWindows.POPOUT){WebIM.PopoutWindow.updateWindowState(D)}else{E[E.length]=D}}}}E.sort(WebIM.Util.conversationSortFunc);for(var C=0,A=E.length;C<A;C++){var D=E[C];var F=this.friends[D.id];if(F){this.getConversation(F.id).updateWindowState(D)}}this.dispatchEvent("updateWindowStates",{windowStates:this._currentWindowStates})},commitWindowState:function(A,C,B){if(WebIM.Manager.isBrowserSupported()){this._queuedWindowStates[A]=new WebIM.Util.WindowState(A,C,B);clearTimeout(this.commitTimeout);this.commitTimeout=setTimeout(function(){var F={};var G=false;var E=0;for(E in WebIM.Manager._queuedWindowStates){var D=WebIM.Manager._queuedWindowStates[E];if(!WebIM.Manager._currentWindowStates[E]||D.state!=WebIM.Manager._currentWindowStates[E].state||D.index!=WebIM.Manager._currentWindowStates[E].index){G=true;WebIM.Manager._currentWindowStates[E]=F[E]=D}}if(G){WebIM.Manager._windowUpdateFromThis=true;WebIM.API.updateWindowState(F)}},500)}},getConversation:function(A){if(!this.conversations[A]){this.conversations[A]=this.createConversation(this.friends[A])}return this.conversations[A]},hasConversation:function(A){if(this.conversations[A]){return true}else{return false}},initAPI:function(){var A=this;WebIM.API.init((function(B){A.processEvents(B)}),function(){WebIM.API.retrieveEvents()})},processEvents:function(O){if(O.statusCode==604){this.dispatchEvent("loggedOnFromAnotherLocation");return}else{if(O.statusCode==605){this.dispatchEvent("error",{error:jsobObj});return}else{if(O.events){var P=O.events;var M=[];var N=[];var H;for(var G=0,E=P.length;G<E;G++){switch(P[G].type){case"user":N[N.length]=P[G];break;case"message":M[M.length]=P[G];var K=WebIM.Manager.conversations[P[G].sid];if(K){K.updateTypingStatus(false)}break;case"windowState":var A=P[G].windows.split(",");try{for(var F=0,L=A.length;F<L;F++){var C=A[F].split(".");var D=C[0].replace(/\s+/,"");var B=C[1].replace(/\s+/,"");var J=C[2].replace(/\s+/,"");this._currentWindowStates[D]=this._queuedWindowStates[D]=new WebIM.Util.WindowState(D,B,J)}}catch(I){this.error(I)}break;case"presence":WebIM.Viewer.updateAttributes(P[G]);WebIM.Util.Cookie.saveViewerPresence(P[G].presence);if(P[G].presence==WebIM.Config.PresenceTypes.ONLINE){this.dispatchEvent("goOnline")}else{if(P[G].presence==WebIM.Config.PresenceTypes.OFFLINE){this.dispatchEvent("goOffline");this.firstEventsResponse=true}else{if(P[G].presence==WebIM.Config.PresenceTypes.HIDDEN){this.dispatchEvent("goHidden")}}}break;case"settings":WebIM.Settings.update(P[G]);if(!WebIM.Settings.enabled&&!WebIM.Manager.firstEventsResponse){WebIM.API._removeAjaxFrame();WebIM.API.state="U";this.dispatchEvent("error",{error:{message:"MySpaceIM is disabled.",fatal:true}});WebIM.Util.Cookie.setMVCookieValue(WebIM.Config.MSSESSION_COOKIE,WebIM.Config.MIMDISABLED_COOKIE,"");return}break;case"clearHistory":var K=WebIM.Manager.conversations[P[G].tid];if(K){K.clearHistory()}break;case"error":this.error(P[G]);break;case"blocklist":WebIM.ModalDialog.blockListCallback(P[G]);break;case"typing":var K=WebIM.Manager.conversations[P[G].sid];if(K){K.updateTypingStatus(!!P[G].status)}break;case"genericEvent":if(WebIM.Console.Events){WebIM.Console.Events._notify(P[G].eventType,P[G].eventArgs)}break;case"indicators":if(WebIM.Config.showIndicators){this.dispatchEvent(P[G].type+"Event",P[G])}break}}}}}this._processFriends(N);if(A&&A.length>0){this.updateWindowStates()}this._processMessages(M);this.dispatchEvent("processEvents",{windowStates:A,messages:M,jsonResponse:O});if(H!=WebIM.Config.PresenceTypes.OFFLINE){this.firstEventsResponse=false}},sendMessage:function(B,A,C){if(!(A==""||/^\s+$/.test(A))){WebIM.API.sendMessage(B,A,function(D){if(D.statusCode!=200){var E=WebIM.Manager.friends[B];E.displaySendMessageError()}});return true}return false},addUserToContactList:function(A,B){WebIM.API.addUserToContactList(A,B)},init:function(){if(WebIM.Manager.initCalled){return}WebIM.Manager.initCalled=true;if(window.suppressWebIMClient!==undefined&&window.suppressWebIMClient){return}if(WebIM.ViewerJSON){WebIM.Viewer=new WebIM.Friend(WebIM.ViewerJSON)}WebIM.FriendsList=new WebIM._FriendsList();WebIM.PopoutWindow=new WebIM.CommonWindow();WebIM.ConsoleWindow=new WebIM.CommonWindow();var E=document.createElement("div");E.id="WebIMSoundPlayer";document.body.appendChild(E);var D={name:"WebIMSoundPlayer",allowscriptaccess:"always",wmode:"transparent"};var A={sounds:WebIM.Config.popSoundURL+","+WebIM.Config.incomingSoundURL};var B={style:"position: fixed; left: 100px; top: 100px;"};if(swfobject&&swfobject.hasFlashPlayerVersion(WebIM.Config.flashVersion)){try{swfobject.embedSWF(WebIM.Config.soundPlayerURL,"WebIMSoundPlayer","1","1",WebIM.Config.flashVersion,"#ffffff",A,D,B);this.soundPlayer=$get("WebIMSoundPlayer")}catch(C){}}this.dispatchEvent("init")},error:function(A){if(A.method){WebIM.Util.error("Error in "+A.method)}WebIM.Util.error("Error: "+A.message);this.dispatchEvent("error",{error:A})},forceOnline:function(){WebIM.API.forceEventsRequest=true;WebIM.Manager.firstEventsResponse=true;WebIM.API.resetTimestamp();WebIM.API.retrieveEvents()},goOnline:function(B){var A=WebIM.Viewer.presence==WebIM.Config.PresenceTypes.OFFLINE;if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.ONLINE){WebIM.API.updatePresence(WebIM.Config.PresenceTypes.ONLINE,function(){if(A){WebIM.Manager.firstEventsResponse=true;WebIM.API.stopPollingPresence();WebIM.API.resetTimestamp();WebIM.API.retrieveEvents()}if(typeof B=="function"){B.apply(null,arguments)}})}},goOffline:function(A){if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.OFFLINE){WebIM.API.updatePresence(WebIM.Config.PresenceTypes.OFFLINE,function(){if(typeof A=="function"){A.apply(null,arguments)}})}},goHidden:function(B){var A=WebIM.Viewer.presence==WebIM.Config.PresenceTypes.OFFLINE;if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.HIDDEN){WebIM.API.updatePresence(WebIM.Config.PresenceTypes.HIDDEN,function(){if(typeof B=="function"){B.apply(null,arguments)}})}},createConversation:function(A){var B=new WebIM.Conversation(A,this._conversationCount++);this.dispatchEvent("createConversation",{conversation:B});return B},createFriend:function(A){var B=new WebIM.Friend(A);this.dispatchEvent("createFriend",{friend:B});if(WebIM.FriendsList.isDisplayable(B)){WebIM.FriendsList.addFriend(B)}return B},startTyping:function(){var A=WebIM.Viewer.presence==WebIM.Config.PresenceTypes.OFFLINE;if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.ONLINE){WebIM.API.updatePresence(WebIM.Config.PresenceTypes.ONLINE,function(){if(A){WebIM.Manager.firstEventsResponse=true;WebIM.API.stopPollingPresence();WebIM.API.resetTimestamp();WebIM.API.retrieveEvents()}if(typeof callback=="function"){callback.apply(null,arguments)}})}},isBrowserSupported:function(){return WebIM.CurrentWindow===WebIM.PopoutWindow||(WebIM.CurrentWindow===WebIM.ConsoleWindow&&!browser.isIE6x)},commitPoppedOut:function(C,E){var A={};var B=C?WebIM.Config.WindowStates.OPEN:WebIM.Config.WindowStates.CLOSE;var D=C?WebIM.Config.WindowStates.CLOSE:WebIM.Config.WindowStates.OPEN;A[WebIM.Config.ReservedWindows.CONSOLE]=new WebIM.Util.WindowState(WebIM.Config.ReservedWindows.CONSOLE,D,-1);A[WebIM.Config.ReservedWindows.POPOUT]=new WebIM.Util.WindowState(WebIM.Config.ReservedWindows.POPOUT,B,-1);WebIM.API.updateWindowState(A,null,null,E)},hasDesktopClient:function(){return gotIM!==undefined&&typeof(gotIM)==="function"&&gotIM()},launchDesktopClient:function(A){if(WebIM.Manager.hasDesktopClient()){IsMySpaceIMInstalledById(A);return true}return false},getStatusAndMoodPop:function(D){var B=this.friends[D];if(!B){return null}if(!WebIM.Manager.StatusAndMoodPop){var A=document.createElement("div");A.id="webim_statusandmood_pop";A.className="webimStatusAndMoodPop";A.style.display="none";document.body.appendChild(A);WebIM.Manager.StatusAndMoodPop=A;WebIM.Util.attachEvent(A,"mouseover",function(){WebIM.Manager.showStatusAndMood()});WebIM.Util.attachEvent(A,"mouseout",function(){WebIM.Manager.hideStatusAndMood()});WebIM.Util.attachEvent(A,"click",function(){WebIM.Manager.statusMoodHistoryPage(B.id)})}var E=new Sys.StringBuilder();if(B.status){E.append("<div class='webimFriendStatus'>");E.append(B.status);E.append("</div>")}if(B.moodName){E.append("<div class='webimFriendMood'><span class='webimFriendMoodLabel'>");E.append(WebIM.Strings.MOODS_LABEL);E.append(" </span>");E.append(B.moodName);E.append(" ")}if(B.moodImgUrl){E.append("<img src='");E.append(B.moodImgUrl);E.append("'/>")}E.append("</div>");var C=B.lastUpdatedText?B.lastUpdatedText:"";if(!B.lastUpdatedText){WebIM.API.getStatusAndMoods(D,WebIM.Manager.getStatusAndMoodsCallback,B)}E.append("<div id= 'webimFriendLastUpdatedText' class='webimFriendLastUpdatedText'>");E.append(C);E.append("</div>");WebIM.Manager.StatusAndMoodPop.innerHTML=E.toString();return WebIM.Manager.StatusAndMoodPop},getStatusAndMoodsCallback:function(A,B){if(A.statusmood&&A.statusmood.lastUpdatedText){B.lastUpdatedText=A.statusmood.lastUpdatedText;var C=document.getElementById("webimFriendLastUpdatedText");if(C){C.innerHTML=B.lastUpdatedText}}},showStatusAndMood:function(){clearTimeout(WebIM.Manager.hideStatusTimer);WebIM.Manager.StatusAndMoodPop.style.display="block"},hideStatusAndMood:function(){WebIM.Manager.hideStatusTimer=setTimeout(function(){WebIM.Manager.hideStatusAndMoodDelayed()},50)},hideStatusAndMoodDelayed:function(){if(WebIM.Manager.StatusAndMoodPop){WebIM.Manager.StatusAndMoodPop.style.display="none"}},statusMoodHistoryPage:function(A){window.location.href=String.format(WebIM.Config.friendMoodsV2URL,A)+"&filter=2"}};WebIM._Manager.registerClass("WebIM._Manager",WebIM.EventTarget);WebIM.Manager=new WebIM._Manager();var WebIM=WebIM||{};WebIM.Friend=function(A){this._eventTypes="updateAttributes,displaySendMessageError".split(",");WebIM.Friend.initializeBase(this,[this._eventTypes]);this._attributesString="presence,name,group,imageURL,profileURL,idx,realName,status";this._attributes=this._attributesString.split(",");for(var B=this._attributes.length-1;B>=0;B--){this[this._attributes[B]]=""}this.id=parseInt(A.id);this.name=A.name&&A.name.search(/[^\s]/)!=-1?A.name:WebIM.Strings.NO_DISPLAY_NAME;this.name=this.name.replace(/</g,"&lt;").replace(/>/g,"&gt;");this.presence=A.presence;if(this.presence){this.presence=this.presence.toLowerCase()}this.idx=A.idx;this.group=A.group;this.imageURL=A.imageUrl||WebIM.Config.noPicURL;this.inFriendsList=false;this.profileURL=String.format(WebIM.Config.profileURL,this.id);this.isContact=this._isContact();this.pendingFriend=!!A.pendingFriend;this.realName=!!A.realName;this._cachedDisplayNames={};this.isMSFriend=this.group==WebIM.Config.FriendGroups.CONTACT||(this.group==WebIM.Config.FriendGroups.NON_CONTACT&&A.isMSFriend)||false;this.sad=!!A.sad;this.status=A.status;this.moodName=A.moodName;this.moodImgUrl=A.moodImgUrl;this.lastUpdatedText=A.lastUpdatedText};WebIM.Friend.prototype={updateAttributes:function(B){var A;var C;for(A in B){if(A=="imageUrl"||this._attributesString.indexOf(A)!=-1){if(A=="imageUrl"){C=B[A];A="imageURL"}else{if(A!="presence"){C=B[A]}else{if(B[A]){C=B[A].toLowerCase()}else{C=""}}}if(C&&C!==this[A]){this[A+"Previous"]=this[A];this[A+"Updated"]=true;this[A]=C}else{this[A+"Updated"]=false}}}var D=this.pendingFriend;this.pendingFriend=!!B.pendingFriend;this.sad=!!B.sad;this.isMSFriend=!!B.isMSFriend;this.pendingFriendUpdated=this.pendingFriend!=D;if(this.groupUpdated){this.isContact=this._isContact();if(WebIM.FriendsList.isDisplayable(this)){WebIM.FriendsList.addFriend(this)}}if(this.presenceUpdated&&this.inFriendsList&&!WebIM.FriendsList.isDisplayable(this)){WebIM.FriendsList.removeFriend(this)}else{if(this.presenceUpdated&&!this.inFriendsList&&WebIM.FriendsList.isDisplayable(this)){WebIM.FriendsList.addFriend(this)}}if(this.nameUpdated){this._cachedDisplayNames={}}this.dispatchEvent("updateAttributes")},_isContact:function(){return WebIM.Config.FriendGroups.NON_CONTACT!=this.group},displaySendMessageError:function(){this.dispatchEvent("displaySendMessageError")},getDisplayName:function(B,H){var I=B+(!!H+"");if(this._cachedDisplayNames[I]){return this._cachedDisplayNames[I]}var A=this.name;if(this.realName&&H){A=A.split(/\s/)[0]}var D=this.name.match(/&(\w+|#\d{2,3});?/g);var G=[];var C="&yuml;&#255;&lsquo;&rsquo;&sbquo;&ldquo;&rdquo;&bdquo;&dagger;&Dagger;&permil;&lsaquo;&rsaquo;&spades;&clubs;&hearts;&diams;&oline;&larr;&uarr;&rarr;&darr;&trade;&trade;&#09;&#10;&#32;&#33;&quot;&#34;&#35;&#36;&#37;&amp;&#38;&#39;&#40;&#41;&#42;&#43;&#44;&#45;&#46;&#46;&frasl;&#47;&#48;&#57;&#58;&#59;&lt;&#60;&#61;&gt;&#62;&#63;&#64;&#65;&#90;&#91;&#92;&#93;&#93;&#95;&#95;&#97;&#122;&#123;&#124;&#124;&#125;&#126;&ndash;&#150;&mdash;&#151;&nbsp;&#160;&iexcl;&#161;&cent;&#162;&pound;&#163;&curren;&#164;&yen;&#165;&brvbar;&brkbar;&#166;&sect;&#167;&uml;&die;&#168;&copy;&#169;&ordf;&#170;&laquo;&#171;&not;&#172;&shy;&#173;&reg;&#174;&macr;&hibar;&#175;&macr;&hibar;&#175;&deg;&#176;&plusmn;&#177;&sup2;&#178;&sup3;&#179;&acute;&#180;&micro;&#181;&para;&#182;&middot;&#183;&cedil;&#184;&sup1;&#185;&ordm;&#186;&raquo;&#187;&frac14;&#188;&frac12;&#189;&frac34;&#190;&iquest;&#191;&Agrave;&#192;&Aacute;&#193;&Acirc;&#194;&Acirc;&#194;&Atilde;&#195;&Auml;&#196;&Aring;&#197;&AElig;&#198;&Ccedil;&#199;&Egrave;&#200;&Eacute;&#201;&Ecirc;&#202;&Euml;&#203;&Igrave;&#204;&Iacute;&#205;&Icirc;&#206;&Iuml;&#207;&ETH;&#208;&Ntilde;&#209;&Ograve;&#210;&Oacute;&#211;&Ocirc;&#212;&Otilde;&#213;&Otilde;&#213;&Ouml;&#214;&times;&#215;&Oslash;&#216;&Ugrave;&#217;&Uacute;&#218;&Ucirc;&#219;&Uuml;&#220;&Yacute;&#221;&THORN;&#222;&szlig;&#223;&agrave;&#224;&aacute;&#225;&acirc;&#226;&atilde;&#227;&auml;&#228;&aring;&#229;&aelig;&#230;&ccedil;&#231;&egrave;&#232;&egrave;&#232;&eacute;&#233;&ecirc;&#234;&euml;&#235;&igrave;&#236;&iacute;&#237;&icirc;&#238;&iuml;&#239;&eth;&#240;&ntilde;&#241;&ograve;&#242;&oacute;&#243;&ocirc;&#244;&otilde;&#245;&ouml;&#246;&divide;&#247;&oslash;&#248;&ugrave;&#249;&uacute;&#250;&ucirc;&#251;&ucirc;&#251;&uuml;&#252;&yacute;&#253;&thorn;&#254;&yuml;&#255;";for(var E=0;D&&E<D.length;E++){if(C.indexOf(D[E])!=-1){G.push(D[E]);A=A.replace(D[E],"<")}}if((A.length)>B){A=A.substring(0,(B-2))+"&#8230;"}while(A.indexOf("<")!=-1){var F=G.shift();A=A.replace("<",F?F:"&lt;")}this._cachedDisplayNames[I]=A;return A}};WebIM.Friend.registerClass("WebIM.Friend",WebIM.EventTarget);var WebIM=WebIM||{};WebIM._FriendsList=function(){this._eventTypes="addFriend,removeFriend".split(",");WebIM._FriendsList.initializeBase(this,[this._eventTypes]);this.friendCount=0;this.state=WebIM.Config.WindowStates.MINIMIZE};WebIM._FriendsList.prototype={open:function(A){if(this.state!=WebIM.Config.WindowStates.OPEN){WebIM.Manager.commitWindowState(WebIM.Config.ReservedWindows.FRIENDS_LIST,WebIM.Config.WindowStates.OPEN)}WebIM._FriendsList.callBaseMethod(this,"open",null);WebIM.Util.Cookie.saveFriendsListState(true)},minimize:function(A){if(this.state!=WebIM.Config.WindowStates.MINIMIZE){WebIM.Manager.commitWindowState(WebIM.Config.ReservedWindows.FRIENDS_LIST,WebIM.Config.WindowStates.MINIMIZE)}WebIM._FriendsList.callBaseMethod(this,"minimize",null);WebIM.Util.Cookie.saveFriendsListState(false)},isDisplayable:function(A){return A!==WebIM.Viewer&&(A.group==WebIM.Config.FriendGroups.CONTACT||A.group==WebIM.Config.FriendGroups.RECENT)&&A.presence!=WebIM.Config.PresenceTypes.OFFLINE&&A.presence!=WebIM.Config.PresenceTypes.NOTSET},addFriend:function(A){if(this.friendCount>WebIM.Config.MAX_FRIEND_DISPLAY_COUNT||A.inFriendsList){return}if(!WebIM.Manager.firstEventsResponse&&WebIM.Settings.soundOnline){WebIM.Manager.playSound(WebIM.Config.Sounds.NEW_ONLINE_FRIEND)}A.inFriendsList=true;this.friendCount++;WebIM.Util.Cookie.saveFriendCount(this.friendCount);this.dispatchEvent("addFriend",{friend:A})},removeFriend:function(A){A.inFriendsList=false;if(this.friendCount>0){this.friendCount--}WebIM.Util.Cookie.saveFriendCount(this.friendCount);this.dispatchEvent("removeFriend",{friend:A})}};WebIM._FriendsList.registerClass("WebIM._FriendsList",WebIM.CommonWindow);var WebIM=WebIM||{};WebIM.Conversation=function(B,A){this._eventTypes="clearHistory,displayMessages,updateTypingStatus".split(",");WebIM.Conversation.initializeBase(this,[this._eventTypes]);this.friend=B;this.index=A;this._messageQueue=[];this.typing=false};WebIM.Conversation.resetConversationIndexes=function(){var C=[];for(var B in WebIM.Manager.conversations){var D=WebIM.Manager.conversations[B];if(D.state!=WebIM.Config.WindowStates.CLOSE){C.push(D)}}C.sort(WebIM.Util.conversationSortFunc);WebIM.Manager._conversationCount=0;for(var A=0;A<C.length;A++){var D=C[A];D.index=WebIM.Manager._conversationCount++;WebIM.Manager.commitWindowState(D.friend.id,D.state,D.index)}};WebIM.Conversation.prototype={close:function(A){if(this.state!=WebIM.Config.WindowStates.CLOSE){this.index=-2;WebIM.Manager.commitWindowState(this.friend.id,WebIM.Config.WindowStates.CLOSE,this.index);var B=this.state;this.state=WebIM.Config.WindowStates.CLOSE;WebIM.Conversation.resetConversationIndexes();this.state=B;WebIM.Conversation.callBaseMethod(this,"close",null)}},open:function(A){if(this.state!=WebIM.Config.WindowStates.OPEN){if(this.index<0){this.index=WebIM.Manager._conversationCount++}WebIM.Manager.commitWindowState(this.friend.id,WebIM.Config.WindowStates.OPEN,this.index);WebIM.Conversation.callBaseMethod(this,"open",null)}},minimize:function(A){if(this.state!=WebIM.Config.WindowStates.MINIMIZE){if(this.index<0){this.index=WebIM.Manager._conversationCount++}WebIM.Manager.commitWindowState(this.friend.id,WebIM.Config.WindowStates.MINIMIZE,this.index);WebIM.Conversation.callBaseMethod(this,"minimize",null)}},displayMessages:function(){var A=this._messageQueue.concat();this.dispatchEvent("displayMessages",{messages:A});this._messageQueue=[]},clearHistory:function(){this.dispatchEvent("clearHistory")},updateTypingStatus:function(A){this.typing=A;this.dispatchEvent("updateTypingStatus",{status:A})}};WebIM.Conversation.registerClass("WebIM.Conversation",WebIM.CommonWindow);var WebIM=WebIM||{};WebIM.ElementContainer=function(B){this.args=B;this.container=$get(B.id);this.generatedFromServer=!!this.container;this.createIFrame=B.createIFrame!=undefined?B.createIFrame:true;this.callReady=B.callReady!=undefined?B.callReady:true;this.id=B.id;this.containerURL=B.containerURL;this.parentWindow=B.parentWindow?B.parentWindow:window;this.listeners=[];this.ready=false;var E=this;this.onReadyParam=B.onReady;var F=function(){if(!E.callReady){return}if(window!==this){this.onload=null}if(typeof E.onReady=="function"){E.onReady()}if(typeof B.onReady=="function"){B.onReady.call(E,null)}var G=E.document.getElementById("contentLoadFrame");setTimeout(function(){if(G){G.onload=null;E.document.body.removeChild(G)}},100);E._callListeners();E.ready=true};var A=function(){if(window!==this){this.onload=null}E.window=E.container.contentWindow;E.document=E.window.document;E.window.WebIM=window.WebIM;E.window.MySpace=window.MySpace;E.window._onFrameContentLoaded=F;if(B.innerHTML){var G="<iframe id='contentLoadFrame' width=0 height=0 frameBorder=0 onload=\"_onFrameContentLoaded.call( this, null );\" ></iframe>";B.innerHTML=B.innerHTML+G;E.insertHTML({html:B.innerHTML,elementName:"body"})}if(E.containerURL!=WebIM.Config.genericFrameURL){F()}};if(!WebIM.Manager.domainGeneralized&&!this.generatedFromServer){this.containerURL=WebIM.Util.appendQueryParam(this.containerURL,"suppressGeneralizeDomain",true,true)}if(!this.generatedFromServer){this.container=WebIM.Util.createIframe(this.containerURL,false,A,F,null,true);this.container.id=this.id;var D="mimContainer ";if(B.cssClasses){for(var C=0;C<B.cssClasses.length;C++){D+=B.cssClasses[C]+" "}}WebIM.Util.setAttributes(this.container,{frameBorder:0,scrolling:"no",id:this.id,className:D});this.parentWindow.document.body.appendChild(this.container)}else{this.initializeForServerWindow()}if(this.args.attributes){WebIM.Util.setAttributes(this.container,this.args.attributes)}if(this.args.styles){WebIM.Util.setStyles(this.container,this.args.styles)}if(browser.isIE6x||(browser.isIE6up&&document.compatMode=="BackCompat")){this.container.style.position="absolute";this.position=B.position}};WebIM.ElementContainer.prototype={initializeForServerWindow:function(){var A=this;if(A.initialized){return}if(!A.container.cachedsrc){A.window=A.container.contentWindow;A.retryDomainCheckAttempts=1;A.container.cachedsrc=A.container.src}try{A.window.document.domain;A.prepareElementsFastRender()}catch(B){WebIM.Util.error(B);if(A.retryDomainCheckAttempts<10){A.retryDomainCheckAttempts+=1;setTimeout(function(){A.initializeForServerWindow()},200)}}},prepareElementsFastRender:function(){var A=this;if(A.window.pageLoaded){A.document=A.window.document;A.window.WebIM=window.WebIM;A.window.MySpace=window.MySpace;if(!this.ready){this.ready=true;if(this.onReady){this.onReady()}if(this.onReadyParam){this.onReadyParam()}this._callListeners()}A.initialized=true;this.container.style.visibility="visible"}else{setTimeout(function(){A.prepareElementsFastRender()},100)}},_callListeners:function(){for(var A=this.listeners.length-1;A>=0;A--){try{this.listeners[A](this)}catch(B){}}this.listeners=[]},addListener:function(A){if(typeof A=="function"){if(this.ready){A(this)}else{this.listeners.push(A)}}},removeListener:function(A){if(typeof A=="function"){this.listeners.remove(A)}},_insert:function(){this.parentWindow.document.body.appendChild(this.container)},get:function(A){return this.document.getElementById(A)},hide:function(){Sys.UI.DomElement.addCssClass(this.container,"mimHidden")},show:function(){this.setPosition();Sys.UI.DomElement.removeCssClass(this.container,"mimHidden")},visible:function(){return !Sys.UI.DomElement.containsCssClass(this.container,"mimHidden")},toggle:function(){this.visible()?this.hide():this.show()},insertElement:function(B,A){},setHTML:function(A){A.set=true;this._setHTML(A)},insertHTML:function(A){A.append=true;this._setHTML(A)},_setHTML:function(A){var B;if(A.elementID){B=this.document.getElementByID(A.elementID)}if(A.elementName){B=this.document.getElementsByTagName(A.elementName)[0]}if(B){if(A.append){B.innerHTML+=A.html}else{if(A.set){B.innerHTML=A.html}}}},setPosition:function(){if(this.position==null){return}if(this.position.bottom){if(!browser.isIE6x&&browser.isIE6up){var A=this.position.bottom?parseInt(this.position.bottom):0;var B=A-document.body.scrollTop;this.container.style.bottom=B+"px"}}},destroy:function(){try{this.parentWindow.document.body.removeChild(this.container)}catch(A){}}};WebIM.ElementContainer.registerClass("WebIM.ElementContainer");WebIM.Console=WebIM.Console||{};WebIM.Console.Dialog=function(A){A.position=A.position?A.position:{};A.position.bottom="25px";if((browser.isIE6up&&document.compatMode=="BackCompat")){A.position.bottom="19px"}WebIM.Console.Dialog.initializeBase(this,[A]);if(!this.targetNode&&A.targetNode){this.targetNode=A.targetNode}this.offset=A.offset?A.offset:0;this.alignment=A.alignment;this.right=A.right;this.left=A.left;this._width=222};WebIM.Console.Dialog.prototype={onReady:function(){},show:function(){if(this.visible()){return}WebIM.Console.Dialog.callBaseMethod(this,"show",null);Sys.UI.DomElement.addCssClass(this.targetNode,"consoleTabSelect")},hide:function(){if(!this.visible()){return}WebIM.Console.Dialog.callBaseMethod(this,"hide",null);Sys.UI.DomElement.removeCssClass(this.targetNode,"consoleTabSelect")},setTargetNode:function(A){if(A){this.targetNode=A}},setPosition:function(){WebIM.Console.Dialog.callBaseMethod(this,"setPosition",null);if(!this.targetNode){return}var A=this._getTargetNodePosition();var C=function(E){var D=document.documentElement.offsetWidth;return D-E-this._width};if(this.right){this.container.style.right=this.right}else{if(this.left){this.container.style.left=this.left}else{if(this.alignment=="left"){var B=this.offset+A.left;WebIM.Util.setStyles(this.container,{right:C.call(this,B)+"px"})}else{if(this.alignment=="right"){var B=this.offset+A.left-this._width+WebIM.Util.getTotalDimensions(this.targetNode).width;WebIM.Util.setStyles(this.container,{right:C.call(this,B)+"px"})}}}}},_getTargetNodePosition:function(){return WebIM.Util.getPosition(this.targetNode)},align:function(A){if(/^left$|^right$/.test(A)){if(this.alignment!=A){this.alignment=A;this.setPosition()}}}};WebIM.Console.Dialog.registerClass("WebIM.Console.Dialog",WebIM.ElementContainer);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console._SettingsDialog=function(A){this.optCallback=A;this.popoutText=true};WebIM.Console._SettingsDialog.prototype={onReady:function(){var A=this;this.window.addHandler("closeButton","click",function(){WebIM.Console.SettingsDialog.close()});this.window.addHandler("popOutIM","click",function(){WebIM.Console.SettingsDialog.close();if(WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.POPPED_OUT){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT)}else{WebIM.Console.Manager.popOutIM()}});if(!WebIM.Manager.isBrowserSupported()){this.rendered=true;return}this.generalSettings=this.get("generalsettingsdiv");this.imSettings=this.get("imsettingsdiv");this.privacySettings=this.get("privacysettingsdiv");this.loadingMessage=this.get("settingsLoader");this.popoutIMText=this.get("popOutIMText");var B=this.get("lblPrivacyEveryone");if(B&&WebIM.ViewerJSON.age){if(WebIM.ViewerJSON.age<=15){B.innerHTML=WebIM.Strings.EVERYONEUNDER18}}this.window.addHandler("gohidden","click",function(){if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.HIDDEN){A.updatePresence(WebIM.Config.PresenceTypes.HIDDEN)}else{A.updatePresence(WebIM.Config.PresenceTypes.ONLINE)}});this.window.addHandler("gooffline","click",function(){if(WebIM.Viewer.presence!=WebIM.Config.PresenceTypes.OFFLINE){A.updatePresence(WebIM.Config.PresenceTypes.OFFLINE)}else{A.updatePresence(WebIM.Config.PresenceTypes.ONLINE)}});this.window.addHandler("generalsettings","click",function(){WebIM.Console.SettingsDialog.showGeneralSettings()});this.window.addHandler("privacysettings","click",function(){WebIM.Console.SettingsDialog.showPrivacySettings()});this.window.addHandler("saveButton","click",function(){WebIM.Console.SettingsDialog.saveGeneralSettings()});this.window.addHandler("cancelButton","click",function(){WebIM.Console.SettingsDialog.close()});this.window.addHandler("savePrivacyButton","click",function(){WebIM.Console.SettingsDialog.savePrivacySettings()});this.window.addHandler("cancelPrivacyButton","click",function(){WebIM.Console.SettingsDialog.close()});this.window.addHandler("editBlockList","click",WebIM.Console.Manager.editBlockList);this.window.addHandler("editFriends","click",WebIM.Console.Manager.editFriends);if(typeof this.optCallback=="function"){this.optCallback()}WebIM.Viewer.addEventListener("updateAttributes",function(){WebIM.Console.SettingsDialog.updateOfflineOnlineButton()});WebIM.Manager.addEventListener("goOffline",function(){WebIM.Console.SettingsDialog.updateOfflineOnlineButton()});WebIM.Console.ConsoleUI.settingsTabElement.addListener(function(C){WebIM.Console._SettingsDialog.callBaseMethod(A,"onReady",null);A.rendered=true;A.updatePopoutIMText();A.show()})},_setTargetNode:function(){if(!WebIM.Manager.isBrowserSupported()){this.setTargetNode(WebIM.Console.ConsoleUI.settingsTabElement.get("notSupportedTab"))}else{this.setTargetNode(WebIM.Console.ConsoleUI.settingsTabElement.get("settingsDialog"))}},_render:function(){if(this._renderCalled){return}this._renderCalled=true;WebIM.Console._SettingsDialog.initializeBase(this,[{id:"settingsDialogContainer",containerURL:WebIM.Config.SETTINGS_POPUP_FRAME_URL,cssClasses:["mimPopup","mimHidden"],styles:{right:WebIM.Console.ConsoleUI.isIndicatorShowing()?"28px":"1px",width:WebIM.Console.Manager.isSpecialCulture?"250px":""}}])},updateOfflineOnlineButton:function(){var C=WebIM.Console.SettingsDialog.get("gohidden");var D=WebIM.Console.SettingsDialog.get("goHiddenContent");var A=WebIM.Console.SettingsDialog.get("gooffline");var B=WebIM.Console.SettingsDialog.get("goOfflineContent");C.style.display="block";if(WebIM.Viewer.presence===WebIM.Config.PresenceTypes.OFFLINE){B.innerHTML=WebIM.Strings.GO_ONLINE;A.className="onlinelink";C.style.display="none";D.innerHTML=WebIM.Strings.GO_HIDDEN}else{if(WebIM.Viewer.presence==WebIM.Config.PresenceTypes.ONLINE){B.innerHTML=WebIM.Strings.GO_OFFLINE;A.className="offlinelinks";D.innerHTML=WebIM.Strings.GO_HIDDEN;C.className="offlinelinks"}else{if(WebIM.Viewer.presence==WebIM.Config.PresenceTypes.HIDDEN){B.innerHTML=WebIM.Strings.GO_OFFLINE;A.className="offlinelinks";D.innerHTML=WebIM.Strings.UNHIDE;C.className="onlinelink"}}}},show:function(){if(!this.rendered){this._render();return}if(!this.targetNode){this._setTargetNode()}var A=WebIM.Console.ConsoleUI.state;if(WebIM.Console.ConsoleUI.state.search(/UNAVAILABLE|LOGGED_IN_OTHER_LOCATION|LOADING|OFFLINE/)!=-1){return}if(WebIM.Manager.isBrowserSupported()){if(!this.visible()){this.showTopSettings()}WebIM.FriendsList.minimize();WebIM.Console.IndicatorsPopup.hide()}WebIM.Console._SettingsDialog.callBaseMethod(this,"show",null)},visible:function(){if(!this.rendered){return false}return WebIM.Console._SettingsDialog.callBaseMethod(this,"visible",null)},hide:function(){if(!this.rendered||!this.visible()){return}WebIM.Console._SettingsDialog.callBaseMethod(this,"hide",null)},close:function(){this.hide()},showTopSettings:function(){this.updateOfflineOnlineButton();this.generalSettings.style.display="block";this.imSettings.style.display="none";this.privacySettings.style.display="none";this.loadingMessage.style.display="none"},intializeIndicatorSettings:function(){this.cbActivityAlert=this.get("cbActivityAlert");this.cbSoundActivity=this.get("cbSoundActivity");this.activityAlertSoundCont=this.get("activityAlertSoundCont");if(!WebIM.Config.showIndicators){this.get("activityAlertCont").style.display="none";this.activityAlertSoundCont.style.display="none"}else{this.window.addHandler("cbActivityAlert","click",function(){WebIM.Console.SettingsDialog.toggleSoundActivity()})}this.intializedIndicatorSettings=true},toggleSoundActivity:function(){if(this.cbActivityAlert.checked){this.cbSoundActivity.disabled=false;this.activityAlertSoundCont.style.color=""}else{this.cbSoundActivity.disabled=true;this.activityAlertSoundCont.style.color="#aaa"}},showGeneralSettings:function(){var A=this.get("cbShowIdle");var D=this.get("idletime");var C=this.get("cbSoundIM");var B=this.get("cbSoundFriend");if(!this.intializedIndicatorSettings){this.intializeIndicatorSettings()}if(WebIM.Config.showIndicators){if(WebIM.Settings.indicators>0){this.cbActivityAlert.checked=true;if(WebIM.Settings.soundIndicators>0){this.cbSoundActivity.checked=true}else{this.cbSoundActivity.checked=false}}else{this.cbActivityAlert.checked=false}this.toggleSoundActivity()}if(WebIM.Settings.idle>0){A.checked=true;D.value=WebIM.Settings.idle}else{A.checked=false;D.value=WebIM.Config.defaultIdleTime}if(WebIM.Settings.soundNewIM>0){C.checked=true}else{C.checked=false}if(WebIM.Settings.soundOnline>0){B.checked=true}else{B.checked=false}this.generalSettings.style.display="none";this.imSettings.style.display="block";this.privacySettings.style.display="none"},retrievePrivacySettingsCallback:function(A){if(A.statusCode==200){WebIM.PrivacySettings.update(A.privacy);WebIM.Console.SettingsDialog.generalSettings.style.display="none";WebIM.Console.SettingsDialog.imSettings.style.display="none";WebIM.Console.SettingsDialog.privacySettings.style.display="block";WebIM.Console.SettingsDialog.loadingMessage.style.display="none";WebIM.Console.SettingsDialog.setPrivacySettings()}else{WebIM.Console.SettingsDialog.loadingMessage.className=" error";WebIM.Console.SettingsDialog.loadingMessage.innerHTML=WebIM.Strings.SETTINGS_RETRIEVE_ERROR}},setPrivacySettings:function(){switch(WebIM.PrivacySettings.privacy){case WebIM.PrivacySettings.PrivacyTypes.Everyone:this.get("rbPrivacyEveryone").checked=true;break;case WebIM.PrivacySettings.PrivacyTypes.FriendsOnly:this.get("rbPrivacyALL").checked=true;break;case WebIM.PrivacySettings.PrivacyTypes.ContactsOnly:this.get("rbPrivacyIM").checked=true;break;case WebIM.PrivacySettings.PrivacyTypes.NoOne:this.get("rbPrivacyNo").checked=true;break}},getPrivacySettings:function(){if(this.get("rbPrivacyEveryone").checked){return WebIM.PrivacySettings.PrivacyTypes.Everyone}if(this.get("rbPrivacyALL").checked){return WebIM.PrivacySettings.PrivacyTypes.FriendsOnly}if(this.get("rbPrivacyIM").checked){return WebIM.PrivacySettings.PrivacyTypes.ContactsOnly}if(this.get("rbPrivacyNo").checked){return WebIM.PrivacySettings.PrivacyTypes.NoOne}},showPrivacySettings:function(){WebIM.API.retrievePrivacySettings(this.retrievePrivacySettingsCallback);this.generalSettings.style.display="none";this.imSettings.style.display="none";this.privacySettings.style.display="none";this.loadingMessage.style.display="block";this.loadingMessage.innerHTML=WebIM.Strings.SETTINGS_LOADING},savePrivacySettings:function(){if(!this.savingPrivacySettings){this.savingPrivacySettings=true;this.toggleSave(true,"savePrivacyButton");WebIM.API.updatePrivacySettings({privacy:this.getPrivacySettings()},this.updatePrivacySettingsCallback)}},updatePrivacySettingsCallback:function(A){WebIM.Console.SettingsDialog.toggleSave(false,"savePrivacyButton");WebIM.Console.SettingsDialog.savingPrivacySettings=false;if(A.statusCode!=200){alert(WebIM.Strings.SETTINGS_SAVE_ERROR)}else{WebIM.Console.SettingsDialog.close()}},setValidIdleTime:function(){var B;var C=this.get("idletime");var A=parseInt(C.value);if(!isNaN(A)&&C.value.search(/[^-\d+\.]/)==-1&&C.value.search(/\.($|\s)/)==-1){if(A<WebIM.Config.minIdleTime){B=WebIM.Config.minIdleTime}else{if(A>WebIM.Config.maxIdleTime){B=WebIM.Config.maxIdleTime}}}else{B=WebIM.Config.defaultIdleTime}if(B){this.get("idleErrorMessage").style.display="block";C.value=B;return true}else{this.get("idleErrorMessage").style.display="none";return false}},saveGeneralSettings:function(){if(!this.savingIMSettings){var B=this.get("cbShowIdle");if(B.checked&&this.setValidIdleTime()){return}this.toggleSave(true,"saveButton");this.savingIMSettings=true;var G=this.get("idletime");var E=this.get("cbSoundIM");var D=this.get("cbSoundFriend");var C=0;if(B.checked){C=parseInt(G.value,10)}if(isNaN(C)){C=WebIM.Config.defaultIdleTime}var F=0;var A=0;if(WebIM.Config.showIndicators){if(this.cbActivityAlert.checked){F=1;if(this.cbSoundActivity.checked){A=1}}else{if(WebIM.Settings.indicators==1){WebIM.Console.ConsoleUI.hideIndicator()}}}else{F=1;A=1}WebIM.API.updateIMSettings({idle:C,soundNewIM:E.checked?1:0,soundOnline:D.checked?1:0,alphaSort:0,indicators:F,soundIndicators:A},this.updateIMSettingsCallback)}},toggleSave:function(C,A){var B=this.get(A);if(C){B.value=WebIM.Strings.SETTINGS_SAVING;B.disabled=true}else{B.value=WebIM.Strings.SAVE;B.disabled=false}},updateIMSettingsCallback:function(B,A){WebIM.Console.SettingsDialog.toggleSave(false,"saveButton");WebIM.Console.SettingsDialog.savingIMSettings=false;if(B.statusCode!=200){alert(WebIM.Strings.SETTINGS_SAVE_ERROR)}else{WebIM.Settings.update(A);WebIM.Console.SettingsDialog.close()}},updatePresence:function(A){if(!this.updatingPresence){this.updatingPresence=true;if(A==WebIM.Config.PresenceTypes.ONLINE){WebIM.Manager.goOnline(this.updatePresenceCallback)}else{if(A===WebIM.Config.PresenceTypes.OFFLINE){WebIM.Manager.goOffline(this.updatePresenceCallback)}else{if(A==WebIM.Config.PresenceTypes.HIDDEN){WebIM.Manager.goHidden(this.updatePresenceCallback)}}}}},updatePresenceCallback:function(B,A){WebIM.Console.SettingsDialog.updatingPresence=false;if(B.statusCode!=200){alert(WebIM.Strings.PRESENCE_SAVE_ERROR)}else{WebIM.Console.SettingsDialog.close()}},updatePopoutIMText:function(){if(!this.rendered||!this.popoutIMText||!WebIM.Manager.isBrowserSupported()){return}if(WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.POPPED_OUT&&this.popoutText){this.get("popOutIM").className="popOutIM popInIM";this.popoutText=false;this.popoutIMText.innerHTML=WebIM.Strings.POP_IN_IM}else{if(!this.popoutText){this.get("popOutIM").className="popOutIM";this.popoutText=true;this.popoutIMText.innerHTML=WebIM.Strings.POP_OUT_IM}}},toggle:function(){if(!this.ready){this._render();return}WebIM.Console._SettingsDialog.callBaseMethod(this,"toggle",null)}};WebIM.Console._SettingsDialog.registerClass("WebIM.Console._SettingsDialog",WebIM.Console.Dialog);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console._IndicatorsPopup=function(A){this.optCallback=A;this.popoutText=true;this.indicatorQueue=[];this.indicatorList=[];this.previousIndicatorsCount=0;this.unread="0";this.indicatorElement="<a class='webimIndicator' href='{1}' target='_blank'><div id='{0}' class='indicatorImage'></div>{2}</a>";WebIM.Console.ConsoleUI.settingsTabElement.window.addHandlerFor(WebIM.Console.ConsoleUI.settingsIndicatorTab,"click",function(){if(WebIM.Console.IndicatorsPopup.visible()){WebIM.Console.IndicatorsPopup.hide()}else{WebIM.Console.IndicatorsPopup.show(WebIM.Console.ConsoleUI.settingsIndicatorTab)}});this.addHover(WebIM.Console.ConsoleUI.settingsIndicatorTab,WebIM.Console.ConsoleUI.settingsTabElement.window)};WebIM.Console._IndicatorsPopup.prototype={onReady:function(){this.rendered=true;this.indicatorPointer=this.get("indicatorPointer");this.indicatorsContainer=this.get("indicatorsContainer");this.show();this.indicatorsBody=this.get("indicatorsBody");this.window.addHandler("minimizeButton","click",function(){WebIM.Console.IndicatorsPopup.hide()});this.refreshIndicators(this.indicatorQueue)},addHover:function(A,B){B.addHandlerFor(A,"mouseover",function(){if(!Sys.UI.DomElement.containsCssClass(this,"consoleTabSelect")){Sys.UI.DomElement.addCssClass(this,"consoleTabHover")}});B.addHandlerFor(A,"mouseout",function(){Sys.UI.DomElement.removeCssClass(this,"consoleTabHover")})},indicatorsChanged:function(A,B){this.unread=A;this.previousIndicatorsCount=this.indicatorList.length;this.indicatorList=B;if(this.rendered){this.refreshIndicators(B)}else{this.indicatorQueue=B}},refreshIndicators:function(B){var C=new Sys.StringBuilder();for(var A=0;A<B.length;A++){C.append(String.format(this.indicatorElement,B[A].type,B[A].indicatorURL,B[A].message))}if(this.indicatorsBody){this.indicatorsBody.innerHTML=C.toString()}if(B.length==0){this.hide()}this.adjustHeight(B.length)},addIndicator:function(A){if(this.indicatorsBody){this.indicatorsBody.appendChild(A)}},adjustHeight:function(B){var A=250;if(B<12){A=B*22}WebIM.Util.setStyles(this.container,{height:60+A+"px"});WebIM.Util.setStyles(this.indicatorsContainer,{height:50+A+"px"})},_render:function(A){if(this._renderCalled){return}this._renderCalled=true;WebIM.Console._IndicatorsPopup.initializeBase(this,[{id:"indicatorsPopup",containerURL:WebIM.Config.INDICATORS_POPUP_FRAME_URL,cssClasses:["mimPopup","mimHidden"],styles:{left:"1px"},targetNode:A}])},show:function(A){if(!this.rendered){this._render(A);return}if(A){this.targetNode=A}if(this.targetNode==WebIM.Console.ConsoleUI.settingsIndicatorTab){WebIM.Util.setStyles(this.container,{right:"1px",left:""});WebIM.Util.setStyles(this.indicatorPointer,{left:"180px"})}Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.settingsIndicatorTab,"consoleTabAlert");WebIM.Console._IndicatorsPopup.callBaseMethod(this,"show",null);if(this.unread=="1"){this.unread=="0";WebIM.API.setIndicatorRead()}WebIM.FriendsList.minimize();WebIM.Console.SettingsDialog.hide()},hide:function(){if(!this.visible()){return}WebIM.Console._IndicatorsPopup.callBaseMethod(this,"hide",null)},visible:function(){if(!this.rendered){return false}return WebIM.Console._IndicatorsPopup.callBaseMethod(this,"visible",null)}};WebIM.Console._IndicatorsPopup.registerClass("WebIM.Console._IndicatorsPopup",WebIM.Console.Dialog);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console._ConsoleUI=function(D){var B=this;this.activeIndicators={};var A=function(){WebIM.ConsoleWindow.addEventListener("open",function(){B.setState(WebIM.Config.ConsoleStates.DEFAULT);if(WebIM.FriendsList.state==WebIM.Config.WindowStates.OPEN){WebIM.Console.FriendsList.show()}if(WebIM.Conversation.active){if(WebIM.Conversation.active._conversation.visible&&!WebIM.Conversation.active._conversation.visible()){WebIM.Conversation.active._conversation.open()}}});WebIM.ConsoleWindow.addEventListener("minimize",function(){B.setState(WebIM.Config.ConsoleStates.COLLAPSED)});WebIM.ConsoleWindow.addEventListener("updateWindowState",function(E){if(E.state==WebIM.Config.WindowStates.OPEN){if(B.state!=WebIM.Config.ConsoleStates.POPPED_OUT){B.setState(WebIM.Config.ConsoleStates.POPPED_OUT)}}});WebIM.PopoutWindow.addEventListener("open",function(){B.setState(WebIM.Config.ConsoleStates.POPPED_OUT)});if(WebIM.Manager.isBrowserSupported()){WebIM.Console.TabManager.addEventHandlers("settingsDialog",this.window.addHandler);WebIM.Console.TabManager.addEventHandlers("poppedOutTab",this.window.addHandler);this.window.addHandler("poppedOutTab","click",function(){WebIM.Console.Manager.focusPopout()});this.window.addHandler("settingsDialog","click",function(){WebIM.Console.SettingsDialog.toggle()})}else{WebIM.Console.TabManager.addEventHandlers("notSupportedTab",this.window.addHandler);this.window.addHandler("notSupportedTab","click",function(){WebIM.Console.SettingsDialog.toggle()})}this.window.addHandler("consoleCollapseTab","click",function(){switch(WebIM.Console.ConsoleUI.state){case"NOT_SUPPORTED":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED_NOT_SUPPORTED);break;case"COLLAPSED_NOT_SUPPORTED":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.NOT_SUPPORTED);break;case"DEFAULT":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED);break;case"UNAVAILABLE":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED_UNAVAILABLE);break;case"COLLAPSED_UNAVAILABLE":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.UNAVAILABLE);break;case"OFFLINE":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED_OFFLINE);break;case"COLLAPSED_OFFLINE":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.OFFLINE);break;case"LOGGED_IN_OTHER_LOCATION":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED_LOGGED_IN_OTHER_LOCATION);break;case"COLLAPSED_LOGGED_IN_OTHER_LOCATION":WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.LOGGED_IN_OTHER_LOCATION);break;case"POPPED_OUT":case"COLLAPSED":if(WebIM.Manager.isBrowserSupported()){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT)}else{WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.NOT_SUPPORTED)}break}});WebIM.Console.TabManager.addEventHandlers("consoleCollapseTab",this.window.addHandler);B.collapseButton=this.get("collapseButtonIcon");B.borderImg=this.get("tabsBorderImg");B.viewerPresence=this.get("settingsPresence");B.fixedTabs=this.get("fixedTabs");B.popOutTab=this.get("poppedOutTab");B.alertTab=this.get("collapsedAlertTab");B.settingsIndicatorTab=this.get("settingsIndicatorTab");this.window.addHandlerFor(B.alertTab,"click",function(){var E=function(){if(WebIM.Conversation._lastAlertedConversation){WebIM.Conversation._lastAlertedConversation.open()}WebIM.Manager.removeEventListener("updateWindowStates",E)};WebIM.Manager.addEventListener("updateWindowStates",E);WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT)});B.settingsBorder=this.get("settingsBorder");B.settingsButton=this.get("settingsButton");B.newMessageAlertPop=this.get("newMessageAlertPopOut");B.newMessageAlertCol=this.get("newMessageAlertCollapsed");WebIM.Manager.addEventListener("indicatorsEvent",function(E){if(WebIM.Settings.indicators==1){if(E.list&&E.list.length>0){WebIM.Console.ConsoleUI.showIndicator();if(E.unread=="1"&&E.list.length>WebIM.Console.IndicatorsPopup.indicatorList.length){if(!WebIM.Manager.firstEventsResponse){WebIM.Console.ConsoleUI.alertIndicator()}else{WebIM.Console.ConsoleUI.highlightIndicator()}}else{if(E.unread=="0"){WebIM.Console.ConsoleUI.removeHighlightIndicator()}}}else{WebIM.Console.ConsoleUI.hideIndicator()}if(E.list){WebIM.Console.IndicatorsPopup.indicatorsChanged(E.unread,E.list)}}else{WebIM.Console.ConsoleUI.hideIndicator()}})};this.settingsTabElement=new WebIM.ElementContainer({id:"settingsTabContainer",containerURL:WebIM.Config.CONSOLE_SETTINGS_FRAME_URL,position:{right:"0px",bottom:"0px"},cssClasses:["mimHidden"],onReady:A});this.collapsed=false;this._convRef=null;this.optCallback=D;this.helpSponsorHidden=true;WebIM.Console._ConsoleUI.initializeBase(this,[{id:"imConsoleContainer",containerURL:WebIM.Config.CONSOLE_TABS_FRAME_URL,position:{bottom:"0px",left:"0px"},cssClasses:["mimHidden"]}]);WebIM.Viewer.addEventListener("updateAttributes",function(){if(WebIM.Viewer.presenceUpdated){WebIM.Console.ConsoleUI.updatePresence(WebIM.Viewer.presence)}});var C=false;WebIM.Manager.addEventListener("processEvents",function(E){if(WebIM.Manager.firstEventsResponse){WebIM.Console.ConsoleUI.updatePresence(WebIM.Viewer.presence);if(WebIM.Console.TabManager.tabs.length==0&&WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.DEFAULT){WebIM.Console.ConsoleUI.showHelpMessageAndSponsor()}WebIM.Console.TabManager.onResize()}else{if(WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.UNAVAILABLE){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT)}}});if(browser.isGecko&&!WebIM.Config.genConsoleFromS){$addHandler(window,"focus",function(){try{if(this.settingsElementHacked){return}this.settingsElementHacked=true;var E=parseInt(WebIM.Console.ConsoleUI.settingsTabElement.container.style.width);setTimeout(function(){WebIM.Console.ConsoleUI.settingsTabElement.container.style.width=E+"px"},10);WebIM.Console.ConsoleUI.settingsTabElement.container.style.width=(E+1)+"px"}catch(F){}})}};WebIM.Console._ConsoleUI.prototype={onReady:function(){if(WebIM.Console.FriendsList){WebIM.Console.FriendsList.targetNode=this.get("friendsListTab")}WebIM.Console.TabManager.addEventHandlers("friendsListTab",this.window.addHandler);if(WebIM.Console.Manager.isSpecialCulture){this.get("friendsListTab").style.width="165px"}this.tabsNode=this.get("tabs");this.friendsCountIndicator=this.get("buddyListBuddyCount");this.shiftLeftButton=this.get("shiftLeftButton");this.shiftRightButton=this.get("shiftRightButton");this.window.addHandler("shiftLeftButton","click",WebIM.Console.TabManager.shiftLeft);this.window.addHandler("shiftRightButton","click",WebIM.Console.TabManager.shiftRight);this.leftTabCount=this.get("leftTabCount");this.rightTabCount=this.get("rightTabCount");this.newMessageAlertLeft=this.get("newMessageAlertLeft");this.newMessageAlertRight=this.get("newMessageAlertRight");this.offlineMessage=this.get("offlineMessage");this.loggedInOtherLocationMessage=this.get("loggedInOtherLocationMessage");this.unavailableMessage=this.get("unavailableMessage");this.consoleElement=this.get("imConsole");this.tabContainer=this.get("collapsable");this.window.addHandler("friendsListTab","click",function(){if(WebIM.Console.FriendsList.visible()){WebIM.FriendsList.minimize()}else{WebIM.FriendsList.open()}});if(browser.isIE6x){WebIM.Util.setStyles(this.container,{position:"absolute",bottom:"0px",left:"0px"})}var A=this;this.settingsTabElement.addListener(function(){var B=WebIM.Util.Cookie.getConsoleState();if(WebIM.Config.genConsoleFromS){if(!B){B="DEFAULT"}}else{B=!B||B.search(/(COLLAPSED|OFFLINE|POPPED_OUT)/)==-1?WebIM.Config.ConsoleStates.DEFAULT:B}if(B!=WebIM.Config.ConsoleStates.COLLAPSED&&!WebIM.Manager.isBrowserSupported()){B=WebIM.Config.ConsoleStates.NOT_SUPPORTED}A.setState(B);if(typeof A.optCallback=="function"){setTimeout(function(){A.optCallback()},100)}})},goOnline:function(A){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT);if(A){WebIM.Manager.forceOnline()}else{WebIM.Viewer.presencePrevious=WebIM.Config.PresenceTypes.OFFLINE;WebIM.Manager.goOnline()}},hideOrShowAlert:function(){if(this.state!=WebIM.Config.ConsoleStates.POPPED_OUT&&this.state!=WebIM.Config.ConsoleStates.COLLAPSED){return}for(var B=0,A=WebIM.Console.TabManager.tabs.length;B<A;B++){if(WebIM.Console.TabManager.tabs[B].alerted){this.showAlert();return}}WebIM.Util.stopAlert("consoleAlert");if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation){WebIM.Conversation.active._conversation.tab.reset()}this.hideAlert()},showAlert:function(){if(this.state!=WebIM.Config.ConsoleStates.POPPED_OUT&&this.state!=WebIM.Config.ConsoleStates.COLLAPSED){return}var B;if(this.state==WebIM.Config.ConsoleStates.POPPED_OUT){this.popOutTab.className="consoleTab consoleTabAlert";B=this.newMessageAlertPop}else{var A="140px";if(this.indicatorShowing){A="165px"}this.settingsBorder.style.display="block";this.settingsTabElement.container.style.width=this.fixedTabs.style.width=A;this.alertTab.className="consoleTab consoleTabAlert";this.alertTab.style.display="block";B=this.newMessageAlertCol}B.className="newMessageAlert";this.borderImg.className="borderImg borderImgRoundAlert"},hideAlert:function(){if(this.state!=WebIM.Config.ConsoleStates.POPPED_OUT&&this.state!=WebIM.Config.ConsoleStates.COLLAPSED){return}if(this.state==WebIM.Config.ConsoleStates.POPPED_OUT){this.popOutTab.className="consoleTab";messageAlert=this.newMessageAlertPop}else{this.settingsBorder.style.display="none";this.alertTab.className="displayNone";var A="75px";if(this.indicatorShowing||WebIM.Util.Cookie.getIndicatorFromCookie()=="1"){A="103px"}this.settingsTabElement.container.style.width=this.fixedTabs.style.width=A;messageAlert=this.newMessageAlertCol}this.borderImg.className="borderImg borderImgRound";messageAlert.className="newMessageAlert displayNone"},alert:function(){WebIM.Util.alert("consoleAlert",function(){WebIM.Console.ConsoleUI.showAlert()},function(){WebIM.Console.ConsoleUI.hideAlert()})},hideOrShowIndicator:function(){if(this.indicatorShowing){this.showIndicator()}},showIndicator:function(){if(this.state!=WebIM.Config.ConsoleStates.POPPED_OUT){this.settingsTabElement.container.style.width=this.fixedTabs.style.width="103px"}this.settingsIndicatorTab.style.display="block";this.tabContainer.style.right="101px";if(WebIM.Console.FriendsList&&WebIM.Console.FriendsList.container){WebIM.Console.FriendsList.container.style.right="28px"}if(WebIM.Console.SettingsDialog&&WebIM.Console.SettingsDialog.container){WebIM.Console.SettingsDialog.container.style.right="28px"}if(!WebIM.Manager.firstEventsResponse){WebIM.Console.TabManager.onResize()}WebIM.Util.Cookie.saveIndicator("1");this.indicatorShowing=true},hideIndicator:function(){WebIM.Util.Cookie.saveIndicator("0");this.indicatorShowing=false;this.settingsIndicatorTab.style.display="none";this.tabContainer.style.right="73px";if(WebIM.Console.FriendsList&&WebIM.Console.FriendsList.container){WebIM.Console.FriendsList.container.style.right="1px"}if(WebIM.Console.SettingsDialog&&WebIM.Console.SettingsDialog.container){WebIM.Console.SettingsDialog.container.style.right="1px"}if(!WebIM.Manager.firstEventsResponse){WebIM.Console.TabManager.onResize()}},alertIndicator:function(){if(WebIM.Settings.soundIndicators){WebIM.Manager.playSound(WebIM.Config.Sounds.MESSAGE_RECEIVED)}var B=this.settingsIndicatorTab;var A=function(){Sys.UI.DomElement.addCssClass(B,"consoleTabAlert")};var C=function(){Sys.UI.DomElement.removeCssClass(B,"consoleTabAlert")};if(this.indicatorShowing){WebIM.Util.alert(this.id,A,C,A)}this.highlightIndicator()},highlightIndicator:function(){if(this.indicatorShowing){Sys.UI.DomElement.addCssClass(this.settingsIndicatorTab,"consoleTabAlert")}},removeHighlightIndicator:function(){if(this.indicatorShowing){Sys.UI.DomElement.removeCssClass(this.settingsIndicatorTab,"consoleTabAlert")}},setState:function(D){if(this.state==D||!WebIM.Config.ConsoleStates[D]){return}if(D=="LOADING"){D="DEFAULT"}WebIM.Util.stopAlert("consoleAlert");this.previousState=this.state;this.state=D;if(WebIM.Console.SettingsDialog){WebIM.Console.SettingsDialog.updatePopoutIMText()}WebIM.Util.Cookie.saveConsoleState(this.state);var F="75px";if(this.indicatorShowing||WebIM.Util.Cookie.getIndicatorFromCookie()=="1"){F="103px";this.tabContainer.style.right="101px"}this.borderImg.className="borderImg ";this.consoleElement.className="imConsoleDefault ";this.fixedTabs.style.width=F;this.settingsBorder.style.display="none";this.settingsTabElement.container.style.width=F;this.collapseButton.className="collapseButton ";this.newMessageAlertPop.className=this.newMessageAlertCol.className="displayNone";this.popOutTab.style.display=this.alertTab.style.display="none";var A=this.settingsTabElement.get("settingsDialog");A.className="consoleTab";this.settingsButton.className="settingsButtonOnline";this.offlineMessage.style.display=this.unavailableMessage.style.display=this.loggedInOtherLocationMessage.style.display="none";if(WebIM.Strings&&WebIM.Strings.COLLAPSE_BAR){this.collapseButton.title=WebIM.Strings.COLLAPSE_BAR}if(this.indicatorShowing){this.settingsIndicatorTab.style.display="block";WebIM.Console.IndicatorsPopup.hide()}try{var B=WebIM.Util.Cookie.getUIState(9);var E=(WebIM.Settings.hideHelpMsg==1||WebIM.Settings.hideHelpMsg==true)?true:false;if(B=="1"||E){this.hideHelpMessageOnly()}}catch(C){}switch(D){case"NOT_SUPPORTED":this._displayNotSupportedState();break;case"LOGGED_IN_OTHER_LOCATION":this._displayDisabled();this.loggedInOtherLocationMessage.style.display="inline";this.showHelpMessageAndSponsor();break;case"DEFAULT":this._displayDefault();if(WebIM.Console.TabManager.tabs.length==0&&!WebIM.Manager.firstEventsResponse){this.showHelpMessageAndSponsor()}break;case"POPPED_OUT":this._displayPoppedOut();break;case"OFFLINE":this._displayDisabled();this.offlineMessage.style.display="inline";this.showHelpMessageAndSponsor();break;case"COLLAPSED_LOADING":case"COLLAPSED_LOGGED_IN_OTHER_LOCATION":case"COLLAPSED_UNAVAILABLE":case"COLLAPSED_OFFLINE":this.settingsButton.className+=" settingsButtonOffline";case"COLLAPSED_NOT_SUPPORTED":case"COLLAPSED":this._displayCollapsed();break;case"UNAVAILABLE":this._displayDisabled();this.unavailableMessage.style.display="inline";this.showHelpMessageAndSponsor();break}this.show();if(D=="DEFAULT"){if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation.visible&&!WebIM.Conversation.active._conversation.visible()){WebIM.Conversation.active._conversation.open()}else{if(WebIM.Conversation.active){WebIM.Conversation.active._conversation.setPosition()}}}},_displayDisabled:function(){this.updatePresence(WebIM.Config.PresenceTypes.OFFLINE);this.hideHelpMessageAndSponsor();this.collapseButton.className+=" collapseRightIcon";WebIM.FriendsList.minimize();WebIM.Console.TabManager.closeAllTabs();this.get("friendsListTab").style.display="none";this.consoleElement.className+=" imConsoleOffline";this.settingsButton.className+=" settingsButtonOffline"},_displayDefault:function(){this.updatePresence(WebIM.Viewer.presence);this.get("friendsListTab").style.display="block";this.collapseButton.className+=" collapseRightIcon";if(WebIM.Console.FriendsList&&this._friendsListVisible&&WebIM.FriendsList.state==WebIM.Config.WindowStates.OPEN){WebIM.Console.FriendsList.show()}if(!WebIM.Manager.firstEventsResponse){WebIM.Manager.commitPoppedOut(false)}},_displayPoppedOut:function(){if(WebIM.Console.FriendsList&&(this._friendsListVisible=WebIM.Console.FriendsList.visible())){WebIM.Console.FriendsList.hide()}if(WebIM.Conversation.active){var C=WebIM.Conversation.active;C._conversation.minimize();WebIM.Conversation.active=C}this.popOutTab.className="consoleTab";this.borderImg.className+=" borderImgRound";this.collapseButton.className+=" poppedOutIcon";var B=browser.isIE||(browser.isWin&&browser.isGecko)?"250px":"230px";this.fixedTabs.style.width=this.settingsTabElement.container.style.width=B;this.popOutTab.style.display="block";var A=this.settingsTabElement.get("settingsDialog");A.className="consoleTab ";this.settingsBorder.style.display="block";if(!WebIM.Manager.firstEventsResponse){WebIM.Manager.commitPoppedOut(true)}this.hideOrShowAlert();this.hideOrShowIndicator()},_displayCollapsed:function(){if(WebIM.Console.FriendsList&&(this._friendsListVisible=WebIM.Console.FriendsList.visible())){WebIM.Console.FriendsList.hide()}if(this.previousState==WebIM.Config.ConsoleStates.NOT_SUPPORTED){WebIM.Console.SettingsDialog.close()}if(WebIM.Conversation.active){var D=WebIM.Conversation.active;D._conversation.minimize();WebIM.Conversation.active=D}this.borderImg.className+=" borderImgRound";this.collapseButton.className+=" collapseLeftIcon";this.collapseButton.title=WebIM.Strings.EXPAND_BAR;if(!WebIM.Manager.isBrowserSupported()){var B=this.settingsTabElement.get("notSupportedTab");B.style.display="none";var A=this.settingsTabElement.get("settingsDialog");this.settingsButton.style.left="5px";this.settingsTabElement.container.style.width=this.fixedTabs.style.width="61px";var C=this.settingsTabElement.get("settingsDropDownButton");C.style.display=this.viewerPresence.style.display="none"}else{if(!WebIM.Manager.firstEventsResponse){WebIM.Manager.commitWindowState(WebIM.Config.ReservedWindows.CONSOLE,WebIM.Config.WindowStates.MINIMIZE)}}this.hideOrShowAlert();this.hideOrShowIndicator()},_displayNotSupportedState:function(){var C=this.settingsTabElement.get("settingsDropDownButton");C.style.display=this.viewerPresence.style.display="none";this.settingsButton.style.left="6px";var B=this.settingsTabElement.get("notSupportedTab");B.style.display="block";this.settingsTabElement.container.style.width=this.fixedTabs.style.width="500px";this.borderImg.className+=" borderImgRound";this.collapseButton.className+=" collapseRightIcon";this.popOutTab.style.display="block";var A=this.settingsTabElement.get("settingsDialog");A.className="consoleTab ";A.style.width="30px";this.settingsBorder.style.display="block";var D=(WebIM.Strings&&WebIM.Strings.POP_OUT_IM)?WebIM.Strings.POP_OUT_IM:"<img src='"+WebIM.Config.transparentImageURL+"' style='width:40px;height:10px' />";this.popOutTab.style.width=(D.length*5+30)+"px";this.popOutTab.style.whiteSpace="nowrap";this.popOutTab.innerHTML='<a class="popOutIM" onclick="WebIM.Console.Manager.popOutIM( );" target="popout"><span class="popOutIcon"><img src="'+WebIM.Config.transparentImageURL+'"/></span>'+D+"</a>"},show:function(){if(this.state.match(/^DEFAULT$|^OFFLINE$|^UNAVAILABLE$|^LOADING$|^LOGGED_IN_OTHER_LOCATION$/)){WebIM.Console._ConsoleUI.callBaseMethod(this,"show",null)}else{WebIM.Console._ConsoleUI.callBaseMethod(this,"hide",null)}this.settingsTabElement.show()},hide:function(A){WebIM.Console._ConsoleUI.callBaseMethod(this,"hide",null);if(A){this.settingsTabElement.hide()}},updatePresence:function(A){this.viewerPresence.className="presence "+A},showHelpMessageAndSponsor:function(){this.helpSponsorHidden=false;var A=this.get("consoleSponsor");if(A){A.style.display="inline"}var B=WebIM.Util.Cookie.getUIState(9);var C=(WebIM.Settings.hideHelpMsg==1||WebIM.Settings.hideHelpMsg==true)?true:false;if(!this.state.match(/^LOGGED_IN_OTHER_LOCATION$|^OFFLINE$|^UNAVAILABLE$/)&&(B!="1"&&!C)){this.get("helpMessage").style.display="inline"}},hideHelpMessageAndSponsor:function(){this.helpSponsorHidden=true;var A=this.get("consoleSponsor");if(A){A.style.display="none"}this.get("helpMessage").style.display="none"},hideHelpMessageOnly:function(){if(WebIM.Util.Cookie.getUIState(9)!="1"){WebIM.API.setHideHelpMsg()}this.get("helpMessage").style.display="none"},updateLoadingFriendsListDisplay:function(A){var B=WebIM.Console.ConsoleUI.get("friendsListLoadingIcon");if(!B){return}if(A){B.src=WebIM.Config.sendingImageURL}else{B.src=WebIM.Config.transparentImageURL}},isIndicatorShowing:function(){return(this.indicatorShowing||WebIM.Util.Cookie.getIndicatorFromCookie()=="1")?true:false}};WebIM.Console._ConsoleUI.registerClass("WebIM.Console._ConsoleUI",WebIM.ElementContainer);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console.TabManager={init:function(){if(WebIM.Console.Manager.isSpecialCulture){this.otherButtonsWidth=251}this._updateTabData();if(browser.isGecko){this.otherButtonsWidth=this.otherButtonsWidth+2;if(browser.isMac&&browser.versionMajor<=3){this.buddyTabWidth=135;this.otherButtonsWidth=this.otherButtonsWidth+13}}var B=WebIM.Console.ConsoleUI.tabsNode.childNodes;for(var A=B.length-1;A>=0;A--){if(B[A].id&&B[A].id.search("buddyTab")!=-1){this.rightMostTabFromServer=B[A];break}}},rightMostTabFromServer:null,tabs:[],buddyTabWidth:137,moreButtonWidth:44,otherButtonsWidth:231,leftTabIndex:0,rightTabIndex:0,_tabsPerPage:-1,_totalPages:0,_currentPage:0,onMouseOver:function(A){if(!Sys.UI.DomElement.containsCssClass(this,"consoleTabSelect")){Sys.UI.DomElement.addCssClass(this,"consoleTabHover")}},onMouseOut:function(A){Sys.UI.DomElement.removeCssClass(this,"consoleTabHover")},onSelect:function(A){if(Sys.UI.DomElement.containsCssClass(this,"consoleTabSelect")){Sys.UI.DomElement.removeCssClass(this,"consoleTabSelect")}else{Sys.UI.DomElement.addCssClass(this,"consoleTabSelect")}},onResize:function(){if(!WebIM.Console.ConsoleUI.ready){return}WebIM.Console.TabManager._updateTabData();var B;if(WebIM.Conversation.active){var A=WebIM.Conversation.active._conversation.tab;B=WebIM.Console.TabManager._getTabsPage(WebIM.Console.TabManager.getTabIndex(A))}else{B=WebIM.Console.TabManager._currentPage}WebIM.Console.TabManager._selectPage(B)},reset:function(A){Sys.UI.DomElement.removeClass(this,"consoleTabSelect");Sys.UI.DomElement.removeClass(this,"consoleTabHover");Sys.UI.DomElement.removeClass(this,"consoleTabAlert")},addEventHandlers:function(A,B){B(A,"mouseout",WebIM.Console.TabManager.onMouseOut);B(A,"mouseover",WebIM.Console.TabManager.onMouseOver)},getTabIndex:function(B){for(var A=this.tabs.length;A>=0;A--){if(this.tabs[A]===B){return A}}return -1},showTab:function(B){for(var A=this.tabs.length-1;A>=0;A--){if(this.tabs[A]===B&&!this.tabs[A].visible){this._selectPage(this._getTabsPage(A));break}}},shiftLeft:function(){if(WebIM.Console.TabManager._currentPage<(WebIM.Console.TabManager._totalPages-1)){WebIM.Console.TabManager._selectPage(WebIM.Console.TabManager._currentPage+1)}},shiftRight:function(){if(WebIM.Console.TabManager._currentPage>0){WebIM.Console.TabManager._selectPage(WebIM.Console.TabManager._currentPage-1)}},tabFromServerAdded:false,addTab:function(A){WebIM.Console.ConsoleUI.hideHelpMessageAndSponsor();var C=!!WebIM.Console.ConsoleUI.get(A.tab.element.id);this.tabFromServerAdded=C?C:this.tabFromServerAdded;var B=WebIM.Manager.firstEventsResponse&&!MySpace.Application.keyDisabled("WebIMTabsGenerateFromServer")&&!this.tabFromServerAdded&&this.rightMostTabFromServer;this.tabs.push(A.tab);if(!C){if(B&&this.rightMostTabFromServer.nextSibling){WebIM.Console.ConsoleUI.tabsNode.insertBefore(A.tab.element,this.rightMostTabFromServer.nextSibling)}else{if(WebIM.Console.ConsoleUI.tabsNode.firstChild&&!B){WebIM.Console.ConsoleUI.tabsNode.insertBefore(A.tab.element,WebIM.Console.ConsoleUI.tabsNode.firstChild)}else{WebIM.Console.ConsoleUI.tabsNode.appendChild(A.tab.element)}}}A.tab.rendered=A.tab.renderedOnce=true;A.tab.index=this.tabs.length-1;this._updateTabData()},removeTab:function(B){for(var A=this.tabs.length-1;A>=0;A--){if(this.tabs[A].id==B.id){WebIM.Console.ConsoleUI.tabsNode.removeChild(this.tabs[A].element);this.tabs.splice(A,1);B.rendered=false;B.visible=false;B.index=-1}}if(this.tabs.length==0&&WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.DEFAULT){WebIM.Console.ConsoleUI.showHelpMessageAndSponsor()}this._selectPage(this._currentPage)},getTotalSpace:function(){var A=0;if(WebIM.Console.ConsoleUI.indicatorShowing){A=25}return WebIM.Util.getWindowWidth()-this.otherButtonsWidth-A},getTotalSpaceAvailable:function(){return this.getTotalSpace()-this._tabsPerPage*this.buddyTabWidth},_rightTabCount:"",_leftTabCount:"",_selectPage:function(I){if(WebIM.Console.ConsoleUI.shiftRightButton){Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"displayNone")}if(WebIM.Console.ConsoleUI.shiftRightButton){Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"displayNone")}WebIM.Util.Cookie.removeFriends();if(I<0){I=0}else{if((I+1)>this._totalPages&&I>0){while(--I>this._totalPages){}}}this._updateTabData(I);var B=[];if(this._totalPages>1){if(I==0){WebIM.Console.ConsoleUI.shiftLeftButton.style.width=this.getTotalSpaceAvailable()+"px";this._leftTabCount=this.tabs.length-this._tabsPerPage;WebIM.Console.ConsoleUI.leftTabCount.innerHTML="("+this._leftTabCount+")";Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"displayNone")}else{if(I==(this._totalPages-1)){WebIM.Console.ConsoleUI.shiftRightButton.style.width=this.getTotalSpaceAvailable()+"px";this._rightTabCount=this.tabs.length-this._tabsPerPage;WebIM.Console.ConsoleUI.rightTabCount.innerHTML="("+this._rightTabCount+")";Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"displayNone")}else{var A=2;WebIM.Console.ConsoleUI.shiftRightButton.style.width=WebIM.Console.ConsoleUI.shiftLeftButton.style.width=Math.ceil(this.getTotalSpaceAvailable()/2)-A+"px";var E=true;Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"displayNone");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"displayNone")}}var J=0,F=0,C=0;for(var D=this.tabs.length-1;D>=0;D--){if(this._getTabsPage(D)==I||(I==(this._totalPages-1)&&J<this._tabsPerPage)){this.tabs[D].show();B.push(this.tabs[D].friend);var G;G=(G=WebIM.Manager.conversations[this.tabs[D].friend.id])?G._conversation:null;J++;if(G){if(J==1&&D>0){G.align("left")}else{G.align("right")}}}else{if(E&&!J){F++}else{if(E){C++}}if(WebIM.Conversation.active&&this.tabs[D]===WebIM.Conversation.active._conversation.tab){WebIM.Conversation.active.minimize()}this.tabs[D].hide()}}if(E){this._leftTabCount=F;this._rightTabCount=C;WebIM.Console.ConsoleUI.leftTabCount.innerHTML="("+F+")";WebIM.Console.ConsoleUI.rightTabCount.innerHTML="("+C+")"}if(WebIM.Conversation.active){var G=WebIM.Conversation.active._conversation;G.setPosition()}}else{for(var D=this.tabs.length-1;D>=0;D--){var G;this.tabs[D].show();B.push(this.tabs[D].friend);if((G=WebIM.Manager.conversations[this.tabs[D].friend.id])&&(G=G._conversation)){if(D==(this.tabs.length-1)&&G.state==WebIM.Config.WindowStates.OPEN){var H=WebIM.Util.getPosition(G.container);if(H.left<0){G.align("left")}else{G.align("right")}}else{G.align("right")}}}if(WebIM.Conversation.active){var G=WebIM.Conversation.active._conversation;G.setPosition()}}WebIM.Util.Cookie.saveFriends(B);this._currentPage=I;WebIM.Util.stopAlert("leftShiftButtonAlert");WebIM.Util.stopAlert("rightShiftButtonAlert");this.displayAlerts()},_updateTabData:function(A){var B=2;var C=this._currentPage;if(A){C=A}if((C==0)||(C==(this._totalPages-1))){B=1}this._tabsPerPage=Math.floor((this.getTotalSpace()-this.moreButtonWidth*B)/this.buddyTabWidth);this._tabsPerPage=this._tabsPerPage>0?this._tabsPerPage:1;this._totalPages=Math.ceil(this.tabs.length/this._tabsPerPage)},_getTabsPage:function(B){if(WebIM.Console.Tab.isInstanceOfType(B)){for(var A=this.tabs.length-1;A>=0;A--){if(this.tabs[A]===B){B=A;break}}}return Math.floor(B/this._tabsPerPage)},displayAlerts:function(E){var B=!Sys.UI.DomElement.containsCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"displayNone");var D=!Sys.UI.DomElement.containsCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"displayNone");if(!B&&!D){WebIM.Util.Cookie.removeShiftButtonState();return}Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.newMessageAlertLeft,"displayNone");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"shiftButtonAlert");Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.newMessageAlertRight,"displayNone");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"shiftButtonAlert");var G=rightAlertSet=false;for(var C=this.tabs.length-1;C>=0&&!G&&!rightAlertSet;C--){if(this.tabs[C].alerted&&!this.tabs[C].visible){if(!G&&this._getTabsPage(C)>this._currentPage){var A=function(){Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.newMessageAlertLeft,"displayNone");Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"shiftButtonAlert")};var F=function(){Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.newMessageAlertLeft,"displayNone");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftLeftButton,"shiftButtonAlert")};if(E){WebIM.Util.alert("leftShiftButtonAlert",A,F)}else{A()}G=true}else{if(!rightAlertSet&&this._getTabsPage(C)<this._currentPage){var A=function(){Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.newMessageAlertRight,"displayNone");Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"shiftButtonAlert")};var F=function(){Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.newMessageAlertRight,"displayNone");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.shiftRightButton,"shiftButtonAlert")};if(E){WebIM.Util.alert("rightShiftButtonAlert",A,F)}else{A()}rightAlertSet=true}}}}WebIM.Util.Cookie.saveShiftButtonState(B?WebIM.Console.ConsoleUI.shiftLeftButton.style.width:"",G,this._leftTabCount,D?WebIM.Console.ConsoleUI.shiftRightButton.style.width:"",rightAlertSet,this._rightTabCount)},closeAllTabs:function(){for(var A=this.tabs.length-1;A>=0;A--){var B;if(B=this.tabs[A].friend){var C=WebIM.Manager.conversations[this.tabs[A].friend.id];if(C){C.clearHistory();C.close()}}}}};WebIM.Console.Tab=function(C,D,A){this.selected=false;this.rendered=false;this.renderedOnce=false;this.element=C;this.visible=!Sys.UI.DomElement.containsCssClass(this.element,"displayNone");this.id=C.id;this.alertInterval=0;this.friend=D;this.alerted=false;this.alerting=false;this.alertMessageDivID=D.tabMessageAlertID;this.alertMessageDiv;this.index=A;for(var B=0;B<this.element.childNodes.length;B++){if(this.element.childNodes[B].id==this.friend.tabPresenceID){this.presenceNode=this.element.childNodes[B];break}}};WebIM.Console.Tab.defaultClass="consoleTab buddyTab left ";WebIM.Console.Tab.originalTitle=document.title;WebIM.Console.Tab.prototype={hide:function(){WebIM.Util.stopAlert(this.id);this.visible=false;Sys.UI.DomElement.addCssClass(this.element,"displayNone")},show:function(){this.visible=true;Sys.UI.DomElement.removeCssClass(this.element,"displayNone")},reset:function(){WebIM.Util.stopAlert(this.id);if(!this.alertMessageDiv){this.alertMessageDiv=WebIM.Console.ConsoleUI.get(this.alertMessageDivID)}this.hideAlert();this.alerted=false},showAlert:function(){var A=String.format(WebIM.Strings.ALERT_TITLE_MESSAGE,this.friend.name);document.title=A;this.alertMessageDiv.className="newMessageAlert ";this.element.className+=" consoleTabAlert"},hideAlert:function(){if(this.alerted||WebIM.Console.ConsoleUI.state.search(/POPPED_OUT/)!=-1){document.title=WebIM.Console.Tab.originalTitle}this.alertMessageDiv.className="newMessageAlert displayNone";this.element.className=WebIM.Console.Tab.defaultClass},alert:function(){var C="New Message from "+this.friend.name;this.alerted=true;if(!this.alertMessageDiv){this.alertMessageDiv=WebIM.Console.ConsoleUI.get(this.alertMessageDivID)}var B=this;var A=function(){B.showAlert()};var D=function(){B.hideAlert()};WebIM.Util.Cookie.updateFriend(this.friend);if(WebIM.Manager.firstEventsResponse){this.showAlert();return}if(this.visible){WebIM.Util.alert(this.id,A,D,A)}else{this.showAlert();WebIM.Console.TabManager.displayAlerts(true)}}};WebIM.Console.Tab.registerClass("WebIM.Console.Tab",null);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console.Conversation=function(A,C){this.dummyWindow=C!=undefined?C:false;var B=A.friend;this.tab=B.tab;this._queuedMessages=[];this.state=WebIM.Config.WindowStates.CLOSE;this.fid=A.friend.id;this.tabPresenceID=B.tabPresenceID;this.messageTS=WebIM.API.adviseTS;this._partialMessageHistory=[];this.sendMessageIndicator=null;this.sendMessageCounter=0;this.sendMessageTimeout=null;this.lastMsgTimestamp=0;this.lastMsgSentBy=WebIM.Config.Sender.NONE;A.addEventListener("displayMessages",function(L){var N=[],F=false,K=false,M=L.target._conversation,J=L.target.friend;if(M.state==WebIM.Config.WindowStates.OPEN){var E=WebIM.Util.Cookie.getLastMessageTS()}for(var I=0,H=L.messages.length;I<H;I++){var M=L.target._conversation,J=L.target.friend,G=L.messages[I],P;if(M.generatedFromServer&&WebIM.Manager.firstEventsResponse&&M.state==WebIM.Config.WindowStates.OPEN&&E&&parseInt(G.ts)>=E){M.lastMsgTimestamp=L.messages[L.messages.length-1].utc;if(L.messages[L.messages.length-1].fromFriend){M.lastMsgSentBy=WebIM.Config.Sender.BUDDY}else{M.lastMsgSentBy=WebIM.Config.Sender.USER}break}if(G.fromFriend){P=M.getReceivedMessageElement(G,L.target.friend);for(var O=0;O<P.length;O++){if(P[O]!=null){P[O].fromFriend=true}}if(!J.isContact&&J.isMSFriend&&!M.notifiedMySpaceFriendMessage){M.displayNotMySpaceFriendNotification(A)}else{if(!J.isContact&&!J.isMSFriend&&!J.sad){M.toggleNonContactOverlay(true)}}if(J.sad){M.displayContactListFullNotification(A)}if(!WebIM.Conversation.active&&G.isNew&&(!J.tab||!J.tab.rendered)){L.target.open()}else{if(L.target.state==WebIM.Config.WindowStates.CLOSE&&G.isNew){L.target.minimize()}}if((WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.COLLAPSED&&G.isNew)||(WebIM.Console.ConsoleUI.state!=WebIM.Config.ConsoleStates.DEFAULT&&G.isNew)){K=F=true}else{if(M.tab&&M.tab.rendered&&L.target.state!=WebIM.Config.WindowStates.OPEN&&G.isNew){F=true}}}else{P=M.getSentMessageElement(G)}for(var O=0;O<P.length;O++){if(P[O]!=null){N.push(P[O])}}}if(H<=(WebIM.Config.MAX_CONV_HISTORY+1)&&H>0){M._partialMessageHistory=M._partialMessageHistory.concat(L.messages);if(M._partialMessageHistory.length>(WebIM.Config.MAX_CONV_HISTORY+1)){M._partialMessageHistory.splice(0,M._partialMessageHistory.length-(WebIM.Config.MAX_CONV_HISTORY+1))}}else{M._partialMessageHistory=L.messages.slice(H-(WebIM.Config.MAX_CONV_HISTORY+1))}if(M.rendered&&M.state==WebIM.Config.WindowStates.OPEN&&(J.isContact||J.isMSFriend)){WebIM.Util.Cookie.saveHistory(M._partialMessageHistory)}if(K){WebIM.Conversation._lastAlertedConversation=L.target;WebIM.Console.ConsoleUI.alert()}if(F){WebIM.Conversation._lastAlertedConversation=L.target;M.tab.alert()}if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation&&WebIM.Conversation.active._conversation.rendered&&WebIM.Conversation.active!==M){WebIM.Conversation.active._conversation.setPosition()}var D=M.generatedFromServer&&L.target===WebIM.Conversation.active&&WebIM.Manager.firstEventsResponse;M.displayMessages(N,D);if(L.target.friend.presence==WebIM.Config.PresenceTypes.OFFLINE){L.target.friend.displayPresenceMessage()}});A.addEventListener("open",function(D){if(WebIM.Manager.firstEventsResponse){WebIM.Conversation.openConversationRef=A}D.target._conversation.open(D.target)});A.addEventListener("minimize",function(D){D.target._conversation.minimize()});A.addEventListener("close",function(D){D.target._conversation.close()});A.addEventListener("clearHistory",function(D){if(!WebIM.Conversation.active||A===WebIM.Conversation.active){WebIM.Util.Cookie.removeConversationHistory()}D.target._conversation.deleteHistory();D.target._conversation.lastMsgTimestamp=0;D.target._conversation.lastMsgSentBy=WebIM.Config.Sender.NONE;D.target._conversation.hideMenuDelayed();D.target._conversation.notifiedMySpaceFriendMessage=false});A.addEventListener("updateTypingStatus",function(D){D.target._conversation.updateTypingStatus(D.status)});this.rendered=false;this._render()};WebIM.Console.Conversation.prototype={getTimestampAndContent:function(A,E,B){var F="";var I="";var H=false;var D="<div class='date'>"+WebIM.Util.getLocalDateOnly(B.utc)+"</div>";var C="<div class='time'>"+WebIM.Util.getLocalTimeMinFormat(B.utc)+"</div>";var G="<div class='header'>"+C+A+":</div>";if(((B.utc-this.lastMsgTimestamp)/1000)>WebIM.Config.displayTimestampDelayInSeconds){H=true}if(this.lastMsgSentBy!=E||H){if(this.lastMsgSentBy!=WebIM.Config.Sender.NONE){F+="<div class='ellip'>"+WebIM.Strings.ELLIPSIS_LINE+"</div>"}if(WebIM.Util.getLocalDateOnly(this.lastMsgTimestamp)!=WebIM.Util.getLocalDateOnly(B.utc)){I+=D}I+=G}if(I!=""){F+=I}this.lastMsgTimestamp=B.utc;this.lastMsgSentBy=E;return F},getSentMessageElement:function(A){var C=null;var B=this.getTimestampAndContent(WebIM.Viewer.getDisplayName(15,true),WebIM.Config.Sender.USER,A);if(B!=undefined&&B.length>0){C=WebIM.Util.createElement("div");C.className="sender";C.innerHTML=B}return[C,this.createMessageDiv(A)]},getReceivedMessageElement:function(B,A){var D=null;var C=this.getTimestampAndContent(A.getDisplayName(15,true),WebIM.Config.Sender.BUDDY,B);if(C!=undefined&&C.length>0){D=WebIM.Util.createElement("div");D.className="receiver";D.innerHTML=C}return[D,this.createMessageDiv(B)]},createMessageDiv:function(A){var B=WebIM.Util.createElement("div");B.className="text";B.innerHTML=A.message;return B},createSendMessageIndicator:function(){if(this.sendMessageIndicator){this.sendMessageIndicator=null}var A=WebIM.Util.createElement("div",this.document);A.className="sender";A.id="webim-sendingMessageIndicator";A.innerHTML="<span class='header'>"+WebIM.Viewer.name+": </span><img src='"+WebIM.Config.sendingImageURL+"' style='padding-right: 5px'></img>"+WebIM.Strings.SENDING;this.sendMessageIndicator=A},addSendMessage:function(){if(!this.sendMessageIndicator){this.createSendMessageIndicator()}var A=this;this.sendMessageCounter++;clearTimeout(this.sendMessageTimeOut);this.sendMessageTimeOut=setTimeout(function(){if(A.sendMessageCounter>0){var B=A.get("webim-sendingMessageIndicator");if(B){A.chatTextWindow.removeChild(B)}A.createSendMessageIndicator();A.chatTextWindow.appendChild(A.sendMessageIndicator);A.chatTextWindowContainer.scrollTop=A.chatTextWindowContainer.scrollHeight}},WebIM.Config.SEND_MESSAGE_DELAY_MILLISECONDS)},removeSendMessage:function(A){this.sendMessageCounter=this.sendMessageCounter>0&&A<this.sendMessageCounter?(this.sendMessageCounter-A):0;var B=this.get("webim-sendingMessageIndicator");if(this.sendMessageCounter==0){clearTimeout(this.sendMessageTimeOut);if(B){this.chatTextWindow.removeChild(B)}}else{if(B){this.chatTextWindow.removeChild(B);this.chatTextWindow.appendChild(this.sendMessageIndicator)}}},setPosition:function(C){if(this.targetNode&&this.targetNode.parentNode&&browser.isGecko){var B=this,E=500;var A=this.targetNode.parentNode.parentNode;if(browser.versionMajor==2){var D=WebIM.Console.ConsoleUI.get("friendsListTab");if(A.clientWidth==D.clientWidth){setTimeout(function(){B.setPosition()},E);return}}else{if(browser.versionMajor==3){if(A.offsetLeft<-10){setTimeout(function(){B.setPosition()},E);return}}}}WebIM.Console.Conversation.callBaseMethod(this,"setPosition",null);if(this.state==WebIM.Config.WindowStates.OPEN){WebIM.Util.Cookie.saveConversationPosition(this.fid,this.container.style.right)}},onReady:function(){var B=WebIM.Manager.friends[this.fid];this.textNode=this.get("chatTextFieldInput");this.chatTextWindow=this.get("chatTextWindow");this.chatTextWindowContainer=this.get("chatTextWindowContainer");this.floatingLinks=this.get("floatinglinks");this.moreLinks=this.get("morelinks");this.rendered=true;this.displayMessages(this._queuedMessages,!!this.generatedFromServer);this._queuedMessages=[];var A=this.get("reportAbuse");if(A){A.href=WebIM.Urls.getReportAbuseUrl(this.fid)}var C=WebIM.Manager.conversations[this.fid];if(C&&C.state==WebIM.Config.WindowStates.OPEN){this.open(C)}if(!B.isContact&&B.isMSFriend&&!this.notifiedMySpaceFriendMessage){this.displayNotMySpaceFriendNotification(C)}if(!B.isContact&&!B.isMSFriend&&!B.sad){this.toggleNonContactOverlay(true)}if(this._showNonContactOverlay){this.toggleNonContactOverlay(true)}B.addConversationEvents(this);if(this.makeHistoryCall){WebIM.API.getHistory(this.fid,this.messageTS,this.getHistoryCallback,this)}this.updateStatus(B)},_renderTab:function(){var A=WebIM.Manager.friends[this.fid];if(!A.tab||!A.tab.rendered){A.injectTabNode()}this.tab=A.tab},_render:function(){if(this._renderCalled){return}this._renderCalled=true;this._renderTab();var B=WebIM.Manager.friends[this.fid];var A=WebIM.Util.appendQueryParam(WebIM.Config.CONV_FRAME_URL,"fid",B.id);A=WebIM.Util.appendQueryParam(A,"presence",B.presence);A=WebIM.Util.appendQueryParam(A,"rand",Math.floor(Math.random()*100));WebIM.Console.Conversation.initializeBase(this,[{id:B.conversationContainerID,containerURL:A,cssClasses:["mimPopup","mimHidden"],alignment:this.alignment?this.alignment:"right",targetNode:this.tab.element,offset:browser.isIE6x||(document.compatMode=="BackCompat"&&browser.isIE6up)?22:1}])},updateStatus:function(A){if(WebIM.Config.showStatusMoods){var B=this.get("statusmood");if(B){if(A.status){B.innerHTML='<a id="statusmoodhref" target="_top" href="'+String.format(WebIM.Config.friendMoodsV2URL,A.id)+'&filter=2">'+WebIM.Util.addEllipsis(A.status,16)+"</a>"}else{B.innerHTML=""}}}},displayServerMessages:function(E,D){var F=[];var C=[];for(var A=0;A<E.length;A++){if(E[A].sid==this.fid){C=this.getReceivedMessageElement(E[A],D)}else{C=this.getSentMessageElement(E[A])}for(var B=0;B<C.length;B++){if(C[B]!=null){F.push(C[B])}}}this.textNode=this.get("chatTextFieldInput");this.chatTextWindow=this.get("chatTextWindow");this.displayMessages(F)},getHistoryCallback:function(G,D){if(G.statusCode==200){var F=[];var C=[];var E=WebIM.Manager.friends[D.fid];for(var A=0;A<G.events.length;A++){if(G.events[A].sid==D.fid){C=D.getReceivedMessageElement(G.events[A],E)}else{C=D.getSentMessageElement(G.events[A])}for(var B=0;B<C.length;B++){if(C[B]!=null){F.push(C[B])}}}D.displayMessages(F,true)}},open:function(){var B=WebIM.Manager.conversations[this.fid];if(WebIM.Conversation.active&&WebIM.Conversation.active!==B){WebIM.Conversation.active.minimize()}WebIM.Conversation.active=B;if(WebIM.Console.ConsoleUI.state!==WebIM.Config.ConsoleStates.DEFAULT){this.tab.alerted=false;WebIM.Console.ConsoleUI.hideOrShowAlert();return}this._renderTab();var A=WebIM.Manager.friends[this.fid];this.tab.reset();this.tab.selected=true;if(this.tab===WebIM.Console.TabManager.tabs[0]){this.alignment="right"}if(WebIM.Console.TabManager._totalPages>1&&this.tab===WebIM.Console.TabManager.tabs[WebIM.Console.TabManager.tabs.length-1]){WebIM.Console.TabManager.onResize();this.alignment="left"}WebIM.Console.TabManager.showTab(this.tab);if(A.listItem){Sys.UI.DomElement.removeCssClass(A.listItem,"listItemHover")}Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.get(A.tabCloseButtonID),"displayNone");this.state=WebIM.Config.WindowStates.OPEN;WebIM.Console.Conversation.callBaseMethod(this,"show",null);if(this.chatTextWindowContainer){this.chatTextWindowContainer.scrollTop=this.chatTextWindowContainer.scrollHeight}this.focus();WebIM.Util.Cookie.updateFriend(A);Sys.UI.DomElement.addCssClass(this.targetNode,"consoleTabSelect");if(!WebIM.Manager.firstEventsResponse){WebIM.Util.Cookie.saveHistory(this._partialMessageHistory)}},minimize:function(){WebIM.Console.Conversation.callBaseMethod(this,"hide",null);this._renderTab();var A=WebIM.Manager.friends[this.fid];Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.get(A.tabCloseButtonID),"displayNone");this.tab.selected=false;if(!WebIM.Conversation.active||WebIM.Manager.conversations[this.fid]===WebIM.Conversation.active){WebIM.Util.Cookie.removeConversationHistory();WebIM.Util.Cookie.removeConversationPosition()}WebIM.Conversation.active=WebIM.Conversation.active===WebIM.Manager.conversations[this.fid]?null:WebIM.Conversation.active;this.state=WebIM.Config.WindowStates.MINIMIZE;if(this.tab.visible){WebIM.Util.Cookie.updateFriend(A)}if(!this.rendered){return}},close:function(){if(this.tab){this.tab.selected=false;this.tab.index=-1;WebIM.Console.TabManager.removeTab(this.tab)}if(!WebIM.Conversation.active||WebIM.Manager.conversations[this.fid]===WebIM.Conversation.active){WebIM.Util.Cookie.removeConversationHistory();WebIM.Util.Cookie.removeConversationPosition()}if(WebIM.Conversation.active===WebIM.Manager.conversations[this.fid]){WebIM.Conversation.active=null}else{if(WebIM.Conversation.active){WebIM.Conversation.active._conversation.setPosition()}}this.state=WebIM.Config.WindowStates.CLOSE;if(!this.rendered){return}WebIM.Console.Conversation.callBaseMethod(this,"hide",null)},getTextFieldValue:function(){return this.textNode.value},clearTextField:function(){var A=this.textNode.value.replace(/^(\s)*$/,"");if(A!=""){this.addSendMessage()}this.textNode.value=""},queueMessage:function(A){this._queuedMessages.push(A)},displayMessages:function(G,F){if(!this.rendered&&this._queuedMessages){this._queuedMessages=this._queuedMessages.concat(G)}else{var C="",E=0;for(var B=0,A=G.length;B<A;B++){if(!G[B].fromFriend){E++}MySpace.Util.applyWBRToElement(G[B]);C+='<div class="'+G[B].className+'">'+G[B].innerHTML+"</div>"}if(F){this.chatTextWindow.innerHTML=C+this.chatTextWindow.innerHTML}else{this.chatTextWindow.innerHTML+=C}this.removeSendMessage(E);var D=this;D.chatTextWindowContainer.scrollTop=D.chatTextWindowContainer.scrollHeight+50;var H=this.chatTextWindow.getElementsByTagName("img");if(H.length>0){H[H.length-1].onload=function(){D.chatTextWindowContainer.scrollTop=D.chatTextWindowContainer.scrollHeight+50;this.onload=null}}}},displayPresenceMessage:function(A){if(this.chatTextWindow){var B=this.get("PresenceMessageContainer");if(B){this.chatTextWindow.removeChild(B);if(!browser.isIE){this.chatTextWindow.style.paddingBottom="3px"}}A.id="PresenceMessageContainer";if(!browser.isIE){this.chatTextWindow.style.paddingBottom="5px"}this.chatTextWindow.appendChild(A);this.chatTextWindowContainer.scrollTop=this.chatTextWindowContainer.scrollHeight}},focus:function(){if(this.textNode&&!this._showNonContactOverlay){this.textNode.focus()}},blur:function(){if(this.textNode){this.textNode.blur()}},remove:function(){WebIM.Util.log("ChatWindow.remove( ) ")},deleteHistory:function(){if(!this.rendered){return}this._partialMessageHistory=[];if(this.chatTextWindow){this.chatTextWindow.innerHTML=""}this.sendMessageCounter=0;this.removeSendMessage()},updateTypingStatus:function(A){if(!this.rendered){return}var B=WebIM.Console.ConsoleUI.get(this.tabPresenceID);if(!B){return}if(A){Sys.UI.DomElement.addCssClass(B,"typing")}else{Sys.UI.DomElement.removeCssClass(B,"typing")}},toggleNonContactOverlay:function(B){this._showNonContactOverlay=B;if(this.rendered){var A=this.get("noContactContainer");var C=this.get("chatContainer");var E=this.get("conversationPopupLinks");var D=this.get("block");if(B){C.style.display="none";A.style.display="block";E.style.visibility="hidden";D.style.visibility="hidden"}else{C.style.display="block";A.style.display="none";E.style.visibility="visible";D.style.visibility="visible"}}},displayNotMySpaceFriendNotification:function(D){if(!this.notifiedMySpaceFriendMessage){var A="<div id='NotMySpaceFriendContainer'>"+WebIM.Strings.NOT_IN_FRIENDS_LIST+"<br/><a id='notMySpaceFriendAddLink' href=\"javascript:WebIM.Console.Manager.acceptMySpaceFriend('"+this.fid+"');\" >"+WebIM.Strings.ADD_FRIEND+"</div>";var C=WebIM.Util.createElement("div");C.innerHTML=A;this.displayMessages([C]);try{D.open()}catch(B){}this.notifiedMySpaceFriendMessage=true}},displayContactListFullNotification:function(C){if(!this.notifiedContactListFullMessage){var A="<div id='ContactListFullContainer'><div class='webim-ContactListFull_image_text_class'><img src='"+WebIM.Config.transparentImageURL+"' class='webim-ContactListFullBang'/>		               <span class='webim-ContactListFull_message_body_bold_class'>"+WebIM.Strings.CONTACT_LIST_FULL+"</span></div>							<div class='webim-ContactListFullRemove_message_body_class'>"+String.format(WebIM.Strings.CONTACT_LIST_FULL_REMOVE,WebIM.Strings.EDIT_IM_FRIENDS)+"</div>							<div class='webim-ContactListFull_image_edit_class'><img src='"+WebIM.Config.transparentImageURL+"' class='webim-editFriend' />							<span>							<a class='webim-ContactListFull_message_link_class' href=\"javascript:WebIM.Console.Manager.editFriends();\" >"+WebIM.Strings.EDIT_IM_FRIENDS+"</a>							</span>						</div></div>";var B=WebIM.Util.createElement("div");B.innerHTML=A;this.displayMessages([B]);C.open();this.notifiedContactListFullMessage=true}},align:function(A){if(!this.rendered){this.alignment=A}WebIM.Console.Conversation.callBaseMethod(this,"align",[A])},showMenu:function(){clearTimeout(this.hideMenuTimer);var A=Sys.UI.DomElement.getBounds(this.moreLinks);this.floatingLinks.style.left=(A.x)+"px";this.floatingLinks.style.visibility="hidden";this.floatingLinks.style.display="block";this.floatingLinks.style.bottom=(242-this.floatingLinks.clientHeight)+"px";this.floatingLinks.style.visibility="visible"},hideMenu:function(){var A=this;this.hideMenuTimer=setTimeout(function(){A.hideMenuDelayed()},50)},hideMenuDelayed:function(){if(this.floatingLinks){this.floatingLinks.style.display="none"}},showStatusAndMood:function(){clearTimeout(WebIM.Manager.hideStatusTimer);if(WebIM.Manager.StatusAndMoodPop&&WebIM.Manager.StatusAndMoodPop.style.display=="block"){return}var E=this.get("statusmood");if(E.innerHTML!=""){var B=WebIM.Manager.getStatusAndMoodPop(this.fid);if(B!=null){var F=WebIM.Manager.conversations[this.fid];if(F&&F._conversation&&F._conversation.container){var C=Sys.UI.DomElement.getBounds(F._conversation.container);var A=Sys.UI.DomElement.getBounds(E);var D=0;B.style.visibility="hidden";B.style.display="block";B.style.position="fixed";if(WebIM.Console.Manager.fixedPositioningNotSupported()){B.style.position="absolute";D=document.body.scrollTop}B.style.left=(C.x+A.x+30)+"px";B.style.bottom=(282-B.clientHeight-D)+"px";B.style.visibility="visible"}}}},sendCurrentPage:function(){WebIM.Manager.sendMessage(this.fid,parent.location.href);this.hideMenuDelayed()}};WebIM.Console.Conversation.registerClass("WebIM.Console.Conversation",WebIM.Console.Dialog);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console._FriendsList=function(C){var B=0;if(browser.isIE){if(browser.isIE6x||document.compatMode=="BackCompat"){B=20}}this.optCallback=C;this._queuedFriends=[];var A=this;WebIM.FriendsList.addEventListener("addFriend",function(D){if(!A.ready){WebIM.Console.Manager.updateCountInBar();A._queuedFriends.push(D.friend)}else{A.addFriend(D.friend)}});WebIM.FriendsList.addEventListener("removeFriend",function(D){if(!A.ready){for(var E=A._queuedFriends.length;E--;){if(A._queuedFriends[E]===D.friend){A._queuedFriends.splice(E,1)}}}else{A.removeFriend(D.friend)}WebIM.Console.Manager.updateCountIndicators()});var A=this;WebIM.FriendsList.addEventListener("open",function(D){A.show()});WebIM.FriendsList.addEventListener("minimize",function(D){A.hide()});if(WebIM.Util.Cookie.isFriendsListOpen()){this._render()}};WebIM.Console._FriendsList.prototype={onReady:function(){var D=this;WebIM.Console.ConsoleUI.addListener(function(F){D.setTargetNode(F.get("friendsListTab"));WebIM.Console._FriendsList.callBaseMethod(D,"onReady",null);D.rendered=true});if(this.generatedFromServer){if(WebIM.Console.ConsoleUI.state!="DEFAULT"||!WebIM.Util.Cookie.isFriendsListOpen()){this.hide()}}var E=WebIM.Util.Cookie.getFriendCount();if(E==null){E=WebIM.FriendsList.friendCount}var C=this.get("onlineFriendsCount");C.innerHTML+=" (<span id='friendsCountIndicator_1'>"+E+"</span>)";this.recentContactsNode=this.get("recentContacts");this.onlineFriendsNode=this.get("onlineFriends");this.friendsCountIndicator=this.get("friendsCountIndicator_1");this.window.addHandler("recentContactsLink","click",function(){WebIM.Console.FriendsList.toggle(this)});this.window.addHandler("onlineFriendsLink","click",function(){WebIM.Console.FriendsList.toggle(this)});this.window.addHandler("popOutIM","click",WebIM.Console.Manager.popOutIM);this.window.addHandler("editFriends","click",WebIM.Console.Manager.editFriends);this.window.addHandler("editBlockList","click",WebIM.Console.Manager.editBlockList);this.window.addHandler("minimizeButton","click",function(){WebIM.FriendsList.minimize()});if(typeof this.optCallback=="function"){this.optCallback()}if(WebIM.FriendsList.state==WebIM.Config.WindowStates.OPEN){this.show()}WebIM.Console.ConsoleUI.updateLoadingFriendsListDisplay(false);this.show();for(var B=0,A=this._queuedFriends.length;B<A;B++){this.addFriend(this._queuedFriends[B])}this._queuedFriends=null;WebIM.PopoutWindow.addEventListener("open",function(){WebIM.Console.FriendsList.hide()})},removeFriend:function(A){if(A&&A.listItem){A.listItem.parentNode.removeChild(A.listItem);A.listItem=null}},createFriendItem:function(C){var B=WebIM.Util.createElement("div",this.document);var A='<div class="col1"><span class="contactPic"><img id="'+C.friendListItemImageID+'" src="'+C.imageURL+'" onerror="WebIM.Util.useNoPicImage(this)"></span><span class="name"><span id="'+C.friendListItemPresenceID+'" class="presence '+C.presence+'" >		<img src="'+WebIM.Config.transparentImageURL+'"></span><span id="'+C.friendListItemNameID+'">'+C.getDisplayName(WebIM.Config.conversationListItemNameLength)+"</span></span></div>";if(C.group==WebIM.Config.FriendGroups.RECENT&&!C.pendingFriend){A+='<a id="'+C.friendListItemAddContactID+'" class="friendRequest"><img src="'+WebIM.Config.transparentImageURL+'"></a>'}else{if(C.group==WebIM.Config.FriendGroups.RECENT&&C.pendingFriend){A+='<a id="'+C.friendListItemAddContactID+'" class="friendRequest friendRequestPending"><img src="'+WebIM.Config.transparentImageURL+'"></a>'}else{A+='<a id="'+C.friendListItemAddContactID+'" class="friendRequest"><img src="'+WebIM.Config.transparentImageURL+'"></a>'}}A+='<a id="'+C.friendListItemDelContactID+'" class="deleteContact"><img src="'+WebIM.Config.transparentImageURL+'"></a>';WebIM.Util.setAttributes(B,{className:"contact",id:"friendListItem_"+C.id,innerHTML:A});var D=C[WebIM.Config.friendAttributeSortKey];D=D.toLowerCase?D.toLowerCase():D;B[WebIM.Config.friendAttributeSortKey]=D;if(C.group==WebIM.Config.FriendGroups.CONTACT){Sys.UI.DomElement.removeCssClass(this.get("onlineFriendsLink"),"contactsGroupLinkClosed");WebIM.Util.insert(this.onlineFriendsNode,B,WebIM.Config.friendAttributeSortKey);Sys.UI.DomElement.removeCssClass(this.onlineFriendsNode,"displayNone")}else{if(C.group==WebIM.Config.FriendGroups.RECENT){Sys.UI.DomElement.removeCssClass(this.get("recentContactsLink"),"contactsGroupLinkClosed");WebIM.Util.insert(this.recentContactsNode,B,WebIM.Config.friendAttributeSortKey);Sys.UI.DomElement.removeCssClass(this.recentContactsNode,"displayNone")}else{Sys.UI.DomElement.removeCssClass(this.get("recentContactsLink"),"contactsGroupLinkClosed");WebIM.Util.insert(this.recentContactsNode,B,WebIM.Config.friendAttributeSortKey);Sys.UI.DomElement.removeCssClass(this.recentContactsNode,"displayNone")}}return B},addFriend:function(C){var B=this.get("friendListItem_"+C.id);if(!B){if(this.onlineFriendsNode==null||this.recentContactsNode==null){var A=this;setTimeout(function(){A.addFriend(C)},200);return}else{B=this.createFriendItem(C)}}if(C.group==WebIM.Config.FriendGroups.RECENT){if(C.groupPrevious==WebIM.Config.FriendGroups.NON_CONTACT){WebIM.Manager.conversations[C.id]._conversation.toggleNonContactOverlay(false)}WebIM.Console.FriendsList.window.addHandler(C.friendListItemAddContactID,"click",function(D){if(D.stopPropagation){D.stopPropagation()}if(C.pendingFriend){location.href=WebIM.Config.pendingRequestsURL;return false}if(!C.pendingFriend){WebIM.Console.Manager.friendRequest(C)}return false})}WebIM.Console.FriendsList.window.addHandler(C.friendListItemDelContactID,"click",function(D){if(D.stopPropagation){D.stopPropagation()}WebIM.Console.Manager.deleteFriend(C);return false});this.window.addHandlerFor(B,"mouseover",function(){if(!Sys.UI.DomElement.containsCssClass(this,"contactRoll")){Sys.UI.DomElement.addCssClass(this,"contactRoll")}C.delContactButton.style.display="block"});this.window.addHandlerFor(B,"mouseout",function(){Sys.UI.DomElement.removeCssClass(this,"contactRoll");C.delContactButton.style.display="none"});this.window.addHandlerFor(B,"click",function(){C.delContactButton.style.display="none";Sys.UI.DomElement.removeCssClass(this,"contactRoll");WebIM.FriendsList.minimize();WebIM.Console.ConsoleUI.hideHelpMessageOnly();C.onListItemClick()});C.listItem=B;C.delContactButton=WebIM.Console.FriendsList.get(C.friendListItemDelContactID);C.friendRequestButton=WebIM.Console.FriendsList.get(C.friendListItemAddContactID);WebIM.Console.Manager.updateCountIndicators()},updateFriendGroup:function(B){if(B.listItem){var C=this.get(B.buddyListItemAddContactID);if(B.group==WebIM.Config.FriendGroups.CONTACT){if(C){var A=C.getElementsByTagName("img")[0];A.src=WebIM.Config.transparentImageURL;A.style.width="17px"}if(this.onlineFriendsNode!==B.listItem.parentNode){B.listItem.parentNode.removeChild(B.listItem);this.onlineFriendsNode.appendChild(B.listItem)}}else{if(this.recentContactsNode!==B.listItem.parentNode){B.listItem.parentNode.removeChild(B.listItem);this.recentContactsNode.appendChild(B.listItem)}}if(this.onlineFriendsNode.childNodes.length==0){Sys.UI.DomElement.addCssClass(this.get("onlineFriendsLink"),"contactsGroupLinkClosed")}if(this.recentContactsNode.childNodes.length==0){Sys.UI.DomElement.addCssClass(this.get("recentContactsLink"),"contactsGroupLinkClosed")}}},toggle:function(A){if(A.id=="recentContactsLink"){Sys.UI.DomElement.toggleCssClass(this.recentContactsNode,"displayNone");Sys.UI.DomElement.toggleCssClass(A,"contactsGroupLinkClosed")}else{if(A.id=="onlineFriendsLink"){Sys.UI.DomElement.toggleCssClass(this.onlineFriendsNode,"displayNone");Sys.UI.DomElement.toggleCssClass(A,"contactsGroupLinkClosed")}}},_render:function(){if(this._renderCalled){return}this._renderCalled=true;WebIM.Console._FriendsList.initializeBase(this,[{id:"buddyListDialogContainer",containerURL:WebIM.Config.FRIENDS_LIST_FRAME_URL,cssClasses:["mimPopup","mimHidden"],styles:{right:WebIM.Console.ConsoleUI.isIndicatorShowing()?"28px":"1px",width:WebIM.Console.Manager.isSpecialCulture?"250px":""}}])},show:function(){if(!this.rendered){WebIM.Console.ConsoleUI.updateLoadingFriendsListDisplay(true);this._render();return}if(WebIM.PopoutWindow.state==WebIM.Config.WindowStates.OPEN||WebIM.Console.ConsoleUI.state!=WebIM.Config.ConsoleStates.DEFAULT){return}WebIM.Console.SettingsDialog.hide();WebIM.Console.IndicatorsPopup.hide();WebIM.Console._FriendsList.callBaseMethod(this,"show",null)},hide:function(){if(!this.rendered||!this.visible()){return}WebIM.Console._FriendsList.callBaseMethod(this,"hide",null)},visible:function(){if(!this.rendered){return false}return WebIM.Console._FriendsList.callBaseMethod(this,"visible",null)}};WebIM.Console._FriendsList.registerClass("WebIM.Console._FriendsList",WebIM.Console.Dialog);var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console.ExtendFriend=function(A){A.addEventListener("updateAttributes",function(B){B.target._updateAttributes()});A.addEventListener("displaySendMessageError",function(B){var C=B.target;var E=WebIM.Manager.conversations[C.id]._conversation;var D=WebIM.Util.createElement("div");D.className="error";D.innerHTML=WebIM.Strings.ERROR_SEND_MESSAGE;E.displayMessages([D]);E.open();E.sendMessageCounter=0;E.removeSendMessage()});A.tab=A.listItem=A.conversationWindow=null;A.conversationContainerID="conversationContainer_"+A.id;A.conversationImageID="conversationImage";A.conversationNameID="conversationName";A.conversationPresenceID="conversationPresence";A.friendListItemNameID="friendListItemName_"+A.id;A.friendListItemImageID="friendListItemImage_"+A.id;A.friendListItemAddContactID="friendListItemAddContact_"+A.id;A.friendListItemDelContactID="friendlistItemDelContact_"+A.id;A.friendListItemPresenceID="friendListItemPresence_"+A.id;A.friendListItemContainerId="friendListItemContainer_"+A.id;A.tabNameID="tabName_"+A.id;A.tabPresenceID="tabPresence_"+A.id;A.tabCloseButtonID="tabCloseButton_"+A.id;A.tabMessageAlertID="tabMessageAlert_"+A.id;A.startTypingStatusTimeout=null;A._updateAttributes=function(){if(this!==WebIM.Viewer){if(this.groupUpdated&&this.inFriendsList){WebIM.Console.FriendsList.updateFriendGroup(this)}this._updateUI()}};A._updateUI=function(){if(this.listItem&&this.inFriendsList){if(this.nameUpdated){WebIM.Console.FriendsList.get(this.friendListItemNameID).innerHTML=A.getDisplayName(WebIM.Config.conversationListItemNameLength)}if(this.imageURLUpdated){WebIM.Console.FriendsList.get(this.friendListItemImageID).src=this.imageURL}if(this.presenceUpdated){WebIM.Console.FriendsList.get(this.friendListItemPresenceID).className="presence "+this.presence}if(this.pendingFriendUpdated&&A.friendRequestButton){var C="friendRequest ";if(this.pendingFriend){C+="friendRequestPending"}A.friendRequestButton.className=C}}var B;if((B=WebIM.Manager.conversations[this.id])&&(B=B._conversation)){if(!B.rendered){B.addListener(function(){A._updateConversation(B)})}else{A._updateConversation(B)}}if(this.tab&&this.tab.rendered){if(this.nameUpdated){WebIM.Console.ConsoleUI.get(this.tabNameID).innerHTML=A.getDisplayName(WebIM.Config.friendTabNameLength);WebIM.Util.Cookie.updateFriend(this)}if(this.presenceUpdated){WebIM.Console.ConsoleUI.get(this.tabPresenceID).className="presence "+this.presence;WebIM.Util.Cookie.updateFriend(this);var B=WebIM.Manager.conversations[this.id];if(B&&B._conversation&&B.typing){B.updateTypingStatus(true)}}}};A._updateConversation=function(B){if(this.nameUpdated){B.get(this.conversationNameID).innerHTML=A.getDisplayName(WebIM.Config.conversationNameLength)}if(this.imageURLUpdated){B.get(this.conversationImageID).src=this.imageURL}if(this.presenceUpdated){B.get(this.conversationPresenceID).className="presence "+this.presence;if(this.presencePrevious!=WebIM.Config.PresenceTypes.IDLE&&(this.presence==WebIM.Config.PresenceTypes.OFFLINE||this.presence==WebIM.Config.PresenceTypes.ONLINE)){this.displayPresenceMessage()}}if(this.groupPrevious==WebIM.Config.FriendGroups.NON_CONTACT&&this.group==WebIM.Config.FriendGroups.CONTACT&&this.isMSFriend){this.hideNotMySpaceFriendContainer()}if(this.statusUpdated){B.updateStatus(this)}if(!this.sad){this.hideContactListFullContainer()}else{B.displayContactListFullNotification(B)}};A.removeUIElements=function(){var B=WebIM.Manager.conversations[this.id];if(B){B.close()}this.removeListItem();if(this.tab&&this.tab.rendered){this.tab.element.parentNode.removeChild(this.tab.element);this.tab.rendered=false}};A.removeListItem=function(){WebIM.FriendsList.removeFriend(this)};A.onListItemClick=function(){if(WebIM.Conversation.active){if(WebIM.Conversation.active.friend===this){return}else{WebIM.Conversation.active.minimize()}}var B=this;var C=WebIM.Manager.getConversation(B.id);setTimeout(function(){C.open()},1);return true};A.injectTabNode=function(){if(!this.tab){this.createTabNode()}if(WebIM.Console.TabManager.tabs.length>=WebIM.Config.maxConsoleConversations){var C=WebIM.Console.TabManager.tabs[0];WebIM.Manager.getConversation(C.friend.id).close()}WebIM.Console.ConsoleUI.hideHelpMessageAndSponsor();var B=!this.tab.renderedOnce;this.tab.index=WebIM.Console.TabManager.tabs.length;WebIM.Console.TabManager.addTab(this);if(this.tab.presenceNode){this.tab.presenceNode.className="presence "+this.presence}if(B){WebIM.Console.ConsoleUI.window.addHandler(this.tab.id,"click",function(){var D=WebIM.Manager.getConversation(A.id);if(D.state==WebIM.Config.WindowStates.OPEN){Sys.UI.DomElement.addCssClass(A.tab.element,"consoleSelectTab");Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.get(A.tabCloseButtonID),"displayNone");D.minimize()}else{if(D.state==WebIM.Config.WindowStates.MINIMIZE){Sys.UI.DomElement.removeCssClass(A.tab.element,"consoleSelectTab");D.open()}}return true});WebIM.Console.ConsoleUI.window.addHandler(this.tab.id,"mouseover",function(){Sys.UI.DomElement.removeCssClass(WebIM.Console.ConsoleUI.get(A.tabCloseButtonID),"displayNone");WebIM.Console.TabManager.onMouseOver.call(A.tab.element,null)});WebIM.Console.ConsoleUI.window.addHandler(this.tab.id,"mouseout",function(){if(!A.tab.selected){Sys.UI.DomElement.addCssClass(WebIM.Console.ConsoleUI.get(A.tabCloseButtonID),"displayNone")}WebIM.Console.TabManager.onMouseOut.call(A.tab.element,null)});WebIM.Console.ConsoleUI.window.addHandler(this.tabCloseButtonID,"click",function(D){if(D.stopPropagation){D.stopPropagation()}WebIM.Manager.getConversation(A.id).close();return null})}};A.createTabNode=function(){if(!this.tab){var D=WebIM.Console.ConsoleUI.get("buddyTab_"+this.id);if(!D){var C=/Mozilla/.test(navigator.userAgent)?"7px":"2px";var B='<div class="tabBorderOverlay "></div>				<span class="presence '+this.presence+'" id="'+this.tabPresenceID+'" ><img src="'+WebIM.Config.transparentImageURL+'" /></span>				<span class="name" id="'+this.tabNameID+'">'+this.getDisplayName(WebIM.Config.friendTabNameLength)+'</span>				<a title="'+WebIM.Strings.CLOSE+'"  id="'+this.tabCloseButtonID+'" class="closeButton displayNone"><img src="'+WebIM.Config.transparentImageURL+'" /></a>				<span id="'+this.tabMessageAlertID+'" style="position: absolute" class="displayNone newMessageAlert" >'+WebIM.Strings.NEW.toUpperCase()+"</span>";D=WebIM.Util.createElement("div",WebIM.Console.ConsoleUI.document);WebIM.Util.setAttributes(D,{id:"buddyTab_"+this.id,className:"consoleTab buddyTab left displayNone",innerHTML:B})}this.tab=new WebIM.Console.Tab(D,this,WebIM.Console.TabManager.tabs.length)}};A.addConversationEvents=function(B){B.window.addHandler("closeButton","click",function(C){WebIM.Manager.getConversation(A.id).close();return false});B.window.addHandler("minimizeButton","click",function(C){WebIM.Manager.getConversation(A.id).minimize();return false});B.window.addHandler("chatTextFieldInput","keydown",function(E){if(E.keyCode==WebIM.Config.ENTER_KEY){var D=B.getTextFieldValue();B.clearTextField();var F=WebIM.Manager.sendMessage(A.id,D);if(this.startTypingStatusTimeOut!=null){if(!F){WebIM.API.stopTypingStatus(A.id)}clearTimeout(this.startTypingStatusTimeOut);this.startTypingStatusTimeOut=null}return false}if(E.keyCode==WebIM.Config.ENTER_KEY||(E.keyCode!=WebIM.Config.BACKSPACE_KEY&&E.keyCode!=WebIM.Config.DELETE_KEY&&E.keyCode!=WebIM.Config.SHIFT_KEY&&E.ctrlKey==false&&E.altKey==false)){if(this.startTypingStatusTimeOut==undefined){WebIM.API.startTypingStatus(A.id)}else{clearTimeout(this.startTypingStatusTimeOut)}var C=this;this.startTypingStatusTimeOut=setTimeout(function(){WebIM.API.stopTypingStatus(A.id);C.startTypingStatusTimeOut=null},WebIM.Config.TYPING_STATUS_STOP_DELAY)}});B.window.addHandler("chatTextFieldInput","keyup",function(C){if(this.value.length>=WebIM.Config.maxMessageLength){this.value=this.value.substr(0,WebIM.Config.maxMessageLength)}if(this.value.length<=0&&this.startTypingStatusTimeOut!=undefined){clearTimeout(this.startTypingStatusTimeOut);this.startTypingStatusTimeOut=setTimeout(function(){WebIM.API.stopTypingStatus(A.id);ref.startTypingStatusTimeOut=null},WebIM.Config.TYPING_STATUS_STOP_EMPTY_DELAY)}});B.window.addHandler("clearHistory","click",function(C){B.deleteHistory();WebIM.API.deleteHistory(A.id);return false});B.window.addHandler("block","click",function(C){A.block(false);return false});B.window.addHandler("reportAbuse","click",function(C){A.reportAbuse();return false});B.window.addHandler("popOutIM","click",function(C){WebIM.Console.Manager.popOutIM();return false});B.window.addHandler("acceptButton","click",function(C){WebIM.Manager.addUserToContactList(A.id,function(E,D){if(E.statusCode==606){B.displayContactListFullNotification(B)}});WebIM.Manager.conversations[A.id]._conversation.toggleNonContactOverlay(false);return false});B.window.addHandler("denyButton","click",function(C){WebIM.API.addUserToBlockList(A.id,1,0);WebIM.Manager.getConversation(A.id).close();return false});B.window.addHandler("denyandblockbutton","click",function(C){A.block(true);return false});B.window.addHandler("morelinks","mouseover",function(C){B.showMenu();return false});B.window.addHandler("morelinks","mouseout",function(C){B.hideMenu();return false});B.window.addHandler("floatinglinks","mouseover",function(C){B.showMenu();return false});B.window.addHandler("floatinglinks","mouseout",function(C){B.hideMenu();return false});B.window.addHandler("statusmood","mouseover",function(C){B.showStatusAndMood();return false});B.window.addHandler("statusmood","mouseout",function(C){WebIM.Manager.hideStatusAndMood();return false});B.window.addHandler("IMCurrentPage","click",function(C){B.sendCurrentPage();return false})};A.block=function(C){var D=this;var B=function(E){if(E){WebIM.Manager.getConversation(D.id).clearHistory();D.removeUIElements()}};if(C){WebIM.ModalDialog.confirmBlockUser(this.id,B)}else{WebIM.ModalDialog.blockUser(this.id,B)}};A.reportAbuse=function(){};A.displayPresenceMessage=function(){var D=WebIM.Manager.conversations[this.id];if(!D._conversation||!D._conversation.rendered){return}if(this.presence==WebIM.Config.PresenceTypes.OFFLINE){this.offlineShown=true;var C=WebIM.Util.createElement("div",D._conversation.document);C.className="consolepopoffline";var B='<div class="consolepopofflinelinks">				<a title="'+WebIM.Strings.SEND_MAIL+'" alt="'+WebIM.Strings.SEND_MAIL+'" target="_top"				href="'+String.format(WebIM.Config.sendMailURL,this.id)+'" class="sendMailLink"><img src="'+WebIM.Config.transparentImageURL+'"></a>				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;				<a title="'+WebIM.Strings.ADD_COMMENT+'" alt="'+WebIM.Strings.ADD_COMMENT+'" target="_top"				href="'+String.format(WebIM.Config.addCommentURL,this.id)+'" class="addCommentLink"><img src="'+WebIM.Config.transparentImageURL+'"></a></div>';C.innerHTML="<div class=consolepopofflineTA>"+String.format(WebIM.Strings.CHATWINDOW_OFFLINE_MSG,this.getDisplayName(WebIM.Config.chatWindowNameLength))+B+"</div>";if(D&&D._conversation){D._conversation.displayPresenceMessage(C)}}else{if(this.offlineShown===true){var C=WebIM.Util.createElement("div",D._conversation.document);C.className="consolepoponline";C.innerHTML=String.format(WebIM.Strings.CHATWINDOW_ONLINE_MSG,this.name);if(D&&D._conversation){D._conversation.displayPresenceMessage(C)}}}};A.hideNotMySpaceFriendContainer=function(){var C=WebIM.Manager.conversations[this.id];if(C&&C._conversation){var B=C._conversation.get("NotMySpaceFriendContainer");if(B){B.style.display="none"}if(C._conversation.notifiedMySpaceFriendMessage!=undefined&&C._conversation.notifiedMySpaceFriendMessage){C._conversation.notifiedMySpaceFriendMessage=false}}};A.hideContactListFullContainer=function(){var C=WebIM.Manager.conversations[this.id];if(C&&C._conversation){var B=C._conversation.get("ContactListFullContainer");if(B){B.parentNode.removeChild(B)}if(C._conversation.notifiedContactListFullMessage!=undefined&&C._conversation.notifiedContactListFullMessage){C._conversation.notifiedContactListFullMessage=false}}}};var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console.Manager={init:function(){WebIM.Config.genConsoleFromS=!!$get("imConsoleContainer");WebIM.CurrentWindow=WebIM.ConsoleWindow;WebIM.Manager.addEventListener("createFriend",this.createFriendListener);WebIM.Manager.addEventListener("createConversation",this.createConversationListener);WebIM.Manager.addEventListener("goOnline",this.goOnlineListener);WebIM.Manager.addEventListener("goOffline",this.goOfflineListener);WebIM.Manager.addEventListener("updateWindowStates",function(){if(WebIM.Manager.firstEventsResponse){if(WebIM.Conversation.openConversationRef){WebIM.Conversation.openConversationRef.open();WebIM.Conversation.openConversationRef._conversation.setPosition();WebIM.Conversation.openConversationRef=null}}});WebIM.Manager.addEventListener("error",function(C){WebIM.Console.Manager.onError(C.error)});var B=WebIM.Util.Cookie.getMVCookieValue(WebIM.Config.MSCULTURE_COOKIE,"PreferredCulture");this.isSpecialCulture=B&&B.search(/(nb-NO|ja-JP|sv-SE|fi-FI)/)!=-1;WebIM.Console.ConsoleUI=new WebIM.Console._ConsoleUI(function(){if(WebIM.Manager.isBrowserSupported()){WebIM.Manager.initAPI();WebIM.Console.IndicatorsPopup=new WebIM.Console._IndicatorsPopup();WebIM.Console.TabManager.init()}else{if(browser.isIE6x){WebIM.Console.ConsoleUI.hide(true);WebIM.Console.ConsoleUI.show()}}if(WebIM.Console.Manager.fixedPositioningNotSupported()){WebIM.Console.Manager.setOnScrollHandler()}});WebIM.Console.SettingsDialog=new WebIM.Console._SettingsDialog();if(WebIM.Manager.isBrowserSupported()){if(!WebIM.Console.FriendsList){WebIM.Console.FriendsList=new WebIM.Console._FriendsList()}$addHandler(window,"resize",WebIM.Console.TabManager.onResize);WebIM.Manager.addEventListener("loggedOnFromAnotherLocation",function(){WebIM.Console.TabManager.closeAllTabs();WebIM.Console.SettingsDialog.close();WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.LOGGED_IN_OTHER_LOCATION)})}else{WebIM.Console.SettingsDialog._render()}var A=WebIM.Util.Cookie.getConversationPosition();WebIM.Manager.addEventListener("processEvents",function(){if(A){var D=A.split("#")[0];if(!WebIM.Conversation.active||D!=WebIM.Conversation.active.friend.id){WebIM.Util.Cookie.removeConversationPosition();var J="conversationContainer_"+D;var H=$get(J);if(H){H.parentNode.removeChild(H)}}}if(WebIM.Config.genConsoleFromS&&!MySpace.Application.keyDisabled("WebIMTabsGenerateFromServer")){var K=WebIM.Console.ConsoleUI.tabsNode.childNodes,F=[];for(var I=0,E=K.length;I<E;I++){if(!K[I].id){continue}var C=K[I].id.split("_")[1];if(!WebIM.Manager.conversations[C]||WebIM.Manager.conversations[C].state==WebIM.Config.WindowStates.CLOSE){WebIM.Util.Cookie.removeFriend(C);F.push(K[I])}}for(var G=0,E=F.length;G<E;G++){WebIM.Console.ConsoleUI.tabsNode.removeChild(F[G])}}WebIM.Manager.removeEventListener("processEvents",arguments.callee)})},showOrHideIframe:function(C,B){if(C){if(B){Sys.UI.DomElement.addCssClass(C,"mimHidden")}else{var A=C.className.indexOf("mimPopup")==-1?0:23;var D=A-document.body.scrollTop;C.style.bottom=D+"px";Sys.UI.DomElement.removeCssClass(C,"mimHidden")}}},setOnScrollHandler:function(){$addHandler(window,"scroll",WebIM.Console.Manager.onScroll);try{this.consoleIframe=$get("imConsoleContainer");this.settingsTabIframe=$get("settingsTabContainer");this.friendsListIframe=$get("buddyListDialogContainer");this.showOrHideIframe(this.settingsTabIframe,true);this.showOrHideIframe(this.settingsTabIframe,false);if(WebIM.Util.Cookie.isFriendsListOpen()){this.showOrHideIframe(this.friendListIframe,true);this.showOrHideIframe(this.friendListIframe,false)}var A=WebIM.Util.Cookie.getConversationPosition();if(A){A=parseInt(A);A=$get("conversationContainer_"+A);Sys.UI.DomElement.addCssClass(A,"mimHidden");Sys.UI.DomElement.removeCssClass(A,"mimHidden")}}catch(B){}},fixedPositioningNotSupported:function(){return browser.isIE6x||(browser.isIE6up&&document.compatMode=="BackCompat")},_elementStatesSaved:false,_scrollingTimeout:-1,onScroll:function(){var B=null;if(WebIM.Manager.firstEventsResponse){B=WebIM.Util.Cookie.getConversationPosition();if(B){try{B=parseInt(B);B=$get("conversationContainer_"+B)}catch(D){}}}var A=300;var C=WebIM.Console.Manager;if(!WebIM.Console.Manager._elementStatesSaved){WebIM.Console.ConsoleUI.hide(true);if(WebIM.Util.Cookie.isFriendsListOpen()){if(WebIM.Console.FriendsList){WebIM.Console.FriendsList.hide()}else{C.showOrHideIframe(C.friendsListIframe,true)}C.friendsListVisibleDuringScroll=true}else{if(WebIM.Console.SettingsDialog&&WebIM.Console.SettingsDialog.visible()){WebIM.Console.SettingsDialog.visibleDuringScroll=true;WebIM.Console.SettingsDialog.hide()}}if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation){WebIM.Conversation.active._conversation.blur();WebIM.Conversation.active._conversation.hide()}else{if(B){Sys.UI.DomElement.addCssClass(B,"mimHidden")}}WebIM.Console.Manager._elementStatesSaved=true}clearTimeout(WebIM.Console.Manager._scrollingTimeout);WebIM.Console.Manager._scrollingTimeout=setTimeout(function(){if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation){WebIM.Conversation.active._conversation.hide()}WebIM.Console.ConsoleUI.show();if(C.friendsListVisibleDuringScroll){if(WebIM.Console.FriendsList){WebIM.Console.FriendsList.show()}else{C.showOrHideIframe(C.friendsListIframe,false)}C.friendsListVisibleDuringScroll=false}else{if(WebIM.Console.SettingsDialog&&WebIM.Console.SettingsDialog.visibleDuringScroll){WebIM.Console.SettingsDialog.show();WebIM.Console.SettingsDialog.visibleDuringScroll=false}}if(WebIM.Conversation.active&&WebIM.Conversation.active._conversation){WebIM.Conversation.active._conversation.show();if(B){Sys.UI.DomElement.removeCssClass(B,"mimHidden")}}else{if(B){Sys.UI.DomElement.removeCssClass(B,"mimHidden")}}WebIM.Console.Manager._elementStatesSaved=false},A)},createFriendListener:function(A){var B=A.friend;WebIM.Console.ExtendFriend(B)},createConversationListener:function(A){var C=A.conversation;if(WebIM.Manager.firstEventsResponse&&!MySpace.Application.keyDisabled("WebIMConversationGenerateFromServer")){var B=$get("conversationContainer_"+C.friend.id);if(B){C._conversation=new WebIM.Console.Conversation(C,true)}else{C._conversation=new WebIM.Console.Conversation(C)}}else{C._conversation=new WebIM.Console.Conversation(C);WebIM.Console.TabManager.onResize()}},popOutIM:function(G){winWidth=700;winHeight=600;var B=WebIM.Config.popoutWinUrl;if(G){for(var F in G){B=WebIM.Util.appendQueryParam(B,F,G[F])}}var D=(screen.availWidth-winWidth)/2;var A=(screen.availHeight-winHeight)/2;if(WebIM.Manager.isBrowserSupported()){if(WebIM.Console.ConsoleUI.state!=WebIM.Config.ConsoleStates.POPPED_OUT){var C=WebIM.Conversation.active;WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.POPPED_OUT);WebIM.Conversation.active=C}}var E=window.open(B,"popoutwindow","resizable=1,height="+winHeight+",width="+winWidth+",left="+D+",top="+A+",status=no,toolbar=no,menubar=no,location=no");if(WebIM.Console.Manager.fixedPositioningNotSupported()){WebIM.Console.Manager.onScroll()}return E},editBlockList:function(){WebIM.ModalDialog.editBlockList()},editFriends:function(){window.location.href=WebIM.Config.editFriendsURL},updateCountIndicators:function(){if(WebIM.Console.ConsoleUI.friendsCountIndicator){WebIM.Console.ConsoleUI.friendsCountIndicator.innerHTML=WebIM.FriendsList.friendCount}if(WebIM.Console.FriendsList.friendsCountIndicator){WebIM.Console.FriendsList.friendsCountIndicator.innerHTML=WebIM.FriendsList.friendCount}},updateCountInBar:function(){if(WebIM.Console.ConsoleUI.friendsCountIndicator){WebIM.Console.ConsoleUI.friendsCountIndicator.innerHTML=WebIM.FriendsList.friendCount}},friendRequest:function(A){location.href=WebIM.Config.addToFriendsURL.format(A.id)},deleteFriend:function(A){WebIM.ModalDialog.genericPrompt(WebIM.Strings.REMOVE_CONTACT,String.format(WebIM.Strings.MODAL_DIALOGS_REMOVE_FROM_IM_LIST,A.name),function(B){if(B){WebIM.Manager.getConversation(A.id).clearHistory();A.removeUIElements();WebIM.API.removeUserFromContactList(A.id)}})},goOnlineListener:function(A){if(WebIM.PopoutWindow.state==WebIM.Config.WindowStates.CLOSE){if(WebIM.Viewer.presencePrevious==WebIM.Config.PresenceTypes.OFFLINE){WebIM.Console.TabManager.closeAllTabs()}if(WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.COLLAPSED_OFFLINE){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED)}else{if(WebIM.Console.ConsoleUI.state!="POPPED_OUT"&&WebIM.Console.ConsoleUI.state.indexOf("COLLAPSED")==-1){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.DEFAULT)}}}else{WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.POPPED_OUT)}},goOfflineListener:function(A){WebIM.Console.TabManager.closeAllTabs();if(WebIM.Console.ConsoleUI.state!==WebIM.Config.ConsoleStates.COLLAPSED_OFFLINE){if(WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.POPPED_OUT||WebIM.Console.ConsoleUI.state==WebIM.Config.ConsoleStates.COLLAPSED){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.COLLAPSED_OFFLINE)}else{WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.OFFLINE)}}},acceptMySpaceFriend:function(A){WebIM.Manager.addUserToContactList(A,this.acceptMySpaceFriendCallback)},acceptMySpaceFriendCallback:function(B,A){if(B.statusCode!=200){WebIM.Console.Manager.showContactError(B.statusCode)}else{if(A&&A.tid){var C=WebIM.Manager.friends[A.tid];C.hideNotMySpaceFriendContainer()}}},showContactError:function(A){if(A==606){alert(WebIM.Strings.ERROR_CONTACT_FULL)}else{alert(WebIM.Strings.ERROR_ADD_CONTACT)}},onLinkClick:function(A){location.href=A},focusPopout:function(){if(browser.isGecko){var A={};A[WebIM.Config.ReservedWindows.POPOUT]=new WebIM.Util.WindowState(WebIM.Config.ReservedWindows.POPOUT,WebIM.Config.WindowStates.CLOSE,-1);WebIM.API.updateWindowState(A,null,null,function(B){setTimeout(function(){WebIM.Console.Manager.popOutIM()},200)})}else{WebIM.Manager.commitPoppedOut(true)}},onError:function(C){if(C.fatal){if(WebIM.Console.ConsoleUI.state.search(/UNAVAILABLE/)==-1){WebIM.Console.ConsoleUI.setState(WebIM.Config.ConsoleStates.UNAVAILABLE)}var B=WebIM.Util.Cookie.getConversationPosition();WebIM.Util.Cookie.removeConversationPosition();if(B){var E=B.split("#")[0];var A="conversationContainer_"+E;var F=$get(A);if(F){F.parentNode.removeChild(F)}}var D=WebIM.Console.ConsoleUI.tabsNode.innerHTML=""}}};WebIM.Manager.addEventListener("init",function(){WebIM.Console.Manager.init()});var WebIM=WebIM||{};WebIM.Console=WebIM.Console||{};WebIM.Console.Events={_eventSubscriptions:[],subscribe:function(A,B){if(A==null||typeof A!="string"){return false}if(B==null||typeof B!="function"){return false}if(!this._eventSubscriptions[A]){this._eventSubscriptions[A]=[]}this._eventSubscriptions[A].push(B);return true},unsubscribe:function(A,B){if(this._eventSubscriptions[A]&&Array.contains(this._eventSubscriptions[A],B)){Array.remove(this._eventSubscriptions[A],B)}},_notify:function(B,D){if(B==null||typeof B!="string"){return}if(!this._eventSubscriptions[B]){return}for(var A=0,C=this._eventSubscriptions[B];A<C.length;A++){if(typeof C[A]=="function"){C[A](D)}}}};var WebIM=WebIM||{};WebIM.SubEvent=function(){WebIM.Console.Events.subscribe("MessagingCounter",this.MailNavUpdate)};WebIM.SubEvent.prototype={MailNavUpdate:function(eventArgs){if(typeof(_MySpace)!="undefined"){if(typeof(_MySpace.Services)!="undefined"){_MySpace.Services.prototype.getInstance().publish("COUNTER_UPDATE_REQUEST");return}}if(eventArgs.Counters){var counters=eval("("+eventArgs.Counters+")");for(key in counters){var id="mailCount"+key.toLowerCase();if($get(id)){if($get(id).childNodes.length>0){$get(id).removeChild($get(id).childNodes[0])}var count=(counters[key]>0)?"("+counters[key]+")":"";var text=document.createTextNode(count);$get(id).appendChild(text)}}}}};WebIM.SubEvent.registerClass("WebIM.SubEvent",null);var WebIMSubEvent=new WebIM.SubEvent();
