// Copyright 2005-2009 Meebo, inc.
//
// RSA javascript implementation Copyright 1998-2005 David Shapiro
// please see http://www.ohdave.com/rsa/
// SHA256 javascript implementation Copyright 2003-2004 Angel Marin
// please see http://anmar.eu.org/
//
// interested in joining meebo?  we have positions for back-end software engineer, front-end software engineer, and visual designer
// email your resume and cover letter to secretjobs at meebo dot com!
var lib={};
function Class(b,e,d){var a=(d?e.extend(d):Class.create(e));
if(b){var c=b.lastIndexOf(".");
Class.getObject(b.slice(0,Math.max(c,0)))[b.slice(c+1)]=a
}return a
}function Singleton(b,a){return new (Class(null,b,a))()
}Class.create=function(a){function b(){if(typeof this.initialize=="function"){return this.initialize.apply(this,arguments)
}}b.prototype=new a(function(e,f,d){var c=a;
if(!d){d=[]
}while(c=c.prototype){if(c[f]){return c[f].apply(e,d)
}}throw new Error("method does not exist")
});
b.extend=Class._extend;
b.prototype.constructor=b;
b.prototype.supa=function(f){var e=this.supa,d=this.supaMethod;
try{if(d&&d!=f){this.supa=this.constructor.prototype.supa;
this.supaMethod=f;
return this.supa.apply(this,arguments)
}else{if(f in a.prototype){var c=Array.prototype.slice.call(arguments,1);
this.supa=a.prototype.supa;
this.supaMethod=f;
return a.prototype[f].apply(this,c)
}else{return a.prototype.supa.apply(this,arguments)
}}}finally{this.supa=e;
this.supaMethod=d
}};
return b
};
Class._extend=function(a){a.prototype=this.prototype;
return Class.create(a)
};
Class.getObject=function(pkg){var parts=pkg.split(".");
if(typeof window=="undefined"){var object=eval(parts[0]+" = typeof "+parts[0]+' == "undefined" ? {} : '+parts[0]+";");
parts.shift()
}else{var object=window
}while(parts.length){var part=parts.shift();
if(!part){continue
}if(!object[part]){object[part]={}
}object=object[part]
}return object
};
Class.objectExists=function(a){var c=a.split("."),b=window;
while(c.length){b=b[c.shift()];
if(!b){return false
}}return true
};
Class("lib.pQueue",function(){this.initialize=function(){this.hash={};
this.priorities=[];
this.size=0
};
function a(d,b){var c=0;
while(c<b.length&&d>b[c]){++c
}if(d!=b[c]){b.splice(c,0,d)
}return d
}this.put=function(b,c){c=c||0;
if(!this.hash[c]){this.hash[c]=[]
}this.hash[c].push(b);
a(c,this.priorities);
++this.size
};
this.take=function(){if(this.size>0){--this.size;
for(var b=0;
b<this.priorities.length;
++b){var c=this.hash[this.priorities[b]];
if(c.length==0){continue
}return c.shift()
}}else{return
}}
});
Class("lib.deferred",function(){this.initialize=function(){this.q=new lib.pQueue();
this.state=-1;
this.paused=0;
this.bFiring=false;
this.results=[null,null]
};
this.addCb=function(e,f){return this.add(e,null,f)
};
this.addEb=function(f,e){return this.add(null,f,e)
};
this.addBoth=function(f,e){return this.add(f,f,e)
};
this.add=function(e,g,f){this.q.put([e,g],f);
c.call(this);
return this
};
this._=function(f){var e=argsToArray(arguments).slice(1);
return this.addBoth(function(g){if(g[f]){return g[f].apply(g,e)
}})
};
function a(f){++this.paused;
var e=this;
f.addBoth(function(){if(--e.paused==0){c.apply(e,arguments)
}})
}function d(e){return(e instanceof lib.deferred)
}function b(g,f){if(d(g)){a.call(this,g)
}else{if(typeof g=="function"){try{var h=g.apply(this,f);
if(d(h)){a.call(this,h)
}}catch(e){if(e instanceof lib.deferred.error){this.errback(e)
}else{throw e
}}}}}function c(){if(this.state<0){return
}while(this.q.size>0&&!this.paused&&!this.bFiring){var e=this.q.take();
this.bFiring=true;
b.call(this,e[this.state],this.results[this.state]);
this.bFiring=false
}}this.callback=function(){this.state=0;
this.results[this.state]=argsToArray(arguments);
c.call(this);
return this
};
this.errback=function(){this.state=1;
this.results[this.state]=argsToArray(arguments);
c.call(this);
return this
}
});
Class("lib.deferred.error",function(){this.initialize=function(a){this.m_msg=a
};
this.toString=function(){return"Error: "+this.m_msg
}
});
Class("lib.serializer",function(){this.initialize=function(){this.m_bExec=false;
this.m_queue=[]
};
this.serialize=function(c){var b=this;
function a(){if(b.m_queue.length){b.m_bExec=true;
b.m_queue.shift()(a);
return
}b.m_bExec=false
}this.m_queue.push(c);
if(!this.m_bExec){a()
}}
});
Class("lib.PubSub",function(){this.initialize=function(){this.m_subscribers={};
this.m_publisherSubscribers={}
};
this.publish=function(b,l){var a=this.m_subscribers[l],c=b.__id__,f,d;
if(c&&(f=this.m_publisherSubscribers[c])&&(d=f[l])){a=!a?d:d.concat(a)
}a=a&&a.slice(0);
for(var g=0,k;
a&&(k=a[g]);
g++){if(typeof k.callback!="function"){k.callback=hitch(k.context,k.callback)
}try{k.callback.apply(k.context||this,arguments)
}catch(h){}}};
this.subscribe=function(d,a,b,f){if(typeof d=="string"){f=b;
b=a;
a=d;
d=null
}var c=this.m_subscribers;
if(d){var g=d.__id__||(d.__id__=String(getUniqueId()));
var c=this.m_publisherSubscribers[g]||(this.m_publisherSubscribers[g]={})
}var e=c[a]||(c[a]=[]);
e[e.length]={context:b,callback:f}
};
this.subscribeAll=function(e,c,b){if(arguments.length==2){b=c;
c=e;
e=null
}var d=this.m_subscribers;
if(e){var g=e.__id__||(e.__id__=String(getUniqueId()));
var d=this.m_publisherSubscribers[g]||(this.m_publisherSubscribers[g]={})
}for(var a in b){var f=d[a]||(d[a]=[]);
f[f.length]={context:c,callback:b[a]}
}};
this.unsubscribe=function(f,a,d){if(typeof f=="string"){d=a;
a=f;
f=null
}if(!d){return
}var e=this.m_subscribers;
if(f){var h=f.__id__;
if(!h){f.__id__=String(getUniqueId())
}var e=this.m_publisherSubscribers[h]
}var g=e&&e[a];
for(var c=0;
g&&c<g.length;
c++){var b=g[c];
if(b.context==d){g.splice(c,1);
c--
}}}
});
Class("lib.Publisher",function(){this.initialize=function(){this.m_subscribers={}
};
this.subscribe=function(d,c,e){if(!c){c=this
}var b=this.m_subscribers[d]||(this.m_subscribers[d]=[]);
var a=Array.prototype.slice.call(arguments,1);
a.splice(2,0,null);
b[b.length]=a;
return this
};
this.unsubscribe=function(d,c,e){if(!c){this.m_subscribers[d]=[];
return
}if(!c){c=this
}var b=this.m_subscribers[d]||(this.m_subscribers[d]=[]);
for(var a=b.length-1;
a>=0;
a--){if(b[a][0]==c&&(!e||b[a][1]==e)){b.splice(a,1)
}}return this
};
this.publish=function(d){var c=this.m_subscribers[d]||(this.m_subscribers[d]=[]);
var a=Array.prototype.slice.call(arguments,1);
for(var b=0,e;
(e=c[b]);
b++){if(typeof e[1]!="function"&&typeof e[2]!="function"){e[2]=hitch(e[0],e[1])
}(e[2]||e[1]).apply(e[0],e.slice(3).concat(a))
}return this
};
this.publishDeferred=function(e){var a=new lib.deferred();
var d=this.m_subscribers[e]||(this.m_subscribers[e]=[]);
for(var c=0,f;
(f=d[c]);
c++){a.addBoth(hitch(f[0],f[1]))
}var b=Array.prototype.slice.call(arguments,1);
a.callback.apply(a,b);
return a
}
});
lib.ResourceManager=function(a){this.m_queue=[];
this.m_create=a;
this.m_isRecyclable=true;
this.getOne=function(b){this.m_queue.length?b(this.m_queue.shift()):this.m_create(b)
};
this.recycle=function(b){if(this.m_isRecyclable){this.m_queue.push(b)
}};
this.setRecyclable=function(b){this.m_isRecyclable=b
};
this.allocate=function(d){var c=hitch(this,"recycle");
for(var b=this.m_queue.length;
b<d;
++b){this.m_create(c)
}}
};
Class("lib.CallbackManager",function(){this.initialize=function(){this.m_callbacks={};
this.m_namespace="CallbackManager"+new Date().getTime()+"_"+Math.floor(Math.random()*100000);
this.m_callbackCount=0
};
this.scheduleCallback=function(b){var a=this.m_namespace+"_"+(this.m_callbackCount++);
this.m_callbacks[a]=b;
return a
};
this.executeCallback=function(b,a){if(!this.m_callbacks[b]){return
}var a=this.m_callbacks[b].call(this,a);
delete this.m_callbacks[b];
return a
}
});
Class("lib.Drag",lib.Publisher,function(a){this.m_startX;
this.m_startY;
this.initialize=function(c,d,b){a(this,"initialize");
this.m_win=c;
this.m_params=null;
this.m_isActive=false;
this.m_addInScroll=!d;
this.m_thresholdSqrd=b*b||0;
this.m_cancelDragMouseEvent=false;
this.onMove=hitch(this,this.onMove);
this.onDrag=hitch(this,this.onDrag);
this.onDragStop=hitch(this,this.onDragStop)
};
this.isDrag=function(){return this.m_isDrag
};
this.addElement=function(b,c){ui.connectEvent(b,"mousedown",this,"startDrag",true,false,c);
if(b.attachEvent){b.attachEvent("ondragstart",ui.setEventHandled)
}};
this.removeElement=function(b){ui.disconnectEvent(b,"mousedown")
};
this.setCancelDragMouseEvent=function(b){this.m_cancelDragMouseEvent=b
};
this.startDrag=function(b,c){if(b.button==2){return
}this.m_isDrag=true;
if(this.m_cancelDragMouseEvent){ui.setEventHandled(b)
}this.m_params=c;
if(this.m_addInScroll){this.m_startX=ui.getCursorX(b);
this.m_startY=ui.getCursorY(b)
}else{this.m_startX=b.clientX;
this.m_startY=b.clientY
}this._connectEvents(b)
};
this.startClick=function(b){this.m_isDrag=false;
this.m_params=b;
this._connectEvents()
};
this._connectEvents=function(b){setTimeout(hitch(ui,"attachEvent",this.m_win.document,"mousedown",this.onDragStop),0);
ui.attachEvent(this.m_win.document,"mouseup",this.onDragStop);
if(this.m_thresholdSqrd>0&&this.m_isDrag){ui.attachEvent(this.m_win.document,"mousemove",this.onMove)
}else{ui.attachEvent(this.m_win.document,"mousemove",this.onDrag);
this.m_isActive=true;
this.publish("DragStart",this.m_params,b?this.getCoords(b):null)
}};
this._disconnectEvents=function(){ui.detachEvent(this.m_win.document,"mousedown",this.onDragStop);
ui.detachEvent(this.m_win.document,"mouseup",this.onDragStop);
ui.detachEvent(this.m_win.document,"mousemove",this.onDrag);
ui.detachEvent(this.m_win.document,"mousemove",this.onMove)
};
this.isActive=function(){return this.m_isActive
};
this.getCoords=function(e){var b,f;
if(this.m_addInScroll){b=ui.getCursorX(e);
f=ui.getCursorY(e)
}else{b=e.clientX;
f=e.clientY
}var d=b-this.m_startX,c=f-this.m_startY;
return{x:b,y:f,dx:d,dy:c,isDrag:this.m_isDrag}
};
this.onMove=function(c){var b=this.getCoords(c);
if(b.dx*b.dx+b.dy*b.dy>this.m_thresholdSqrd){ui.detachEvent(this.m_win.document,"mousemove",this.onMove);
ui.attachEvent(this.m_win.document,"mousemove",this.onDrag);
this.m_isActive=true;
this.publish("DragStart",this.m_params,{x:this.m_startX,y:this.m_startY,dx:0,dy:0});
this.publish("Drag",this.m_params,b)
}};
this.onDrag=function(b){ui.setEventHandled(b);
this.publish("Drag",this.m_params,this.getCoords(b))
};
this.onDragStop=function(b){ui.setEventHandled(b);
this._disconnectEvents();
if(this.m_isActive){this.m_isActive=false;
this.publish("DragStop",this.m_params,this.getCoords(b))
}}
});
Class("lib.DropTargets",function(){this.m_isActive=false;
this.m_win=null;
this.m_list=[];
this.m_dropTargets=[];
this.getDropTargets=function(){return this.m_dropTargets
};
this.addDropTarget=function(a){this.m_dropTargets.push(a);
if(this.m_isActive){this._addToList(a)
}};
this.updateDropTarget=function(a){if(this.m_isActive){this._removeFromList(a);
this._addToList(a)
}};
this.removeDropTarget=function(b){for(var a=this.m_dropTargets.length-1;
a>=0;
a--){if(this.m_dropTargets[a]==b){this.m_dropTargets.splice(a--,1)
}}if(this.m_isActive){this._removeFromList(b)
}};
this.activate=function(c,a){this.m_locator=a||posWithRespectTo;
this.m_win=c;
this.m_list=[];
this.m_isActive=true;
for(var b=0,d;
d=this.m_dropTargets[b];
b++){this._addToList(d,true)
}this._sortList()
};
this.query=function(a,d){for(var b=0,c;
c=this.m_list[b];
++b){if(a>=c.x&&a<=c.x+c.w&&d>=c.y&&d<=c.y+c.h){return c.dropTarget
}}return null
};
this.deactivate=function(){this.m_isActive=false;
this.m_list=[]
};
this._addToList=function(d,c){if(!d||!d.m_element||d.m_win!=this.m_win){return
}var a;
if(d.getDropDescription){a=d.getDropDescription()
}else{var b=d.getDropTargetElement&&d.getDropTargetElement()||d.m_element;
var a=this.m_locator(b);
a.zSort=parseInt(getCSSProp(d.m_element,"z-index"));
if(isNaN(a.zSort)){a.zSort=0
}}a.dropTarget=d;
this.m_list.push(a);
if(!c){this._sortList()
}};
this._removeFromList=function(c){for(var a=0,b;
b=this.m_list[a];
++a){if(c==b.dropTarget){this.m_list.splice(a--,1)
}}};
this._sortList=function(){this.m_list.sort(function(d,c){return(c.zSort-d.zSort)
})
}
});
util={};
util.query={AD_SHARE_ID:"ad",AUTO_LAUNCH_ID:"launch",MEEBO_USER:"mu",USER:"u",ADD_BUDDY_USERNAME:"ab",TRACK_VIRAL:"v",SESSION_KEY:"k",FIREFOX_EXTENSION:"ff",IMTHIS_TITLE:"it",IMTHIS_URL:"iu",AUTH_TOKEN:"t",NETWORK:"n",PROTOCOL:"p",GROUPCHAT_PASSWORD:"pass",GROUPCHAT_INVITE_RECEIVED:"m",FILE_ID:"fileid",PROMPT_SIGNUP:"signup",FORCE_TREATMENT:"treatment",CLIENT_TYPE:"ct",PREFILL_NAME:"pf",CONNECT_CALLER_URL:"ccu",CALLER_CLIENTID:"cid",PARTNER_AUTH_TOKEN:"pat",CALLBACK_ID:"cb",RWC_NAME:"rn",RWC_VALUE:"rv",SHOW_BLOG:"blog",REMOTE_CALL:"rc",REMOTE_URL:"ru",REMOTE_ARGS:"ra",REMOTE_CALLBACK:"rb",REMOTE_SUCCESS:"rs"};
function getQueryVariable(a){return getUrlVariable(a,window.location.search.substring(1))
}function getHashVariable(b,a){var c;
if(a){c=a.substr(a.indexOf("#")+1)
}else{c=window.location.hash.substr(1)
}return c&&getUrlVariable(b,c)||null
}function getUrlVariable(a,b){if(ui.isIE||ui.isSafari){b=decodeURIComponent(b)
}return getURIParamsAsObject(b)[a]
}function getObjectAsURIParams(c){var a=[];
for(var b in c){a.push(encodeURIComponent(b)+"="+encodeURIComponent(c[b]))
}return a.join("&")
}function getURIParamsAsObject(e){if(!e){return{}
}var c={};
var d=e.split("&");
for(var b=0;
b<d.length;
b++){var a=d[b].split("=");
c[decodeURIComponent(a[0])]=decodeURIComponent(a[1])
}return c
}util.query.grabHashVariables=function(){util.query.m_hashValues=util.query.m_hashValues||{};
var a=window.location.href.split("#");
if(a[1]){if(!ui.isWebKit){window.location.hash="#"
}util.query.m_hashValues=getURIParamsAsObject(a[1])
}};
util.query.getHashVariable=function(a){return util.query.m_hashValues[a]
};
util.query.addParams=function(c,k,a){var g=c.split("?");
if(g[1]){var l=g[0];
var b=(g[1]||"").split("#");
var d=b[0];
var e=b[1]
}else{var b=c.split("#");
var l=b[0];
var d="";
var e=b[1]
}var f=(d?d+"&":"")+getObjectAsURIParams(k);
var h=(e?e+"&":"")+getObjectAsURIParams(a);
return l+(f?"?"+f:"")+(h?"#"+h:"")
};
util.query.URL=function(a){var b=String(a).match(/^([^:\/?#]+:)?(?:\/\/)?([^\/?#]*)([^?\s#]*)?(\?([^#]*))?(#(.*))?$/);
if(b){this.protocol=b[1];
this.host=b[2];
this.pathname=b[3];
this.search=b[5];
this.hash=b[7]
}};
util.query.URL.prototype.toString=function(){var a="";
if(this.protocol){a+=this.protocol
}if(this.host){a+="//"+this.host
}a+=this.pathname;
if(this.search){a+="?"+this.search
}if(this.hash){a+="#"+this.hash
}return a
};
util.query.url=function(a){return new util.query.URL(a)
};
util.query.relativeTo=function(b,a){var c=util.query.url(b);
var b=util.query.url(b),a=util.query.url(a);
if(!b.protocol){c.protocol=a.protocol;
if(!b.host){c.host=a.host
}}return c.toString()
};
util.cookie={};
util.cookie.save=function(a,f,d,c){if(typeof d!="number"&&!(d instanceof Date)){d=(365*24*60*60*1000)
}var b;
if(d instanceof Date){b=d
}else{if(d>=0){b=new Date();
b.setTime(b.getTime()+d)
}}var e=b?"expires="+b.toGMTString()+"; ":"";
var k=a+"="+encodeURIComponent(f)+"; ";
var g=c||(/(\.|^)meebo\.com$/i.test(document.domain)?".meebo.com":document.domain);
var c="domain="+g+"; ";
var h="path=/; ";
document.cookie=k+e+c+h
};
util.cookie.erase=function(b,a){util.cookie.save(b,"",new Date(0),a)
};
util.cookie.load=function(b){var c=document.cookie;
if(c.length){var a=new RegExp(";?\\s*"+b+"=(.*?);").exec(" "+c+";");
if(a&&a.length){return decodeURIComponent(a[1])
}}return null
};
function addClassName(c,b){var d=typeof c=="string";
if((!d&&!c)||!b){return
}var a=d?c:c.className;
if((" "+a+" ").indexOf(" "+b+" ")==-1){a+=(a?" ":"")+b
}if(!d){c.className=a
}return a
}function addClassNames(a){for(var b=1;
b<arguments.length;
b++){addClassName(a,arguments[b])
}}function removeClassName(c,b){var d=typeof c=="string";
if((!d&&!c)||!b){return
}var a=d?c:c.className;
a=(" "+a+" ").replace(" "+b+" "," ").replace(/^\s+|\s+$/g,"");
if(!d){c.className=a
}return a
}function removeClassNames(a){for(var b=1;
b<arguments.length;
b++){removeClassName(a,arguments[b])
}}function toggleClassName(c,b,a){if(b){addClassName(c,a)
}else{removeClassName(c,a)
}}function hasClassName(c,b){var d=typeof c=="string";
if((!d&&!c)||!b){return
}var a=d?c:c.className;
return((" "+a+" ").indexOf(" "+b+" ")!=-1)
}function roundElementCorners(a){if(ui.isFirefox||ui.isSafari){addClassName(a,"roundCorners")
}else{var k=gDoc(a);
var l=a.parentNode;
var e=k.createElement("div");
l.removeChild(a);
e.appendChild(a);
l.appendChild(e);
addClassName(e,"stackedCorners");
addClassName(a,"stackedContent");
var h=k.createElement("b");
var f=k.createElement("b");
addClassName(h,"stack-top");
addClassName(f,"stack-bot");
for(var c=1;
c<=3;
c++){var g=k.createElement("b");
addClassName(g,"roundCorner stack"+c);
h.appendChild(g)
}for(var c=3;
c>=1;
c--){var g=k.createElement("b");
addClassName(g,"roundCorner stack"+c);
f.appendChild(g)
}var d=a.firstChild;
if(!d){d=a.ownerDocument.createElement("div");
a.appendChild(d)
}d.style.padding="0px 1px 0px";
a.parentNode.insertBefore(h,a);
a.parentNode.appendChild(f)
}}function $(e){for(var c=0,d;
(d=$.docs[c]);
c++){try{var b=d.getElementById(e);
if(b){return b
}}catch(a){}}}$.docs=[document];
$.remember=function(b){for(var a=0;
a<$.docs.length;
++a){if(b===$.docs[a]){return
}}$.docs.push(b)
};
$.forget=function(c){var a=[];
for(var b=0;
b<$.docs.length;
++b){if($.docs[b]!==c){a.push($.docs[b])
}}$.docs=a
};
function gDoc(b){if(b){if(b.ownerDocument){return b.ownerDocument
}else{if(b.document){return b.document
}else{if(typeof(b.nodeName)=="string"){if(b.nodeName.match(/document/i)){return b
}else{if(gWin.isWindow(b)){return b.document
}}}}}var a=b.target||b.srcElement;
if(a){return gDoc(a)
}}return gDoc._doc
}gDoc._doc=document;
function gWin(c){if(gWin.wins.length==1){return gWin.wins[0]
}if(gWin.isWindow(c)){return c
}var b=gDoc(c);
for(var a=0;
a<gWin.wins.length;
a++){if(gWin.wins[a].document===b){return gWin.wins[a]
}}var d=b.parentWindow||b.defaultView;
return d||gWin.wins[0]
}gWin.wins=[window];
gWin.isWindow=function(c){var a=false;
try{a=(c&&typeof c.screen=="object")
}catch(b){a=true
}return a
};
gWin.map=function(b){for(var a=0;
a<gWin.wins.length;
++a){b(gWin.wins[a])
}};
gWin.remember=function(a){if(isDefined(a._gWinPos)){return
}a._gWinPos=gWin.wins.length;
gWin.wins.push(a)
};
gWin.forget=function(c){if(!isDefined(c._gWinPos)){return
}gWin.wins.splice(c._gWinPos,1);
for(var b=c._gWinPos;
b<gWin.wins.length;
b++){gWin.wins[b]._gWinPos=b
}try{delete c._gWinPos
}catch(a){}};
function getChild(a,c){if(!a){return
}if(!a.hasChildNodes){return
}var b=a.firstChild;
while(b){if(b.id==c){return b
}b=b.nextSibling
}}function recursiveGetPart(a,d){if(!a||!d){return
}if(!a.hasChildNodes()){return
}var c=a.firstChild;
while(c){if(c.id==d){return c
}var b=recursiveGetPart(c,d);
if(b){return b
}c=c.nextSibling
}return null
}function posWithRespectTo(b,a){var d={x:0,y:0,w:0,h:0};
if(b){d.w=b.offsetWidth;
d.h=b.offsetHeight
}var c=b;
while(c){if(c===a){break
}d.x+=c.offsetLeft;
d.y+=c.offsetTop;
if(c!=b){d.x-=c.scrollLeft;
d.y-=c.scrollTop
}c=c.offsetParent
}d.left=d.x;
d.top=d.y;
return d
}function getElementPosition(a){if(!a){return
}var b=gDoc(a),c=posWithRespectTo(a);
if(navigator.userAgent.indexOf("Mac")!=-1&&isDefined(b.body.leftMargin)){c.x+=b.body.leftMargin;
c.left=c.x;
c.y+=b.body.topMargin;
c.top=c.y
}return c
}function getPartFromElement(a,b){if(a){return recursiveGetPart(a,b)
}}function removeChildren(a){if(a){var b;
while(b=a.firstChild){a.removeChild(b)
}}return a
}function removeElement(b){try{if(!b||!b.parentNode){return b
}return b.parentNode.removeChild(b)
}catch(a){b.style.visibility="hidden";
return b
}}function getTextContent(a,b){var e=a.getElementsByTagName(b)[0];
if(!e){var d=a.getElementsByTagName("*");
for(var c=0;
c<d.length;
c++){if(d[c].tagName==b){e=d[c];
break
}}if(!e){return""
}}if("text" in e){return unescapeHTML(unescape(e.text))
}else{if("textContent" in e){return e.textContent
}else{if(e.firstChild){return e.firstChild.nodeValue
}}}return""
}function hitch(c,d){var b=Array.prototype.slice.call(arguments,2);
function a(){var e=(typeof d=="function"?d:c[d]);
return e.apply(c,b.concat(Array.prototype.slice.call(arguments)))
}a.methodName=d;
return a
}function getValue(c){var a=$(c);
if(!a||!isDefined(a.value)){return""
}var b=a.value;
if(!b){return""
}return b
}function createRadio(b,c){if(ui.isIE){var a=c.document.createElement('<input type="radio" name="'+b+'">')
}else{var a=c.document.createElement("input");
a.type="radio";
a.name=b
}return a
}function copyStyles(f,c,a,e){for(var b=0,g;
g=e[b];
++b){getCSSProp.camelProp[g]||(getCSSProp.camelProp[g]=g.replace(/-\D/gi,getCSSProp.capitalize))
}var d=getCSSProp(c,e,f);
for(var g in d){if(d[g]){a.style[getCSSProp.camelProp[g]]=d[g]
}}}function getCSSProp(f,n,l){if(f.currentStyle){var a=f.style.display;
f.style.display=(a=="block"?"inline":"block");
f.style.display=a;
if(isArray(n)){var c={};
for(var g=0,b;
b=n[g];
++g){var d=getCSSProp.camelProp[b]||(getCSSProp.camelProp[b]=b.replace(/-\D/gi,getCSSProp.capitalize));
try{c[b]=f.currentStyle[d]
}catch(m){}}return c
}else{var d=getCSSProp.camelProp[n]||(getCSSProp.camelProp[n]=n.replace(/-\D/gi,getCSSProp.capitalize));
var h=/font/i;
if(h.test(d)){addClassName(f,"fontHack");
removeClassName(f,"fontHack")
}try{var c=f.currentStyle[d]
}catch(m){}return c
}}else{var l=l||gWin(f);
if(l.document.defaultView){var k=l.document.defaultView.getComputedStyle(f,"");
if(k){if(isArray(n)){var c={};
for(var g=0,b;
b=n[g];
++g){c[b]=k.getPropertyValue(b)
}return c
}else{return k.getPropertyValue(n)
}}}}if(f.style.getPropertyValue){if(isArray(n)){var c={};
for(var g=0,b;
b=n[g];
++g){c[b]=f.style.getPropertyValue(b)
}return c
}else{return f.style.getPropertyValue(n)
}}return null
}getCSSProp.capitalize=function(a){return a.charAt(a.length-1).toUpperCase()
};
getCSSProp.camelProp={};
function getTextHeight(e,b,a){if(!e||e.length<=0){return 0
}var c=setupRuler(a);
if(b){c.style.width=b+"px"
}else{c.style.width=document.body.offsetWidth+"px"
}setText(c,e);
c.className="";
var d=c.offsetHeight;
c.style.width="";
return d
}function setupRuler(b){var c=$("ruler");
if(!c){c=document.createElement("span");
c.id="ruler";
c.style.left="400px";
c.style.top="0px";
c.style.position="absolute";
c.style.visibility="hidden";
c=document.body.appendChild(c)
}if(b){var e=getCSSProp(b,"font-size");
var a=getCSSProp(b,"font-weight");
var d=getCSSProp(b,"font-family");
c.style.fontSize=e?e:"11px";
c.style.fontWeight=a?a:"normal";
c.style.fontFamily=d?d:"Tahoma, Arial, sans serif"
}return c
}function getFittedHeightText(h,a,b,c){if(c<=0){return""
}if(ui.isGecko){var d=15;
var f=h.split(" ");
for(var e=0;
e<f.length;
e++){if(f[e].length>d){f.splice(e+1,0,f[e].substring(d));
f[e]=f[e].substring(0,d)
}}h=f.join(" ")
}var g=getTextHeight(h,a,b);
while(g>c){var k=h.lastIndexOf(" ");
if(k==-1){return""
}h=h.substr(0,k)+"\u2026";
g=getTextHeight(h,a,b)
}return h
}function getbAttribute(a,b){if(!a||!a.getAttribute){return false
}var c=a.getAttribute(b);
if((!c)||(c.length<=0)){return false
}return c
}function truncateMiddle(d,b){if(d.length<=b){return d
}var a=Math.ceil(b/2);
var c=Math.floor(b/2);
return d.substr(0,a)+"\u2026"+d.substr(d.length-c)
}function truncateEnd(b,a){return b.substr(0,a)+"\u2026"
}function getTruncatedText(e,c,d,a,b){if(!e){return""
}b=b||arguments.callee.textbox;
if(!b){b=document.createElement("div");
b.style.fontSize="11px";
b.style.fontWeight="normal";
b.style.fontFamily="Tahoma, Arial, sans-serif";
b.style.position="absolute";
b.style.top=b.style.left="-999px";
b.style.visibility="hidden";
document.body.appendChild(b);
arguments.callee.textbox=b
}setTruncatedText(window,b,e,c,d,a);
return b.firstChild.nodeValue
}function setTruncatedText(h,c,q,p,o,m){if(p<=0){return false
}var s=getTextRuler(h,c);
if(o){s.style.width=p+"px";
s.style.whiteSpace="normal";
setText(s,q);
if(s.offsetHeight>o){var g=q;
var f=0,l=q.length,e="";
while(l-f>1){i=Math.floor((l+f)/2);
var k=g.substr(0,i)+"\u2026";
setText(s,k);
if(s.offsetHeight>o){l=i
}else{f=i;
q=k
}}}}else{s.style.width="auto";
s.style.whiteSpace="nowrap";
setText(s,q);
m=m||truncateEnd;
var a=s.offsetWidth;
if(p&&a>p){var n=q.length,b=0,d=q.length/2;
do{b=n;
n=Math.floor((p/a)*n);
setText(s,m(q,n));
a=s.offsetWidth
}while(d-->0&&(Math.abs(n-b)>1||(n!=b&&a>p)));
q=m(q,Math.min(n,b))
}}setText(c,q);
return true
}setTruncatedText.ruler={};
function getTextRuler(b,a){if(!setTruncatedText.ruler[b]){var c=b.document.createElement("div");
c.style.position="absolute";
c.style.top=c.style.left="-999px";
b.document.body.appendChild(c);
setTruncatedText.ruler[b]=c
}var c=setTruncatedText.ruler[b];
c.style.fontSize=getCSSProp(a,"font-size",b)||"";
c.style.fontWeight=getCSSProp(a,"font-weight",b)||"";
c.style.fontFamily=getCSSProp(a,"font-family",b)||"";
return c
}function getTextWidth(b,a,c){var d=getTextRuler(b,a);
d.style.width="auto";
d.style.whiteSpace="nowrap";
setText(d,c);
return d.offsetWidth
}function setTruncatedTextContent(e,m,c,k,h,g){k=k||truncateEnd;
h=h||{};
if(c<0){c=0
}var n=arguments.callee.ruler;
if(!n){g=g||window;
n=g.document.createElement("div");
n.style.whiteSpace="nowrap";
n.style.position="absolute";
n.style.top=n.style.left="-999px";
n.style.visibility="hidden";
g.document.body.appendChild(n);
arguments.callee.ruler=n
}n.style.fontSize=h.fontSize||getCSSProp(e,"font-size",g)||"";
n.style.fontWeight=h.fontWeight||getCSSProp(e,"font-weight",g)||"";
n.style.fontFamily=h.fontFamily||getCSSProp(e,"font-family",g)||"";
setText(n,m);
var b=m;
var a=n.offsetWidth;
if(c&&a>c){var l=m.length,d=0,f=m.length/2;
do{d=l;
l=Math.floor((c/a)*l);
b=k(m,l);
setText(n,b);
a=n.offsetWidth
}while(f-->0&&(Math.abs(l-d)>1||(l!=d&&a>c)));
b=k(m,Math.min(l,d))
}setText(e,b);
return a
}function isCursorInElement(b,c){if(!c){c=gWin(b).event
}if(!c||!b){return false
}var e=getElementPosition(b);
var a=ui.getCursorX(c);
var d=ui.getCursorY(c);
return isInRect(a,d,e.x,e.y,e.w,e.h)
}function isChecked(b){var a=$(b);
if(a){return a.checked
}return false
}function moveToEnd(c){if(!c){return
}if(ui.isSafari){return
}try{if(c.createTextRange){var b=c.createTextRange();
b.collapse(false);
b.select()
}else{c.focus();
var a=c.value.length;
if(c.setSelectionRange&&a){c.setSelectionRange(a,a)
}}}catch(d){}}function sendMouseEvent(e,l,g,f,d,c,m,b,h,n){var o=gDoc(e);
var k=gWin(o);
if(ui.isIE){var a=o.createEventObject();
a.detail=0;
a.screenX=g;
a.screenY=f;
a.clientX=d;
a.clientY=c;
a.button=m;
a.ctrlKey=b;
a.altKey=h;
a.shiftKey=n;
a.metaKey=false;
a.relatedTarget=null;
e.fireEvent("on"+l,a)
}else{if(ui.isGecko){var a=o.createEvent("MouseEvents");
a.initMouseEvent(l,true,true,k,1,g,f,d,c,b,h,n,false,0,null);
e.dispatchEvent(a)
}}}function unselectText(b){var a,e=gWin(b);
var d=e.document;
if(d.selection){var c=d.selection;
if(!c||!c.createTextRange){return
}a=c.createTextRange();
if(!a||!a.collapse){a.collapse(false)
}}else{if(e&&e.getSelection){var c=e.getSelection();
if(!c||!c.removeRange){return
}if(c.rangeCount<=0){return
}var a=c.getRangeAt(0);
if(!a){return
}c.removeRange(a)
}}}function calcWinChrome(a){if(isDefined(a.outerWidth)){return{w:a.outerWidth-a.innerWidth-2,h:a.outerHeight-a.innerHeight-30}
}else{if(a===window){return{w:0,h:0}
}else{return{w:5,h:52}
}}}function calcWinPos(a){if(isDefined(a.screenLeft)){return{x:a.screenLeft,y:a.screenTop,w:a.document.body.clientWidth,h:a.document.body.clientHeight}
}else{return{x:a.screenX,y:a.screenY,w:a.innerWidth,h:a.innerHeight}
}}function fixPng(a,b){if(arguments.length==0){a=this
}b=b||gImages.getPath()+"blank.gif";
if(navigator.platform=="Win32"&&navigator.appName=="Microsoft Internet Explorer"&&typeof a.style.filter=="string"&&a.src.match(/\.png$/i)!=null){var c=a.src;
if(a.width){a.style.width=a.width+"px"
}if(a.height){a.style.height=a.height+"px"
}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"', sizingMethod='scale')";
a.onload=function(){a.className=a.className.replace(/\bfixPng\b/g,"")
};
a.src=b
}else{a.className=a.className.replace(/\bfixPng\b/g,"")
}}if(navigator.platform=="Win32"&&navigator.appName=="Microsoft Internet Explorer"){document.write('<style type="text/css"> .fixPng { visibility: hidden; } </style>')
}function disableSelection(b,a){if(a){var d=b.all||b.getElementsByTagName("*");
for(var c=0;
c<d.length;
c++){arguments.callee(d[c])
}}else{b.style.MozUserSelect="none";
b.style.KhtmlUserSelect="none";
b.unselectable="on"
}}function enableSelection(b,a){if(a){var d=b.all||b.getElementsByTagName("*");
for(var c=0;
c<d.length;
c++){arguments.callee(d[c])
}}else{b.style.MozUserSelect="";
b.style.KhtmlUserSelect="";
b.unselectable="off"
}}function isSelectionCollapsed(b){var d=gDoc(b);
var c=gWin(d);
if(d.selection){return d.selection.createRange().text==""
}else{if(c.getSelection){var a=c.getSelection();
if(typeof a=="string"){return a==""
}else{return a.isCollapsed
}}}}function setText(a,b){b=String(b);
if("textContent" in a){a.textContent=b
}else{if("innerText" in a){a.innerText=b.replace(/\n/g," ")
}else{a.innerHTML="";
a.appendChild(gDoc(a).createTextNode(b))
}}return a
}function getText(a){if("textContent" in a){return a.textContent
}else{if("innerText" in a){return a.innerText
}else{return a.innerHTML
}}}function attachIframeCallback(a,b){a.onload=function(){a.onload=null;
a.onreadystatechange=null;
b.call(this)
};
a.onreadystatechange=function(){if(this.readyState=="complete"){a.onload=null;
a.onreadystatechange=null;
b.call(this)
}}
}function attachIframeMouseHandlers(e,d,b,a){var c=ui.isIE?e.contentWindow.document:e.contentDocument;
function f(l,h,k,m){var p=true;
if(m){p=m(l)
}var o=getElementPosition(e);
if(ui.isFirefox==1){o={left:0,top:0}
}var g=l.clientX+o.left;
var n=l.clientY+o.top;
sendMouseEvent(e.parentNode,h,g,n,g,n,k,false,false,false);
return p
}ui.connectEvent(c,"mousemove",this,f,true,false,"mousemove",0,d);
ui.connectEvent(c,"mousedown",this,f,true,false,"mousedown",0,a);
ui.connectEvent(c,"mouseup",this,f,true,false,"mouseup",0,a)
}function scrollToItem(b,h){if(!b||!b.style||!h||!h.style){return
}var g=b.scrollTop;
var a=b.offsetHeight;
var f=g+a;
var d=h.offsetTop;
var e=h.scrollHeight;
var c=d+e;
if((g<d)&&(c<f)){return
}if(g>d){b.scrollTop=d;
return
}if(c>f){b.scrollTop=d-a+e
}}function scaleImage(b,d,f){var g=b.height,a=b.width;
var e=f,c=d;
if(e!=g){b.height=e=Math.min(e,g);
b.width=c=(d/f)*e
}if(c>a){b.width=c=a;
b.height=e=(f/d)*c
}b.style.borderStyle="solid";
b.style.borderTopWidth=Math.floor((g-e)/2)+"px";
b.style.borderBottomWidth=Math.ceil((g-e)/2)+"px";
b.style.borderLeftWidth=Math.floor((a-c)/2)+"px";
b.style.borderRightWidth=Math.ceil((a-c)/2)+"px"
}function sanitizeLinks(c,b){var a=c.getElementsByTagName("a");
for(var d=0;
d<a.length;
d++){if(b){var e=a[d].href.match(/\/\/(.*?)\//);
if(!e||e[1]!=b){a[d].target="_blank"
}}else{a[d].target="_blank"
}}}function domInsertBefore(b,c,a){if(!c||!b){return
}if(a){return b.insertBefore(c,a)
}else{return b.appendChild(c)
}}function trackClickInIframe(d,c,a){a=a||document.body;
var b=$(d);
if(b){removeElement(b)
}var b=gDoc(a).createElement("iframe");
b.id=d;
b.style.position="absolute";
b.style.top="-1000px";
b.style.left="-1000px";
b.src=c;
a.appendChild(b)
}var g_currentUniqueId=1;
function getUniqueId(){return String(++g_currentUniqueId)
}function isDefined(a){return typeof a!="undefined"
}function isNumber(a){return typeof a=="number"||a instanceof Number
}function isString(a){return typeof a=="string"||a instanceof String
}function isFunction(a){return typeof a=="function"||a instanceof Function
}function isArray(b){return b instanceof Array
}function callee(a){var c=a.callee,b=this;
return function(){return c.apply(b,a)
}
}function shallowCopy(b){var c={};
for(var a in b){c[a]=b[a]
}return c
}function argsToArray(a,b){b=b||0;
return Array.prototype.slice.call(a,b)
}function objectToArray(a){if(!a){return[]
}var c=[];
for(var b in a){if(a[b]){c.push(a[b])
}}return c
}function arrayToObject(b){if(!b){return{}
}var d={};
for(var c=0;
c<b.length;
c++){d[String(b[c])]=b[c]
}return d
}function isEmpty(a){if(!a){return false
}for(var b in a){if(a[b]!=null){return false
}}return true
}function doFunctions(a){if(!a){return
}var b=argsToArray(arguments);
if(b){b=b.slice(1)
}for(var c=0;
c<a.length;
c++){if(a[c]){a[c].apply(this,b)
}}}function sprintf(){if(!arguments||arguments.length<1||!RegExp||!arguments[0]){return
}var b=arguments[0];
for(var a=1;
a<arguments.length;
a++){b=b.replace(new RegExp("%"+a,"g"),arguments[a]||"")
}return b
}function runInMainContext(){var b=null;
var c=arguments[0];
if(typeof c!="function"){b=arguments[0];
c=arguments[1];
if(typeof c=="string"){c=b[c]
}}var a=argsToArray(arguments).slice(b!=null?2:1);
setTimeout(function(){try{c.apply(b,a)
}catch(d){}},0)
}function createDelayedMethod(b,c,a){var d=function(){this[b]=createDelayedMethod.delayBind(this,c,a);
this[b].apply(this,arguments)
};
d.cancel=function(){};
return d
}createDelayedMethod.delayBind=function(c,d,a){var b=function(){clearTimeout(b.m_timeout);
b.m_args=arguments;
b.m_timeout=setTimeout(b.run,a||0)
};
b.run=function(){b.cancel();
d.apply(c,b.m_args)
};
b.cancel=function(){clearTimeout(b.m_timeout)
};
return b
};
function createHandler(b){var a="m_on"+b;
var c="addOn"+b;
var e="removeOn"+b;
var d="on"+b;
if(!this[a]){this[a]=[]
}this[c]=function(f){this[a].push(f);
return f
};
this[e]=function(g){if(!g){this[a]=[];
return
}for(var f=this[a].length;
f>=0;
f--){if(this[a][f]==g){this[a].splice(f,1);
break
}}};
this[d]=function(){var f=argsToArray(arguments);
f.splice(0,0,this[a].slice());
doFunctions.apply(null,f)
}
}function createSetter(b,a){return function(d){if(this["m_"+b]==d){return
}var c=this["m_"+b];
this["m_"+b]=d;
if(a){gPubSub.publish(this,a,d,c)
}}
}if(typeof JSON=="undefined"){JSON={}
}if(!JSON.parse){JSON.parse=function(text){if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return eval("("+text+")")
}}
}function getObjectAsString(c){var d="";
if(typeof(c)=="string"){d='"'+c.replace(/(["\\])/g,"\\$1").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")+'"'
}else{if(c instanceof Array){var a=[];
for(var b=0;
b<c.length;
b++){a.push(getObjectAsString(c[b]))
}d="["+a.join(", ")+"]"
}else{if(c==null){d="null"
}else{if(typeof(c)=="object"){var a=[];
for(var e in c){a.push(getObjectAsString(e)+": "+getObjectAsString(c[e]))
}d="{"+a.join(", ")+"}"
}else{d=String(c)
}}}}return d
}if(!JSON.stringify){JSON.stringify=getObjectAsString
}function isSpecialKey(a){return(!a||(a>=36&&a<=40)||a==45||a==46)
}function isArrowKey(a){return(a>=37&&a<=40)
}var modifier={ALT:1,CTRL:2,SHIFT:4};
function getFunctionKeysFromKeyEvent(b){var a=0;
if(b.altKey){a|=modifier.ALT
}if(b.ctrlKey||b.metaKey){a|=modifier.CTRL
}if(b.shiftKey){a|=modifier.SHIFT
}return a
}function rgbToHex(a){var c=/rgb\(([\d]+), ([\d]+), ([\d]+)\)/;
var b=a.match(c);
return"#"+toHex(b[1],2)+toHex(b[2],2)+toHex(b[3],2)
}function toHex(a,b){var d="0123456789ABCDEF";
var c=d.charAt(a&15);
while(a>15){a=a>>4;
c=d.charAt(a&15)+c
}while(c.length<b){c="0"+c
}return c
}function decToHex(a){if(typeof a=="string"){a=parseInt(a)
}return a.toString(16)
}function isInRect(d,c,a,f,b,e){if((d<a)||(d>=a+b)){return false
}if((c<f)||(c>=f+e)){return false
}return true
}function computeFileSize(b){var a=["K","M","G","T","P"];
var c=-1;
while(b/1024>1){b/=1024;
c++
}b=Math.floor(b*10)/10;
return b+" "+(c>-1?a[c]:"")+"B"
}(function(){if(window.google&&google.gears){return
}var a=null;
if(typeof navigator.mimeTypes!="undefined"&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");
a.style.display="none";
a.width=a.height=0;
a.type="application/x-googlegears";
document.documentElement.appendChild(a)
}if(!a){return
}if(!window.google){google={}
}if(!google.gears){google.gears={factory:a}
}})();
util.storage=(function(){var d="meebo.com";
var h={version:"1",create:"CREATE TABLE IF NOT EXISTS localdata 			(k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)",get:"SELECT v FROM localdata WHERE k = ?",set:"INSERT INTO localdata(k, v) VALUES (?, ?)",remove:"DELETE FROM localdata WHERE k = ?"};
if(window.globalStorage||window.localStorage){try{var b=window.localStorage||window.globalStorage[window.location.hostname]
}catch(f){}return{load:function(l,o){try{var k=b.getItem(l);
var m=window.localStorage?k:(k?k.value:null);
if(o){o(m)
}else{return m
}}catch(n){}},save:function(k,l){try{b.setItem(k,l);
return true
}catch(m){}},erase:function(k,l){try{b.removeItem(k);
return true
}catch(m){}}}
}else{if(window.openDatabase){var a=null;
var g=function(e){if(!a){a=openDatabase(d,h.version,d,200*1024);
if(!a){return false
}a.transaction(function(k){k.executeSql(h.create,[],function(){})
},function(){})
}a.transaction(e);
return true
};
return{isAsynchronous:true,load:function(e,k){if(!k){return null
}var l=g(function(m){m.executeSql(h.get,[e],function(n,o){k(o.rows.length>0?o.rows.item(0)["v"]:null)
})
});
if(!l){k(null)
}},save:function(e,k){return g(function(l){l.executeSql(h.remove,[e],function(){l.executeSql(h.set,[e,k],function(m,n){})
})
})
},erase:function(e){return g(function(k){k.executeSql(h.remove,[e])
})
}}
}else{if(window.google&&google.gears){var a=null;
var g=function(l,e){if(!a){var k=google.gears.factory.hasPermission;
if(!k&&e){k=google.gears.factory.getPermission("Meebo","http://s.meebo.com/skin/beta/img/network/meebome_40_online.png",e)
}if(k){a=google.gears.factory.create("beta.database");
a.open(d);
a.execute(h.create).close()
}else{return false
}}a.execute("BEGIN");
l(a);
a.execute("COMMIT").close();
return true
};
return{load:function(e,l){var k=null;
g(function(m){var n=m.execute(h.get,[e]);
k=n.isValidRow()?n.field(0):null;
n.close()
});
if(l){l(k)
}else{return k
}},save:function(k,m,e){var l=g(function(n){n.execute(h.remove,[k]);
n.execute(h.set,[k,m])
},e);
return l
},erase:function(e){var k=g(function(l){l.execute(h.remove,[e])
});
return k
}}
}else{if(document.documentElement.addBehavior){var c=function(e){var l=document.createElement("div");
document.body.appendChild(l);
l.addBehavior("#default#userData");
l.load(d);
var k=e(l);
l.save(d);
document.body.removeChild(l);
return k
};
return{load:function(e,l){var k=c(function(m){return m.getAttribute(e)
});
if(l){l(k)
}else{return k
}},save:function(e,k){c(function(l){l.setAttribute(e,k)
});
return true
},erase:function(e){c(function(k){k.removeAttribute(e)
});
return true
}}
}else{return{load:function(e,k){return k?k(null):null
},save:function(e,k){return false
},erase:function(e){return false
}}
}}}}})();
function insertChar(e,b,d){if(!e){e=""
}if(d<=0){return b+e
}if(d>=e.length){return e+b
}var c=e.slice(0,d);
var a=e.slice(d);
return c+b+a
}function deleteChar(b,a){if(a<0){return b
}return b.slice(0,a-1)+b.slice(a)
}function parseGET(e){var a={};
var b=e.split("&");
for(var c=0;
c<b.length;
c++){var d=b[c].split("=");
a[d[0]]=decodeURIComponent(d[1])
}return a
}function stripWhitespace(a){return(a||"").replace(/(^\s+|\s+$)/g,"")
}function capitalize(a){if(!a||!a.length||!a.charAt){return a
}var b=a.charAt(0);
b=b.toUpperCase();
return b+a.substring(1)
}function isEmail(a){return a&&a.match(/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i)
}function unescapeHTML(a){if(!a||!a.length){return a
}a=a.replace(/&quot;/g,'"');
a=a.replace(/&lt;/g,"<");
a=a.replace(/&gt;/g,">");
a=a.replace(/&apos;/g,"'");
a=a.replace(/&#39;/g,"'");
a=a.replace(/&amp;/g,"&");
return a
}function escapeHTML(b,a){if(!b||!b.length){return b
}b=b.replace(/&/g,"&amp;");
b=b.replace(/"/g,"&quot;");
b=b.replace(/</g,"&lt;");
b=b.replace(/>/g,"&gt;");
b=b.replace(/(\r\n|\r|\n)/g,"<br>");
if(!a){}return b
}function removeHTML(b){if(!b){return b
}var a=unescapeHTML(b.replace(/<[^<>]+>/g,""));
return a
}function normalizeString(c){if(!c){return c
}var b=c.toLowerCase();
var a=b.replace(/\s/g,"");
return a
}function compressSpaces(a){return stripWhitespace(a).replace(/\s\s*/g," ")
}function isStringNumber(b){if(typeof b=="string"){return true
}var a=/^[0-9]+$/;
return(b.match(a)!=null)
}function linkify(a){return replaceLinks(a,findLinks(a))
}function findLinks(e){var d=[];
var a=function(h,g){var m={index:h.index+h[1].length,lastIndex:h.index+h[0].length,href:g+h[2]};
for(var k=d.length-1,l;
l=d[k];
--k){if(m.index>l.index){d.splice(k+1,0,m);
return
}}d.unshift(m)
};
var b;
var f=new RegExp('(^|[^\'"])(\\bhttps?://(?:[^\\s")<>(,;.:?\\!]|(?:[:");,.?!][^:\\s";)<>(,.?\\!])|(?:\\([^\\s";<>,.?\\!]*\\)))*)',"gi");
var c=new RegExp('(^|\\s+)((?:www(?:[-.]\\w+)*(?:\\.\\w+)+(?:\\.(?:[a-zA-Z]{2}|biz|com|info|name|net|org|pro|aero|asia|cat|coop|edu|gov|int|jobs|mil|mobi|museum|tel|travel)\\b)|(?!www)\\w+(?:[-.]\\w+)*(?:\\.(?:[a-zA-Z]{2,}\\.[a-zA-Z]{2}|biz|com|info|name|net|org|pro|aero|asia|cat|coop|edu|gov|int|jobs|mil|mobi|museum|tel|travel)\\b))(?:[^\\s")<>(,;.:?\\!]|(?:[:");,.?!][^:\\s";)<>(,.?\\!])|(?:\\([^\\s";<>,.?\\!]*\\)))*)',"gi");
while(b=f.exec(e)){a(b,"")
}while(b=c.exec(e)){a(b,"http://")
}return d
}function replaceLinks(g,c){var a=g.length;
var f="";
var b=0;
for(var d=0,e;
(e=c[d])&&e.index<a;
d++){f+=g.substring(b,e.index)+'<a title="'+e.href+'" href="'+e.href+'" target="_blank">'+g.substring(e.index,e.lastIndex)+"</a>";
b=e.lastIndex
}f+=g.substring(b,a);
return f
}function isInsideTag(b,a){var f=b.lastIndexOf("<",a);
var d=b.lastIndexOf(">",a);
var c=b.indexOf("<",a);
var e=b.indexOf(">",a);
return !(d>=f&&c<=e)
}function isInsideEntity(b,a){var d=b.lastIndexOf("&",a-1);
var c=b.lastIndexOf(";",a-1);
return a&&c<d
}function decodeEntities(b){var a=decodeEntities.decoder;
a.innerHTML=b.replace(/</g,"&lt;").replace(/>/g,"&gt;");
return a.value
}decodeEntities.decoder=document.createElement("textarea");
function appendWbrUrl(d,e){var c;
var g=Array();
g[0]=/\b(https?:\/\/[^\s+\"\<\>]+)\b/ig;
g[1]=/\b(www\.[^\s+\"\<\>]+)\b/ig;
for(var b=0;
b<g.length;
b++){var f=0;
var a="";
while(c=g[b].exec(d)){a+=d.substr(f,c.index-f);
if(!isInsideTag(d,c.index)){a+=insertWbrText(c[1],e)
}else{a+=c[1]
}f=c.index+c[1].length
}a+=d.substr(f,d.length-f);
d=a
}return d
}function insertWbrText(e,d){var a=0;
var c="";
for(var b=0;
b<e.length;
b++){if(++a>=d&&!isInsideEntity(e,b)){a=0;
c+="<wbr>"
}c+=e.charAt(b)
}return c
}function pad(c,b){if(!c){c=""
}for(var a=0;
a<b;
a++){if(c.length==b){return c
}c="0"+c
}return c
}function isdigit(a){return((a>="0")&&(a<="9"))
}function insertTargets(a,b){if(!a||!a.indexOf){return a
}a=a.replace(/(<\s*a\s+[^>]*href\s*=\s*[\"\']?)([^\"\' >:]{5,6}[^:][^\"\' >:]+)/gi,"$1http://$2");
if(!b){b="_blank"
}a=a.replace(/<a /gi,'<a target="'+b+'" ');
return a
}function de(a){var b="";
for(i=0;
i<a.length;
i++){b+=String.fromCharCode(2^a.charCodeAt(i))
}return b
}function reverseString(c){var b="";
for(var a=c.length-1;
a>=0;
a--){b+=c.charAt(a)
}return b
}function makeTextSplittable(a){return a.replace(/(@|\/|\\)/g,"$1<wbr>")
}function escapeRegexp(b){if(!arguments.callee.sRE){var a=["/",".","*","+","?","|","^","$","(",")","[","]","{","}","\\"];
arguments.callee.sRE=new RegExp("(\\"+a.join("|\\")+")","g")
}return b.replace(arguments.callee.sRE,"\\$1")
}function ellipsize(b,a){if(b.length<=a){return b
}return(b.substr(0,a-1)+"...")
}function getTimeString(e,d){var f=Math.floor(e/(60*60*24));
e=e-(f*(60*60*24));
var a=Math.floor(e/(60*60));
e=e-(a*(60*60));
var b=Math.floor(e/60);
e=e-(b*60);
if(d){if(f>0){a=b=e=0
}else{if(a>0){b=e=0
}else{if(b>0){e=0
}}}}var c="";
if(f>0){c+=sprintf(((f==1)?gLang.timeDay:gLang.timeDays),f)
}if(a>0){if(c){c+=", "
}c+=sprintf(((a==1)?gLang.timeHour:gLang.timeHours),a)
}if(b>0){if(c){c+=", "
}c+=sprintf(((b==1)?gLang.timeMinute:gLang.timeMinutes),b)
}if(e>0){if(c){c+=", "
}c+=sprintf(((e==1)?gLang.timeSecond:gLang.timeSeconds),e)
}return c
}function getTimestampString(c){var d=Math.floor((new Date().getTime()-c.getTime())/(1000*60));
var a=Math.floor(d/60);
var h=Math.floor(a/24);
var g;
if(d<=0){g="less than a minute ago"
}else{if(d<60){g=(d==1)?d+" minute ago":d+" minutes ago"
}else{if(a<24){g=(a==1)?a+" hour ago":a+" hours ago"
}else{if(h<30){g=(h==1)?h+" day ago":h+" days ago"
}else{var b=c.getDate();
var f=c.getMonth();
var e=c.getFullYear();
g="on "+(f+1)+"/"+b+"/"+e
}}}}return g
}function getLocalizedDate(b,a){if(typeof a!="number"||typeof b!="number"){return null
}return new Date(b*1000-a)
}function getDayOfTheWeekString(a){return[gLang.sunday,gLang.monday,gLang.tuesday,gLang.wednesday,gLang.thursday,gLang.friday,gLang.saturday][a]
}function getMonthString(a){return[gLang.january,gLang.february,gLang.march,gLang.april,gLang.may,gLang.june,gLang.july,gLang.august,gLang.september,gLang.october,gLang.november,gLang.december][a]
}var biRadixBase=2;
var biRadixBits=16;
var bitsPerDigit=biRadixBits;
var biRadix=1<<16;
var biHalfRadix=biRadix>>>1;
var biRadixSquared=biRadix*biRadix;
var maxDigitVal=biRadix-1;
var maxInteger=9999999999999998;
var maxDigits;
var ZERO_ARRAY;
var bigZero,bigOne;
function setMaxDigits(b){maxDigits=b;
ZERO_ARRAY=new Array(maxDigits);
for(var a=0;
a<ZERO_ARRAY.length;
a++){ZERO_ARRAY[a]=0
}bigZero=new BigInt();
bigOne=new BigInt();
bigOne.digits[0]=1
}setMaxDigits(20);
var dpl10=15;
var lr10=biFromNumber(1000000000000000);
function BigInt(a){if(typeof a=="boolean"&&a==true){this.digits=null
}else{this.digits=ZERO_ARRAY.slice(0)
}this.isNeg=false
}function biFromDecimal(d){var c=d.charAt(0)=="-";
var a=c?1:0;
var e;
while(a<d.length&&d.charAt(a)=="0"){++a
}if(a==d.length){e=new BigInt()
}else{var b=d.length-a;
var f=b%dpl10;
if(f==0){f=dpl10
}e=biFromNumber(Number(d.substr(a,f)));
a+=f;
while(a<d.length){e=biAdd(biMultiply(e,lr10),biFromNumber(Number(d.substr(a,dpl10))));
a+=dpl10
}e.isNeg=c
}return e
}function biCopy(a){var b=new BigInt(true);
b.digits=a.digits.slice(0);
b.isNeg=a.isNeg;
return b
}function biFromNumber(b){var c=new BigInt();
c.isNeg=b<0;
b=Math.abs(b);
var a=0;
while(b>0){c.digits[a++]=b&maxDigitVal;
b=Math.floor(b/biRadix)
}return c
}function reverseStr(b){var c="";
for(var a=b.length-1;
a>-1;
--a){c+=b.charAt(a)
}return c
}var hexatrigesimalToChar=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
function biToString(c,e){var a=new BigInt();
a.digits[0]=e;
var d=biDivideModulo(c,a);
var f=hexatrigesimalToChar[d[1].digits[0]];
while(biCompare(d[0],bigZero)==1){d=biDivideModulo(d[0],a);
digit=d[1].digits[0];
f+=hexatrigesimalToChar[d[1].digits[0]]
}return(c.isNeg?"-":"")+reverseStr(f)
}function biToDecimal(c){var a=new BigInt();
a.digits[0]=10;
var d=biDivideModulo(c,a);
var e=String(d[1].digits[0]);
while(biCompare(d[0],bigZero)==1){d=biDivideModulo(d[0],a);
e+=String(d[1].digits[0])
}return(c.isNeg?"-":"")+reverseStr(e)
}var hexToChar=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
function digitToHex(c){var a=15;
var b="";
for(i=0;
i<4;
++i){b+=hexToChar[c&a];
c>>>=4
}return reverseStr(b)
}function biToHex(a){var c="";
var d=biHighIndex(a);
for(var b=biHighIndex(a);
b>-1;
--b){c+=digitToHex(a.digits[b])
}return c
}function charToHex(k){var b=48;
var a=b+9;
var d=97;
var h=d+25;
var g=65;
var e=65+25;
var f;
if(k>=b&&k<=a){f=k-b
}else{if(k>=g&&k<=e){f=10+k-g
}else{if(k>=d&&k<=h){f=10+k-d
}else{f=0
}}}return f
}function hexToDigit(c){var d=0;
var a=Math.min(c.length,4);
for(var b=0;
b<a;
++b){d<<=4;
d|=charToHex(c.charCodeAt(b))
}return d
}function biFromHex(d){var e=new BigInt();
var a=d.length;
for(var c=a,b=0;
c>0;
c-=4,++b){e.digits[b]=hexToDigit(d.substr(Math.max(c-4,0),Math.min(c,4)))
}return e
}function biFromString(m,k){var a=m.charAt(0)=="-";
var e=a?1:0;
var h=new BigInt();
var b=new BigInt();
b.digits[0]=1;
for(var d=m.length-1;
d>=e;
d--){var f=m.charCodeAt(d);
var g=charToHex(f);
var l=biMultiplyDigit(b,g);
h=biAdd(h,l);
b=biMultiplyDigit(b,k)
}h.isNeg=a;
return h
}function biDump(a){return(a.isNeg?"-":"")+a.digits.join(" ")
}function biAdd(a,g){var d;
if(a.isNeg!=g.isNeg){g.isNeg=!g.isNeg;
d=biSubtract(a,g);
g.isNeg=!g.isNeg
}else{d=new BigInt();
var f=0;
var e;
for(var b=0;
b<a.digits.length;
++b){e=a.digits[b]+g.digits[b]+f;
d.digits[b]=e%biRadix;
f=Number(e>=biRadix)
}d.isNeg=a.isNeg
}return d
}function biSubtract(a,g){var d;
if(a.isNeg!=g.isNeg){g.isNeg=!g.isNeg;
d=biAdd(a,g);
g.isNeg=!g.isNeg
}else{d=new BigInt();
var f,e;
e=0;
for(var b=0;
b<a.digits.length;
++b){f=a.digits[b]-g.digits[b]+e;
d.digits[b]=f%biRadix;
if(d.digits[b]<0){d.digits[b]+=biRadix
}e=0-Number(f<0)
}if(e==-1){e=0;
for(var b=0;
b<a.digits.length;
++b){f=0-d.digits[b]+e;
d.digits[b]=f%biRadix;
if(d.digits[b]<0){d.digits[b]+=biRadix
}e=0-Number(f<0)
}d.isNeg=!a.isNeg
}else{d.isNeg=a.isNeg
}}return d
}function biHighIndex(a){var b=a.digits.length-1;
while(b>0&&a.digits[b]==0){--b
}return b
}function biNumBits(b){var f=biHighIndex(b);
var e=b.digits[f];
var a=(f+1)*bitsPerDigit;
var c;
for(c=a;
c>a-bitsPerDigit;
--c){if((e&32768)!=0){break
}e<<=1
}return c
}function biMultiply(l,h){var g=new BigInt();
var f;
var b=biHighIndex(l);
var o=biHighIndex(h);
var m,a,d;
for(var e=0;
e<=o;
++e){f=0;
d=e;
for(j=0;
j<=b;
++j,++d){a=g.digits[d]+l.digits[j]*h.digits[e]+f;
g.digits[d]=a&maxDigitVal;
f=a>>>biRadixBits
}g.digits[e+b+1]=f
}g.isNeg=l.isNeg!=h.isNeg;
return g
}function biMultiplyDigit(a,g){var f,e,d;
result=new BigInt();
f=biHighIndex(a);
e=0;
for(var b=0;
b<=f;
++b){d=result.digits[b]+a.digits[b]*g+e;
result.digits[b]=d&maxDigitVal;
e=d>>>biRadixBits
}result.digits[1+f]=e;
return result
}function arrayCopy(f,e,c,h,g){var a=Math.min(e+g,f.length);
for(var d=e,b=h;
d<a;
++d,++b){c[b]=f[d]
}}var highBitMasks=new Array(0,32768,49152,57344,61440,63488,64512,65024,65280,65408,65472,65504,65520,65528,65532,65534,65535);
function biShiftLeft(a,h){var d=Math.floor(h/bitsPerDigit);
var g=new BigInt();
arrayCopy(a.digits,0,g.digits,d,g.digits.length-d);
var f=h%bitsPerDigit;
var c=bitsPerDigit-f;
for(var b=g.digits.length-1,e=b-1;
b>0;
--b,--e){g.digits[b]=((g.digits[b]<<f)&maxDigitVal)|((g.digits[e]&highBitMasks[f])>>>(c))
}g.digits[0]=((g.digits[b]<<f)&maxDigitVal);
g.isNeg=a.isNeg;
return g
}var lowBitMasks=new Array(0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535);
function biShiftRight(a,h){var c=Math.floor(h/bitsPerDigit);
var f=new BigInt();
arrayCopy(a.digits,c,f.digits,0,a.digits.length-c);
var e=h%bitsPerDigit;
var g=bitsPerDigit-e;
for(var b=0,d=b+1;
b<f.digits.length-1;
++b,++d){f.digits[b]=(f.digits[b]>>>e)|((f.digits[d]&lowBitMasks[e])<<g)
}f.digits[f.digits.length-1]>>>=e;
f.isNeg=a.isNeg;
return f
}function biMultiplyByRadixPower(a,c){var b=new BigInt();
arrayCopy(a.digits,0,b.digits,c,b.digits.length-c);
return b
}function biDivideByRadixPower(a,c){var b=new BigInt();
arrayCopy(a.digits,c,b.digits,0,b.digits.length-c);
return b
}function biModuloByRadixPower(a,c){var b=new BigInt();
arrayCopy(a.digits,0,b.digits,0,c);
return b
}function biCompare(a,c){if(a.isNeg!=c.isNeg){return 1-2*Number(a.isNeg)
}for(var b=a.digits.length-1;
b>=0;
--b){if(a.digits[b]!=c.digits[b]){if(a.isNeg){return 1-2*Number(a.digits[b]>c.digits[b])
}else{return 1-2*Number(a.digits[b]<c.digits[b])
}}}return 0
}function biDivideModulo(h,g){var c=biNumBits(h);
var f=biNumBits(g);
var d=g.isNeg;
var o,l;
if(c<f){if(h.isNeg){o=biCopy(bigOne);
o.isNeg=!g.isNeg;
h.isNeg=false;
g.isNeg=false;
l=biSubtract(g,h);
h.isNeg=true;
g.isNeg=d
}else{o=new BigInt();
l=biCopy(h)
}return new Array(o,l)
}o=new BigInt();
l=h;
var k=Math.ceil(f/bitsPerDigit)-1;
var a=0;
while(g.digits[k]<biHalfRadix){g=biShiftLeft(g,1);
++a;
++f;
k=Math.ceil(f/bitsPerDigit)-1
}l=biShiftLeft(l,a);
c+=a;
var u=Math.ceil(c/bitsPerDigit)-1;
var B=biMultiplyByRadixPower(g,u-k);
while(biCompare(l,B)!=-1){++o.digits[u-k];
l=biSubtract(l,B)
}for(var A=u;
A>k;
--A){var m=(A>=l.digits.length)?0:l.digits[A];
var z=(A-1>=l.digits.length)?0:l.digits[A-1];
var w=(A-2>=l.digits.length)?0:l.digits[A-2];
var v=(k>=g.digits.length)?0:g.digits[k];
var e=(k-1>=g.digits.length)?0:g.digits[k-1];
if(m==v){o.digits[A-k-1]=maxDigitVal
}else{o.digits[A-k-1]=Math.floor((m*biRadix+z)/v)
}var s=o.digits[A-k-1]*((v*biRadix)+e);
var p=(m*biRadixSquared)+((z*biRadix)+w);
while(s>p){--o.digits[A-k-1];
s=o.digits[A-k-1]*((v*biRadix)|e);
p=(m*biRadix*biRadix)+((z*biRadix)+w)
}B=biMultiplyByRadixPower(g,A-k-1);
l=biSubtract(l,biMultiplyDigit(B,o.digits[A-k-1]));
if(l.isNeg){l=biAdd(l,B);
--o.digits[A-k-1]
}}l=biShiftRight(l,a);
o.isNeg=h.isNeg!=d;
if(h.isNeg){if(d){o=biAdd(o,bigOne)
}else{o=biSubtract(o,bigOne)
}g=biShiftRight(g,a);
l=biSubtract(g,l)
}if(l.digits[0]==0&&biHighIndex(l)==0){l.isNeg=false
}return new Array(o,l)
}function biDivide(a,b){return biDivideModulo(a,b)[0]
}function biModulo(a,b){return biDivideModulo(a,b)[1]
}function biMultiplyMod(b,c,a){return biModulo(biMultiply(b,c),a)
}function biPow(b,e){var d=bigOne;
var c=b;
while(true){if((e&1)!=0){d=biMultiply(d,c)
}e>>=1;
if(e==0){break
}c=biMultiply(c,c)
}return d
}function biPowMod(c,g,b){var f=bigOne;
var d=c;
var e=g;
while(true){if((e.digits[0]&1)!=0){f=biMultiplyMod(f,d,b)
}e=biShiftRight(e,1);
if(e.digits[0]==0&&biHighIndex(e)==0){break
}d=biMultiplyMod(d,d,b)
}return f
}function BarrettMu(a){this.modulus=biCopy(a);
this.k=biHighIndex(this.modulus)+1;
var b=new BigInt();
b.digits[2*this.k]=1;
this.mu=biDivide(b,this.modulus);
this.bkplus1=new BigInt();
this.bkplus1.digits[this.k+1]=1;
this.modulo=BarrettMu_modulo;
this.multiplyMod=BarrettMu_multiplyMod;
this.powMod=BarrettMu_powMod
}function BarrettMu_modulo(h){var g=biDivideByRadixPower(h,this.k-1);
var e=biMultiply(g,this.mu);
var d=biDivideByRadixPower(e,this.k+1);
var c=biModuloByRadixPower(h,this.k+1);
var k=biMultiply(d,this.modulus);
var b=biModuloByRadixPower(k,this.k+1);
var a=biSubtract(c,b);
if(a.isNeg){a=biAdd(a,this.bkplus1)
}var f=biCompare(a,this.modulus)>=0;
while(f){a=biSubtract(a,this.modulus);
f=biCompare(a,this.modulus)>=0
}return a
}function BarrettMu_multiplyMod(a,c){var b=biMultiply(a,c);
return this.modulo(b)
}function BarrettMu_powMod(b,f){var e=new BigInt();
e.digits[0]=1;
var c=b;
var d=f;
while(true){if((d.digits[0]&1)!=0){e=this.multiplyMod(e,c)
}d=biShiftRight(d,1);
if(d.digits[0]==0&&biHighIndex(d)==0){break
}c=this.multiplyMod(c,c)
}return e
}function RSAKeyPair(b,c,a){this.e=biFromHex(b);
this.d=biFromHex(c);
this.m=biFromHex(a);
this.digitSize=2*biHighIndex(this.m)+2;
this.chunkSize=this.digitSize-11;
this.radix=16;
this.barrett=new BarrettMu(this.m)
}function twoDigit(a){return(a<10?"0":"")+String(a)
}function encryptedString(p,w){if(p.chunkSize>p.digitSize-11){return"Error"
}var o=new Array();
var c=w.length;
var g=0;
while(g<c){o[g]=w.charCodeAt(g);
g++
}var h=o.length;
var m="";
var f,e,d;
for(g=0;
g<h;
g+=p.chunkSize){d=new BigInt();
f=0;
var n;
var v=(g+p.chunkSize)>h?h%p.chunkSize:p.chunkSize;
var l=new Array();
for(n=0;
n<v;
n++){l[n]=o[g+v-1-n]
}l[v]=0;
var u=Math.max(8,p.digitSize-3-v);
for(n=0;
n<u;
n++){l[v+1+n]=Math.floor(Math.random()*254)+1
}l[p.digitSize-2]=2;
l[p.digitSize-1]=0;
for(e=0;
e<p.digitSize;
++f){d.digits[f]=l[e++];
d.digits[f]+=l[e++]<<8
}var t=p.barrett.powMod(d,p.e);
var q=p.radix==16?biToHex(t):biToString(t,p.radix);
m+=q+" "
}return m.substring(0,m.length-1)
}function rsaEncrypt(d){if(!d){return""
}var a=arguments.callee.cache;
if(!a){a=arguments.callee.cache={}
}if(d in a){return a[d]
}var c=new Date().getTime();
setMaxDigits(160);
var e=new RSAKeyPair("25","","00846e46d25bc8743ac45c12c5ae9acbdb1ae2d632d9fdda3bc50ad0c02afbb3060ac5350af7d774014e4c01feef522edbc8f68d3b066025066b78e3de201fa2ec5e0f2006599c9f993ca18316ee940be6f7185b2fbd797fb692740da782e0c41b33e8b2dcb392f93b650526a4470ea9b6ae510dc6c84a69f0b1f27b3dbb43f615");
var b=encryptedString(e,d);
a[d]=b;
return b
}util.sha={};
util.sha.sha256=(function(){var n=8;
function l(q,u){var t=(q&65535)+(u&65535);
var s=(q>>16)+(u>>16)+(t>>16);
return(s<<16)|(t&65535)
}function e(s,q){return(s>>>q)|(s<<(32-q))
}function g(s,q){return(s>>>q)
}function a(q,t,s){return((q&t)^((~q)&s))
}function f(q,t,s){return((q&t)^(q&s)^(t&s))
}function b(q){return(e(q,2)^e(q,13)^e(q,22))
}function h(q){return(e(q,6)^e(q,11)^e(q,25))
}function m(q){return(e(q,7)^e(q,18)^g(q,3))
}function p(q){return(e(q,17)^e(q,19)^g(q,10))
}function d(s,t){var G=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298);
var u=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225);
var q=new Array(64);
var H,F,E,D,B,z,y,x,w,v;
var C,A;
s[t>>5]|=128<<(24-t%32);
s[((t+64>>9)<<4)+15]=t;
for(var w=0;
w<s.length;
w+=16){H=u[0];
F=u[1];
E=u[2];
D=u[3];
B=u[4];
z=u[5];
y=u[6];
x=u[7];
for(var v=0;
v<64;
v++){if(v<16){q[v]=s[v+w]
}else{q[v]=l(l(l(p(q[v-2]),q[v-7]),m(q[v-15])),q[v-16])
}C=l(l(l(l(x,h(B)),a(B,z,y)),G[v]),q[v]);
A=l(b(H),f(H,F,E));
x=y;
y=z;
z=B;
B=l(D,C);
D=E;
E=F;
F=H;
H=l(C,A)
}u[0]=l(H,u[0]);
u[1]=l(F,u[1]);
u[2]=l(E,u[2]);
u[3]=l(D,u[3]);
u[4]=l(B,u[4]);
u[5]=l(z,u[5]);
u[6]=l(y,u[6]);
u[7]=l(x,u[7])
}return u
}function k(u){var t=Array();
var q=(1<<n)-1;
for(var s=0;
s<u.length*n;
s+=n){t[s>>5]|=(u.charCodeAt(s/n)&q)<<(24-s%32)
}return t
}function o(u){var s=0;
var t=s?"0123456789ABCDEF":"0123456789abcdef";
var v="";
for(var q=0;
q<u.length*4;
q++){v+=t.charAt((u[q>>2]>>((3-q%4)*8+4))&15)+t.charAt((u[q>>2]>>((3-q%4)*8))&15)
}return v
}function c(q){return o(d(k(q),q.length*n))
}return function(q){return c(q)
}
})();
function getFlashVersion(){var b=[0,0,0];
try{if(navigator.plugins&&navigator.mimeTypes.length){var a=navigator.plugins["Shockwave Flash"];
if(a&&a.description){b=a.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".")
}}else{try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")
}catch(d){try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
b=[6,0,21];
c.AllowScriptAccess="always"
}catch(d){b[0]=4;
return b
}try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")
}catch(d){}}if(c!=null){b=c.GetVariable("$version").split(" ")[1].split(",")
}}}catch(d){}return{major:b[0],minor:b[1],rev:b[2]}
}function embedFlash(g){g.width=g.width||1;
g.height=g.height||1;
g.wmode=g.wmode||"transparent";
g.id=g.id||"meeboFlashMovie"+(embedFlash.movieId++);
g.flashVars=g.flashVars||{};
if(g.onReady){if(!g.win.__meeboFlashCallbackManager){g.win.__meeboFlashCallbackManager=new lib.CallbackManager()
}var d=g.win.__meeboFlashCallbackManager.scheduleCallback(g.onReady);
g.flashVars.callback=d
}var c="";
if(g.top||g.left){c=' style="position:absolute;top:'+g.top+";left:"+g.left+'"'
}var e=g.win.document;
var b=e.createElement("div");
var f=getObjectAsURIParams(g.flashVars);
var a='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="'+g.id+'" width="'+g.width+'" height="'+g.height+'" align="middle"'+c+'><param name="allowScriptAccess" value="always" /><param name="movie" value="'+g.swfUrl+'" /><param name="quality" value="high" /><param name="wmode" value="'+g.wmode+'" /><param name="FlashVars" value="'+f+'" /><embed wmode="'+g.wmode+'" src="'+g.swfUrl+'" FlashVars="'+f+'" quality="high" width="'+g.width+'" height="'+g.height+'" swLiveConnect=true id="'+g.id+'" name="'+g.id+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" /></object>';
domInsertBefore(g.parent||e.body,b,g.insertBefore);
b.innerHTML=a;
if(ui.isIE){return g.win[g.id]
}else{return e[g.id]
}}embedFlash.movieId=0;
var ComScore={m_tracked:false,track:function(a){if(this.m_tracked||!gConfig.getReleaseType().length){return
}this.m_tracked=true;
var b={c1:"7",c2:"5964888",c3:a,c4:"",c5:"",c6:"",c7:escape(document.location.href),c8:escape(document.title),c9:escape(document.referrer),c10:escape(screen.width+"x"+screen.height)};
new ui.TrackingPixel(b,"http://beacon.scorecardresearch.com/scripts/beacon.dll")
},CORE_ID:1,CIM_ID:2};
var gLog=false;
var gEventLog=false;
var gNetworkLog=false;
var gDebug=false;
var gLogTimer={};
var gDebugger;
function eventlog(a){if(!gEventLog||!gDebugger){return false
}gDebugger.addText(a);
gDebugger.m_dlg.showWindow(true);
return true
}function networklog(a){if(!gNetworkLog||!gDebugger){return false
}gDebugger.addText(a);
gDebugger.m_dlg.showWindow(true);
return true
}function startlogtime(b,a){gLogTimer[b]={time:a||new Date().getTime(),timing:true}
}function stoplogtime(a){gLogTimer[a].time=new Date().getTime()-gLogTimer[a].time;
gLogTimer[a].timing=false;
return gLogTimer[a].time
}function islogtiming(a){return gLogTimer[a]&&gLogTimer[a].timing
}function clearlogtime(a){delete gLogTimer[a]
}function log(a){if(!gLog||!gDebugger){return false
}var b=Array.prototype.join.call(arguments," ");
gDebugger.addText(b,null,false,false);
gDebugger.m_dlg.showWindow(true);
return true
}log.timedelta=function(a){function b(d,e){d=String(d);
e=e||2;
while(d.length<e){d="0"+d
}return d
}var c=new Date().getTime()-a;
return b(Math.floor(c/60000))+":"+b(Math.floor((c%60000)/1000))+"."+b(Math.floor(c%1000),3)
};
function logSpeed(){startTime=typeof startTime=="number"?startTime:0;
var a=log.timedelta(startTime)+" "+Array.prototype.join.call(arguments," ");
log(a)
}function initDebugging(b,a,e,c){var d=["meeboApp.debugDlg"];
if(c){d.push("meeboApp.debugEvents")
}gWindowMgr.loadObjects(d,function(){gLog=b;
gEventLog=a;
gNetworkLog=e;
gDebug=c;
if(!gDebugger&&(gLog||gEventLog||gNetworkLog)){try{gWindowMgr.createDebugDlg()
}catch(f){}}})
}net={};
net.getTransportLayer=function(){return this.m_transportLayer
};
net.use=function(a){this.m_transportLayer=a
};
net.post=function(a,b){a.method="POST";
this.request(a,b)
};
net.get=function(a,b){a.method="GET";
this.request(a,b)
};
net.abort=function(a){if(!a||/\/mcmd\/quit/.test(a.url)){return
}a.transport.abort(a)
};
net.request=function(a,b){a.timestamp=new Date().getTime();
a.aborted=false;
a.id=null;
if(!a.transport){a.transport=this.m_transportLayer
}return a.transport.request(a,b)
};
net.abortOnTimeout=function(a,b){if(a.timeout>0){a.timeoutTimer=setTimeout(function(){net.abort(a);
b(null,new net.RequestError("request timed out",1))
},a.timeout)
}};
net.clearTimeout=function(a){clearTimeout(a.timeoutTimer)
};
net.doSslCheck=function(){return this.m_transportLayer.doSslCheck&&this.m_transportLayer.doSslCheck()
};
net.buildGetQuery=function(b){var a=this.buildQuery(b);
if(!a){return b.url
}var c=b.url.split("?");
var d=c[0];
d+="?"+a;
if(c[1]){d+="&"+c[1]
}return d
};
net.buildQuery=function(c){var b=[];
for(var a in c.args){var d=encodeURIComponent(a)+"="+encodeURIComponent(c.args[a]);
if(a=="sessionKey"){b.unshift(d)
}else{b.push(d)
}}return b.join("&")
};
net.REQUEST_ERROR=1;
net.SERVER_ERROR=2;
net.EVAL_ERROR=3;
net.RequestError=function(b,a){return{msg:b,code:a}
};
net.Request=function(){return{aborted:false,err:null,responseType:null,args:{},sync:false,timeout:20000,timeoutTimer:null,timestamp:null,url:null,transport:null}
};
net.XHRTransport=new function(){this.m_id=0;
this.m_xhrs={};
this.XHRResource=new lib.ResourceManager(function(callback){var xhr=null;
if(typeof XMLHttpRequest!="undefined"){try{xhr=new XMLHttpRequest()
}catch(e){}}else{if(typeof Components!="undefined"){xhr=Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
xhr.QueryInterface(Components.interfaces.nsIXMLHttpRequest)
}}if(!xhr&&typeof ActiveXObject!="undefined"){try{xhr=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e){}if(!xhr){try{xhr=new ActiveXObject("Microsoft.XMLHTTP")
}catch(e){}}}if(!xhr){alert("Meebo does not support your browser yet.  Stay tuned!")
}else{callback(xhr)
}});
this.recycleXHR=function(xhr){xhr.onreadystatechange=function(){};
this.XHRResource.recycle(xhr)
};
this.abort=function(request){if(!request){return
}var xhr=this.m_xhrs[request.xhrId];
if(!xhr){return
}delete this.m_xhrs[request.xhrId];
if(!request.aborted){request.xhrId=null;
request.aborted=true;
try{xhr.abort()
}catch(e){}if(!request.err){this.recycleXHR(xhr)
}}net.clearTimeout(request)
};
this.request=function(request,callback,xhr){if(!xhr||(xhr.readyState!=4&&xhr.readyState!=0)){this.XHRResource.getOne(hitch(this,this.request,request,callback));
return
}if(!callback){callback=function(){}
}if(!/^https?:/i.test(request.url)){request.url=window.location.protocol+"//"+document.domain+(window.location.port?":"+window.location.port:"")+request.url
}var id="X"+(this.m_id++);
this.m_xhrs[id]=xhr;
request.xhrId=id;
if(request.method=="POST"){xhr.open(request.method,request.url,!request.sync)
}else{xhr.open("GET",net.buildGetQuery(request),!request.sync)
}xhr.onreadystatechange=hitch(this,onReadyStateChange,this.m_xhrs[id],request,callback);
xhr.setRequestHeader("If-Modified-Since",new Date(0));
if(request.args&&request.method=="POST"){xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
}try{net.abortOnTimeout(request,callback);
xhr.send(request.method=="POST"?net.buildQuery(request):null)
}catch(e){request.err=new net.RequestError("could not send",1);
this.abort(request);
throw request.err
}};
function getResponse(xhr,request){try{xhr.readyState
}catch(e){throw new net.RequestError("could not access readyState",1)
}if(xhr.readyState!=4){return null
}try{var status=xhr.status
}catch(e){throw new net.RequestError("could not access status",1)
}if(status==500){throw new net.RequestError("status was 500",2)
}if(status!=200){throw new net.RequestError("status was "+status,1)
}var contentType=(xhr.getResponseHeader("Content-Type")||"").match(/[-a-z]+\/[-a-z]+/i);
if(!contentType){throw new net.RequestError("could not access content type",1)
}contentType=contentType[0];
try{var response=contentType=="text/xml"?xhr.responseXML:xhr.responseText
}catch(e){throw new net.RequestError("could not examine responseText",1)
}if(request.responseType=="application/json"){try{response=eval("("+response+")")
}catch(e){throw new net.RequestError("error evaling the response",3)
}}else{if(contentType=="text/javascript"||contentType=="application/javascript"||contentType=="application/x-javascript"){eval(response)
}}return response
}function onReadyStateChange(xhr,request,callback){if(request.aborted){return
}try{var response=getResponse(xhr,request);
if(response!=null){net.clearTimeout(request);
callback(response);
this.recycleXHR(xhr)
}}catch(e){if(typeof net!="undefined"){net.clearTimeout(request);
callback(null,e)
}}}this.doSslCheck=function(){if(/\.meebo\.com$/i.test(document.domain)){if(gNetworkMgr.getProtocol()=="https:"){gNetworkMgr.enableLoginWithSsl();
return
}setTimeout(hitch(this,"requestSslIframe"),0)
}};
this.requestSslIframe=function(){enableLoginWithSsl=hitch(this,function(){gNetworkMgr.enableLoginWithSsl();
this.destroySslIframe()
});
var iframe=document.createElement("iframe");
iframe.style.position="absolute";
iframe.style.left="-5000px";
iframe.style.top="-5000px";
document.body.appendChild(iframe);
this.m_sslTestIframe=iframe;
iframe.src="https://"+document.domain+"/httpstest.html?"+String(new Date().getTime());
if(window.attachEvent){window.attachEvent("onunload",hitch(this,"destroySslIframe"))
}};
this.destroySslIframe=function(){if(this.m_sslTestIframe){document.body.removeChild(this.m_sslTestIframe);
this.m_sslTestIframe=null
}}
};
if(!net.getTransportLayer()){net.use(net.XHRTransport)
}net.FormTransport=new function(){this.m_id=0;
this.m_callbacks={};
this.m_init=false;
this.m_doc=document;
this.abort=function(request){if(ui.isWebKit){setTimeout(hitch(this,"cleanup",request),60000)
}else{this.cleanup(request)
}};
this.cleanup=function(request){var data=this.m_callbacks[request.formId];
if(data){removeElement(data.iframe);
removeElement(data.form);
if(data.xdPostRequest){net.abort(data.xdPostRequest)
}}delete this.m_callbacks[request.formId]
};
this.request=function(request,callback){if(!request.url.match("^https?://")){return
}if(!this.m_init){this.m_init=true;
gPubSub.subscribe(gEventMgr,"meebo.EventMgr::mcmdResponse",this,"onMcmdResponse");
this.tryHtmlFile()
}var doc=this.m_doc;
var hasFormElements=false;
var hasFileUpload=false;
for(var name in request.args){if(request.args[name]&&request.args[name].nodeName){doc=gDoc(request.args[name]);
if(request.args[name].type=="file"){hasFileUpload=true
}hasFormElements=true
}}var id=request.formId="F"+this.m_id++;
if(parseInt(ui.isSafari)==525&&!ui.isChrome&&!hasFileUpload&&!hasFormElements&&net.redirect){var url=new util.query.URL(request.url);
var fwdReq=new net.Request();
fwdReq.url=url.protocol+"//"+url.host+"/cim/xdPost_v"+gConfig.getVersion()+".html";
fwdReq.args={url:request.url,args:request.args};
fwdReq.timeout=60*1000;
fwdReq.transport=net.redirect;
var xdCallback=hitch(this,function(response,error){delete this.m_callbacks[id];
net.clearTimeout(request);
callback(response,error)
});
net.request(fwdReq,xdCallback);
this.m_callbacks[id]={callback:xdCallback,request:request,iframe:null,form:null,xdPostRequest:fwdReq};
net.abortOnTimeout(request,xdCallback);
return
}var formDiv=doc.createElement("div");
formDiv.innerHTML='<form action="'+request.url+'" method="'+request.method+'" target="FTFrame'+id+'" '+(hasFileUpload?'enctype="multipart/form-data" ':"")+'id="FTForm'+id+'"><input type="hidden" name="sessionKey"><input type="hidden" name="requestId" value="'+id+'"></form>';
var form=formDiv.firstChild;
form.style.position="absolute";
form.style.left=form.style.top="-999px";
form.style.width=form.style.height="1px";
form.style.overflow="hidden";
for(var name in request.args){var value=request.args[name];
if(name=="sessionKey"){form.firstChild.value=value
}else{if(value.nodeName){form.appendChild(value)
}else{var input=doc.createElement("input");
input.type=hasFileUpload?"hidden":"password";
input.name=name;
input.readonly=true;
input.value=value;
form.appendChild(input)
}}}var iframe=null;
if(ui.isIE){try{iframe=doc.createElement('<iframe name="FTFrame'+id+'">');
iframe.src="javascript:false;"
}catch(e){}}if(!iframe){var iframeDiv=doc.createElement("div");
iframeDiv.innerHTML='<iframe name="FTFrame'+id+'" id="FTFrame'+id+'" src="javascript:void(0);"></iframe>';
iframe=iframeDiv.firstChild
}iframe.style.position="absolute";
iframe.style.left=iframe.style.top="-999px";
doc.body.appendChild(iframe);
doc.body.appendChild(form);
if(request.noRequestId){var onloadCallback=hitch(this,"onIFrameLoad",id);
if(ui.isIE){iframe.onreadystatechange=onloadCallback
}else{iframe.onload=onloadCallback
}}this.m_callbacks[id]={callback:callback,request:request,iframe:iframe,form:form};
net.abortOnTimeout(request,callback);
setTimeout(hitch(this,this.submitForm,form),0)
};
this.submitForm=function(form){form.submit();
for(var i=0,el;
el=form.childNodes[i];
++i){try{el.disabled=true
}catch(e){}}};
this.onIFrameLoad=function(requestId){var iframe=this.m_callbacks[requestId].iframe;
try{var doc=iframe.contentWindow.document;
if(doc.location.href=="javascript:void(0);"||doc.location.href=="javascript:false;"||(ui.isIE&&doc.readyState!="complete")){return
}var response=removeHTML(doc.body.innerHTML);
try{response=eval("("+response+")")
}catch(e){}this.onResponse(requestId,response)
}catch(e){}};
this.tryHtmlFile=function(){try{if(!window.ActiveXObject){return
}var htmlfile=new ActiveXObject("htmlfile");
htmlfile.open();
htmlfile.write("<html></html>");
htmlfile.close();
this.m_doc=htmlfile;
window.attachEvent("onunload",hitch(this,this.removeHtmlFile))
}catch(e){}};
this.removeHtmlFile=function(){this.m_doc=null
};
this.onMcmdResponse=function(gEventMgr,event,requestId,response){this.onResponse(requestId,response)
};
this.onResponse=function(requestId,response){if(!this.m_callbacks[requestId]){return
}var request=this.m_callbacks[requestId].request;
var callback=this.m_callbacks[requestId].callback;
net.clearTimeout(request);
setTimeout(hitch(this,"cleanup",request),1000);
if(callback){callback(response)
}}
};
Class("IGClient",lib.Publisher,function(a){this.m_eventListener=null;
this.m_eventPollDuration=45000;
this.m_networkPollDuration=10000;
this.m_serverTimeoutDuration=120000;
this.m_messageRev=0;
this.m_noResponseLimit=12;
this.m_noResponses=0;
this.m_host="";
this.m_commandPath="cmd";
this.m_modulePath="mcmd";
this.m_ipAddress="";
this.m_isTesting=false;
this.m_testRequest=null;
this.m_testInterval=null;
this.m_isConnected=false;
this.m_sessionKey="";
this.m_clientId=0;
this.m_isAttached=false;
this.m_clientType="none";
this.m_cmds=["mstart","gaimlog","getip","exists","create","addacc","removeacc","setacc","gmeeboinfo","smeeboinfo","sicon","spref","gpref","gwid","mmc","mmd","mmw","cl","dcl","crl","mccreate","mcsearch","mcfetchspillovers","init_ft.py","majoin","mainfo","mafulllist","mauserlist","mauserinfo","maguestjoin","invite","contacts.php","share_email"];
this.m_mcmds=["start","attach","detach","quit","test","events","changeip","dbg","login","relogin","logout","sacctinfo","setstatus","nick","setuserprofile","deleteuserinfo","prefget","add","rbs","importbuddies","move","blks","alias","info","auth","m2m","buddysearch","rename","rgs","send","conv","chat","mcjoin","mcflag","mcwarn","msend","mcaffiliate","malaunch","arv","uiset","uiclear","clearnotifications","clearunreadcounter","fetchconversation","reportabuse","genauthtoken","fetchpoll","setfact","fetchad","trackurl","sharelink","arefriends","publish"];
this.m_noSession=["start","attach","mstart","gaimlog","getip","exists"];
this.m_isGetRequest=["start","attach","uiset","uiclear","clearnotifications","clearunreadcounter","conv","publish","quit","dbg"];
for(var b=0,c;
(c=this.m_cmds[b]);
b++){this.m_cmds[c]=true
}for(var b=0,c;
(c=this.m_mcmds[b]);
b++){this.m_mcmds[c]=true
}for(var b=0,c;
(c=this.m_noSession[b]);
b++){this.m_noSession[c]=true
}for(var b=0,c;
(c=this.m_isGetRequest[b]);
b++){this.m_isGetRequest[c]=true
}this.initialize=function(){a(this,"initialize");
this.m_activeRequests=[]
};
this.getSessionKey=function(){return this.m_sessionKey||""
};
this.getClientId=function(){return this.m_clientId||0
};
this.isConnected=function(){return this.m_isConnected
};
this.isAttached=function(){return this.m_isAttached
};
this.setClientType=function(d){this.m_clientType=d
};
this.getClientType=function(){return this.m_clientType
};
this.setIPAddress=function(d){this.m_ipAddress=d
};
this.setHost=function(d){this.m_host=d
};
this.getHost=function(){return(typeof MeeboExtensionDomain!="undefined"?MeeboExtensionDomain:this.m_host)
};
this.setChannel=function(d){this.m_channel=d
};
this.getChannel=function(){return this.m_channel
};
this.getCmdUrl=function(h,e){var g=this.getHost()||window.location.host,d="";
if(g){var f=this.getChannel();
if(f){g=f+"."+g
}d=(e?"https:":window.location.protocol)+"//"+g
}return d+"/"+(h in this.m_mcmds?this.m_modulePath:this.m_commandPath)+"/"+h
};
this.removeRequest=function(e){for(var d=this.m_activeRequests.length-1;
d>=0;
d--){if(this.m_activeRequests[d]==e){this.m_activeRequests.splice(d,1)
}}};
this.clearRequests=function(){while(this.m_activeRequests.length){net.abort(this.m_activeRequests.pop())
}};
this.cmd=function(g,m,n,l,q,d){if(!m){m={}
}if(this.getNoResponseCount()>0){return this.handleRequestError(gLang.ajaxConnectError,21,n)
}var f=g;
if(/^([^:\/?#]+:)?\/\//.test(f)){g=""
}else{f=this.getCmdUrl(g,d)
}if(g&&!(g in this.m_noSession)){if(!this.isConnected()){return this.handleRequestError(gLang.ajaxLogoutError,20,n)
}else{if(!m.sessionKey){m.sessionKey=this.m_sessionKey;
m.clientId=this.m_clientId
}}}var o=false;
for(var p in m){o=o||(m[p]&&m[p].nodeName)
}var h=new net.Request();
h.responseType="application/json";
h.url=f;
h.args=m;
h.sync=l;
h.method=(g in this.m_isGetRequest?"GET":"POST");
if(o||d){h.transport=net.FormTransport;
h.noRequestId=(!g||g in this.m_cmds)
}if(typeof q=="number"){h.timeout=q
}try{networklog("cmd: "+(g||f));
net.request(h,g=="attach"?hitch(this,n,h):hitch(this,"cmdCallback",h,n));
this.m_activeRequests.push(h)
}catch(k){this.handleNetworkError(k.msg);
this.handleRequestError(gLang.ajaxError,24,n)
}};
this.cmdCallback=function(g,k,f,h){this.removeRequest(g);
if(h){if(h.code==net.EVAL_ERROR){this.publish("evalError",h,k,f)
}else{this.handleNetworkError(h.msg)
}this.handleRequestError(gLang.ajaxError,h.msg,k);
return
}if(typeof f=="undefined"){this.handleNetworkError("cmdCallback received null response");
this.handleRequestError(gLang.ajaxError,7,k);
return
}if(f=="failure"){this.handleRequestError(gLang.ajaxError,9,k);
this.abort("cmdCallback received failure");
return
}try{var d=(typeof f!="object"||f.stat!="fail");
if(k){k(f,d,0)
}}catch(h){this.publish("evalError",h,k,f);
this.handleRequestError(gLang.ajaxError,10,k)
}};
this.handleRequestError=function(d,h,g){if(g){try{g(d,false,h)
}catch(f){}}};
this.start=function(e){this.publish("connecting");
var d={type:this.m_clientType,network:typeof gCIM!="undefined"&&gCIM.network||"none",newEvents:1,ts:new Date().getTime()};
if(this.m_ipAddress){d.ip=this.m_ipAddress
}this.cmd("start",d,hitch(this,"startCallback",e))
};
this.startCallback=function(f,e,d){if(d){this.m_isConnected=true;
this.m_sessionKey=e.sessionKey;
this.m_clientId=e.clientId;
this.startEvents();
this.publish("connect")
}else{this.abort()
}f(e,d)
};
this.attach=function(d,f){if(!d){return f(null,false)
}this.publish("connecting");
this.m_sessionKey=d;
var e={sessionKey:this.m_sessionKey,type:this.m_clientType,newEvents:1};
this.cmd("attach",e,hitch(this,"attachCallback",f))
};
this.attachCallback=function(h,f,d,g){this.removeRequest(f);
if(g||d=="success"||d.stat=="fail"){if(g&&g.code==net.REQUEST_ERROR){setTimeout(hitch(this,"attach",this.m_sessionKey,h),5000)
}else{this.stopRequests();
setTimeout(hitch(this,h,d,false),0)
}return
}this.m_isAttached=true;
this.m_isConnected=true;
this.m_clientId=d.clientId;
this.publish("connect",d);
setTimeout(hitch(this,"startEvents"),0);
h(d,true)
};
this.detach=function(){this.cmd("detach");
this.m_isConnected=false
};
this.mstart=function(d,e){this.publish("connecting");
this.cmd("mstart",d,hitch(this,"mstartCallback",e))
};
this.mstartCallback=function(f,e,d){if("events" in e){this.m_sessionKey=e.sessionKey;
this.attachCallback(e,d)
}else{this.startCallback(function(){gNetworkMgr.requestLogin("login",accounts)
},e,d)
}};
this.test=function(){if(!this.isConnected()){return
}if(this.m_testRequest){net.abort(this.m_testRequest);
this.m_testRequest=null
}this.incrementNoResponseCount();
if(this.getNoResponseCount()>=this.m_noResponseLimit){this.abort("giving up testing and dying");
return
}this.publish("fail",this.getNoResponseCount());
this.m_testRequest=new net.Request();
this.m_testRequest.responseType="application/json";
this.m_testRequest.url=this.getCmdUrl("test");
this.m_testRequest.args={sessionKey:this.getSessionKey(),clientId:this.getClientId(),ts:new Date().getTime()};
try{networklog("sending test request "+this.getNoResponseCount());
net.get(this.m_testRequest,hitch(this,"testCallback",this.m_testRequest));
this.m_activeRequests.push(this.m_testRequest)
}catch(d){this.handleNetworkError(d.msg)
}};
this.testCallback=function(f,d,g){if(!this.isConnected()){return this.stopRequests()
}this.removeRequest(f);
if(g){if(g.code==net.REQUEST_ERROR){this.handleNetworkError(g.msg)
}if(g.code==net.SERVER_ERROR){this.abort(g.msg)
}return
}if(!d){this.handleNetworkError("testCallback received null response");
return
}if(d=="failure"){this.abort("test request returned failure");
return
}this.handleNetworkResume()
};
this.startEvents=function(){if(this.m_eventRequest){net.abort(this.m_eventRequest)
}this.m_eventRequest=new net.Request();
this.m_eventRequest.url=this.getCmdUrl("events");
this.m_eventRequest.responseType="application/json";
this.m_eventRequest.timeout=this.m_eventPollDuration;
this.events()
};
this.events=function(){if(!this.isConnected()||this.getNoResponseCount()>0){return
}this.m_eventRequest.args={sessionKey:this.getSessionKey(),rev:this.m_messageRev,clientId:this.getClientId()};
this.publish("beforeEvents",this.m_eventRequest.args);
try{net.get(this.m_eventRequest,hitch(this,"eventsCallback"))
}catch(d){this.handleNetworkError(d.msg)
}};
this.eventsCallback=function(d,f){if(!this.isConnected()){return
}if(!this.m_eventRequest){this.handleNetworkError("events returned but there is no eventRequest object");
return
}if(f){this.handleNetworkError(f.msg);
return
}if(!d){return this.handleNetworkError("eventsCallback received null response from server")
}if(d=="failure"){return this.abort("eventsCallback received failure")
}try{networklog("received events rev "+d.rev+" took "+(new Date().getTime()-this.m_eventRequest.timestamp)/1000+"s");
if(this.isValidEvent(d)){if(d.rev&&d.rev>0){this.m_messageRev=d.rev
}this.publish("events",d)
}else{this.handleNetworkError("invalid events packet")
}}catch(f){}setTimeout(hitch(this,"events"),0)
};
this.isValidEvent=function(d){try{if(!d||!d.rev){this.abort();
if(typeof gLogon!="undefined"){setTimeout(hitch(gLogon,"reconnectAll"),1000)
}return false
}}catch(f){return false
}return true
};
this.handleNetworkError=function(d){if(typeof networklog=="undefined"){return
}networklog("handleNetworkError: "+d);
if(!this.isConnected()){networklog("handleNetworkError stop Ajax");
return this.stopRequests()
}if(this.m_isTesting){return
}var e=this.m_eventListener?this.m_eventListener.getTimestamp():null;
if(e&&new Date().getTime()-e>this.m_serverTimeoutDuration){this.abort("the session has been inactive for more than 3 minutes");
return
}this.m_isTesting=true;
if(this.m_eventRequest){net.abort(this.m_eventRequest);
this.m_eventRequest=null
}this.m_testInterval=setInterval(hitch(this,"test"),this.m_networkPollDuration);
this.test()
};
this.handleNetworkResume=function(){networklog("handleNetworkResume");
if(!this.isConnected()){networklog("handleNetworkResume stop Ajax");
this.stopRequests();
return
}clearInterval(this.m_testInterval);
this.clearRequests();
this.resetNoResponseCount();
this.m_isTesting=false;
this.publish("resume");
this.startEvents()
};
this.getNoResponseCount=function(){return this.m_noResponses
};
this.incrementNoResponseCount=function(){this.m_noResponses++
};
this.resetNoResponseCount=function(){this.m_noResponses=0
};
this.stopRequests=function(){this.publish("stop");
this.clearRequests();
if(this.m_eventRequest){net.abort(this.m_eventRequest);
this.m_eventRequest=null
}clearInterval(this.m_testInterval);
if(this.m_testRequest){net.abort(this.m_testRequest);
this.m_testRequest=null
}this.m_isConnected=false;
this.m_messageRev=0;
this.m_sessionKey=null;
this.m_isAttached=false;
this.resetNoResponseCount();
this.m_isTesting=false
};
this.abort=function(d){networklog("abort: trying to logout (stopping AJAX)");
this.stopRequests();
this.publish("abort")
}
});
meebo={};
meebo.config=function(){this.m_meeboAppImagePath="/skin/default/img/";
this.m_imageServer="/skin/default/img/";
this.m_version="74";
this.m_releaseT="prod";
this.m_timeStamp="1246411050";
this.m_soundPath="/skin/default/sound/";
this.getCDN=function(a){return typeof gCDNs=="object"&&gCDNs[a]?"//"+gCDNs[a]:""
};
this.getVersion=function(){return this.m_version
};
this.getTimeStamp=function(){return this.m_timeStamp
};
this.getReleaseType=function(){return this.m_releaseT
};
this.getImageServer=function(){return this.getCDN("img")+this.m_imageServer
};
this.getImageURL=function(a){return(a.substr(0,1)=="/"?a:this.getImageServer()+a)
};
this.getSoundPath=function(){return this.getCDN("img")+this.m_soundPath
};
this.getMeeboAppImageURL=function(a){return this.getCDN("img")+this.m_meeboAppImagePath+a
}
};
var gConfig=new meebo.config();
Class("meebo.Protocol",function(){this.initialize=function(c,a,b){this.m_id=c;
this.m_isJabberBased=a;
this.m_defaultGroup=b||"Buddies"
};
this.getId=this.toString=function(){return this.m_id
};
this.toLowerCase=function(){return this.m_id.toLowerCase()
};
this.isJabberBased=function(){return this.m_isJabberBased
}
});
gProtocols={msn:new meebo.Protocol("msn",false,"Individuals"),aim:new meebo.Protocol("aim"),icq:new meebo.Protocol("icq"),yahoo:new meebo.Protocol("yahoo",false,"Friends"),jabber:new meebo.Protocol("jabber",true),gtalk:new meebo.Protocol("gtalk",true),facebook:new meebo.Protocol("facebook"),myspace:new meebo.Protocol("myspace"),twitter:new meebo.Protocol("twitter")};
Class("meebo.Network",function(){this.initialize=function(a){gNetworks[a.id]=this;
this.m_id=a.id;
this.m_protocol=gProtocols[a.protocol];
this.m_name=a.name;
this.m_cimPartner=a.cimPartner||false;
this.m_domains=a.domains||[];
this.m_live="live" in a?a.live:true;
this.m_profileUrl=a.profileUrl||"";
this.m_forgotPasswordUrl=a.forgotPasswordUrl;
this.m_loginIsEmail=a.loginIsEmail||false;
var b=a.supports||{};
this.m_supports={add:("add" in b?b.add:true),remove:("remove" in b?b.remove:true),groups:("groups" in b?b.groups:true),block:("block" in b?b.block:true),invisible:("invisible" in b?b.invisible:true),groupchat:("groupchat" in b?b.groupchat:true),chatrooms:("groupchat" in b&&!b.groupchat?false:("chatrooms" in b?b.chatrooms:true)),customalias:("customalias" in b?b.customalias:true),chatlogs:("chatlogs" in b?b.chatlogs:true),icon:("icon" in b?b.icon:true)}
};
this.getId=this.toString=function(){return this.m_id
};
this.getProtocol=function(){return this.m_protocol
};
this.getName=function(){return this.m_name
};
this.getIcon=function(b,a,c){b="."+(b||"gif");
a="_"+(a||14);
c=c?"_"+c:"";
return gConfig.getMeeboAppImageURL("network/"+this.m_id+a+c+b)
};
this.isCIMPartner=function(){return this.m_cimPartner
};
this.getDomains=function(){return this.m_domains
};
this.loginIsEmail=function(){return this.m_loginIsEmail
};
this.getForgotPasswordUrl=function(){return this.m_forgotPasswordUrl
};
this.getProfileUrl=function(){return this.m_profileUrl
};
this.isLive=function(){return this.m_live
};
this.makeLive=function(){return this.m_live=true
};
this.supports=function(a){return this.m_supports[a]
};
this.getIconUrl=function(){return"network/"+this.getId()+"_14_online.gif"
}
});
Class("meebo.CIMNetwork",meebo.Network,function(a){this.initialize=function(b){b.protocol="jabber";
a(this,"initialize",arguments);
this.m_cimPartner=true;
this.m_supports.remove=false;
this.m_supports.groups=false;
this.m_supports.block=true;
this.m_supports.invisible=false;
this.m_supports.groupchat=false;
this.m_supports.chatrooms=false;
this.m_supports.customalias=false;
this.m_singleSubdomain="singleSubdomain" in b?b.singleSubdomain:false;
this.m_isBarVisible="imBarVisible" in b?b.imBarVisible:false;
this.m_friendsSafetyBar="friendsSafetyBar" in b?b.friendsSafetyBar:false;
this.m_imFriendsOnly="imFriendsOnly" in b?b.imFriendsOnly:false;
this.m_noTooltips="noTooltips" in b?b.noTooltips:false;
this.m_showAds="showAds" in b?b.showAds:false;
this.m_revenueId="revenueId" in b?b.revenueId:null
};
this.singleSubdomain=function(){return this.m_singleSubdomain
};
this.isBarVisible=function(){return this.m_isBarVisible
};
this.friendsSafetyBar=function(){return this.m_friendsSafetyBar
};
this.imFriendsOnly=function(){return this.m_imFriendsOnly
};
this.tooltipsDisabled=function(){return this.m_noTooltips
}
});
gNetworks={};
(function(){if(typeof gNetworksData!="undefined"){for(var d in gNetworksData){var a=gNetworksData[d];
if(!(a.protocol in gProtocols)){continue
}a.id=d;
gNetworks[d]=new meebo.Network(a)
}}else{new meebo.Network({id:"jabber",name:"Jabber",protocol:"jabber",supports:{block:false,invisible:false,icon:false},domains:["jabber.org"]})
}if(typeof gCIM!="undefined"&&gCIM.networkDefs){for(var c=0,b;
(b=gCIM.networkDefs[c]);
c++){new meebo.CIMNetwork(b)
}}})();
Class("meebo.Account",function(a){this.initialize=function(b){this.m_id="";
this.m_name=b;
this.m_password=null;
this.m_meeboAuthToken=null;
this.m_partnerAuthToken=null
};
this.getId=function(){return this.m_id
};
this.getName=function(){return this.m_name
};
this.getPassword=function(){return this.m_password
};
this.getMeeboAuthToken=function(){return this.m_meeboAuthToken
};
this.setMeeboAuthToken=function(b){this.m_meeboAuthToken=b
};
this.getPartnerAuthToken=function(){return this.m_partnerAuthToken
};
this.setPartnerAuthToken=function(b){this.m_partnerAuthToken=b
}
});
Class("meebo.Logon",meebo.Account,function(a){this.initialize=function(b,c){a(this,"initialize",[b]);
this.m_network=c;
this.m_isAuthToken=false;
this.m_alias="";
this.m_profile=null;
this.m_age=null;
this.m_id=getLogonId(b,this.getProtocol());
this.m_statusMsg="";
this.m_state="pending";
this.m_status="available";
this.m_lastError=null;
this.m_bMeebo=false;
this.m_bAutoStart=false;
this.m_bAutoInvisible=false;
this.m_hasCustomStatusMessage=false;
this.m_isUserSpecifiedAlias=false;
this.m_iconUrl=""
};
this.getAccountType=function(){return"meebo.Logon"
};
this.getUser=function(){return this.m_name
};
this.setName=function(b){this.m_name=b
};
this.getNetwork=function(){return this.m_network
};
this.getProtocol=function(){return this.m_network.getProtocol()
};
this.isJabberBased=function(){return this.getProtocol().isJabberBased()
};
this.isAuthToken=function(){return this.m_isAuthToken
};
this.getLastError=function(){return this.m_lastError
};
this.setLastError=function(b){this.m_lastError=b||{}
};
this.getDisplayName=function(){if(this.m_network.isCIMPartner()||this.m_network=="meebome"){return this.m_alias||meebo.util.stripJabber(this.m_name)
}else{if(this.isJabberBased()){return meebo.util.stripJabber(this.getName())
}else{if(this.m_network=="facebook"){return this.m_alias||gLang.facebookAccount
}else{return this.getName()
}}}};
this.getAlias=function(){return this.m_alias||this.getDisplayName()
};
this.setAlias=createSetter("alias","meebo.Logon::changeAlias");
this.getState=function(){return this.m_state
};
this.setState=createSetter("state","meebo.Logon::changeState");
this.isMeeboChild=function(){return this.m_bMeebo
};
this.setMeeboChild=function(b){this.m_bMeebo=b
};
this.isMeeboLogon=function(){return(this.m_network=="meebome"&&this.m_name.substr(0,this.m_name.indexOf("@"))==gLogon.getMeeboUser())
};
this.getAutoStart=function(){return this.m_bAutoStart
};
this.setAutoStart=function(b){this.m_bAutoStart=b
};
this.getAutoInvisible=function(){return this.m_bAutoInvisible
};
this.setAutoInvisible=function(b){this.m_bAutoInvisible=b
};
this.isOnline=function(){return this.m_state=="online"||this.m_state=="signingoff"
};
this.setOnline=function(b){if(this.isOnline()==b){return
}this.setState(b?"online":"offline")
};
this.getStatus=function(){return this.m_status
};
this.setStatus=function(c){if(!(c in arrayToObject(["available","away","invisible","unavailable"]))){return
}if(c=="invisible"&&!this.getNetwork().supports("invisible")){c="unavailable"
}var b=this.m_status;
this.m_status=c;
gPubSub.publish(this,"meebo.Logon::changeStatus",this.m_status,b)
};
this.getStatusMessage=function(){return this.m_statusMsg
};
this.setStatusMessage=createSetter("statusMsg","meebo.Logon::changeStatusMessage");
this.hasCustomStatusMessage=function(){return this.m_hasCustomStatusMessage
};
this.setHasCustomStatusMessage=createSetter("hasCustomStatusMessage","meebo.Logon::changeHasCustomStatusMessage");
this.setPassword=function(b){this.m_password=b;
this.m_isAuthToken=false
};
this.setAuthToken=function(b){this.m_password=b;
this.m_isAuthToken=true
};
this.isUserSpecifiedAlias=function(){return this.m_isUserSpecifiedAlias
};
this.setUserSpecifiedAlias=function(b){this.m_isUserSpecifiedAlias=b
};
this.getProfile=function(){return this.m_profile
};
this.setProfile=function(b){this.m_profile=b
};
this.getAge=function(){return this.m_age
};
this.setAge=function(b){this.m_age=b
};
this.isAnonymous=function(){return/@gc\d*.meebo.org/i.test(this.m_name)
};
this.getIconUrl=function(){return this.m_iconUrl
};
this.setIconUrl=createSetter("iconUrl","meebo.Logon::changeIcon")
});
Class("meebo.MeeboAccount",meebo.Account,function(a){this.initialize=function(c,b){a(this,"initialize",[c]);
this.m_password=b;
this.m_email=null;
this.m_state="offline"
};
this.getAccountType=function(){return"meebo.MeeboAccount"
}
});
Class("meebo.CIMAccount",meebo.Account,function(a){this.initialize=function(c,b,d){a(this,"initialize",[c]);
this.m_id=getCIMAccountId(c,d);
this.m_password=b;
this.m_network=d;
this.m_state="pending";
this.m_lastError=null;
this.m_logon=null;
this.m_bMeebo=false
};
this.getAccountType=function(){return"meebo.CIMAccount"
};
this.getAlias=function(){return this.m_name
};
this.getDisplayName=function(){return this.m_name
};
this.getNetwork=function(){return this.m_network
};
this.getState=function(){return this.m_state
};
this.setState=createSetter("state","meebo.CIMAccount::changeState");
this.getLogon=function(){return this.m_logon
};
this.setLogon=function(b){this.m_logon=b
};
this.getLastError=function(){return this.m_lastError
};
this.setLastError=function(b){this.m_lastError=b||{}
};
this.isOnline=function(){return false
};
this.getAutoStart=function(){return this.m_bAutoStart
};
this.setAutoStart=function(b){this.m_bAutoStart=b
};
this.getAutoInvisible=function(){return this.m_bAutoInvisible
};
this.setAutoInvisible=function(b){this.m_bAutoInvisible=b
};
this.isMeeboChild=function(){return this.m_bMeebo
};
this.setMeeboChild=function(b){this.m_bMeebo=b
};
this.isMeeboLogon=function(){return false
};
this.getProtocol=function(){return"jabber"
}
});
meebo.NetworkMgr=function(){this.m_loginWithSsl=false;
this.m_sslTestIframe;
this.m_lastIframeRequest=-1;
this.m_uiLogFilters={}
};
meebo.NetworkMgr.prototype.init=function(){if(typeof rsaEncrypt=="undefined"){this.m_loginWithSsl=true
}else{if(!this.m_loginWithSsl){this.doSslCheck()
}}};
meebo.NetworkMgr.prototype.getProtocol=function(){return(typeof window!="undefined"?window.location.protocol:"http:")
};
meebo.NetworkMgr.prototype.doSslCheck=function(){net.doSslCheck()
};
meebo.NetworkMgr.prototype.enableLoginWithSsl=function(){this.m_loginWithSsl=true
};
meebo.NetworkMgr.prototype.requestURL=function(a,d){try{var b=new net.Request();
b.url=a;
b.transport=net.XHRTransport;
net.get(b,d)
}catch(c){gWindowMgr.createNotifyDlg({id:getUniqueId()+"networkError",caption:gLang.meeboMessage},gLang.disruption+gLang.pleaseCheck)
}};
meebo.NetworkMgr.prototype.doRequest=function(e,c,f,d,a,b){if(gDebug){return
}gIGClient.cmd(e,c,f,d,a,b)
};
meebo.NetworkMgr.prototype.encryptPassword=function(a){if(!a){return""
}return rsaEncrypt(gIGClient.getSessionKey().substring(0,32)+a)
};
meebo.NetworkMgr.prototype.requestLogin=function(f,k){if(f!="mstart"&&!gIGClient.isConnected()){var s=callee.call(this,arguments);
return gIGClient.start(function(u,n){if(n){s()
}})
}if(typeof gCIM!="undefined"&&gCIM.connectURL&&typeof gPartner!="undefined"){k=gPartner.requestLogin(f,k);
if(!k.length){return
}}var d=!this.m_loginWithSsl;
var m={sessionKey:gIGClient.getSessionKey(),clientId:gIGClient.getClientId(),gmt:-(new Date().getTimezoneOffset())};
if(f=="mstart"){m.type=gIGClient.m_clientType;
m.newEvents=1
}if(typeof document=="undefined"||typeof MeeboExtension!="undefined"){m.ext="ff"
}if(this.getProtocol()=="https:"){m.ssl=true
}m.num=0;
for(var h=0,c;
(c=k[h]);
h++){if(c.getAccountType()=="meebo.MeeboAccount"){break
}}if(c){var e=m.num++;
var t=c.getPassword(),l;
m["username"+e]=c.getName();
m["protocol"+e]="meebo";
m[(d?"encrypted_":"")+"password"+e]=d?this.encryptPassword(t):t;
if(f=="relogin"){m["autologin"+e]=false
}var q=c.getMeeboAuthToken();
var p=c.getPartnerAuthToken();
if(q&&p){m["meeboauthtoken"+e]=q;
m["partnerauthtoken"+e]=p;
delete m[(d?"encrypted_":"")+"password"+e]
}if((l=gLogon.getMeeboMeLogon())&&l.isMeeboLogon()){m["state"+e]=l.getStatus();
m["message"+e]=l.getStatusMessage()
}}for(var h=0,b;
(b=k[h]);
h++){if(b.getAccountType()=="meebo.MeeboAccount"){continue
}var e=m.num++;
m["username"+e]=b.getName();
var a=(b.getAccountType()=="meebo.CIMAccount");
var o=b.getProtocol();
var g=b.isMeeboChild();
m["protocol"+e]=o.toString();
if(!a){m["state"+e]=b.getStatus();
m["message"+e]=b.getStatusMessage();
m["isauthtoken"+e]=b.isAuthToken()?"true":"false";
if(g){m["mep"+e]=true
}}m["network"+e]=b.getNetwork().getId();
m["ispartnerlogin"+e]=a;
if(b.getMeeboAuthToken&&b.getMeeboAuthToken()){this.enableLoginWithSsl();
var q=b.getMeeboAuthToken();
var p=b.getPartnerAuthToken();
if(q&&p){m["meeboauthtoken"+e]=q;
m["partnerauthtoken"+e]=p;
m["mep"+e]=true;
m["ispartnerlogin"+e]=false
}}else{var t=g?gLogon.getMeeboPassword():b.getPassword();
if(!d){m["password"+e]=t
}else{m["encrypted_password"+e]=this.encryptPassword(t)
}}}if(f=="mstart"){}else{this.doRequest(f,m,hitch(gLogon,"receiveVerifyUser"),null,null,this.m_loginWithSsl)
}};
meebo.NetworkMgr.prototype.requestAddAccounts=function(e,d){var b={numLogins:0,muser:gLogon.getMeeboUser()};
for(var c=0,a;
(a=e[c]);
c++){var f=++b.numLogins;
b[f+"user"]=a.getName();
b[f+"protocol"]=a.getProtocol();
b[f+"password2"]=this.encryptPassword(a.getPassword());
b[f+"state"]=a.getAutoInvisible()?"invisible":"online";
b[f+"autologin"]=a.getAutoStart();
b[f+"alias"]=a.getAlias();
b[f+"ispartnerlogin"]=(a.getAccountType()=="meebo.CIMAccount");
b[f+"network"]=a.getNetwork().getId()
}if(b.numLogins){this.doRequest("addacc",b,d)
}};
meebo.NetworkMgr.prototype.doUILog=function(m,h,c,n,g,l){var f={element:m,name:h,action:c,bForce:n,comment:g};
var e=m+"-"+h+"-"+c;
for(var a in this.m_uiLogFilters){var k=this.m_uiLogFilters[a];
if(e.search(k[0])!=-1){k[1](f)
}}var o=(typeof gUILoggingPercent!="undefined"?gUILoggingPercent:0);
var p=(Math.floor(Math.random()*100)<o);
if(!p&&!f.bForce){return
}var d=gIGClient.isConnected();
var b=f.element+"-"+f.name+"="+f.action+(f.comment?"|"+g:"");
this.doRequest(d?"dbg":"gaimlog",{cat:"javascript",m:b},null,l)
};
meebo.NetworkMgr.prototype.addUILogFilter=function(c,b,a){this.m_uiLogFilters[c]=[b,a]
};
meebo.NetworkMgr.prototype.doLog=function(a){this.doRequest("dbg",{m:a})
};
meebo.NetworkMgr.prototype.requestChatLog=function(d,c,a){var b={muser:gLogon.getMeeboUser(),p:c.getProtocol(),bu:c.getName(),u:c.getUser()};
if(a){b.l=a
}this.doRequest("cl_proxy",b,d,null,0)
};
meebo.NetworkMgr.prototype.deleteChatLog=function(a,c){var b={muser:gLogon.getMeeboUser(),p:c.getProtocol(),bu:c.getName(),u:c.getUser()};
this.doRequest("dcl_proxy",b,a)
};
meebo.NetworkMgr.prototype.requestMeeboChatLog=function(a,f,d,b,e,g){var c={muser:gLogon.getMeeboUser()||"",r:f.getChatName(),t:d};
if(b){c.l=b
}if(e){c.ds=e
}if(g){c.de=g
}this.doRequest("crl",c,a)
};
meebo.NetworkMgr.prototype.requestInfo=function(b,c){var a={};
this.buddyToQueryString(a,b);
this.doRequest("info",a,c)
};
meebo.NetworkMgr.prototype.requestM2M=function(b,c){var a={n:1};
this.buddyToQueryString(a,b,1);
this.doRequest("m2m",a,c)
};
meebo.NetworkMgr.prototype.requestSetProfile=function(a,f,b,e,d){if(ui.isIE){e=e.replace(/<EM>/ig,"<i>");
e=e.replace(/<\/EM>/ig,"</i>");
e=e.replace(/<STRONG>/ig,"<b>");
e=e.replace(/<\/STRONG>/ig,"</b>")
}var c={protocol:f,accountname:b,info:e};
this.doRequest("sacctinfo",c,a)
};
meebo.NetworkMgr.prototype.requestRoomsPrefs=function(a,c,e){var b={muser:e,nprefs:0};
for(var d=0;
d<c.length;
d++){if(!c[d]){continue
}b[++b.nprefs+"pn"]=c[d]
}if(b.nprefs){this.doRequest("gpref",b,a)
}};
meebo.NetworkMgr.prototype.requestPrefs=function(b){var a={num:0};
for(var c=0;
c<b.length;
c++){if(!b[c]){continue
}a["name"+a.num++]=b[c]
}if(a.num){this.doRequest("prefget",a)
}};
meebo.NetworkMgr.prototype.requestRemoveBuddies=function(b,c){var a=this.buildMultiBuddyRequest(b);
if(!a){return
}a.uiT=c;
this.doRequest("rbs",a,hitch(this,"receiveRemoveBuddies"))
};
meebo.NetworkMgr.prototype.receiveRemoveBuddies=function(b,a,c){if(a||!gWindowMgr){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.removeErrorHeader},gLang.removeNetError)
};
meebo.NetworkMgr.prototype.receiveSetAcc=function(b,a,c){if(a||!gWindowMgr){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.ajaxError},gLang.netError)
};
meebo.NetworkMgr.prototype.requestRemoveBuddyGroups=function(d){var b={n:0};
for(var c in d){if(!d[c]||!d[c].getExtra){continue
}var a=d[c].getExtra();
if(!a||!a.getName||!a.getName()||!a.getType||a.getType()!="buddygroup"){continue
}b[++b.n+"g"]=d[c].getExtra().getName()
}if(b.n){this.doRequest("rgs",b,hitch(this,"receiveRemoveBuddyGroups"))
}};
meebo.NetworkMgr.prototype.receiveRemoveBuddyGroups=function(b,a,c){if(a||!gWindowMgr){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.removeErrorHeader},gLang.removeNetError)
};
meebo.NetworkMgr.prototype.requestRenameGroup=function(c,a,b){this.doRequest("rename",{g:a,ng:b},c)
};
meebo.NetworkMgr.prototype.requestAddBuddy=function(f,d,g,e,b,a){var c={user:b,protocol:g,group:e,buddy:d};
if(a){c.subscr=0
}this.doRequest("add",c,f)
};
meebo.NetworkMgr.prototype.requestImportBuddies=function(c,b){var a={user:b.getName(),protocol:b.getProtocol()};
this.doRequest("importbuddies",a,c)
};
meebo.NetworkMgr.prototype.requestMoveBuddy=function(a,f,e){if(!f||!e){return
}var b={};
var d=0;
for(var c=0;
c<f.length;
c++){this.buddyToQueryString(b,f[c],++d);
b[d+"g"]=e
}b.n=d;
if(d){this.doRequest("move",b,a)
}};
meebo.NetworkMgr.prototype.receiveAddBuddy=function(b,a,c){if(a){return
}if(gWindowMgr){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.addErrorHeader},gLang.addNetError+" "+gLang.pleaseCheck)
}};
meebo.NetworkMgr.prototype.receiveImportBuddies=function(b,a,c){if(a||!gWindowMgr){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.addErrorHeader},gLang.addNetError+" "+gLang.pleaseCheck)
};
meebo.NetworkMgr.prototype.receiveAddChat=function(a,d,c,f){if(c){var b=a.getYourself();
if(b){a.addMember(b.getBuddy());
var e=gWindowMgr.getConvWindow(a);
if(e){e.moveBuddy(b)
}}return
}if(gWindowMgr){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.addErrorHeader},gLang.addNetError+" "+gLang.pleaseCheck)
}};
meebo.NetworkMgr.prototype.requestBlockBuddies=function(d,a){for(var c=d.length-1;
c>=0;
c--){if(!d[c].getNetwork().supports("block")){d.splice(c,1)
}}var b=this.buildMultiBuddyRequest(d);
if(!b){return
}b.block=a?"true":"false";
this.doRequest("blks",b,hitch(this,"receiveBlockBuddies"))
};
meebo.NetworkMgr.prototype.receiveBlockBuddies=function(b,a,d){if(a){return
}if(gWindowMgr){var c=gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.removeErrorHeader},gLang.removeNetError)
}};
meebo.NetworkMgr.prototype.requestSetAffiliation=function(a,d,b,e){if(!d||!b){return
}var c={buddy:d.getAlias(),room:b.getName(),ch:b.getChatId(),affiliation:e};
this.doRequest("mcaffiliate",c,a)
};
meebo.NetworkMgr.prototype.requestChatAction=function(c,b,e,d,h,a,g){var f=new Array();
if(e){f.push(e)
}this.requestChatActionFull(c,b,f,d.getProtocol(),d.getUser(),h,a,g)
};
meebo.NetworkMgr.prototype.requestChatActionFull=function(l,e,a,k,f,b,d,c){var h={};
if(e){h.a=e
}if(a&&a.length){h.nbuddies=a.length;
for(var g=0;
g<a.length;
g++){h[(g+1)+"b"]=a[g]
}}if(f){h.u=f
}if(k){h.p=k
}if(b){h.i=b
}if(d){h.d1=d
}if(c){h.d2=c
}this.doRequest("chat",h,l)
};
meebo.NetworkMgr.prototype.requestJoinRoom=function(h,g,a,d,f,e,c){var b={room:g};
if(a){b.nick=a
}if(d){b.password=d
}if(f){b.invitee=f
}if(e){b.invitee_protocol=e
}if(c){b.platform_instance_id=c
}this.doRequest("mcjoin",b,h)
};
meebo.NetworkMgr.prototype.requestCreateOrConfigMeeboChat=function(h,n,a,d,b,m,l,o,k,g,e){var f={sessionKey:gIGClient.getSessionKey()};
if(n){f.muser=n
}f.r=a;
if((typeof b=="boolean")&&b){f.p=this.encryptPassword(m)||""
}if(typeof l=="string"){f.d=l
}if(typeof o=="string"){f.t=o
}if(typeof d=="string"){f.a=d
}if(typeof k=="boolean"){f.modu=k
}if(g){if(g.nodeName){f.file=g
}else{f.stock=g
}}if(e){f.numc=e.length;
for(var c=0;
c<e.length;
c++){f[(c+1)+"c"]=e[c]
}}this.doRequest("mccreate",f,h)
};
meebo.NetworkMgr.prototype.requestSetStatus=function(e,d,f){if(!e){return
}var b={num:e.length};
for(var c=0,g=1,a;
(a=e[c]);
c++,g++){b[g+"user"]=a.getName();
b[g+"protocol"]=a.getProtocol();
b[g+"state"]=(d===null?a.getStatus():d);
b[g+"message"]=(f===null?a.getStatusMessage():f)
}if(c){this.doRequest("setstatus",b,hitch(this,"receiveSetStatus"))
}};
meebo.NetworkMgr.prototype.receiveSetStatus=function(b,a){if(a||!gWindowMgr){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.ajaxError},gLang.awayDisruption+" "+gLang.pleaseCheck)
};
meebo.NetworkMgr.prototype.requestSetConversationClose=function(a){runInMainContext(this,"doRequest","conv",{rec:a.getName(),proto:a.getProtocol(),send:a.getUser(),data:"close"})
};
meebo.NetworkMgr.prototype.requestSetTypingNotification=function(a,b){this.doRequest("conv",{rec:b.getName(),proto:b.getProtocol(),send:b.getUser(),data:(a==1?"typ":(a==2?"stoptyp":"cleartyp"))})
};
meebo.NetworkMgr.prototype.requestInappropriate=function(a,c,b){this.doRequest("mcflag",{url:a,room:c},b)
};
meebo.NetworkMgr.prototype.requestWarn=function(c,a,b){this.doRequest("mcwarn",{room:c,buddy:a},b)
};
meebo.NetworkMgr.prototype.requestSetAlias=function(b,c,d){var a={a:c};
this.buddyToQueryString(a,b);
this.doRequest("alias",a,d)
};
meebo.NetworkMgr.prototype.requestMultiInvite=function(e,f,b,d,a,c){this.requestMultiSend(e,f,b,d,a,c)
};
meebo.NetworkMgr.prototype.requestMultiSend=function(a,f,g,e,l,b){if(!a.length){return
}var k={numReceivers:a.length};
for(var h=0,d=1;
h<a.length;
h++,d++){k[d+"sender"]=a[h].getUser();
k[d+"protocol"]=a[h].getProtocol();
k[d+"receiver"]=a[h].getName();
var c=a[h].getChatId&&a[h].getChatId();
if(c){k[d+"ch"]=c
}}if(l){k.m=l
}if(b){k.type="app"
}k.msg=f;
if(g){k.room=e||g;
k.roomname=g
}var m=l?hitch(this,"doUILog","invite-msg-sent",l,a.length,true):null;
this.doRequest("msend",k,m)
};
meebo.NetworkMgr.prototype.requestSetIcon=function(d,a,c){var b={sessionKey:gIGClient.getSessionKey(),clientId:gIGClient.getClientId(),muser:gLogon.getMeeboUser()};
if(c){b.url=c
}else{if(a){b.file=a
}else{b.stock=d
}}this.doRequest("sicon",b,hitch(this,"receiveSetIcon",c||d||"custom-upload"))
};
meebo.NetworkMgr.prototype.receiveSetIcon=function(b,c){if(c=="success"){gPubSub.publish(this,"meebo.NetworkMgr::iconSet",b);
return true
}var a=gLang.buddyIconErrorGeneral;
switch(c){case"failed:imagesize":a=gLang.buddyIconErrorImageSize;
break;
case"failed:filesize":a=gLang.buddyIconErrorSize;
break;
case"failed:filetype":a=gLang.buddyIconErrorFiletype;
break
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.buddyIconErrorHeader},a)
};
meebo.NetworkMgr.prototype.receiveAuthBuddy=function(b,a,c){if(!a&&gWindowMgr){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.authHeader},gLang.authCheck)
}};
meebo.NetworkMgr.prototype.buddyToQueryString=function(e,d,h){if(typeof h!="number"){h=""
}var f=d.getType()=="chat";
var b=gLogon.getMeeboUser();
var a=(f&&b)?b+"@meebo.org":d.getUser();
var g=f?gProtocols.jabber:d.getProtocol();
var c=d.getName();
if(g.isJabberBased()){c=meebo.util.stripJabber(c)
}e[h+"u"]=a;
e[h+"p"]=g;
e[h+"b"]=c
};
meebo.NetworkMgr.prototype.buildMultiBuddyRequest=function(e){var d=0;
var c={};
for(var a in e){if(!e[a]){continue
}var b=e[a];
if(b.m_control=="uiTree"){b=b.getExtra()
}if(b.getType()!="buddy"&&b.getType()!="chat"){continue
}this.buddyToQueryString(c,b,++d)
}if(d==0){return null
}c.n=d;
return c
};
meebo.NetworkMgr.prototype.requestSpilloverRooms=function(b,a){this.doRequest("mcfetchspillovers",{room:a},b)
};
meebo.NetworkMgr.prototype.requestSetUiState=function(c){var b=0,a={};
for(var d in c){a["uid"+b]=d;
a["state"+b]=getObjectAsString(c[d]);
++b
}if(b==0){return
}a.num=b;
runInMainContext(this,"doRequest","uiset",a)
};
meebo.NetworkMgr.prototype.requestClearUiState=function(a){runInMainContext(this,"doRequest","uiclear",{uid:a})
};
meebo.NetworkMgr.prototype.requestNotificationRead=function(e,a,d,c){var b={numCleared:1,"0user":a,"0protocol":d,"0notificationid":e};
runInMainContext(this,"doRequest","clearnotifications",b,function(f){if(f=="success"&&c){c()
}})
};
meebo.NetworkMgr.prototype.requestAreFriends=function(e){var c={};
for(var d=0,b;
b=e[d];
++d){var f=b.getLogin().getId();
var a=c[f];
if(!a){a=c[f]={username:b.getUser(),protocol:b.getProtocol(),num:0}
}c[f]["buddyname"+(a.num++)]=b.getName()
}for(var f in c){this.doRequest("arefriends",c[f],hitch(this,"onAreFriends",c[f].username,c[f].protocol))
}};
meebo.NetworkMgr.prototype.onAreFriends=function(e,f,c,a){if(!a){return
}for(var b=0,d;
d=c.result[b];
++b){gBuddyList.getBuddy(d.buddyname,f,e).setIsFriend(d.isbuddy)
}};
meebo.EventMgr=function(){this.m_state="logon";
this.m_inNetworkInterrupt=false;
this.m_roomPrefsToRequest=[];
this.m_serverTimeOffset=null;
this.m_serverLoginTime=null;
this.m_clients=[]
};
meebo.EventMgr.prototype.getState=function(){return this.m_state
};
meebo.EventMgr.prototype.setState=createSetter("state","meebo.EventMgr::changeState");
meebo.EventMgr.prototype.resolveURL=function(a){var b=gIGClient.getHost();
return(b?util.query.relativeTo(a,"//"+b):a)
};
meebo.EventMgr.prototype.addClient=function(a){this.m_clients.push(a);
gPubSub.publish(this,"meebo.EventMgr::clientAttach",a)
};
meebo.EventMgr.prototype.removeClient=function(b){for(var a=this.m_clients.length-1;
a>=0;
a--){if(!this.m_clients[a].clientId==b.clientId){continue
}this.m_clients.splice(a,1)
}gPubSub.publish(this,"meebo.EventMgr::clientDetach",b)
};
meebo.EventMgr.prototype.getNumClients=function(){return this.m_clients.length
};
meebo.EventMgr.prototype.isClientAttached=function(b){for(var a=0;
a<this.m_clients.length;
a++){if(this.m_clients[a].clientType==b){return true
}}return false
};
meebo.EventMgr.prototype.inNetworkInterrupt=function(){return this.m_inNetworkInterrupt
};
meebo.EventMgr.prototype.onConnecting=function(){gEventMgr.setState(this.m_state=="logon"||this.m_state=="connecting"?"connecting":"reconnecting")
};
meebo.EventMgr.prototype.onConnect=function(b){if(!b){return
}this.setState("im");
for(var a=0,c;
(c=b.clients[a]);
a++){this.addClient(c)
}if("sessionState" in b){gBuddyList.setLarge(b.sessionState.large_buddylist)
}this.manageEvents(b);
if(typeof(gUIState)!="undefined"){gUIState.handleSetEvent(b.ui_state,true);
gUIState.flush()
}if(b.targeting){gTargeting.setTargetingFromEvents(b.targeting)
}if(gWidgets&&gLogon.hasMeeboAccount()){gWidgets.requestWidgets()
}var d=b.notifications||[];
for(var a=0;
a<d.length;
a++){gPubSub.publish(this,"meebo.EventMgr::notifications",d[a])
}gLogon.inferCustomStatus()
};
meebo.EventMgr.prototype.onFailTest=function(a){this.m_inNetworkInterrupt=true;
gPubSub.publish(this,"meebo.EventMgr::networkInterrupt",a)
};
meebo.EventMgr.prototype.onStopRequests=function(){if(this.getState()=="connecting"){this.setState("logon")
}else{this.m_clients=[];
this.logout()
}};
meebo.EventMgr.prototype.onResume=function(){this.m_inNetworkInterrupt=false;
gPubSub.publish(this,"meebo.EventMgr::networkResume")
};
meebo.EventMgr.prototype.onRequestData=function(a){gPubSub.publish(this,"meebo.EventMgr::networkRequestData",a)
};
meebo.EventMgr.prototype.onEvalError=function(h,a,f){function k(p){var n=p.name;
var o=p.message||p.description;
var m=p.fileName?p.fileName+":"+p.lineNumber:"";
var l=p.number;
return n+(o?": "+o:"")+(m?"; "+m:"")+(l?"; "+l:"")
}var c=navigator.userAgent.replace(/\s/g,"_").replace(/\|/g,"");
var d="host="+document.domain+" url="+(typeof location!="undefined"?location:"unknown")+" https="+(typeof ui!="undefined"?ui.isHttps:"unknown")+" ua="+c;
if(gLogon.getMeeboUser()){d+=" meebousername="+gLogon.getMeeboUser()
}var b=k(h).replace(/[\n\r\t]/g,"");
var g=a.toString().replace(/[\n\r\t]/g,"").substring(0,25);
if(a&&a.methodName&&typeof a.methodName=="string"){g="["+a.methodName+"] "+g
}gNetworkMgr.doLog("error=ajaxEvalError | function="+g+" | "+d+" | message="+b+" | string="+String(f).replace(/[\n\r]/g,""))
};
meebo.EventMgr.prototype.manageEvents=function(e){if(this.getState()=="done"||!e){return
}e.events=e.events||[];
logSpeed("received server events");
var g=new Date().getTime();
gPubSub.publish(this,"meebo.EventMgr::beforeHandleEvents",e.rev);
for(var b=0,d;
d=e.events[b];
++b){if(!("twitter" in gProtocols)&&d.data&&d.data.protocol&&(d.data.protocol=="twitter")){continue
}var c=d.type.split("::");
switch(c[0]){case"im":this.handleMsgEvent(c[1],d.data);
break;
case"buddy":this.handleBuddyEvent(c[1],d.data);
break;
case"mc":this.handleMeeboChatEvent(c[1],d.data);
break;
case"user":this.handleUserEvent(c[1],d.data);
break;
case"account":this.handleAccountEvent(c[1],d.data);
break;
case"info":this.handleInfoEvent(c[1],d.data);
break;
case"mcmd":gPubSub.publish(this,"meebo.EventMgr::mcmdResponse",d.requestId,d.data);
break
}}gPubSub.publish(this,"meebo.EventMgr::handleEvents",e.rev);
if(gLogon.getMeeboUser()&&this.m_roomPrefsToRequest.length&&gIGClient.getClientType()!="cim-imbar"&&gIGClient.getClientType()!="none"){prefNames=[];
for(var b=0;
b<this.m_roomPrefsToRequest.length;
b++){prefNames.push("room:"+this.m_roomPrefsToRequest[b].getChatName())
}gNetworkMgr.requestRoomsPrefs(hitch(this,"receiveRoomPrefs",this.m_roomPrefsToRequest),prefNames,gLogon.getMeeboUser());
this.m_roomPrefsToRequest=[]
}var f=(new Date().getTime()-g);
function a(h,k){h=String(h);
k=k||2;
while(h.length<k){h="0"+h
}return h
}};
meebo.EventMgr.prototype.receiveRoomPrefs=function(f,c,b,d){if(!b){return
}gPrefs.receiveRoomPrefs(f,c,b,d);
for(prefId in c){if(prefId.indexOf("room:")!=0){continue
}var a=c[prefId];
if(!a.lastAccess){continue
}var e=gBuddyList.getRoomByName(prefId.split("room:")[1]);
if(!e){continue
}e.setLastReadMsg(a.lastAccess)
}};
meebo.EventMgr.prototype.handleBuddyEvent=function(b,p){if(!p||!b){return false
}if(b=="rg"){gBuddyList.removeGroup(p.data);
return true
}var x=p.user,y=p.protocol;
var l=gLogon.getLogon(x,y);
if(!l){if(y!="meebo"){var v=("network" in p)&&gNetworks[p.network]||meebo.util.normalizeLogon(p.user,p.protocol).network;
l=gLogon.addLogon(x,v)
}}if(b=="online"&&!l.isOnline()){l.setOnline(true)
}var s=meebo.util.isMeeboGroupChat(p.buddy,l.getNetwork());
var o=!s?gBuddyList.addBuddy(p.buddy,l):gBuddyList.addRoom(p.buddy,p.buddyalias,l);
switch(b){case"logout":gBuddyList.removeBuddyFromGroup(o,p.data);
break;
case"online":o.setOnline(true);
if(o.getType()=="buddy"){o.setStatusMessage(p.data2)
}if(!s){o.setAway(false)
}case"login":if(s){this.m_roomPrefsToRequest.push(o)
}else{o.setAlias(p.buddyalias)
}var a=s&&meebo.util.isDefaultGroupChatGroup(p.data)?gLang.meeboChats:p.data;
gBuddyList.addBuddyToGroup(o,a);
if(p.buddyiconurl){o.setIconURL(this.resolveURL(p.buddyiconurl))
}break;
case"offline":if(!l.isOnline()){break
}o.setOnline(false);
gBuddyList.addBuddyToGroup(o,p.data);
break;
case"busy":o.setBusy(true);
o.setStatusMessage(p.data);
break;
case"away":o.setAway(true);
o.setStatusMessage(p.data);
break;
case"backi":o.setIdle(false,-1);
break;
case"backa":o.setAway(false);
o.setStatusMessage(p.data2);
break;
case"backb":o.setBusy(false);
o.setStatusMessage(p.data2);
break;
case"idle":if(o.isOnline()){o.setIdle(true,p.data)
}break;
case"typing":o.setTyping(1);
break;
case"stoppedtyping":o.setTyping(2);
break;
case"cleartyp":o.setTyping(0);
break;
case"info":o.setInfo(p.data);
if(o.getType()=="buddy"){o.setStatusMessage(p.data2)
}o.setAlias(p.buddyalias);
break;
case"infoaim":o.setInfoAim(p.data);
break;
case"m2m":if(p.data=="1"){o.setOnMeeboStatus("OnMeebo")
}else{if(p.data=="0"&&p.data2=="0"){o.setOnMeeboStatus("NeverOnMeebo")
}else{o.setOnMeeboStatus("NotOnMeebo")
}}break;
case"icon":if(p.data){if(p.data.charAt(0)=='"'){p.data=JSON.parse(p.data)
}o.setIconURL(this.resolveURL(p.data))
}else{o.setIconURL("")
}break;
case"mobile":o.setAway(false);
o.setMobile(true);
break;
case"backm":o.setMobile(false);
break;
case"blocked":o.setBlocked(true);
gBuddyList.addBuddyToGroup(o,p.data);
break;
case"unblk":o.setBlocked(false);
break;
case"chi":var u=o.getName();
var d=function(z,w){runInMainContext(gNetworkMgr,gNetworkMgr.requestChatAction,hitch(gNetworkMgr,"receiveAuthBuddy"),"a",p.buddy,o,p.data,z)
};
var h=sprintf(gLang.inviteToChat,u+" ("+y+")",l.getUser(),p.data);
if(typeof meeboApp=="undefined"){d(false);
alert(h+"  "+gLang.groupsUnsupported);
return
}if(p.data2){h+=" "+sprintf(gLang.inviteMsg,u,p.data2)
}var g=gWindowMgr.createAcceptDenyDlg({id:getUniqueId()+"-accept",caption:gLang.chatAcceptHeader},{buddy:u,logon:l,message:h,joinButtonText:gLang.acceptBtn},d);
if(meeboApp.util.hasMeeboExtension()){var f=hitch(this,function(z){if(!z.isPoppedOut()){MeeboExtension.showMeeboTab();
z.callActivate()
}else{z.m_win.focus()
}},g);
MeeboExtension.showNotification(gLang.chatAcceptHeader,removeHTML(h),null,"invitation",f)
}break;
case"chj":this.handleChatJoin(o,p);
break;
case"chjo":var t=gBuddyList.getRoomByName(p.data);
t.addMember(o);
var q=t.getPresences();
if(q[o.getId()]){this.handleChatJoin(o,p)
}break;
case"chl":this.handleChatLeave(o,p);
break;
case"nick":var n=p.data;
var m=n.substring(0,n.indexOf("/"));
var t=gBuddyList.getRoomByName(m);
var c=o.getPresence(t);
var k=c.getAlias();
var e=n.substring(n.indexOf("/")+1);
c.setAlias(e);
if(o.isYourself()){gPrefs.saveRoomPref(t,"nick",e);
if(!gLogon.getMeeboUser()){o.getLogin().setAlias(e)
}}if(t&&t.constructor==meebo.ApplicationRoom&&isDefined(p.data2.app_args)){c.setAppArgs(p.data2.app_args);
meeboApp.platform.changeAlias(t.getChatName(),c)
}break;
default:return false
}return true
};
meebo.EventMgr.prototype.handleChatLeave=function(e,f){var g=f.protocol;
var b=f.user;
var d=gLogon.getLogon(b,g);
var a=(meebo.util.isMeeboGroupChat(f.data,d.getNetwork())?gBuddyList.addRoom(f.data,null,d):gBuddyList.addProtocolChat(null,f.data2.chatid,f.data,d));
var c=e.getPresence(a);
if(isDefined(f.data2.app_args)){c.setAppArgs(f.data2.app_args)
}c.setOnline(false)
};
meebo.EventMgr.prototype.handleChatJoin=function(o,s){if(!s.data2){return
}var x=s.buddy;
var z=s.protocol;
var l=s.buddyalias;
var y=s.user;
var m=gLogon.getLogon(y,z);
if(m.isJabberBased()){gBuddyList.addJabberGroup(s.data)
}var c=s.data2.p;
var b=s.data2.i;
var a=s.data2.m;
var q=s.data2.s||x==y;
var e=s.data2.priv;
var k=s.data2.tags;
var n=s.data2.categories;
var g=s.data2.mod_url;
var d=s.data2.warn;
var p=s.data2.app_args;
var t=s.data2.app_id;
var u=s.data2.guest_only_user;
var v,w;
if(meebo.util.isMeeboGroupChat(s.data,m.getNetwork())){if(t&&(t>0)){w=v=gBuddyList.addApplicationRoom(s.data);
var h=w.getApplication();
if(!h||h.app_id!=t){w.setApplication(meebo.applicationMgr.getApplication(t)||new meebo.Application({app_id:t}))
}if(u&&!q){w.setGuestOnly(true)
}}else{w=v=gBuddyList.addRoom(s.data,null,m)
}w.setLogin(m);
if(typeof k!="undefined"){w.setTags(k)
}if(typeof n!="undefined"){w.setCategories(n)
}if(isDefined(e)){w.setPrivate(Boolean(e));
w.setPasswordLength(e)
}if(typeof g!="undefined"){w.setModeratedUrls(Boolean(g))
}}else{v=gBuddyList.addProtocolChat(c,b,s.data,m)
}if(w&&w.constructor==meebo.ApplicationRoom){w.setAbandoned(q&&w&&!w.hasPresences()&&!w.getInvites())
}if(s.data){v.setName(s.data)
}v.setChatId(b);
if(w&&w.constructor==meebo.Room&&!w.isInChat()){gPrefs.updateRoomLastAccess(w);
if(!w.isOnlist()){if(w.m_shouldAddToBuddylist){gNetworkMgr.requestAddBuddy(hitch(gNetworkMgr,"receiveAddChat",w),w.getName(),"jabber",gLang.meeboChats,w.getLogin().getName());
w.m_shouldAddToBuddylist=false
}else{if(!w.isSpillover()){this.m_roomPrefsToRequest.push(w)
}}}}var f=o.getPresence(v,l);
if(l){f.setAlias(l)
}if(s.data2.u&&s.data2.up){f.m_joiner=normalizeString(s.data2.u);
f.m_joinerProtocol=s.data2.up
}if(q){o.setYourself(true)
}if(typeof a!="undefined"){f.setOwner(a==1);
f.setSubModerator(a==2)
}f.setWarnCount(d);
if(typeof p!="undefined"){f.setAppArgs(p)
}if(s.type!="chjo"){f.setOnline(true);
o.setOnline(true)
}};
meebo.EventMgr.prototype.handleMsgEvent=function(c,o){var h=gLogon.getLogon(o.receiver,o.protocol);
if(h.isJabberBased()){o.sender=meebo.util.stripJabber(o.sender)
}var v=o.sender;
var g=o.d.a;
var m=gBuddyList.addBuddy(v,h);
if(g&&(!m.isGuestUser()||meebo.util.stripJabber(g)!=m.getName())){m.setAlias(g)
}if(o.d.i&&h.isJabberBased()){var k=v.indexOf("/");
var f=k==-1?v:v.substr(0,k);
if(meebo.util.isMeeboGroupChat(f,h.getNetwork())){var t=gBuddyList.addRoom(f,null,h)
}}if(o.d.i&&!t){var t=gBuddyList.addProtocolChat(null,o.d.i,null,h)
}var b=typeof gWindowMgr!="undefined"&&gWindowMgr.getConvWindow(t);
switch(c){case"ft":case"received":if(t&&(m.isYourself()||m.getPresence(t).isMuted())){break
}if(typeof o.timeSentUTC=="number"&&typeof this.m_serverLoginTime=="number"&&o.timeSentUTC>0&&o.timeSentUTC<this.m_serverLoginTime){var p=getLocalizedDate(o.timeSentUTC,this.m_serverTimeOffset)
}if(!t&&m.getType()=="buddy"){m.saveMessage(m,o.message,p||new Date());
m.incrementUnreadMessageCount()
}gPubSub.publish(this,"meebo.EventMgr::IM",m,o.message,t,p,o.d.fileid,o.d.muser,o.d.msgId,o.d.delayed);
if(t&&t.getType()=="chat"){t.setLastMsg()
}if(!t){m.setTyping(0)
}break;
case"sent":gPubSub.publish(this,"meebo.EventMgr::sentIM",m,o.message,t,p,o.d.fileid,o.d.muser,o.d.msgId);
break;
case"urls":if(!b){break
}var u=meeboApp.MediaListItem.fromEvent(o);
b.addToMediaList(u,m);
b.queueGroupChatMedia(u);
break;
case"kick":t.setChatId(null);
if(t.constructor==meebo.ApplicationRoom){break
}t.m_isLeaving=false;
if(b){var q=gLogon.getMeeboMeLogon();
var d=q&&(t.getLogin()!=q);
if(b.isVisible()){b.addHistoryIM(gLang.meeboMessage,gLang.leftRoomMessage,true,true)
}if(d){t.setLogin(q);
meeboApp.joinRoom(t)
}}gPrefs.updateRoomLastAccess(t);
if(o.d.reason=="kick"&&gNotice.m_flashEnabled){gNotice.add(t.getChatName(),h.getName(),h.getAlias());
var s=gNotice.getNoticeCount();
var e=gNotice.getLockoutLimit();
if(s+1==e){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.bannedTitle},gLang.bannedWarning)
}else{if(s>=e){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.bannedTitle},gLang.bannedFinal)
}else{gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.bannedTitle},gLang.bannedFromRoom)
}}}gBuddyListDlg.updateBuddyRows(t);
break;
case"appinvite":case"roominvite":var l=o.d.r;
var n=o.d.ra;
var a=o.d.pass;
var h=gLogon.getLogon(o.receiver,o.protocol);
var m=gBuddyList.addBuddy(o.sender,h);
gPubSub.publish(this,(c=="roominvite"?"meebo.EventMgr::roomInvite":"meebo.EventMgr::appInvite"),m,o.message,l,n,a);
break;
case"urldata":gPubSub.publish(this,"meebo.EventMgr::urlData",o.d);
break;
default:break
}};
meebo.EventMgr.prototype.handleMeeboChatEvent=function(k,a){var h=(!a.user||!a.protocol?gLogon.getMeeboMeLogon():gLogon.getLogon(a.user,a.protocol));
var p=a.info&&a.info.app_instance_id?gBuddyList.addApplicationRoom(a.info.app_instance_id):gBuddyList.addRoom(a.room,a.alias,h);
var l=typeof gWindowMgr!="undefined"&&gWindowMgr.getConvWindow(p);
switch(k){case"update":var f=a.lastmsg2?Math.floor(new Date().getTime()/1000)-a.lastmsg2:a.lastmsg;
if(typeof a.count=="number"){p.setCount(a.count)
}if(typeof f=="number"){p.setLastMsg(f)
}break;
case"sync":gPubSub.publish(p,"meebo.Room::sync",a.info.url,a.info.nitems);
break;
case"icon":p.setIconURL(this.resolveURL(a.info));
if(l){l.updateChatInfo()
}break;
case"password":if(l){l.showPasswordPrompt()
}break;
case"widget":p.setWidgetHash(a.info);
break;
case"noads":p.setPartner(true);
break;
case"personal":var o=hitch(p,function(s,q,t){if(q){this.setWidgetHash(s)
}});
var e={o:gLogon.getMeeboUser(),i:p.getAlias(),link:p.getChatName(),d:0,npairs:3,"1n":"w","1v":430,"2n":"h","2v":300,"3n":"rmjid","3v":p.getName()};
gNetworkMgr.doRequest("mmc",e,o);
break;
case"warn":if(!p){break
}var b=getBuddyId(a.info,gLogon.getMeeboMeLogon());
var n=p.getPresences();
if(!n||!n[b]){break
}var d=n[b];
var g=d.getBuddy();
d.setWarnCount(d.getWarnCount()+1);
if(g.isYourself()){gNotice.addWarn(p.getName(),p.getName()+"/"+d.getAlias());
gNotice.checkProbation()
}if(l){var c=d.getWarnCount()==1?sprintf(gLang.hasBeenWarned,d.getAlias()):sprintf(gLang.hasBeenWarnedPlural,d.getAlias(),d.getWarnCount());
l.addHistoryIM("",c,true,true)
}break;
case"data":var m=parseGET(a.info.data);
if(!isDefined(m.msg)||!isDefined(m.msgType)){break
}p.receiveMsg(m.msg,parseInt(m.msgType,10),a.info.from);
break;
case"appcreated":gPubSub.publish(this,"meebo.EventMgr::appCreated",p,a.info.chat_id);
break;
case"appregister":gPubSub.publish(this,"meebo.EventMgr::appRegister",p,a.info);
break;
case"error":gPubSub.publish(p,"meebo.Chat::error",a.info.error);
break
}};
meebo.EventMgr.prototype.handleUserEvent=function(o,b){var f=b.user,p=b.protocol;
var e=("network" in b)&&gNetworks[b.network]||meebo.util.normalizeLogon(f,p).network;
var m=(f&&p&&p in gProtocols)&&gLogon.getLogon(f,p);
switch(o){case"connecting":if(!m.isOnline()){m.setState("pending")
}break;
case"online":var k=b.data;
this.setState("im");
if(p=="meebo"){gLogon.setMeeboUser(f,null,"online");
gLogon.setMeeboFirstName(b.data.firstname);
break
}m=gLogon.addLogon(f,e);
m.setName(f);
m.setOnline(true);
if(typeof k=="string"){m.setAlias(k)
}break;
case"offline":if(p=="meebo"){e=gNetworks.meebome
}var h=b.data,d,n=null;
if("partnerusername" in h){d=gLogon.getCIMAccount(h.partnerusername,h.partner);
if(!d){break
}}else{d=gLogon.getCIMAccount(f,e);
n=h
}if(d){d.setLastError(n);
d.setState("error");
break
}m=gLogon.addLogon(f,e);
var c=m.getState();
switch(c){case"signingoff":m.setState("offline");
break;
case"pending":case"online":m.setLastError(h);
m.setState("error");
if(c=="pending"&&!m.isMeeboChild()){gLogon.removeLogon(m)
}break;
case"error":case"offline":case"disconnected":default:break
}if(m.getNetwork()=="meebome"&&m!=gLogon.getMeeboMeLogon()){gLogon.removeLogon(m)
}var a=gBuddyList.getBuddies({protocol:p,user:f});
for(var g=0,l;
(l=a[g]);
g++){gBuddyList.removeBuddy(l)
}break;
case"idle":break;
case"away":break;
case"warned":break;
case"request":gPubSub.publish(this,"meebo.EventMgr::buddyAddRequest",b.data,p,f);
break;
case"notify":gPubSub.publish(this,"meebo.EventMgr::notify",b.data);
break;
case"login":gLogon.receiveVerifyUser(b.data,true,0);
break;
case"icon":if(m){m.setIconUrl(this.resolveURL(b.data))
}else{if(p=="meebo"){gPrefs.setIcon(this.resolveURL(b.data))
}}break;
case"alias_changed":m.setAlias(b.data);
break;
case"info":m.setProfile(b.data);
break;
case"status":m.setStatusMessage(b.data.status);
m.setStatus(b.data.state);
break;
case"myspace_age":m.setAge(b.data);
break;
case"anonymized_username":gPubSub.publish(gEventMgr,"meebo.EventMgr::anonymized_username",b.data);
break;
case"sharedlink":gPubSub.publish(this,"meebo.EventMgr::sharedlink",m,b.data);
break
}};
meebo.EventMgr.prototype.handleAccountEvent=function(e,g){var b=g.user,h=g.protocol;
var f=("network" in g)&&gNetworks[g.network]||meebo.util.normalizeLogon(b,h).network;
if(!f){return
}switch(e){case"info":if(h=="meebo"&&!gLogon.getMeeboUser()){gLogon.setMeeboUser(b,null,"online");
if(g.prefs){gPrefs.onReceiveMeeboUserPrefs(g.prefs)
}break
}var d=gLogon.addLogon(b,f);
if("partnerusername" in g){var a=gLogon.getCIMAccount(g.partnerusername,g.network);
if(a){d.setPassword(a.getPassword());
gLogon.removeCIMAccount(a)
}}d.setMeeboChild(g.meebochild);
d.setAutoInvisible(g.loginstatus=="invisible");
d.setAutoStart(g.autologin=="true");
if(typeof g.alias=="string"){d.setAlias(g.alias)
}if("buddyiconurl" in g){var c=this.resolveURL(g.buddyiconurl);
d.setIconUrl(c);
if(d.isMeeboLogon()){gPrefs.setIcon(c)
}}if("state" in g){d.setStatus(g.state)
}else{if(g.loginstatus=="invisible"){d.setStatus("invisible")
}}if("isonline" in g){d.setState(g.isonline?"online":"offline")
}else{if(g.meebochild&&d.getState()=="pending"&&!d.getAutoStart()){d.setState("offline")
}}if("message" in g){d.setStatusMessage(g.message)
}break
}};
meebo.EventMgr.prototype.handleInfoEvent=function(a,b){switch(a){case"load_apps":gPubSub.publish(this,"meebo.EventMgr::loadApps");
break;
case"recently_viewed":gPubSub.publish(this,"meebo.EventMgr::recentlyViewed",b);
break;
case"targeting":gTargeting.setTargetingFromEvents(b);
break;
case"profile":gPubSub.publish(this,"meebo.EventMgr::profileData",b);
break;
case"ui_state":gUIState.handleSetEvent(b);
break;
case"ui_clear":gUIState.handleClearEvent(b);
break;
case"notifications":gPubSub.publish(this,"meebo.EventMgr::notifications",b);
break;
case"terminated":this.terminate(b);
break;
case"attached":this.addClient(b);
break;
case"detached":this.removeClient(b);
break;
case"large_buddylist":gBuddyList.setLarge(true);
break;
case"poll":gPubSub.publish(this,"meebo.EventMgr::poll",b.polls);
break;
case"ad":gPubSub.publish(this,"meebo.EventMgr::ad",b.ads);
break;
case"trackurl":gPubSub.publish(this,"meebo.EventMgr::trackUrl",b);
break;
case"prefs":gPrefs.onReceivePrefs(b);
break;
case"publish":if(net.publish){net.publish.receive(b.data)
}break
}};
meebo.EventMgr.prototype.onAbort=function(){if(this.getState() in arrayToObject(["logon","done"])){return
}this.m_inNetworkInterrupt=true;
this.logout()
};
meebo.EventMgr.prototype.terminate=function(c){if(!(this.getState() in arrayToObject(["im","reconnecting"]))){return
}var d=this.getState();
this.m_inNetworkInterrupt=false;
gPubSub.publish(this,"meebo.EventMgr::onTerminate",c);
this.setState("done");
var e=gLogon.getLogons();
for(var b=0,a;
(a=e[b]);
b++){if(a.isOnline()||(d=="reconnecting"&&a.getState()=="pending")){a.setState("disconnected")
}}gBuddyList.clearBuddyList();
this.m_clients=[];
gIGClient.stopRequests()
};
meebo.EventMgr.prototype.logout=function(d){if(!(this.getState() in arrayToObject(["im","reconnecting"]))){return
}if(!gDebug){gPrefs.doPreferenceSync();
runInMainContext(function(){gNetworkMgr.doRequest("quit");
this.m_clients=[];
gIGClient.stopRequests()
})
}var c=this.getState();
this.setState("done");
var e=gLogon.getLogons();
for(var b=0,a;
(a=e[b]);
b++){if(a.isOnline()||a.getState()=="pending"){a.setState("disconnected")
}}gBuddyList.clearBuddyList();
this.m_inNetworkInterrupt=false
};
meebo.LogonMgr=function(){this.m_logons={};
this.m_logonsCache={};
this.m_accounts={};
this.m_meeboUser=null;
this.m_meeboEmail="";
this.m_meeboFirstName="";
this.m_meeboLogonPassword=null;
this.m_meeboLogonState="offline"
};
meebo.LogonMgr.prototype.addLogon=function(b,c){var a=this.getLogon(b,c.getProtocol());
if(!a){a=new meebo.Logon(b,c);
this.m_logons[a.getId()]=a;
this.m_logonsCache[c.getProtocol()+"/"+b]=a;
gPubSub.publish(this,"meebo.LogonMgr::addLogon",a)
}return a
};
meebo.LogonMgr.prototype.getLogon=function(a,c){var b=c+"/"+a;
return this.m_logonsCache[b]||(this.m_logonsCache[b]=this.m_logons[getLogonId(a,c)])
};
meebo.LogonMgr.prototype.getUserHash=function(){return util.sha.sha256(this.hasMeeboAccount()?this.m_meeboUser:this.getLogons()[0].getId())
};
meebo.LogonMgr.prototype.getLogons=function(a){a=a||{};
var c=[];
for(var d in this.m_logons){var b=this.m_logons[d];
if("state" in a&&b.getState()!=a.state){continue
}if("status" in a&&b.getStatus()!=a.status){continue
}if("protocol" in a&&b.getProtocol()!=a.protocol){continue
}if("network" in a&&b.getNetwork()!=a.network){continue
}if("anonymous" in a&&b.isAnonymous()!=a.anonymous){continue
}if("name" in a&&b.getName()!=a.name){continue
}if("online" in a&&b.isOnline()!=a.online){continue
}if("meeboChild" in a&&b.isMeeboChild()!=a.meeboChild){continue
}if("cimPartner" in a&&b.getNetwork().isCIMPartner()!=a.cimPartner){continue
}if("supports" in a&&!b.getNetwork().supports(a.supports)){continue
}if("statusMessage" in a&&!b.getStatusMessage()){continue
}if("customStatusMessage" in a&&b.hasCustomStatusMessage()!=a.customStatusMessage){continue
}if("autostart" in a&&b.getAutoStart()!=a.autostart){continue
}c.push(b);
c[d]=b
}return c
};
meebo.LogonMgr.prototype.removeLogon=function(a){if(meebo.CIMAccount&&a instanceof meebo.CIMAccount){return this.removeCIMAccount(a)
}for(var b in this.m_logonsCache){if(this.m_logonsCache[b]==a){delete this.m_logonsCache[b]
}}delete this.m_logons[a.getId()];
gPubSub.publish(this,"meebo.LogonMgr::removeLogon",a)
};
meebo.LogonMgr.prototype.addCIMAccount=function(c,b,d){var a=this.getCIMAccount(c,d)||new meebo.CIMAccount(c,b,d);
this.m_accounts[a.getId()]=a;
gPubSub.publish(this,"meebo.LogonMgr::addCIMAccount",a);
return a
};
meebo.LogonMgr.prototype.getCIMAccount=function(a,b){return this.m_accounts[getCIMAccountId(a,b)]
};
meebo.LogonMgr.prototype.removeCIMAccount=function(a){delete this.m_accounts[a.getId()];
gPubSub.publish(this,"meebo.LogonMgr::removeCIMAccount",a)
};
meebo.LogonMgr.prototype.getMeeboMeLogon=function(){var a=this.getLogons({network:"meebome"});
if(a.length>1){var d=null;
for(var c=0,b;
(b=a[c]);
c++){if(b.isMeeboLogon()){d=b;
break
}if(b.getState()!="online"){if(a.length>1){a.splice(c--,1)
}}}}return d||(a.length?a[0]:null)
};
meebo.LogonMgr.prototype.getMeeboUser=function(a){return this.m_meeboLogonState=="online"||a?this.m_meeboUser:""
};
meebo.LogonMgr.prototype.hasMeeboAccount=function(){return !!this.m_meeboUser
};
meebo.LogonMgr.prototype.getMeeboFirstName=function(){return this.m_meeboFirstName
};
meebo.LogonMgr.prototype.setMeeboFirstName=function(a){this.m_meeboFirstName=a
};
meebo.LogonMgr.prototype.getMeeboEmail=function(){return this.m_meeboEmail
};
meebo.LogonMgr.prototype.setMeeboEmail=function(a){this.m_meeboEmail=a
};
meebo.LogonMgr.prototype.getMeeboPassword=function(){return this.m_meeboLogonPassword
};
meebo.LogonMgr.prototype.setMeeboPassword=function(a){this.m_meeboLogonPassword=a
};
meebo.LogonMgr.prototype.setMeeboUser=function(b,a,c){this.m_meeboUser=b;
if(a){this.m_meeboLogonPassword=a
}if(c){this.m_meeboLogonState=c
}if(c=="online"){gPubSub.publish(this,"meebo.LogonMgr::meeboUserLogon",b)
}};
meebo.LogonMgr.prototype.receiveVerifyUser=function(c,b){logSpeed("server login returned");
if(gDebug){gEventMgr.setState("im");
return
}if(!b){gEventMgr.setState(gEventMgr.getState()=="connecting"?"logon":"done");
if(typeof gWindowMgr!="undefined"){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.netErrorHeader},gLang.netError)
}if(typeof gWait!="undefined"){gWait.hideWait()
}return false
}if(typeof c.servertime=="number"){gEventMgr.m_serverTimeOffset=c.servertime*1000-new Date().getTime();
gEventMgr.m_serverLoginTime=c.servertime
}else{gEventMgr.m_serverTimeOffset=null
}var a=this.m_meeboUser;
if(a&&c.muser&&normalizeString(c.muser)==normalizeString(a)){this.setMeeboUser(a,null,"online");
if(meebo.applicationMgr){meebo.applicationMgr.loadUser(null)
}gPrefs.onReceiveMeeboUserPrefs(c.prefs);
if(gWidgets){gWidgets.requestWidgets()
}}return true
};
meebo.LogonMgr.prototype.reconnect=function(a){if(!a){return
}if(a.isMeeboChild()&&!this.getMeeboUser()){return
}a.setState("pending");
gNetworkMgr.requestLogin("relogin",[a])
};
meebo.LogonMgr.prototype.reconnectAll=function(){var c=this.getLogons({state:"disconnected"});
for(var b=0,a;
(a=c[b]);
b++){a.setState("pending")
}if(!c.length&&!this.m_meeboUser){gLogon.receiveVerifyUser("success",true,0)
}else{if(this.m_meeboUser){c.push(new meebo.MeeboAccount(this.m_meeboUser,this.m_meeboLogonPassword))
}runInMainContext(gNetworkMgr,gNetworkMgr.requestLogin,"relogin",c)
}};
meebo.LogonMgr.prototype.signoff=function(b){if(!b){return
}if(gDebug){b.setState("offline");
return
}if(gLogon.getLogons({online:true}).length==1){gEventMgr.logout()
}else{b.setState("signingoff");
var a={numLogouts:1,"1protocol":b.getProtocol(),"1user":b.getName()};
gNetworkMgr.doRequest("logout",a,hitch(this,"receiveSignoff"))
}};
meebo.LogonMgr.prototype.receiveSignoff=function(b,a,c){if(a||typeof gWindowMgr=="undefined"){return
}gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.netErrorHeader},gLang.netError)
};
meebo.LogonMgr.prototype.toggleOnline=function(a){if(a.isOnline()){this.signoff(a)
}else{this.reconnect(a)
}};
meebo.LogonMgr.prototype.getGlobalLogonStatus=function(){var a=this.getLogons({online:true});
if(!a.length){return"offline"
}var b=this.getMeeboMeLogon();
return(b&&b.isOnline()?b:a[0]).getStatus()
};
meebo.LogonMgr.prototype.getGlobalLogonStatusMessage=function(){var b=this.getLogons({online:true,customStatusMessage:false});
var c=this.getMeeboMeLogon();
if(!b.length){if(c&&!c.hasCustomStatusMessage()){return c.getStatusMessage()
}var a=this.getLogons({online:false,customStatusMessage:false});
return a[0]?a[0].getStatusMessage():""
}else{return(c&&c.isOnline()?c:b[0]).getStatusMessage()
}};
meebo.LogonMgr.prototype.inferCustomStatus=function(){var a=this.getGlobalLogonStatusMessage();
for(var b in this.m_logons){this.m_logons[b].setHasCustomStatusMessage(this.m_logons[b].getStatusMessage()!=a)
}};
meebo.BuddyList=function(){this.m_groups={};
this.m_buddies={};
this.m_jabberGroups={};
this.m_groupNames={}
};
meebo.BuddyList.prototype.getRoomByName=function(c){if(c.indexOf("@")!=-1){return this.getBuddyById(getMeeboChatId(c))
}else{for(var a in this.m_buddies){var b=this.m_buddies[a];
if(b.getType()=="chat"&&b.getChatName()==c){return b
}}}};
meebo.BuddyList.prototype.getBuddyById=function(a){return this.m_buddies[a]
};
meebo.BuddyList.prototype.getBuddy=function(c,d,a){var b=gLogon.getLogon(a,d);
var e=(meebo.util.isMeeboGroupChat(c,b.getNetwork())?getMeeboChatId(c):getBuddyId(c,b));
return this.m_buddies[e]
};
meebo.BuddyList.prototype.getBuddies=function(b){b=b||{};
var d=[];
for(var a in this.m_buddies){var c=this.m_buddies[a];
if("type" in b&&c.getType()!=b.type){continue
}if("protocol" in b&&c.getProtocol()!=b.protocol){continue
}if("user" in b&&c.getUser()!=b.user){continue
}if("logon" in b&&c.getLogin()!=b.logon){continue
}if("online" in b&&c.isOnline()!=b.online){continue
}if("onlist" in b&&c.isOnlist()!=b.onlist){continue
}if("friend" in b&&c.isFriend()!=b.friend){continue
}d.push(c);
d[a]=c
}return d
};
meebo.BuddyList.prototype.addRoom=function(b,c,a){if(!b){return null
}if(!a){a=gLogon.getMeeboMeLogon()
}var e=getMeeboChatId(b);
var d=this.m_buddies[e];
if(!d){d=new meebo.Room(b,c,a);
this.m_buddies[e]=d
}if(typeof c=="string"){d.setAlias(c)
}return d
};
meebo.BuddyList.prototype.addApplicationRoom=function(b,a){var d=getMeeboChatId(b);
var c=this.m_buddies[d];
if(!c){c=new meebo.ApplicationRoom(b,a);
this.m_buddies[d]=c
}return c
};
meebo.BuddyList.prototype.addProtocolChat=function(e,d,c,b){if(!d||!b){return null
}var f=getGroupChatId(b.getProtocol(),b.getName(),d);
var a=this.m_buddies[f]||new meebo.ProtocolChat(e,c,b);
this.m_buddies[f]=a;
return a
};
meebo.BuddyList.prototype.addBuddy=function(b,g){if(!b||!g){return null
}if(g.isJabberBased()){b=meebo.util.stripJabber(b);
if(b.indexOf("/")!=-1){var l=b.substring(0,b.indexOf("/"));
var e=b.substring(b.indexOf("/")+1);
if(this.isJabberGroup(l)){var a=this.getRoomByName(l);
var h=a.getPresences();
for(var k in h){var d=h[k];
if(d.isOnline()&&d.getAlias()==e){return this.m_buddies[k]
}}}}}var c=getBuddyId(b,g);
var f=this.m_buddies[c]||(this.m_buddies[c]=new meebo.Buddy(b,g,c));
return f
};
meebo.BuddyList.prototype.addBuddyToGroup=function(a,b){if(!a||!b){return null
}if(typeof b=="string"){b=this.createGroup(b)
}if(!a.hasGroup(b)){b.appendBuddy(a);
gPubSub.publish(this,"meebo.BuddyList::addBuddyToGroup",a,b)
}};
meebo.BuddyList.prototype.removeBuddyFromGroup=function(a,b){if(!a||!b){return
}if(typeof b=="string"){b=this.getGroupByName(b);
if(!b){return
}}if(b.removeBuddy(a)){gPubSub.publish(this,"meebo.BuddyList::removeBuddyFromGroup",a,b)
}if(!a.isOnlist()){a.setOnline(false)
}if(!b.getBuddies().length){this.removeGroup(b)
}};
meebo.BuddyList.prototype.removeBuddy=function(a){var c=a.getGroups();
for(var b=0,d;
(d=c[b]);
b++){this.removeBuddyFromGroup(a,d)
}};
meebo.BuddyList.prototype.getGroupByName=function(a){return this.m_groupNames[a]||(this.m_groupNames[a]=this.getGroupById(getBuddyGroupId(a)))
};
meebo.BuddyList.prototype.getGroupById=function(a){return this.m_groups[a]
};
meebo.BuddyList.prototype.createGroup=function(b){var a=this.getGroupByName(b);
if(a){return a
}var a=new meebo.BuddyGroup(b);
this.m_groups[a.getId()]=this.m_groupNames[b]=a;
gPubSub.publish(this,"meebo.BuddyList::createGroup",a);
return a
};
meebo.BuddyList.prototype.getGroups=function(){var b=[];
for(var a in this.m_groups){var c=this.m_groups[a];
b.push(c);
b[a]=c
}return b
};
meebo.BuddyList.prototype.addJabberGroup=function(a){this.m_jabberGroups[a]=a
};
meebo.BuddyList.prototype.isJabberGroup=function(a){return a in this.m_jabberGroups
};
meebo.BuddyList.prototype.withGroups=function(a){for(var b in this.m_groups){if(this.m_groups[b]&&a(this.m_groups[b])=="break"){break
}}};
meebo.BuddyList.prototype.setGroupName=function(c,a){for(var b in this.m_groupNames){if(this.m_groupNames[b]!=c){continue
}delete this.m_groupNames[b]
}delete this.m_groups[c.getId()];
c.setName(a);
this.m_groups[c.getId()]=c
};
meebo.BuddyList.prototype.removeGroup=function(e){if(typeof e=="string"){e=this.getGroupByName(e)
}if(!e){return
}var d=e.getBuddies();
for(var b=0,a;
(a=d[b]);
b++){this.removeBuddyFromGroup(a,e)
}for(var c in this.m_groupNames){if(this.m_groupNames[c]!=e){continue
}delete this.m_groupNames[c]
}delete this.m_groups[e.getId()];
gPubSub.publish(this,"meebo.BuddyList::removeGroup",e)
};
meebo.BuddyList.prototype.clearBuddyList=function(){gPubSub.publish(this,"meebo.BuddyList::beforeClearBuddyList");
var f=this.getBuddies();
for(var c=0,b;
(b=f[c]);
c++){var d=b.getGroups();
for(var a=0,e;
(e=d[a]);
a++){e.removeBuddy(b)
}b.setOnline(false)
}this.m_groups={};
this.m_groupNames={}
};
meebo.BuddyList.prototype.setLarge=function(a){this.m_isLargeBuddyList=a;
if(a){gPubSub.publish(this,"meebo.BuddyList::isLarge")
}};
meebo.BuddyList.prototype.isLarge=function(){return this.m_isLargeBuddyList
};
Class("meebo.BuddyGroup",function(){this.initialize=function(a){this.m_name=a;
this.m_id=getBuddyGroupId(a);
this.m_buddies={}
};
this.getType=function(){return"buddygroup"
};
this.getId=function(){return this.m_id
};
this.getName=function(){return this.m_name
};
this.setName=function(b){if(b==this.m_name){return
}var a=this.m_name,c=this.m_id;
this.m_name=b;
this.m_id=getBuddyGroupId(b);
gPubSub.publish(this,"meebo.BuddyGroup::changeName",this.m_name,a,this.m_id,c)
};
this.removeBuddy=function(a){var b=a.getId();
if(!this.m_buddies[b]){return false
}this.m_buddies[b].removeGroup(this);
delete this.m_buddies[b];
return true
};
this.appendBuddy=function(a){if(this.m_buddies[a.getId()]){return
}this.m_buddies[a.getId()]=a;
a.addGroup(this);
return a
};
this.getBuddies=function(b){b=b||{};
var d=[];
d.totalLength=0;
for(var a in this.m_buddies){var c=this.m_buddies[a];
d.totalLength++;
if("online" in b&&c.isOnline()!=b.online){continue
}if("type" in b&&c.getType()!=b.type){continue
}d[d.length]=c
}return d
}
});
Class("meebo.IMObject",function(){this.initialize=function(b,a){this.m_groups=[];
this.m_type;
this.m_unavailableInfoTimer=-1;
this.m_id;
this.m_info="";
this.m_iconURL="";
this.m_name=b;
this.m_alias="";
this.m_logon=a;
this.m_protocol=a.getProtocol();
this.m_user=a.getName();
this.m_bPendingInfo=false;
this.m_infoRequestTime=null;
this.m_bOnline=false;
this.m_loginTime=0;
this.m_persistTime=0;
this.m_onlineTime=0;
this.m_profileURL="";
this.m_wentOnlistTime=0;
this.m_isFriend=false;
this.m_checkedFriendship=false
};
this.getId=function(){return this.m_id
};
this.getGroupId=function(a){return this.m_id
};
this.getType=function(){return this.m_type
};
this.getName=function(){return this.m_name
};
this.getNetwork=function(){return this.m_logon.getNetwork()
};
this.getProtocol=function(){return this.m_protocol
};
this.getUser=function(){return this.m_user
};
this.getLogin=function(){return this.m_logon
};
this.getResource=function(){if(!this.m_protocol.isJabberBased()){return""
}var a=this.getName();
if(a.indexOf("/")==-1){return""
}return a.substring(a.indexOf("/")+1)
};
this.getGroups=function(){return this.m_groups.slice(0)
};
this.hasGroup=function(b){for(var a=0;
a<this.m_groups.length;
a++){if(this.m_groups[a]==b){return true
}}return false
};
this.addGroup=function(a){if(this.hasGroup(a)){return
}if(!this.m_groups.length){this.m_wentOnlistTime=new Date().getTime()
}this.m_groups.push(a);
this.setIsFriend(true);
gPubSub.publish(this,"meebo.IMObject::addGroup",a)
};
this.removeGroup=function(b){for(var a=this.m_groups.length-1;
a>=0;
a--){if(this.m_groups[a]==b){this.m_groups.splice(a,1)
}}if(!this.m_groups.length){this.m_wentOnlistTime=0
}};
this.getIconURL=function(){return this.m_iconURL
};
this.setIconURL=createSetter("iconURL","meebo.IMObject::changeIcon");
this.hasAlias=function(){return this.m_alias
};
this.getAlias=function(){return this.m_alias||this.m_name
};
this.setAlias=createSetter("alias","meebo.IMObject::changeAlias");
this.getWentOnlistTime=function(){return this.m_wentOnlistTime
};
this.isOnlist=function(){return this.m_groups.length
};
this.isOnline=function(){return this.m_bOnline
};
this.setOnline=function(b){if(this.m_bOnline==b){return
}this.setIsFriend(true);
var a=this.m_bOnline;
this.m_bOnline=b;
gPubSub.publish(this,"meebo.IMObject::changeOnline",b,a)
};
this.isMeebome=function(){if(this.getType()!="buddy"||this.getNetwork()!="meebome"){return false
}for(var a in this.m_presences){return false
}return true
};
this.getCaptionImage=function(){return(this.getNetwork()=="yahoo"?"yahoo_logo_small_title.gif":"network/"+this.getNetwork()+"_14_online.gif")
};
this.getCaption=function(){var a=this.getAlias();
if(gLogon.getLogons({protocol:this.m_protocol}).length>1){a+=" ("+this.m_logon.getAlias()+")"
}return a
};
this.getOnlineStatus=this.getStatus=function(){if(this.m_bOnline){status=sprintf(gLang.isOnline,this.getAlias())
}else{status=sprintf(gLang.isOffline,this.getAlias())
}};
this.stampLoginTime=function(){this.m_loginTime=new Date().getTime()
};
this.calcOnlineTime=function(){if(!this.isMeebome()){return 0
}if(!this.m_info){if(!this.m_bPendingInfo){this.requestInfo()
}this.m_onlineTime=0;
return 0
}var a=new Date().getTime();
var c=Math.floor((a-this.m_loginTime)/1000);
var b=this.getPersistenceInfo();
this.m_onlineTime=c+b;
return this.m_onlineTime
};
this.getOnlineTime=function(){return this.m_onlineTime
};
this.getPersistenceInfo=function(){var b=0;
if(this.isMeebome()){if(this.m_persistTime){b=this.m_persistTime
}else{var c=/<b>Description:<\/b> ([\d]+)/;
var a=c.exec(this.m_info);
if(a){this.m_persistTime=parseInt(a[1]);
b=this.m_persistTime
}}}return b
};
this.verifyInfo=function(b,a,c){if(c==404||c==500){return
}if(b!="success"){this.m_bPendingInfo=false
}else{this.m_unavailableInfoTimer=setTimeout(hitch(this,function(){this.setUnavailableInfo()
}),45000)
}this.m_bHaveRequestedInfo=true
};
this.setUnavailableInfo=function(){};
this.requestInfo=function(){if(this.isInfo()||this.m_bPendingInfo||!this.isOnline()){return
}gNetworkMgr.requestInfo(this,hitch(this,"verifyInfo"));
this.m_bPendingInfo=true;
this.m_infoRequestTime=new Date()
};
this.setInfo=function(e){if(this.m_unavailableInfoTimer!=-1){clearTimeout(this.m_unavailableInfoTimer);
this.m_unavailableInfoTimer=-1
}this.m_bPendingInfo=false;
if(!e){return e
}var c=/(<b>Online Since:<\/b> )([^\n]+)/;
var d=e.match(c);
if(d){e=e.replace(c,"$1"+new Date(d[2]).toLocaleString())
}var b=/(<b>Profile URL<\/b>: <a href=\")([^\n\"]+)\">/;
var a=e.match(b);
if(a&&a[2]){this.setProfileURL(a[2])
}this.m_info=insertTargets(e);
this.calcOnlineTime();
gPubSub.publish(this,"meebo.IMObject::changeInfo",e);
return this.m_info
};
this.isInfo=function(){return Boolean(this.m_infoRequestTime&&new Date().getTime()-this.m_infoRequestTime.getTime()<900000)
};
this.getInfo=function(){var a=this.m_info;
if(this.isMeebome()){a=gInfoDlg.updatePersistenceInfo(a,this.getOnlineTime())
}return gInfoDlg.updateIdleInfo(a,this.m_bIdle,this.m_idleTime)
};
this.isFriend=function(){if(!this.isOnlist()&&!this.m_bOnline&&gBuddyList.isLarge()&&!this.m_checkedFriendship){this.m_checkedFriendship=true;
meebo.IMObject.pendingFriendChecks.push(this);
setTimeout(meebo.IMObject.checkFriends,10)
}return this.m_isFriend
};
this.setIsFriend=createSetter("isFriend","meebo.IMObject::changeIsFriend");
this.setProfileURL=createSetter("profileURL","meebo.IMObject::changeProfileURL");
this.getProfileURL=function(){switch(this.getNetwork().getId()){case"aim":return"http://profiles.aim.com/"+this.getName();
case"yahoo":return"http://profiles.yahoo.com/"+this.getName();
case"facebook":return"http://www.facebook.com/profile.php?id="+this.getName()+"&v=info";
case"myspace":return"http://www.myspace.com/"+this.getName();
case"icq":return"http://people.icq.com/people/about_me.php?uin="+this.getName();
default:return this.m_profileURL
}}
});
meebo.IMObject.pendingFriendChecks=[];
meebo.IMObject.checkFriends=function(){gNetworkMgr.requestAreFriends(meebo.IMObject.pendingFriendChecks);
meebo.IMObject.pendingFriendChecks=[]
};
Class("meebo.Buddy",meebo.IMObject,function(a){this.initialize=function(c,b,d){a(this,"initialize",[c,b]);
this.m_type="buddy";
this.m_id=d||getBuddyId(this.m_name,b);
this.m_statusMessage="";
this.m_isBusy=false;
this.m_isAway=false;
this.m_isIdle=false;
this.m_idleTime=0;
this.m_typingT=0;
this.m_isMobile=false;
this.m_isBlocked=false;
this.m_isYourself=false;
this.m_numWarnsUsed=0;
this.m_mostRecentWarn=0;
this.m_onMeeboStatus=null;
this.m_alias="";
this.m_presences={};
this.m_infoAim="";
this.m_messages=[];
this.m_unreadMessageCount=0;
this.m_activityTime=0
};
this.getAlias=function(){return this.m_alias||(this.getNetwork()=="meebome"?this.m_name.substr(0,this.m_name.indexOf("@")):this.m_name)
};
this.getGroupId=function(b){return this.m_id+"--"+b.getId()
};
this.getPresence=function(b,d){if(!b){return
}var c=b.getId();
if(this.m_presences[c]){return this.m_presences[c]
}return new meebo.Presence(this,b,d)
};
this.getPresences=function(){return this.m_presences
};
this.hasPresences=function(){for(var b in this.m_presences){return true
}return false
};
this.setInfoAim=function(b){this.m_infoAim=b
};
this.getInfoAim=function(){return this.m_infoAim
};
this.setUnavailableInfo=function(){this.setInfo(gLang.buddyUnavailable)
};
this.getActivityTime=function(){return this.m_activityTime
};
this.updateActivityTime=function(){this.m_activityTime=Math.floor(new Date().getTime()/1000)
};
this.getOnlineStatus=function(){var b=sprintf(this.isOnline()?(this.isMobile()?gLang.isMobile:gLang.isOnline):(this.isWidgetUser()?gLang.hasLeftYourPage:gLang.isOffline),this.getAlias());
return b
};
this.setOnline=function(b){if(this.m_bOnline==b){return
}if(b&&this.isMeebome()){this.stampLoginTime()
}if(!b){this.m_isBusy=false;
this.m_isAway=false;
this.m_isIdle=false;
this.m_typingT=0;
this.m_isMobile=false;
this.m_onMeeboStatus=null
}this.m_bOnline=b;
gPubSub.publish(this,"meebo.IMObject::changeOnline",b)
};
this.saveMessage=function(c,d,b){this.m_messages.push({buddy:c,message:d,date:b})
};
this.getMessages=function(){return this.m_messages
};
this.getUnreadMessageCount=function(){return this.m_unreadMessageCount
};
this.setUnreadMessageCount=function(b){b=b||0;
if(this.m_unreadMessageCount==b){return
}this.m_unreadMessageCount=b;
gPubSub.publish(this,"meebo.Buddy::changeUnreadCount",b)
};
this.resetUnreadMessageCount=function(){if(this.m_unreadMessageCount!=0){this.setUnreadMessageCount(0);
gNetworkMgr.doRequest("clearunreadcounter",{username:this.getUser(),buddyname:this.getName(),protocol:this.getProtocol()})
}};
this.incrementUnreadMessageCount=function(b){this.m_unreadMessageCount+=(b||1);
gPubSub.publish(this,"meebo.Buddy::changeUnreadCount",this.m_unreadMessageCount)
};
this.getTyping=function(){return this.m_typingT
};
this.setTyping=createSetter("typingT","meebo.Buddy::changeTyping");
this.isAway=function(){return this.m_isAway
};
this.setAway=function(b){if(this.m_isAway==b){return
}this.m_isAway=b;
if(b){this.setOnline(true)
}gPubSub.publish(this,"meebo.Buddy::changeAway",b)
};
this.isBusy=function(){return this.m_isBusy
};
this.setBusy=function(b){if(this.m_isBusy==b){return
}this.m_isBusy=b;
if(b){this.setOnline(true);
this.setAway(false)
}gPubSub.publish(this,"meebo.Buddy::changeBusy",b)
};
this.getStatusMessage=function(){return this.m_statusMessage
};
this.setStatusMessage=function(d){if(!isString(d)){return
}var e=/\n<b>Away Message:<\/b> ([^\n]+)/;
var c=/\n<b>Status:<\/b> ([^\n]+)/;
var b;
if((b=d.match(e))){d=b[1]
}else{if((b=d.match(c))){d=b[1]
}}if(this.m_protocol.isJabberBased()){d=d.replace(/^Away: /,"")
}d=unescapeHTML(d);
if(this.m_statusMessage==d){return
}this.m_statusMessage=d;
gPubSub.publish(this,"meebo.Buddy::changeStatusMessage",d)
};
this.setIdleTime=function(b){this.m_idleTime=b
};
this.getIdleTime=function(){return this.m_idleTime
};
this.isIdle=function(){return this.m_isIdle
};
this.setIdle=function(c,d){if(c){this.setOnline(true)
}this.m_isIdle=c;
if(c){var b=new Date().getTime()/1000;
this.m_idleTime=b-parseInt(d)
}gPubSub.publish(this,"meebo.Buddy::changeIdle",c,this.m_idleTime)
};
this.requestOnMeeboStatus=function(){if(this.getOnMeeboStatus()||!this.isOnline()||this.m_logon.isMeeboLogon()){return
}gNetworkMgr.requestM2M(this)
};
this.getOnMeeboStatus=function(){return(this.m_logon.isMeeboLogon()?"OnMeebo":this.m_onMeeboStatus)
};
this.setOnMeeboStatus=createSetter("onMeeboStatus","meebo.IMObject::changeInfo");
this.setUser=function(b){this.m_user=b
};
this.getUser=function(){return this.m_user
};
this.isMobile=function(){return this.m_isMobile
};
this.setMobile=createSetter("isMobile","meebo.Buddy::changeMobile");
this.isBlocked=function(){return this.m_isBlocked
};
this.setBlocked=createSetter("isBlocked","meebo.Buddy::changeBlocked");
this.isYourself=function(){return this.m_isYourself
};
this.setYourself=function(b){this.m_isYourself=b
};
this.isMeeboUser=function(){return/@meebo\.org$/.test(this.m_name)
};
this.isWidgetUser=function(){return/@guest[0-9]*\.meebo\.org$/.test(this.m_name)
};
this.isGuestUser=function(){return/guest\d*@gc\d*\.meebo\.org$/.test(this.m_name)
};
this.removeExpiredWarns=function(){if(((new Date()).getTime()-this.m_mostRecentWarn)>=(5*60*1000)){this.m_numWarnsUsed=0
}};
this.canWarn=function(){this.removeExpiredWarns();
return this.m_numWarnsUsed<5
};
this.addWarn=function(){this.m_numWarnsUsed++;
this.m_mostRecentWarn=(new Date()).getTime()
};
this.getRemainingWarns=function(){this.removeExpiredWarns();
return 5-this.m_numWarnsUsed
}
});
Class("meebo.Chat",meebo.IMObject,function(a){this.initialize=function(c,b){a(this,"initialize",arguments);
this.m_chatid=null;
this.m_presences={}
};
this.isInChat=function(){for(var b in this.m_presences){var c=this.m_presences[b];
if(c&&c.isOnline()){return true
}}return false
};
this.addPresence=function(b){if(b.getBuddy().getId() in this.m_presences){return
}this.m_presences[b.getBuddy().getId()]=b;
gPubSub.publish(this,"meebo.Chat::addPresence",b)
};
this.removePresence=function(b){if(!(b.getBuddy().getId() in this.m_presences)){return
}delete this.m_presences[b.getBuddy().getId()];
gPubSub.publish(this,"meebo.Chat::removePresence",b)
};
this.getPresences=function(){return this.m_presences
};
this.hasPresences=function(){for(var b in this.m_presences){return true
}return false
};
this.getYourself=function(){for(var c in this.m_presences){var b=this.m_presences[c].getBuddy();
if(b&&b.isYourself()){return this.m_presences[c]
}}return null
};
this.getChatId=function(){return this.m_chatid
};
this.setChatId=createSetter("chatid","meebo.Chat::changeChatId")
});
Class("meebo.Room",meebo.Chat,function(a){this.initialize=function(c,d,b){if(!b){b=new meebo.Logon("",gNetworks.meebome)
}a(this,"initialize",[c,b]);
this.m_type="chat";
this.m_alias=d;
this.m_count=0;
this.m_userLastMsg=this.setLastReadMsg();
this.m_lastmsg=-1;
this.m_isPrivate=false;
this.m_passwordLength=0;
this.m_password;
this.m_bOnline=true;
this.m_isModeratedUrls=true;
this.m_isPersonal=c.substring(0,2)=="__";
this.m_isPartner=false;
this.m_members={};
this.m_isGuestOnly=false;
this.m_isLeaving=false;
this.m_chatName=meebo.util.splitGroupChatName(c).id||c;
this.m_isSpillover=this.m_chatName.indexOf("___spill___")>-1;
this.m_description="";
this.m_tags="";
this.m_categories=[];
this.m_application=null;
this.m_applicationId="";
this.m_shouldAddToBuddylist=false;
this.m_widgetHash=null;
this.m_invites=null;
this.m_id=getMeeboChatId(this.m_name)
};
this.isSpillover=function(){return this.m_isSpillover
};
this.setInvites=function(d,c,b){this.m_invites={invitees:d,msg:c,msgIdx:b}
};
this.getInvites=function(){return this.m_invites
};
this.clearInvites=function(){this.m_invites=null
};
this.getGroupId=function(b){return this.m_id+"--"+b.getId()
};
this.setName=function(b){if(this.m_name==b){return
}if(this.m_name.indexOf("@")!=-1){return
}this.m_name=b;
this.m_chatName=meebo.util.splitGroupChatName(b).id;
this.m_id=getMeeboChatId(this.m_name)
};
this.setLogin=function(b){if(b==this.m_logon){return
}var e=gWindowMgr.getConvWindow(this);
if(e&&e.getImObject()==this){var c=getIMId(this.getName(),b);
var d=e.m_id;
if(c!=d){gWindowMgr.reregisterWindow(d,c);
e.m_id=c
}}this.m_logon=b;
this.m_protocol=b.getProtocol();
this.m_user=b.getName()
};
this.isModeratedUrls=function(){return this.m_isModeratedUrls
};
this.setModeratedUrls=createSetter("isModeratedUrls","meebo.Room::changeModeratedUrls");
this.isPrivate=function(){return this.m_isPrivate
};
this.setPrivate=function(b){this.m_isPrivate=b
};
this.getPasswordLength=function(){return this.m_passwordLength
};
this.setPasswordLength=function(b){this.m_passwordLength=b
};
this.getPassword=function(){return this.m_password
};
this.setPassword=function(b){this.m_password=b
};
this.setLastReadMsg=function(b){if(!b){b=Math.floor(new Date().getTime()/1000)
}if(this.m_userLastMsg==b){return
}this.m_userLastMsg=b;
gPubSub.publish(this,"meebo.Room::changeLastReadTime",b);
return this.m_userLastMsg
};
this.setLastMsg=function(b){if(!b){b=Math.floor(new Date().getTime()/1000)
}if(b==this.m_lastMsgTime){return
}this.m_lastMsg=b;
gPubSub.publish(this,"meebo.Room::changeLastMessageTime",b);
return this.m_lastMsg
};
this.getCount=function(){var d=0;
for(var b in this.m_presences){var c=this.m_presences[b];
if(c&&c.isOnline()){d++
}}return d||this.m_count
};
this.setCount=function(b){if(typeof b!="number"||b==this.m_count){return
}this.m_count=b;
gPubSub.publish(this,"meebo.Room::changeCount",b)
};
this.hasNewMessage=function(){return(this.m_userLastMsg<this.m_lastMsg)
};
this.getChatlogURL=function(){var b="http://chatlogs.meebo.com/";
var c=encodeURIComponent(this.getChatName());
if(c.substr(0,2)=="__"){b+="user/"+c.substring(2)+"/room/"
}else{b+="room/"+c+"/"
}return b+"logs/today/"
};
this.getChatName=function(){return this.m_chatName
};
this.getAlias=function(){if(this.m_isPersonal){var b=this.getChatName().substring(2).split("___spill___");
return sprintf(gLang.myRoom,b[0])+(b.length==2?" #"+b[1]:"");
return sprintf(gLang.myRoom,this.getChatName().substring(2))
}else{return this.m_alias||(this.m_chatName||"").replace("___spill___"," #")||this.m_name;
return this.m_alias||this.m_chatName||this.m_name
}};
this.getCaption=function(){return this.getAlias()
};
this.setInfo=function(c){c=a(this,"setInfo",[c]);
if(c){var b=(/<b>Description:<\/b>\s*([^<]*)\s*<br\/>/).exec(c);
this.m_description=b?b[1]:""
}};
this.getChatDescription=function(){return this.m_description
};
this.getTags=function(){return this.m_tags
};
this.setTags=function(b){this.m_tags=b
};
this.getCategories=function(){return this.m_categories
};
this.setCategories=function(b){this.m_categories=b
};
this.getWidgetHash=function(){return this.m_widgetHash
};
this.setWidgetHash=createSetter("widgetHash","meebo.Room::changeWidgetHash");
this.isPartner=function(){return this.m_isPartner
};
this.setPartner=createSetter("isPartner","meebo.Room::changePartner");
this.addMember=function(b){this.m_members[b.getName()]=true;
gPubSub.publish(this,"meebo.Room::addMember",b)
};
this.isMember=function(b){return this.m_members[b.getName()]
};
this.isGuestOnly=function(){return this.m_isGuestOnly
};
this.setGuestOnly=function(b){this.m_isGuestOnly=b
};
this.inviteBuddies=function(f,h,g,b){if(!f){return
}if(!(f instanceof Array)){f=[f]
}var d;
for(var e=f.length-1;
(d=f[e]);
e--){var c=this.m_presences[d.getId()];
if(c&&c.isOnline()&&!h){f.splice(e,1);
continue
}gPubSub.publish(this,"meebo.Room::invite",d)
}gNetworkMgr.requestMultiInvite(f,g,this.getChatName(),this.getAlias(),b,this.constructor==meebo.ApplicationRoom)
}
});
Class("meebo.ApplicationRoom",meebo.Room,function(supr){this.initialize=function(name,application){if(!application){var app_id=parseInt(name.split("_")[1],10);
application=meebo.applicationMgr.getApplication(app_id)||new meebo.Application({app_id:app_id})
}supr(this,"initialize",[name,application&&application.alias||null,gLogon.getMeeboMeLogon()]);
this.m_application=application;
this.m_joinParams={};
this.m_launchId=null;
this.m_launchTime=0;
this.m_bAbandoned=false;
this.m_htmlSanitizeRegexps=[];
for(var i=0,htmlTagBlacklist=["script","applet","object","embed"];
i<htmlTagBlacklist.length;
i++){var tag=htmlTagBlacklist[i];
var regexp=new RegExp("<W*"+tag+".*/?>(.*</"+tag+">)?","gim");
this.m_htmlSanitizeRegexps.push(regexp)
}};
this.getAlias=function(){return this.m_alias||(this.getApplication()&&this.getApplication().getAlias())||supr(this,"getAlias")
};
this.setAlias=function(alias){if(this.m_name==alias){return
}supr(this,"setAlias",[alias])
};
this.getApplication=function(){return this.m_application
};
this.setApplication=function(application){this.m_application=application
};
this.isInfo=function(){return true
};
this.requestInfo=function(){return
};
this.getInfo=function(){var app=this.getApplication();
return'<div class="tooltipUserName"><img align=left src="'+gImages.getPath()+"network/"+this.getNetwork()+'_14_online.gif"><b>'+escapeHTML(this.getAlias())+"</b> from "+escapeHTML(app.owner_name)+"<p>"+app.info+"</p></div><br>"
};
this.sendMsg=function(msg,msgType,to){msg="msg="+encodeURIComponent(msg)+"&msgType="+encodeURIComponent(msgType||0);
var args={sender:this.getUser(),receiver:to||this.getName(),protocol:this.getProtocol(),msg:msg,mt:"a",ch:this.getChatId()};
gNetworkMgr.doRequest("send",args)
};
this.receiveMsg=function(msg,msgType,from){switch(msgType){case meebo.ApplicationRoom.MSG_TYPE_APP:try{var args=eval("("+msg+")")
}catch(e){break
}args.from=from;
gPubSub.publish(this,"meebo.ApplicationRoom::receiveAppMsg",args);
break;
case meebo.ApplicationRoom.MSG_TYPE_IM:gPubSub.publish(this,"meebo.ApplicationRoom::receiveIMMsg",msg);
break;
case meebo.ApplicationRoom.MSG_TYPE_HTML_IM:msg=this.sanitizeHtml(msg);
gPubSub.publish(this,"meebo.ApplicationRoom::receiveIMMsg",msg);
break
}};
this.sanitizeHtml=function(html){for(var i=0;
i<this.m_htmlSanitizeRegexps.length;
i++){html=html.replace(this.m_htmlSanitizeRegexps[i],"")
}html=html.replace(/<.*on\w+=('|")?.*('|")?\W>/gim,"");
html=html.replace(/<.*href=(?!http|"http|'http|https|"https|'https|mailto|"mailto|'mailto).*>/gim,"");
return html
};
this.getCaption=function(){var caption=this.getAlias();
var aliases=[];
for(var buddyId in this.m_presences){var presence=this.m_presences[buddyId];
if(presence.getBuddy().isYourself()||presence.isPending()||!presence.isOnline()){continue
}aliases.push(presence.getAlias())
}if(aliases.length){caption+=" ("+aliases.join(", ")+")"
}return caption
};
this.setJoinParams=function(time,hash){this.m_joinParams={time:time,hash:hash}
};
this.getJoinParams=function(){return this.m_joinParams
};
this.setLaunchTime=function(launchTime){this.m_launchTime=launchTime
};
this.getLaunchTime=function(){return this.m_launchTime
};
this.getLaunchId=function(){return this.m_launchId
};
this.setLaunchId=function(launchId){this.m_launchId=launchId
};
this.getAbandoned=function(){return this.m_bAbandoned
};
this.setAbandoned=function(abandoned){this.m_bAbandoned=abandoned
};
this.logLoadTime=function(name){var timeDelta=Math.floor((new Date().getTime()-this.getLaunchTime())/1000);
gNetworkMgr.doUILog("apps",(this.getInvites()?"launch":"join")+name,timeDelta,true,this.getApplication().app_id)
}
});
meebo.ApplicationRoom.MSG_TYPE_APP=0;
meebo.ApplicationRoom.MSG_TYPE_IM=1;
meebo.ApplicationRoom.MSG_TYPE_HTML_IM=2;
Class("meebo.ProtocolChat",meebo.Chat,function(a){this.initialize=function(d,c,b){a(this,"initialize",[c||d,b]);
this.m_type="protocolchat";
this.m_buddyParent=d;
this.m_alias=c
};
this.getId=function(){return getGroupChatId(this.getProtocol(),this.getUser(),this.m_chatid)
};
this.setName=function(c){if(this.m_name==c){return
}var e=gWindowMgr.getConvWindow(this);
if(e){var b=getIMId(c,this.m_logon);
var d=e.m_id;
if(b!=d){gWindowMgr.reregisterWindow(d,b);
e.m_id=b
}}this.m_name=c
};
this.getBuddyParent=function(){return this.m_buddyParent
};
this.getCaption=function(){return this.m_alias
};
this.isOnlist=function(){return true
};
this.isMember=function(){return false
}
});
Class("meebo.Presence",function(){this.initialize=function(b,a,c){this.m_buddy=b;
this.m_chat=a;
if(b&&a){b.m_presences[a.getId()]=this;
a.addPresence(this)
}this.m_alias=c;
this.m_joiner=null;
this.m_joinerProtocol=null;
this.m_isPending=false;
this.m_isOnline=false;
this.m_isOwner=false;
this.m_isSubModerator=false;
this.m_isMuted=false;
this.m_warnCount=0;
this.m_media=[];
this.m_appArgs={};
this.m_tree
};
this.getChat=function(){return this.m_chat
};
this.getBuddy=function(){return this.m_buddy
};
this.getAlias=function(){return this.m_alias||this.m_buddy.getAlias()
};
this.setAlias=createSetter("alias","meebo.Presence::changeAlias");
this.isPending=function(){return this.m_isPending
};
this.setPending=function(a){this.m_isPending=a
};
this.isOnline=function(){return this.m_isOnline
};
this.setOnline=createSetter("isOnline","meebo.Presence::changeOnline");
this.isOwner=function(){return this.m_isOwner
};
this.setOwner=createSetter("isOwner","meebo.Presence::changeOwner");
this.isSubModerator=function(){return this.m_isSubModerator
};
this.setSubModerator=createSetter("isSubModerator","meebo.Presence::changeSubModerator");
this.isMuted=function(){return this.m_isMuted
};
this.setMuted=function(a){this.m_isMuted=a
};
this.isMember=function(){return this.m_chat?this.m_chat.isMember(this.m_buddy):false
};
this.addMedia=function(a){this.m_media.push(a);
while(this.m_media.length>5){this.m_media.shift()
}};
this.getMedia=function(){return this.m_media
};
this.setWarnCount=function(a){this.m_warnCount=a>0?a:0
};
this.getWarnCount=function(){return this.m_warnCount
};
this.setAppArgs=function(a){this.m_appArgs=a
};
this.getAppArgs=function(){return this.m_appArgs
}
});
meebo.Prefs=function(){this.m_defaultIcon="defaultbuddyicon.gif";
this.m_icon;
this.m_savedPrefs={privacy:"allow_all",emoticons:true,audioSend:true,audioReceive:true,gchatlog:true,buddySort:"alias",font:{type:"Arial",size:11,color:"#000000",bBold:false,bItalics:false,bUnderline:false},nAwayMessages:4,awayMessage0:gLang.rightBack,awayMessage1:gLang.busy,awayMessage2:gLang.sleeping,awayMessage3:gLang.awayComputer,lastCustomAwayMessage:""};
this.m_dirtyPrefs={};
this.m_savedAccountPrefs={};
this.m_dirtyAccountPrefs={};
this.m_accounts={};
this.m_saveTimer=null;
gPubSub.subscribe("meebo.NetworkMgr::iconSet",this,hitch(this,"logBrandChange","buddy_icons"));
gPubSub.subscribe("meeboApp.ConsolePageMain::setWallpaper",this,hitch(this,"logBrandChange","wallpapers"))
};
meebo.Prefs.prototype.logBrandChange=function(f,b,a,c){var e;
var d;
if(c=="custom"){e="custom-upload";
d=false
}else{if(c&&(c.indexOf("http://")==0||c.indexOf("url")==0)){e=this.extractShareIdFromUrl(c,f);
d=true
}else{e="stock/"+c;
d=false
}}gNetworkMgr.doUILog(f,(d?"branded":"unbranded"),e,true)
};
meebo.Prefs.prototype.extractShareIdFromUrl=function(b,g){try{var f=b?b.split("/"+g+"/"):null;
var c=f&&f[0]?f[0].split("/").pop():null;
var a=f&&f[1]?f[1].split(".")[0]:null;
return c+"/"+a
}catch(d){return"/"
}};
meebo.Prefs.prototype.setIcon=function(a){if(this.m_icon==a){return
}this.m_icon=a;
gPubSub.publish(this,"meebo.Prefs::changeIcon",this.getIcon())
};
meebo.Prefs.prototype.getDefaultIcon=function(){return this.m_defaultIcon
};
meebo.Prefs.prototype.getIcon=function(){return this.m_icon||this.m_defaultIcon
};
meebo.Prefs.prototype.getAccountPref=function(a,d,b,c){var e=getLogonId(a,d);
if(!(e in this.m_accounts)){return c
}else{return(b in this.m_dirtyAccountPrefs[e]?this.m_dirtyAccountPrefs[e][b]:(b in this.m_savedAccountPrefs[e]?this.m_savedAccountPrefs[e][b]:c))
}};
meebo.Prefs.prototype.getPref=function(a,b){if(a.length>256){a=a.substr(0,256)
}return(a in this.m_dirtyPrefs?this.m_dirtyPrefs[a]:(a in this.m_savedPrefs?this.m_savedPrefs[a]:b))
};
meebo.Prefs.prototype.saveAccountPref=function(a,e,b,c){var f=getLogonId(a,e);
if(!(f in this.m_accounts)){this.m_accounts[f]={user:a,protocol:e,id:f};
this.m_savedAccountPrefs[f]={};
this.m_dirtyAccountPrefs[f]={}
}var d=false;
if(typeof c!="object"&&this.m_savedAccountPrefs[f][b]===c){d=b in this.m_dirtyAccountPrefs[f];
delete this.m_dirtyAccountPrefs[f][b]
}else{d=typeof c=="object"||c!==this.m_dirtyAccountPrefs[f][b];
this.m_dirtyAccountPrefs[f][b]=c
}return d
};
meebo.Prefs.prototype.savePref=function(a,b){var c=false;
if(a.length>256){a=a.substr(0,256)
}if(typeof b=="string"&&b.length>256){b=b.substr(0,256)
}if(typeof b!="object"&&this.m_savedPrefs[a]===b){c=a in this.m_dirtyPrefs;
delete this.m_dirtyPrefs[a]
}else{c=typeof b=="object"||b!==this.m_dirtyPrefs[a];
this.m_dirtyPrefs[a]=b
}if(c){clearTimeout(this.m_saveTimer);
this.m_saveTimer=setTimeout(hitch(this,"doPreferenceSync"),3000)
}return c
};
meebo.Prefs.prototype.doPreferenceSync=function(b){var a=this.serialiseLatestPrefs();
if(a){gNetworkMgr.doRequest("spref",a,null,b)
}};
meebo.Prefs.prototype.serialiseLatestPrefs=function(){if(!gLogon.getMeeboUser()){return""
}if(this.m_saveTimer){clearTimeout(this.m_saveTimer);
this.m_saveTimer=null
}var d={muser:gLogon.getMeeboUser(),nprefs:0};
for(var b in this.m_dirtyPrefs){var e=++d.nprefs;
var c=this.m_dirtyPrefs[b];
var a=getObjectAsString(c);
if(typeof c=="string"){while(a.length>256){c=c.substring(0,c.length-2);
a=getObjectAsString(c)
}}d[e+"pn"]=b;
d[e+"pv"]=a;
this.m_savedPrefs[b]=c;
delete this.m_dirtyPrefs[b]
}return d.nprefs?d:null
};
meebo.Prefs.prototype.onReceiveMeeboUserPrefs=function(a){this.onReceivePrefs(a);
if(!("nAwayMessages" in a)&&gIGClient.getClientType()!="cim-imbar"&&gIGClient.getClientType()!="none"){this.requestAwayMessagePrefs(this.getPref("nAwayMessages"))
}};
meebo.Prefs.prototype.onReceivePrefs=function(c){var e={};
var a=0;
for(var b in c){var d=c[b];
switch(b){case"wallpapers0":this.savePref(b,d);
if(d){gPubSub.publish(this,"meebo.Prefs::loadWallpaper",d.fullUrl)
}break;
case"meeboSkin":this.saveSkinPref(d);
break;
case"buddySort":this.saveBuddySortPref(d);
break;
case"audioSend":this.saveSoundPref(d,null);
break;
case"audioReceive":this.saveSoundPref(null,d);
break;
case"nAwayMessages":this.requestAwayMessagePrefs(d);
break;
case"longPrefs":this.requestLongPrefs(d);
break;
case"enableWallpaper":this.savePref(b,d);
if(d){break
}gPubSub.publish(this,"meebo.Prefs::loadWallpaper",null);
break;
default:if(b.match(/^awayMessage\d+/)){e[b]=d;
a++;
continue
}this.savePref(b,d)
}if(b in this.m_dirtyPrefs){this.m_savedPrefs[b]=this.m_dirtyPrefs[b];
delete this.m_dirtyPrefs[b]
}}if(a){this.receiveAwayMessagePrefs(a,e)
}gPubSub.publish(this,"meebo.Prefs::receivePrefs",c)
};
meebo.Prefs.prototype.receiveRoomPrefs=function(k,m,d,a){if(!d){return
}var g=[];
for(var e=0;
e<k.length;
e++){var q=k[e];
var f="room:"+q.getChatName();
if(!q.isOnlist()){g.push(q)
}var l=m[f];
if(!l){continue
}var o=this.getPref(f,{});
var p=false;
for(var c in o){if(!(c in l)||o[c]!=l[c]){p=true
}}for(var c in l){if(!(c in o)){o[c]=l[c]
}}if(!p){this.m_savedPrefs[f]=o;
delete this.m_dirtyPrefs[f]
}else{this.m_dirtyPrefs[f]=o;
delete this.m_savedPrefs[f]
}}if(g.length){var b=[];
var n=gBuddyList.getGroupByName(gLang.recentRooms);
if(n){b=n.getBuddies({type:"chat"});
b.sort(function(v,s){var t=gPrefs.getRoomPref(v.getChatName(),"lastAccess",0);
var u=gPrefs.getRoomPref(s.getChatName(),"lastAccess",0);
return t-u
})
}for(var e=0;
e<g.length;
e++){if(b.length>=5){var h=b.shift();
gNetworkMgr.requestRemoveBuddies({chat:h})
}var q=g[e];
gNetworkMgr.requestAddBuddy(hitch(gNetworkMgr,"receiveAddBuddy"),q.getName(),"jabber",gLang.recentRooms,q.getLogin().getName(),true)
}}};
meebo.Prefs.prototype.requestAwayMessagePrefs=function(c){var a=[];
for(var b=0;
b<c;
b++){a.push("awayMessage"+b)
}if(c>0){gNetworkMgr.requestPrefs(a)
}else{this.receiveAwayMessagePrefs(0,{})
}};
meebo.Prefs.prototype.receiveAwayMessagePrefs=function(e,b){for(var c=0;
c<e;
c++){var a="awayMessage"+c;
if(!(a in b)){continue
}this.m_savedPrefs[a]=b[a]||this.m_savedPrefs[a];
delete this.m_dirtyPrefs[a]
}var d=this.getPref("nAwayMessages");
for(d--;
d>=c;
d--){delete this.m_savedPrefs["awayMessage"+c];
delete this.m_dirtyPrefs["awayMessage"+c]
}delete this.m_dirtyPrefs.nAwayMessages;
this.m_savedPrefs.nAwayMessages=e;
gPubSub.publish(this,"meebo.Prefs::changeAwayMessages")
};
meebo.Prefs.prototype.saveAwayMessagePrefs=function(c,a){var d=this.getPref("nAwayMessages");
if(a<0||a>=d){if(!c){return
}this.savePref("nAwayMessages",d+1);
this.savePref("awayMessage"+d,c)
}else{if(c==""){for(var b=a;
b<(d-1);
b++){this.savePref("awayMessage"+b,this.getPref("awayMessage"+(b+1)))
}this.savePref("nAwayMessages",d-1)
}else{this.savePref("awayMessage"+a,c)
}}gPubSub.publish(this,"meebo.Prefs::changeAwayMessages")
};
meebo.Prefs.prototype.getCustomAwayMessages=function(){var c=this.getPref("nAwayMessages");
var a=[];
for(var b=0;
b<c;
b++){a.push(stripWhitespace(this.getPref("awayMessage"+b)))
}return a
};
meebo.Prefs.prototype.saveFontPref=function(a,b){var c=this.getPref("font");
c[a]=b;
this.savePref("font",c)
};
meebo.Prefs.prototype.saveBuddySortPref=function(a){if(this.savePref("buddySort",a)&&typeof gBuddyListDlg!="undefined"&&gBuddyListDlg){gBuddyListDlg.sortGroups(a)
}};
meebo.Prefs.prototype.saveSkinPref=function(a){if(this.savePref("meeboSkin",a)){gSkins.setSkin(a);
gNetworkMgr.doUILog("prefs","skin",a,false)
}};
meebo.Prefs.prototype.getLongPref=function(d){var c=this.getPref("longPrefs",{});
if(!(d in c)){return[]
}var b=[];
for(var a=0;
a<c[d];
a++){b.push(this.getPref(d+a))
}return b
};
meebo.Prefs.prototype.saveLongPref=function(d,c){for(var a=0;
a<c.length;
a++){if(this.m_savedPrefs[d+a]!=c[a]){this.savePref(d+a,c[a])
}}var b=this.getPref("longPrefs",{});
b[d]=c.length;
this.savePref("longPrefs",b)
};
meebo.Prefs.prototype.requestLongPrefs=function(c){var a=[];
for(prefName in c){for(var b=0;
b<c[prefName];
b++){a.push(prefName+b)
}}if(a.length>0){gNetworkMgr.requestPrefs(a)
}this.savePref("longPrefs",c)
};
meebo.Prefs.prototype.saveWallpaperPref=function(f,c,d){var a={thumbUrl:f,fullUrl:c};
if(d){a.title=d
}var e=this.getLongPref("wallpapers");
for(var b=e.length-1;
b>=0;
b--){if(!e[b]||(e[b].thumbUrl==f||e[b].fullUrl==c)){if(!a.title&&e[b]&&e[b].title){a.title=e[b].title
}e.splice(b,1)
}}e.unshift(a);
e=e.slice(0,6);
this.saveLongPref("wallpapers",e)
};
meebo.Prefs.prototype.getWallpaperPref=function(){return this.getLongPref("wallpapers")
};
meebo.Prefs.prototype.saveBuddyIconPref=function(c){var b=this.getLongPref("buddyIcons");
for(var a=b.length-1;
a>=0;
a--){if(b[a]==c){b.splice(a,1)
}}b.unshift(c);
b=b.slice(0,6);
this.saveLongPref("buddyIcons",b)
};
meebo.Prefs.prototype.getBuddyIconPref=function(){return this.getLongPref("buddyIcons")
};
meebo.Prefs.prototype.saveSoundPref=function(c,b){if(typeof c!="boolean"){c=this.getPref("audioSend")
}if(typeof b!="boolean"){b=this.getPref("audioReceive")
}var d=!(this.getPref("audioSend")||this.getPref("audioReceive"));
var a=(this.getPref("audioSend")!=c||this.getPref("audioReceive")!=b);
if(typeof gAudioBtn!="undefined"&&gAudioBtn&&a){if(!(c||b)){gAudioBtn.m_element.sound=false;
util.cookie.save("sound",gAudioBtn.m_element.sound);
gAudioBtn.m_imageBase="buttons/noaudio";
gSounds.mute();
gAudioBtn.refreshImage()
}else{if(d){gAudioBtn.m_element.sound=true;
util.cookie.save("sound",gAudioBtn.m_element.sound);
gAudioBtn.m_imageBase="buttons/audio";
gSounds.unmute();
gAudioBtn.refreshImage()
}}}this.savePref("audioSend",c);
this.savePref("audioReceive",b)
};
meebo.Prefs.prototype.getRoomPref=function(d,a,c){var b="room:"+d;
var e=this.getPref(b,{});
return(a in e?e[a]:c)
};
meebo.Prefs.prototype.saveRoomPref=function(d,a,c){if(!d||d.constructor!=meebo.Room){return
}var b="room:"+d.getChatName();
var e=this.getPref(b,{});
e[a]=c;
return this.savePref(b,e)
};
meebo.Prefs.prototype.updateRoomLastAccess=function(a){this.saveRoomPref(a,"lastAccess",Math.floor(new Date().getTime()/1000))
};
meebo.Widgets=function(){this.m_widgets=null;
this.m_defParams={d:false}
};
meebo.Widgets.prototype.requestWidgets=function(){gNetworkMgr.doRequest("gwid",{muser:gLogon.getMeeboUser()},hitch(this,"receiveWidgets"))
};
meebo.Widgets.prototype.receiveWidgets=function(b,a,c){if(!b){return false
}this.m_widgets=b;
for(var d in this.m_widgets){this.m_widgets[d].a=null;
this.m_widgets[d].blc=null;
this.m_widgets[d].bfc=null;
this.m_widgets[d].tbc=null;
this.m_widgets[d].tbc2=null;
this.m_widgets[d].tbc3=null;
this.m_widgets[d].tbc4=null;
this.m_widgets[d].tbtc=null;
this.m_widgets[d].hbfc=null;
this.m_widgets[d].ibfc=null;
this.m_widgets[d].sbfc=null;
this.m_widgets[d].dtc=null
}return true
};
meebo.Widgets.prototype.addWidget=function(d,a,e,f){var b=gLogon.getMeeboUser();
if(!b){return
}var c={o:b,i:d,d:0,npairs:2,"1n":"w","1v":a,"2n":"h","2v":e};
gNetworkMgr.doRequest("mmc",c,hitch(this,"onAdd",{n:d,w:a,h:e,c:f}))
};
meebo.Widgets.prototype.onAdd=function(e,c,b,f){var d=false;
if(b&&c.length==10){d=true;
var a=new Object();
a.n=e.n;
a.w=e.w;
a.h=e.h;
a.d=false;
a.a=null;
a.blc=null;
a.bfc=null;
a.tbc=null;
a.tbc2=null;
a.tbc3=null;
a.tbc4=null;
a.tbtc=null;
a.hbfc=null;
a.ibfc=null;
a.sbfc=null;
a.dtc=null;
if(!this.m_widgets){this.m_widgets=new Object()
}this.m_widgets[c]=a
}if(e.c){e.c(d,d?"":c,d?c:"",e.n,e.w,e.h)
}};
meebo.Widgets.prototype.deleteWidgets=function(f,g){if(!f||!f.length||!this.m_widgets){if(g){g(true,"")
}return
}var b=gLogon.getMeeboUser();
if(!b){return
}var c={o:b};
var e=0;
for(var d=0;
d<f.length;
d++){var a=this.m_widgets[f[d]];
if(!a){continue
}e++;
c[e+"h"]=f[d];
c[e+"i"]=a.n
}c.nhs=e;
if(e>0){gNetworkMgr.doRequest("mmd",c,hitch(this,"onDelete",{hl:f,c:g}))
}};
meebo.Widgets.prototype.onDelete=function(e,a,c,f){var d=false;
if(!c.length){d=true;
for(var b=0;
b<e.hl.length;
b++){if(this.m_widgets[e.hl[b]]){delete this.m_widgets[e.hl[b]]
}}}if(e.c){e.c(d,d?"":c)
}};
meebo.Widgets.prototype.modifyWidget=function(d,c){var a=getMyMeeboId();
if(gWindows[a]){var b=gWindows[a];
if(b.m_delegate.m_meeboMePaneContent){b.m_delegate.m_meeboMePaneContent.updateWidget(d,c)
}}};
meebo.Widgets.prototype.updateWidgets=function(l,m){if(!l||!this.m_widgets){if(m){m(true,"")
}return
}var h=gLogon.getMeeboUser();
if(!h){return
}var g={o:h};
var k=1;
var a=this.copyWidgets();
for(var e in l){if(!this.m_widgets[e]){continue
}var b=l[e];
var f=this.m_widgets[e];
var n=0;
var d=false;
for(var c in f){if(isDefined(b[c])&&b[c]!=f[c]){d=true;
if(c!="d"&&c!="n"){n++;
g[k+"n"+n]=c;
g[k+"v"+n]=b[c]
}a[e][c]=b[c]
}}if(d){g[k+"i"]=b.n;
g[k+"d"]=b.d?"true":"false";
g[k+"h"]=e;
g[k+"npairs"]=n;
k++
}}if(k>1){g.nhs=k-1;
gNetworkMgr.doRequest("mmw",g,hitch(this,"onUpdate",{wi:a,c:m}))
}else{if(m){m(true,"")
}}};
meebo.Widgets.prototype.onUpdate=function(d,b,a,e){var c=false;
if(!b.length){c=true;
this.m_widgets=d.wi
}if(d.c){d.c(c,c?"":b)
}};
meebo.Widgets.prototype.getWidgets=function(){return this.m_widgets
};
meebo.Widgets.prototype.copyWidgets=function(){if(!this.m_widgets){return null
}var b=new Object();
for(var c in this.m_widgets){if(!this.m_widgets[c]){continue
}var a=this.m_widgets[c];
b[c]=new Object();
for(var d in a){b[c][d]=a[d]
}}return b
};
meebo.Widgets.prototype.hasWidgets=function(){if(!this.m_widgets){return false
}return !isEmpty(this.m_widgets)
};
Class("meebo.Targeting",lib.Publisher,function(a){this.initialize=function(){a(this,"initialize");
this.m_targeting={};
gPubSub.subscribe("meebo.EventMgr::changeState",this,"onChangeState")
};
this.setTargeting=function(d,b){if(b=="lookery"){d=this.convertFromLookery(d);
util.cookie.save("tdata",JSON.stringify(d),30*24*60*60*1000)
}for(key in d){if(key in this.m_targeting){continue
}this.m_targeting[key]=d[key]
}if("age" in this.m_targeting&&!("age_bucket" in this.m_targeting)){var c=this.m_targeting.age,e=null;
if(c>=55){e="55over"
}else{if(c>=50){e="50-54"
}else{if(c>=45){e="45-49"
}else{if(c>=35){e="35-44"
}else{if(c>=25){e="25-34"
}else{if(c>=21){e="21-24"
}else{if(c>=18){e="18-20"
}else{if(c>=16){e="16-17"
}else{if(c>=13){e="13-15"
}}}}}}}}}if(!e){delete this.m_targeting.age
}else{this.m_targeting.age_bucket=e
}}};
this.getTargeting=function(){return this.m_targeting
};
this.hasFullTargeting=function(){return"age" in this.m_targeting&&"gender" in this.m_targeting
};
this.onChangeState=function(d,b,e,c){if(c=="connecting"&&e=="im"){gPubSub.unsubscribe("meebo.EventMgr::changeState",this);
this.m_targetingTimeout=setTimeout(hitch(this,"setTargetingFromEvents",{}),4000)
}};
this.setTargetingFromEvents=function(b){clearTimeout(this.m_targetingTimeout);
this.setTargeting(b);
if(!this.hasFullTargeting()){this.setTargeting(this.getTargetingFromCookie())
}if(!this.hasFullTargeting()&&gCountry=='US'){this.getTargetingFromLookery()
}gNetworkMgr.doUILog("meebo","demographic","age:"+this.m_targeting.age+",gender:"+this.m_targeting.gender,true);
this.publish("ready")
};
this.getTargetingFromCookie=function(){targeting=util.cookie.load("tdata");
return targeting?JSON.parse(targeting):{}
};
this.getTargetingFromLookery=function(){var b=document.createElement("script");
b.type="text/javascript";
b.src="http://services.lookery.com/targeting?v=2&format=json&api_key=7a871621030949624effc9c5a4c7b102&callback=setLookeryTargeting";
document.getElementsByTagName("head")[0].appendChild(b)
};
this.convertFromLookery=function(b){if(!("demographics" in b)){return{}
}var c=b.demographics;
return{age:c.age,gender:c.gender&&(c.gender==1?"m":"f")}
}
});
function setLookeryTargeting(a){gTargeting.setTargeting(a,"lookery")
}meebo.util={};
meebo.util.isICQ=function(b){if(!b||!b.length||isEmail(b)){return false
}var c=b.charAt(0);
var a=parseInt(c,10);
if(isNaN(a)){return false
}return true
};
meebo.util.padRoomName=function(a){return a+decToHex(String(new Date().getTime())+String(Math.ceil(Math.random()*1000)))
};
meebo.util.accessByIP=function(){var b=String(document.location.host);
var a=/.+\.meebo\.com/i;
return a.exec(b)==null
};
meebo.util.normalizeRoomName=function(a){if(a){return a.replace(/[^\w]+/g,"").toLowerCase()
}};
meebo.util.normalizeGroupName=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," ")
};
meebo.util.isValidGroupName=function(a){a=meebo.util.normalizeGroupName(a);
if(a.length>50){return false
}return true
};
meebo.util.getDefaultGroup=function(e){var d;
switch(String(e)){case"yahoo":d="Friends";
break;
case"msn":d="Individuals";
break;
case"meebome":d="meebome";
break;
default:d="Buddies"
}var b=gBuddyList.getGroups();
for(var a=0,c;
(c=b[a]);
a++){if(c.getName().toLowerCase()==d.toLowerCase()){d=c.getName();
break
}}return d
};
meebo.util.stripJabber=function(a){if(!a){return""
}var b=a.indexOf("/");
if(b!=-1){var c=a.substr(0,b);
if(!gBuddyList.isJabberGroup(c)){a=c
}}return a
};
meebo.util.stripMeebo=function(b){var a=b.indexOf("@meebo.org");
if(a>-1){return b.substr(0,a)
}return b
};
meebo.util.isMeeboGroupChat=function(a,b){return b=="meebome"&&/@conference.gc\d*.meebo.org$/i.test(a)
};
meebo.util.splitGroupChatName=function(b){var a=b.split("@");
return{id:a[0],server:a[1]}
};
meebo.util.isDefaultGroupChatGroup=function(a){return(a=="meebo chatrooms")
};
meebo.util.getMeeboGroupChatLink=function(c){var b=/https?\:\/\/(.+\.meebo\.com|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\/room\/([^\/]+)\/(#.*)?([^a-zA-Z]|$)/i;
var a=b.exec(c);
if(a&&a[2]){return a[2]
}b=/https?\:\/\/(.+\.meebo\.com|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\/user\/([^\/]+)\/room\/(#.*)?([^a-zA-Z]|$)/i;
a=b.exec(c);
if(a&&a[2]){return"__"+a[2]
}return null
};
meebo.util.getMeeboApplicationLink=function(c){var b=/https?\:\/\/(.+\.meebo\.com|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\/app\/([^\/]+)\/(#.*)?([^a-zA-Z]|$)/i;
var a=b.exec(c);
if(a&&a[2]){return a[2]
}return null
};
meebo.util.getMeeboShareLink=function(c){var b=/^https?:\/\/[^\/]*\.meebo\.com\/share\/([^\/#]*)/;
var a=b.exec(c);
if(a&&a[1]){return a[1]
}return null
};
meebo.util.generateMeeboShareLink=function(a){return"http://www.meebo.com/share/"+a
};
meebo.util.getOriginContentPath=function(){return"http"+(ui.isHttps?"s":"")+"://"+((ui.isHttps||meebo.util.accessByIP())?"origin-":"")+"share.meebo.com/content/"
};
meebo.util.getWallpaperUrl=function(c,a,b){b=b||"1024x768";
return meebo.util.getOriginContentPath()+c+"/wallpapers/"+b+"/"+a+".jpg"
};
meebo.util.getWallpaperThumbUrl=function(b,a){return meebo.util.getWallpaperUrl(b,a,"67x50")
};
meebo.util.getWallpaperPreviewUrl=function(b,a){return meebo.util.getWallpaperUrl(b,a,"130x98")
};
meebo.util.createAccount=function(d,f,c){d=stripWhitespace(d);
if(!d){return gLang.noName
}if(!c){return gLang.noPass
}if(f=="meebo"){f="meebome"
}f=gNetworks[f];
if(f.isCIMPartner()){return gLogon.addCIMAccount(d,c,f)
}var e=meebo.util.normalizeLogon(d,f,c);
if(e.error){return error
}d=e.name,f=e.network;
if(f=="meebome"){d=meebo.util.stripMeebo(d);
var a=new meebo.MeeboAccount(d,c);
gLogon.setMeeboUser(d,c,"pending");
return a
}var b=gLogon.addLogon(d,f);
b.setPassword(c);
return b
};
meebo.util.normalizeLogon=function(d,e,c){if(e=="meebo"){e="meebome"
}e=gNetworks[e];
if(e){switch(e.getId()){case"gtalk":case"jabber":case"meebome":var a=(d||"").replace(/^[^@]*@/,"").replace(/\/.*$/,"");
for(var f in gNetworks){f=gNetworks[f];
if(f.getProtocol().isJabberBased()&&a in arrayToObject(f.getDomains())){e=f;
break
}}break
}}if(!d){var b=gLang.noName
}else{if(d.indexOf("@")==-1&&e.getDomains().length){d=normalizeString(d+"@"+e.getDomains()[0])
}if(e=="yahoo"){d=d.replace(/@yahoo\.com$/i,"")
}}if(!b&&typeof c=="string"&&!c){b=gLang.noPass
}return{error:b,name:d,network:e}
};
meebo.util.parse33xCookie=function(){var d=[];
var g=util.cookie.load("33x_rs")||"";
b=g.replace(/"/g,"").split(":");
for(var e=0,b;
(piece=b[e]);
e++){var f=piece.split("=");
if(f[0]=="s2.5"){var a=f[1].split(",");
for(var c=0;
c<a.length;
c++){if(!a[c]){continue
}d.push(a[c])
}break
}}return d
};
meebo.util.createTrackingPixel=function(a,c,d){if(c){if(!(c instanceof Array)){c=[c]
}for(var b=0;
b<c.length;
b++){a["ln"+b]=c[b].getName();
a["lp"+b]=c[b].getProtocol()
}}if(d){if(!(d instanceof Array)){d=[d]
}for(var b=0;
b<d.length;
b++){a["bn"+b]=d[b].getName();
a["bp"+b]=d[b].getProtocol()
}}new ui.TrackingPixel(a)
};
function getMeeboChatId(a){return a&&normalizeString(a.split("@")[0]).replace(/["&\\\/:<>@]/g,"")
}function getBuddyId(b,a){return normalizeString(b)+"-"+a.getId()+"brow"
}function parseBuddyId(c){var b=c.indexOf("-");
var a=parseLogonId(c.substring(b+1,c.length-4));
if(a==null){return null
}a.name=c.substring(0,b);
return a
}function getCIMAccountId(b,a){return a+"-"+meebo.util.stripJabber(b)
}function getGroupChatId(c,a,b){return normalizeString(c)+"@"+a+"@"+b
}function getBuddyGroupId(a){return compressSpaces(a).toLowerCase()+"bgroup"
}function getIMId(b,a){var c=a.getProtocol();
if(meebo.util.isMeeboGroupChat(b,a.getNetwork())){b=meebo.util.splitGroupChatName(b).id
}else{if(c=="msn"){if(b.indexOf("@")==-1){b+="@hotmail.com"
}}else{if(c.isJabberBased()){b=meebo.util.stripJabber(b)
}}}return c+"-"+normalizeString(b)+":"+normalizeString(a.getName())+"-im"
}function getLogonId(a,b){if(b=="msn"){if(a.indexOf("@")==-1){a+="@hotmail.com"
}}else{if(gProtocols[b].isJabberBased()){a=meebo.util.stripJabber(a)
}}return normalizeString(a)+"-"+normalizeString(b)
}function parseLogonId(c){var b=c.indexOf("-");
var a=c.substring(b+1);
if(a in gProtocols){return{user:c.substring(0,b),protocol:a}
}return null
}meebo.util.message={};
meebo.util.message.parseIMHistory=function(l){var g=new RegExp("<br/><hr size=1><div class='ImChatHeader'>([a-zA-Z]+), (\\d{4}) ([a-zA-Z]+) (\\d+) &#40;(\\d{2}):(\\d{2}):(\\d{2})&#41;</div><hr size=1>");
var k={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11};
var d=[];
while(true){var h=l.match(g);
if(!h){if(l){d.push(l)
}break
}var c=new Date(parseInt(h[2],10),k[h[3]],parseInt(h[4],10),parseInt(h[5],10),parseInt(h[6],10),parseInt(h[7],10));
var b=l.substr(0,h.index);
var n=l.substr(h.index+h[0].length);
if(b){d.push(b)
}d.push(c);
l=n
}var e=new RegExp("<span class='([a-zA-Z]+)'>\\[(\\d{2}):(\\d{2})\\] ([^>]+)</span>: (.+)<br/>\\n");
for(var f=0;
f<d.length;
f++){var l=d[f];
if(typeof l!="string"){continue
}d.splice(f,1);
while(true){var h=l.match(e);
if(!h){if(l){d.splice(f++,0,l)
}break
}var m=h[1]=="ImSend";
var c=new Date(0);
c.setHours(parseInt(h[2],10));
c.setMinutes(parseInt(h[3],10));
var a=h[4];
var o=h[5];
var b=l.substr(0,h.index);
var n=l.substr(h.index+h[0].length);
if(b){d.splice(f++,0,b)
}d.splice(f++,0,{isSender:m,nick:a,date:c,message:o});
l=n
}}return d
};
meebo.util.message.fixRoomHistoryDates=function(h){var f=/\[(\d*)-(\d*)-(\d*) (\d*):(\d*):(\d*)\]/g;
var c;
var e=new Date(0);
while(c=f.exec(h)){var g=new Date(0);
g.setUTCFullYear(parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10));
g.setUTCHours(parseInt(c[4],10));
g.setUTCMinutes(parseInt(c[5],10));
g.setUTCSeconds(parseInt(c[6],10));
var b="";
if(g.getFullYear()!=e.getFullYear()||g.getMonth()!=e.getMonth()||g.getDate()!=e.getDate()){b='<span><hr><div class="ImChatHeader">'+sprintf(gLang.dateFormat,getDayOfTheWeekString(g.getDay()),getMonthString(g.getMonth()),g.getDate(),g.getFullYear())+"</div><hr></span>";
e.setTime(g.getTime())
}var a=g.getHours()<10?"0"+g.getHours():g.getHours();
var d=g.getMinutes()<10?"0"+g.getMinutes():g.getMinutes();
b+="["+a+":"+d+"]";
h=h.substr(0,f.lastIndex-c[0].length)+b+h.substr(f.lastIndex);
f.lastIndex-=c[0].length-b.length
}return h
};
meebo.util.message.fixRoomHistoryMessages=function(a){a=a.replace(/(\[\d{2}:\d{2}\]) --- (.*) has joined/g,gLang.buddyJoinChatRegExp);
a=a.replace(/(\[\d{2}:\d{2}\]) --- (.*) has left/g,gLang.buddyLeaveChatRegExp);
a=a.replace(/(\[\d{2}:\d{2}\]) --- (.*) is now known as (.*)/g,gLang.buddyNameChangeRegExp);
return a
};
meebo.util.emoticons={};
meebo.util.emoticons.images={smile:["(smile)",":)",":-)","=)","=-)"],big_smile:[":D",":-D","(grin)"],cool:["B)","B-)","8)","8-)","(cool)"],smug:[":>",":->"],pirate:[":pirate:","(arr)","(arrr)","(pirate)","P)"],wink:[";)",";-)","(wink)"],lol:["(lol)","x-D","X-D",":))"],tongue:[":P",":-P",":p",":-p"],wink_tongue:[";P",";-P",";p",";-p"],confused:[":S",":-S",":s",":-s",":?",":-?"],kiss:[":*",":-*"],yikes:[":o",":O",":-o","(eek)","(shock)","(yikes)"],neutral:[":|",":-|","(neutral)"],disappoint:[":T",":-T"],oops:[":x",":X",":-X",":-x"],sad:[":(",":-(","(sad)"],happy_tear:[":'D"],upset:[":<",":-<"],hmm2:[":\\",":-\\"],hmm:["(hmm)"],emo:["//:|","(emo)"],rapper:["(rapper)"],peace:[":)>-"],ninja:["(ninja)"],skull:["(skull)"],pacman:["(pacman)"],ghost:["(ghost)"],monkey:[":(|)","(m)","8(|)"],panda:["(panda)"],pig:[":@)"],angel:["O:)","O:-)","o:)","o:-)","(angel)"],angry:["(angry)",">:o",">:O",">:-o",">:-O"],arrow:[":arrow:"],beaten:["(beaten)","b-("],cry:[":((",":-((",":'(","(cry)"],evil:["(devil)","(evil)",">>:)",">:)",">>:-)",">:-)"],exclaim:[":!:"],hug:[">:D<","(hug)"],liar:["(liar)",":^o",":^O"],loser:["(loser)","L-)"],love:["(love)","(L)","(l)"],mad:[">>:(",">:(",">>:-(",">:-(","X(","X-(","x(","x-(","(mad)"],meebo:[":meebo:","(meebo)","*meebo*"],money:["(money)","$-)","$)"],nerd:["(nerd)",":-B",":B",":-b",":b"],omg:["(O_O)","(O.O)"],party:["(party)","<:-p","<:o)","<:-P"],question:["(?)"],roll:["(roll)","(rolleyes)"],rose:["(r)","@};-"],"rose-dead":["(w)"],sarcasm:["(sarcasm)","/:)","/:-)"],sick:["(sick)",":-&","+o("],sleepy:["(sleepy)","|-)"],soccer:["(so)"],ssssh:[":-#"],star:["(*)"],"thumb-down":["(n)"],"thumb-up":["(y)"],unlove:["(unlove)","(U)","(u)"],bender:["(bender)"],genderbender:["(genderbender)"],"nerd-pirate":["(nerdpirate)"],oogly:["(o.O)","(O.o)"],doraemon:["(doraemon)"],frisbee:["(ultimatefrisbee)"],tare:["(tarepanda)"],foursquare:["(foursquare)"],rockyou:["(rockyou)"],plaxo:["(plaxo)"],fingerblaster:["(fingerblaster)"],cheezburger:["(cheezburger)"],lolwut:["(lolwut)"],fail:["(fail)"],brainslug:["(brainslug)"],beetle:["(vw)"],monkeyking:["(monkeyking)"],grillz:["(grillz)"],letsgogiants:["(letsgogiants)"],meebosimon:["(simon)","(meebosimon)"],mom:["(mom)"],pilot:["(pilot)"],prosopagnosiac:["(prosopagnosiac)"],r2d2:["(r2d2)"],sadpanda:["(sadpanda)"]};
meebo.util.emoticons.compileEmoticons=function(){var a=this.images;
var m=[];
for(var c in a){var k=a[c];
c+=".gif";
for(var e=0,h;
(h=k[e]);
e++){h=h.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;");
m.push({emoticon:h,image:c});
if(h.search(/\'\"/)){m.push({emoticon:h.replace(/\'/g,"&apos;").replace(/\"/g,"&quot;"),image:c})
}}}meebo.util.emoticons.emoticons={};
for(var e=0;
e<m.length;
e++){this.emoticons[m[e].emoticon]=m[e].image
}function g(){this.count=0;
this.end=false;
this.children={}
}var l=new g();
var b,f,d;
for(var e=0;
e<m.length;
e++){b=l;
for(d=0;
d<m[e].emoticon.length;
d++){f=m[e].emoticon.charAt(d);
if(!(f in b.children)){b.children[f]=new g();
b.count++
}b=b.children[f]
}b.end=true
}this.regex=new RegExp(this.buildExpression(l)+"|(&.*?;)","g")
};
meebo.util.emoticons.buildExpression=function(a){var d="";
var c=true;
for(var b in a.children){c?(c=false):d+="|";
if(b.match(/\W/)){d+="\\"
}d+=b;
if((a.children[b].count>1)||(a.children[b].end&&(a.children[b].count>0))){d+="("+this.buildExpression(a.children[b])+")"
}else{d+=this.buildExpression(a.children[b])
}if(a.children[b].end&&(a.children[b].count>0)){d+="?"
}}return d
};
meebo.util.emoticons.compileEmoticons();
meebo.util.emoticons.insertMeeboEmoticons=function(b){var d=[];
var c;
if((c=b.match(/^\<.*?\>\(auto\-response from .*?\)/))!=null){d.push("");
d.push(c[0]);
b=b.substring(c.index+c[0].length)
}while((c=b.match(/(\<a.*?\<\/a\>)|(\<.*?\>)/))!=null){d.push(b.substring(0,c.index));
d.push(c[0]);
b=b.substring(c.index+c[0].length)
}d.push(b);
for(var a=0;
a<d.length;
a+=2){d[a]=d[a].replace(this.regex,function(e){if(e in meebo.util.emoticons.emoticons){return meebo.util.emoticons.getMeeboEmoticon(meebo.util.emoticons.emoticons[e],e)
}return e
})
}b=d.join("");
return b
};
meebo.util.emoticons.getMeeboEmoticon=function(a,b){return'<img height="18" alt="'+b.replace("'","&apos;").replace('"',"&quot;")+'" src="'+gConfig.getMeeboAppImageURL("emoticons/"+a)+'">'
};
meebo.util.platform={getChannelId:function(b,a){a=a||"";
return"meebo"+a+"Channel"+b
},getAppChannelBase:function(a){return meebo.util.platform.getChannelId(a,"App")
},getTrayChannelBase:function(){return"SecureMeeboTrayChannel"
},getPlatformChannelBase:function(a){return meebo.util.platform.getChannelId(a,"Platform")
},getSecureChannelBase:function(){return"SecureMeeboChannel"
},generateAuthenticityHash:function(){return"hash"
},blastChannels:function(c,e,b,d){for(var a=1;
a<=5;
a++){e.sendMessage(c+"_"+a,b,d)
}},APP_TYPE_SINGLE:"APP_TYPE_SINGLE",APP_TYPE_MULTI:"APP_TYPE_MULTI",CMD_ECHO:"CMD_ECHO",CMD_APP_MSG:"CMD_APP_MSG",CMD_IM_MSG:"CMD_IM_MSG",CMD_IM_HTML_MSG:"CMD_IM_HTML_MSG",CMD_REQG_BUDDY_ICON:"CMD_REQG_BUDDY_ICON",CMD_REQG_WALLPAPER:"CMD_REQG_WALLPAPER",CMD_REQG_STATUS_MESSAGE:"CMD_REQG_STATUS_MESSAGE",CMD_REQG_ALIAS:"CMD_REQG_ALIAS",CMD_REQG_SHARE_LIST:"CMD_REQG_SHARE_LIST",CMD_REQS_BUDDY_ICON:"CMD_REQS_BUDDY_ICON",CMD_REQS_WALLPAPER:"CMD_REQS_WALLPAPER",CMD_REQS_STATUS_MESSAGE:"CMD_REQS_STATUS_MESSAGE",CMD_REQP_SHARE:"CMD_REQP_SHARE",CMD_REQP_INVITE:"CMD_REQP_INVITE",CMD_TRACK_AD:"CMD_TRACK_AD",CMD_SEND_MSG:"CMD_SEND_MSG",EVT_APP_MSG:"EVT_APP_MSG",EVT_IM_MSG:"EVT_IM_MSG",EVT_IM_HTML_MSG:"EVT_IM_HTML_MSG",EVT_JOIN:"EVT_JOIN",EVT_LEAVE:"EVT_LEAVE",EVT_OPEN:"EVT_OPEN",EVT_DEACTIVE:"EVT_DEACTIVE",EVT_CLOSE:"EVT_CLOSE",SCMD_REQG_SESSION_INFO:"SCMD_REQG_SESSION_INFO",SCMD_ATTACH:"SCMD_ATTACH",SCMD_PING:"SCMD_PING",SCMD_ADD_BUDDY:"SCMD_ADD_BUDDY",SEVT_SESSIONKEY_CHANGE:"SEVT_SESSIONKEY_CHANGE",SEVT_MEEBO_ACCOUNT_CREATED:"SEVT_MEEBO_ACCOUNT_CREATED"};
Class("meebo.util.FlashMessageBridge",function(){var b=document.location.protocol;
var a=(document.location.protocol=="https:"?"origin-platformapi":"platformapi")+".meebo.com";
this.swfUrl=b+"//"+a+"/js/JsToLocalConnectionBridge.swf";
this.initialize=function(d,c){this.m_id="flashBridge_"+getUniqueId();
meebo.util.FlashMessageBridge.bridges[this.m_id]=this;
this.m_channelBase=d;
this.m_readyCallbacks=[];
this.m_ready=false;
this.m_callbackManager=new lib.CallbackManager();
this.m_messageHandler=c
};
this.getFlashInterface=function(){var c;
if(ui.isIE){c=window[this.m_id]
}else{if(ui.isSafari){c=document.getElementById(this.m_id)
}else{c=document[this.m_id]
}}return c
};
this.create=function(d,g){if(gFlashVersion.major<8){return
}var f=this.swfUrl;
if(g){f+="?"+new Date().getTime()
}var c;
if(ui.isIE){c='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="'+this.m_id+'" name="'+this.m_id+'" width="1" height="1" align="middle" data="'+f+'"><param name="movie" value="'+f+'" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="FlashVars" value="readyHandlerName=meebo.util.FlashMessageBridge.bridges.'+this.m_id+".onInterfaceReady&messageHandlerName=meebo.util.FlashMessageBridge.bridges."+this.m_id+".giveMessage&responseHandlerName=meebo.util.FlashMessageBridge.bridges."+this.m_id+".giveResponse&channelBase="+this.m_channelBase+'" /></object>'
}else{c='<embed src="'+f+'" quality="high" width="1" height="1" swLiveConnect="true" id="'+this.m_id+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" flashvars="readyHandlerName=meebo.util.FlashMessageBridge.bridges.'+this.m_id+".onInterfaceReady&messageHandlerName=meebo.util.FlashMessageBridge.bridges."+this.m_id+".giveMessage&responseHandlerName=meebo.util.FlashMessageBridge.bridges."+this.m_id+".giveResponse&channelBase="+this.m_channelBase+'" />'
}var e=document.createElement("div");
e.style.position="absolute";
e.style.top="1px";
e.style.left="1px";
e.style.zIndex=99999999;
e.innerHTML=c;
d.appendChild(e)
};
this.getChannel=function(){return this.m_channelId
};
this.onInterfaceReady=function(c){this.m_channelId=c;
this.m_ready=true;
doFunctions.call(this,this.m_readyCallbacks);
this.m_readyCallbacks=[]
};
this.ensureReady=function(c){if(this.m_ready){c.call(this)
}else{this.m_readyCallbacks.push(c)
}};
this.sendMessage=function(e,d,c){this.ensureReady(function(){var f;
if(c){f=this.m_callbackManager.scheduleCallback(c)
}setTimeout(hitch(this,function(){try{this.getFlashInterface().giveMessage(e,d,f)
}catch(g){this.m_ready=false;
this.m_readyCallbacks.push(hitch(this,"sendMessage",e,d,c))
}}),0)
})
};
this.giveResponse=function(d,c){setTimeout(hitch(this.m_callbackManager,"executeCallback",d,c),0)
};
this.giveMessage=function(d,e){var c;
if(e){c=hitch(this,function(f){this.getFlashInterface().giveResponse(e,f)
})
}setTimeout(hitch(this,this.m_messageHandler,d,c),0)
}
});
meebo.util.FlashMessageBridge.bridges={};
Class("meebo.util.SecureFlashMessageBridge",meebo.util.FlashMessageBridge,function(){this.swfUrl=window.location.protocol+"//"+window.location.hostname+"/flash/SecureJsToLocalConnectionBridge.swf"
});
Class("meebo.Platform",function(){this.initialize=function(){this.m_instanceId="Platform"+Math.floor(Math.random()*100000);
this.m_commandHandlers={};
this.initBridge();
this.initCommandHandlers()
};
this.initBridge=function(){var a=meebo.util.platform.getPlatformChannelBase(this.getPlatformInstanceId());
this.m_bridge=new meebo.util.FlashMessageBridge(a,hitch(this,"handleCommand"))
};
this.openBridge=function(a){this.m_bridge.create(a)
};
this.initCommandHandlers=function(){this.setCommandHandler(meebo.util.platform.CMD_ECHO,hitch(this,function(b,c,a){a(b)
}))
};
this.launchApplication=function(b,a){if(this.m_appInfos[b]){var c=this.createAppFromInfo(this.m_appInfos[b]);
c.launch();
a(c)
}else{gNetworkMgr.doRequest("mainfo",{app_id:b},hitch(this,"onAppInfo",function(d,f){this.m_appInfos[b]=d;
var e=this.createAppFromInfo(this.m_appInfos[b]);
e.launch();
a(e)
}))
}};
this.createAppFromInfo=function(a){if(a.type==meebo.util.platform.APP_TYPE_SINGLE){var b=new meebo.ApplicationSingle(a)
}else{var b=new meebo.Application(a);
gPubSub.subscribe(room,"meebo.ApplicationRoom::receiveAppMsg",this,"handleAppMessageFromServer",b)
}return b
};
this.getPlatformInstanceId=function(){return this.m_instanceId
};
this.getChannel=function(){return this.m_bridge.getChannel()
};
this.setCommandHandler=function(b,a){if(!meebo.util.platform[b]){throw ("No such command "+b)
}this.m_commandHandlers[b]=a
};
this.setResponseHandler=function(b,a){this.setCommandHandler(b,function(d,c){c(a(d))
})
};
this.handleCommand=function(c,b){var d=c.command;
var a=c.appInstanceId;
if(this.m_commandHandlers[d]){this.m_commandHandlers[d](c.data,b)
}};
this.handleAppMessageFromApp=function(b,a){a.getRoom().sendMsg(b.msg,meebo.util.platform.APP_MSG,b.to)
};
this.handleAppMessageFromServer=function(e,d,a,c){var b=meebo.util.platform.getAppChannelId(e.getInstanceId());
this.m_bridge.sendMessage(b,{m_event:meebo.util.platform.EVT_APP_MSG,message:c})
}
});
Class("meebo.ApplicationPlatform",meebo.Platform,function(a){this.initialize=function(){a(this,"initialize");
this.m_appInstances={};
this.m_appInfos={}
};
this.initCommandHandlers=function(){var b=meebo.util.platform;
this.setCommandHandler(b.CMD_REQS_BUDDY_ICON,hitch(meeboApp,"setBuddyIconUrl"));
this.setCommandHandler(b.CMD_REQS_WALLPAPER,hitch(this,"handleSetWallpaper"));
this.setCommandHandler(b.CMD_REQS_STATUS_MESSAGE,hitch(meeboApp,"setStatusMessage"));
this.setResponseHandler(b.CMD_REQG_BUDDY_ICON,hitch(meeboApp,"getBuddyIcon"));
this.setResponseHandler(b.CMD_REQG_ALIAS,hitch(meeboApp,"getDisplayName"));
this.setResponseHandler(b.CMD_REQG_SHARE_LIST,hitch(this,"handleGetShareList"));
this.setCommandHandler(b.CMD_APP_MSG,hitch(this,"handleAppMessageFromApp"));
this.setCommandHandler(b.CMD_TRACK_AD,hitch(this,"handleTrackRequest"));
this.setCommandHandler(b.CMD_SEND_MSG,hitch(this,"handleSendMessage"))
};
this.handleTrackRequest=function(b){meebo.util.createTrackingPixel({component:"MediaBar",shareId:b.shareId,group:b.group,item:b.item,time:b.time},gLogon.getLogons())
};
this.handleSendMessage=function(d){var b=gBuddyList.getBuddy(d.name,d.protocol,d.user);
if(!b){return
}var c=gWindowMgr.createIMWindow(b,true,false);
if(c.addCb){c.addCb(function(f,e){f.m_message.setText(d.msg)
})
}else{c.m_message.setText(d.msg)
}};
this.handleSetWallpaper=function(b){meeboApp.setWallpaper(b.url,b.thumb,b.title)
};
this.handleGetShareList=function(d,g){var f=[];
var e=gBuddyList.getBuddies({type:"buddy",online:true});
e.sort(function(k,h){if(h.getActivityTime()<k.getActivityTime()){return -1
}else{if(k.getActivityTime()<h.getActivityTime()){return 1
}}return 0
});
for(var c=0,b;
(b=e[c]);
c++){f.push({name:b.getName(),alias:b.getAlias(),user:b.getUser(),protocol:b.getProtocol().toString()})
}return f
};
this.launchApplication=function(c,b){if(this.m_appInfos[c]){var d=this.createAppFromInfo(this.m_appInfos[c]);
d.launch();
b(d)
}else{gNetworkMgr.doRequest("mainfo",{app_id:c},hitch(this,"onAppInfo",function(e,g){this.m_appInfos[c]=e;
var f=this.createAppFromInfo(this.m_appInfos[c]);
f.launch();
b(f)
}))
}};
this.createAppFromInfo=function(b){if(b.type==meebo.util.platform.APP_TYPE_SINGLE){var c=new meebo.ApplicationSingle(b)
}else{var c=new meebo.Application(b);
gPubSub.subscribe(room,"meebo.ApplicationRoom::receiveAppMsg",this,"handleAppMessageFromServer",c)
}return c
};
this.handleAppMessageFromApp=function(c,b){b.getRoom().sendMsg(c.msg,meebo.util.platform.APP_MSG,c.to)
};
this.handleAppMessageFromServer=function(f,e,b,d){var c=meebo.util.platform.getAppChannelId(f.getInstanceId());
this.m_bridge.sendMessage(c,{m_event:meebo.util.platform.EVT_APP_MSG,message:d})
}
});
Class("meebo.SecurePlatform",meebo.Platform,function(){this.initBridge=function(b){var a=meebo.util.platform.getSecureChannelBase();
this.m_bridge=new meebo.util.SecureFlashMessageBridge(a,hitch(this,"handleCommand"))
};
this.initCommandHandlers=function(){this.setCommandHandler(meebo.util.platform.SCMD_REQG_SESSION_INFO,hitch(this,"handleGetSessionInfo"));
this.setCommandHandler(meebo.util.platform.SCMD_ATTACH,hitch(this,"handleAttachRequest"));
this.setCommandHandler(meebo.util.platform.SCMD_PING,hitch(this,"sendToTray",{response:"PONG"}));
this.setCommandHandler(meebo.util.platform.SCMD_ADD_BUDDY,hitch(this,"handleAddBuddyRequest"))
};
this.sendToTray=function(b,c){var a=meebo.util.platform;
a.blastChannels(a.getTrayChannelBase(),this.m_bridge,b,c)
};
this.notifyMeeboAccountCreated=function(b,a){this.sendToTray({event:meebo.util.platform.SEVT_MEEBO_ACCOUNT_CREATED,username:b,password:a,sessionkey:gIGClient.getSessionKey()})
};
this.handleGetSessionInfo=function(d,c){var b=gLogon.hasMeeboAccount()?gLogon.getMeeboMeLogon():gLogon.getLogons()[0];
var a=gLogon.hasMeeboAccount()?gLogon.getMeeboPassword():b.getPassword();
c({username:b.getUser(),network:b.getNetwork().getId(),password:a,sessionkey:gIGClient.getSessionKey()})
};
this.handleAttachRequest=function(a){if(a.sessionkey!=gIGClient.getSessionKey()){window.location.hash="#k="+a.sessionkey;
meeboApp.dontShowWarning=true;
window.location.reload()
}};
this.handleAddBuddyRequest=function(a){meeboApp.share.handleAddBuddyLinkClick(a.buddy)
};
this.sendSessionKey=function(a){var c=gLogon.hasMeeboAccount()?gLogon.m_meeboUser:gLogon.getLogons()[0].getUser();
var b=gLogon.hasMeeboAccount()?"meebome":gLogon.getLogons()[0].getNetwork().getId();
this.sendToTray({event:meebo.util.platform.SEVT_SESSIONKEY_CHANGE,sessionkey:a,username:c,network:b})
};
this.getSessionInfoFromTray=function(a){var b={command:meebo.util.platform.SCMD_REQG_SESSION_INFO};
this.sendToTray(b,hitch(this,"onSessionInfoFromTray"))
};
this.onSessionInfoFromTray=function(c){var a=meebo.util.normalizeLogon(c.username,c.network);
if(!a.network){return
}var b=gLogon.getLogon(a.name,a.network.getProtocol());
if(b){b.setPassword(c.password);
if(b.isMeeboLogon()){gLogon.setMeeboPassword(c.password)
}}}
});
Class("meebo.ApplicationSingle",function(){this.initialize=function(b,a){this.m_instanceId=Math.floor(Math.random()*100000)+"-"+(new Date().getTime());
this.m_platform=a||meeboApp.platform;
this.parseArgs(b)
};
this.parseArgs=function(b){b=b||{};
var c={owner_name:"",app_id:"",engagedAppId:"",category_id:0,description:"",resizable:0,width:20,height:20,alias:"",delta:0,location:"",domain:"meeboapis.com",icon_location:"",max_participants:0,intalled:0,name:"",enabled:1,info:"",multi_instance:0,invite:null,screenshot_location:"",num_times_launched:0,revenue_type:0,featured:0,favorite:0,type:meebo.util.platform.APP_TYPE_MULTI,platform_version:1,share:""};
for(var a in c){this[a]=b[a]||this[a]||c[a]
}};
this.getAlias=function(){return this.alias||this.name
};
this.getInstanceId=function(){return this.m_instanceId
}
});
meebo.APP_COMMUNICATION_CATEGORY=4;
meebo.APP_TYPE_MediaBar="MediaBar";
meebo.APP_TYPE_IM="IM";
meebo.APP_TYPE_LeaderBoard="LeaderBoard";
Class("meebo.Application",meebo.ApplicationSingle,function(a){this.launch=function(e,b,d,g,f){var c={nick:b,app_id:this.app_id,chat_id:e,platform_instance_id:this.m_platform.getPlatformInstanceId()};
gNetworkMgr.doRequest("malaunch",c,g)
};
this.setRoom=function(b){this.m_room=b
};
this.getRoom=function(){return this.m_room
};
this.join=function(c,e){if(!this.app_id){return
}var b={app_id:this.app_id,app_instance_id:c,platform_instance_id:meeboApp.platform.getPlatformInstanceId()};
var d=gLogon.getMeeboUser();
if(d){b.muser=d
}gNetworkMgr.doRequest("majoin",b,hitch(this,"onJoin",e))
};
this.onJoin=function(d,c,b){if(!b){return
}this.parseArgs(c);
if(d){d(c.time,c.hash,this)
}};
this.getInfo=function(d,c){if(!c&&!this.app_id){return
}var b=(c?{app_instance_id:c}:{app_id:this.app_id});
gNetworkMgr.doRequest("mainfo",b,hitch(this,"onGetInfo",d))
};
this.onGetInfo=function(d,c,b){if(!b){return
}this.parseArgs(c);
if(d){d(this)
}};
this.createIframe=function(d){var e=getUniqueId();
var c=gWin().document.createElement("div");
c.id=e+"-appFrame";
addClassName(c,"appFrame");
c.style.width=d.width;
c.style.height=d.height;
var b='<iframe src="'+this.location+"?app_instance_id="+encodeURIComponent(this.app_instance_id)+"&platform_instance_id="+meeboApp.platform.getPlatformInstanceId()+"&time="+encodeURIComponent(d.joinParams.time)+"&hash="+encodeURIComponent(d.joinParams.hash)+'" ';
if(this.resizable==1||!this.width||!this.height||this.width<=0||this.height<=0){b+='width="100%" height="100%" frameborder="0" style="top: 0px; left: 0px;"></iframe>'
}else{b+='width="'+this.width+'" height="'+this.height+'" frameborder="0" style="margin-left: -'+Math.round(this.width/2)+"px; margin-top: -"+Math.round(this.height/2)+'px;"></iframe>'
}c.innerHTML=b;
return c
}
});
Class("meebo.ApplicationMgr",function(){this.initialize=function(){this.m_applications=[];
this.m_categories=[];
this.m_featured=null;
this.m_favorites=null
};
this.loadList=function(b){var a={rank_key:"installed"};
if(gLogon.getMeeboUser()){a.muser=gLogon.getMeeboUser()
}gNetworkMgr.doRequest("mafulllist",a,hitch(this,"onLoad",b))
};
this.loadUser=function(b){var a={muser:gLogon.getMeeboUser()};
gNetworkMgr.doRequest("mauserlist",a,hitch(this,"onLoad",b))
};
this.loadApplication=function(a){var b=this.getApplication(a.app_id);
if(!b){b=new meebo.Application(a)
}else{b.parseArgs(a)
}this.addApplication(b);
return b
};
this.onLoad=function(g,d,a,h){if(!a){return
}var f=d.applications||d;
for(var c=0;
c<f.length;
c++){this.loadApplication(f[c])
}if(d.categories){for(var b in d.categories){var e=d.categories[b];
if(this.getCategory(e.category_id)){continue
}this.addCategory(e)
}}if(typeof g=="function"){g(this.m_applications,this.m_categories)
}this.m_favorites=null;
this.m_featured=null;
this.saveFavorites()
};
this.loadGuest=function(d,a,c){var b={};
if(a){b.muser=a
}if(c){b.app_instance_id=c
}gNetworkMgr.doRequest("maguestjoin",b,hitch(this,"onLoadGuest",d))
};
this.onLoadGuest=function(e,c,a,g){if(!a){return
}var f=null;
if(c.app_info){f=new meebo.Application(c.app_info);
this.addApplication(f)
}this.m_favorites={};
var d=null;
if(c.user_info){for(var b=0;
b<c.user_info.app_id.length;
b++){this.m_favorites[c.user_info.app_id[b]]=true
}d=c.user_info.icon_url
}if(e){e(f,d)
}this.saveFavorites()
};
this.getApplications=function(){return this.m_applications
};
this.getApplication=function(b){var c=null;
for(var a=0;
(c=this.m_applications[a]);
a++){if(c.app_id==b){break
}}return c||null
};
this.addApplication=function(a){for(var b=0,c;
(c=this.m_applications[b]);
b++){if(a.app_id==c.app_id){this.m_applications.splice(b,1,a);
return
}}this.m_applications.push(a)
};
this.getCategories=function(){return this.m_categories
};
this.getCategory=function(c){var b=null;
for(var a=0;
(b=this.m_categories[a]);
a++){if(b.category_id==c){break
}}return b||null
};
this.addCategory=function(a){this.m_categories.push(a)
};
this.getFeatured=function(){if(!this.m_featured){this.m_featured={};
var b=this.getApplications();
for(var a=0;
a<b.length;
a++){if(!b[a].featured){continue
}this.m_featured[b[a].app_id]=true
}}return this.m_featured
};
this.addFavorite=function(a){if(this.getFavorites()[a]){return
}this.m_favorites[a]=true;
this.sendFavoriteRequest(a,true);
this.saveFavorites()
};
this.removeFavorite=function(a){if(!this.getFavorites()[a]){return
}delete this.m_favorites[a];
this.sendFavoriteRequest(a,false);
this.saveFavorites()
};
this.sendFavoriteRequest=function(c,d){var a=gLogon.getMeeboUser();
if(!a){return
}var b={muser:a,nfavorites:1,"1app_id":c,"1fav":d?1:0};
gNetworkMgr.doRequest("mauserinfo",b)
};
this.saveFavorites=function(){gPubSub.publish(this,"meebo.ApplicationMgr::updateFavorites")
};
this.getFavorites=function(){if(!this.m_favorites){this.m_favorites={};
var b=this.getApplications();
for(var a=0;
a<b.length;
a++){if(!b[a].favorite){continue
}this.m_favorites[b[a].app_id]=true
}}return this.m_favorites
}
});
meebo.applicationMgr=new meebo.ApplicationMgr();
Class("meebo.UIState",lib.Publisher,function(a){this.initialize=function(b){a(this,"initialize");
this.m_state={};
this.m_needsFlush=false;
this.m_clearOnFlush={};
this.m_pending={};
this.m_dontNotifyBackend=b;
this.m_sync=hitch(this,"sync");
this.m_delay=1000;
gPubSub.subscribe("meebo.EventMgr::networkResume",this,"onNetworkResume")
};
this.set=function(f,c,b){var e=false;
if(!this.m_state[f]){this.m_state[f]={}
}for(var d in c){if(this.m_state[f][d]!=c[d]){this.m_state[f][d]=c[d];
e=true
}}if(e&&!b&&!this.m_dontNotifyBackend){this.requestSet(f)
}};
this.clear=function(c,b){if(!this.m_state.hasOwnProperty(c)){return
}delete this.m_state[c];
if(!b&&!this.m_dontNotifyBackend){this.requestClear(c)
}};
this.handleSetEvent=function(c,b){for(var d in c){this.m_state[d]=c[d]
}for(var d in c){this.publish("ChangeState",d,c[d],b)
}};
this.handleClearEvent=function(b){delete this.m_state[b];
this.publish("ChangeState",b,null)
};
this.get=function(b){return shallowCopy(this.m_state[b])
};
this.needsFlush=function(){this.m_needsFlush=true
};
this.requestSet=function(b){if(gEventMgr.getState()!="im"){this.m_needsFlush=true;
delete this.m_clearOnFlush[b]
}else{if(!this.flush()){this.m_pending[b]=true;
this.resetTimer()
}}};
this.requestClear=function(b){if(gEventMgr.getState()!="im"){this.m_needsFlush=true;
this.m_clearOnFlush[b]=true
}else{this.flush();
this.resetTimer();
gNetworkMgr.requestClearUiState(b)
}};
this.resetTimer=function(){clearTimeout(this.m_timer);
this.m_timer=setTimeout(this.m_sync,this.m_delay)
};
this.onNetworkResume=function(){clearTimeout(this.m_timer);
this.sync()
};
this.sync=function(){clearTimeout(this.m_timer);
var b={};
for(var c in this.m_pending){if(c in this.m_state){b[c]=this.m_state[c]
}}this.m_pending={};
gNetworkMgr.requestSetUiState(b)
};
this.flush=function(){if(!this.m_needsFlush||gEventMgr.getState()!="im"){return false
}gNetworkMgr.requestSetUiState(this.m_state);
for(var b in this.m_clearOnFlush){gNetworkMgr.requestClearUiState(b)
}this.m_needsFlush=false;
this.m_clearOnFlush={};
this.m_pending={};
clearTimeout(this.m_timer);
return true
}
});
Quantcast={m_qacct:"p-93vmRJG_BQlqo",m_tracked:false,track:function(c){if(this.m_tracked||!gConfig.getReleaseType().length){return
}this.m_tracked=true;
c=c||window;
c._qoptions={qacct:this.m_qacct};
var b=(("https:"==c.document.location.protocol)?"https://secure.":"http://pixel.");
var a=c.document.createElement("script");
a.src=b+"quantserve.com/quant.js";
c.document.getElementsByTagName("head")[0].appendChild(a)
}};
DoubleClick={MEDIABAR:"MediaBar",SPARK:"Spark",MEDIAALERT:"MediaAlert",url:"http://ad.doubleclick.net/pfadx/%1/;%2;dcmt=text/html;ord=%3?",pendingCallbacks:{},defaultCallbackId:"unspecifiedShareCallback",sizes:{Spark:"47x47",MediaBar:"728x90",MediaAlert:"24x24"},positions:{Spark:1,MediaBar:1,MediaAlert:1},isTest:false,ads:{},getAdTypes:function(){return[this.SPARK,this.MEDIABAR,this.MEDIAALERT]
},doesAdRequireHttps:function(){return((ui.isIE||ui.isFirefox)&&document.location.protocol=="https:")
},setTest:function(a){this.isTest=a
},getAd:function(a,b){return a in this.ads?this.ads[a][b]:null
},loadAd:function(e,d){d=d||{};
var f=d.shareId,h=d.callback,l=d.targetingInfo||{},n=d.site,b=d.ord,t=d.tile,g=d.keyValuePairs||{};
if(this.doesAdRequireHttps()){this.url=this.url.replace("http://","https://")
}var m="DoubleClickAd"+e;
if(!n){if(f){n="meeboshare"
}else{if(this.isTest){n="meebotest"
}else{if(window.location.protocol=="https:"&&e!="Spark"){n="meebo.comsecure"
}else{n="meebo.com"
}}}}if($(m)){removeElement($(m))
}var k;
if(f){k="dcove=o;share="+f
}else{var a=[];
for(var u in g){a.push(u+"="+g[u])
}var s=this.positions[e]>4?"other":this.positions[e];
a.push(["position="+encodeURIComponent(s)]);
this.positions[e]++;
for(var u in l){a.push(u+"="+encodeURIComponent(l[u]))
}if(!ui.isSafari){var p=meebo.util.parse33xCookie();
if(p.length){for(var q=0,c;
(c=p[q]);
q++){a.push("x33="+c)
}}}k=a.join(";")
}if(t){k+=";tile="+encodeURIComponent(t)
}k+=";sz="+this.sizes[e];
this.pendingCallbacks[f||this.defaultCallbackId+e]=h;
var o=document.createElement("script");
o.src=sprintf(this.url,n,k,b||new Date().getTime());
o.type="text/javascript";
o.id=m;
document.getElementsByTagName("head")[0].appendChild(o)
},onAdLoaded:function(a,b){if(!(a in this.ads)){this.ads[a]={}
}this.ads[a][b.share]=b;
if(this.doesAdRequireHttps()){b=DoubleClick.requireHttps(b)
}b.isSharable=!b.notSharable;
var c=this.pendingCallbacks[b.share]||this.pendingCallbacks[this.defaultCallbackId+a];
delete this.pendingCallbacks[b.share||this.defaultCallbackId+a];
if(c){c(a,b)
}else{switch(a){case"MediaBar":gPubSub.publish(this,"meebo.DoubleClick::loadMediaBar",b);
break;
case"Spark":gPubSub.publish(this,"meebo.DoubleClick::loadSparkAd",b);
break;
case"MediaAlert":gPubSub.publish(this,"meebo.DoubleClick::loadMediaAlert",b);
break
}}},requireHttps:function(d){var c=/^http:\/\/share.meebo.com/i;
var e=/^http:\/\//gi;
for(var a in d){if(d[a] instanceof Array){for(var b=0;
b<d[a].length;
b++){if(!d[a][b].replace){continue
}d[a][b]=d[a][b].replace(c,"https://origin-share.meebo.com/");
d[a][b]=d[a][b].replace(e,"https://")
}}else{if(d[a].replace){d[a]=d[a].replace(c,"https://origin-share.meebo.com");
d[a]=d[a].replace(e,"https://")
}}}return d
}};
var ui={};
ui.KEY_BACKSPACE=8;
ui.KEY_TAB=9;
ui.KEY_RETURN=13;
ui.KEY_ESC=27;
ui.KEY_LEFT=37;
ui.KEY_UP=38;
ui.KEY_RIGHT=39;
ui.KEY_DOWN=40;
ui.KEY_DELETE=46;
ui.KEY_SPACEBAR=32;
ui.bEnabled=true;
ui.enableEvents=function(){ui.bEnabled=true
};
ui.disableEvents=function(){ui.bEnabled=false
};
ui.globalEvents={};
ui.connectGlobalEvent=function(c,a,b){var d=ui.retrieveEventId(c.body);
if(!this.globalEvents[d]){this.globalEvents[d]={}
}if(this.globalEvents[d][a]){ui.disconnectGlobalEvent(c,a)
}this.globalEvents[d][a]=b;
ui.attachEvent(c.body,a,b,true)
};
ui.disconnectGlobalEvent=function(c,a){var d=ui.retrieveEventId(c.body);
if(!this.globalEvents[d]||!this.globalEvents[d][a]){return
}var b=gWin(c);
if(ui.isIE&&!arguments.callee.disconnecting&&b.event&&b.event.type==a&&b.event.srcElement!=c.body){arguments.callee.disconnecting=true;
this.globalEvents[d][a](b.event);
arguments.callee.disconnecting=false
}ui.detachEvent(c.body,a,this.globalEvents[d][a],true);
delete this.globalEvents[d][a]
};
ui.retrieveEventId=function(a){if(!a){return
}var b;
if(!a.getAttribute){b=ui.getElementEventId(a)
}else{b=a.getAttribute("ev_id");
if(!b){b=String(getUniqueId());
a.setAttribute("ev_id",b)
}}if(!ui.connectedEvents[b]){ui.connectedEvents[b]={el:a}
}return b
};
ui.getElementEventId=function(a){for(var b=0,c;
c=ui.elementIdMap[b];
++b){if(c.el==a){return c.id
}}var d=String(getUniqueId());
ui.elementIdMap[ui.elementIdMap.length]={el:a,id:d};
return d
};
ui.elementIdMap=[];
ui.hookEvents={};
ui.hookCallback=null;
ui.setHookEvents=function(d,b){if(!d||!b){return
}ui.hookEvents={};
ui.hookCallback=b;
var c;
for(var a=0;
(c=d[a]);
a++){ui.hookEvents[c]=true
}};
ui.connectedEvents={};
ui.connectEvent=function(e,a,c,l,d,k){if(!e||!a||!c||!l){return
}var h=Array.prototype.slice.call(arguments,6);
var g=function(n){if(typeof ui=="undefined"||!ui.bEnabled){return
}var o=n||gWin(e).event;
var m=(d?(k?[o,e]:[o]):(k?[e]:[])).concat(h);
var f=hitch(c,l).apply(c,m);
eventlog(e.id+" "+n);
return f
};
var b=ui.retrieveEventId(e);
if(ui.connectedEvents[b][a]){ui.disconnectEvent(e,a,ui.connectedEvents[b][a])
}ui.connectedEvents[b][a]=g;
ui.attachEvent(e,a,g)
};
ui.disconnectEvent=function(a,b){if(!a||!b){return
}var d=ui.retrieveEventId(a);
var c=ui.connectedEvents[d][b];
if(!c){return
}delete ui.connectedEvents[d][b];
ui.detachEvent(a,b,c)
};
ui.disconnectAllEvents=function(a){var f=ui.retrieveEventId(a);
for(var b in ui.connectedEvents[f]){if(b=="el"){continue
}try{ui.detachEvent(a,b,ui.connectedEvents[f])
}catch(d){}}delete ui.connectedEvents[f];
var c=gDoc(a);
if(a==c){for(var f in ui.connectedEvents){var a=ui.connectedEvents[f].el;
if(c==document||c==gDoc(a)){arguments.callee(a)
}}}};
ui.USE_CAPTURE=false;
ui.normaliseEvent=function(a,b,c){var e=gDoc(a);
var d=gWin(a);
if(b=="focus"&&a==d){if(isDefined(e.onfocusin)){b="focusin";
a=e
}else{if(isDefined(d.onfocus)){b="focus"
}else{b="focus";
a=e;
c=true
}}}else{if(b=="blur"&&a==d){if(isDefined(e.onfocusout)){b="focusout";
a=e
}else{if(isDefined(d.onblur)){b="blur"
}else{b="blur";
a=e;
c=true
}}}else{if(b=="focusie7"&&a==d){b="focus";
a=d
}}}return{element:a,event:b,useCapture:c}
};
ui.attachEvent=function(c,d,f,e){if(!c||!d||!f){return
}var b=ui.normaliseEvent(c,d,e);
c=b.element;
d=b.event;
e=b.useCapture;
if(c.attachEvent){c.attachEvent("on"+d,f)
}else{if(c.addEventListener){if(d.toLowerCase()=="mousewheel"){d="DOMMouseScroll"
}if(d=="contextmenu"&&ui.isFirefox&&ui.isMac){d="mouseup";
var a=f;
f=function(g){if(g.button==2){a(g)
}}
}if(ui.isSafari&&d.toLowerCase()=="dblclick"){c.ondblclick=f
}else{c.addEventListener(d,f,typeof e=="boolean"?e:ui.USE_CAPTURE)
}}}};
ui.detachEvent=function(b,c,e,d){if(!b||!c||!e){return
}var a=ui.normaliseEvent(b,c,d);
b=a.element;
c=a.event;
d=a.useCapture;
if(b.detachEvent){b.detachEvent("on"+c,e)
}else{if(b.removeEventListener){if(c.toLowerCase()=="mousewheel"){c="DOMMouseScroll"
}if(ui.isSafari&&c.toLowerCase()=="dblclick"){delete b.ondblclick
}else{b.removeEventListener(c,e,typeof d=="boolean"?d:ui.USE_CAPTURE)
}}}};
ui.setEventHandled=function(b,a){if(!b){b=window.event
}if(!a&&ui.hookEvents[b.type]){ui.hookCallback()
}if(b&&b.preventDefault){b.stopPropagation()
}else{b.cancelBubble=true
}ui.preventDefault(b)
};
ui.preventDefault=function(a){if(a.preventDefault){a.preventDefault()
}else{a.returnValue=false
}};
ui.isCursorInClient=function isCursorInClient(b){var c=ui.getClientRect();
var a=ui.getCursorX(b);
if(a<0||a>=c.w){return false
}var d=ui.getCursorY(b);
if(d<0||d>=c.h){return false
}return true
};
ui.getCursorPos=function getCursorPos(a){return{x:ui.getCursorX(a),y:ui.getCursorY(a)}
};
ui.getCursorX=function getCursorX(b){if(ui.isSafari&&b&&!isDefined(b.clientX)){return(b.target)?0:-1
}var d=gDoc(b&&(b.target||b.srcElement));
if(ui.isIE&&ui.isIE<=5.5){d=gDoc()
}var c=gWin(d);
var a=0;
if(ui.isIE||ui.isOpera){a=c.event.clientX+d.documentElement.scrollLeft+d.body.scrollLeft-(d.documentElement.clientLeft+d.body.clientLeft)
}else{a=b.clientX+c.scrollX
}return a
};
ui.getCursorY=function getCursorY(a){if(ui.isSafari&&a&&!isDefined(a.clientY)){return(a.target)?0:-1
}var c=gDoc(a&&(a.target||a.srcElement));
if(ui.isIE&&ui.isIE<=5.5){c=gDoc()
}var b=gWin(c);
var d=0;
if(ui.isIE||ui.isOpera){d=b.event.clientY+c.documentElement.scrollTop+c.body.scrollTop-(c.documentElement.clientTop+c.body.clientTop)
}else{d=a.clientY+b.scrollY
}return d
};
ui.getMouseButton=function(b){var c=gWin(b);
if(!b){b=c.event
}var a=b.button;
if(ui.isIE||ui.isSafari){if(a&1){a=0
}else{if(a&2){a=2
}else{if(a&4){a=1
}}}}return a
};
ui.getClientRect=function getClientRect(a){var b=gDoc(a);
return new ui.rect(0,0,b.body.clientWidth,b.body.clientHeight)
};
ui.getClientCenter=function(a){var b=ui.getClientRect(a);
return{x:parseInt(b.w/2),y:parseInt(b.h/2)}
};
ui.isBrowser=function(a){var c=navigator.userAgent,b;
if((b=c.indexOf(a))>=0){ui.m_version=parseFloat(c.substr(b+a.length+1));
return ui.m_version
}return false
};
ui.isOS=function(a){var b=navigator.userAgent.toLowerCase();
return(b.indexOf(a)>=0)
};
ui.isWebKit=ui.isBrowser("WebKit");
ui.isChrome=ui.isBrowser("Chrome");
ui.isSafari=ui.isBrowser("Safari");
ui.isSafari3=ui.isSafari&&navigator.userAgent.indexOf("Version/3.")>=0;
ui.isSafari4=ui.isSafari&&navigator.userAgent.indexOf("Version/4.")>=0;
ui.isSafari2=ui.isSafari&&!ui.isSafari3;
ui.isFluid=(window.fluid!=null);
ui.isPrism=(window.platform!=null);
ui.isIPhone=navigator.userAgent.indexOf("iPhone")>=0;
ui.isIE=ui.isBrowser("MSIE");
ui.isOpera=ui.isBrowser("Opera");
ui.isOpera9=ui.isOpera&&navigator.userAgent.indexOf("Opera/9")>=0;
ui.isNS=ui.isBrowser("Netscape6/");
ui.isGecko=ui.isBrowser("Gecko")&&!ui.isSafari;
ui.isFirefox=ui.isBrowser("Firefox");
ui.isFirefox3=ui.isFirefox&&navigator.userAgent.indexOf("Firefox/3")>=0;
ui.isMac=ui.isOS("mac");
ui.isWin=ui.isOS("win");
ui.isLinux=ui.isOS("linux");
ui.isUnix=ui.isOS("x11");
ui.isHttps=(document.location.href.indexOf("https")==0);
ui.isIE7=(ui.isIE&&ui.m_version>=7);
if(ui.isSafari3){ui.m_version=3
}else{if(ui.isSafari2){ui.m_version=2
}}ui.isQuirks=function(a){var b=a.compatMode;
return(!b||b=="BackCompat")
};
ui.getVersion=function(){return ui.m_version
};
ui.getClient=function(){if(ui.isSafari){return"Safari"
}else{if(ui.isIPhone){return"iPhone"
}else{if(ui.isIE){return"MSIE"
}else{if(ui.isOpera){return"Opera"
}else{if(ui.isNS){return"Netscape"
}else{if(ui.isFirefox){return"Firefox"
}else{if(ui.isGecko){return"Gecko"
}else{return"unknown"
}}}}}}}};
if(ui.isSafari){ui.isGecko=false
}ui.cleanUp=function(a){var d=gDoc(a);
ui.disconnectAllEvents(d);
var c=d.getElementsByTagName("DIV");
for(var b=0;
b<c.length;
b++){if(c[b].ptr){c[b].ptr=null
}}};
ui.emptyTags=/^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i;
ui.createHTML=function(f){if(isString(f)){return f
}var d="<"+f.tag;
for(attribute in f){var e=f[attribute];
switch(attribute){case"tag":case"textContent":case"children":continue;
break;
case"className":attribute="class";
break;
case"htmlFor":attribute="for";
break;
case"style":if(!isString(e)){var a=e;
e="";
for(style in a){var c=style=="cssFloat"?"float":style.replace(/([A-Z])/g,"-$1").toLowerCase();
e+=c+": "+a[style]+";"
}}}d+=" "+attribute+'="'+e+'"'
}d+=">";
if(!ui.emptyTags.test(f.tag)){if(f.children){for(var b=0;
b<f.children.length;
b++){d+=arguments.callee(f.children[b])
}}else{if(f.textContent){d+=escapeHTML(f.textContent)
}}d+="</"+f.tag+">"
}return d
};
ui.createDOM=function(b,a){a=a||document;
var c=a.createElement("div");
c.innerHTML=ui.createHTML(b);
return c.firstChild
};
ui.rect=function(a,d,b,c){this.x=a;
this.y=d;
this.w=b;
this.h=c;
this.x2=a+b;
this.y2=d+c
};
Class("ui.element",function(){this.m_visDisplay="block";
this.m_className="";
this.m_element=null;
this.m_id="";
this.m_title="";
this.m_win=window;
this.initialize=function(a){if(a){this.m_win=gWin(a);
this.m_element=a;
this.m_id=a.id
}};
this.getId=function(){return this.m_id||(this.m_element&&this.m_element.id)||""
};
this.getElement=function(){return this.m_element||$(String(this.getId()))
};
this.getTitle=function(){return this.m_title
};
this.setTitle=function(a){this.m_title=a||"";
if(this.getElement()){this.getElement().title=this.m_title
}};
this.setPos=function(a,e,b,d){if(!this.getElement()){return
}var c=this.getElement().style;
if(a!=null&&parseInt(c.right)){c.right=a+"px"
}else{if(a!=null){c.left=a+"px"
}}if(e!=null&&parseInt(c.bottom)){c.bottom=e+"px"
}else{if(e!=null){c.top=e+"px"
}}if(b!=null&&b>=0){c.width=b+"px"
}if(d!=null&&d>=0){c.height=d+"px"
}};
this.getPos=function(){var a=this.getElement();
return{w:a.offsetWidth,h:a.offsetHeight,x:a.offsetLeft,y:a.offsetTop}
};
this.getAbsolutePos=function(){return getElementPosition(this.getElement())
};
this.setVisibility=function(a){if(this.getElement()){this.getElement().style.visibility=a?"visible":"hidden"
}};
this.getVisibility=function(){return Boolean(this.getElement()&&this.getElement().style.visibility!="hidden")
};
this.setDisplay=function(a){if(!this.getElement()){return
}if(typeof(a)=="string"){this.getElement().style.display=a
}else{this.getElement().style.display=a?"block":"none"
}};
this.getDisplay=function(){if(this.getElement()){return this.getElement().style.display
}};
this.setStyle=function(a,b){if(this.getElement()){this.getElement().style[a]=b
}};
this.addClassName=function(a){this.m_className=addClassName(this.m_className,a);
var b=this.getElement();
if(b){addClassName(b,a)
}};
this.removeClassName=function(a){this.m_className=removeClassName(this.m_className,a);
var b=this.getElement();
if(b){removeClassName(b,a)
}};
this.hasClassName=function(a){return hasClassName(this.getElement()||this.m_className,a)
};
this.createHandler=createHandler;
this.onRender=function(){this.connectEvents()
};
this.setInnerHTML=function(a){if(!this.getElement()){return
}this.getElement().innerHTML=a
};
this.connectEvents=function(){if(!this.getElement()){return
}for(var a in this.eventHash){ui.connectEvent(this.getElement(),a,this,this.eventHash[a])
}}
});
Class("ui.Element",lib.Publisher,function(a){this.initialize=function(){a(this,"initialize",arguments);
this.m_win=null;
this.m_parent=null;
this.m_element=null
};
this.create=function(b,c){this.m_parent=b||this.m_parent;
var d=this.m_parent.m_win||this.m_parent;
if(this.m_win!=d||!this.m_element){this.m_win=d;
this.uncreate();
this.m_element=c||this.m_win.document.createElement("div");
this.createContent()
}return this
};
this.uncreate=function(){if(!this.m_element){return
}this.uncreateContent();
removeElement(this.m_element);
this.m_element=null;
this.m_parent=null;
this.m_win=null
};
this.createContent=function(){throw new Error("abstract method")
};
this.uncreateContent=function(){};
this.setParent=function(b){if(this.m_parent!=b){if(this.m_element){this.create(b)
}else{this.m_parent=b;
this.m_win=b.m_win
}}};
this.getElement=function(){return this.m_element
};
this.getId=function(){return this.m_id||(this.m_element&&this.m_element.id)||""
};
this.getParent=function(){return this.m_parent
};
this.setTitle=function(b){this.m_element.title=b;
return this
};
this.getTitle=function(){return this.m_title
};
this.addClassName=function(b){addClassName(this.m_element,b);
return this
};
this.removeClassName=function(b){removeClassName(this.m_element,b);
return this
};
this.hasClassName=function(b){return hasClassName(this.m_element,b)
};
this.setDisplay=function(b){if(this.m_element){this.m_element.style.display=b?"block":"none"
}return this
};
this.getDisplay=function(){return this.m_element&&this.m_element.style.display!="none"
}
});
ui.effectMgr=function(){this.m_minIncrement=40;
this.intervalTimers=new Object();
this.intervalFaders=new Object();
this.fontDecoration=function(a,b){if(a&&a.style){a.style.textDecoration=b
}};
this.setOpacity=function(a,c){if(a&&a.style){var b=a.style;
if(ui.isIE){b.filter="alpha(opacity="+c+")"
}else{b.opacity=(c/100);
b.MozOpacity=(c/100);
b.KhtmlOpacity=(c/100)
}}};
this.startFade=function(b,d,k,c,h){if(c<this.m_minIncrement){c=this.m_minIncrement
}var g=Math.abs(k-d);
var f=1;
if(c){numberIntervals=parseInt(c/this.m_minIncrement)
}var a=0;
if(g>0){a=parseInt(g/numberIntervals)
}if(!isDefined(b.length)){b=[b]
}if(this.intervalTimers[b[0].id]&&this.intervalTimers[b[0].id]!=null){clearInterval(this.intervalTimers[b[0].id]);
this.intervalTimers[b[0].id]=null
}for(var e=0;
e<b.length;
e++){this.setOpacity(b[e],d)
}this.intervalFaders[b[0].id]=d;
this.intervalTimers[b[0].id]=setInterval(function(){gEffects.fadeAnimationStep(b,k,a,h)
},this.m_minIncrement)
};
this.fadeAnimationStep=function(g,c,f,a){if(!g||!g[0].id){return
}var b=c-this.intervalFaders[g[0].id];
var e=Math.abs(b);
if(b==0){clearTimeout(this.intervalTimers[g[0].id]);
this.intervalTimers[g[0].id]=null;
if(a){a()
}return
}if(e<f){f=e
}if(b<0){f*=-1
}for(var d=0;
d<g.length;
d++){this.setOpacity(g[d],this.intervalFaders[g[0].id]+f)
}this.intervalFaders[g[0].id]+=f
};
this.startResize=function(a,n,f,b,e,g,p){if(!a){return
}var l=e();
var d=Math.abs(n-l.w);
var k=Math.abs(f-l.h);
var m=1;
if(b){m=parseInt(b/this.m_minIncrement)
}if(m<=1){g(l.x,l.y,n,f);
if(p){p()
}return
}var c=0;
var q=0;
if(d){c=parseInt(d/m)
}if(k){q=parseInt(k/m)
}a.timerId="timer"+getUniqueId();
if(this.intervalTimers[a.timerId]&&this.intervalTimers[a.timerId]!=null){clearInterval(this.intervalTimers[a.timerId]);
this.intervalTimers[a.timerId]=null
}var o=ui.isIE?0:((parseInt(getCSSProp(a,"border-left-width"))||0)+(parseInt(getCSSProp(a,"border-right-width"))||0));
this.intervalTimers[a.timerId]=setInterval(function(){try{gEffects.resizeAnimationStep(a,n,f,c,q,e,g,o,p)
}catch(h){}},this.m_minIncrement)
};
this.stopAllAnimations=function(a){if(!a||!a.timerId){return
}if(this.intervalTimers[a.timerId]&&this.intervalTimers[a.timerId]!=null){clearInterval(this.intervalTimers[a.timerId]);
this.intervalTimers[a.timerId]=null
}};
this.resizeAnimationStep=function(c,o,g,f,p,e,h,m,n){var k=e();
if(k.w-m==o&&k.h==g){clearInterval(this.intervalTimers[c.timerId]);
this.intervalTimers[c.timerId]=null;
if(n){n()
}return
}var b=g-k.h;
var l=Math.abs(b);
var d=o-k.w;
var a=Math.abs(d);
if(l<p){p=l
}if(a<f){f=a
}if(b<0){p*=-1
}if(d<0){f*=-1
}h(k.x,k.y,k.w+f,k.h+p)
};
this.startMove=function(c,a,b,n,k,d,s){var t=true;
var u=true;
var q="left";
var o="top";
if(!n){q="right"
}if(!k){o="bottom"
}if(a==null){t=false
}if(b==null){u=false
}var v=Math.floor(d/32);
if(!v){return
}var l=0;
var g=0;
var m=c.offsetLeft;
var h=c.offsetTop;
if(!k){h=gDoc(c).body.clientHeight-(c.offsetTop+c.offsetHeight)
}if(t){l=(a-m)/v
}if(u){g=(b-h)/v
}var f=m;
var e=h;
var p=setInterval(function(){f+=l;
e+=g;
if(t){c.style[q]=Math.round(f)+"px"
}if(u){c.style[o]=Math.round(e)+"px"
}v--;
if(v==0){clearInterval(p);
if(s){s()
}}},32);
return p
};
this.stopMove=function(a){clearInterval(a)
}
};
var gEffects=new ui.effectMgr();
Class("ui.Animation",function(){this.initialize=function(a){a=a||{};
this.m_duration=a.duration||500;
this.m_timeDelta=a.delta||40;
this.m_transition=a.transition||ui.Animation.linear;
this.onfinished=a.finished||null;
this.m_state=this.m_target=0;
this.m_subjects=[];
this.m_interval=null
};
this.setTransition=function(a){this.m_transition=a||ui.Animation.linear
};
this.setDuration=function(a){this.m_duration=a
};
this.addSubject=function(a){this.m_subjects.push(a);
return this
};
this.removeSubject=function(a){for(var b=this.m_subjects.length-1;
b>=0;
b--){if(this.m_subjects[b]==a){this.m_subjects.splice(b,1)
}}};
this.getState=function(){return this.m_state
};
this.removeAllSubjects=function(){this.m_subjects=[]
};
this.isAnimating=function(){return Boolean(this.m_interval)
};
this.atTarget=function(){return this.m_state===this.m_target
};
this.seekFromTo=function(b,a){b=(b>1?1:(b<0?0:b));
a=(a>1?1:(a<0?0:a));
this.m_state=b;
this.m_target=a;
this.animate()
};
this.seekTo=function(a){this.seekFromTo(this.m_state,a)
};
this.seek=function(){this.seekFromTo(this.m_state,this.m_target)
};
this.jumpTo=function(a){this.seekFromTo(a,a)
};
this.play=function(){this.seekFromTo(0,1)
};
this.reverse=function(){this.seekFromTo(1,0)
};
this.toggle=function(){this.seekTo(1-this.m_target)
};
this.animate=function(){this.m_startTime=new Date().getTime();
this.m_startState=this.m_state;
if(this.m_interval){return
}if(this.m_state==this.m_target){var b=this.m_transition(this.m_state);
try{for(var a=0;
a<this.m_subjects.length;
a++){this.m_subjects[a](b,this.m_state)
}}catch(c){}if(this.onfinished){this.onfinished()
}}else{this.m_interval=setInterval(hitch(this,"onInterval"),this.m_timeDelta)
}};
this.onInterval=function(){var c=((new Date().getTime()-this.m_startTime)/this.m_duration);
if(this.m_target>this.m_state){c+=this.m_startState;
if(this.m_target<c){c=this.m_target
}}else{c=this.m_startState-c;
if(this.m_target>c){c=this.m_target
}}try{var b=this.m_transition(c);
for(var a=0;
a<this.m_subjects.length;
a++){this.m_subjects[a](b,c)
}}catch(d){}this.m_state=c;
if(this.m_state==this.m_target){clearInterval(this.m_interval);
this.m_interval=null;
if(this.onfinished){this.onfinished()
}}};
this.pause=function(){if(this.m_interval){clearInterval(this.m_interval);
this.m_interval=null
}}
});
ui.Animation.linear=function(a){return a
};
ui.Animation.easeInOut=function(a){if((a*=2)<1){return 0.5*a*a*a
}else{return 0.5*((a-=2)*a*a+2)
}};
ui.Animation.easeOut=function(a){return a*(2-a)
};
ui.Animation.easeOutBounce=function(a){if(a<(1/2.75)){return(7.5625*a*a)
}else{if(a<(2/2.75)){return(7.5625*(a-=(1.5/2.75))*a+0.75)
}else{if(a<(2.5/2.75)){return(7.5625*(a-=(2.25/2.75))*a+0.9375)
}else{return(7.5625*(a-=(2.625/2.75))*a+0.984375)
}}}};
ui.colorMgr=function(){this.debugErrorColor="#FF0000";
this.debugObjectColor="#339900";
this.debugUserCmdColor="#0000FF";
this.getColorByType={};
this.getColorByType.buddy="#dde4f5";
this.getColorByType.chat="#dde4f5";
this.getColorByType.buddygroup="#d7e0f5";
this.getColorByType.none="#dde4f5"
};
Class("ui.button",ui.Element,function(a){this.initialize=function(h,b,f,d,e,c,g){a(this,"initialize");
this.m_control="ui.Button";
this.m_className="uiButton";
this.m_id=h;
this.m_title=f;
this.m_tabIndex=d;
this.m_img=c;
this.m_imageType=g;
this.m_bPreload=false;
this.m_isLegacy=false;
this.m_label=new ui.label();
this.m_labelText=b;
this.m_isDisabled=false;
this.m_hasDisabledImage=true;
this.m_bHover=false;
this.m_onMouseOver=new Array();
this.m_onMouseUp=new Array();
this.m_onMouseDown=new Array();
this.m_skin=e||"";
this.m_state="normal"
};
this.createContent=function(){var b=this.getElement();
this.m_isLegacy=Boolean(this.m_imageType);
b.id=this.m_id;
if(this.m_title){b.title=this.m_title
}if(this.m_tabIndex){b.tabIndex=this.m_tabIndex
}b.control=this.m_control;
if(this.m_isLegacy){this.m_imageBase=this.m_img;
this.m_imgW=b.getAttribute("imgW");
this.m_imgH=b.getAttribute("imgH");
this.m_imgAlt=b.getAttribute("imgAlt");
this.m_bPreload=b.getAttribute("imgPreload")!=false;
this.m_isPng=b.getAttribute("png")=="true"
}else{this.setSkin(this.m_skin)
}if(this.constructor==ui.button){this.createDOMNode()
}return this
};
this.createDOMNode=function(){var b=this.m_element;
if(this.m_isLegacy){this.addClassName("uiButtonLegacy");
this.m_img=createImg(b.id+"img",b,this.m_imgW,this.m_imgH,this.m_imageBase+"."+this.m_imageType,this.m_imgAlt,this.m_bPreload,null,this.m_isPng);
b.appendChild(this.m_img)
}else{this.addClassName(this.m_className);
this.setSkin(this.m_skin,true);
var c=this.m_win.document;
this.m_leftDiv=c.createElement("div");
this.m_leftDiv.className="uiButtonLeft uiButtonLeft-normal";
this.m_centerDiv=c.createElement("div");
this.m_centerDiv.className="uiButtonCenter uiButtonCenter-normal";
this.m_label.create(this.m_id+"_label"+getUniqueId(),this.m_centerDiv,this.m_img,this.m_labelText);
this.m_rightDiv=c.createElement("div");
this.m_rightDiv.className="uiButtonRight uiButtonRight-normal";
b.appendChild(this.m_leftDiv);
b.appendChild(this.m_centerDiv);
b.appendChild(this.m_rightDiv);
var d=c.createElement("div");
d.style.position="absolute";
d.style.top="0";
d.style.left="0";
if(ui.isIE){d.style.width=b.offsetWidth;
d.style.height=b.offsetHeight
}else{d.style.bottom="0";
d.style.right="0"
}if(!ui.isSafari){d.className="blankBackground"
}b.appendChild(d);
this.m_eventsDiv=d
}b.ptr=this;
disableSelection(b,true);
ui.connectEvent(b,"mouseover",this,"onMouseAction",true,true,"over");
ui.connectEvent(b,"mouseout",this,"onMouseAction",true,true,"out");
ui.connectEvent(b,"mouseup",this,"onMouseAction",true,true,"up");
ui.connectEvent(b,"mousedown",this,"onMouseAction",true,true,"down");
ui.connectEvent(b,"keypress",this,"onKeyPress",true,true,"keypress")
};
this.destroy=function(){ui.disconnectAllEvents(this.m_element);
removeElement(this.m_element)
};
this.getLabel=function(){return this.m_label
};
this.onKeyPress=function(d,b){if(d){var c=d.keyCode;
if(c!=13){return true
}ui.setEventHandled(d)
}doFunctions(this.m_onMouseUp,d,b);
if(d){return false
}};
this.onMouseAction=function(e,c,d){if(this.m_isDisabled){return
}ui.setEventHandled(e);
var f="";
var g="";
switch(d){case"over":if(!this.m_isLegacy&&ui.isIE){this.m_eventsDiv.style.display="inline";
this.m_eventsDiv.style.width=this.m_element.offsetWidth;
this.m_eventsDiv.style.height=this.m_element.offsetHeight;
this.m_eventsDiv.style.display="block"
}if(this.m_state=="down"){return
}f="_hot";
this.m_bHover=true;
g=this.m_onMouseOver;
this.setState("hot");
break;
case"out":f="";
this.m_bHover=false;
g=this.m_onMouseOut;
this.setState("normal");
break;
case"up":f="";
this.m_bHover=true;
g=this.m_onMouseUp;
this.setState("hot");
break;
case"down":f="_down";
g=this.m_onMouseDown;
this.setState("down");
break
}if(this.m_isLegacy){var b=this.m_imageBase+f+"."+this.m_imageType;
this.swapImage(b)
}if(g){doFunctions(g,e,c)
}};
this.setSkin=function(b,c){if(!c&&b==this.m_skin){return
}var d=this.m_control.replace(/\./g,"");
this.removeClassName(d+"-"+this.m_skin);
this.removeClassName(d+"-"+this.m_skin+"-"+this.m_state);
this.m_skin=b;
if(this.m_skin){this.addClassName(d+"-"+this.m_skin);
this.addClassName(d+"-"+this.m_skin+"-"+this.m_state)
}};
this.setState=function(b){if(this.m_isLegacy||this.m_state==b){return
}var c=this.m_control.replace(/\./g,"");
this.removeClassName(c+"-"+this.m_state);
this.removeClassName(c+"-"+this.m_skin+"-"+this.m_state);
this.m_state=b;
this.addClassName(c+"-"+this.m_state);
this.addClassName(c+"-"+this.m_skin+"-"+this.m_state);
if(this.m_element){this.m_leftDiv.className="uiButtonLeft uiButtonLeft-"+b;
this.m_centerDiv.className="uiButtonCenter uiButtonCenter-"+b;
this.m_rightDiv.className="uiButtonRight uiButtonRight-"+b
}};
this.refreshImage=function(){this.swapImage(this.m_imageBase+"."+this.m_imageType)
};
this.swapImage=function(b){if(this.m_bPreload&&window.gImages){gImages.requestImage(b,this.m_img)
}else{this.m_img.src=b
}};
this.addOnMouseUp=function(b){this.m_onMouseUp.push(b)
};
this.addOnMouseDown=function(b){this.m_onMouseDown.push(b)
};
this.setHasDisabledImage=function(b){this.m_hasDisabledImage=b
};
this.enable=function(){this.setDisabled(false)
};
this.disable=function(){this.setDisabled(true)
};
this.setDisabled=function(b){b=Boolean(b);
if(this.m_isDisabled==b){return
}this.m_isDisabled=b;
if(this.m_isLegacy){this.swapImage(this.m_imageBase+(b?"_disabled":"")+"."+this.m_imageType)
}else{this.setState(b?"disabled":"normal");
var c=this.getImage();
if(c){this.setImage(c.replace(/(?:_disabled)?\.([a-zA-Z]+)$/,(this.m_hasDisabledImage&&b?"_disabled":"")+".$1"))
}}};
this.isDisabled=function(){return this.m_isDisabled
};
this.setTabIndex=function(b){this.m_element.tabIndex=b
};
this.getImage=function(){return this.m_label.getPreImg()
};
this.setImage=function(c,b,d){this.m_label.setPreImg(c,b,d)
};
this.getText=function(){return this.m_label.getText()
};
this.setText=function(b){this.m_label.setText(b)
}
});
Class("ui.FileUploadButton",ui.button,function(a){this.initialize=function(c,b){a(this,"initialize",[c,b]);
this.m_fileInput
};
this.createContent=function(){a(this,"createContent");
if(this.constructor==ui.FileUploadButton){this.createDOMNode()
}};
this.createDOMNode=function(){a(this,"createDOMNode");
this.m_eventsDiv.style.overflow="hidden";
gEffects.setOpacity(this.m_eventsDiv,0);
this.createFileInput()
};
this.createFileInput=function(){if(this.m_fileInput){removeElement(this.m_fileInput)
}var b=this.m_win.document.createElement("input");
this.m_fileInput=b;
b.type="file";
b.name="file";
b.accept="image/jpeg,image/gif,image/png";
ui.connectEvent(b,"change",this,"selectFile",true,true);
b.style.position="absolute";
if(!ui.isSafari){b.style.fontSize="60pt";
b.style.top=b.style.right="0"
}else{b.style.top=b.style.right="-999px"
}this.m_eventsDiv.appendChild(b);
this.m_eventsDiv.style.zIndex=gWindowMgr.getNextZIndex()
};
this.onMouseAction=function(d,b,c){if(c!="up"){a(this,"onMouseAction",arguments)
}else{if(ui.isSafari){this.m_fileInput.click()
}else{}}};
this.isFileExtensionAllowed=function(){if(!ui.isWin){return true
}var b=this.m_fileInput.value;
if(b&&b.lastIndexOf(".")!=-1){var c=b.substring(1+b.lastIndexOf(".")).toLowerCase();
return(c=="jpg"||c=="gif"||c=="png"||c=="bmp"||c=="jpeg")
}return true
};
this.selectFile=function(){this.setState("normal");
if(this.isFileExtensionAllowed()){if(this.m_onMouseUp){doFunctions(this.m_onMouseUp,this.m_fileInput);
this.createFileInput()
}}else{gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.buddyIconErrorHeader},gLang.buddyIconErrorExt)
}}
});
ui.checkbox=function(){this.create=function(h,d,g,e,f,b){this.m_win=gWin(d);
var a=this.m_win.document.createElement("input");
a.setAttribute("type","checkbox");
a.id=h;
a.tabIndex=e;
if(g){a.checked=true;
a.defaultChecked=true
}if(b){this.addOnMouseUp(b);
this.m_changeHandler=b
}var c=this.m_win.document.createElement("span");
c.setAttribute("descr",f);
c.className="checkboxDescr";
d.appendChild(a);
d.appendChild(c);
this.init(a,c)
};
this.init=function(a,c){this.m_check=a;
this.m_span=c;
this.m_bChecked=a.defaultChecked;
this.m_descr=this.m_span.getAttribute("descr");
if(this.m_descr){this.m_span.innerHTML=this.m_descr
}this.m_span.style.verticalAlign="20%";
var b=this;
this.m_check.onclick=function(d){return b.onCheckMouseUp(d,this)
};
this.m_span.onmouseover=function(d){return b.onMouseOver(d,this)
};
this.m_span.onmouseout=function(d){return b.onMouseOut(d,this)
};
this.m_span.onclick=function(d){return b.onMouseUp(d,this)
};
this.m_check.ptr=this
};
this.setDescr=function(a){if(a){this.m_span.setAttribute("descr",a);
this.m_descr=a;
this.m_span.innerHTML=this.m_descr
}return this.m_descr
};
this.setCheck=function(a){this.m_bChecked=this.m_check.defaultChecked=this.m_check.checked=a;
return this.m_bChecked
};
this.onCheckMouseUp=function(b,a){this.m_bChecked=this.m_check.defaultChecked=a.checked?true:false;
if(this.m_changeHandler){this.m_changeHandler(this.m_bChecked,b,a)
}return true
};
this.onMouseOver=function(b,a){if(!this.m_span){return
}gEffects.fontDecoration(this.m_span,"underline");
ui.setEventHandled(b)
};
this.onMouseOut=function(b,a){if(!this.m_span){return
}gEffects.fontDecoration(this.m_span,"none");
ui.setEventHandled(b)
};
this.onMouseUp=function(b,a){this.m_bChecked=this.m_check.defaultChecked=this.m_check.checked=(this.m_check.checked)?false:true;
ui.setEventHandled(b);
if(this.m_onMouseUp){doFunctions(this.m_onMouseUp,this.m_bChecked,b,a)
}};
this.addOnMouseUp=function(a){this.m_onMouseUp.push(a)
};
this.isChecked=function(){return this.m_bChecked
};
this.m_win=window;
this.m_onMouseUp=new Array();
this.m_bChecked=true;
this.m_descr;
this.m_span;
this.m_check
};
Class("ui.toolbar",ui.Element,function(a){this.initialize=function(b){a(this,"initialize");
this.m_control="ui.toolbar";
this.m_win=window;
this.m_element=null;
this.m_marginLeft=2;
this.m_hSpace=1;
this.m_pos=this.m_marginLeft;
this.m_size="large";
this.m_height;
this.m_buttons=[];
this.m_selectedButton=null;
this.m_selectIndicator=null;
this.m_sizes={small:20,large:26,xlarge:32};
this.m_size=b;
this.m_height=this.m_sizes[b]
};
this.createContent=function(){var c=this.m_element.firstChild;
while(c){if(c.getAttribute&&(c.getAttribute("control")=="ui.toolbarButton")){var b=new ui.toolbarButton(this);
this.addButton(b)
}c=c.nextSibling
}this.m_element.control=this.m_control;
this.addClassName("uiToolbar")
};
this.resize=function(c){if(!c){c=this.m_element.offsetWidth
}this.m_element.style.width=c+"px";
var h=0;
var f=0;
for(var e=this.m_buttons.length-1;
e>=0;
e--){var d=this.m_buttons[e];
if(d.constructor==ui.toolbarFlexibleSpace){h++
}else{f+=d.getWidth()
}}var g=(c-f)/h;
if(g<0){g=0
}var b=0;
for(var e=0;
e<this.m_buttons.length;
e++){var d=this.m_buttons[e];
if(d.constructor==ui.toolbarFlexibleSpace){d.setWidth(g)
}d.m_element.style.position="absolute";
d.m_element.style.left=b+"px";
d.m_element.style.top="0";
b+=d.getWidth()
}};
this.addButton=function(g,b,f,d,e){var c=g;
if(arguments.length>1){if(d){c=new ui.toolbarButton(this,g,b,this.m_size,f,d,e).create(this.m_win);
this.getElement().appendChild(c.getElement())
}else{c=new ui.ToolbarImageButton();
c.create(g,this.m_element,b,this.m_size,f,e)
}}this.appendButton(c);
return c
};
this.appendButton=function(b){this.m_buttons.push(b);
this.m_buttons[b.m_element.id]=b
};
this.getButton=function(b){return this.m_buttons[b]
};
this.removeButtons=function(){while(this.m_buttons.length){var b=this.m_buttons[0];
b.destroy();
this.m_buttons.splice(0,1);
delete this.m_buttons[b.getId()]
}};
this.select=function(b){this.m_selectedButton=b;
if(!this.m_selectIndicator){this.m_selectIndicator=this.m_win.document.createElement("div");
this.m_selectIndicator.className="selectIndicator"
}this.m_selectIndicator.style.height=(this.m_height+4)+"px";
this.m_selectIndicator.style.width=b.getWidth()-(ui.isIE?0:2)+"px";
this.m_selectIndicator.style.left=b.getElement().offsetLeft+"px";
this.m_element.insertBefore(this.m_selectIndicator,this.m_element.firstChild)
};
this.getSelected=function(){return this.m_selectedButton
};
this.destroy=function(){this.removeButtons();
this.m_element.ptr=null;
this.m_element=null
}
});
Class("ui.toolbarButton",ui.button,function(a){this.initialize=function(b,h,c,e,g,d,f){a(this,"initialize",[h,d]);
this.m_control="ui.ToolbarButton";
this.m_className="uiToolbarButton";
this.m_toolbar=b;
this.m_img=c;
this.m_size=e||"large";
this.m_title=g;
this.m_width=32;
this.m_height=26;
this.m_isDisabled=f
};
this.createContent=function(){a(this,"createContent");
this.setImage(this.m_img);
this.setSkin(this.m_size);
this.setDisabled(this.m_isDisabled);
if(this.constructor==ui.toolbarButton){this.createDOMNode()
}};
this.createDOMNode=function(){a(this,"createDOMNode");
if(this.getText()){addClassName(this.m_label.getTextO(),"hasText")
}};
this.getWidth=function(){if(this.m_label&&this.m_label.getElement()){return this.m_label.getPreImgWidth()+this.m_label.getTextO().offsetWidth
}return 0
};
this.setDepressed=function(b){this.setSkin(this.m_size+(b?"-depressed":""))
};
this.isDepressed=function(){return this.m_skin.substring(this.m_skin.length-10)=="-depressed"
};
this.setText=function(b){if(b){addClassName(this.m_label.getTextO(),"hasText")
}else{removeClassName(this.m_label.getTextO(),"hasText")
}a(this,"setText",arguments);
this.m_toolbar.resize()
};
this.setImage=function(d){var b,c;
switch(this.m_size){case"small":b=25;
c=20;
break;
case"large":b=32;
c=26;
break;
case"xlarge":b=32;
c=32;
break
}a(this,"setImage",[d,b,c])
}
});
Class("ui.toolbarFlexibleSpace",ui.toolbarButton,function(a){this.createContent=function(){var b=this.m_win.document.createElement("div");
b.setAttribute("control","ui.toolbarButton");
this.addClassName("uiToolbarButton");
return this
};
this.getWidth=function(){return this.m_width||0
};
this.setWidth=function(b){this.m_width=b
}
});
Class("ui.ToolbarImageButton",ui.element,function(a){this.initialize=function(){this.m_size;
this.m_img;
this.m_title;
this.m_isDisabled=false;
this.m_isDepressed=false;
this.m_hover=false;
this.m_bgImageSrc;
this.m_bgDownImageSrc;
this.m_bgHoldImageSrc;
this.m_onMouseUp=[];
this.m_onMouseOver=[];
this.m_onMouseClick=[];
this.m_width=32;
this.m_height=27;
this.m_imageElement
};
this.init=function(c){this.m_element=c;
var h=c.id||"";
var f=c.parentNode;
var b=c.getAttribute("img");
var d=c.getAttribute("buttonsize");
var g=c.getAttribute("title");
var e=c.getAttribute("disabled")=="true";
this.create(h,f,b,d,g,e)
};
this.create=function(g,e,b,c,f,d){this.m_size=c;
this.m_img=b;
this.m_title=f;
switch(this.m_size){case"small":this.m_width=25;
this.m_height=20;
this.m_bgImageSrc="buttons/btnBack-small.png";
this.m_bgHoldImageSrc="buttons/btnBackHold-small.png";
this.m_bgDownImageSrc="buttons/btnBackDown-small.png";
break;
case"large":this.m_width=32;
this.m_height=27;
this.m_bgImageSrc="buttons/btnBack.png";
this.m_bgHoldImageSrc="buttons/btnBackHold.png";
this.m_bgDownImageSrc="buttons/btnBackDown.png";
break;
case"xlarge":this.m_width=32;
this.m_height=32;
this.m_bgImageSrc="buttons/btnBack-xlarge.gif";
this.m_bgHoldImageSrc="buttons/btnBackDown-xlarge.gif";
this.m_bgDownImageSrc="buttons/btnBackHold-xlarge.gif";
break
}this.m_win=gWin(e);
this.m_element=this.m_win.document.createElement("div");
e.appendChild(this.m_element);
this.m_element.title=this.m_title;
this.m_element.setAttribute("control","ui.toolbarButton");
this.m_element.className="uiToolbarButton uiToolbarImageButton-"+this.m_size;
this.m_element.style.height=this.m_height+"px";
this.m_element.style.width=this.m_width+"px";
this.m_imageElement=this.m_win.document.createElement("div");
this.m_imageElement.className=b+(d?"-disabled":"");
this.m_imageElement.title=f;
this.m_element.appendChild(this.m_imageElement);
ui.connectEvent(this.m_element,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(this.m_element,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(this.m_element,"mousedown",this,"onMouseDown",true,true);
ui.connectEvent(this.m_element,"mouseup",this,"onMouseUp",true,true);
ui.connectEvent(this.m_element,"click",this,"onMouseClick",true,true);
this.setImgPos(0,0);
this.setDisabled(d)
};
this.addArrow=function(b){this.m_arrow=this.m_win.document.createElement("span");
addClassNames(this.m_arrow,"arrow","arrow"+(b?"Up":"Down"));
this.m_element.appendChild(this.m_arrow)
};
this.getWidth=function(){return this.m_width
};
this.setImgPos=function(b,d){var c=this.m_element.firstChild;
if(!c){return
}c.style.position="absolute";
c.style.left=b+"px";
c.style.top=d+"px"
};
this.setBackgroundImage=function(b){this.m_element.style.backgroundImage=!b?"":("url("+gImages.getPath()+b+")")
};
this.setImage=function(b){this.m_img=b;
this.m_imageElement.className=b+(this.m_isDisabled?"-disabled":"")
};
this.setTitle=function(b){this.m_title=b;
this.m_imageElement.title=this.m_title;
this.m_element.title=this.m_title
};
this.onMouseOver=function(b){ui.setEventHandled(b);
if(this.m_isDisabled){return
}this.m_hover=true;
this.setBackgroundImage(this.m_isDepressed?this.m_bgDownImageSrc:this.m_bgImageSrc);
if(this.m_arrow){this.m_arrow.style.display="block"
}doFunctions(this.m_onMouseOver,b)
};
this.onMouseOut=function(b){ui.setEventHandled(b);
if(this.m_isDisabled){return
}this.m_hover=false;
this.setBackgroundImage(this.m_isDepressed?this.m_bgHoldImageSrc:"");
if(this.m_arrow&&!this.m_isDepressed){this.m_arrow.style.display="none"
}this.setImgPos(0,0)
};
this.onMouseDown=function(b){if(ui.getMouseButton(b)==2){return
}if(this.m_isDisabled){return
}ui.setEventHandled(b);
this.setBackgroundImage(this.m_bgDownImageSrc);
this.setImgPos(1,1)
};
this.onMouseUp=function(b){if(ui.getMouseButton(b)==2){return
}if(this.m_isDisabled){return
}this.setBackgroundImage(this.m_isDepressed?this.m_bgHoldImageSrc:this.m_bgImageSrc);
this.setImgPos(0,0);
doFunctions(this.m_onMouseUp,b)
};
this.onMouseClick=function(b){if(ui.getMouseButton(b)==2){return
}if(this.m_isDisabled){return
}doFunctions(this.m_onMouseClick,b)
};
this.addOnMouseClick=function(b){this.m_onMouseClick.push(b)
};
this.addOnMouseUp=function(b){this.m_onMouseUp.push(b)
};
this.removeOnMouseUp=function(c){for(var b=this.m_onMouseUp.length-1;
b>=0;
b--){if(this.m_onMouseUp[b]==c){this.m_onMouseUp.splice(b,1)
}}};
this.addOnMouseOver=function(b){this.m_onMouseOver.push(b)
};
this.removeOnMouseOver=function(c){for(var b=this.m_onMouseOver.length-1;
b>=0;
b--){if(this.m_onMouseOver[b]==c){this.m_onMouseOver.splice(b,1)
}}};
this.removeAllOnMouseOver=function(){this.m_onMouseOver=[]
};
this.setDepressed=function(b){if(this.m_isDepressed==b){return
}this.m_isDepressed=b;
this.setBackgroundImage(b?this.m_bgHoldImageSrc:"");
if(this.m_arrow){this.m_arrow.style.display=b?"block":"none"
}};
this.isDepressed=function(){return this.m_isDepressed
};
this.setDisabled=function(b){b=Boolean(b);
if(this.m_isDisabled==b){return
}this.m_isDisabled=b;
this.m_imageElement.className=this.m_img+(b?"-disabled":"");
this.m_element.style.cursor=b?"default":((ui.isIE&&ui.isIE<=5.5)?"hand":"pointer");
this.m_element.disabled=b
};
this.destroy=function(){ui.disconnectAllEvents(this.m_element);
removeElement(this.m_element)
}
});
ui.tabbar=function(){this.create=function(e,c,b,d){this.m_win=gWin(c);
var a=this.m_win.document.createElement("div");
if(d){a.style.height=d+"px"
}if(!a){return
}a.id=e;
a.control="ui.tabbar";
a.className="uiTabBar";
if(b){a.setAttribute("tabW",b)
}if(d){a.setAttribute("tabH",d)
}a.id=e;
this.init(c.appendChild(a))
};
this.init=function(b){if(!b){return
}this.m_element=b;
var a=parseInt(this.m_element.getAttribute("tabW"));
if(a){this.m_barW=a
}var c=this.m_element.getAttribute("tabH");
if(c){if(!ui.isIE){c-=1
}this.m_element.style.height=c+"px";
this.m_barH=c
}var d=this.m_element.firstChild;
while(d){if(d.getAttribute&&(d.getAttribute("control")=="ui.tab")){this.initTab(d)
}d=d.nextSibling
}this.m_element.ptr=this
};
this.initTab=function(b){var a=new ui.tab();
a.init(b);
this.layoutTab(a);
this.m_tabs[a.m_element.id]=a
};
this.addTab=function(c,e,n,k,a,m,g,l,f,h,b){var o;
if(!this.m_tabs[c]){o=new ui.tab();
o.create(c,this.m_element,e,n,k,a,m,g,l,f,h,b);
var d=this;
o.addOnMouseUp(function(){d.selectTab(c)
});
this.m_tabs[o.m_element.id]=o
}else{o=this.m_tabs[c]
}this.layoutTab(o,b);
return o
};
this.selectTab=function(b){var a=null;
for(var d in this.m_tabs){if(!d||!this.m_tabs[d]||(d==b)){continue
}a=this.m_tabs[d].m_element;
removeClassName(a,"uiTabSelected");
if(ui.isIE){var c=this.m_barH-this.m_marginTop-1
}else{var c=this.m_barH-this.m_marginTop
}a.style.height=c+"px";
this.m_tabs[d].removeCorners()
}a=this.m_tabs[b].m_element;
addClassName(a,"uiTabSelected");
if(ui.isIE){var c=(this.m_barH-this.m_marginTop)
}else{var c=(this.m_barH-this.m_marginTop-1)
}a.style.height=c;
this.m_tabs[b].addCorners()
};
this.getTab=function(a){return this.m_tabs[a]
};
this.resetLayout=function(){this.m_pos=this.m_marginLeft
};
this.layoutTab=function(a,b){a.m_element.style.left=this.m_pos+"px";
a.m_element.style.top=this.m_marginTop+"px";
a.m_element.style.width=b+"px";
a.m_element.style.height=(this.m_barH-this.m_marginTop)+"px";
this.m_pos+=(b+this.m_hSpace)
};
this.m_win=window;
this.m_element=null;
this.m_barW=0;
this.m_barH=20;
this.m_marginLeft=5;
this.m_marginTop=5;
this.m_hSpace=4;
this.m_pos=this.m_marginLeft;
this.m_tabs=new Array()
};
ui.tab=function(){this.create=function(c,l,d,n,k,a,m,f,h,e,g,b){this.m_win=gWin(l);
var o=this.m_win.document.createElement("div");
if(!o){return
}o.id=c;
o.setAttribute("inactiveTextColor",f);
o.setAttribute("activeTextColor",h);
o.setAttribute("inactiveBgColor",a);
o.setAttribute("activeBgColor",m);
o.setAttribute("leftCorner",e);
o.setAttribute("rightCorner",g);
if(d&&d.length){o.setAttribute("tabimg",d)
}if(k&&k.length){o.setAttribute("postImg",k)
}o.setAttribute("label",n);
o.setAttribute("width",b);
o.id=c;
o.className="uiTab";
o.setAttribute("control","uiTab");
o.ptr=this;
this.init(l.appendChild(o))
};
this.init=function(a){this.m_element=a;
this.m_activeTextColor=a.getAttribute("activeTextColor");
this.m_inactiveTextColor=a.getAttribute("inactiveTextColor");
this.m_activeBgColor=a.getAttribute("activeBgColor");
this.m_inactiveBgColor=a.getAttribute("inactiveBgColor");
this.m_leftCorner=a.getAttribute("leftCorner");
this.m_rightCorner=a.getAttribute("rightCorner");
this.m_img=a.getAttribute("tabimg");
this.m_postImg=a.getAttribute("postImg");
this.m_postImgW=a.getAttribute("postImgW");
this.m_text=a.getAttribute("label");
this.m_width=parseInt(a.getAttribute("width"));
if((this.m_width%2)==0){this.m_width+=1;
this.m_element.setAttribute("width",this.m_width)
}this.m_label=new ui.label();
this.m_label.create(this.m_element.id+"label",this.m_element,this.m_img,this.m_text,this.m_postImg,this.m_postImgW,this.m_width);
this.m_label.m_element.style.position="relative";
this.m_label.m_element.style.top="3px";
ui.connectEvent(this.m_element,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(this.m_element,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(this.m_element,"mouseup",this,"onMouseUp",true,true);
ui.connectEvent(this.m_element,"mousedown",this,"onMouseDown",true,true)
};
this.removeCorners=function(){var a=getPartFromElement(this.m_element,"nwcorner");
if(a){this.m_element.removeChild(a)
}a=getPartFromElement(this.m_element,"necorner");
if(a){this.m_element.removeChild(a)
}};
this.addCorners=function(){var c=getPartFromElement(this.m_element,"nwcorner");
if(c){return
}var a=this.m_win.document.createElement("div");
a.id="nwcorner";
addClassName(a,"roundedTab-nw");
this.m_element.appendChild(a);
var b=this.m_win.document.createElement("div");
b.id="necorner";
addClassName(b,"roundedTab-ne");
this.m_element.appendChild(b)
};
this.onMouseOver=function(b,a){ui.setEventHandled(b);
this.m_bHover=true;
this.m_label.m_element.style.textDecoration="underline"
};
this.onMouseOut=function(b,a){ui.setEventHandled(b);
this.m_bHover=false;
this.m_label.m_element.style.textDecoration="none"
};
this.onMouseDown=function(b,a){this.m_bHover=true;
this.m_label.m_element.style.textDecoration="underline";
if(this.m_onMouseDown){doFunctions(this.m_onMouseDown,b,a)
}};
this.onMouseUp=function(b,a){ui.setEventHandled(b);
this.m_bHover=false;
this.m_label.m_element.style.textDecoration="none";
if(this.m_onMouseUp){doFunctions(this.m_onMouseUp,b,a)
}};
this.addOnMouseUp=function(a){this.m_onMouseUp.push(a)
};
this.addOnMouseDown=function(a){this.m_onMouseDown.push(a)
};
this.m_win=window;
this.m_element=null;
this.m_label=null;
this.m_bHover=false;
this.m_text="";
this.m_width=100;
this.m_activeTextColor="#000000";
this.m_inactiveTextColor="#000000";
this.m_activeBgColor="#FFFFFF";
this.m_inactiveBgColor="#CCCCCC";
this.m_img=null;
this.m_postImg=null;
this.m_postImgW=0;
this.m_onMouseOver=new Array();
this.m_onMouseUp=new Array();
this.m_onMouseDown=new Array()
};
Class("uiDlgButton",ui.element,function(a){this.initialize=function(){a(this,"initialize");
this.m_state;
this.m_element=null;
this.m_imgElem=null;
this.m_bHover=false;
this.m_bDisabled=false;
this.m_onMouseUp=new Array();
this.m_onMouseDown=new Array()
};
this.create=function(g,d,c,f){this.m_win=gWin(d);
var b=this.m_win.document.createElement("div");
if(!b){return
}b.id=g;
b.className="uiDlgButton";
b.setAttribute("state",f);
b.setAttribute("control","uiDlgButton");
b.ptr=this;
b.state=f;
b=d.appendChild(b);
var e=this.m_win.document.createElement("div");
e.className="uiDlgButton"+c;
e.style.width="19px";
e.style.height="19px";
this.m_imgElem=b.appendChild(e);
this.init(b)
};
this.init=function(b){this.m_element=b;
this.m_state=this.m_element.getAttribute("state");
if(this.m_state=="disable"){this.m_bDisabled=true
}ui.connectEvent(this.m_element,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(this.m_element,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(this.m_element,"mouseup",this,"onMouseUp",true,true);
ui.connectEvent(this.m_element,"mousedown",this,"onMouseDown",true,true)
};
this.changeType=function(b){this.m_imgElem.className="uiDlgButton"+b
};
this.refreshImage=function(){if(this.m_state=="disable"){addClassName(this.m_element,"disable")
}else{removeClassName(this.m_element,"disable")
}};
this.onMouseOver=function(c,b){ui.setEventHandled(c);
this.m_bHover=true;
if(!this.m_bDisabled){addClassName(this.m_element,"hot")
}};
this.onMouseOut=function(c,b){ui.setEventHandled(c);
this.m_bHover=false;
if(!this.m_bDisabled){removeClassName(this.m_element,"hot");
removeClassName(this.m_element,"down")
}};
this.onMouseDown=function(c,b){this.m_bHover=true;
if(!this.m_bDisabled){addClassName(this.m_element,"down");
if(this.m_onMouseDown){doFunctions(this.m_onMouseDown,c,b)
}}};
this.onMouseUp=function(c,b){ui.setEventHandled(c);
this.m_bHover=false;
if(!this.m_bDisabled){removeClassName(this.m_element,"down");
removeClassName(this.m_element,"hot");
if(this.m_onMouseUp){doFunctions(this.m_onMouseUp,c,b)
}}};
this.addOnMouseUp=function(b){this.m_onMouseUp.push(b)
};
this.addOnMouseDown=function(b){this.m_onMouseDown.push(b)
}
});
uiDlgButtons=function(){this.create=function(f,e,c,b,a){this.m_win=gWin(e);
var d=this.m_win.document.createElement("div");
if(!d){return
}d.id=f;
d.setAttribute("control","uiDlgButtons");
d.className="uiDlgButtons";
d.setAttribute("close",a);
d.setAttribute("minimize",c);
d.setAttribute("maximize",b);
d.ptr=this;
e.appendChild(d);
this.m_element=getPartFromElement(e,f);
if(c!="none"){this.m_minimizeBtn=new uiDlgButton();
this.m_minimizeBtn.create(f+"-min",this.m_element,"Min",c)
}if(b!="none"){this.m_maximizeBtn=new uiDlgButton();
this.m_maximizeBtn.create(f+"-max",this.m_element,"Max",b)
}if(a!="none"){this.m_closeBtn=new uiDlgButton();
this.m_closeBtn.create(f+"-close",this.m_element,"Close",a)
}this.init(d)
};
this.init=function(b){this.m_element=b;
this.m_win=gWin(b);
var a=this.m_element.getAttribute("img");
if(!a){return
}var c=this.m_win.document.createElement("img");
if(!c){return
}c=this.m_element.appendChild(c);
c.src=gImages.requestImage(a,c)
};
this.updateButtons=function(a){switch(a){case"min":if(this.m_minimizeBtn){this.m_minimizeBtn.changeType("Min")
}break;
case"max":if(this.m_maximizeBtn){this.m_maximizeBtn.changeType("Max")
}break;
case"minrestore":if(this.m_minimizeBtn){this.m_minimizeBtn.changeType("Restore")
}break;
case"maxrestore":if(this.m_maximizeBtn){this.m_maximizeBtn.changeType("Restore")
}break
}};
this.addOnCloseUp=function(a){if(this.m_closeBtn){this.m_closeBtn.addOnMouseUp(a)
}};
this.addOnMinimizeUp=function(a){if(this.m_minimizeBtn){this.m_minimizeBtn.addOnMouseUp(a)
}};
this.addOnMaximizeUp=function(a){if(this.m_maximizeBtn){this.m_maximizeBtn.addOnMouseUp(a)
}};
this.addOnCloseDown=function(a){if(this.m_closeBtn){this.m_closeBtn.addOnMouseDown(a)
}};
this.addOnMinimizeDown=function(a){if(this.m_minimizeBtn){this.m_minimizeBtn.addOnMouseDown(a)
}};
this.addOnMaximizeDown=function(a){if(this.m_maximizeBtn){this.m_maximizeBtn.addOnMouseDown(a)
}};
this.getWidth=function(){return this.m_element.offsetWidth
};
this.getHeight=function(){return this.m_element.offsetHeight
};
this.m_win=window;
this.m_minimizeBtn;
this.m_maximizeBtn;
this.m_closeBtn;
this.m_element=null;
this.m_hover=false
};
Class("ui.deferredDlg",lib.deferred,function(a){this.initialize=function(o,f){a(this,"initialize");
this.m_framePadding=4;
var n=argsToArray(f);
var c=n[0];
var q=n[4];
var p=n[5];
var s=n[6];
var l=n[7];
var k="favicon";
if(n[3]){var b;
if((b=n[3].lastIndexOf("."))!=-1){k=n[3].substring(0,b)
}else{k=n[3]
}}var g=this;
var e=-1;
function t(h){g.addBoth(hitch(g,"removeDlgFromPendingList"),1);
g.addBoth(h,1);
var u=g.openWindow(o,q,p,s,l);
o.m_poppedOut=!!u;
if(!u){g.displayPopupError();
g.errback(o,window);
return
}gBrowser.setFavIconSrc(k,u);
e=gTimerMgr.addTimer(function(){if(u.closed){o.m_poppedOut=false;
gTimerMgr.removeTimer(e);
g.errback(o,window)
}},125)
}function d(u,h){gTimerMgr.removeTimer(e);
gWin.remember(h);
$.remember(h.document);
n[1]=h.document.body;
if(h===window){var v=gWindowMgr.getVisibleWindowPos(n[6],n[7],false);
n[4]=v.x;
n[5]=v.y
}u.create.apply(u,n)
}function m(u,h){gTimerMgr.removeTimer(e);
if(gWindows[c]){gWindows[c].m_bPoppingOut=false
}}this.addCb(d,-1);
this.addEb(m,-1);
this.addCb(hitch(this,"resizePopupToWindow"),-1);
this.addCb(hitch(this,"hookupWinClose"),1);
this.addCb(hitch(this,"hookupWinRename"),1);
this.addCb(hitch(this,"hookupWinResize"),1);
this.addCb(hitch(this,"hookupWinEvents"),1);
this.addCb(hitch(this,"mergeIntoRealWindow"),1);
ui.deferredDlg.pendingWindows[c]=this;
gSerializer.serialize(t)
};
this.openWindow=function(m,p,o,s,k){var n=calcWinPos(window);
var e=calcWinChrome(window);
var c={menubar:"no",location:navigator.userAgent.indexOf("Camino")!=-1?"no":"yes",toolbar:"no",scrollbars:"no",status:"no",width:s,height:k-m.m_minimizeH,left:n.x+e.w+p,top:n.y+e.h+o,resizable:"yes"};
var g=[];
for(var f in c){g.push(f+"="+c[f])
}var q=g.join(",");
var d=this,b=getUniqueId()+"";
var l=window.open("/popup.html#",b,q);
if(l){l.id=b;
window._popOutCbs=window._popOutCbs||{};
window._popOutCbs[b]=[l,function(){d.callback(m,l);
delete window._popOutCbs[b]
}]
}return l
};
window._fetchCb=function(d){function c(h,g){if(window._popOutCbs[h][0]===g){var f=window._popOutCbs[h][1];
delete window._popOutCbs[h];
if(g[h]){delete g[h]
}return f
}else{return false
}}for(var e in window._popOutCbs){var b;
if(d.id&&(b=c(d.id,d))){return b
}if((b=c(e,d))){return b
}}return function(){d.close()
}
};
this.displayPopupError=function(){if(!ui.deferredDlg.m_bBlockedFlag){var b="";
if(ui.isIE){b="ie"
}else{if(ui.isFirefox){b="firefox"
}}var d=gLang.popupBlockedMsg;
if(b){var c=(b=="ie"?gLang.popupie:gLang.popupfirefox);
d+="<br><br>"+c+'<br><br><img src="'+gImages.getPath()+"popup_"+b+'.png"></img>'
}gWindowMgr.createNotifyDlg({id:getUniqueId(),caption:gLang.popupBlocked,w:d?300:275,h:d?200:130},d);
ui.deferredDlg.m_bBlockedFlag=true
}};
this.removeDlgFromPendingList=function(c,b){for(var d in ui.deferredDlg.pendingWindows){if(ui.deferredDlg.pendingWindows[d]==this){delete ui.deferredDlg.pendingWindows[d];
break
}}};
this.resizePopupToWindow=function(f,e){var b=e.document.body;
if(!b){return
}var c=b.offsetWidth,d=b.offsetHeight;
d+=f.m_marginH-(this.m_framePadding*2);
f.resizeContent(f.m_contentArea,c<f.m_minX?f.m_minX:c,d<f.m_minY?f.m_minY:d)
};
this.hookupWinRename=function(d,c){if(!d.m_captionChangeListeners){d.m_captionChangeListeners=[]
}function b(e){gBrowser.setTitle(c,e)
}d.m_captionChangeListeners.push(b);
b(d.getWindowCaption())
};
this.hookupWinResize=function(c,b){if(!c.m_onCallbackMoveToTop){c.m_onCallbackMoveToTop=[]
}c.m_onCallbackMoveToTop.push(function(){b.focus()
});
var e;
function d(){clearTimeout(e);
e=setTimeout(hitch(this,function(){try{this.resizePopupToWindow(c,b)
}catch(f){}}),50)
}ui.connectEvent(b,"resize",{fn:hitch(this,d)},"fn",true)
};
this.hookupWinClose=function(d,c){function b(){d.closeWindow()
}d.m_onClose=d.m_onClose||[];
d.m_onClose.push(function(){ui.cleanUp(d.m_element);
if(gWindows[d.m_id]===d){gWindowMgr.unregisterWindow(d.m_id)
}$.forget(c.document);
gWin.forget(c);
if(ui.isIE){ui.deferredDlg.m_closingWindows.push(c);
if(!ui.deferredDlg.m_closingWindows.m_timerId){ui.deferredDlg.m_closingWindows.m_timerId=gTimerMgr.addTimer(hitch(ui.deferredDlg,"checkForClosedWindows"),125)
}}c.close()
});
ui.connectEvent(c,"unload",{fn:b},"fn")
};
this.hookupWinEvents=function(c,b){gBrowser.connectEventsToWin(b)
};
this.mergeIntoRealWindow=function(f,e){var b=e.document.body;
var c=b.offsetWidth,d=b.offsetHeight;
this.showNonContent(f,false);
f.m_contentArea.style.top=this.m_framePadding+"px";
f.resizeContent(f.m_contentArea,c,d+f.m_marginH-(this.m_framePadding*2))
};
this.showNonContent=function(d,b){if(typeof(b)=="undefined"){b=true
}var c=b?"visible":"hidden";
var e=d.m_element.firstChild;
while(e){if(b||e!==d.m_contentArea){e.style.visibility=c
}e=e.nextSibling
}getPartFromElement(d.m_element,"se").style.visibility=c
}
});
ui.deferredDlg.pendingWindows={};
ui.deferredDlg.m_bBlockedFlag=false;
ui.deferredDlg.m_closingWindows=[];
ui.deferredDlg.getWndOpening=function(a){return this.pendingWindows[a]||null
};
ui.deferredDlg.checkForClosedWindows=function(){if(!this.m_closingWindows.length){gTimerMgr.removeTimer(this.m_closingWindows.m_timerId);
this.m_closingWindows.m_timerId=null
}for(var a=0;
a<this.m_closingWindows.length;
a++){if(this.m_closingWindows[a].closed){this.m_closingWindows.splice(a,1);
a--
}else{this.m_closingWindows[a].close()
}}};
Class("ui.dlg",function(){this.initialize=function(){this.m_win=window;
this.m_classNamePrefix=this.m_classNamePrefix||"uiDlg";
this.m_bDisplayActive=false;
this.m_bFlashing=false;
this.m_element=null;
this.m_parent=null;
this.m_bActive=false;
this.m_bVisible=true;
this.m_minimizeW=150;
this.m_minimizeH=28;
this.m_state="normal";
this.m_lastMinPos;
this.m_lastMaxPos;
this.m_lastPos;
this.m_bResizable=false;
this.m_resizeHandle;
this.m_dr=new ui.drag.dragObject();
this.m_minX=100;
this.m_minY=100;
this.m_maxX=99999;
this.m_maxY=99999;
this.m_marginX=4;
this.m_marginY=30;
this.m_marginW=8;
this.m_marginH=40;
this.m_caption=null;
this.m_contentArea=null;
this.m_windowButtons=null;
this.m_skin="";
this.m_chromelessMaxDragY=0;
this.m_chromelessVersion=2;
this.m_id;
this.m_poppedOut=false;
this.m_bPoppingOut=false;
this.m_onMouseDown=[];
this.m_onDragStart=[];
this.m_onStopResize=[];
this.m_onStopMove=[];
this.m_onMinimize=[];
this.m_onCallbackRestoreMinimize=[];
this.m_onMaximize=[];
this.m_onRestoreMaximize=[];
this.m_onCallbackRestoreMaximize=[];
this.m_onClose=[];
this.m_onFocus=[];
this.m_onKeyPress=[];
this.m_onBlur=[];
this.m_onMoveToTop=[];
this.m_onCallbackMoveToTop=[];
this.m_onWindowFocus=[];
this.m_onWindowUnfocus=[];
this.m_delegate;
this.m_isRestoring=false
};
this.create=function(b,n,o,p,k,g,l,c,d,f){if(!n&&ui.deferredDlg){return new ui.deferredDlg(this,arguments)
}else{if(!n){n=window.document.body
}}this.m_win=gWin(n);
if(this.isPoppedOut()){this.m_win.m_windowId=b
}var e=this.m_win.document.createElement("div");
e.setAttribute("type",f);
if(d){e.setAttribute("resizable",d)
}e.setAttribute("caption",o);
e.ptr=this;
this.m_id=e.id=b;
e.className=this.m_classNamePrefix;
e.setAttribute("captionImg",p);
var m=(this.getTemplate?this.getTemplate():null);
if(m){e.innerHTML=m
}if(l>document.body.offsetWidth){l=document.body.offsetWidth
}if(c>document.body.offsetHeight){c=document.body.offsetHeight
}if(k+l>document.body.offsetWidth){k=document.body.offsetWidth-l
}if(g+c>document.body.offsetHeight){g=document.body.offsetHeight-c
}if(k<0||this.isPoppedOut()){k=0
}if(g<0||this.isPoppedOut()){g=0
}e.style.left=k+"px";
e.style.top=g+"px";
e.style.width=l+"px";
e.style.height=c+"px";
if(ui.isMac&&ui.isFirefox){e.style.position="fixed"
}if(!n){n=this.m_win.document.body
}e=n.appendChild(e);
return this.init(e)
};
this.initContent=function(){if(!this.m_delegate){var b=this.m_win.document.createElement("span");
b.className="unselectable";
b.unselectable="on";
b.style.lineHeight="1";
b.style.fontSize="11px";
setText(b,gLang.oneMoment);
getPartFromElement(this.m_element,"bg").appendChild(b);
this.m_loadingMessage=b
}return true
};
this.connectContentEvents=function(){};
this.init=function(d){var f=new lib.deferred().callback(this);
if(!d){return f
}this.m_element=d;
this.m_parent=this.m_element.parentNode;
this.m_bResizable=(getbAttribute(this.m_element,"resizable"))?true:false;
if(this.m_bResizable){this.m_marginH=36;
addClassName(this.m_element,"resizable")
}var g=this.createWindowTable();
var c=this.m_element.getAttribute("caption");
var e=this.m_element.getAttribute("captionImg");
this.addWindowButtons();
this.setWindowCaption(c,e);
this.createContentArea(g);
if(this.m_bResizable){var b=this.m_win.document.createElement("img");
b.className=this.m_classNamePrefix+"Handle";
b.id="handle";
gImages.requestImage("handle.gif",b);
b.style.position="absolute";
b.style.bottom=(ui.isIE?1-this.m_element.offsetHeight%2:1)+"px";
b.style.right=(ui.isIE?1-this.m_element.offsetWidth%2:1)+"px";
this.m_element.appendChild(b);
this.m_resizeHandle=b
}this.m_element.ptr=this;
if(this.onRender){this.onRender()
}this.connectEvents();
return f
};
this.setId=function(b){this.m_id=b;
this.m_element.id=b;
this.m_caption.getElement().id=b+"caption";
this.m_caption.m_id=b+"caption"
};
this.getDelegate=function(){return this.m_delegate
};
this.setDelegate=function(b,c){if(this.m_delegate){return
}this.m_delegate=b;
if(this.m_element){b.m_dlg=this;
b.m_element=this.getBody();
b.m_win=this.m_win;
b.m_id=this.m_id+"-delegate";
if(this.m_loadingMessage){removeElement(this.m_loadingMessage);
this.m_loadingMessage=null
}if(b.setDelegateParams){b.setDelegateParams.apply(b,c)
}if(b.getTemplate){b.m_element.innerHTML=b.getTemplate()
}b.initContent();
if(this.m_delegate.m_minX){this.m_minX=this.m_delegate.m_minX
}if(this.m_delegate.m_minY){this.m_minY=this.m_delegate.m_minY
}}};
this.isPoppedOut=function(){return this.m_poppedOut
};
this.onGlobalKeyPress=function(c,b){if(this.m_onKeyPress){doFunctions(this.m_onKeyPress,c,b)
}};
this.onGlobalKeyDown=function(c,b){if(this.m_onKeyDown){doFunctions(this.m_onKeyDown,c,b)
}};
this.onKeyPress=function(b){if(this.m_onKeyPress){doFunctions(this.m_onKeyPress,b)
}};
function a(c,d){if(!this[c]){return
}for(var b=0;
b<this[c].length;
b++){if(this[c][b]==d){this[c].splice(b,1);
return
}}}this.addOnKeyPress=function(c,b){this.m_onKeyPress.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnKeyDown=function(c,b){this.m_onKeyDown.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnClose=function(c,b){this.m_onClose.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnFocus=function(c,b){this.m_onFocus.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnMouseDown=function(c,b){this.m_onMouseDown.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnMoveToTop=function(c,b){this.m_onMoveToTop.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.addOnStopResize=function(b){this.m_onStopResize.push(b)
};
this.removeOnMoveToTop=function(b){a.call(this,"m_onMoveToTop",b)
};
this.addOnBlur=function(c,b){this.m_onBlur.push(function(e,d){if(c[b]){c[b](e,d)
}})
};
this.getZIndex=function(){return parseInt(this.m_element.style.zIndex)
};
this.setZIndex=function(b){this.m_element.style.zIndex=Math.max(b,1)
};
this.getElement=function(){return this.m_element
};
this.createWindowTable=function(){var c=this.m_element.innerHTML;
var b='<table id="windowFrame" class="'+this.m_classNamePrefix+'Frame">			<tr class="'+this.m_classNamePrefix+'RowN">				<td id="nw" class="'+this.m_classNamePrefix+'NW">&nbsp;<br>				<td id="n" class="'+this.m_classNamePrefix+'N">&nbsp;<br>				<td id="ne" class="'+this.m_classNamePrefix+'NE">&nbsp;<br>			</tr>			<tr class="'+this.m_classNamePrefix+'RowBar">				<td id="barw" class="'+this.m_classNamePrefix+'BarW">&nbsp;<br>				<td id="barn" class="'+this.m_classNamePrefix+'BarN">&nbsp;<br>				<td id="bare" class="'+this.m_classNamePrefix+'BarE">&nbsp;<br>			</tr>			<tr class="'+this.m_classNamePrefix+'RowBody">				<td id="w" class="'+this.m_classNamePrefix+'W">&nbsp;<br>				<td id="bg" class="'+this.m_classNamePrefix+'Bg" align="center" valign="center">				<td id="e" class="'+this.m_classNamePrefix+'E">&nbsp;<br>			</tr>			<tr class="'+this.m_classNamePrefix+'RowS">				<td id="sw" class="'+this.m_classNamePrefix+'SW">&nbsp;<br>				<td id="s" class="'+this.m_classNamePrefix+'S">&nbsp;<br>				<td id="se" class="'+this.m_classNamePrefix+'SE">&nbsp;<br>			</tr>		</table>';
this.m_element.innerHTML=b;
this.m_windowFrame=this.m_element.getElementsByTagName("table")[0];
this.setSkin(this.m_skin);
addClassName(this.m_windowFrame,"inactive");
return c
};
this.setSkin=function(b){if(!this.m_windowFrame){this.m_skin=b;
return
}if(this.isPoppedOut()){removeClassName(gDoc(this.m_element).body,this.m_skin)
}removeClassName(this.m_element,this.m_skin);
this.m_skin=b;
addClassName(this.m_element,this.m_skin);
if(this.isPoppedOut()){addClassName(gDoc(this.m_element).body,this.m_skin)
}if(this.m_skin=="chromeless"){this.m_marginW=8;
this.m_marginH=this.m_bResizable?14:18
}else{this.m_marginW=8;
this.m_marginH=this.m_bResizable?36:40
}};
this.setWindowCaption=function(h,e){if(!this.m_windowFrame){return
}var k=this.m_windowFrame.rows.length;
var c=this.m_windowFrame.rows[k-3].cells[1];
var g=this.m_windowFrame.rows[1].cells[2];
if(!c){return
}if(!this.m_caption){if(ui.isIE){var b=c.offsetWidth;
if(this.m_windowButtons){b-=this.m_windowButtons.m_element.offsetWidth
}}else{var b=(this.m_windowButtons?this.m_windowButtons.m_element.offsetLeft:g.offsetLeft)
}if(ui.isSafari&&(b>56)){b-=56
}this.m_caption=new ui.label();
this.m_caption.create(this.m_id+"caption",c,e,h,"","",b);
this.m_caption.addClassName(this.m_classNamePrefix+"Caption");
this.m_caption.m_cssProperties={fontSize:"12px",fontWeight:"bold",fontFamily:"Tahoma, Arial, sans-serif"}
}else{this.m_caption.setText(h);
if(e){this.m_caption.setPreImg(e)
}}var f=this.m_captionChangeListeners;
for(var d=0;
f&&d<f.length;
++d){f[d](stripWhitespace(h))
}};
this.getWindowCaption=function(){if(this.m_caption&&this.m_caption.getText){return this.m_caption.getText()
}};
this.addWindowButtons=function(){var c=this.m_element.getAttribute("type");
if(c=="none"){return
}this.m_windowButtons=new uiDlgButtons();
var b=getPartFromElement(this.m_element,"barn");
switch(c){case"close":this.m_windowButtons.create(this.m_id+"-windowbtns",b,"none","none","enable");
break;
case"onlymin":this.m_windowButtons.create(this.m_id+"-windowbtns",b,"enable","none","none");
break;
case"noclose":this.m_windowButtons.create(this.m_id+"-windowbtns",b,"enable","enable","none");
break;
case"nominmax":this.m_windowButtons.create(this.m_id+"-windowbtns",b,"disable","disable","enable");
break;
case"none":break;
default:this.m_windowButtons.create(this.m_id+"-windowbtns",b,"enable","enable","enable");
break
}this.m_windowButtons.addOnCloseUp(hitch(this,"closeWindow"));
this.m_windowButtons.addOnMinimizeUp(hitch(this,"minimizeWindow"));
this.m_windowButtons.addOnMaximizeUp(hitch(this,"maximizeWindow"));
this.m_windowButtons.addOnCloseDown(hitch(this,"onMouseDown"));
this.m_windowButtons.addOnMinimizeDown(hitch(this,"onMouseDown"));
this.m_windowButtons.addOnMaximizeDown(hitch(this,"onMouseDown"))
};
this.createContentArea=function(c){var b=this.m_win.document.createElement("div");
b.innerHTML=c;
b.id="content";
addClassName(b,this.m_classNamePrefix+"ContentArea");
this.resizeContent(b,this.m_element.offsetWidth,this.m_element.offsetHeight);
this.m_contentArea=this.m_element.insertBefore(b,this.m_windowFrame)
};
this.connectBorderMouseDown=function(b){if(b){ui.connectEvent(b,"mousedown",this,"onBorderMouseDown",true,true)
}};
this.connectEvents=function(){var b=this.m_element.getElementsByTagName("td");
var c=this.toHash(b);
if(this.m_element.getAttribute("resizable")=="false"){return
}if(this.m_bResizable&&this.m_windowButtons.m_maximizeBtn){ui.connectEvent(c.barn,"dblclick",this,"restoreWindow")
}this.connectBorderMouseDown(c.barn);
this.connectBorderMouseDown(c.bare);
this.connectBorderMouseDown(c.barw);
this.connectBorderMouseDown(c.nw);
this.connectBorderMouseDown(c.n);
this.connectBorderMouseDown(c.ne);
this.connectBorderMouseDown(c.w);
this.connectBorderMouseDown(c.e);
this.connectBorderMouseDown(c.sw);
this.connectBorderMouseDown(c.s);
this.connectBorderMouseDown(c.se);
this.connectBorderMouseDown(this.m_resizeHandle);
this.connectBorderMouseDown(this.getBody());
this.addOnMouseDown(this,"callActivate");
this.addOnFocus(this,"handleFocus")
};
this.toHash=function(b){var d={};
for(var c=0;
c<b.length;
c++){var e=b[c];
if(e&&e.id){d[e.id]=e
}}return d
};
this.onBlur=function(){if(this.m_onBlur){doFunctions(this.m_onBlur)
}};
this.onFocus=function(){if(this.m_win.m_focus){try{if(!this.isPoppedOut()){$("focuser").focus()
}}catch(b){}this.m_win.focus()
}if(this.m_onFocus){doFunctions(this.m_onFocus)
}};
this.handleFocus=function(){this.moveToTop();
this.stopFlashWindow()
};
this.onWindowFocus=function(){doFunctions(this.m_onWindowFocus)
};
this.onWindowUnfocus=function(){doFunctions(this.m_onWindowUnfocus)
};
this.onMouseDown=function(c,b){if(this.m_onMouseDown){doFunctions(this.m_onMouseDown)
}};
this.onStopResize=function(b,c){doFunctions(this.m_onStopResize)
};
this.callActivate=function(c,b){if(!this.isActive()){gWindowMgr.activateWindow(this)
}};
this.onBorderMouseDown=function(c,b){this.onMouseDown(c,b);
if(!b||!b.id||!c){return true
}if(b.getAttribute("control")=="uiDlgButton"){return true
}var g=b.id;
if(g=="barn"){var f=getElementPosition(b);
if(this.m_windowButtons&&(ui.getCursorX(c)>(f.left+b.offsetWidth-this.m_windowButtons.getWidth()))){return true
}}else{if(g=="handle"&&this.m_bResizable){g="se"
}}if(g!="content"){ui.setEventHandled(c)
}if(hasClassName(b,"draggable")&&this.m_state!="min"&&this.m_state!="max"){this.m_dr.init(this,c);
this.m_dr.startMove();
return
}switch(g){case"content":if(this.m_skin=="chromeless"){var e=c.target||c.srcElement;
if(this.m_state!="min"&&this.m_state!="max"&&ui.getCursorPos(c).y-this.getWindowPos().y<=this.m_chromelessMaxDragY){this.m_dr.init(this,c);
this.m_dr.startMove()
}}break;
case"barn":if(this.m_state!="min"&&this.m_state!="max"){this.m_dr.init(this,c);
this.m_dr.startMove()
}break;
case"n":case"ne":case"nw":if((this.m_state!="min")&&this.m_state!="max"&&(!this.m_bResizable)){this.m_dr.init(this,c);
this.m_dr.startMove();
break
}default:if((this.m_state!="min")&&this.m_state!="max"&&(this.m_bResizable)){this.m_dr.init(this,c);
var d=g;
if(g=="bare"){d="e"
}if(g=="barw"){d="w"
}this.m_dr.startResize(d,this.m_minX,this.m_minY,this.m_maxX,this.m_maxY)
}break
}return
};
this.isActive=function(){return this.m_bActive
};
this.restoreWindow=function(){if(this.m_state=="min"){this.restoreMinimizeWindow()
}else{this.maximizeWindow()
}};
this.minimizeWindow=function(){if(this.m_state=="min"){this.restoreMinimizeWindow();
return
}if(this.m_onMinimize){doFunctions(this.m_onMinimize)
}this.saveLastMinimizePos();
if(this.m_windowButtons){this.m_windowButtons.updateButtons("minrestore");
this.m_windowButtons.updateButtons("max")
}this.m_state="min";
this.getBody().style.visibility="hidden";
addClassName(this.m_windowFrame,"minimize");
if(this.m_bResizable){this.m_resizeHandle.style.visibility="hidden";
removeClassName(this.m_element,"resizable")
}var b=ui.getClientRect(document);
this.setWindowPos(0,b.h-this.m_minimizeH,this.m_minimizeW,this.m_minimizeH);
this.m_element.setAttribute("tileIndex",gWindowMgr.getNextTileIndex());
this.m_element.style.zIndex=1;
gWindowMgr.tileMinWindows();
gWindowMgr.deactivateWindows();
this.activateWindow();
if(ui.isWebKit){removeClassName(this.m_windowFrame,this.m_classNamePrefix+"Frame");
setTimeout(hitch(this,function(){addClassName(this.m_windowFrame,this.m_classNamePrefix+"Frame")
}),0)
}};
this.maximizeWindow=function(){removeClassName(this.m_windowFrame,"minimize");
if(this.m_onMaximize){doFunctions(this.m_onMaximize)
}if(this.m_state=="max"){this.restoreMaximizeWindow();
return
}this.saveLastMaximizePos();
if(this.m_windowButtons){this.m_windowButtons.updateButtons("maxrestore");
this.m_windowButtons.updateButtons("min")
}var b=gWindowMgr.getNumMinWindows();
if(this.m_state=="min"){b--;
this.m_state="max";
this.getBody().scrollTop=this.getBody().scrollLeft=0;
this.getBody().style.visibility="visible";
if(this.m_bResizable){this.m_resizeHandle.style.visibility="visible";
addClassName(this.m_element,"resizable")
}gWindowMgr.tileMinWindows()
}if(this.m_bResizable){this.m_resizeHandle.style.visibility="hidden";
removeClassName(this.m_element,"resizable")
}this.onFocus();
var c=ui.getClientRect(this.m_win.document);
if(b>0){c.h=c.h-(gWindowMgr.getNumMinRows()*this.m_minimizeH)
}this.setWindowRect(c);
this.m_state="max"
};
this.updateMaximize=function(){if(!this.isMaximized()){return
}var b=gWindowMgr.getNumMinWindows();
var c=ui.getClientRect(this.m_win.document);
if(b>0){c.h=c.h-(gWindowMgr.getNumMinRows()*this.m_minimizeH)
}this.setWindowRect(c)
};
this.restoreMinimizeWindow=function(){if(this.m_state!="min"){return
}if(this.m_onRestoreMinimize){doFunctions(this.m_onRestoreMinimize)
}this.m_state="normal";
this.setWindowRect(this.m_lastMinPos);
this.m_lastMinPos=null;
if(this.m_windowButtons){this.m_windowButtons.updateButtons("min")
}this.getBody().scrollTop=this.getBody().scrollLeft=0;
this.getBody().style.visibility="visible";
removeClassName(this.m_windowFrame,"minimize");
if(this.m_bResizable){this.m_resizeHandle.style.visibility="visible";
addClassName(this.m_element,"resizable")
}this.onFocus();
gWindowMgr.tileMinWindows();
if(this.m_onCallbackRestoreMinimize){doFunctions(this.m_onCallbackRestoreMinimize)
}};
this.restoreMaximizeWindow=function(){if(this.m_onRestoreMaximize){doFunctions(this.m_onRestoreMaximize)
}this.setWindowRect(this.m_lastMaxPos);
if(this.m_windowButtons){this.m_windowButtons.updateButtons("max")
}this.m_state="normal";
this.m_lastMaxPos=null;
if(this.m_bResizable){this.m_resizeHandle.style.visibility="visible";
addClassName(this.m_element,"resizable")
}if(this.m_onCallbackRestoreMaximize){doFunctions(this.m_onCallbackRestoreMaximize)
}};
this.isMinimized=function(){return(this.m_state=="min")
};
this.isMaximized=function(){return(this.m_state=="max")
};
this.saveLastMinimizePos=function(){if(this.isMaximized()){this.m_lastMinPos=this.m_lastMaxPos;
return
}this.m_lastMinPos=this.getWindowPos()
};
this.saveLastMaximizePos=function(){if(this.isMinimized()){this.m_lastMaxPos=this.m_lastMinPos;
return
}this.m_lastMaxPos=this.getWindowPos()
};
this.startFlashWindow=function(){if(this.m_bFlashing){return
}gWindowMgr.addFlashingWindow(this,true);
this.m_bFlashing=true
};
this.stopFlashWindow=function(){if(!this.m_bFlashing){return
}gWindowMgr.addFlashingWindow(this,false);
this.m_bFlashing=false
};
this.flashWindow=function(){if(this.m_bDisplayActive){removeClassName(this.m_windowFrame,"inactive")
}else{addClassName(this.m_windowFrame,"inactive")
}this.m_bDisplayActive=!this.m_bDisplayActive
};
this.inactivateWindow=function(){if(!this.m_bActive&&!this.m_bDisplayActive){return
}addClassName(this.m_windowFrame,"inactive");
this.onBlur();
this.m_bActive=this.m_bDisplayActive=false
};
this.activateWindow=function(){if(this.m_bActive){return
}removeClassName(this.m_windowFrame,"inactive");
this.m_bActive=this.m_bDisplayActive=true;
if(this.m_state!="min"){this.onFocus()
}};
this.moveToTop=function(){if(this.m_onMoveToTop){doFunctions(this.m_onMoveToTop)
}if(!this.isMinimized()){this.setZIndex(gWindowMgr.getNextZIndex())
}if(this.m_onCallbackMoveToTop){doFunctions(this.m_onCallbackMoveToTop)
}};
this.getWindowPos=function(){if(this.isPoppedOut()){var e=this.m_win;
var b=calcWinPos(e);
var f=calcWinPos(window);
var d=calcWinChrome(window);
if(ui.isIE){var c=calcWinChrome(e);
b.x-=c.w;
b.y-=c.h
}return{x:b.x-f.x-d.w,y:b.y-f.y-d.h,w:b.w,h:b.h,z:this.getZIndex()}
}if(this.isVisible()){return{x:this.m_element.offsetLeft,y:this.m_element.offsetTop,w:this.m_element.offsetWidth,h:this.m_element.offsetHeight,z:this.getZIndex()}
}else{if(this.m_lastPos){return this.m_lastPos
}}return{x:0,y:0,w:0,h:0,z:0}
};
this.centerWindow=function(){var c=Math.round((this.m_win.document.body.clientWidth-this.m_element.offsetWidth)/2);
var b=Math.round((this.m_win.document.body.clientHeight-this.m_element.offsetHeight)/2);
this.moveWindow(c,b)
};
this.showWindow=function(){if(this.m_bVisible){return
}this.m_element.style.visibility="visible";
this.m_element=this.m_parent.appendChild(this.m_element);
this.m_bVisible=true;
if(this.onShow){this.onShow()
}};
this.closeWindow=function(){if(!this.m_bVisible){return
}this.stopFlashWindow();
if(this.m_onClose){doFunctions(this.m_onClose)
}if(!this.isPoppedOut()){this.m_lastPos=this.getWindowPos();
if(this.m_element.parentNode){removeElement(this.m_element)
}else{this.m_element.style.visibility="hidden"
}if(this.m_state=="min"){gWindowMgr.tileMinWindows()
}}this.m_bVisible=false;
gWindowMgr.handleWindowClose(this)
};
this.isVisible=function(){return this.m_bVisible
};
this.moveWindow=function(b,g){if(this.m_poppedOut){b=g=0
}var f=this.m_win.document.body.clientWidth;
var e=this.m_win.document.body.clientHeight;
var c=this.m_element.offsetWidth;
var d=this.m_element.offsetHeight;
if(b<75-c){b=75-c
}if(b>(f-this.m_minimizeH)){b=f-this.m_minimizeH
}if(g<0){g=0
}if(g>(e-this.m_minimizeH)){g=e-this.m_minimizeH
}this.m_element.style.left=b+"px";
this.m_element.style.top=g+"px"
};
this.setWindowRect=function(b){this.setWindowPos(b.x,b.y,b.w,b.h)
};
this.setWindowPos=function(l,k,m,e,c){var d=m-this.m_element.offsetWidth;
var f=e-this.m_element.offsetHeight;
if(this.isPoppedOut()&&ui.isGecko){this.m_element.style.position="fixed"
}else{if(this.isPoppedOut()){this.m_element.style.position="absolute";
l=k=0
}}if(!c&&this.isPoppedOut()){var g=this.getWindowPos();
this.m_win.resizeBy(m>=0?m-g.w:0,e>=0?e-g.h:0)
}if(l>=0){this.m_element.style.left=l+"px"
}if(k>=0){this.m_element.style.top=k+"px"
}if(m>=0&&d){this.m_element.style.width=m+"px";
if(this.m_resizeHandle){this.m_resizeHandle.style.right=(ui.isIE?1-m%2:1)+"px"
}}if(e>=0&&f){this.m_element.style.height=e+"px";
if(this.m_resizeHandle){this.m_resizeHandle.style.bottom=(ui.isIE?1-e%2:1)+"px"
}}if(m>0&&d){var b=(this.m_windowButtons)?(m-this.m_windowButtons.m_element.offsetWidth):m;
b-=(ui.isIE)?15:10;
if(b<0){b=0
}if(this.m_caption){this.m_caption.resize(b)
}}if(d||f){this.resizeContent(this.m_contentArea,m,e)
}};
this.resizeContent=function(c,b,e){if(this.m_poppedOut&&ui.isGecko){c.style.position="fixed"
}var d;
var f;
if(b&&(b>=0)){d=b-this.m_marginW;
if(d<0){d=0
}c.style.width=d+"px"
}if(e&&(e>=0)){f=e-this.m_marginH;
if(f<0){f=0
}c.style.height=f+"px"
}if(c.ptr&&c.ptr.resize){c.ptr.resize(d,f)
}};
this.getBody=function(){return this.m_contentArea
};
this.getId=function(){return this.m_id
};
this.saveState=function(){return{}
};
this.restoreState=function(b){this.m_isRestoring=false
};
this.setCreateFnc=function(c,d,b){this.m_createFnc={c:c,f:d,a:b}
};
this.reversePop=function(b){if(!this.m_isRestoring){this.popOutDlg(!this.isPoppedOut(),b)
}};
this.popOutDlg=function(d,c){if(this.m_bPoppingOut){return
}this.m_bPoppingOut=true;
var b=function(){if(!this.m_createFnc){return
}var h=this.getWindowPos();
if(this.isPoppedOut()){h.h+=this.m_minimizeH
}var f=this;
function e(l){var k=f.saveState();
f.closeWindow();
l.restoreState(k);
gWindowMgr.activateWindow(l);
if(c){c(l)
}}var g=this.m_createFnc.f.apply(this.m_createFnc.c,this.m_createFnc.a.concat(e,d,h,true));
g.m_isRestoring=true
};
runInMainContext(this,b)
}
});
ui.drag={};
Class("ui.drag.dragObject",function(){this.m_obj;
this.m_event;
this.m_active=false;
this.m_minW;
this.m_minH;
this.m_maxW;
this.m_maxH;
this.m_startX;
this.m_startY;
this.m_startRect;
this.m_didMoveX;
this.m_didMoveY;
this.m_actionType;
this.m_direction;
this.m_currentDropOver=null;
this.m_dropCargo=null;
this.m_bDropSuccess=false;
this.m_bDragStartCalled=false;
this.m_callback;
this.initialize=function(){this.m_win=window;
this.m_dropCoordList=[]
};
this.init=function(c,a,b){this.m_win=gWin(c.m_element||c);
this.m_callback=b;
this.m_obj=c;
this.m_event=a;
this.m_startX=ui.getCursorX(this.m_event);
this.m_startY=ui.getCursorY(this.m_event);
if(!this.m_obj.m_element&&this.m_obj.getPos){this.m_startRect=this.m_obj.getPos()
}else{if(this.m_obj.m_element){this.m_startRect=this.getPos(this.m_obj.m_element)
}else{if(this.m_obj){this.m_startRect=this.getPos(this.m_obj)
}}}this.m_bDragStartCalled=false;
this.m_bDropSuccess=false
};
this.getPos=function(a){if(!a){return null
}return new ui.rect(a.offsetLeft,a.offsetTop,a.offsetWidth,a.offsetHeight)
};
this.setDropCargo=function(a){this.m_dropCargo=a
};
this.clearDropCargo=function(){this.m_dropCargo=null
};
this.startResize=function(e,a,c,d,b){eventlog("start resize");
this.m_active=true;
this.m_actionType="resize";
this.m_direction=e;
this.m_minW=a;
this.m_minH=c;
this.m_maxW=d;
this.m_maxH=b;
this.m_didMoveX=false;
this.m_didMoveY=false;
ui.setEventHandled(this.m_event);
ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onDragStop"));
ui.connectGlobalEvent(gDoc(this.m_win),"mousemove",hitch(this,"onDrag"));
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"onDragStop"));
gPubSub.publish(this,"ui.drag::startResize")
};
this.startMove=function(){eventlog("start move");
this.m_active=true;
this.m_actionType="move";
var c=gDragManager.getDropTargets();
if(this.m_dropCargo&&c.length>0){this.setupDragListCoords();
if(c.length>1){for(var a=0;
a<this.m_dropCoordList.length;
a++){var b=this.m_dropCoordList[a].dropTarget.m_element;
b.zSort=parseInt(getCSSProp(b,"z-index"));
if(isNaN(b.zSort)){b.zSort=0
}}this.m_dropCoordList.sort(function(e,d){return(d.dropTarget.m_element.zSort-e.dropTarget.m_element.zSort)
})
}}ui.setEventHandled(this.m_event);
ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onDragStop"));
ui.connectGlobalEvent(gDoc(this.m_win),"mousemove",hitch(this,"onDrag"));
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"onDragStop"));
gPubSub.publish(this,"ui.drag::startMove")
};
this.setupDragListCoords=function(){var b=gDragManager.getDropTargets();
this.m_dropCoordList=[];
for(var a=0;
a<b.length;
a++){var d=b[a];
if(!d||(d.control=="imdlg"&&d.isPoppedOut())||!d.m_element||gWin(d.m_element)!=this.m_win){continue
}var c=posWithRespectTo(d.m_element);
c.dropTarget=d;
this.m_dropCoordList.push(c)
}};
this.onDrag=function(a){if(this.m_actionType=="move"){this.onDragMove(a)
}else{if(this.m_actionType=="resize"){this.onResize(a)
}}ui.setEventHandled(a)
};
this.onDragStop=function(a){eventlog("stopping drag");
this.m_active=false;
ui.setEventHandled(a);
ui.disconnectGlobalEvent(gDoc(this.m_win),"mousedown");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mousemove");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup");
if(this.m_currentDropOver!=null){if(this.m_currentDropOver.dropHandle){if(this.m_dropCargo){this.m_bDropSuccess=this.m_currentDropOver.dropHandle(this.m_dropCargo);
this.m_dropCargo=null
}if(this.m_currentDropOver.dropHover){this.m_currentDropOver.dropHover(false)
}}this.m_currentDropOver=null
}if(this.m_actionType=="resize"&&this.m_obj.m_onStopResize){doFunctions(this.m_obj.m_onStopResize,a,this.m_didMoveX,this.m_didMoveY);
gPubSub.publish(this,"ui.drag::stopResize")
}else{if(this.m_actionType=="move"&&this.m_obj.m_onStopMove){doFunctions(this.m_obj.m_onStopMove);
gPubSub.publish(this,"ui.drag::stopMove")
}}this.m_bDragStartCalled=false
};
this.getCurrentDropOver=function(){return this.m_currentDropOver
};
this.isDropSuccessful=function(){return this.m_bDropSuccess
};
this.onResize=function(e){var b=ui.getCursorX(e)-this.m_startX;
var a=ui.getCursorY(e)-this.m_startY;
if((b==0)&&(a==0)){return
}if(b){this.m_didMoveX=true
}if(a){this.m_didMoveY=true
}if((this.m_direction.indexOf("w")!=-1)&&(this.m_startRect.x+b<0)){b=0-this.m_startRect.x
}if((this.m_direction.indexOf("n")!=-1)&&(this.m_startRect.y+a<0)){a=0-this.m_startRect.y
}if(!this.m_bDragStartCalled){if(this.m_obj&&this.m_obj.m_onDragStart){doFunctions(this.m_obj.m_onDragStart);
this.m_bDragStartCalled=true
}}var d;
if(this.m_obj&&this.m_obj.m_element){d=this.getPos(this.m_obj.m_element)
}else{if(this.m_obj&&this.m_obj.getElement){d=this.getPos(this.m_obj.getElement())
}else{if(this.m_obj){d=this.getPos(this.m_obj)
}else{return
}}}var c=new ui.rect(this.m_startRect.x,this.m_startRect.y,this.m_startRect.w,this.m_startRect.h);
switch(this.m_direction){case"n":c.y=(this.m_startRect.y+a);
c.h=(this.m_startRect.h-a);
break;
case"ne":c.y=(this.m_startRect.y+a);
c.h=(this.m_startRect.h-a);
c.w=(this.m_startRect.w+b);
break;
case"nw":c.y=(this.m_startRect.y+a);
c.h=(this.m_startRect.h-a);
c.x=(this.m_startRect.x+b);
c.w=(this.m_startRect.w-b);
break;
case"e":c.w=(this.m_startRect.w+b);
break;
case"w":c.x=(this.m_startRect.x+b);
c.w=(this.m_startRect.w-b);
break;
case"s":c.h=(this.m_startRect.h+a);
break;
case"se":c.w=(this.m_startRect.w+b);
c.h=(this.m_startRect.h+a);
break;
case"sw":c.h=(this.m_startRect.h+a);
c.x=(this.m_startRect.x+b);
c.w=(this.m_startRect.w-b);
break
}if(this.m_minW&&(c.w<this.m_minW)){if(this.m_direction.indexOf("w")!=-1){c.x=this.m_startRect.x+this.m_startRect.w-this.m_minW
}c.w=this.m_minW
}if(this.m_minH&&(c.h<this.m_minH)){if(this.m_direction.indexOf("n")!=-1){c.y=this.m_startRect.y+this.m_startRect.h-this.m_minH
}c.h=this.m_minH
}if(this.m_maxW&&(c.w>this.m_maxW)){c.w=this.m_maxW
}if(this.m_maxH&&(c.h>this.m_maxH)){c.h=this.m_maxH
}if((!this.m_minW||(c.w>=this.m_minW))&&(!this.m_maxW||(c.w<=this.m_maxW))){d.w=c.w;
d.x=c.x
}if((!this.m_minH||(c.h>=this.m_minH))&&(!this.m_maxH||(c.h<=this.m_maxH))){d.h=c.h;
d.y=c.y
}if(this.m_callback){this.m_callback(d.x,d.y,d.w,d.h)
}else{if(this.m_obj&&this.m_obj.setWindowPos){this.m_obj.setWindowPos(d.x,d.y,d.w,d.h)
}else{if(this.m_obj&&this.m_obj.setElementPos){this.m_obj.setElementPos(d.x,d.y,d.w,d.h)
}else{if(this.m_obj&&this.m_obj.style){this.m_obj.style.top=d.y+"px";
this.m_obj.style.left=d.x+"px";
this.m_obj.style.width=d.w+"px";
this.m_obj.style.height=d.h+"px"
}}}}};
this.onDragMove=function(c){var a=ui.getCursorX(c);
var e=ui.getCursorY(c);
var d=(this.m_startRect.x+a-this.m_startX);
var b=(this.m_startRect.y+e-this.m_startY);
if(d!=this.m_startRect.x||b!=this.m_startRect.y){if(!this.m_bDragStartCalled){if(this.m_obj&&this.m_obj.m_onDragStart){doFunctions(this.m_obj.m_onDragStart);
this.m_bDragStartCalled=true
}}}if(this.m_obj.moveWindow){this.m_obj.moveWindow(d,b)
}if(this.m_dropCargo!=null){this.query(a,e)
}};
this.query=function(a,d){var c=false;
for(var b=0;
b<this.m_dropCoordList.length;
b++){if(isInRect(a,d,this.m_dropCoordList[b].x,this.m_dropCoordList[b].y,this.m_dropCoordList[b].w,this.m_dropCoordList[b].h)){c=true;
if(this.m_currentDropOver==this.m_dropCoordList[b].dropTarget){break
}if(this.m_currentDropOver!=null&&this.m_currentDropOver.dropHover){this.m_currentDropOver.dropHover(false)
}this.m_currentDropOver=this.m_dropCoordList[b].dropTarget;
if(this.m_currentDropOver.dropHover){this.m_currentDropOver.dropHover(true)
}if(this.m_obj&&this.m_obj.m_element){this.m_obj.m_element.style.cursor="default"
}break
}}if(!c&&this.m_currentDropOver!=null){if(this.m_currentDropOver.dropHover){this.m_currentDropOver.dropHover(false)
}this.m_currentDropOver=null;
if(ui.isIE>5.5&&this.m_obj&&this.m_obj.m_element){this.m_obj.m_element.style.cursor="not-allowed"
}}return this.m_currentDropOver
};
this.activate=this.setupDragListCoords
});
ui.drag.DragManager=function(){this.m_dropTargets=[];
this.getDropTargets=function(){return this.m_dropTargets
};
this.addDropTarget=function(a){this.m_dropTargets.push(a)
};
this.removeDropTarget=function(b){for(var a=this.m_dropTargets.length-1;
a>=0;
a--){if(this.m_dropTargets[a]==b){this.m_dropTargets.splice(a,1)
}}}
};
Class("ui.label",ui.element,function(a){this.m_preImgO;
this.m_postImg;
this.m_postImgW=0;
this.m_postImgPadding=0;
this.m_textO;
this.m_text="";
this.m_width=0;
this.m_height=0;
this.m_control="uiLabel";
this.m_className="uiLabel";
this.m_bShrinkToSize=false;
this.m_paddingLeft=3;
this.m_paddingRight=2;
this.m_padding=4;
this.m_customizeInProgress=null;
this.m_force=false;
this.m_textTruncate=truncateEnd;
this.initialize=function(){a(this,"initialize");
this.m_preImg={id:""};
this.m_cssProperties={}
};
this.init=function(f){this.m_element=f;
var c=f.id||"";
var l=f.label||f.getAttribute("label")||null;
var g=f.img||f.getAttribute("img")||null;
var h=f.postimg||f.getAttribute("postimg")||null;
var d=f.postimgw||f.getAttribute("postimgw")||null;
var b=parseInt(f.width)||parseInt(f.getAttribute("width"));
var k=parseInt(f.height)||parseInt(f.getAttribute("height"));
var e=f.parentNode;
if(g=="null"){g=null
}this.create(c,e,g,l,h,d,b,k)
};
this.create=function(k,g,c,h,e,b,d,f){this.m_win=gWin(g||this.m_element);
this.m_id=k;
this.m_preImg.id="preimg"+getUniqueId();
if(isNumber(d)&&!isNaN(d)){this.m_width=d
}if(isNumber(f)&&!isNaN(f)){this.m_height=f
}if(h){this.setText(h)
}if(c){this.setPreImg(c)
}if(e){this.setPostImg(e,b)
}if(g&&this.constructor==ui.label){this.createDOMNode(g)
}};
this.createDOMNode=function(b){this.m_win=gWin(b||this.m_win);
if(!this.m_element){this.m_element=this.m_win.document.createElement("div");
if(b){b.appendChild(this.m_element)
}}this.m_element.id=this.getId();
this.m_element.className=this.m_className;
this.m_element.setAttribute("control",this.m_control);
this.m_element.title=this.m_title;
this.m_element.style.width=this.m_width?this.m_width+"px":"auto";
this.m_element.style.height=this.m_height?this.m_height+"px":"auto";
this.m_textO=this.m_win.document.createElement("span");
this.m_element.appendChild(this.m_textO);
this.m_force=true;
this.setText(this.m_text);
this.setPreImg(this.m_preImg);
this.setPostImg(this.m_postImg,this.m_postImgW);
this.m_force=false;
return this.m_element
};
this.getHTMLString=function(){return('<div id="'+this.m_id+'" class="'+this.m_className+'" control="uiLabel" title="'+escapeHTML(this.m_title)+'" style="width: '+(this.m_width?this.m_width+"px":"auto")+";height: "+(this.m_height?this.m_height+"px":"auto")+(this.m_preImg.src?';"><img path="'+this.m_preImg.src+'" align="top">':';">')+'<span style="">'+escapeHTML(this.m_text)+"</span></div>")
};
this.onRender=function(b){this.m_element=b||$(this.m_id)||this.m_element;
this.m_win=gWin(this.m_element)
};
this.setShrinkToSize=function(b){if(b==this.m_bShrinkToSize){return
}this.m_bShrinkToSize=b;
if(this.m_bShrinkToSize&&this.getTextO()){this.getTextO().style.width=""
}if(b){this.setText(this.m_text,true)
}};
this.shrinkToSize=function(g){if(!this.m_bShrinkToSize||!this.getElement()||!this.getTextO().offsetWidth){return
}if(arguments.length==0){return this.setText(this.m_text,true)
}if(this.getTextO().offsetWidth&&!this.m_postImg){var c=this.getTextO().offsetWidth;
if(this.m_preImg.w){c+=this.m_preImg.w+this.m_paddingLeft+this.m_paddingRight
}this.getElement().style.width=c+"px"
}else{var b=this.getPreImgO();
var d=g+this.m_paddingLeft+this.m_paddingRight;
var f=b?b.offsetWidth:this.m_preImg.w;
if(f<=1){f=this.m_preImg.w
}var h=this.m_postImgW+this.m_postImgPadding;
var e=d+f+h+this.m_padding;
this.getElement().style.width=e+"px";
this.getTextO().style.width=d+"px";
if(this.m_postImg&&this.m_postImgW){this.setPostImg(this.m_postImg,this.m_postImgW)
}}};
this.setTrunctation=function(b){this.m_textTruncate=b
};
this.getTextO=function(){return this.m_textO||(this.getElement()&&(this.m_textO=this.getElement().getElementsByTagName("span")[0]))
};
this.show=function(b){b=(typeof(b)=="undefined"?true:!!b);
this.getElement().style.visibility=(b?"visible":"hidden")
};
this.getPreImgWidth=function(){return this.m_preImg.w
};
this.getPostImg=function(){return this.m_postImg
};
this.getPostImgWidth=function(){return this.m_postImgW
};
this.setPostImgPadding=function(b){this.m_postImgPadding=b
};
this.getPreImg=function(){return this.m_preImg.src
};
this.getPreImgO=function(){return this.m_preImgO||(this.getElement()&&(this.m_preImgO=this.getElement().getElementsByTagName("img")[0]))
};
this.setPreImg=function(c,d,e){if(c&&typeof c=="object"){d=c.w;
e=c.h;
c=c.src
}if(c=="null"){c=null
}if(!this.m_force&&c==this.m_preImg.src){return
}this.m_preImg.src=c;
if(d){this.m_preImg.w=d
}if(e){this.m_preImg.h=e
}var b=this.getPreImgO();
if(!this.m_preImg.src){if(b){removeElement(b);
this.m_preImgO=null
}this.m_preImg.w=this.m_preImg.h=0;
return
}if(!this.getElement()||this.m_win!=gWin(this.getElement())){return
}if(!b){this.m_preImgO=b=createImg(this.m_preImg.id,this.getElement(),this.m_preImg.w,this.m_preImg.h,this.m_preImg.src,"",true,null,/png$/i.test(c));
b.align="top";
if(this.getElement().firstChild){this.getElement().insertBefore(b,this.getElement().firstChild)
}else{this.getElement().appendChild(b)
}}else{gImages.requestImage(this.m_preImg.src,b);
if(this.m_preImg.w){b.style.width=this.m_preImg.w+"px"
}if(this.m_preImg.h){b.style.height=this.m_preImg.h+"px"
}}};
this.setPostImg=function(c,d,b){if(!c||!c.length||(c=="null")){return
}if(c&&d){this.m_postImg=c;
this.m_postImgW=d||0
}if(this.m_postImg!=undefined&&this.getElement()){this.m_element.style.backgroundImage=this.m_postImg?"url("+gImages.getPath()+this.m_postImg+")":"";
this.m_element.style.backgroundRepeat="no-repeat";
this.getElement().style.backgroundPosition="center right"
}};
this.getText=function(){return this.m_text
};
this.setText=function(g,e){g=g||"";
if(!this.m_force&&!e&&this.m_text==g){return
}this.m_text=g;
if(!this.getTextO()){return
}var d=this.getTextO().parentNode;
if(!d){return
}var b=4;
var c=this.m_width-(this.m_preImg.w||0)-this.m_postImgW-(ui.isIE?0:b);
var f=0;
if(c<=0){setText(this.getTextO(),g);
f=this.getTextO().offsetWidth
}else{f=setTruncatedTextContent(this.getTextO(),g,c,this.m_textTruncate,this.m_cssProperties)
}if(this.m_bShrinkToSize){this.shrinkToSize(f)
}};
this.setPosition=function(e,d,b,c){if(e){this.m_element.style.left=e+"px"
}if(d){this.m_element.style.top=d+"px"
}this.resize(b,c)
};
this.resize=function(b,d){if(!b){return
}var c=this.m_width;
if(b>0){if(!ui.isIE){b-=4
}this.m_width=this.m_element.width=b;
if(b>0){this.m_element.style.width=b+"px"
}c=b-this.m_preImg.w-this.m_postImgW
}if(d>0){this.m_height=this.m_element.height=d;
this.m_element.style.height=d+"px"
}this.setText(this.m_text,true);
if(this.m_postImg&&this.m_postImgW){this.setPostImg(this.m_postImg,this.m_postImgW)
}}
});
Class("ui.menu",function(){this.initialize=function(){this.m_win=window;
this.m_selectedItem=null;
this.m_element=null;
this.m_marginLeft=0;
this.m_marginTop=0;
this.m_hSpace=4;
this.m_orientation=null;
this.m_pos=this.m_marginTop;
this.m_parent=null;
this.m_items=new Object();
this.m_numItems=0;
this.m_width=0;
this.m_topBorderHeights=0;
this.m_bMouseEnabled=true;
this.m_bPruned=false
};
this.create=function(e,b,d,c){this.m_win=gWin(c);
var a=this.m_win.document.createElement("div");
if(!a){return
}a.id=e;
a.className="uiMenu";
a.setAttribute("width",d);
a.ptr=this;
this.init(a,b)
};
this.init=function(b,a){if(!b){return
}this.m_win=gWin(b);
this.m_parent=a;
this.m_element=b;
this.m_orientation=this.m_parent.m_orientation;
this.m_width=parseInt(b.getAttribute("width"),10);
if(this.m_width){this.m_element.style.width=this.m_width+"px"
}this.m_element.ptr=this
};
this.resize=function(a,b){this.m_width=a;
this.m_element.style.width=this.m_width-(ui.isIE?0:2)+"px";
if(this.m_element.parentNode&&this.m_element.parentNode.nodeName=="#document-fragment"){this.m_element.style.top=this.m_element.style.left="-999px";
this.m_win.document.body.appendChild(this.m_element);
var c=true
}for(var d in this.m_items){if(d&&this.m_items[d]){this.m_items[d].resize(a-(ui.isIE?0:2),b)
}}if(c){removeElement(this.m_element)
}};
this.removeAllItems=function(){this.m_pos=this.m_marginTop;
this.m_numItems=0;
var a=this.m_element;
if(!a){return
}if(!a.hasChildNodes()){return
}var d=a.firstChild;
while(d){var b=d.nextSibling;
a.removeChild(d);
d=b
}this.m_items=new Object()
};
this.showAllMenuItems=function(){if(!this.m_bPruned){return
}this.m_pos=0;
this.m_numItems=0;
for(var b in this.m_items){if(!b||!this.m_items[b]||!this.m_items[b].getText){continue
}var a=this.m_items[b];
this.m_items[b].m_element.style.display="block";
this.layoutMenuItem(this.m_items[b]);
this.m_numItems++
}this.setMenuHeight();
this.m_bPruned=false
};
this.selectPrev=function(){var c=this.getSelectedItem();
if(!c){for(var d in this.m_items){if(!d||!this.m_items[d]||!this.m_items[d].m_element){continue
}if(this.m_items[d].m_element.style.display!="none"){var b=this.m_items[d].m_element.nextSibling;
if(!b||!b.ptr||!b.ptr.select||b.style.display=="none"){this.m_items[d].m_element.ptr.select();
return
}}}}var a=c.m_element.previousSibling;
if(!a||!a.ptr||!a.ptr.select||a.style.display=="none"){this.clearSelected();
return
}if(a.style.display!="none"){a.ptr.select()
}};
this.selectNext=function(){var b=this.getSelectedItem();
if(!b||!b.m_element||!b.m_element){for(var c in this.m_items){if(!c||!this.m_items[c]||!this.m_items[c].m_element){continue
}if(this.m_items[c].m_element.style.display!="none"){if(this.m_items[c].m_element.ptr&&this.m_items[c].m_element.ptr.select){this.m_items[c].m_element.ptr.select();
return
}}}}var a=b.m_element.nextSibling;
if(!a||!a.ptr||!a.ptr.select||a.style.display=="none"){this.clearSelected();
return
}if(a.style.display!="none"){a.ptr.select()
}};
this.pruneMenuItems=function(a){if(!a||!a.length){this.showAllMenuItems();
return
}this.m_bPruned=true;
this.m_pos=0;
this.m_numItems=0;
var d=normalizeString(a);
for(var e in this.m_items){if(!e||!this.m_items[e]||!this.m_items[e].getText){continue
}var c=this.m_items[e];
var b=normalizeString(this.m_items[e].getText());
if(b.indexOf(d)==0){this.m_items[e].m_element.style.display="block";
this.layoutMenuItem(this.m_items[e]);
this.m_numItems++
}else{this.m_items[e].m_element.style.display="none"
}}this.setMenuHeight()
};
this.calculateMenuHeight=function(){this.m_numItems=0;
this.m_pos=0;
for(var a in this.m_items){if(!a||!this.m_items[a]||!this.m_items[a].getText){continue
}if(this.m_items[a].m_element.style.display!="none"){this.layoutMenuItem(this.m_items[a]);
this.m_numItems++
}}this.setMenuHeight()
};
this.setMenuHeight=function(){var a=0;
if(this.m_numItems==0){this.m_element.style.visibility="hidden";
return
}else{this.m_element.style.visibility="visible"
}if(this.m_numItems>this.m_parent.m_menuMax){a=(this.m_parent.m_menuMax*this.m_parent.m_rowHeight);
this.m_element.style.overflowY="auto"
}else{a=this.m_pos;
this.m_element.style.overflowY="hidden"
}if(ui.isIE){a+=2
}a+=this.m_topBorderHeights;
this.m_element.style.height=a+"px"
};
this.removeMenuItem=function(a){if(typeof a!="string"&&a.m_element){a=a.m_element.id
}if(!this.m_items[a]){return
}removeElement(this.m_items[a].m_element);
delete this.m_items[a];
this.m_numItems--;
this.layoutMenuItems()
};
this.getMenuItem=function(a){return this.m_items[a]
};
this.addMenuItem=function(h,b,g,e,a,d){if(!this.m_width){return
}this.m_element.style.top=this.m_element.style.left="-999px";
this.m_win.document.body.appendChild(this.m_element);
var f=new ui.menuItem();
var c=this.m_width;
f.create(h,this.m_element,b,g,c,a,e);
this.appendMenuItem(f,d);
removeElement(this.m_element);
return f
};
this.appendMenuItem=function(a,b){a.setParent(this);
if(b){this.m_element.insertBefore(a.m_element,b.m_element);
this.layoutMenuItems()
}else{this.layoutMenuItem(a)
}this.m_items[a.getId()]=a;
this.m_numItems++;
if(ui.isGecko){this.m_element.style.overflow="-moz-scrollbars-"+(this.m_numItems<=this.m_parent.m_menuMax?"none":"vertical")
}};
this.layoutMenuItem=function(a){this.m_pos+=a.m_height||this.m_parent.m_rowHeight
};
this.layoutMenuItems=function(){this.m_pos=0;
var b=this.m_element.childNodes;
for(var a=0,c;
(c=b[a]);
a++){this.m_pos+=Number(c.ptr.m_height)||0
}this.setMenuHeight()
};
this.connectMenuItemEvents=function(){for(var a in this.m_items){if(this.m_items[a]&&this.m_items[a].connectEvents){this.m_items[a].connectEvents()
}}};
this.disconnectMenuItemEvents=function(){for(var a in this.m_items){if(this.m_items[a]&&this.m_items[a].disconnectEvents){this.m_items[a].disconnectEvents()
}}};
this.onMouseMove=function(b,a){if(!this.m_bMouseEnabled){this.clearSelected();
this.enableMouse(true)
}};
this.isMouseEnabled=function(){return this.m_bMouseEnabled
};
this.enableMouse=function(a){this.m_bMouseEnabled=a
};
this.onMouseOver=function(){this.m_hover=true
};
this.onMouseOut=function(){this.m_hover=false
};
this.onMouseDown=function(){this.m_element.style.visibility="hidden";
if(!this.m_parent){return
}this.m_parent.m_bMenuShow=false
};
this.onParentMouseUp=function(b,c,a){if(!this.m_parent){return
}this.m_parent.onParentMouseUp(b,c,a)
};
this.onParentMouseDown=function(b,a){if(!this.m_parent){return true
}return this.m_parent.onParentMouseDown(b,a)
};
this.clearSelected=function(){var a=this.getSelectedItem();
if(a){a.unselect()
}};
this.getSelectedItem=function(){return this.m_selectedItem
};
this.setSelectedItem=function(a){this.m_selectedItem=a
}
});
Class("ui.menuheader",ui.button,function(a){this.initialize=function(e,m,d,g,l,b,k,n,f,h,c){a(this,"initialize",[e,m]);
this.m_control="ui.MenuHeader";
this.m_className="uiMenuHeader";
this.m_borderLeftColor;
this.m_borderRightColor;
this.m_borderTopColor;
this.m_borderBottomColor;
this.m_selectedTitle=m;
this.m_selectedValue=n;
this.m_selectedImg;
this.m_bDelayMenu=false;
this.m_bMenuCreated=false;
this.m_menuItems=new Array();
this.m_dropDownImgSrc="arrow-drop.gif";
this.m_menuMax=10;
this.m_bStatic=false;
this.m_bCustomize=false;
this.m_verticalOffset=0;
this.m_horizontalOffset=0;
this.m_customizeElement=null;
this.m_numItems=0;
this.m_menuBody=null;
this.m_menuBodyId="";
this.m_menuParent=null;
this.m_menuOrientation=null;
this.m_onSelects=new Array();
this.m_onShow=new Array();
this.m_onClose=new Array();
this.m_bOpen=false;
this.m_width=d;
this.m_menuWidth=g||100;
this.m_menuAlign=l||"left";
this.m_bShrinkToSize=h||false;
this.m_maxW=c||100;
this.m_popMenuUp=k;
if(k){this.m_dropDownImgSrc="arrow-lift.gif"
}this.m_orientation=k?"up":"down";
this.m_rowHeight=b||16;
this.m_bStatic=f;
this.m_arrowGap=10;
this.m_edit;
this.m_isCustom=false;
this.m_previous;
this.m_lastCustom;
this.m_preventReselect=true
};
this.createContent=function(){a(this,"createContent");
if(this.constructor==ui.menuheader){this.createDOMNode()
}};
this.createDOMNode=function(){a(this,"createDOMNode");
if(this.m_dropDownImgSrc){this.m_label.m_postImg="blank.gif";
this.m_label.m_postImgW=6
}if(this.m_bShrinkToSize){this.m_label.setShrinkToSize(true)
}if(!this.m_bDelayMenu){this.createMenuBody()
}this.connectEvents(this.m_element);
if(this.m_width){this.resize(this.m_width,null,this.m_menuWidth)
}};
this.setShrinkToSize=function(b){this.m_bShrinkToSize=b;
if(this.m_label){this.m_label.setShrinkToSize(b)
}};
this.shrinkToSize=function(){var d=this.m_rightDiv.offsetWidth||parseInt(getCSSProp(this.m_rightDiv,"width"))||0;
var c=this.m_leftDiv.offsetWidth||parseInt(getCSSProp(this.m_leftDiv,"width"))||0;
if(!this.m_label.m_bShrinkToSize){this.m_label.setShrinkToSize(true)
}this.m_label.m_width=this.m_maxW-(d+c);
this.m_label.setText(this.m_selectedTitle,true);
var b=this.m_centerDiv.offsetWidth||parseInt(getCSSProp(this.m_centerDiv,"width"))||0;
var e=d+c+b;
if(e>this.m_maxW){this.resize(this.m_maxW,null,this.m_maxW);
this.m_label.setPos(null,null,this.m_maxW-d-c)
}else{this.resize(e,null,e)
}};
this.resize=function(d,f,e){if(!d){return
}if(ui.isOpera){d+=6
}var c=this.m_rightDiv.offsetWidth||parseInt(getCSSProp(this.m_rightDiv,"width"))||0;
var b=this.m_leftDiv.offsetWidth||parseInt(getCSSProp(this.m_leftDiv,"width"))||0;
this.m_label.resize(d-b-c,f);
this.m_menuWidth=e?e:d;
if(e&&this.m_bMenuCreated){if(e==d){var g=this.m_element;
var k=this.m_menuBody;
setTimeout(function(){try{k.resize(g.offsetWidth||e)
}catch(h){}},50)
}else{this.m_menuBody.resize(this.m_menuWidth)
}}if(ui.isIE){this.m_eventsDiv.style.width=this.m_element.offsetWidth;
this.m_eventsDiv.style.height=this.m_element.offsetHeight
}};
this.setSelected=function(g,e,c,b,d){var f=d||(this.m_preventReselect&&g==this.getImage()&&e==this.getTitle()&&c==this.getItemValue());
this.m_previous={text:this.getTitle(),img:this.getImage(),val:this.getItemValue(),isCustom:this.m_isCustom};
if(this.m_isCustom){this.m_lastCustom=this.m_previous
}this.m_isCustom=Boolean(b);
this.setImage(g);
this.setTitle(e,c,f)
};
this.connectEvents=function(b){ui.connectEvent(b,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(b,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(b,"mousedown",this,"onMouseDown",true,true);
ui.connectEvent(b,"mouseup",this,"onMouseUp",true,true)
};
this.disconnectEvents=function(){ui.disconnectAllEvents(this.m_element)
};
this.createMenuBody=function(){this.m_menuBody=new ui.menu();
this.m_menuBodyId=String(getUniqueId());
this.m_menuBody.create(this.m_menuBodyId,this,this.m_menuWidth,this.m_element);
this.m_menuBody.m_element.style.zIndex=gWindowMgr.getTopZIndex();
this.m_bMenuCreated=true;
if(this.m_menuBodyClassName){addClassName(this.m_menuBody.m_element,this.m_menuBodyClassName)
}for(var c=0;
c<this.m_menuItems.length;
c++){var d=this.m_menuItems[c];
this.m_numItems--;
var b=this.addMenuItem(d.text,d.img,d.val,undefined,undefined,d.id,!d.display)
}this.m_menuBody.setMenuHeight();
this.m_menuItems=new Array();
return this.m_menuBody
};
this.addShowFunc=function(b){this.m_onShow.push(b)
};
this.addCloseFunc=function(b){this.m_onClose.push(b)
};
this.addSelectFunc=function(b){this.m_onSelects.push(b)
};
this.removeAllItems=function(){var b=this.hasVisibleItems();
if(this.m_menuBody){this.m_menuBody.removeAllItems();
this.m_menuBody.setMenuHeight()
}this.m_numItems=0;
if(this.hasVisibleItems()!=b){this.updateDropDownImg()
}};
this.hasVisibleItems=function(){var b=false;
if(!this.m_menuBody){for(var c=0;
c<this.m_menuItems.length;
c++){b=b||this.m_menuItems[c].display
}}else{for(var e in this.m_menuBody.m_items){var d=this.m_menuBody.m_items[e];
b=b||d.getDisplay()!="none"
}}return b
};
this.setMenuItemDisplay=function(d,c){var b=this.hasVisibleItems();
if(!this.m_menuBody&&typeof(d)=="string"){d=this.getMenuItem(d)
}if(!d){return
}if(d.setDisplay){d.setDisplay(c)
}else{d.display=c
}if(this.hasVisibleItems()!=b){this.updateDropDownImg()
}};
this.removeMenuItem=function(c){if(!this.m_menuBody&&typeof(c)=="string"){var d=c;
for(var b=0;
b<this.m_menuItems.length;
b++){if(this.m_menuItems[b]&&this.m_menuItems[b].id==d){this.m_menuItems.splice(b,1);
return
}}this.m_numItems--;
return
}if(typeof(c)=="string"){c=this.m_menuItems[c]
}this.m_menuBody.removeMenuItem(c);
this.m_numItems--;
this.m_menuBody.setMenuHeight()
};
this.replaceMenuItem=function(l,f,d,g,h){if(!l){return
}var k=this.hasVisibleItems();
if(!this.m_menuBody&&typeof(l)=="string"){var b=l;
for(var e=0;
e<this.m_menuItems.length;
e++){if(this.m_menuItems[e]&&this.m_menuItems[e].id==b){var c=this.createDelayMenuItem(f,d,g,h);
this.m_menuItems.splice(e,1,c);
l=c.id;
break
}}}else{if(typeof(l)=="string"){l=this.m_menuBody.getMenuItem(l)
}l.setPreImg(d);
l.setText(f);
l.setValue(g);
l.setDisplay(!h)
}if(this.hasVisibleItems()!=k){this.updateDropDownImg()
}return l
};
this.getMenuItem=function(c){if(!this.m_menuBody){for(var b=0;
b<this.m_menuItems.length;
b++){if(this.m_menuItems[b]&&this.m_menuItems[b].id==c){return this.m_menuItems[b]
}}return
}return this.m_menuBody.getMenuItem(c)
};
this.createDelayMenuItem=function(b,d,e,c){return{id:"menuItem"+getUniqueId()+"-"+b,text:b,img:d,val:e,display:!c}
};
this.updateDropDownImg=function(){if(this.hasVisibleItems()){this.m_label.setPostImgPadding(this.m_arrowGap);
this.m_label.setPostImg(this.m_dropDownImgSrc,6,4)
}else{this.m_label.setPostImgPadding(0);
this.m_label.setPostImg("blank.gif",1,1)
}if(this.m_bShrinkToSize){this.shrinkToSize()
}else{this.resize(this.m_width,null,this.m_menuWidth)
}};
this.addMenuItem=function(l,h,d,g,e,b,f){var k=this.hasVisibleItems();
if(!this.m_menuBody){var c=this.createDelayMenuItem(l,h,d,f);
this.m_menuItems.push(c);
var m=c.id
}else{if(this.m_numItems==0&&!this.m_selectedTitle&&!this.m_bStatic){this.setSelected(h,l,d)
}var m=this.m_menuBody.addMenuItem(b||"menuItem"+getUniqueId()+"-"+l,h,l,this.m_rowHeight,d,e);
m.setDisplay(!f)
}this.m_numItems++;
if(this.hasVisibleItems()!=k){this.updateDropDownImg()
}if(g){this.setSelected(h,l,d)
}return m
};
this.getItemValue=function(){return this.m_selectedValue
};
this.setItemValue=function(b){this.m_selectedValue=b
};
this.setImage=function(b,c,d){this.m_selectedImg=b;
this.m_label.setPreImg(b,c,d)
};
this.getImage=function(){return this.m_selectedImg
};
this.setTitle=function(d,b,c){if(!this.m_label){return
}if(b){this.setItemValue(b)
}this.m_selectedTitle=d;
if(this.m_bShrinkToSize){this.shrinkToSize()
}else{this.m_label.setText(d)
}if(!c){doFunctions(this.m_onSelects,d,b,this)
}};
this.getTitle=function(){return this.m_selectedTitle
};
this.onMouseOver=function(){if(this.m_isDisabled){return
}if(ui.isIE){this.m_eventsDiv.style.display="inline";
this.m_eventsDiv.style.width=this.m_element.offsetWidth;
this.m_eventsDiv.style.height=this.m_element.offsetHeight;
this.m_eventsDiv.style.display="block"
}if(this.m_hover){return
}this.m_hover=true;
if(this.m_state!="down"){this.setState("hot")
}};
this.onMouseOut=function(b){if(this.m_isDisabled||!this.m_hover){return
}this.m_hover=false;
if(this.m_state!="down"){this.setState("normal")
}};
this.onMouseUp=function(c){if(this.m_isDisabled||ui.getMouseButton(c)!=0){return
}if(!this.m_bMenuCreated){this.createMenuBody()
}var k=$(this.m_menuBodyId);
if(!k&&this.m_menuBody&&this.m_menuBody.m_element){k=this.m_menuBody.m_element
}if(!k){return
}var e=this.hasClassName("uiMenuHeader-chromeless");
var l=getElementPosition(this.m_element);
var b=this.m_menuBody.m_numItems>this.m_menuMax?this.m_menuMax:this.m_menuBody.m_numItems;
var f=b*this.m_rowHeight;
var d=this.m_win.document.body.clientHeight-(l.top+this.m_element.offsetHeight+f);
var h=l.top-f;
if(this.m_orientation=="down"&&(d>0||d>h)){k.style.top=(l.top+this.m_element.offsetHeight+this.m_verticalOffset)+"px";
k.style.bottom=""
}else{var m=this.m_win.document.body.clientHeight-this.m_verticalOffset-getElementPosition(this.m_element).top;
if(ui.isIE){m-=1
}k.style.top="";
k.style.bottom=m+"px"
}if(this.m_menuAlign=="left"){k.style.left=l.left+this.m_horizontalOffset+"px"
}else{var g=l.left-(this.m_menuWidth-this.m_rightDiv.offsetLeft+this.m_rightDiv.offsetWidth);
if(ui.isIE){g-=2
}k.style.left=g+"px"
}if(!this.m_bOpen&&this.m_menuBody.m_numItems>0){this.showMenu(k);
this.m_bOpen=true;
ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onBodyMouseDown"));
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"onBodyMouseUp"));
this.m_menuBody.connectMenuItemEvents()
}else{if(this.m_bCustomize){this.handleCustomize()
}this.closeMenu()
}ui.setEventHandled(c)
};
this.onMouseDown=function(c,b){if(this.m_isDisabled){return
}if(this.m_bOpen){ui.setEventHandled(c);
return false
}else{return true
}};
this.setCustomize=function(b){this.m_bCustomize=b
};
this.showMenu=function(c){if(!this.m_bMenuCreated){this.createMenuBody()
}c.style.zIndex=gWindowMgr.getTopZIndex();
c.style.visibility="visible";
this.m_bOpen=true;
this.setState("down");
this.m_menuBody.setMenuHeight();
if(this.m_menuParent){this.m_menuBody.m_element=this.m_menuParent.appendChild(c)
}else{this.m_win.document.body.appendChild(c)
}var d=0;
if(c.offsetTop<0){d=-c.offsetTop
}if(c.offsetTop+c.offsetHeight>this.m_win.document.body.clientHeight){d=c.offsetTop+c.offsetHeight-this.m_win.document.body.clientHeight
}if(d){var b=this.m_menuMax;
this.m_menuMax-=Math.round(d/this.m_rowHeight);
this.m_menuBody.setMenuHeight();
this.m_menuMax=b
}if(this.m_bCustomize){this.doCustomize()
}doFunctions(this.m_onShow,this)
};
this.closeMenu=function(){if(!this.m_bOpen){return
}this.setState("normal");
var b=$(this.m_menuBodyId);
if(!b){return
}if(!b.parentNode){return
}b.style.visibility="hidden";
this.m_menuBody.showAllMenuItems();
this.m_menuBody.setMenuHeight();
this.m_menuParent=b.parentNode;
try{this.m_menuBody.m_element=this.m_menuParent.removeChild(b)
}catch(c){}this.m_bOpen=false;
ui.disconnectEvent(this.m_win.document.body,"mousedown");
ui.disconnectEvent(this.m_win.document.body,"mouseup");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mousedown");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup");
this.closeCustomize();
doFunctions(this.m_onClose)
};
this.onBodyMouseUp=function(b){if(isCursorInElement(this.m_menuBody.m_element,b)){return true
}ui.setEventHandled(b);
if(!this.m_bOpen){return
}this.closeMenu()
};
this.onBodyMouseDown=function(b){if(isCursorInElement(this.m_menuBody.m_element,b)){return true
}if(this.m_customizeElement&&isCursorInElement(this.m_customizeElement,b)){return true
}if(!isCursorInElement(this.m_element,b)){this.closeMenu();
return true
}ui.setEventHandled(b);
return false
};
this.onParentMouseUp=function(c,d,b){if(!this.m_bStatic){this.setSelected(c,d,b)
}else{if(b){this.setItemValue(b);
doFunctions(this.m_onSelects,d,b,this)
}}this.closeMenu()
};
this.onParentMouseDown=function(c,b){this.onBodyMouseDown(c);
ui.setEventHandled(c);
return false
};
this.isArrowKey=function(b){if(b>=37&&b<=40){return true
}return false
};
this.getCaretPos=function(d){var f=0;
var e;
if(!ui.isIE&&d.selectionEnd){return d.selectionEnd
}if(!ui.isIE){return
}var b=this.m_win.document.selection.createRange();
var c=b.getBookmark();
return c.charCodeAt(2)-2
};
this.handleArrow=function(b){if(b==37||b==39){return
}if(b==38){this.m_menuBody.selectPrev()
}if(b==40){this.m_menuBody.selectNext()
}this.m_menuBody.enableMouse(false)
};
this.onCustomizeKeyDown=function(d){if(!d){return
}var c=(d.which)?d.which:d.keyCode;
if(isArrowKey(c)){this.handleArrow(c);
return true
}var b=this.m_customizeElement.value;
var e=this.getCaretPos(this.m_customizeElement);
if(c==8){if(b.length&&e>0){this.m_menuBody.pruneMenuItems(deleteChar(b,e))
}return true
}if(c==46){if(b.length&&e<b.length){this.m_menuBody.pruneMenuItems(deleteChar(b,e+1))
}return true
}return true
};
this.onCustomizeKeyPress=function(d){if(!d){return true
}var c=(d.which)?d.which:d.keyCode;
if(!this.m_customizeElement){return
}if(c==27){this.closeMenu();
ui.setEventHandled(d);
return false
}var b=this.m_customizeElement.value;
if(c==13){if(this.m_menuBody.m_selectedItem){this.m_menuBody.m_selectedItem.onMouseUp()
}else{this.handleCustomize()
}ui.setEventHandled(d);
return false
}if(isArrowKey(c)){this.handleArrow(c);
return true
}if((c==33)||(c==34)||(c==255)){ui.setEventHandled(d);
return false
}if(this.m_menuBody.m_selectedItem){this.m_menuBody.m_selectedItem.unselect()
}switch(c){case 35:case 36:case 16:case 17:case 18:case 20:case 9:case 255:return true
}var e=this.getCaretPos(this.m_customizeElement);
if(c==8){if(b.length&&e>0){this.m_menuBody.pruneMenuItems(deleteChar(b,e))
}return true
}if(c==46){if(b.length&&e<b.length){this.m_menuBody.pruneMenuItems(deleteChar(b,e+1))
}return true
}if(String.fromCharCode(c).length){this.m_menuBody.pruneMenuItems(insertChar(b,String.fromCharCode(c),e))
}return true
};
this.handleCustomize=function(){if(!this.m_customizeElement){return
}var b=this.m_customizeElement.value;
if(b.length){this.setSelected(null,b,b)
}this.closeMenu()
};
this.closeCustomize=function(){if(!this.m_customizeElement){return
}this.m_menuBody.clearSelected();
ui.disconnectEvent(this.m_customizeElement,"keypress");
ui.disconnectEvent(this.m_win.document.body,"mouseup");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup");
if(this.m_customizeElement){removeElement(this.m_customizeElement)
}this.m_customizeElement.ptr=null;
this.m_customizeElement=null;
this.m_element.style.display=""
};
this.doCustomize=function(){this.m_customizeElement=this.m_win.document.createElement("input");
this.m_customizeElement.className=this.m_element.className;
this.m_customizeElement.style.backgroundColor="#FFFFFF";
var c=this.m_element.style;
var b=this.m_customizeElement.style;
if((c.position=="absolute")||c.left||c.top||c.right||c.bottom){if(c.position&&c.position.length){b.position=c.position
}if(c.top&&c.top.length){b.top=c.top
}if(c.left&&c.left.length){b.left=c.left
}if(c.bottom&&c.bottom.length){b.bottom=c.bottom
}if(c.right&&c.right.length){b.right=c.right
}}this.m_customizeElement.style.width=this.m_element.offsetWidth+"px";
this.m_customizeElement.style.height=this.m_element.offsetHeight+"px";
this.m_customizeElement.setAttribute("autocomplete","off");
this.m_customizeElement.size="10";
this.m_customizeElement.ptr=this;
if(this.m_element.parentNode){this.m_customizeElement=this.m_element.parentNode.appendChild(this.m_customizeElement);
this.m_customizeElement.style.zIndex=gWindowMgr.getTopZIndex()
}this.m_customizeElement.focus();
this.m_customizeElement.select();
if(ui.isIE){ui.connectEvent(this.m_customizeElement,"keydown",this,"onCustomizeKeyDown",true,true)
}ui.connectEvent(this.m_customizeElement,"keypress",this,"onCustomizeKeyPress",true,true);
ui.connectEvent(this.m_customizeElement,"mouseup",this,"closeMenu",true,true);
this.m_element.style.display="none"
};
this.setDelayMenu=function(b){this.m_bDelayMenu=b
};
this.getCustomizeElement=function(){return this.m_customizeElement
};
this.getPreviousValue=function(){return this.m_previous.val
};
this.revertToPrevious=function(b){this.setSelected(this.m_previous.img,this.m_previous.text,this.m_previous.val,this.m_previous.isCustom,b)
};
this.customizeMessage=function(b){if(this.m_edit){return
}this.m_edit=this.m_win.document.createElement("input");
if(b){this.m_edit.value=b
}else{if(this.m_lastCustom){this.m_edit.value=this.m_lastCustom.text
}}this.m_edit.style.position="absolute";
this.m_edit.setAttribute("autocomplete","off");
this.m_edit.style.left=this.m_element.offsetLeft+"px";
this.m_edit.style.top=this.m_element.offsetTop+"px";
this.m_edit.style.width=this.m_element.offsetWidth+"px";
this.m_edit.style.height=this.m_element.offsetHeight+"px";
this.m_edit.style.zIndex=gWindowMgr.getTopZIndex();
this.m_edit=this.m_element.parentNode.appendChild(this.m_edit);
this.m_edit.focus();
this.m_edit.select();
ui.connectEvent(this.m_edit,"keypress",this,"onKeyPress",true,true);
ui.connectEvent(this.m_edit,"blur",this,"handleCustomizeMessage");
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"handleCustomizeMessage"))
};
this.onKeyPress=function(c){if(!c||!this.m_edit){return
}var b=c.keyCode;
if(b!=13&&b!=27){return true
}if(b==13){this.handleCustomizeMessage()
}if(b==27){this.m_edit.value="";
this.handleCustomizeMessage()
}ui.setEventHandled(c);
return false
};
this.handleCustomizeMessage=function(){if(!this.m_edit){return
}var b=this.m_edit.value;
if(b.length){this.setSelected(this.getImage(),b,this.getItemValue(),true)
}else{this.revertToPrevious(true)
}ui.disconnectEvent(this.m_edit,"keypress");
ui.disconnectEvent(this.m_win.document.body,"mouseup");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup");
removeElement(this.m_edit);
this.m_edit=null
};
this.setMenuMax=function(b){this.m_menuMax=b;
if(this.m_menuBody){this.m_menuBody.setMenuHeight()
}};
this.isCustom=function(){return this.m_isCustom
};
this.getWidth=function(){return(this.m_element?this.m_element.offsetWidth:this.m_width)
};
this.setMenuBodyClassName=function(b){this.m_menuBodyClassName=b
};
this.setVerticalOffset=function(b){this.m_verticalOffset=b
};
this.setHorizontalOffset=function(b){this.m_horizontalOffset=b
};
this.setPreventReselect=function(b){this.m_preventReselect=b
}
});
Class("ui.menuItem",ui.label,function(a){this.initialize=function(){a(this,"initialize");
this.m_control="uiMenuItem";
this.m_itemValue=null;
this.m_parent;
this.m_height=16
};
this.create=function(h,f,c,g,d,b,e){a(this,"create",[h,f,c,g,"","",d,e]);
this.m_itemValue=b;
if(f&&this.constructor==ui.menuItem){this.createDOMNode(f)
}};
this.createDOMNode=function(b){a(this,"createDOMNode",arguments);
this.addClassName("uiMenuItem");
this.m_textO.style.position="relative";
this.m_textO.style.top="2px";
this.m_element.ptr=this
};
this.addTopBorder=function(){if(!hasClassName(this.m_element,"borderTop")){this.addClassName("borderTop");
this.m_height-=1;
this.m_element.style.height=this.m_height+"px"
}};
this.setParent=function(b){this.m_parent=b
};
this.getHeight=function(){return this.m_element.offsetHeight
};
this.setValue=function(b){this.m_itemValue=b
};
this.connectEvents=function(){ui.connectEvent(this.m_element,"mousemove",this.m_parent,"onMouseMove",true,true);
ui.connectEvent(this.m_element,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(this.m_element,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(this.m_element,"mousedown",this,"onMouseDown",true,true);
ui.connectEvent(this.m_element,"mouseup",this,"onMouseUp",true,true)
};
this.disconnectEvents=function(){ui.disconnectAllEvents(this.m_element)
};
this.setDisplay=function(b){a(this,"setDisplay",arguments);
this.m_parent.calculateMenuHeight()
};
this.select=function(){this.m_parent.clearSelected();
if(this.m_highlightColor){this.m_element.style.backgroundColor=this.m_highlightColor
}addClassName(this.m_element,"uiMenuItemHot");
scrollToItem(this.m_parent.m_element,this.m_element);
this.m_parent.setSelectedItem(this)
};
this.unselect=function(){removeClassName(this.m_element,"uiMenuItemHot");
this.m_element.style.backgroundColor="";
this.m_parent.setSelectedItem(null)
};
this.onMouseOver=function(){if(!this.m_parent.isMouseEnabled()){return false
}this.m_hover=true;
this.select();
return true
};
this.onMouseOut=function(){if(!this.m_parent.isMouseEnabled()){return false
}this.m_hover=false;
this.unselect();
return true
};
this.onMouseDown=function(c,b){if(this.m_parent){this.m_parent.onParentMouseDown(c,b)
}};
this.onMouseUp=function(c,b){if(!this.m_parent){return true
}this.m_element.style.backgroundColor="";
this.m_parent.onParentMouseUp(this.m_preImg.src,this.m_text,this.m_itemValue);
if(c){ui.setEventHandled(c)
}return false
}
});
ui.contextmenu=function(){this.init=function(c,a,b){this.m_win=gWin(b);
this.m_menuId=c;
this.m_menuWidth=a;
this.createMenuBody()
};
this.setContextObject=function(a){this.m_contextObject=a
};
this.getContextObject=function(a){return this.m_contextObject
};
this.createMenuBody=function(){this.m_menuBody=new ui.menu();
this.m_menuBody.create(this.m_menuId+"body",this,this.m_menuWidth,this.m_win.document);
this.m_menuBody.m_element.style.zIndex=gWindowMgr.getTopZIndex();
this.m_menuBody.setMenuHeight();
return this.m_menuBody
};
this.addSelectFunc=function(a){this.m_onSelects.push(a)
};
this.addCloseFunc=function(a){this.m_onClose.push(a)
};
this.removeAllItems=function(a){this.m_menuBody.removeAllItems();
this.m_numItems=0;
this.m_menuBody.setMenuHeight();
if(a){this.m_onSelects=new Array()
}};
this.addMenuItem=function(e,c,b,d){if(!this.m_menuBody){return
}var a=this.m_menuBody.addMenuItem(e+".menuitem",c,e,this.m_rowHeight,b);
this.m_numItems++;
this.m_menuBody.setMenuHeight();
return a
};
this.showMenu=function(d,b){this.closeMenu();
if(b){this.m_contextObject=b
}this.m_menuBody.m_element.style.visibility="hidden";
if(this.m_menuParent){this.m_menuBody.m_element=this.m_menuParent.appendChild(this.m_menuBody.m_element)
}else{this.m_menuBody.m_element=this.m_win.document.body.appendChild(this.m_menuBody.m_element)
}var a=isDefined(d.left)?d.left:ui.getCursorX(d);
var c=isDefined(d.top)?d.top:ui.getCursorY(d);
this.positionMenu(a,c);
this.m_menuBody.m_element.style.zIndex=gWindowMgr.getTopZIndex();
this.m_menuBody.m_element.style.visibility="visible";
this.m_menuBody.m_element.style.overflow="hidden";
this.m_bOpen=true;
ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onBodyMouseDown"));
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"onBodyMouseUp"));
this.m_menuBody.connectMenuItemEvents()
};
this.positionMenu=function(b,a){r=ui.getClientRect(this.m_menuBody.m_element);
var c=this.m_menuBody.m_element.offsetWidth;
if((b+c)>r.w){b-=c-1
}var d=this.m_menuBody.m_element.offsetHeight;
if((a+d)>r.h){a-=d-1
}if(b<0){b=0
}if(a<0){a=0
}this.m_menuBody.m_element.style.left=b+"px";
this.m_menuBody.m_element.style.top=a+"px"
};
this.closeMenu=function(){if(!this.m_bOpen){return
}var a=$(this.m_menuId+"body");
if(!a){return
}if(!a.parentNode){return
}a.style.visibility="hidden";
this.m_menuParent=a.parentNode;
try{this.m_menuBody.m_element=this.m_menuParent.removeChild(a)
}catch(b){}this.m_bOpen=false;
ui.disconnectGlobalEvent(gDoc(this.m_win),"mousedown");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup");
doFunctions(this.m_onClose)
};
this.onBodyMouseUp=function(a){if(isCursorInElement(this.m_menuBody.m_element,a)){return true
}this.closeMenu()
};
this.onBodyMouseDown=function(a){if(isCursorInElement(this.m_menuBody.m_element,a)){return true
}this.closeMenu();
return false
};
this.onParentMouseUp=function(b,c,a){this.closeMenu();
if(a){doFunctions(this.m_onSelects,c,a)
}};
this.onParentMouseDown=function(b,a){this.onBodyMouseDown(b);
ui.setEventHandled(b);
return false
};
this.isOpen=function(){return this.m_bOpen
};
this.m_win=window;
this.m_contextObject=null;
this.m_menuMax=10;
this.m_rowHeight=16;
this.m_numItems=0;
this.m_menuBody=null;
this.m_menuParent=null;
this.m_onSelects=new Array();
this.m_onClose=new Array();
this.m_bOpen=false;
this.m_menuWidth=0
};
ui.image=function(){this.setFilename=function(a){this.m_filename=a
};
this.copyToObjects=function(){if(!this.m_requests){return
}for(var b in this.m_requests){if(this.m_requests[b]){try{this.copyToObject(this.m_requests[b])
}catch(a){}}}this.m_requests=null
};
this.copyToObject=function(a){if(!a){return
}if(this.m_bIECachingBug){return
}if(String(a.png)=="true"&&ui.isIE&&typeof a.style.filter=="string"&&/\.png$/i.test(this.m_image.src)){a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.m_image.src+"', sizingMethod='scale')";
a.src=gImages.getPath()+"blank.gif";
a.height=this.m_image.height;
a.width=this.m_image.width
}else{a.src=this.m_image.src;
if(ui.isIE){a.style.filter=""
}}if(typeof ui!="undefined"&&(ui.isIE&&a.readyState!="complete")&&this.isWindowObject(a)){this.m_bIECachingBug=true
}};
this.isWindowObject=function(a){if(a.id&&a.id.indexOf("wimg")&&a.src&&(a.src.indexOf("dis")!=-1)){return true
}return false
};
this.onload=function(){this.m_bLoaded=true;
this.copyToObjects();
if(this.m_finishCallback){this.m_finishCallback(this.m_filename)
}this.m_finishCallback=null;
return true
};
this.reloadAllImages=function(b,a){this.m_finishCallback=a;
if(!this.m_requests){this.m_requests=new Object()
}for(var c in this.m_objects){this.m_requests[c]=this.m_objects[c]
}this.load(b)
};
this.load=function(a){this.m_bLoaded=false;
this.m_image.onload=hitch(this,"onload");
try{this.m_image.src=a
}catch(b){}};
this.removeObject=function(a){if(this.m_objects&&this.m_objects[a]){this.m_objects[a]=null
}if(this.m_requests&&this.m_requests[a]){this.m_requests[a]=null
}};
this.getURL=function(){return this.m_image.src
};
this.addObject=function(a,b){if(!a){return
}if(this.m_objects){this.m_objects[b]=a
}if(this.m_bLoaded){this.copyToObject(a)
}else{if(this.m_requests){this.m_requests[b]=a
}}};
this.m_bLoaded=false;
this.m_requests=new Object();
this.m_objects=new Object();
this.m_image=new Image();
this.m_bIECachingBug=false;
this.m_filename=null;
this.m_finishCallback=null
};
Class("ui.imagemap",ui.element,function(a){this.initialize=function(){a(this,"initialize");
this.m_bShow=false;
this.m_region=new Array();
this.m_image=null;
this.m_element=null;
this.m_parentElement=null;
this.m_headerElement=null;
this.m_bHover=false;
this.createHandler("Close")
};
this.create=function(k,g,f,c,b,e){this.m_win=gWin(g);
var d=createImg(k,g,b,e,c,"",true);
d.id=k;
d.className="uiImageMap";
d.setAttribute("img",c);
d.setAttribute("width",b);
d.setAttribute("height",e);
d.header=f;
d.setAttribute("control","uiImageMap");
d.ptr=this;
d=g.appendChild(d);
this.init(d)
};
this.init=function(b){this.m_headerElement=b.header;
this.m_element=b;
this.m_parentElement=b.parentNode;
this.m_image=this.m_element.getAttribute("img");
this.m_element.style.cursor="default";
this.m_element.style.zIndex=gWindowMgr.getNextZIndex();
this.m_bShow=true
};
this.show=function(){if(!this.m_element||!this.m_parentElement){return
}this.m_element=this.m_parentElement.appendChild(this.m_element);
this.m_element.style.zIndex=gWindowMgr.getNextZIndex();
this.m_bShow=true;
ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onMouseDown"));
ui.connectGlobalEvent(gDoc(this.m_win),"mouseup",hitch(this,"onMouseUp"))
};
this.hide=function(){if(!this.m_bShow){return
}this.onClose();
if(this.m_element&&this.m_parentElement&&this.m_element.parentNode){this.m_element=this.m_parentElement.removeChild(this.m_element)
}this.m_bShow=false;
ui.disconnectGlobalEvent(gDoc(this.m_win),"mousedown");
ui.disconnectGlobalEvent(gDoc(this.m_win),"mouseup")
};
this.isShowing=function(){return this.m_bShow
};
this.onMouseUp=function(d){if(!this.m_bShow){return
}if(this.m_element&&this.m_element.parentNode==this.m_parentElement&&!isCursorInElement(this.m_element,d)){this.hide();
ui.setEventHandled(d);
return false
}var b=ui.getCursorX(d)-this.m_element.offsetLeft;
var e=ui.getCursorY(d)-this.m_element.offsetTop;
for(var c=0;
c<this.m_region.length;
c++){if((b>=this.m_region[c].left)&&(b<=this.m_region[c].right)){if((e>=this.m_region[c].top)&&(e<=this.m_region[c].bottom)){this.m_region[c].func();
this.hide()
}}}ui.setEventHandled(d);
return false
};
this.onMouseDown=function(c){if(!this.m_bShow){return true
}var d=isCursorInElement(this.m_element,c);
var b=isCursorInElement(this.m_headerElement,c);
if(!d&&!b){if(this.m_bShow){this.hide()
}return true
}ui.setEventHandled(c);
return false
};
this.addRegion=function(c,e,b,d,g){this.m_region.push({left:c,top:e,right:b,bottom:d,func:g})
}
});
Class("ui.imagecache",function(){this.initialize=function(){this.m_ctrlname="uiimgcache";
this.m_currentSkin="default";
if(typeof gTakeover!="undefined"&&gTakeover){this.m_currentSkin=gTakeover.skin
}this.m_path="/skin/"+this.m_currentSkin+"/img/";
this.m_images={};
this.m_directory={};
this.m_loadQueue=[];
this.m_cssQueue=[]
};
this.requestImage=function(a,d){if(!d||!a){return
}var b=a.replace(/^(https?:\/\/)?.*[\/]?skin\/[^\/]*\/img\//,"");
if(a.toLowerCase().indexOf("http://")==-1&&a.toLowerCase().indexOf("https://")==-1&&a.substr(0,1)!="/"){a=this.getPath()+a
}if(!d.getAttribute){return
}var c=d.getAttribute(this.m_ctrlname);
if(c&&this.m_directory[c]){if(this.m_directory[c].getURL().indexOf(a)!=-1){return
}this.m_directory[c].removeObject(c)
}else{c=this.stampObject(d)
}if(!this.m_images[b]){if(gWin(d)!=window){runInMainContext(this,this.loadImage,a,d,c)
}else{this.loadImage(a,d,c)
}return
}this.m_directory[c]=this.m_images[b];
this.m_images[b].addObject(d,c)
};
this.stampObject=function(b){var a=getUniqueId();
b.setAttribute(this.m_ctrlname,a);
return a
};
this.loadImage=function(b,e,d){var c=b.replace(/^(https?:\/\/)?.*[\/]?skin\/[^\/]*\/img\//,"");
var a=new ui.image();
a.setFilename(c);
this.m_images[c]=a;
this.m_directory[d]=this.m_images[c];
a.addObject(e,d);
a.load(b)
};
this.getPath=function(){return this.m_path
};
this.setPath=function(a){this.m_path=a
};
this.setIEPNG=function(b,a,c){if(!c||!c.length){c="image"
}if(ui.isIE){b.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='"+c+"')"
}};
this.getStylesheet=function(){var a=document.getElementsByTagName("link");
for(var b=0,c;
(c=a[b]);
b++){if(c.type=="text/css"){return c
}}};
this.getSkinId=function(a){return a+"-stylesheet"
};
this.setSkin=function(g){if(this.m_currentSkin==g){return
}var e=/skin\/[^\/]*(\/.*)/;
this.setPath(this.m_path.replace(e,"skin/"+g+"$1"));
this.m_currentSkin=g;
if($(this.getSkinId(g))){removeElement($(this.getSkinId(g)))
}var a=this.getStylesheet();
var d=document.createElement("link");
d.rel="stylesheet";
d.type="text/css";
d.id=this.getSkinId(g);
d.href=a.href.replace(e,"skin/"+g+"$1");
a.parentNode.appendChild(d);
for(var c in this.m_images){var b=c;
if(b.toLowerCase().indexOf("http://")==-1&&b.toLowerCase().indexOf("https://")==-1&&b.substr(0,1)!="/"){b=this.getPath()+b
}this.m_images[c].reloadAllImages(b,null)
}var f=hitch(gPubSub,"publish",this,"ui.imagecache::skinLoaded",g);
if(ui.isIE){d.onload=f;
d.onerror=f
}else{setTimeout(f,2000)
}}
});
var gImages=new ui.imagecache();
gImages.setPath(gConfig.getImageServer());
ui.soundmanager=function(){this.m_isMuted=false;
this.m_isDisabled=false;
this.m_isReady=false;
this.m_flashElem=null;
this.m_path=gConfig.getSoundPath();
this.m_sounds={send:this.m_path+"send_4.mp3",receive:this.m_path+"recv_4.mp3",room:this.m_path+"room_d.mp3"};
this.init=function(b){if(!b){b={}
}if(this.m_isDisabled||gFlashVersion.major<9){this.m_isDisabled=true;
return
}b.win=b.win||window;
var a=b.win.document;
b.swfUrl=this.m_path+"SoundPlayer.swf";
b.onReady=hitch(this,"onFlashReady");
this.m_flashElem=embedFlash(b)
};
this.onFlashReady=function(){this.m_isReady=true
};
this.playSample=function(a){if(!this.m_flashElem||!this.m_isReady||this.m_isDisabled||this.m_isMuted||!(a in this.m_sounds)){return
}try{this.m_flashElem.playSample(this.m_sounds[a])
}catch(b){}};
this.isDisabled=function(){return this.m_isDisabled
};
this.setDisabled=function(a){this.m_isDisabled=a
};
this.isMuted=function(){return this.m_isMuted
};
this.mute=function(){this.m_isMuted=true;
this.setMediaMute()
};
this.unmute=function(){this.m_isMuted=false;
this.setMediaMute()
};
this.toggleMute=function(){this.m_isMuted=!this.m_isMuted;
this.setMediaMute();
return this.m_isMuted
};
this.setMediaMute=function(){if(typeof gWindows=="undefined"){return
}for(var a in gWindows){var b=gWindows[a];
if(b&&b.isMeeboGroupChat&&b.isMeeboGroupChat()){b.setMediaMute(this.m_isMuted)
}}}
};
ui.notice=function(){this.m_isReady=false;
this.m_flashEnabled=false;
if(gFlashVersion.major&&gFlashVersion.major>=8){this.m_flashEnabled=true
}else{return
}var d="notice";
this.m_path="http://widget.meebo.com/";
if(ui.isHttps){this.m_path=window.location.protocol+"//"+window.location.hostname+"/flash/"
}var b=document.createElement("div");
b=document.body.appendChild(b);
var c=1;
var e=1;
var f=Math.floor(Math.random()*1000000);
var a='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="'+d+'" width="'+c+'" height="'+e+'" align="middle">';
a+='<param name="allowScriptAccess" value="always" />';
a+='<param name="movie" value="'+this.m_path+"notice.swf?"+f+'" />';
a+='<param name="quality" value="high" />';
a+='<param name="wmode" value="transparent" />';
a+='<embed src="'+this.m_path+"notice.swf?"+f+'" quality="high" width="'+c+'" height="'+e+'" swLiveConnect=true id="'+d+'" name="'+d+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" />';
a+="</object>";
b.innerHTML=a;
if(ui.isIE){this.m_flashElem=window[d]
}else{this.m_flashElem=document[d]
}if(!this.m_flashElem){this.m_flashEnabled=false
}this.onProbation=0;
this.probationCheckInterval=-1;
this.probationCallback=null
};
ui.notice.prototype.onReady=function(){this.m_isReady=true;
if(this.m_readyCallback){setTimeout(hitch(this,"m_readyCallback"),0)
}};
ui.notice.prototype.executeWhenReady=function(a){if(this.m_isReady){setTimeout(hitch(this,a),0)
}else{this.m_readyCallback=a
}};
ui.notice.prototype.onNotice=function(a){if(!this.m_flashEnabled||!this.m_flashElem.onNotice){return false
}return this.m_flashElem.onNotice(a)
};
ui.notice.prototype.add=function(a,c,b){if(!this.m_flashEnabled||!this.m_flashElem.add){return
}this.m_flashElem.add(a,c,b)
};
ui.notice.prototype.isLockedOut=function(){if(!this.m_flashEnabled||!this.m_flashElem.isLockedOut){return false
}return this.m_flashElem.isLockedOut()
};
ui.notice.prototype.getNoticeCount=function(){if(!this.m_flashEnabled||!this.m_flashElem.getNoticeCount){return 0
}return this.m_flashElem.getNoticeCount()
};
ui.notice.prototype.getLockoutLimit=function(){if(!this.m_flashEnabled||!this.m_flashElem.getLockoutLimit){return 100
}return this.m_flashElem.getLockoutLimit()
};
ui.notice.prototype.addWarn=function(a,b){if(!this.m_flashEnabled||!this.m_flashElem.addWarn){return
}return this.m_flashElem.addWarn(a,b)
};
ui.notice.prototype.getMuteTimeLeft=function(){if(!this.m_flashEnabled||!this.m_flashElem.getMuteTimeLeft){return 0
}return this.m_flashElem.getMuteTimeLeft()
};
ui.notice.prototype.canWarn=function(a,b){if(!this.m_flashEnabled||!this.m_flashElem.canWarn){return false
}return this.m_flashElem.canWarn(a,b)
};
ui.notice.prototype.checkProbation=function(){var a=this.getMuteTimeLeft();
if(a>0){a=Math.round(a/1000);
this.onProbation=a;
if(this.probationCheckInterval==-1){clearInterval(this.probationCheckInterval);
this.probationCheckInterval=setInterval(hitch(this,"checkProbation"),30000)
}if(this.probationCallback){this.probationCallback(true,this.onProbation)
}}else{this.onProbation=0;
clearInterval(this.probationCheckInterval);
if(this.probationCheckInterval!=-1){this.probationCheckInterval=-1
}if(this.probationCallback){this.probationCallback(false)
}}};
ui.notice.prototype.registerProbationCallback=function(a){this.probationCallback=a
};
ui.notice.prototype.isLocalStorageEnabled=function(){if(!this.m_flashEnabled){return false
}var a=false;
try{a=this.m_flashElem.isLocalStorageEnabled()
}catch(b){gNetworkMgr.doUILog("notice","failedLocalStorageCall","isLocalStorageEnabled",true,b.toString())
}return a
};
ui.Uid=function(){this.m_isReady=false;
this.m_flashEnabled=false;
this.m_uid;
if(typeof(gFlashVersion)!="undefined"&&gFlashVersion.major&&(gFlashVersion.major>=8)){this.m_flashEnabled=true
}else{return
}var d="uid";
if(window.location.href.indexOf("dev.meebo.com")>=0){this.m_path=window.location.protocol+"//"+window.location.hostname+"/"
}else{if(window.location.href.indexOf("stage.meebo.com")>=0){this.m_path="http://stage-widget.meebo.com/"
}else{this.m_path="http://widget.meebo.com/"
}}if(ui.isHttps){this.m_path=window.location.protocol+"//"+window.location.hostname+"/flash/"
}var b=document.createElement("div");
b=document.body.appendChild(b);
var c=1;
var e=1;
var f=Math.floor(Math.random()*1000000);
var a='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="'+d+'" width="'+c+'" height="'+e+'" align="middle">';
a+='<param name="allowScriptAccess" value="always" />';
a+='<param name="movie" value="'+this.m_path+"uid.swf?"+f+'" />';
a+='<param name="quality" value="high" />';
a+='<param name="wmode" value="transparent" />';
a+='<embed src="'+this.m_path+"uid.swf?"+f+'" quality="high" width="'+c+'" height="'+e+'" swLiveConnect=true id="'+d+'" name="'+d+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" />';
a+="</object>";
b.innerHTML=a;
this.m_flashElem=(ui.isIE)?window[d]:document[d];
this.m_flashEnabled=Boolean(this.m_flashElem)
};
ui.Uid.prototype.onReady=function(){this.m_isReady=true;
if(this.m_readyCallback){setTimeout(hitch(this,"m_readyCallback"),0)
}};
ui.Uid.prototype.executeWhenReady=function(a){if(!this.m_flashEnabled||this.m_isReady){setTimeout(hitch(this,a),0)
}else{this.m_readyCallback=a
}};
ui.Uid.prototype.makeUid=function(){var b=new Date().getTime()*Math.random();
var a=b.toString();
var c=util.sha.sha256(a).substr(0,40);
util.cookie.save("meebo_unique_id",c);
this.m_uid=c
};
ui.Uid.prototype.onUid=function(){if(this.m_uid){return this.m_uid
}if(!this.m_flashEnabled||"undefined"==typeof(this.m_flashElem.onUid)){var a=util.cookie.load("meebo_unique_id");
if(a){this.m_uid=a
}else{this.makeUid()
}}else{try{this.m_uid=this.m_flashElem.onUid()
}catch(b){this.makeUid()
}}return this.m_uid
};
ui.Uid.prototype.isLocalStorageEnabled=function(){if(!this.m_flashEnabled){return false
}var a=false;
try{a=this.m_flashElem.isLocalStorageEnabled()
}catch(b){gNetworkMgr.doUILog("uid","failedLocalStorageCall","isLocalStorageEnabled",true,b.toString())
}return a
};
function spanNodeCreator(a){var b=gDoc(a);
return function(c){var d=b.createElement("span");
d.innerHTML=c;
return d
}
}function createImg(c,k,b,h,a,e,l,g,f){var d=gDoc(k).createElement("img");
if(!d){return
}if(c){d.id=c
}if(e){d.setAttribute("alt",e);
d.setAttribute("title",e)
}if(g){d.setAttribute("align",typeof g=="boolean"?"top":g)
}if(!l&&a){if(f){d.onload=hitch(d,fixPng);
addClassName(d,"fixPng")
}d.src=a
}else{if(a){if(f){d.png=true
}gImages.requestImage(a,d)
}}if(b){d.width=b
}if(h){d.height=h
}return d
}function cacheImgs(a){if(a.tagName.toLowerCase()=="img"){gImages.requestImage(a.getAttribute("src"),a)
}else{var e=a.getElementsByTagName("img");
for(var c=0,b;
(b=e[c]);
c++){var d=b.getAttribute("path")||b.getAttribute("src");
gImages.requestImage(d,b)
}}}ui.pane=function(){this.create=function(e,a,b,c){this.m_win=gWin(a);
var d=this.m_win.document.createElement("div");
if(!d){return
}d.id=e;
d.control="ui.pane";
d.className="uiPane";
d.setAttribute("width",b);
d.setAttribute("height",c);
this.init(a.appendChild(d))
};
this.init=function(a){if(!a){return
}this.m_element=a;
this.m_element.setAttribute("ptr",this);
this.m_width=parseInt(this.m_element.getAttribute("width"));
this.m_height=parseInt(this.m_element.getAttribute("height"));
var b=this.m_element.firstChild;
while(b){if(b.getAttribute&&(b.getAttribute("control")=="ui.paneContent")){this.initContent(b)
}b=b.nextSibling
}this.m_element.ptr=this
};
this.initContent=function(a){if(!a){return
}a.initContent(this.m_element,this.m_width,this.m_height);
this.m_contents[a.m_element.id]=a
};
this.addContent=function(c,a){var b=new ui.paneContent();
b.create(c,this.m_element,a);
this.m_contents[contentO.m_element.id]=contentO;
return b
};
this.showContent=function(a){if(this.m_activePane&&(this.m_activePane.m_element.id==a)){return
}if(this.m_activePane){this.hideContent(this.m_activePane.m_element.id)
}if(this.m_contents[a]){this.m_activePane=this.m_contents[a];
this.m_activePane.m_element=this.m_contents[a].m_element=this.m_element.appendChild(this.m_contents[a].m_element);
this.m_activePane.resize(this.m_width,this.m_height)
}if(this.m_activePane.onRender){this.m_activePane.onRender()
}};
this.hideContent=function(a){if(this.m_contents[a]&&this.m_contents[a].onHide){this.m_contents[a].onHide()
}if(this.m_contents[a]){this.m_contents[a].m_element=this.m_element.removeChild(this.m_contents[a].m_element)
}};
this.getActivePane=function(){if(this.m_activePane){return this.m_activePane
}else{for(var a in this.m_contents){if(this.m_contents[a]){this.m_activePane=this.m_contents[a];
return this.m_activePane
}}}};
this.getContent=function(a){return this.m_contents[a]
};
this.resize=function(a,b){if(a<0){a=0
}if(b<0){b=0
}this.m_element.style.width=a+"px";
this.m_element.style.height=b+"px";
this.m_width=a;
this.m_height=b;
var c=this.getActivePane();
if(c){c.resize(a,b)
}};
this.m_win=window;
this.m_activePane=null;
this.m_element=null;
this.m_width=0;
this.m_height=0;
this.m_contents=new Array()
};
ui.paneContent=function(){this.m_id;
this.m_element=null;
this.m_onMouseUp=new Object();
this.m_win=window;
this.create=function(c,a){this.m_win=gWin(a);
var b=this.m_win.document.createElement("div");
if(!b){return
}this.id=c;
b.id=c;
b.control="ui.paneContent";
b.className="uiPaneContent";
this.init(b)
};
this.init=function(a){this.m_element=a
};
this.resize=function(a,b){if(a<0){a=0
}if(b<0){b=0
}this.m_element.style.width=a+"px";
this.m_element.style.height=b+"px";
this.m_width=a;
this.m_height=b;
if(this.resizePane){this.resizePane(a,b)
}}
};
Class("ui.Tree",ui.Element,function(a){this.initialize=function(b){a(this,"initialize");
if(!b){b={}
}this.buildDragTree=b.buildDragTree;
b.eventModel=b.eventModel||ui.TreeEventModel;
this.setEventModel(new b.eventModel(this));
this.m_selectionModel=new ui.TreeSelection(this);
this.m_children=[];
this.m_root=null;
this.m_dragTree=null;
this.m_isDragEnabled=false;
this.m_useProgressiveUpdate=false;
this.m_dropTargets=null;
this.m_scroller=new ui.Animation();
this.m_scroller.addSubject(hitch(this,"onAnimateScroll"));
this.m_initialScrollTop;
this.m_scrollDy;
this.m_uncreatedHTML=null
};
this.createContent=function(){this.m_drag=new lib.Drag(this.m_win,false,3);
this.m_drag.subscribe("DragStart",this,"onDragStart");
this.m_drag.subscribe("Drag",this,"onDrag");
this.m_drag.subscribe("DragStop",this,"onDragStop");
if(this.m_uncreatedHTML){this.m_element.innerHTML=this.m_uncreatedHTML;
this.m_uncreatedHTML=null;
setTimeout(hitch(this,"onRender"),0)
}};
this.onRender=function(){this.m_root.onRender(this.m_win);
this.m_eventModel.connectContentEvents(this.m_root.getElement())
};
this.uncreateContent=function(){if(this.m_root&&this.m_root.getElement()){this.m_eventModel.disconnectContentEvents(this.m_root.getElement())
}this.m_uncreatedHTML=this.m_element.innerHTML
};
this.applyToRange=function(l,k,g){var b=this.m_root;
if(!l){l=this.m_root.getNextTree()
}if(!k){k=this.m_root.getLastDescendant()
}if(!l){return
}var e=l.compareTo(k);
var c=e<0?"getNextTree":"getPreviousTree";
var d=l[c]();
g(l);
if(e==0){return
}for(var h=d;
h!=k&&h;
h=d){d=h[c]();
g(h)
}g(k)
};
this.applyToVisibleRange=function(d){var e=this.m_element.scrollTop-10;
var b=e+this.m_element.offsetHeight+20;
var c=this.m_root;
while(c&&(c=c.getNextVisibleTree())){if(c.isVisible()&&c.m_element.offsetTop+20>=e){d(c);
c=c.getNextVisibleTree();
while(c&&c.m_element.offsetTop<=b){d(c);
c=c.getNextVisibleTree()
}return
}}};
this.enableProgressiveUpdate=function(){this.m_useProgressiveUpdate=true;
ui.connectEvent(this.m_element,"scroll",this,"updateVisible")
};
this.getSelectionModel=function(){return this.m_selectionModel
};
this.setEventModel=function(b){if(b==this.m_eventModel){return
}if(this.m_eventModel&&this.m_element){this.m_eventModel.disconnectContentEvents(this.m_element)
}this.m_eventModel=b;
if(this.m_element){this.m_eventModel.connectContentEvents(this.m_element)
}};
this.getEventModel=function(){return this.m_eventModel
};
this.setRoot=function(b){if(this.m_element){if(this.m_root&&this.m_root.m_element.parentNode==this.m_element){var c=this.m_root.getElement();
removeElement(c);
this.m_eventModel.disconnectContentEvents(c)
}this.m_root=b;
this.m_redrawChildren={};
this.m_root.m_isRoot=true;
this.m_root.setTree(this);
this.m_root.create(this);
var c=this.m_root.getElement();
this.m_element.appendChild(c);
if(this.m_eventModel){this.m_eventModel.connectContentEvents(c)
}}else{this.m_root=b
}return b
};
this.getRoot=function(){return this.m_root
};
this.getCount=function(){return this.m_root.getCount.apply(this.m_root,arguments)
};
this.getChildren=function(){return this.m_root.getChildren.apply(this.m_root,arguments)
};
this.insertItem=function(){return this.m_root.insertItem.apply(this.m_root,arguments)
};
this.deleteItem=function(){return this.m_root.deleteItem.apply(this.m_root,arguments)
};
this.getDescendantItem=function(){return this.m_root.getDescendantItem.apply(this.m_root,arguments)
};
this.getSelections=function(){return this.m_selectionModel.getSelections()
};
this.setDropTargets=function(b){this.m_dropTargets=b
};
this.getDropTargets=function(){return this.m_dropTargets
};
this.setDragEnabled=function(){};
this.startDrag=function(c,b){if(c.button==2||(ui.isMac&&c.ctrlKey)){return
}this.m_dragNode=b;
this.m_drag.startDrag(c,this.m_selectionModel.getSelections())
};
this.handleDragStop=function(){if(this.m_dragTree){this.m_dragTree.style.display="none"
}};
this.getPos=function(){return posWithRespectTo(this.m_element,this.m_globalParent)
};
this.onDragStart=function(e,h){if(!this.buildDragTree){return
}if(!this.m_dragTree){this.m_dragTree=this.buildDragTree()
}this.m_dragTree.style.width=this.m_element.offsetWidth+"px";
var f=this.m_dragTree.childNodes[0];
f.innerHTML="";
var d=this.m_dragNode;
if(!d.isSelected()){this.m_selectionModel.selectOnly(d)
}var g=this.m_selectionModel.getSelections();
this.m_drag.m_params=g;
for(var b in g){var c=g[b].getExtra();
if(c.getType()!="chat"&&(c.getType()!="buddy"||c.isWidgetUser())){continue
}var k=g[b].getElement().cloneNode(true);
ui.disconnectAllEvents(k);
f.appendChild(k);
var l=posWithRespectTo(g[b].m_element);
k.style.position="absolute";
k.style.top=l.top-h.y+"px";
k.style.left=l.left-h.x+"px";
k.style.width=g[b].m_element.offsetWidth+"px";
k.firstChild.style.backgroundColor="transparent";
if(!ui.isSafari){gEffects.setOpacity(k,50)
}}this.m_dragTree.style.left=h.x+"px";
this.m_dragTree.style.top=h.y+"px";
this.m_dragTree.style.display="block";
if(this.m_dropTargets){this.m_dropTargets.activate(this.m_win)
}};
this.onDrag=function(c,b){if(this.m_dragTree){this.m_dragTree.style.left=b.x+"px";
this.m_dragTree.style.top=b.y+"px"
}if(this.m_dropTargets){this.m_currentTarget=this.m_dropTargets.query(b.x,b.y)
}};
this.onDragStop=function(d,b){var c=false;
if(this.m_currentTarget){if(this.m_currentTarget.dropHandle){if(d){c=this.m_currentTarget.dropHandle(d)
}if(this.m_currentTarget.dropHover){this.m_currentTarget.dropHover(false)
}}this.m_currentTarget=null
}if(this.m_dragTree){if(c){this.handleDragStop()
}else{gEffects.startMove(this.m_dragTree,b.x-b.dx,b.y-b.dy,true,true,100,hitch(this,"handleDragStop"))
}}};
this.scrollToNodeHeader=function(c){var b=c.m_element.offsetTop;
var e=c.getHeader();
var d=e&&e.offsetHeight||20;
if(b<this.m_element.scrollTop){this.m_element.scrollTop=b
}else{if(b>this.m_element.scrollTop+this.m_element.offsetHeight-d){this.m_element.scrollTop=b-this.m_element.offsetHeight+d
}}};
this.scrollToNode=function(d,f){var c=d.m_element.offsetTop+(f&&f.top?f.top:0);
var b=d.m_element.offsetTop+d.m_element.offsetHeight+(f&&f.bottom?f.bottom:0);
var e=this.m_element.scrollTop;
if(b>e+this.m_element.offsetHeight){e=b-this.m_element.offsetHeight
}if(c<e){e=c
}this.m_element.scrollTop=e
};
this.scrollToTop=function(b,c){this.m_initialScrollTop=this.m_element.scrollTop;
this.m_scrollDy=b.m_element.offsetTop-this.m_element.scrollTop;
this.m_scroller.play()
};
this.onAnimateScroll=function(b){this.m_element.scrollTop=this.m_scrollDy*b+this.m_initialScrollTop
};
this.markRedraw=function(b){this.m_redrawChildren[b.m_id]=b
};
this.unmarkRedraw=function(b){delete this.m_redrawChildren[b.m_id]
};
this.redrawChildren=function(){var b=this.m_element.parentNode;
while(b&&b!=this.m_win.document){b=b.parentNode
}if(!b){return
}for(var c in this.m_redrawChildren){this.m_redrawChildren[c].redraw();
delete this.m_redrawChildren[c]
}this.updateVisible()
};
this.updateVisible=createDelayedMethod("updateVisible",function(){if(!this.m_useProgressiveUpdate){return
}var b=this.applyToVisibleRange(function(c){c.update()
})
},100)
});
ui.Tree.compareTreeAncestorPaths=function(c,b){for(var a=0;
a<c.length&&a<b.length&&c[a]==b[a];
a++){}if(a==c.length){if(a==b.length){return 0
}return -1
}if(a==b.length){return 1
}return c[a]<b[a]?-1:1
};
ui.Tree.getRange=function(f,e){var a=[f];
var c=f.compareTo(e);
if(c==0){return
}if(c<0){var b="getNextTree"
}if(c>0){var b="getPreviousTree"
}for(var d=f[b]();
d!=e&&d;
d=d[b]()){a[a.length]=d
}return a
};
Class("ui.TreeNode",ui.Element,function(a){this.m_control="uiTree";
this.m_extra;
this.m_headerDiv;
this.m_className="uiTree";
this.m_headerClassName="header";
this.m_baseHeaderClassName="";
this.m_text="";
this.m_childrenDiv;
this.m_tree=null;
this.m_isRoot=false;
this.m_index=0;
this.m_level=0;
this.m_indentation=16;
this.m_sortFunc;
this.m_sortIndex;
this.m_bToggleHandle;
this.m_bToggleOpen=true;
this.m_display=true;
this.m_needsUpdate=false;
this.m_isSelected=false;
this.m_isSelectionEnabled=true;
this.m_selectionModifiers=modifier.CTRL|modifier.SHIFT;
this.initialize=function(b){a(this,"initialize");
this.m_id=b;
this.m_children=[]
};
this.setDisplay=function(b){a(this,"setDisplay",arguments);
this.m_display=b
};
this.setTree=function(b){this.m_tree=b
};
this.getTree=function(){return this.m_tree
};
this.setSelectionEnabled=function(b){this.m_isSelectionEnabled=b
};
this.isSelectionEnabled=function(){return this.m_isSelectionEnabled
};
this.selectAllChildren=function(){var b=this.m_tree.getSelectionModel();
for(var c=0,d;
(d=this.m_children[c]);
c++){b.addNode(d)
}};
this.selectAllSiblings=function(d){var c=this.m_tree.getSelectionModel();
for(var b=this[d]();
b!=null;
b=b[d]()){c.addNode(b)
}};
this.isSelected=function(){return this.m_isSelected
};
this.setSelected=function(b){if(this.m_isSelected==b){return
}this.m_isSelected=b;
this.toggleHeaderClassName(b,ui.TreeNode.classNames.selected)
};
this.getSiblingAncestors=function(d){if(this.m_level==d.m_level&&this.m_parent==d.m_parent){return[this,d]
}else{var c=this,b=d;
if(this.m_level>d.m_level){c=this.m_parent
}else{if(this.m_level<d.m_level){b=d.m_parent
}else{c=this.m_parent;
b=d.m_parent
}}return c.getSiblingAncestors(b)
}};
this.getNextSiblingTree=function(){return(this.m_parent instanceof ui.TreeNode?this.m_parent.m_children[this.m_index+1]:null)
};
this.getPreviousSiblingTree=function(){return(this.m_parent instanceof ui.TreeNode?this.m_parent.m_children[this.m_index-1]:null)
};
this.getNextTree=function(){if(this.m_children.length&&this.m_bToggleOpen){return this.m_children[0]
}if(this.m_parent instanceof ui.Tree||!this.m_parent){return null
}if(this.m_index<this.m_parent.m_children.length-1){return this.getNextSiblingTree()
}return this.m_parent.getNextSiblingTree()
};
this.getPreviousTree=function(){var b=this.getPreviousSiblingTree();
if(b){var c=b.getLastDescendant();
return(c?c:b)
}else{return(this.m_parent==this.m_tree.getRoot())?null:this.m_parent
}};
this.getPreviousVisibleTree=function(){var b=this;
do{b=b.getPreviousTree()
}while(b&&!b.isVisible());
return b
};
this.getNextVisibleTree=function(){var b=this;
do{b=b.getNextTree()
}while(b&&!b.isVisible());
return b
};
this.getLastDescendant=function(b){if(!this.m_children.length||!this.m_bToggleOpen){return(b?this:null)
}else{return this.m_children[this.m_children.length-1].getLastDescendant(true)
}};
this.getLastVisibleDescendant=function(){var b=this.getLastVisibleChild();
if(b&&b.m_children.length){var c=b.getLastVisibleDescendant();
if(c){return c
}}return b
};
this.getLastVisibleChild=function(){for(var b=this.m_children.length-1,c;
c=this.m_children[b];
--b){if(c.isVisible()){return c
}}return null
};
this.isVisible=function(){var b=this;
while((b=b.m_parent)&&b instanceof ui.TreeNode){if(!b.m_bToggleOpen){return false
}}return this.getElement()&&getCSSProp(this.getElement(),"display")!="none"
};
this.getElement=function(){return this.m_element||(this.m_element=this.m_win&&this.m_win.document.getElementById(this.m_id))
};
this.getType=function(){var b=this.getExtra();
if(!b){return"none"
}return b.getType()
};
this.getCount=function(){return this.m_children.length
};
this.getDescendantItem=function(e){if(!this.m_children.length){return null
}var c=this.getItem(e);
if(c){return c
}for(var b=0,d;
(d=this.m_children[b]);
b++){var c=d.getDescendantItem(e);
if(c){return c
}}return null
};
this.getHeader=function(){return this.m_headerDiv||(this.m_element?(this.m_headerDiv=this.m_element.firstChild):null)
};
this.getChildrenDiv=function(c){var b=this.m_childrenDiv||(this.m_element?(this.m_childrenDiv=this.m_element.childNodes[this.m_isRoot?0:1]):null);
if(!b&&this.m_element&&c){b=this.m_win.document.createElement("div");
b.className=ui.TreeNode.classNames.children;
if(!this.m_bToggleOpen){b.style.display="none"
}this.m_element.appendChild(b);
this.m_childrenDiv=b
}return b
};
this.getItem=function(b){return this.m_children[b]
};
this.highlight=function(b){this.toggleHeaderClassName(b,ui.TreeNode.classNames.highlight)
};
this.addHeaderClassName=function(b){this.toggleHeaderClassName(true,b)
};
this.removeHeaderClassName=function(b){this.toggleHeaderClassName(false,b)
};
this.toggleHeaderClassName=function(c,b){var e=(c?addClassName:removeClassName)(this.m_headerClassName,this.m_baseHeaderClassName+b);
if(e==this.m_headerClassName){return
}this.m_headerClassName=e;
var d=this.getHeader();
if(d){d.className=this.m_headerClassName
}};
this.isToggled=function(){return !this.m_bToggleOpen
};
this.setToggled=function(b){if(this.m_bToggleOpen==b){this.toggle()
}};
this.toggle=function(){this.m_bToggleOpen=!this.m_bToggleOpen;
this.publish("Toggle",this,!this.m_bToggleOpen);
this.toggleHeaderClassName(this.m_bToggleOpen,ui.TreeNode.classNames.toggleOpen);
this.toggleHeaderClassName(!this.m_bToggleOpen,ui.TreeNode.classNames.toggleClose);
if(this.getChildrenDiv()){this.getChildrenDiv().style.display=this.m_bToggleOpen?"":"none"
}else{if(this.m_bToggleOpen&&this.m_children.length){removeElement(this.getElement());
this.m_element=null;
this.redraw()
}}if(this.m_tree){this.m_tree.updateVisible()
}};
this.getText=function(){return this.m_text
};
this.setText=function(b){if(b==this.m_text){return
}this.m_text=b;
this.markRedraw()
};
this.showEditInput=function(n,o,e){o=stripWhitespace(typeof o=="string"?o:this.getText());
if(!this.m_element){this.redraw()
}var f=this.m_tree.m_element;
var d=this.getHeader().firstChild;
var k=posWithRespectTo(d,f);
var l=k.x+d.offsetWidth,g=k.y,m=f.offsetWidth-l-(ui.isIE?0:4),c=this.getHeader().offsetHeight+4;
var b=this.m_win.document.createElement("div");
b.innerHTML='<input class="uiLabelEditField" type="text" 			autocomplete="off" value="'+escapeHTML(o)+'" style="top:'+g+"px; left:"+l+"px; width:"+m+"px; height:"+c+'px;z-index: 2000000000">';
this.m_editInput=b.firstChild;
f.style.overflow="hidden";
f.onselectstart=null;
f.appendChild(this.m_editInput);
this.m_editInput.focus();
this.m_editInput.select();
if(e){this.m_editInput.maxLength=e
}ui.connectEvent(this.m_editInput,"keypress",this,"onEditEvent",true);
ui.connectGlobalEvent(this.m_win.document,"mousedown",hitch(this,"onEditEvent"));
this.m_editCallback=n;
if(ui.isIE&&typeof gWindowMgr!="undefined"){gWindowMgr.redraw()
}};
this.onEditEvent=function(c){var f=c.target||c.srcElement,b=c.type,d=c.keyCode;
if(b!="keypress"&&f==this.m_editInput){return false
}else{if(d==ui.KEY_ESC){this.cancelEdit()
}else{if(b=="mousedown"||d==ui.KEY_RETURN){this.cancelEdit(this.m_editInput.value)
}}}};
this.cancelEdit=function(b){if(!this.m_editInput){return
}this.m_tree.m_element.style.overflow="";
this.m_tree.m_element.onselectstart=function(){return false
};
removeElement(this.m_editInput);
this.m_editInput=null;
ui.disconnectGlobalEvent(this.m_win.document,"mousedown");
if(this.m_editCallback){this.m_editCallback(this,typeof b=="string"?b:null);
this.m_editCallback=null
}};
this.sort=function(){if(!this.m_sortFunc||this.m_children.length<=1){return
}if(this.m_element){var c=this.getChildrenDiv(true)
}this.m_children.sort();
for(var d=0,e;
(e=this.m_children[d]);
d++){e.m_index=d;
var b=c&&c.childNodes[d];
if(b&&b!=e.m_element){c.insertBefore(e.m_element,b)
}}};
this.getItemIndex=function(g){var e=this.m_children;
var f=g.m_sortIndex,d=e.length;
if(this.m_sortFunc&&d){var c=0,b=d;
while(b-c>1){d=Math.floor((b+c)/2);
if(f<e[d].m_sortIndex){b=d
}else{c=d
}}d=(f<e[c].m_sortIndex?c:b)
}return d
};
this.getIndex=function(){return this.m_index
};
this.insertItem=function(d){if(this.m_children[d.getId()]){return d.m_index
}if(d.m_parent instanceof ui.TreeNode){d.m_parent.deleteItem(d,true)
}d.m_parent=this;
d.m_level=this.m_level+1;
d.m_tree=this.m_tree;
d.setSortIndex();
var b=this.getItemIndex(d);
this.m_children[d.getId()]=d;
this.m_children.splice(b,0,d);
for(var c=b;
c<this.m_children.length;
c++){this.m_children[c].m_index=c
}this.insertChildDOMNode(d);
return d
};
this.reinsertItem=function(f){var d=this.m_children;
var e=f.m_index;
d.splice(e,1);
var c=this.getItemIndex(f);
d.splice(c,0,f);
for(var b=Math.min(e,c);
b<d.length;
b++){d[b].m_index=b
}this.insertChildDOMNode(f);
return f
};
this.insertChildDOMNode=function(d){d.m_parent=this;
if(!d.m_element){d.markRedraw()
}else{if(this.getChildrenDiv()||this.m_bToggleOpen){d.getHeader().style.paddingLeft=(this.m_level*d.m_indentation)+"px";
for(var c=d.m_index+1,b;
(b=this.m_children[c]);
c++){if(!b.m_element){continue
}this.getChildrenDiv(true).insertBefore(d.m_element,b.m_element);
break
}if(!b){this.getChildrenDiv(true).appendChild(d.m_element)
}}}return d
};
this.deleteAll=function(){this.m_element.removeChild(this.getChildrenDiv())
};
this.deleteItem=function(e,d){if(!e||!this.m_children.length){return
}if(this.m_tree){this.m_tree.unmarkRedraw(e);
this.m_tree.publish("DeleteNode",e)
}var b=e.m_index;
if(this.m_children[b]==e){this.m_children.splice(b,1);
for(var c=b;
c<this.m_children.length;
c++){this.m_children[c].m_index=c
}}removeElement(e.m_element);
if(!d){e.m_element=null;
e.m_headerDiv=null
}delete this.m_children[e.m_id];
e.m_parent=null;
e.m_tree=null;
e.m_index=0;
return e
};
this.renameChildItemId=function(b,c){if(b==c){return
}var d=this.m_children[b];
if(!d){return
}delete this.m_children[b];
d.setId(c);
this.m_children[c]=d
};
this.getLevel=function(){return this.m_level
};
this.getChildren=function(){return this.m_children
};
this.hasChildren=function(){return Boolean(this.m_children.length)
};
this.getExtra=function(){return this.m_extra
};
this.setExtra=function(b){this.m_extra=b
};
this.getId=function(){return this.m_id||this.m_element&&this.m_element.id||""
};
this.setId=function(b){this.m_id=b;
if(this.m_element){this.m_element.id=b
}};
this.createContent=function(){this.m_element.id=this.m_id;
this.m_element.setAttribute("control","uiTree");
this.m_element.className=this.m_className;
this.m_element.innerHTML=this.getHTMLString(true);
if(!this.m_display){this.m_element.style.display="none"
}};
this.getHTMLString=function(e){var d=(e?"":'<div id="'+this.m_id+'" class="'+this.m_className+'" control="uiTree">')+(this.m_isRoot?"":'<div class="'+this.m_headerClassName+'" style="padding-left: '+((this.m_level-1)*this.m_indentation)+'px;">'+this.getHeaderHTMLString()+"</div>");
if(this.m_children.length&&this.m_bToggleOpen){var b=['<div class="'+ui.TreeNode.classNames.children+'"',(this.m_bToggleOpen?">":' style="display: none;">')];
for(var c=0;
c<this.m_children.length;
c++){b[b.length]=this.m_children[c].getHTMLString()
}b[b.length]="</div>";
d+=b.join("")
}if(!e){d+="</div>"
}this.markUpdate();
return d
};
this.getHeaderHTMLString=function(){return'<span class="'+ui.TreeNode.classNames.img+'">'+(ui.isSafari||ui.isOpera?"&nbsp;":"")+'<div class="'+ui.TreeNode.classNames.img+'"></div></span><span class="'+ui.TreeNode.classNames.label+'">'+this.getText()+"</span>"
};
this.onRender=function(c){this.m_win=c;
this.m_headerDiv=null;
this.m_childrenDiv=null;
this.m_element=null;
this.m_element=this.getElement();
for(var b=0,d;
(d=this.m_children[b]);
b++){d.onRender(this.m_win)
}};
this.markRedraw=function(){if(!this.m_parent){return
}if(!this.m_parent.m_element){this.setSortIndex();
this.m_parent.markRedraw()
}else{if(this.m_tree){this.m_tree.markRedraw(this)
}}};
this.redraw=function(){if(this.setSortIndex()){this.m_parent.reinsertItem(this)
}if(this.m_element){this.getHeader().innerHTML=this.getHeaderHTMLString()
}else{if(!this.m_parent||this.m_parent.m_element){this.sort();
this.create(this.m_parent);
if(this.m_parent){this.m_parent.insertChildDOMNode(this)
}if(this.m_children.length){this.onRender(this.m_win)
}}else{this.m_parent.redraw()
}}if(this.m_tree){this.m_tree.unmarkRedraw(this)
}this.markUpdate()
};
this.markUpdate=function(){this.m_needsUpdate=true
};
this.update=function(){this.m_needsUpdate=false
};
this.show=function(){this.setDisplay(true);
this.m_tree.publish("ShowNode",this)
};
this.hide=function(){this.setDisplay(false);
this.m_tree.publish("HideNode",this)
};
this.setNewParent=function(b){if(b==this.m_parent){return
}if(this.m_parent){this.m_parent.deleteItem(this,true)
}if(b.insertItem){b.insertItem(this)
}};
this.setSortFunc=function(c){this.m_sortFunc=c;
for(var b=0;
b<this.m_children.length;
b++){this.m_children[b].setSortIndex()
}this.sort()
};
this.setSortIndex=function(){if(!this.m_parent||!this.m_parent.m_sortFunc){return false
}var d=this.m_parent.m_sortFunc(this);
if(this.m_sortIndex==d){return false
}this.m_sortIndex=d;
var c=this.getPreviousSiblingTree(),b=this.getNextSiblingTree();
if(c&&!(d>c.m_sortIndex)){return true
}if(b&&!(d<b.m_sortIndex)){return true
}return false
};
this.toString=function(){return this.m_sortIndex
};
this.compareTo=function(b){return b&&ui.Tree.compareTreeAncestorPaths(this.getTreeAncestorPath(),b.getTreeAncestorPath())
};
this.getTreeAncestorPath=function(){var b=[];
for(var c=this;
c;
c=c.m_parent){b.unshift(c.m_index)
}return b
}
});
ui.TreeNode.classNames={children:"children",highlight:"highlight",img:"img",label:"label",selected:"selected",toggleOpen:"toggle-open",toggleClose:"toggle-close"};
Class("ui.TreeSelection",lib.Publisher,function(a){this.initialize=function(b){a(this,"initialize");
this.m_tree=b;
this.m_tree.subscribe("HideNode",this,"onHideNode");
this.m_tree.subscribe("DeleteNode",this,"onDeleteNode");
this.m_selections={};
this.m_pivot=null;
this.m_focus=null;
this.m_numSelections=0;
this.directions={TOP:"Top",BOTTOM:"Bottom",PREVIOUS:"Previous",NEXT:"Next",UP:"Previous",DOWN:"Next"}
};
this.getSelections=function(){return this.m_selections
};
this.setSelections=function(b){this.m_selections=b
};
this.getPivot=function(){return this.m_pivot
};
this.setPivot=function(b){this.m_pivot=b
};
this.setFocus=function(b){this.m_focus=b
};
this.getFocus=function(){return this.m_focus
};
this.getNumSelections=function(){return this.m_numSelections
};
this.setNumSelections=function(b){this.m_numSelections=b
};
this.extendSelection=function(c){if(this.m_pivot==null&&this.m_numSelections==1){this.m_pivot=this.getFirstSelection()
}var b=this.getNextVisibleFrom(this.m_pivot,c);
if(b){if(b.isSelected()){this.removeNode(this.m_pivot)
}else{this.addNode(b)
}this.m_pivot=b;
this.m_tree.scrollToNodeHeader(b)
}return b
};
this.addNode=function(b){if(b.isSelected()){return
}this.m_selections[b.getId()]=b;
this.m_numSelections++;
if(!this.m_pivot){this.m_pivot=b
}b.setSelected(true);
this.publish("SelectionChanged")
};
this.removeNode=function(b){if(!b){return false
}b.setSelected(false);
if(b.getId() in this.m_selections){delete this.m_selections[b.getId()];
this.m_numSelections--;
this.publish("SelectionChanged");
return true
}return false
};
this.selectOnly=function(b){this.unselectAll();
this.addNode(b)
};
this.unselectAll=function(){for(var b in this.m_selections){this.m_selections[b].setSelected(false)
}this.m_selections={};
this.m_pivot=null;
this.m_numSelections=0
};
this.resetSelections=function(){this.unselectAll();
this.m_focus=null
};
this.unselectAllButPivot=function(){for(var b in this.m_selections){if(this.m_selections[b]!=this.m_pivot){this.m_selections[b].setSelected(false)
}}this.m_selections={};
this.m_selections[this.m_pivot.m_id]=this.m_pivot;
this.m_numSelections=1
};
this.getTopSelection=function(){return this.getSelectionBy(function(d,c){if(d.m_parent==c||c.m_parent==d){return d.m_level-c.m_level
}var e=d.getSiblingAncestors(c);
return e[0].m_index-e[1].m_index
})
};
this.getBottomSelection=function(){return this.getSelectionBy(function(d,c){if(d.m_parent==c||c.m_parent==d){return c.m_level-d.m_level
}var e=d.getSiblingAncestors(c);
return e[1].m_index-e[0].m_index
})
};
this.getSelectionBy=function(b,c){c=c||this.m_selections;
var e=null;
for(var d in c){e=e||c[d];
if(b(e,c[d])>=0){e=c[d]
}}return e
};
this.getFirstSelection=function(){for(var b in this.m_selections){return this.m_selections[b]
}return null
};
this.getNextVisibleFrom=function(b,c){return b?b["get"+c+"VisibleTree"]():this.m_tree.getRoot().getNextVisibleTree()
};
this.selectOnlyNext=function(d){var b=this.getFirstSelection();
var c=this.getNextVisibleFrom(b,d);
if(c){this.removeNode(b);
this.addNode(c);
this.m_pivot=c;
this.m_tree.scrollToNodeHeader(c)
}return c
};
this.selectFromSelection=function(b){var c=this["get"+b+"Selection"]();
if(c){this.unselectAll();
this.addNode(c)
}return c
};
this.onHideNode=function(b){this.removeNode(b);
if(this.m_pivot==b){this.m_pivot=this.getFirstSelection()
}};
this.onDeleteNode=function(b){if(b.isSelected()){this.removeNode(b)
}};
this.handleKeyEvent=function(d){if(!d){return true
}var c=d.keyCode||d.charCode;
var b=d.shiftKey;
switch(c){case ui.KEY_UP:case 63232:ui.setEventHandled(d);
if(b){return this.extendSelection(this.directions.UP)
}else{if(this.m_numSelections<=1){return this.selectOnlyNext(this.directions.UP)
}else{return this.selectFromSelection(this.directions.TOP)
}}break;
case ui.KEY_DOWN:case 63233:ui.setEventHandled(d);
if(b){return this.extendSelection(this.directions.DOWN)
}else{if(this.m_numSelections<=1){return this.selectOnlyNext(this.directions.DOWN)
}else{return this.selectFromSelection(this.directions.BOTTOM)
}}break;
case ui.KEY_RIGHT:case 63235:if(this.m_pivot&&this.m_pivot.m_bToggleHandle&&!this.m_pivot.m_bToggleOpen){this.m_pivot.toggle()
}return;
case ui.KEY_LEFT:case 63234:if(this.m_pivot&&this.m_pivot.m_bToggleHandle&&this.m_pivot.m_bToggleOpen){this.m_pivot.toggle()
}else{if(this.m_pivot&&this.m_pivot.m_parent.m_bToggleHandle&&this.m_pivot.m_parent.m_bToggleOpen){this.m_pivot.m_parent.toggle();
this.selectOnly(this.m_pivot.m_parent)
}}return;
case ui.KEY_RETURN:if(this.m_numSelections==1&&this.m_pivot.m_bToggleHandle){this.m_pivot.toggle()
}else{for(var c in this.m_selections){this.m_selections[c].publish("Activate")
}}break;
case ui.KEY_ESC:this.unselectAll();
break;
default:return true
}ui.setEventHandled(d);
return false
}
});
Class("ui.TreeEventModel",function(){this.initialize=function(a){this.m_tree=a
};
this.connectContentEvents=function(a){var b=hitch(this,function(c,d){ui.connectEvent(a,c,this,"delegateEvent",true,false,d)
});
a.onselectstart=function(){return false
};
a.oncontextmenu=function(){return false
};
b("mouseover","onMouseOver");
b("mousedown","onMouseDown");
b("mouseout","onMouseOut");
b("click","onClick");
b("contextmenu","onContextMenu");
b("dblclick","onDblClick");
ui.connectEvent(a,"keyup",this,"onKeyUp",true)
};
this.disconnectContentEvents=function(a){ui.disconnectEvent(a,"mouseover");
ui.disconnectEvent(a,"mouseout");
ui.disconnectEvent(a,"mousedown");
ui.disconnectEvent(a,"click");
ui.disconnectEvent(a,"contextmenu");
ui.disconnectEvent(a,"dblclick");
ui.disconnectEvent(a,"keyup");
a.onselectstart=null;
a.oncontextmenu=null
};
this.onMouseOver=function(b,a){a.highlight(true);
a.publish("MouseOver",a,b)
};
this.onMouseOut=function(b,a){a.highlight(false);
a.publish("MouseOut",a,b)
};
this.onClick=function(b,a){a.publish("Click",a,b)
};
this.onDblClick=function(b,a){a.publish("DblClick",a,b)
};
this.onContextMenu=function(b,a){a.publish("ContextMenu",a,b)
};
this.onMouseDown=function(b,a){a.publish("MouseDown",a,b)
};
this.onKeyUp=function(b){var a=this.m_tree.getSelectionModel();
if(a){a.handleKeyEvent(b)
}};
this.delegateEvent=function(e,d){var g=e.target||e.srcElement;
var a=null;
while(g.parentNode){if(g.nodeType!=3&&(g.getAttribute("control")||g.control)=="uiTree"){var c=this.m_tree.getDescendantItem(g.id);
if(c){return this[d](e,c,a)
}}if(this.m_classNameList&&!a){for(var b=0,f;
f=this.m_classNameList[b];
++b){if(hasClassName(g,f)){a=f
}}}g=g.parentNode
}}
});
Class("ui.Panel",ui.dlg,function(a){this.initialize=function(){a(this,"initialize");
this.m_classNamePrefix="uiPanel"
};
this.handleFocus=function(){this.m_element.style.zIndex=gWindowMgr.getNextZIndex()
};
this.initContent=function(){a(this,"initContent");
if(this.m_contentArea){this.makeContentAndBordersDraggable();
this.m_element.style.zIndex=gWindowMgr.getNextZIndex()
}return true
};
this.createWindowTable=function(){var c=this.m_element.innerHTML;
var b='<table id="windowFrame" class="'+this.m_classNamePrefix+'Frame">			<tr class="'+this.m_classNamePrefix+'RowBar">				<td id="barw" class="'+this.m_classNamePrefix+'BarW">&nbsp;<br>				<td id="barn" class="'+this.m_classNamePrefix+'BarN">&nbsp;<br>				<td id="bare" class="'+this.m_classNamePrefix+'BarE">&nbsp;<br>			</tr>			<tr class="'+this.m_classNamePrefix+'RowBody">				<td id="w" class="'+this.m_classNamePrefix+'W">&nbsp;<br>				<td id="bg" class="'+this.m_classNamePrefix+'Bg" align="center" valign="center">				<td id="e" class="'+this.m_classNamePrefix+'E">&nbsp;<br>			</tr>			<tr class="'+this.m_classNamePrefix+'RowS">				<td id="sw" class="'+this.m_classNamePrefix+'SW">&nbsp;<br>				<td id="s" class="'+this.m_classNamePrefix+'S">&nbsp;<br>				<td id="se" class="'+this.m_classNamePrefix+'SE">&nbsp;<br>			</tr>		</table>';
this.m_element.innerHTML=b;
this.m_windowFrame=this.m_element.getElementsByTagName("table")[0];
this.setSkin(this.m_skin);
addClassName(this.m_windowFrame,"inactive");
return c
};
this.makeContentAndBordersDraggable=function(){addClassName(this.m_contentArea,"draggable");
ui.connectEvent(this.m_contentArea,"mousedown",this,function(e,d){this.onBorderMouseDown(e,d)
},true,true);
var b=this.m_element.getElementsByTagName("td");
var c=this.toHash(b);
addClassName(c.w,"draggable");
addClassName(c.e,"draggable");
addClassName(c.s,"draggable");
addClassName(c.se,"draggable");
addClassName(c.sw,"draggable");
addClassName(c.barw,"draggable");
addClassName(c.bare,"draggable")
};
this.isPoppedOut=function(){return false
}
});
Class("ui.edit",ui.Element,function(a){this.initialize=function(k,g,f,b,e,h,d,c){a(this,"initialize");
this.m_onKeyPress=null;
this.m_onKeyDown=null;
this.m_fontFamily="Arial";
this.m_fontSize=10;
this.m_fontColor="#000000";
this.m_defaultFontFamily="";
this.m_defaultFontSize="";
this.m_defaultFontColor="";
this.m_fontSizeToHTMLSizeMapping=Array(8,10,12,16,24,34,48);
this.m_HTMLSizeToHTMLSizeMapping=Array(1,2,3,4,5,6,7);
this.m_editId=k;
this.m_editClass=c;
this.m_fontSize=f;
this.m_fontColor=String(b);
this.m_fontFamily=String(g);
this.m_isBold=e;
this.m_isItalics=h;
this.m_isUnderline=d
};
this.setFontFamily=function(b){};
this.setFontSize=function(b){};
this.setFontColor=function(b){};
this.setEditorColor=function(b){};
this.setUnderline=function(b){};
this.setBold=function(b){};
this.setItalics=function(b){};
this.appendText=function(b){};
this.clear=function(){};
this.getText=function(){};
this.setText=function(b){};
this.getHtml=function(b){};
this.focus=function(){};
this.select=function(){};
this.blur=function(){};
this.getValue=function(){};
this.onKeyPress=function(b){this.m_onKeyPress=b
};
this.keyPress=function(b){if(this.m_onKeyPress){return this.m_onKeyPress(b)
}else{return true
}};
this.onKeyUp=function(b){this.m_onKeyUp=b
};
this.keyUp=function(b){if(this.m_onKeyUp){return this.m_onKeyUp(b)
}else{return true
}};
this.onKeyDown=function(b){this.m_onKeyDown=b
};
this.keyDown=function(b){if(this.m_onKeyDown){return this.m_onKeyDown(b)
}else{return true
}};
this.formatMessage=function(b){if(this.m_isBold){b="<b>"+b+"</b>"
}if(this.m_isUnderline){b="<u>"+b+"</u>"
}if(this.m_isItalics){b="<i>"+b+"</i>"
}if(this.m_fontFamily){b='<font face="'+this.m_fontFamily+'">'+b+"</font>"
}if(this.m_fontColor){b='<font color="'+this.m_fontColor+'">'+b+"</font>"
}if(this.m_fontSize){b='<font size="'+this.pixelsToFontSize(this.m_fontSize)+'">'+b+"</font>"
}return b
};
this.pixelsToFontSize=function(b){if(b>39){return 7
}else{if(b>=29){return 6
}else{if(b>=21){return 5
}else{if(b>=17){return 4
}else{if(b>=13){return 3
}else{if(b>=11){return 2
}}}}}}return 1
};
this.fontToHTMLSize=function(d,b){if(!b){b=this.m_fontSizeToHTMLSizeMapping
}for(var c=0;
c<b.length;
c++){if(d<=b[c]){return(c+1)
}}return b.length
};
this.HTMLToFontSize=function(b,c){if(!c){c=this.m_fontSizeToHTMLSizeMapping
}if(b-1<c.length){return c[b-1]
}return c[c.length-1]
};
this.setHTMLMapping=function(b){this.m_HTMLSizeToHTMLSizeMapping=b
};
this.getId=function(){return this.m_element.id
}
});
Class("ui.simpleEdit",ui.edit,function(a){this.createContent=function(){this.m_element.innerHTML=ui.isIPhone?"<input>":"<textarea></textarea>";
this.m_element.id=this.m_editId;
this.m_element=this.m_element.firstChild;
this.m_element.ptr=this;
this.m_element.setAttribute("control","ui.simpleEdit");
this.m_element.className=this.m_editClass;
this.m_defaultFontFamily=this.m_fontFamily;
this.m_defaultFontSize=parseInt(this.m_fontSize);
this.m_defaultFontColor=this.m_fontColor;
this.setFontFamily(this.m_defaultFontFamily);
this.setFontSize(this.m_defaultFontSize);
this.setFontColor(this.m_defaultFontColor);
this.setBold(this.m_isBold);
this.setItalics(this.m_isItalics);
this.setUnderline(this.m_isUnderline);
ui.connectEvent(this.m_element,"keypress",this,"keyPress",true,false);
ui.connectEvent(this.m_element,"keyup",this,"keyUp",true,false);
ui.connectEvent(this.m_element,"keydown",this,"keyDown",true,false)
};
this.setFontFamily=function(b){this.m_fontFamily=b;
this.m_element.style.fontFamily=b
};
this.setFontSize=function(b){this.m_fontSize=b;
this.m_element.style.fontSize=b
};
this.setFontColor=function(b){this.m_fontColor=b;
this.m_element.style.color=b
};
this.setEditorColor=function(b){this.m_element.style.backgroundColor=b
};
this.setDisabled=function(b){this.m_element.readOnly=b;
this.m_element.value=""
};
this.setUnderline=function(b){this.m_isUnderline=b;
gEffects.fontDecoration(this.m_element,this.m_isUnderline?"underline":"none")
};
this.setBold=function(b){this.m_isBold=b;
this.m_element.style.fontWeight=this.m_isBold?"bold":"normal"
};
this.setItalics=function(b){this.m_isItalics=b;
this.m_element.style.fontStyle=this.m_isItalics?"italic":"normal"
};
this.focus=function(){try{this.m_element.focus()
}catch(b){}moveToEnd(this.m_element)
};
this.blur=function(){this.m_element.blur()
};
this.reinit=function(){this.clear()
};
this.appendText=function(b){this.m_element.value=this.m_element.value+b;
this.focus()
};
this.clear=function(){this.m_element.value=""
};
this.getText=function(){return this.m_element.value
};
this.setText=function(b){this.m_element.value=b
};
this.getHtml=function(b){return this.formatMessage(b,this.m_element.value)
}
});
Class("ui.richEdit",ui.edit,function(a){this.initialize=function(k,g,f,b,e,h,d,c){a(this,"initialize",[k,g,f,b,e,h,d,c]);
this.m_defaultFontFamily="";
this.m_defaultFontColor="";
this.m_defaultFontSize="";
this.m_defaultHtml="";
this.m_iframe=null;
this.m_frameDoc=null;
this.m_range=null;
this.m_onKeyPress=[]
};
this.createContent=function(){this.m_defaultFontFamily=this.m_fontFamily;
this.m_defaultFontColor=this.m_fontColor;
this.m_defaultFontSize=this.m_fontSize;
this.m_element.innerHTML='<iframe frameborder="0" class="uiRichEdit"></iframe>';
this.m_element.className=this.m_editClass;
this.m_element.ptr=this;
this.m_element.setAttribute("control","ui.richEdit");
this.m_iframe=this.m_element.getElementsByTagName("iframe")[0];
var b=this;
if(!ui.isIE){this.m_iframe.onload=function(){this.onload=null;
b.initIframe()
}
}else{this.m_iframe.onreadystatechange=function(){if(b.m_iframe.contentWindow.document.readyState=="complete"){this.onreadystatechange=null;
b.initIframe()
}}
}this.m_iframe.src="blank.html"
};
this.initIframe=function(){if(ui.isIE){this.initIframeIE()
}else{var b=this;
setTimeout(function(){b.initIframeNS()
},0)
}};
this.initIframeIE=function(){this.m_frameDoc=this.m_iframe.contentWindow.document;
if(this.m_frameDoc){this.m_frameDoc.designMode="on";
this.m_frameDoc=this.m_iframe.contentWindow.document;
this.initRichEdit(this.m_defaultHtml);
if(this.m_frameDoc.body){this.m_frameDoc.body.focus()
}}};
this.setSize=function(b,c){this.m_element.style.width=b+"px";
this.m_element.style.height=c+"px";
if(ui.isIE){this.m_iframe.style.width=(b-1)+"px";
this.m_iframe.style.height=(c-1)+"px"
}};
this.initIframeNS=function(){this.m_iframe.contentDocument.designMode="on";
this.m_frameDoc=this.m_iframe.contentDocument;
this.initRichEdit(this.m_defaultHtml);
this.command("useCSS",false)
};
this.initRichEdit=function(b){if(!b){b=""
}var c='<html>					<head>					<style>					body {						margin: 2px;						word-wrap: break-word;						font-family: Tahoma, Arial, sans serif;						font-size: 11px;						color: #000000;						background-color: #FFFFFF;					}					</style>					<!--[if IE]><style type="text/css">p { margin: 0; }</style><![endif]-->					</head>					<body>'+b+"</body>					</html>";
if(this.m_frameDoc){this.m_frameDoc.open();
this.m_frameDoc.write(c);
this.m_frameDoc.close();
this.connectEvents()
}else{this.m_defaultHtml=b
}};
this.connectEvents=function(){attachIframeMouseHandlers(this.m_iframe,hitch(this,"mouseMove"),hitch(this,"mouseDown"),null);
ui.connectEvent(this.m_frameDoc,"keyup",this,"keyUp",true,false);
if(ui.isIE){ui.connectEvent(this.m_frameDoc.body,"beforedeactivate",this,"onBlur",true,false)
}};
this.command=function(f,c){var b=this.m_iframe.contentWindow;
if(!c){c=""
}try{b.focus();
b.document.execCommand(f,false,c);
b.focus()
}catch(d){}};
this.queryCommand=function(d){var b=this.m_iframe.contentWindow;
try{if(d=="bold"||d=="italic"||d=="underline"){return b.document.queryCommandState(d)
}else{return b.document.queryCommandValue(d)
}}catch(c){}};
this.setFontType=function(b,c){this.m_fontType=c;
this.setFontFamily(c)
};
this.setFontFamily=function(b){if(this.m_range){this.m_range.select()
}this.m_fontFamily=b;
this.command("fontname",b);
this.updateFormatting()
};
this.setFontSize=function(b){if(this.m_range){this.m_range.select()
}this.m_fontSize=b;
this.command("fontsize",this.fontToHTMLSize(this.m_fontSize));
this.updateFormatting()
};
this.setFontColor=function(b){this.m_fontColor=b;
this.command("forecolor",b);
this.updateFormatting()
};
this.setUnderline=function(b){this.command("underline","");
this.updateFormatting()
};
this.setBold=function(b){this.command("bold","");
this.updateFormatting()
};
this.setItalics=function(b){this.command("italic","");
this.updateFormatting()
};
this.appendText=function(d){if(ui.isIE){if(!this.m_range){this.m_range=this.m_frameDoc.selection.createRange()
}this.m_range.select();
this.m_range.pasteHTML(d);
this.m_range.moveStart("character",-d.length);
this.setFormatting();
this.m_range.collapse(false);
this.m_range.select()
}else{this.command("insertHTML",d);
var c=this.m_iframe.contentWindow.getSelection();
if(c.getRangeAt){var b=this.m_iframe.contentWindow.getSelection().getRangeAt(0);
b.setStart(b.startContainer,b.startOffset-d.length);
this.setFormatting();
var b=this.m_iframe.contentWindow.getSelection().getRangeAt(0);
this.m_iframe.contentWindow.getSelection().collapse(b.endContainer,b.endOffset)
}}};
this.setFormatting=function(){if(this.m_isBold){this.command("bold")
}if(this.m_isItalics){this.command("italic")
}if(this.m_isUnderline){this.command("underline")
}this.setFontFamily(this.m_fontFamily);
this.setFontColor(this.m_fontColor);
this.setFontSize(this.m_fontSize)
};
this.getValue=function(){if(!this.m_frameDoc){return""
}var b=this.m_frameDoc.body.innerHTML;
if(ui.isIE){b=b.replace(/<\/p>/ig,"<br>").replace(/<p>/ig,"")
}return b
};
this.setValue=function(b){if(!b){b=""
}if(ui.isIE){b=b.replace(/<\/p>/ig,"<br><br>").replace(/<p>/ig,"")
}this.initRichEdit(b)
};
this.getFormattingFromSelection=function(){var b={};
b.fontFamily=this.queryCommand("fontname");
if(!b.fontFamily){b.fontFamily=this.m_defaultFontFamily
}b.fontSize=this.queryCommand("fontsize");
if(!b.fontSize){b.fontSize=this.m_defaultFontSize
}else{b.fontSize=this.HTMLToFontSize(parseInt(b.fontSize))
}b.fontColor=this.queryCommand("forecolor");
if(!b.fontColor){b.fontColor=this.m_defaultFontColor
}b.bUnderline=this.queryCommand("underline");
b.bBold=this.queryCommand("bold");
b.bItalics=this.queryCommand("italic");
return b
};
this.updateFormatting=function(){var b=this.getFormattingFromSelection(this);
this.publish("FormatChange",b.fontFamily,b.fontSize,b.fontColor,b.bBold,b.bItalics,b.bUnderline)
};
this.mouseMove=function(b){this.updateFormatting();
return true
};
this.mouseDown=function(b){this.updateFormatting();
return true
};
this.keyUp=function(b){this.updateFormatting();
if(this.m_onKeyPress){doFunctions(this.m_onKeyPress,b,this)
}return true
};
this.onBlur=function(){this.m_range=this.m_frameDoc.selection.createRange()
}
});
Class("ui.timerMgr",function(){this.initialize=function(){this.m_msec=125;
this.m_timerFncs={};
this.m_timerId=0;
this.m_timerInterval=setInterval(hitch(this,"timerFnc"),this.m_msec)
};
this.addTimer=function(b,a){var c=this.m_timerId++;
this.m_timerFncs[String(c)]={f:b,t:Math.round(a/this.m_msec),et:0};
return c
};
this.removeTimer=function(a){delete this.m_timerFncs[String(a)]
};
this.timerFnc=function(){for(var a in this.m_timerFncs){this.m_timerFncs[a].et++;
if(this.m_timerFncs[a].et>=this.m_timerFncs[a].t){try{this.m_timerFncs[a].et=0;
this.m_timerFncs[a].f()
}catch(b){}}}}
});
Class("ui.searchbox",ui.Element,function(a){this.initialize=function(b,c){a(this,"initialize");
this.m_control="ui.searchbox";
this.m_className="uiSearchbox";
this.m_searchText=b||"";
this.m_width=c||136;
this.m_buttonWidth=16;
this.m_searchInput=null;
this.m_searchButton=null
};
this.createContent=function(){var c=gDoc(this.m_parent);
this.m_element.setAttribute("control",this.m_control);
this.addClassName("searchBox");
this.m_id=this.m_element.id;
this.m_element.style.width=this.m_width+"px";
var b=this.m_width-this.m_buttonWidth;
this.m_searchInput=c.createElement("input");
this.m_searchInput.id=this.m_id+"-input";
this.m_searchInput.value=this.m_searchText;
addClassName(this.m_searchInput,"searchBoxInput");
this.m_searchInput.style.width=b+"px";
this.m_element.appendChild(this.m_searchInput);
this.m_searchButton=c.createElement("img");
this.m_searchButton.id=this.m_id+"-button";
addClassName(this.m_searchButton,"searchBoxButton");
this.m_searchButton.style.left=(b-(ui.isIE?1:-1))+"px";
this.m_element.appendChild(this.m_searchButton);
gImages.requestImage("gallery-search2.png",this.m_searchButton);
ui.connectEvent(this.m_searchInput,"keypress",this,"onKeyPress",true,false);
ui.connectEvent(this.m_searchInput,"focus",this,"onFocus",true,false);
ui.connectEvent(this.m_searchInput,"blur",this,"onBlur",true,false);
ui.connectEvent(this.m_searchButton,"mousedown",this,"doSearch",true,false)
};
this.destroy=function(){ui.disconnectAllEvents(this.m_element);
removeElement(this.m_element)
};
this.highlight=function(c){var d=c?"searchBox":"searchBoxFocus";
var b=c?"searchBoxFocus":"searchBox";
this.removeClassName(d);
this.addClassName(b);
if(ui.isIE){if(c){this.m_element.style.width=(this.m_width+2)+"px"
}else{this.m_element.style.width=this.m_width+"px"
}}};
this.doSearch=function(b){if(this.m_searchInput.value!=(gLang.seeMore+"\u2026")){this.publish("Search",this.m_searchInput.value,b)
}};
this.onKeyPress=function(b){switch(b.keyCode){case ui.KEY_ESC:this.revertText();
ui.setEventHandled(b);
break;
case ui.KEY_RETURN:this.publish("Search",this.m_searchInput.value,b);
ui.setEventHandled(b);
break
}};
this.onFocus=function(b){this.highlight(true);
var c=this.m_searchInput.value;
if(c==gLang.seeMore+"\u2026"){this.m_searchInput.value=""
}else{this.m_searchInput.select()
}};
this.onBlur=function(b){this.highlight(false);
this.revertText()
};
this.revertText=function(){if(!this.m_searchText||this.m_searchText==(gLang.seeMore+"\u2026")){this.m_searchInput.value=gLang.seeMore+"\u2026"
}}
});
Class("ui.ImageChooser",ui.menuheader,function(a){this.initialize=function(h,d,f,b,e,g,c){a(this,"initialize",[h]);
this.m_control="uiImageChooser";
this.m_img=d;
this.m_imageWidth=f;
this.m_imageHeight=b;
this.m_numColumns=g.length<e?g.length:e;
this.m_numRows=Math.ceil(g.length/this.m_numColumns);
this.m_images=g;
this.m_className=c||"";
this.m_bShrinkToSize=true
};
this.createContent=function(){a(this,"createContent");
this.m_bStatic=true;
this.createDOMNode();
this.m_label.m_force=true;
this.setImage(this.m_img||this.m_images[0],this.m_imageWidth,this.m_imageHeight)
};
this.createDOMNode=function(){a(this,"createDOMNode");
this.removeClassName("uiMenuHeader");
this.addClassName("uiImageChooser "+this.m_className);
this.m_dropDownImg=createImg(getUniqueId(),this.m_centerDiv,10,10,this.m_dropDownImgSrc,"",true);
this.m_dropDownImg.className="dropDownImg";
this.m_centerDiv.appendChild(this.m_dropDownImg)
};
this.createMenuBody=function(){var d=a(this,"createMenuBody");
var b=(this.m_numColumns*this.m_imageWidth)+((this.m_numColumns+1)*4);
d.resize(b);
var c=new ui.ImagePaletteMenuItem(this.m_imageWidth,this.m_imageHeight);
c.create(this.getId()+"-images",d.m_element,"",this.m_images,this.m_numRows,this.m_numColumns);
d.appendMenuItem(c);
return d
}
});
Class("ui.ImagePaletteMenuItem",ui.menuItem,function(a){this.initialize=function(b,c){a(this,"initialize");
this.m_iconWidth=b;
this.m_iconHeight=c;
this.m_descriptionHeight=13;
this.m_rows=0;
this.m_columns=0;
this.m_icons=[];
this.m_iconSpacing=3
};
this.create=function(h,f,g,d,e,c,b){a(this,"create",[h,f,null,g,null]);
this.m_rows=e;
this.m_columns=c;
this.m_icons=d;
this.m_description=b||"";
this.m_highlightColor=null;
this.m_width=(this.m_iconWidth*this.m_columns)+(this.m_iconSpacing*(this.m_columns+1));
this.m_height=(this.m_iconHeight*this.m_rows)+(this.m_iconSpacing*(this.m_rows+1))+2;
if(this.m_description){this.m_height+=this.m_descriptionHeight
}if(f&&this.constructor==ui.ImagePaletteMenuItem){this.createDOMNode(f)
}};
this.createDOMNode=function(c){this.m_win=gWin(c);
if(!this.m_element){this.m_element=this.m_win.document.createElement("table");
this.m_element.ptr=this;
c.appendChild(this.m_element)
}this.addClassName("uiIconMenuItem");
var g=this.m_win.document.createElement("tbody");
this.m_element.appendChild(g);
if(this.m_description){var n=this.m_win.document.createElement("tr");
var k=this.m_win.document.createElement("td");
addClassName(k,"itemDescription");
k.colSpan=this.m_columns;
k.appendChild(setText(this.m_win.document.createElement("div"),this.m_description));
n.appendChild(k);
g.appendChild(n)
}for(var h=0,m=0;
h<this.m_rows;
h++){var l=this.m_win.document.createElement("tr");
for(var e=0;
e<this.m_columns;
e++){var o=this.m_icons[m];
if(!o){break
}var d=this.m_win.document.createElement("td");
var f=this.m_win.document.createElement("img");
f.src=o;
f.width=this.m_iconWidth;
f.height=this.m_iconHeight;
var b=d.appendChild(this.m_win.document.createElement("div"));
b.appendChild(f);
l.appendChild(d);
m++
}g.appendChild(l)
}};
this.unselect=function(){a(this,"unselect");
var c=this.m_element.getElementsByTagName("td");
for(var b=0,d;
(d=c[b]);
b++){removeClassName(d,"selected")
}};
this.aquireTarget=function(b){var c=b.target||b.srcElement;
while(c&&c!=this.m_element&&c.nodeName!="TD"){c=c.parentNode
}return(c&&c.nodeName=="TD"?c:null)
};
this.onMouseOver=function(b){if(!a(this,"onMouseOver")){return
}var c=this.aquireTarget(b);
if(c){addClassName(c,"selected")
}};
this.onMouseOut=function(b){if(!a(this,"onMouseOut")){return
}var c=this.aquireTarget(b);
if(c){removeClassName(c,"selected")
}};
this.onMouseUp=function(d,c){var g=this.aquireTarget(d);
if(!g){return
}var b=g.firstChild.firstChild;
var f=b.src.replace(/^http:\/\/icons\.meebo\.com\/stock\//,"");
removeClassName(g,"selected");
this.m_element.style.backgroundColor="";
this.m_parent.onParentMouseUp(this.m_preImg.src,this.m_text,f);
if(d){ui.setEventHandled(d)
}return false
}
});
Class("ui.IconChooser",ui.ImageChooser,function(a){this.initialize=function(e,b){var d=[];
for(var c=0;
c<gDefaultBuddyIcons.length;
c++){d[c]="http://icons.meebo.com/stock/"+gDefaultBuddyIcons[c]
}a(this,"initialize",[e,b,48,48,3,d]);
this.m_control="uiIconChooser";
this.m_recentIconsItem=null;
this.m_clearIconItem=null;
this.m_bDelayMenu=true;
this.m_hasDisabledImage=false
};
this.createDOMNode=function(){a(this,"createDOMNode");
this.m_dropArrow=this.m_win.document.createElement("div");
addClassName(this.m_dropArrow,"dropArrow");
this.m_element.appendChild(this.m_dropArrow);
ui.connectEvent(this.m_dropArrow,"mouseover",this,"onMouseOver",true,true);
ui.connectEvent(this.m_dropArrow,"mouseout",this,"onMouseOut",true,true);
ui.connectEvent(this.m_dropArrow,"mousedown",this,"onMouseDown",true,true);
ui.connectEvent(this.m_dropArrow,"mouseup",this,"onMouseUp",true,true)
};
this.onMouseOver=function(){if(this.m_isDisabled){return
}a(this,"onMouseOver",arguments);
addClassName(this.m_dropArrow,"dropArrow-hot")
};
this.onMouseOut=function(){a(this,"onMouseOut",arguments);
removeClassName(this.m_dropArrow,"dropArrow-hot")
};
this.setDisabled=function(b){a(this,"setDisabled",arguments);
toggleClassName(this.m_dropArrow,b,"dropArrow-disabled")
};
this.createMenuBody=function(){var c=a(this,"createMenuBody");
this.addRecentIcons(c);
this.m_clearIconItem=new ui.menuItem();
this.m_clearIconItem.create(this.getId()+"-clearIconItem",c.m_element,null,"Clear Icon",null,this.m_menuWidth,"clear");
c.appendMenuItem(this.m_clearIconItem);
var b=new ui.FileUploadMenuItem();
b.m_width=this.m_menuWidth;
b.create(this.getId()+"-fileUploadItem",c.m_element,null,"Custom Icon...");
c.appendMenuItem(b)
};
this.addRecentIcons=function(c){if(this.m_recentIconsItem){return
}var b=gPrefs.getLongPref("buddyIcons");
if(b&&b.length){this.m_recentIconsItem=new ui.ImagePaletteMenuItem(48,48);
this.m_recentIconsItem.create(this.getId()+"-recentIconsItem",c.m_element,"Recent Icons",b,Math.ceil(b.length/this.m_numColumns),this.m_numColumns,gLang.recentIcons);
c.appendMenuItem(this.m_recentIconsItem,this.m_clearIconItem||null)
}};
this.onMouseUp=function(b){if(gLogon.getMeeboUser()){a(this,"onMouseUp",arguments)
}else{this.m_tooltip=this.m_tooltip||new meeboApp.AccountUpsellTooltip(gLang.BuddyIcon,gLang.youNeedMeeboAccount);
this.m_tooltip.showAt(this.getElement(),this.m_tooltip.BELOW);
ui.setEventHandled(b)
}};
this.showMenu=function(b){this.addRecentIcons(this.m_menuBody);
a(this,"showMenu",arguments)
};
this.closeMenu=function(){a(this,"closeMenu");
if(this.m_recentIconsItem){this.m_menuBody.removeMenuItem(this.m_recentIconsItem.getId());
this.m_recentIconsItem=null
}}
});
Class("ui.FileUploadMenuItem",ui.menuItem,function(a){this.initialize=function(){a(this,"initialize");
this.m_clipDiv;
this.m_fileInput
};
this.create=function(e,d,b,c){a(this,"create",arguments);
if(d&&this.constructor==ui.FileUploadMenuItem){this.createDOMNode(d)
}};
this.createDOMNode=function(d){a(this,"createDOMNode",arguments);
this.m_element.style.overflow="hidden";
this.m_element.style.position="relative";
var b=this.m_win.document.createElement("div");
b.style.position="absolute";
b.style.overflow="hidden";
if(ui.isSafari){b.style.width=b.style.height="0";
b.style.left=b.style.top="-999px"
}else{b.style.width=this.m_width+"px";
b.style.height=this.m_height+"px";
b.style.left=b.style.top="0";
gEffects.setOpacity(b,0)
}this.m_clipDiv=b;
var c=this.createFileInput();
this.m_element.appendChild(b)
};
this.createFileInput=function(){if(this.m_fileInput&&this.m_fileInput.parentNode==this.m_clipDiv){this.m_clipDiv.removeChild(this.m_fileInput)
}var b=this.m_win.document.createElement("input");
this.m_fileInput=b;
b.type="file";
b.name="file";
b.accept="image/jpeg,image/gif,image/png";
ui.connectEvent(b,"change",this,"submitIcon",true,true);
b.style.fontSize="60pt";
b.style.position="absolute";
b.style.top=b.style.right="0";
this.m_clipDiv.appendChild(b);
return b
};
this.onMouseUp=function(c,b){if(ui.isSafari){this.m_fileInput.click()
}else{}};
this.isFileExtensionAllowed=function(){if(!ui.isWin){return true
}var b=this.m_fileInput.value;
if(b&&b.lastIndexOf(".")!=-1){var c=b.substring(1+b.lastIndexOf(".")).toLowerCase();
return(c=="jpg"||c=="gif"||c=="png"||c=="bmp"||c=="jpeg")
}return true
};
this.submitIcon=function(){var b=null;
if(this.isFileExtensionAllowed()){b=this.m_fileInput;
this.createFileInput()
}else{gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.buddyIconErrorHeader},gLang.buddyIconErrorExt)
}this.m_parent.onParentMouseUp(this.m_preImg.src,this.m_text,b)
}
});
Class("ui.Form",ui.element,function(a){this.initialize=function(b,c){c=c||{};
var d=this.m_win.document.createElement("div");
addClassName(d,"uiForm");
a(this,"initialize",[d]);
b.appendChild(d);
this.m_handler=c.handler;
this.m_items=[];
if(c.items){this.addItems(c.items)
}};
this.addItems=function(b){for(var c=0;
c<b.length;
c++){this.addItem(b[c])
}};
this.addItem=function(b){if(b){this.m_items.push(b)
}};
this.initContent=function(){a(this,"initialize");
for(var b=0;
b<this.m_items.length;
b++){this.createField(this.m_items[b])
}};
this.createField=function(f){if(f.type=="radio"){var h=this.createWrapper("options field","",f.label);
for(var e=0;
e<f.options.length;
e++){var g="radio"+getUniqueId();
var d=this.m_win.document.createElement("span");
d.innerHTML='<input type="radio" name="'+f.name+'" value="'+f.options[e]+'" id="'+g+'"></input>';
var b=this.createWrapper("radio",f.options[e],null,g);
b.insertBefore(d,b.firstChild);
h.appendChild(b)
}}else{if(f.type=="text"){var h=this.createWrapper("text field",f.name,f.label);
var c=this.m_win.document.createElement("input");
c.type="text";
h.appendChild(c);
h.name=f.name
}else{if(f.type=="submitlink"){var h=this.m_win.document.createElement("div");
addClassName(h,"submitlink field");
setText(h,f.text);
ui.connectEvent(h,"click",this,"onSubmit");
ui.attachEvent(h,"mouseover",hitch(this.m_win,"addClassName",h,"underline"));
ui.attachEvent(h,"mouseout",hitch(this.m_win,"removeClassName",h,"underline"))
}}}f.m_element=h;
this.m_element.appendChild(h)
};
this.createWrapper=function(c,d,e,g){var f=this.m_win.document.createElement("div");
addClassName(f,c);
var b=escapeHTML(e?e:d);
f.innerHTML='<label for="'+g+'">'+b+"</label>";
return f
};
this.onSubmit=function(){var d={};
var e=true;
for(var b=0;
b<this.m_items.length;
b++){var c=this.getItemValue(this.m_items[b]);
if(this.m_items[b].verify&&!this.m_items[b].verify(c)){addClassName(this.m_items[b].m_element,"invalid");
e=false
}else{removeClassName(this.m_items[b].m_element,"invalid")
}d[this.m_items[b].name]=c
}if(e){this.m_handler(d)
}};
this.getItemValue=function(d){var c=d.m_element.getElementsByTagName("input");
if(d.type=="radio"){for(var b=0;
b<c.length;
b++){if(c[b].checked){return c[b].value
}}}else{if(d.type=="text"){return c[0].value
}}return
}
});
Class("ui.WizardPage",ui.element,function(a){this.initialize=function(b){a(this,"initialize");
this.m_parent=b
};
this.getElement=function(){var c=!this.m_element;
var b=this.m_element||(this.m_element=$(String(this.getId())));
if(c){this.initContent()
}return b
};
this.getBody=function(){return this.getElement()
};
this.setId=function(b){this.m_id=b
};
this.showPage=function(b){this.getBody().style.display=b?"block":"none"
};
this.isVisible=function(){return this.getBody().style.display=="block"
};
this.getTemplate=function(){return""
};
this.initContent=function(){};
this.getValues=function(){return{}
};
this.validateInputs=function(b){return true
}
});
Class("ui.WizardDlg",ui.element,function(a){this.initialize=function(){a(this,"initialize");
this.m_okText=gLang.okBtn;
this.m_pages=[];
this.m_visiblePage=0
};
this.setOkText=function(b){this.m_okText=b
};
this.addPage=function(b){this.m_pages.push(b)
};
this.getPages=function(){return this.m_pages
};
this.getCurrentPage=function(){return this.m_visiblePage
};
this.initContent=function(){this.initButtons();
this.showPage(0);
return true
};
this.getTemplate=function(){var e=this.getId();
var b=[];
for(var d=0;
d<this.m_pages.length;
d++){this.m_pages[d].setId(this.getPageId(d))
}for(var d=0;
d<this.m_pages.length;
d++){b.push('<div id="'+this.getPageId(d)+'" class="createGroupChatPage">'+this.m_pages[d].getTemplate()+"</div>")
}var c='</div><div id="'+e+'-buttonContainer" 			style="position: absolute; bottom: 0px; right: 8px;"></div>';
return b.join("")+c
};
this.getPageId=function(b){return this.getId()+"-page"+b
};
this.initButtons=function(){var c=this.getId();
var b=getPartFromElement(this.m_element,c+"-buttonContainer");
this.m_backBtn=new ui.button(c+"-backbutton",gLang.backTT).create(this.m_win).addClassName("createBuddyListBackBtn");
this.m_backBtn.addOnMouseUp(hitch(this,"onBack"));
b.appendChild(this.m_backBtn.getElement());
this.m_nextBtn=new ui.button(c+"-nextbutton",gLang.nextTT).create(this.m_win);
this.m_nextBtn.addOnMouseUp(hitch(this,"onNext"));
b.appendChild(this.m_nextBtn.getElement())
};
this.showPage=function(b){this.m_backBtn.setDisplay(Boolean(b));
if(b!=this.m_pages.length-1){this.m_nextBtn.setText(gLang.nextTT)
}else{this.m_nextBtn.setText(this.m_okText)
}this.m_pages[this.m_visiblePage].showPage(false);
this.m_pages[b].showPage(true);
this.m_visiblePage=b
};
this.onBack=function(){if(!this.m_visiblePage){return
}this.showPage(this.m_visiblePage-1)
};
this.onNext=function(){var b=this.m_pages[this.m_visiblePage].getValues();
if(this.m_pages[this.m_visiblePage].validateInputs(b)){if(this.m_visiblePage==this.m_pages.length-1){this.onOK()
}else{this.showPage(this.m_visiblePage+1)
}}};
this.onOK=function(){}
});
Class("ui.TrackingPixel",function(){this.initialize=function(c,a,f){c=c||{};
keyValues=[];
for(var e in c){keyValues.push(e+"="+encodeURIComponent(c[e]))
}if(!f){keyValues.push("tm="+Math.floor(Math.random()*1000000))
}if(isArray(a)){for(var d=0,b;
(b=a[d]);
d++){this.createPixel(b,keyValues)
}}else{this.createPixel(a,keyValues)
}};
this.createPixel=function(a,c){a=a||"http://rd.meebo.com/b.gif";
if(((ui.isIE||ui.isFirefox)&&document.location.protocol=="https:")){a=a.replace("http:","https:")
}var b=document.createElement("img");
b.style.position="absolute";
b.style.top="-1000px";
b.style.left="-1000px";
b.onload=function(){this.onload=null;
this.parentNode.removeChild(this)
};
b.src=a+(c.length?("?"+c.join("&")):"");
document.body.appendChild(b)
}
});
Class("ui.Lightbox",ui.element,function(a){this.m_width=520;
this.m_height=300;
this.initialize=function(){this.createHandler("Hide")
};
this.initContent=function(){this.m_element=this.m_win.document.createElement("div");
this.m_content=this.m_win.document.createElement("div");
addClassName(this.m_element,"uiLightbox");
addClassName(this.m_content,"content");
this.resize();
this.createOverlayBackground();
this.createContent();
this.updatePosition();
this.m_win.document.body.appendChild(this.m_element)
};
this.resize=function(){this.m_content.style.height=this.m_height+"px";
this.m_content.style.width=this.m_width+"px"
};
this.createOverlayBackground=function(){var b=this.m_win.document.createElement("div");
addClassName(b,"overlayBackground");
gEffects.setOpacity(b,80);
this.m_element.appendChild(b)
};
this.createContent=function(){this.m_content=this.m_win.document.createElement("div");
this.m_element.appendChild(this.m_content)
};
this.updatePosition=function(){var b=getElementPosition(this.m_win.document.body);
this.m_content.style.top=Math.floor(b.h/2-this.m_height/2)+"px";
this.m_content.style.left=Math.floor(b.w/2-this.m_width/2)+"px";
this.setStyle("zIndex",gWindowMgr.getTopZIndex())
};
this.hide=function(){this.m_element.style.display="none";
this.onHide()
}
});
Class("ui.Wallpaper",ui.element,function(){this.initialize=function(a,d){this.setConsoleGradient(Boolean(a)&&!d);
if(ui.isSafari4||ui.isSafari3||ui.isFirefox3||ui.isOpera9||ui.isChrome){var c=$("BackgroundImage");
if(!c){c=document.createElement("img");
c.id="BackgroundImage";
var b=c.style;
b.position="absolute";
b.left=b.right="0px";
b.width="100%";
b.height="auto";
b.maxWidth="2056px";
b.minWidth="1024px";
b.display="none"
}document.body.insertBefore(c,document.body.firstChild);
c.style.display=a?"block":"none";
c.src=a?a:""
}else{document.body.style.backgroundImage=a?"url("+a+")":"";
document.body.style.backgroundRepeat=a?"repeat":"repeat-x"
}};
this.setConsoleGradient=function(a){var b=$("ConsoleGradient");
if(!b){b=document.createElement("div");
b.id="ConsoleGradient";
addClassName(b,"ConsoleBlackGradient")
}document.body.insertBefore(b,document.body.firstChild);
b.style.display=a?"block":"none"
}
});
Class("ui.Tooltip",ui.Element,function(a){this.m_fadeInDuration=300;
this.m_fadeOutDuration=100;
this.m_arrowOffset=26;
this.ON_RIGHT="onRight";
this.BELOW="below";
this.createContent=function(){this.addClassName("Tooltip");
var b=this.m_element.appendChild(this.m_win.document.createElement("table"));
this.m_tbody=b.appendChild(this.m_win.document.createElement("tbody"));
this.createBorderRow("top");
this.createContentRow();
this.createBorderRow("bottom");
this.createCloseButton();
this.createArrow();
this.setOpacity(0)
};
this.createBorderRow=function(c){var b=this.m_tbody.appendChild(this.m_win.document.createElement("tr"));
addClassName(b,c);
var f=b.insertCell(-1);
var e=b.insertCell(-1);
var d=b.insertCell(-1);
addClassName(f,"left");
addClassName(e,"middle");
addClassName(d,"right")
};
this.createContentRow=function(){var d=this.m_tbody.appendChild(this.m_win.document.createElement("tr"));
var e=d.insertCell(-1);
var c=d.insertCell(-1);
var b=d.insertCell(-1);
addClassName(d,"contentRow");
addClassName(e,"left");
addClassName(c,"middle");
addClassName(b,"right");
this.m_content=c.appendChild(this.m_win.document.createElement("div"));
addClassName(this.m_content,"content")
};
this.createCloseButton=function(){var c=this.m_content.appendChild(this.m_win.document.createElement("div"));
addClassName(c,"close");
var b=hitch(this,function(d){ui.setEventHandled(d);
addClassName(c,"close-down")
});
ui.connectEvent(c,"mouseover",this.m_win,"addClassName",false,true,"close-hot");
ui.connectEvent(c,"mouseout",this.m_win,"removeClassNames",false,true,"close-hot","close-down");
ui.connectEvent(c,"click",this,"hide");
ui.connectEvent(c,"mouseup",this.m_win,"removeClassName",false,true,"close-down");
ui.connectEvent(c,"mousedown",this,b,true)
};
this.createArrow=function(){this.m_arrow=this.m_element.appendChild(this.m_win.document.createElement("div"));
addClassName(this.m_arrow,"arrow")
};
this.getContent=function(){return this.m_content
};
this.setArrowOffset=function(b){this.m_arrowOffset=b
};
this.showAt=function(d,e){this.create(this.m_win||window);
this.m_element.style.visibility="hidden";
this.setDisplay(true);
this.m_win.document.body.appendChild(this.m_element);
this.setPositionClassName(e);
var b=posWithRespectTo(d);
switch(e){case this.BELOW:var c=b.x+b.w/2;
this.m_arrow.style.top=0;
this.m_arrow.style.left=Math.floor((this.m_arrowOffset-this.m_arrow.offsetWidth/2))+"px";
this.m_element.style.top=(b.y+b.h)+"px";
this.m_element.style.left=(c-this.m_arrowOffset)+"px";
break;
case this.ON_RIGHT:default:var c=b.y+b.h/2;
this.m_arrow.style.left=0;
this.m_arrow.style.top=Math.floor((this.m_arrowOffset-this.m_arrow.offsetHeight/2))+"px";
this.m_element.style.left=(b.x+b.w)+"px";
this.m_element.style.top=(c-this.m_arrowOffset)+"px";
break
}this.m_element.style.visibility="visible";
this.checkWindowOverflow(e);
this.show()
};
this.setPositionClassName=function(b){this.removeClassName("Tooltip-"+this.ON_RIGHT);
this.removeClassName("Tooltip-"+this.BELOW);
this.addClassName("Tooltip-"+b)
};
this.getAnimation=function(){if(this.m_animation){return this.m_animation
}this.m_animation=new ui.Animation();
this.m_animation.addSubject(hitch(this,"animate"));
return this.m_animation
};
this.animate=function(b){this.setOpacity(Math.floor(b*100))
};
this.show=function(){if(ui.Tooltip.currentTooltip&&ui.Tooltip.currentTooltip!=this){ui.Tooltip.currentTooltip.hide()
}ui.Tooltip.currentTooltip=this;
this.m_element.style.zIndex=gWindowMgr.getNextZIndex();
this.setDisplay(true);
if(!ui.isIE){var b=this.getAnimation();
b.setDuration(this.m_fadeInDuration);
b.seekTo(1)
}this.connectGlobalEvents();
gPubSub.subscribe("meebo.EventMgr::changeState",this,"onEventMgrChangeState")
};
this.hide=function(){if(ui.isIE){this.setOpacity(0)
}else{var b=this.getAnimation();
b.setDuration(this.m_fadeOutDuration);
b.seekTo(0)
}this.disconnectGlobalEvents();
gPubSub.unsubscribe("meebo.EventMgr::changeState",this)
};
this.setOpacity=function(b){if(b==0){this.setDisplay(false);
removeElement(this.m_element);
if(ui.Tooltip.currentTooltip==this){ui.Tooltip.currentTooltip=null
}}if(ui.isIE){return
}gEffects.setOpacity(this.m_element,b)
};
this.checkWindowOverflow=function(c){var h=9;
var g=ui.getClientRect();
var k=posWithRespectTo(this.m_element);
var f=k.x+k.w+h;
if(f>g.w){var e=g.w-k.w-h;
this.m_element.style.left=e+"px";
if(c==this.BELOW){this.m_arrow.style.left=parseInt(this.m_arrow.style.left)-(e-k.x)+"px"
}}var d=k.y+k.h+h;
if(d>g.h){var b=g.h-k.h-h;
this.m_element.style.top=b+"px";
if(c==this.ON_RIGHT){this.m_arrow.style.top=parseInt(this.m_arrow.style.top)-(b-k.x)+"px"
}}if(k.x<h){this.m_element.style.left=h+"px"
}if(k.y<h){this.m_element.style.top=h+"px"
}};
this.connectGlobalEvents=function(){if(!this.m_isSticky){ui.connectGlobalEvent(gDoc(this.m_win),"mousedown",hitch(this,"onGlobalMouseAction"))
}};
this.disconnectGlobalEvents=function(){ui.disconnectGlobalEvent(gDoc(this.m_win),"mousedown")
};
this.onEventMgrChangeState=function(d,b,e,c){if(e!="im"){this.hide()
}};
this.onGlobalMouseAction=function(b){if(isCursorInElement(this.m_element,b)){return true
}this.hide()
};
this.setSticky=function(b){if(this.m_isSticky==b){return
}this.m_isSticky=b;
toggleClassName(this.m_element,b,"Tooltip-sticky");
if(b){this.disconnectGlobalEvents()
}else{this.connectGlobalEvents()
}}
});
ui.Tooltip.currentTooltip=null;
var meeboApp={};
meeboApp.setupRemote=function(){var h=["lgvtk`gq,amo","emkleml,amo","qajogfng{,amo","qgcfpktg,lgv"];
var c=document.location.hostname;
for(var a=0;
a<h.length;
a++){var k=de(h[a]);
var b=k.length+1;
if(c.length<=b){continue
}var g=c.length-b;
var d=c.substr(g).toLowerCase();
if(d=="."+k){document.domain=k;
gRemote.domain=document.domain;
gRemote.setup=true;
if(parent){try{if(parent.meeboConnected){parent.meeboConnected()
}}catch(f){}}break
}}};
meeboApp.dontShowWarning=false;
meeboApp.addNavigateAwayWarnings=function(){window.onbeforeunload=function(b){b=b||window.event;
gPrefs.doPreferenceSync();
if(ui.isIE&&window.__flash_unloadHandler&&window.onunload==window.__flash_unloadHandler){window.onunload=null
}if(b&&gBuddyListDlg&&!gIsGuestGroupChat&&!meeboApp.dontShowWarning&&gEventMgr&&!gEventMgr.isClientAttached("trayicon")&&!gEventMgr.isClientAttached("cim-imbar")&&gLogon&&((gLogon.getLogons({online:true}).length>0)||(gLogon.getLogons({state:"pending"}).length>0)||(gLogon.getLogons({state:"signingoff"}).length>0))){var c=(!meeboApp.isCIMPopout()?gLang.navigateAway:sprintf(gLang.popoutNavigateAway,meeboApp.getPartnerLogon().getNetwork().getName()));
if(ui.isIE){b.returnValue=c
}return c
}};
var a=function(f){gWindowMgr.closeNonIMWindows();
if(gBuddyListDlg&&gBuddyListDlg.isPoppedOut()){gBuddyListDlg.closeWindow()
}gWindowMgr.updateOfflineWindows();
ui.cleanUp();
if(meeboApp.isCIMPopout()){gUIState.set("popout",{isPoppedOut:false},false,true)
}else{if(gEventMgr.getState() in arrayToObject(["im","reconnecting"])){gPrefs.doPreferenceSync(true);
gNetworkMgr.doRequest("detach",{},null,true)
}}if(ui.isIE){var b=document.getElementsByTagName("OBJECT");
for(var c=0;
c<b.length;
c++){var d=b[c];
for(var g in d){try{if(typeof(d[g])=="function"){d[g]=null
}}catch(f){}}d.style.display="none"
}}};
if(ui.isIE){window.attachEvent("onunload",a)
}else{window.onunload=a
}};
meeboApp.serveBigNotifierUpsell=function(){if(ui.isWin&&!this.m_bigNotifierUpsold&&!gEventMgr.isClientAttached("trayicon")){this.m_bigNotifierUpsold=true;
var a=new meeboApp.ConsoleExtensionNotifier();
gConsoleMgr.getMainPage().getMainContainer().addExtension(a);
gPubSub.subscribe("meebo.EventMgr::clientAttach",this,function(d,b,c){if(c.clientType=="trayicon"){gConsoleMgr.getMainPage().getMainContainer().removeExtension(a)
}})
}};
meeboApp.upsellTrayNotifier=function(){if(gIsGuestGroupChat||gPrefs.getPref("noNotifierThanks")){return
}util.storage.load("noNotifierThanks",function(a){if(!a){meeboApp.serveBigNotifierUpsell()
}})
};
meeboApp.onEventMgrChangeState=function(c,a,d,b){if(d!="im"&&d!="done"){return
}if(d=="done"){meeboApp.m_seenIM={}
}if(d=="im"){if(util.cookie.load("attachKey")!=gIGClient.getSessionKey()){util.cookie.save("attachKey",gIGClient.getSessionKey())
}if(b=="connecting"||b=="logon"){removeElement($("frontPageStyle"));
document.body.style.overflow="hidden";
ui.connectEvent(document,"scroll",meeboApp,"onScroll",true,true);
if(!meeboApp.isPopout()&&!gIsGuestGroupChat){gSecurePlatform.sendSessionKey(gIGClient.getSessionKey())
}if((!gLogon.hasMeeboAccount()||gConsoleMgr.getMainPage().getRegistrationMode())&&window.gTakeover){gConsoleMgr.getMainPage().setTakeoverWallpaper();
meeboApp.upsellTrayNotifier()
}else{gPubSub.subscribe("meebo.Prefs::receivePrefs",this,function(f,e,g){if(!("meeboSkin" in g)&&!("enableWallpaper" in g)){gConsoleMgr.getMainPage().setTakeoverWallpaper()
}meeboApp.upsellTrayNotifier();
gPubSub.unsubscribe("meebo.Prefs::receivePrefs",this)
})
}}if(b=="reconnecting"&&!gIsGuestGroupChat){gSecurePlatform.sendSessionKey(gIGClient.getSessionKey())
}gWindowMgr.createBuddyWindow(gLang.buddylist);
if(!gIsGuestGroupChat&&!gWindows["email-import"]&&!gWindows.upsell&&b=="connecting"&&!gConsoleMgr.getMainPage().getRegistrationMode()&&(!meeboApp.isPopout()||util.query.getHashVariable(util.query.SHOW_BLOG)=="true")){gWindowMgr.createWelcomeWindow()
}if(gWait){gWait.hideWait()
}if(b=="connecting"||b=="logon"){if(!gIsGuestGroupChat){window.setTimeout(function(){gApplicationPlatform.openBridge(document.body);
if(!ui.isIE){gSecurePlatform.openBridge(document.body)
}},500)
}}}meeboApp.updateStatusPanelIcon()
};
meeboApp.href=document.location.href;
meeboApp.handleIMNotifications=function(w,buddy,msg,chat,senderString){var isReopen=!w.isVisible();
if(isReopen){gWindowMgr.reopenIMWindow(w)
}senderString=senderString||buddy.getAlias();
if(w.m_state=="min"&&!w.isMeeboGroupChat()){w.minimizeWindow(w.getElement())
}if(chat&&w){senderString=w.getWindowCaption()+" - "+senderString
}gBrowser.setFlash(w.m_win,senderString,unescapeHTML(removeHTML(msg)));
var shouldShowNotifier=!w.m_win.m_focus;
if(!w.isActive()||(w.isPoppedOut()&&!w.m_win.m_focus)){w.startFlashWindow();
if(!chat){shouldShowNotifier=true;
gBuddyListDlg.showBuddyMessageFeedback(buddy,true,msg)
}}else{if(buddy.getType()=="buddy"&&w.m_win.m_focus){buddy.resetUnreadMessageCount()
}}if(!chat||chat.getType()!="chat"){if(!shouldShowNotifier||meeboApp.hasTrayNotifier()){}else{if(ui.isFluid||ui.isPrism){meeboApp.ssbDisplayNotification(senderString,removeHTML(msg),buddy.getIconURL(),"message",w)
}else{if(meeboApp.util.hasMeeboExtension()){var callback=hitch(this,function(buddy){var w=gWindowMgr.createIMWindow(buddy,true);
if(!w||!w.isPoppedOut||!w.isPoppedOut()){MeeboExtension.showMeeboTab()
}},buddy);
MeeboExtension.showNotification(buddy.getAlias(),removeHTML(msg),buddy.getIconURL(),"message",callback);
if(w){MeeboExtension.showBlink(w.m_win)
}meeboApp.updateStatusPanelIcon()
}}}}if(gPrefs.getPref("audioReceive")||(!gPrefs.getPref("audioSend")&&!gPrefs.getPref("audioReceive")&&!gSounds.isMuted())){gSounds.playSample(w.isMeeboGroupChat()?"room":"receive")
}if(gRemote&&gRemote.setup&&gRemote.callback){if(parent){var mO={msg:removeHTML(msg),sender:buddy.getName(),protocol:buddy.getNetwork()};
try{if(typeof gRemote.callback=="string"){eval("parent."+gRemote.callback+"(mO);")
}else{if(typeof gRemote.callback=="function"){gRemote.callback(mO)
}}}catch(e){}}}return isReopen
};
meeboApp.m_seenIM=[];
meeboApp.dispatchIM=function(a,q,l,c,s,k,h,o,b){var n=gWindowMgr.getConvWindow(s||l);
if(!n){gWindowMgr.createIMWindow(s||l,false,false,callee.call(this,arguments));
return
}if(isNumber(b)){if(meeboApp.m_seenIM[b]){return
}meeboApp.m_seenIM[b]=true
}var m=(q=="meebo.EventMgr::sentIM");
var e=s&&l.getPresence(s);
var d=(m?l.getLogon():(e||l)).getAlias();
if(!m){var g=this.handleIMNotifications(n,l,c,s,d)
}this.moveWindowFromUnderGallery(n);
var p=n.m_trees[l.getId()];
var f=n.isGroupChat()&&p&&p.getColor();
n.addHistoryIM(d,c,!m,false,false,f,g,k,h,o);
if(l.updateActivityTime){l.updateActivityTime()
}};
meeboApp.moveWindowFromUnderGallery=function(a){var c=a.getWindowPos();
if(gGallery.isMaximized()){var b=parseInt(getCSSProp(gGallery.getElement(),"z-index"),10)||0;
galleryPos=gGallery.getPos();
if(c.y+30>galleryPos.y&&c.z<b){c.y=galleryPos.y-30
}a.setWindowPos(-1,c.y,-1,-1)
}};
meeboApp.updateStatusPanelIcon=function(){if(meeboApp.util.hasMeeboExtension()){if(gEventMgr&&gEventMgr.getState()=="im"){MeeboExtension.setStatus("online");
if(gBuddyListDlg){var a=gBuddyListDlg.getTotalUnreadMessageCount()
}if(a){MeeboExtension.setStatus("unread",a)
}else{if(gBuddyListDlg&&gBuddyListDlg.m_statusMenu){if(gBuddyListDlg.m_statusMenu.getItemValue()=="available"){MeeboExtension.setStatus("online")
}else{MeeboExtension.setStatus("away")
}}}}else{if(gEventMgr&&gEventMgr.inNetworkInterrupt()){MeeboExtension.setStatus("error")
}else{MeeboExtension.setStatus("offline")
}}}};
meeboApp.joinRoom=function(b,m,e,k,l){if(typeof b=="string"){var d=b;
b=gBuddyList.addRoom(d,null,gLogon.getMeeboMeLogon())
}else{d=b.getChatName()
}if(gIsGuestGroupChat&&gNotice.m_flashEnabled&&(gNotice.onNotice(d)||gNotice.isLockedOut())){gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.bannedTitle},gLang.bannedFromRoom);
if(l){l(null,false,null)
}return
}b.m_isLeaving=false;
if(m){b.setPassword(m)
}var h=true;
var g=gWindowMgr.getConvWindow(b);
if(!g){var c=gWindowMgr.createIMWindow(b,true)
}else{if(!g.m_isShowingPasswordPrompt){gWindowMgr.createIMWindow(b,true);
if(!g.isOffline()){h=false
}else{g.clearHistory();
g.clearBuddyList();
g.clearMediaList();
g.m_bMediaRequested=false
}}}var f=function(o,n,p){if(l){l(o,n,p)
}if(!n||!o){if(c){c._("showOverlayMessage",gLang.disabledRoom)
}else{if(g){g.showOverlayMessage(gLang.disabledRoom)
}}}};
if(h){var a=gPrefs.getRoomPref(d,"nick")||b.getLogin().getAlias();
runInMainContext(gNetworkMgr,gNetworkMgr.requestJoinRoom,f,d,a,m,e,k)
}return b
};
meeboApp.onChatChangeChatId=function(k,h,c){if(!c){return
}var d=k.getType()=="protocolchat"&&k.getBuddyParent();
var f=gWindowMgr.getConvWindow(k);
if(!f){var b=ui.deferredDlg.getWndOpening(getIMId(d,k.getLogin()));
var e=argsToArray(arguments);
var a=callee;
var g=hitch(this,function(l){a.call(this,e);
l.onChatChangeChatId(k,h,c)
});
if(b){b.addBoth(g)
}else{if(k.constructor==meebo.ApplicationRoom){meeboApp.Application.onAppLoaded(k)
}else{if(k.getType()=="chat"){k.setLastMsg()
}}gWindowMgr.createIMWindow(k,true,false,g)
}}else{if(k.constructor==meebo.ApplicationRoom){if(k.getAbandoned()){if(k&&k.getChatId()){gNetworkMgr.requestChatAction(null,"l",null,k,k.getChatId(),null);
gWindowMgr.unregisterGroupChat(getGroupChatId(k.getProtocol(),k.getUser(),k.getChatId()))
}f.setApplicationRoom(null);
f.onAbandonedApp();
return
}f.setApplicationRoom(k);
k.getApplication().join(k.getChatName())
}else{if(k.getType()=="protocolchat"){f.setImObject(k)
}}}};
meeboApp.onChatInvite=function(b,m,f,o,a,c,k){var n=gBuddyList.getRoomByName(a);
if(m=="meebo.EventMgr::roomInvite"){var h=hitch(this,function(q,p){if(q){n=meeboApp.joinRoom(n||a,k,f.getUser(),f.getProtocol());
n.m_shouldAddToBuddylist=p
}gNetworkMgr.doUILog("roomsinvite",f.getNetwork(),q?"1":"0",true)
});
var e=gLogon.getMeeboMeLogon();
var l=o.length>1?sprintf(gLang.inviteToChatWithMessage,f.getName(),f.getUser(),c,o):sprintf(gLang.inviteToChat,f.getName(),f.getUser(),c);
gWindowMgr.createAcceptDenyDlg({id:getUniqueId()+"-accept",caption:gLang.roomInvite},{buddy:a,protocol:gNetworks.meebome.getProtocol(),logon:e,message:l,joinButtonText:gLang.joinRoom,joinAndAddButtonText:(!n||!n.isOnlist())&&(gLogon.getMeeboUser()?gLang.joinRoomAndAdd:"")},h)
}else{var g=gWindowMgr.getConvWindow(f);
if(!g){gWindowMgr.createIMWindow(f,false,false,callee.call(this,arguments));
return
}var d=this.handleIMNotifications(g,f,o);
g.addAppRoomInvite(o,a,d)
}};
meeboApp.onAppRegister=function(b,a,e,d){var f=gWindowMgr.getConvWindow(e);
if(!f){var c=hitch(this,function(g){g.setApplicationRoom(e);
meeboApp.onAppRegister(b,a,e,d)
});
gWindowMgr.createIMWindow(e,true,false,c);
return
}e.logLoadTime("tojoin");
meeboApp.platform.createAppInstance(e.getChatName(),e);
e.setJoinParams(d.time,d.hash);
f.initApp(e.getApplication())
};
meeboApp.onBuddyAddRequest=function(a,l,e,f,b){var h=function(o,m){var n={user:b,protocol:f,buddy:e,authorized:o};
if(m||(o&&f=="jabber")){n.ad=meebo.util.getDefaultGroup(f)
}gNetworkMgr.doRequest("auth",n,hitch(gNetworkMgr,"receiveAuthBuddy"))
};
var c=f!="jabber"?gLang.acceptBtn:gLang.acceptAndAddBtnTT;
joinAndAdd=f!="jabber"?gLang.acceptAndAddBtnTT:null;
var d=gLogon.getLogon(b,f);
var g=gWindowMgr.createAcceptDenyDlg({id:getUniqueId()+"-accept",caption:gLang.acceptHeader},{buddy:e,logon:d,message:sprintf(gLang.wantsAdd,e+" ("+f+")",b),joinButtonText:c,joinAndAddButtonText:joinAndAdd},h);
if(meeboApp.util.hasMeeboExtension()){var k=hitch(this,function(m){if(!m.isPoppedOut()){MeeboExtension.showMeeboTab();
m.callActivate()
}else{m.m_win.focus()
}},g);
MeeboExtension.showNotification(gLang.acceptHeader,sprintf(gLang.wantsAdd,e+" ("+f+")",b),null,"invitation",k)
}};
meeboApp.preloadImages=function(){var c=["notifyBuddy.gif","buttons/button.hot.center.png","buttons/button.hot.right.png","buttons/button.hot.left.png","buttons/button.down.center.png","buttons/button.down.right.png","buttons/button.down.left.png","buttons/button.disabled.center.png","buttons/button.disabled.right.png","buttons/button.disabled.left.png"];
for(var b=0;
b<c.length;
b++){var a=document.createElement("img");
gImages.requestImage(c[b],a)
}};
meeboApp.initGlobals=function(){gWindows=[];
gTimerMgr=new ui.timerMgr();
gWindowMgr=new meeboApp.WindowMgr();
gConsoleMgr=new meeboApp.consoleMgr();
gInfoDlg=new meeboApp.info();
gSerializer=new lib.serializer();
gSkins=new meeboApp.skins();
gWidgets=new meebo.Widgets();
gDragManager=new ui.drag.DragManager();
gColorMgr=new ui.colorMgr();
gWait=new meeboApp.logonWaitDlg();
gSounds=new ui.soundmanager();
gSounds.init();
gNotice=new ui.notice();
gNotice.registerProbationCallback(hitch(gWindowMgr,"checkMuteRooms"));
gUid=new ui.Uid();
gFrontPage=new meeboApp.FrontPage();
gFrontPage.initAudioButton();
gBrowser=new meeboApp.browser();
gBrowser.init();
gBrowser.setFavIconSrc("favicon",window);
gRemote={};
meeboApp.setupRemote();
gIsGuestApplication=meebo.util.getMeeboApplicationLink(document.location)!=null;
gIsGuestGroupChat=meebo.util.getMeeboGroupChatLink(document.location)!=null||gIsGuestApplication;
var b=ui.isMac&&isNumber(ui.isFirefox)&&ui.isFirefox<3;
if(!b){gGallery=new meeboApp.MediaBar();
gAdTimer=new meeboApp.AdTimer()
}else{gGallery=new meeboApp.roomGallery();
gAdTimer=null
}gGallery.create(document.body);
gInfoDlg.create();
if(gLog||gEventLog||gNetworkLog){try{gWindowMgr.createDebugDlg()
}catch(c){}}meeboApp.share=new meeboApp.Share();
for(var a=0;
a<gRoomsCategories.length;
a++){gRoomsCategories[a].name=gLang[gRoomsCategories[a].id]||gRoomsCategories[a].title
}gApplicationPlatform=new meebo.ApplicationPlatform();
gSecurePlatform=new meebo.SecurePlatform();
if(ui.isIE){gSecurePlatform.openBridge(document.body)
}if("twitter" in gProtocols){delete gProtocols.twitter
}if("twitter" in gNetworks){delete gNetworks.twitter
}};
meeboApp.setBuddyIconUrl=function(b,a){if(gEventMgr.getState()!="im"){return gWindowMgr.createReconnectDlg()
}var c=hitch(this,function(){if(b.type=="file"){gNetworkMgr.requestSetIcon(null,b,null)
}else{if(b.match(/https?:\/\//)){gNetworkMgr.requestSetIcon(null,null,b)
}else{gNetworkMgr.requestSetIcon(b,null,null)
}}});
if(!gLogon.getMeeboUser()){gWindowMgr.createCreateMeeboAccountDlg({caption:gLang.meeboBuddyIconUpsell},"console-icon","upsell_buddyicons.png",c);
if(a){a()
}}else{c()
}};
meeboApp.launchSandbox=function(a){gGallery.launchAd({engagedUrl:a,title:"Sandbox",share:"Sandbox"},"sandbox")
};
meeboApp.setStatusMessage=function(a){meeboApp.statusInput.setValue(a)
};
meeboApp.getDisplayName=function(){return gLogon.getLogons()[0].getDisplayName()
};
meeboApp.getBuddyIcon=function(){return document.location.protocol+"//"+document.location.hostname+"/"+gPrefs.getIcon()
};
meeboApp.setWallpaper=function(a,c,b){if(gEventMgr.getState()!="im"){return gWindowMgr.createReconnectDlg()
}gPrefs.savePref("enableWallpaper",true);
gConsoleMgr.getMainPage().setWallpaper(a);
if(c&&b){gPrefs.saveWallpaperPref(c,a,b)
}};
meeboApp.setDontShowWarning=function(a){meeboApp.dontShowWarning=a
};
meeboApp.getPartnerLogon=function(){return meeboApp.m_partnerLogon
};
meeboApp.setPartnerLogon=function(a){meeboApp.m_partnerLogon=a
};
meeboApp.initBasicMeebo=function(){var d=util.query;
meeboApp.adId=d.getHashVariable(d.AD_SHARE_ID);
if(d.getHashVariable(d.NETWORK) in gNetworks){util.cookie.save("morenetworks",d.getHashVariable(d.NETWORK))
}var e=d.getHashVariable(d.SESSION_KEY);
gIGClient.setClientType(d.getHashVariable(d.CLIENT_TYPE)||"core");
if(gEventMgr.getState()=="im"){gFrontPage.updateInnerMeebo();
gGallery.initContent();
gGallery.setDisplay(true);
gSkins.setSkin(gPrefs.getPref("meeboSkin"));
meeboApp.onEventMgrChangeState(gEventMgr,"meebo.EventMgr::changeState","im")
}else{if(d.getHashVariable(d.FIREFOX_EXTENSION)){window.location.hash="#";
addClassName(document.body,"extensionloggingin");
gWait.showWait(gLang.signOnWait,gImages.getPath()+"wait_ax.gif",document.body);
var b=function(g,f,h){removeClassName(document.body,"extensionloggingin");
if(gWait){gWait.hideWait()
}gPubSub.unsubscribe("meebo.Logon::changeState",this);
gPubSub.unsubscribe("meebo.LogonMgr::meeboUserLogon",this);
if(f=="meebo.Logon::changeState"&&h=="error"){gFrontPage.init();
return
}else{if(f!="meebo.Logon::changeState"||h=="online"){if(meeboApp.util.hasMeeboExtension()){MeeboExtension.markSuccessfulLogin()
}gFrontPage.updateInnerMeebo()
}}};
gPubSub.subscribe("meebo.Logon::changeState",meeboApp,b);
gPubSub.subscribe("meebo.LogonMgr::meeboUserLogon",meeboApp,b);
gPubSub.subscribe("meebo.EventMgr::changeState",meeboApp,function(g,f,h){if(h=="done"&&gEventMgr.inNetworkInterrupt()){if(gWait){gWait.hideWait()
}removeClassName(document.body,"extensionloggingin");
gPubSub.unsubscribe("meebo::EventMgr::changeState",this)
}})
}else{if(e){meeboApp.initPopoutMeebo(e)
}else{gFrontPage.init()
}}}if(d.getHashVariable(d.IMTHIS_TITLE)&&d.getHashVariable(d.IMTHIS_URL)){var a=new meeboApp.IMThisInterstitial();
var c=false;
gPubSub.subscribe("meebo.EventMgr::changeState",a,function(h,f,k,g){if(k=="im"){if(!c){c=true;
gPubSub.unsubscribe(a);
meeboApp.showInterstitial(a)
}if(window.opener&&window.opener.meeboShare){window.opener.meeboShare.attach(gIGClient.getSessionKey())
}}})
}if(d.getHashVariable(d.PROMPT_SIGNUP)){gWindowMgr.createCreateMeeboAccountDlg({},"frontpage-url","upsell_access.png")
}};
meeboApp.onUIChangeState=function(c,a,b){switch(c){case"popout":if(!a.isPoppedOut){if(b){gUIState.set("popout",{isPoppedOut:true})
}else{meeboApp.dontShowWarning=true;
window.close()
}}break
}};
meeboApp.initPopoutMeebo=function(b){meeboApp.setIsPopout(true);
gUIState.subscribe("ChangeState",meeboApp,"onUIChangeState");
var h=util.query;
var e=h.getHashVariable(h.AUTH_TOKEN);
var a=h.getHashVariable(h.USER);
var f=h.getHashVariable(h.NETWORK);
if(!b){window.location="/";
return true
}if(f){gIGClient.setClientType("cim-popout");
var g=gNetworks[f];
g.makeLive();
if(a){var c=gLogon.addLogon(a,g);
if(e){c.setAuthToken(e)
}meeboApp.setPartnerLogon(c)
}}gIGClient.attach(b,function(l,k){if(k){gPubSub.publish(this,"meeboApp::attached");
gFrontPage.updateInnerMeebo();
gSecurePlatform.getSessionInfoFromTray()
}else{if(c){try{window.close()
}catch(m){}}else{gFrontPage.init()
}}});
if(f&&!util.cookie.load("interstitial")){var d=new meeboApp.CIMInterstitial(f);
d.addOnHide(hitch(util.cookie,"save","interstitial","1"));
d.addOnHide(hitch(util.cookie,"save","morenetworks",meeboApp.getPartnerLogon().getNetwork()));
meeboApp.showInterstitial(d)
}};
meeboApp.showInterstitial=function(a){if(gGallery.minimize){gGallery.minimize();
a.addOnHide(hitch(gGallery,"midimize"))
}meeboApp.setDontShowWarning(true);
a.addOnHide(hitch(meeboApp,"setDontShowWarning",false));
a.initContent();
gOverlay=a
};
meeboApp.initGuestMeebo=function(){gIGClient.setClientType("core");
var d=util.query;
var b=d.getHashVariable(d.USER);
var e=d.getHashVariable(d.PROTOCOL);
gWindowMgr.createBuddyWindow(gLang.buddyList);
gBuddyListDlg.setUpsell(e||"aim",b||"");
gFrontPage.updateInnerMeebo();
var c=meebo.util.getMeeboGroupChatLink(document.location)!=null;
var a=meebo.util.getMeeboApplicationLink(document.location)!=null;
if(a){gBuddyListDlg.m_element.style.visibility="hidden"
}gIGClient.start(hitch(this,function(g,f){if(!f){return
}if(c){this.initGroupChat(b,e)
}else{if(a){this.initApplication(b,e)
}else{this.initFileTransfer()
}}}));
gPubSub.subscribe("meebo.Logon::changeState",meeboApp,function(h,f,k){if(h.isAnonymous()||!h.isOnline()){return
}gIsGuestGroupChat=false;
gBuddyListDlg.m_element.style.visibility="visible";
gWindowMgr.rightAlignBuddy();
gPubSub.unsubscribe("meebo.Logon::changeState",this);
var g=$("guestDownload");
if(g){g.parentNode.removeChild(g);
if(!meeboApp.GuestDownload.m_errorCode){gWindowMgr.createOkDlg({id:"acceptFile",caption:gLang.fileTransfer},meeboApp.GuestDownload.getHeaderText(),hitch(meeboApp.GuestDownload,"acceptFile"),null,gLang.acceptBtn,null,"file_download.gif")
}gNetworkMgr.doUILog("filetransfer","login","true",true)
}})
};
meeboApp.initGroupChat=function(c,h){var g=util.query;
var k=g.getHashVariable(g.GROUPCHAT_PASSWORD);
var b=g.getHashVariable(g.GROUPCHAT_INVITE_RECEIVED);
if(String(document.location).indexOf("#")!=-1){document.location="#?"
}var a=meebo.util.getMeeboGroupChatLink(document.location);
if(isDefined(b)){gNetworkMgr.doUILog("invite-msg-receive",b,"true",true)
}gEventMgr.setState("im");
var d=hitch(this,function(){if(!gNotice.isLocalStorageEnabled()){var l='<a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager03.html" target="_blank">';
gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.sorry,h:160},sprintf(gLang.flashLocalStorageRequired,a,"<br><br>",l,"</a>"));
gNetworkMgr.doUILog("guestroomsinvite",h||"none","nolocalstorage");
return
}meeboApp.joinRoom(a,k,c,h,function(){gNetworkMgr.doUILog("guestroomsinvite",h||"none","1")
})
});
var e=function(){gNetworkMgr.doUILog("meebo","load",(gUILogging?"stats":"nostats")+"-ggc",true,"uid:"+gUid.onUid())
};
if(!gNotice.m_flashEnabled){var f='<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">';
gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.sorry},sprintf(gLang.flashRequiredToJoinRoom,a,f,"</a>"));
gNetworkMgr.doUILog("guestroomsinvite",h||"none","noflash")
}else{gNotice.executeWhenReady(d)
}gUid.executeWhenReady(e)
};
meeboApp.initApplication=function(a,d){var c=util.query;
var e=c.getHashVariable(c.MEEBO_USER);
if(String(document.location).indexOf("#")!=-1){document.location="#?"
}gEventMgr.setState("im");
var b=meebo.util.getMeeboApplicationLink(document.location);
meebo.applicationMgr.loadGuest(hitch(this,function(h,f){if(f){gPubSub.publish(this,"meeboApp::loadGuestIcon",f)
}var g=meeboApp.Application.joinApp(a||null,a||null,d,b,h);
gWindowMgr.createIMWindow(g,true,false,function(k){k.setApplicationRoom(g)
})
}),e,b)
};
meeboApp.initFileTransfer=function(){var a=util.query;
gNetworkMgr.doUILog("filetransfer","guest","true",true);
gWindowMgr.rightAlignBuddy();
meeboApp.GuestDownload.create("guestDownload",document.body,a.getHashVariable(a.FILE_ID),a.getHashVariable(a.MEEBO_USER));
meeboApp.GuestDownload.addClassName("downloadPage")
};
meeboApp.initMeeboInvite=function(c,e,a){var b=gBuddyList.getBuddy(c,e,a);
if(b){var d=sprintf(gLang.askToSendIMInvite,gLang.sendInvitesMessageDefault,b.getAlias());
gWindowMgr.createOkDlg({id:"inviteToMeebo-"+getUniqueId(),caption:sprintf(gLang.notOnMeebo,b.getAlias())},d,hitch(meeboApp,"sendIMInvite",b,gLang.sendInvitesMessageDefault),null,gLang.sendBtn,null,"inviteAppChat.gif");
gInfoDlg.hideInfo()
}};
meeboApp.sendIMInvite=function(b,d){var c=gWindowMgr.getConvWindow(b);
var a={sender:b.getUser(),receiver:b.getName(),protocol:b.getProtocol(),msg:d};
gNetworkMgr.doRequest("send",a,hitch(meeboApp,"onSentIMInvites"));
if(c){c.addHistoryIM(c.getImObject().getUser(),d)
}};
meeboApp.onSentIMInvites=function(b,a){if(a){gNetworkMgr.doUILog("m2m","invite","profile",true);
var c=gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.inviteSent},gLang.thanksForIMInvite)
}else{var c=gWindowMgr.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.sendInviteErrorHeader},gLang.sendInviteTryAgain)
}};
meeboApp.onInput=function(){if(gAdTimer){gAdTimer.checkIntervals()
}};
meeboApp.onScroll=function(a){$("body").scrollTop=0
};
meeboApp.ssbDisplayNotification=function(c,g,d,b,e){d=d.match("http")?d:document.location.protocol+"//"+document.location.hostname+d;
var a=c+g;
var f=c+" says";
if(ui.isFluid){window.fluid.showGrowlNotification({title:f,description:g,priority:1,sticky:false,identifier:a,icon:d,onclick:function(){window.fluid.activate();
gWindowMgr.activateWindow(e);
e.restoreMinimizeWindow()
}})
}else{if(ui.isPrism){window.platform.showNotification(f,g,d)
}}};
meeboApp.fluidUpdateMessageCount=function(c,a,f){var e=0,g=gBuddyList.getBuddies({type:"buddy"});
for(var d=0,b;
(b=g[d]);
d++){e+=b.getUnreadMessageCount()
}window.fluid.dockBadge=e?String(e):""
};
meeboApp.m_isPopout=false;
meeboApp.setIsPopout=function(a){meeboApp.m_isPopout=a
};
meeboApp.isPopout=function(){return meeboApp.m_isPopout
};
meeboApp.isCIMPopout=function(){return gIGClient.getClientType()=="cim-popout"
};
meeboApp.hasTrayNotifier=function(){return gEventMgr.isClientAttached("trayicon")
};
meeboApp.activateSpecialSkin=function(){gSkins.m_skins.halloween={n:"Halloween",p:"halloween"};
gSkins.setSkin("halloween");
$("meebologo").style.background='url("'+gImages.getPath()+'meebologo-halloween.png")';
$("meebologo").style.width="161px";
var b=["bat","bloodyhand","bones","eyeball","frank","pumpkin","witchhat"];
for(var a=0;
a<b.length;
a++){meebo.util.emoticons.images[b[a]]=["("+b[a]+")"]
}meebo.util.emoticons.compileEmoticons();
for(var a=1;
a<=4;
a++){gDefaultBuddyIcons[a]="halloween/"+a+".png"
}};
meeboApp.onAnonymizedUsername=function(g,b,e){gPubSub.unsubscribe("meebo.EventMgr::anonymized_username",this);
var d={pid:5,uid:encodeURIComponent(e),cn:"meebo.com"};
var a=document.location.protocol=="https:"?"33across.com":"pixel.33across.com";
var c=document.location.protocol+"//"+a+"/ps/";
var f=Math.ceil(1000000*Math.random());
var h=c+f+"/";
new ui.TrackingPixel(d,h)
};
meeboApp.initializeTakeover=function(){if(gIsGuestGroupChat){return
}new ui.TrackingPixel({},gTakeover.impression_front);
if(gTakeover.fgimage){var a=document.createElement("div");
addClassName(a,"TakeoverContainer");
var c=$("languagelinks");
c.parentNode.insertBefore(a,c);
c.style.paddingTop="0px";
var b=createImg("TakeoverImage",document.body,728,90,gTakeover.fgimage,"",true,"",true);
addClassName(b,"TakeoverImage");
a.appendChild(b)
}};
meeboApp.downloadNotifier=function(b){b=b||"unknown";
var a="http://download.meebo.com/notifier/MeeboNotifierSetup-Beta.exe";
if(!meeboApp.m_notifierIframe){var c=window.document;
meeboApp.m_notifierIframe=c.createElement("iframe");
meeboApp.m_notifierIframe.style.position="absolute";
meeboApp.m_notifierIframe.style.top=meeboApp.m_notifierIframe.style.left="-999px";
meeboApp.m_notifierIframe.src=a;
c.body.appendChild(meeboApp.m_notifierIframe)
}else{meeboApp.m_notifierIframe.src=a
}gNetworkMgr.doUILog("notifierupsell","download",b,true)
};
Class("meeboApp.TreeEventModel",ui.TreeEventModel,function(a){this.onClick=function(d,c){if(c.m_bToggleHandle){var f=d.target||d.srcElement;
if(f.className==ui.TreeNode.classNames.img){c.toggle()
}}b.call(c,getFunctionKeysFromKeyEvent(d),false);
a(this,"onClick",arguments)
};
function b(f,h){var e=this.m_tree.getSelectionModel();
if(!e||!this.m_isSelectionEnabled){return
}f&=this.m_selectionModifiers;
var g=f&modifier.CTRL;
var d=f&modifier.SHIFT;
if(h&&this.toggle){this.toggle()
}if(!e.getPivot()){d=false
}if(!g){if(d){e.unselectAllButPivot()
}else{e.unselectAll()
}}var c=e.getPivot();
if(!d){e.setPivot(this);
if(g&&this.isSelected()){e.removeNode(this);
return
}}else{if(c&&c!=this){this.m_tree.applyToRange(e.getPivot(),this,hitch(e,"addNode"))
}}if(this){e.addNode(this)
}}this.onContextMenu=function(f,d){var c=this.m_tree.getSelectionModel();
if(!c||!d.m_isSelectionEnabled){return
}if(c.getNumSelections()<=1||!d.isSelected()){c.unselectAll();
c.addNode(d)
}a(this,"onContextMenu",arguments)
};
this.onDblClick=function(d,c){c.publish("Activate",c,d)
};
this.onMouseDown=function(d,c){this.m_tree.startDrag(d,c);
if(!ui.isSafari||ui.isSafari>=523){ui.preventDefault(d)
}}
});
Class("meeboApp.consoleMgr",function(){this.initialize=function(){this.m_pageMain=new meeboApp.ConsolePageMain();
this.m_pageGuest=new meeboApp.ConsolePageGuest()
};
this.getMainPage=function(){return this.m_pageMain
};
this.onResize=function(){this.m_pageMain.onResize()
}
});
Class("meeboApp.WindowMgr",function(){this.initialize=function(){this.m_groupChats={};
this.m_meeboGroupChats={};
this.m_numWindows=0;
this.m_numMinRows=0;
this.m_posIter=0;
this.m_flashIter=0;
this.m_flashTime=0;
this.m_totalFlashIters=8;
this.m_flashArr=new Array();
this.m_perWindow=-1;
this.m_maxIterMsec=40;
this.m_minIterMsec=20;
this.m_minFlashIters=8;
this.m_bFirstPopOut=true;
this.m_popOutQueue=Array();
this.m_currentZindex=2;
this.m_currentTileIndex=0;
this.m_timerFlash=gTimerMgr.addTimer(hitch(this,"doFlash"),125);
gPubSub.subscribe("meebo.EventMgr::changeState",this,"onEventMgrChangeState");
gPubSub.subscribe("meebo.EventMgr::notify",this,"onEventMgrNotify");
gPubSub.subscribe("meebo.Logon::changeState",this,"onLogonChangeState");
gPubSub.subscribe("meebo.CIMAccount::changeState",this,"onLogonChangeState");
gUIState.subscribe("ChangeState",this,"onUIChangeState");
this.m_dlgTemplates={defaultDlg:{id:"",caption:"",img:null,x:null,y:null,w:300,h:200,parent:null,bResize:false,bTopmost:true,buttonType:"close",bReconnectDlg:true,ctorName:"",deps:null,uiType:"dlg"},createMeeboAccountDlg:{id:"upsell",caption:gLang.createAccountHeader,w:600,h:390,ctorName:"meeboApp.createMeeboAccountDlg",creationFunction:"createCreateMeeboAccountDlg"},EmailInviteDlg:{id:"email-import",caption:gLang.emailImportHeader2,w:360,h:260,ctorName:"meeboApp.EmailInviteDlg",creationFunction:"createEmailInviteDlg",deps:["meeboApp.emailInvite.inc"]},signOnDlg:{id:getSignOnDlgId(),caption:gLang.newConnectionHeader,w:275,h:250,ctorName:"meeboApp.signOnDlg",deps:["meeboApp.signOnControl","meeboApp.signOnDlg"],creationFunction:"createSignOnWindow"},addBuddyDlg:{id:getAddBuddyDlgId(),caption:gLang.addBuddyHeader,w:275,h:278,ctorName:"meeboApp.addBuddyDlg",creationFunction:"createAddBuddyDlg"},profileDlg:{w:360,h:230,bResize:true,buttonType:"all",ctorName:"meeboApp.profileDlg",creationFunction:"createProfileDlg"},blogDlg:{id:getWelcomeDlgId(),caption:gLang.blogHeader,x:340,y:72,w:300,h:300,bResize:true,bTopmost:false,buttonType:"all",ctorName:"meeboApp.BlogDlg",creationFunction:"createWelcomeWindow"},myMeeboDlg:{id:getMyMeeboId(),caption:gLang.welcomeHeader,w:575,h:390,bResize:true,buttonType:"all",ctorName:"meeboApp.myMeeboDlg",deps:["meeboApp.myMeebo.inc","meeboApp.signOnControl","meeboApp.signOnDlg"],creationFunction:"createMyMeeboWindow"},Settings:{id:"settings",uiType:"Panel",caption:gLang.settings,w:270,h:260,ctorName:"meeboApp.SettingsPanel",deps:["meeboApp.SectionsPanel","meeboApp.SettingsPanel"],creationFunction:"createSettingsPanel"},Preferences:{id:"preferences",uiType:"Panel",caption:gLang.IMSettings,w:270,h:260,ctorName:"meeboApp.PreferencesPanel",deps:["meeboApp.SectionsPanel","meeboApp.PreferencesPanel"],creationFunction:"createPreferencesPanel"},Appearance:{id:"appearance",uiType:"Panel",caption:gLang.appearancePanel,w:260,h:252,ctorName:"meeboApp.AppearancePanel",deps:["meeboApp.appearancePanel.inc"],creationFunction:"createAppearancePanel"},FeatureTest:{id:"featureTest",caption:gLang.testingNewFeatures,w:300,h:250,ctorName:"meeboApp.FeatureTestDlg",deps:["meeboApp.InputDlg","meeboApp.FeatureTestDlg"],creationFunction:"createFeatureTestDlg"},chatLogDlg:{id:getChatLogDlgId(),caption:gLang.welcomeHeader,w:450,h:360,bResize:true,buttonType:"all",ctorName:"meeboApp.chatLogDlg",deps:["meeboApp.chatLog.inc"],creationFunction:"createChatLogWindow"},failSignOnDlg:{id:getFailSignOnDlgId(),caption:gLang.miniLogonHeader,w:300,h:225,ctorName:"meeboApp.failSignOnDlg",creationFunction:"createMiniLogonWindow"},addWidgetDlg:{id:getAddWidgetDlgId(),w:300,h:195,ctorName:"meeboApp.addWidgetDlg",creationFunction:"createAddWidgetDlg"},notifyDlg:{w:275,h:130,ctorName:"meeboApp.notifyDlg",creationFunction:"createNotifyDlg"},noAccountsDlg:{id:getNoAccountsDlgId(),w:275,h:130,ctorName:"meeboApp.NoAccountsDlg",creationFunction:"createNoAccountsDlg"},okDlg:{w:275,h:130,ctorName:"meeboApp.OkDlg",creationFunction:"createOkDlg"},inputDlg:{w:260,h:150,ctorName:"meeboApp.InputDlg",creationFunction:"createInputDlg"},setDisplayNameDlg:{w:260,h:150,deps:["meeboApp.InputDlg","meeboApp.SetDisplayNameDlg"],ctorName:"meeboApp.SetDisplayNameDlg",creationFunction:"createSetDisplayNameDlg"},textAreaDlg:{w:300,h:210,bResizable:true,deps:["meeboApp.InputDlg","meeboApp.TextAreaDlg"],ctorName:"meeboApp.TextAreaDlg",creationFunction:"createTextAreaDlg"},setProfileDlg:{w:300,h:210,bResize:true,deps:["meeboApp.InputDlg","meeboApp.TextAreaDlg","meeboApp.SetProfileDlg"],ctorName:"meeboApp.SetProfileDlg",creationFunction:"createSetProfileDlg"},addMediaDlg:{caption:gLang.addMedia,w:260,h:170,deps:["meeboApp.InputDlg","meeboApp.AddMediaDlg"],ctorName:"meeboApp.AddMediaDlg",creationFunction:"createAddMediaDlg"},roomCreateDlg:{w:327,h:475,deps:["meeboApp.roomCreate.inc"],ctorName:"meeboApp.RoomCreateDlg",creationFunction:"createRoomCreateDlg"},inviteDlg:{w:327,h:475,deps:["meeboApp.InviteBuddiesPage","meeboApp.InviteDlg"],ctorName:"meeboApp.InviteDlg",creationFunction:"createInviteDlg"},acceptDenyDlg:{w:300,h:130,ctorName:"meeboApp.AcceptDenyDlg",creationFunction:"createAcceptDenyDlg"},statusMenuDlg:{id:getStatusMenuDlgId(),caption:gLang.awayMessages,w:250,h:175,bResize:true,ctorName:"meeboApp.StatusMenuDlg",creationFunction:"createStatusMenuDlg"},roomWidgetDlg:{caption:gLang.roomWidgetHeader,w:300,h:280,ctorName:"meeboApp.RoomWidgetDlg",creationFunction:"createRoomWidgetDlg"},groupChatDlg:{id:getGroupChatDlgId(),caption:gLang.groupChatHeader,w:295,h:175,ctorName:"meeboApp.GroupChatDlg",creationFunction:"createGroupChatDlg"},imBuddyDlg:{id:getIMBuddyDlgId(),caption:gLang.imBuddyHeader,w:275,h:175,ctorName:"meeboApp.IMBuddyDlg",creationFunction:"createIMBuddyDlg"},addBuddyGroupDlg:{id:getAddBuddyGroupDlgId(),caption:gLang.addBuddyGroupHeader,w:275,h:160,ctorName:"meeboApp.AddBuddyGroupDlg",creationFunction:"createAddBuddyGroupDlg"},dateDlg:{w:275,h:125,buttonType:"none",ctorName:"meeboApp.DateDlg",creationFunction:"createDateDlg",caption:gLang.birthday},debugDlg:{id:getDebugDlgId(),x:50,y:100,w:550,h:450,bResize:true,buttonType:"all",ctorName:"meeboApp.debugDlg",creationFunction:"createDebugDlg",caption:"Debugger"},roomGalleryDlg:{id:"roomGalleryDlg",w:900,h:450,bResize:true,buttonType:"all",ctorName:"meeboApp.RoomGalleryDlg",creationFunction:"createRoomGalleryDlg",caption:"Room Gallery"},notifierUpsellDlg:{id:"notifierUpsellDlg",w:350,h:241,ctorName:"meeboApp.NotifierUpsellDlg",creationFunction:"createNotifierUpsellDlg",caption:"Meebo Notifier"}};
for(var b in this.m_dlgTemplates){var a=this.m_dlgTemplates[b];
if(!a.creationFunction){continue
}this[a.creationFunction]=hitch(this,"createDelegatedDlg",a)
}};
this.createDelegatedDlg=function(b,a){function h(n,m){var k={};
for(var l in n){k[l]=isDefined(m[l])?m[l]:n[l]
}return k
}a=h(h(this.m_dlgTemplates.defaultDlg,b),a||{});
var c=Array.prototype.slice.call(arguments,2);
var d=ui.deferredDlg.getWndOpening(a.id);
if(d){return d
}if(gWindows[a.id]){var f=gWindows[a.id].m_delegate;
if(f&&f.restoreDelegate){f.restoreDelegate.apply(f,c)
}return this.restoreDlg(gWindows[a.id])
}var d=this.createDlgFromTemplate(a);
var g=a.deps||[a.ctorName];
this.loadObjects(g,function e(){var l=Class.getObject(a.ctorName);
var k=new l();
d._("setDelegate",k,c)
});
return d
};
this.requestObject=function(b,a,f){try{var c=new net.Request();
c.url=b;
c.transport=net.XHRTransport;
net.get(c,function(g,h){if(!h){a()
}else{gWindowMgr.createNotifyDlg({id:getUniqueId()+"networkError",caption:gLang.meeboMessage},gLang.disruption+gLang.pleaseCheck);
f()
}})
}catch(d){f()
}};
this.loadObject=function(a,h,b){var g=gConfig.getTimeStamp(),c=gConfig.getVersion();
var d=callee.call(this,arguments);
if(!a.length){b();
if(h){h()
}}else{var e=a.shift();
var f="/script/"+e.replace(/\.(?!inc$)/g,"/")+(c?"_v"+c:"")+".js"+(g?"?"+g:"");
if(Class.objectExists(e)){d()
}else{runInMainContext(this,gWindowMgr.requestObject,f,d,b)
}}};
this.loadObjects=function(a,c){for(var b=a.length-1;
b>=0;
b--){if(Class.objectExists(a[b])){a.splice(b,1)
}}if(!a.length){if(c){c()
}}else{gSerializer.serialize(hitch(gWindowMgr,"loadObject",a,c))
}};
this.getNextTileIndex=function(){return ++this.m_currentTileIndex
};
this.getNextZIndex=function(){return ++this.m_currentZindex
};
this.getTopZIndex=function(){return this.m_currentZindex+100
};
this.nextParent=function(){var a=gWindowMgr.getActiveWindow();
if(a&&a.isPoppedOut()){return null
}return document.body
};
this.getConvWindow=function(a){if(!a){return null
}else{if(a.getType()=="protocolchat"){return gWindowMgr.m_groupChats[a.getId()]||gWindows[getIMId(a.getName(),a.getLogin())]||gWindows[getIMId(a.m_buddyParent,a.getLogin())]
}else{if(a.constructor==meebo.ApplicationRoom){var d=gWindows[getGroupChatId(a.getProtocol(),a.getUser(),a.getChatId())];
if(d){return d
}var c=gWindowMgr.getConvWindows();
for(var b=0,d;
(d=c[b]);
b++){if(d.getImObject()!=a&&d.getApplicationRoom()!=a){continue
}return d
}}else{var d=gWindows[getIMId(a.getName(),a.getLogin())];
if(d){return d
}var c=gWindowMgr.getConvWindows();
for(var b=0,d;
(d=c[b]);
b++){if(d.m_buddy==a){return d
}}}}}return null
};
this.loadDebugCases=function(){if(!gDebug){return
}var a=new Date().getTime();
try{}catch(b){alert("Couldn't find the debug events function.")
}log("loadDebugCases: "+(new Date().getTime()-a))
};
this.createBuddyWindow=function(m,n,f,e,c){var h=getBuddyListId();
var d=ui.deferredDlg.getWndOpening(h);
if(d){if(n){d.addBoth(function(p,o){n(p)
})
}return d
}if(gWindows[h]&&(!isDefined(f)||f==gWindows[h].isPoppedOut())){gWindowMgr.loadDebugCases();
return gWindows[h]
}var l=new meeboApp.buddyListDlg();
var g;
if(isDefined(e)){g=e
}else{g=ui.getClientRect();
var a=ui.getClientRect();
g.x=g.w-240;
g.y=gIsGuestGroupChat?60:5;
g.w=235;
g.h=gIsGuestGroupChat?Math.min(a.h-150,522):g.h-10
}var k=f?null:document.body;
var b=l.create(h,k,m,null,g.x,g.y,g.w,g.h,true,"onlymin");
return b.addBoth(function(o){o.setCreateFnc(gWindowMgr,gWindowMgr.createBuddyWindow,Array(m));
gBuddyListDlg=o;
gBuddyListDlg.m_element.style.zIndex="3";
gBuddyListDlg.initContent(c);
gWindowMgr.loadDebugCases();
gWindowMgr.registerWindow(gBuddyListDlg);
if(n){n(o)
}})
};
this.addFlashingWindow=function(b,c){if(c){this.m_flashArr.push(b)
}else{for(var a=0;
a<this.m_flashArr.length;
a++){if(this.m_flashArr[a]===b){this.m_flashArr.splice(a,1);
return
}}}};
this.doFlash=function(){var f=this.m_flashArr;
var c=0;
var a=(new Date()).getTime();
for(var d=this.m_flashIter;
d<f.length;
d+=this.m_totalFlashIters){f[d].flashWindow();
c++
}var g=(new Date()).getTime();
if(this.m_perWindow==-1&&c){this.m_perWindow=(g-a)/c
}this.m_flashTime+=(g-a);
if(this.m_flashIter==this.m_totalFlashIters-1){if(this.m_perWindow<=0){this.m_perWindow=1
}var h=Math.floor(this.m_flashTime/this.m_flashIter);
if(h>this.m_maxIterMsec){this.m_totalFlashIters+=Math.ceil(((h-this.m_maxIterMsec)/this.m_perWindow))
}else{if(this.m_totalFlashIters>this.m_minFlashIters&&h<this.m_minIterMsec){this.m_totalFlashIters-=Math.ceil(((this.m_minIterMsec-h)/this.m_perWindow))
}}this.m_flashIter=0;
this.m_flashTime=0;
this.m_perWindow=-1
}else{this.m_flashIter++
}};
this.reopenIMWindow=function(b,a){gWindowMgr.moveWindowToVisiblePos(b);
if(!a){b.showWindow(true)
}b.greyText();
if(b.isMaximized()){b.restoreMaximizeWindow()
}b.recalcLayout()
};
this.createIMWindow=function(t,s,a,v,A,d){var f=t.constructor==meebo.ApplicationRoom;
var u=t.getType()=="chat"&&!f;
var y=t.getType()=="protocolchat";
if(u&&t.m_isLeaving){return
}var B=t.getName();
var D=t.getProtocol();
var C=t.getUser();
var q=t.getAlias();
var l=getIMId(B,t.getLogin());
var c=ui.deferredDlg.getWndOpening(l);
if(c){if(v){c.addBoth(function(w,h){v(w)
})
}return c
}var z=gWindows[l];
if(!z&&u&&gWindowMgr.m_meeboGroupChats[l]){z=gWindows[l]=gWindowMgr.m_meeboGroupChats[l];
delete gWindowMgr.m_meeboGroupChats[l]
}if(z&&(!isDefined(A)||A==z.isPoppedOut())){var k=z&&!z.isVisible()&&!this.nextParent()&&!z.isPoppedOut();
if(!z.isVisible()){if(u){z.m_element.style.visibility="hidden"
}this.reopenIMWindow(z,k);
if(u&&ui.isIE){z.reuseChatWindow();
z.m_element.style.visibility="visible"
}}if(z.m_state=="min"){z.minimizeWindow(z.getElement())
}if(s&&!k){this.activateWindow(z)
}z.m_history.scrollTop=z.m_history.scrollHeight;
if(k){z.popOutDlg(true,v)
}return z
}logSpeed("creating im window");
var z=new meeboApp.imDlg(t);
if(f){z.setApplicationRoom(t)
}if(u){z.setSkin("chromeless")
}var b;
if(!isDefined(A)){b=this.nextParent();
A=(b==null)
}else{b=A?null:document.body
}var n=(u?700:(y?400:300));
var x=(u?522:275);
if(u&&gIsGuestGroupChat){var p=ui.getClientRect();
x=Math.min(p.h-150,522);
var e=(this.getConvWindows().length>0?gWindowMgr.getVisibleWindowPos(n,x,A):{x:20,y:60,w:n,h:x})
}else{if(isDefined(d)){var e=d
}else{var e=gPrefs.getAccountPref(C,D,"wd:"+l);
if(!e){if(f&&t.getApplication()){var m=t.getApplication();
n+=m.width+z.m_vertSliderSize-(ui.isIE?0:2);
x=Math.max(m.height+(ui.isIE?118:119),x)
}if(a){e=gWindowMgr.getDlgPos(null,n,x)
}else{e=gWindowMgr.getVisibleWindowPos(n,x,A)
}e.w=n;
e.h=x;
if(gIsGuestGroupChat){e.x=350;
e.y=75
}}}}var o=z.create(l,b,t.getCaption(),t.getCaptionImage(),e.x,e.y,e.w,e.h,"true","all");
var g=isDefined(gWindows[l]);
o._("initContent",g);
if(!gWindows[l]){gNetworkMgr.doUILog(z.control,(u?"room-":"")+"general","load")
}o.addBoth(function(h){h.setCreateFnc(gWindowMgr,gWindowMgr.createIMWindow,[t,s,a]);
if(s){gWindowMgr.activateWindow(h);
h.focusOnMessage()
}else{h.setZIndex(e.z)
}gWindowMgr.registerWindow(h);
gDragManager.addDropTarget(h);
if(v){v(h)
}logSpeed("im window drawn")
});
return o
};
this.createReconnectDlg=function(){var a=gWindowMgr.createOkDlg({id:getReconnectDlgId(),caption:gLang.disconnected,bReconnectDlg:false},gLang.thanks+gLang.logout+"<br><br>"+gLang.comeBack,hitch(gLogon,"reconnectAll"),null,gLang.reconnectionBtn,null,"notifyBuddy.gif");
a._("moveToTop");
return a
};
this.createDlgFromTemplate=function(a){if(!gEventMgr){return
}if(a.bReconnectDlg&&gEventMgr.getState()=="done"){return gWindowMgr.createReconnectDlg({},gLang.logoffStatus+"<br><br>"+gLang.reconnectPrompt)
}var c=new ui[a.uiType]();
var b=gWindowMgr.createDlg(c,a.id,a.caption,a.img,a.parent,a.x,a.y,a.w,a.h,a.bResize,a.bTopmost,a.buttonType);
return gWindowMgr.connectDlgEvents(b,a.id)
};
this.getNumWindows=function(){return this.m_numWindows
};
this.getNumMinWindows=function(){var a=0;
for(var c in gWindows){var b=gWindows[c];
if(!b||!b.isMinimized||!b.isMinimized()){continue
}a++
}return a
};
this.moveWindowToBottom=function(a,c){if(!a){return
}var b=a.getElement();
if(!b){return
}var g=a.getZIndex();
var e=g;
for(var d=0;
d<c.length;
d++){if(!c[d]||!c[d].getZIndex){continue
}g=Math.min(g,parseInt(c[d].getZIndex()));
e=Math.max(g,parseInt(c[d].getZIndex()))
}if(g>2){a.setZIndex(g-2);
return
}for(d=0;
d<c.length;
d++){if(!c[d]||!c[d].setZIndex){continue
}var f=parseInt(c[d].getZIndex())+2;
c[d].setZIndex(f);
e=Math.max(e,f)
}a.setZIndex(g);
if(parseInt(gGallery.getElement().style.zIndex)<=e){gGallery.getElement().style.zIndex=e+2
}};
this.resizeMaxWindows=function(){var a=[];
for(var b in gWindows){if(gWindows[b]&&gWindows[b].isMaximized&&gWindows[b].isMaximized()){gWindows[b].updateMaximize()
}}};
this.tileMinWindows=function(){var h=new Array();
var e=0;
for(var g in gWindows){var b=gWindows[g];
if(!b||!b.isMinimized||!b.isMinimized()||!b.isVisible||!b.isVisible()){continue
}h[b.m_id]=b;
e++
}h=objectToArray(h);
h.sort(gWindowMgr.sortByTileIndex);
var a=ui.getClientRect(document);
var k=0;
var c=0;
var f=0;
if(gGallery.getDisplay()!="none"){f=gGallery.getGalleryTop()
}for(var d=0;
d<h.length;
d++){var b=h[d];
if(!b){continue
}if(((c+1)*150)>=a.w){k++;
c=0
}b.moveWindow(c*150+8,a.h-f-((k+1)*28));
if(k){gWindowMgr.moveWindowToBottom(b,h)
}c++
}if(h.length){gWindowMgr.m_numMinRows=k+1
}else{gWindowMgr.m_numMinRows=0
}};
this.getNumMinRows=function(){return gWindowMgr.m_numMinRows
};
this.sortByTileIndex=function(f,d){var e=f.getElement().getAttribute("tileIndex");
var c=d.getElement().getAttribute("tileIndex");
return e-c
};
this.rightAlignBuddy=function(){if(!gBuddyListDlg||gBuddyListDlg.isMinimized()||gBuddyListDlg.isPoppedOut()){return
}if(gIsGuestGroupChat){return
}var a=ui.getClientRect();
var l=gBuddyListDlg.getWindowPos();
var g=a.w-l.w-5;
var f=5;
var k=l.w;
var c=a.h-10;
if(ui.isIPhone){var e=gBuddyListDlg.getTree().getElement();
var b=e.scrollHeight;
var d=l.h-e.offsetHeight;
c=Math.max(c,b+d)
}gBuddyListDlg.setWindowPos(g,f,k,c)
};
this.redraw=function(a){if(gEventMgr.getState()=="logon"){return
}gWindowMgr.tileMinWindows();
gWindowMgr.resizeMaxWindows();
gWindowMgr.rightAlignBuddy();
if(gEventMgr.getState()=="im"){gGallery.onResize()
}};
this.registerGroupChat=function(b,a){if(!gWindowMgr.m_groupChats){gWindowMgr.m_groupChats=new Object()
}gWindowMgr.m_groupChats[b]=a
};
this.unregisterGroupChat=function(a){delete gWindowMgr.m_groupChats[a]
};
this.unregisterWindow=function(a){delete gWindows[a];
this.m_numWindows--
};
this.reregisterWindow=function(b,a){if(a==b){return
}gWindows[a]=gWindows[b];
delete gWindows[b]
};
this.registerWindow=function(a){gWindows[a.m_id]=a;
this.m_numWindows++
};
this.moveWindowUnderTop=function(a){var b=gWindowMgr.getActiveWindow();
if(!b&&gGallery.isMaximized()){b=gGallery
}var c=0;
if(b){c=b.getZIndex()-1
}else{c=gWindowMgr.getNextZIndex()
}a.setZIndex(c)
};
this.moveWindowToVisiblePos=function(a){if(!a||!a.getWindowPos){return
}if(this.isWindowPosVisible(a)){this.moveWindowUnderTop(a);
return
}var c=a.getWindowPos();
var b=this.getVisibleWindowPos(c.w,c.h,a.isPoppedOut());
a.moveWindow(b.x,b.y);
a.setZIndex(b.z)
};
this.isWindowPosVisible=function(b){var c=80,f=50;
var d=this.getActiveConvWindow();
if(!d){return true
}var e=b.getWindowPos();
var a=d.getWindowPos();
if(e.z>a.z){return true
}if((a.x-e.x)>=c){return true
}if(((e.x+e.w)-(a.x+a.w))>=c){return true
}if((a.y-e.y)>=f){return true
}if(((e.y+e.h)-(a.y+a.h))>=f){return true
}return false
};
this.getVisibleWindowPos=function(v,A,g){var y=320,C=100;
var e=5,h=5,l=5;
var D=40;
var b=28;
var t=4;
var q=3;
var u=0,p=0,o=0;
var z=false,m=false,k=false,s=false;
var a=this.getActiveConvWindow();
var d=null;
var c=[];
if(a&&a.isPoppedOut()==g){o=a.getZIndex()-1;
d=a.getWindowPos();
for(var w in gWindows){if(gWindows[w].getZIndex()==o){c.push(gWindows[w])
}}}else{a=null;
o=gWindowMgr.getNextZIndex()
}var B=ui.getClientRect();
if(d){z=(d.x-D)>e;
m=(d.y-b)>h;
k=(d.x+d.w+D)<B.w-e;
s=(d.y+d.h+b)<B.h-l
}if(!a||a.isMaximized()||(!z&&!m&&!k&&!s)){var x=this.m_posIter++;
var f=Math.floor(x/t);
var u=y+((x%t)*D)+((f%q)*D);
var p=C+((x%t)*b);
return{x:u,y:p,w:v,h:A,z:o}
}if(z){var x=c.length;
var f=Math.floor(x/t);
u=d.x-D-((x%t)*D)+((f%q)*D)
}else{if(k){var x=c.length;
var f=Math.floor(x/t);
u=d.x+d.w+D-v+((x%t)*D)+((f%q)*D)
}else{var x=this.m_posIter++;
var f=Math.floor(x/t);
u=y+((x%t)*D)+((f%q)*D)
}}if(s){p=d.y+d.h+b-A+((c.length%t)*b)
}else{if(m){p=d.y-b-+((c.length%t)*b)
}else{var x=this.m_posIter++;
p=C+((x%t)*b)
}}return{x:u,y:p,w:v,h:A,z:o}
};
this.restoreDlg=function(a){if(!a){return
}if(a.isMinimized&&a.isMinimized()){a.minimizeWindow(a.getElement())
}a.showWindow(true);
this.activateWindow(a);
return new lib.deferred().callback(a)
};
this.getDlgPos=function(m,k,a){var l=parseInt(k/2);
var g=parseInt(a/2);
if(m&&m.getWindowPos){var f=m.getWindowPos();
var e=f.x+parseInt(f.w/2);
var d=f.y+parseInt(f.h/2);
e-=l;
d-=g;
if(m.isPoppedOut&&!m.isPoppedOut()&&e<0){e=0
}if(m.isPoppedOut&&!m.isPoppedOut()&&d<0){d=0
}return{x:e,y:d}
}else{var b=ui.getClientCenter(m);
b.x-=l;
b.y-=g;
if(b.x<0){b.x=0
}if(b.y<0){b.y=0
}return{x:b.x,y:b.y}
}};
this.createDlg=function(l,b,s,t,g,o,n,p,e,c,q,k,d){var a=new lib.deferred().errback();
var f;
if(g instanceof ui.dlg){if(g.isPoppedOut()){f=null
}else{f=document.body
}}else{if(g){f=g
}else{f=this.nextParent()
}}if(!l){return a
}if(o&&n&&p&&e){if(o<0){o=0
}if(n<0){n=0
}a=l.create(b,f,s,t,o,n,p,e,c,k)
}else{var m=gWindowMgr.getDlgPos(g,p,e);
a=l.create(b,f,s,t,m.x,m.y,p,e,c,k)
}return a.addBoth(function(u){if(!u.m_element){return
}gWindowMgr.registerWindow(u);
if(!u.initContent(d)){gWindowMgr.unregisterWindow(b);
return
}if(q){gWindowMgr.activateWindow(u)
}if(!g){return
}var h=g.m_id;
u.m_parent=g;
if(h&&u.m_onClose){u.m_onClose.push(function(){if(h&&gWindows[h]){gWindows[h].moveToTop()
}})
}})
};
this.connectDlgEvents=function(c,a){function b(e){if(!e){return
}var d=function(){gWindowMgr.unregisterWindow(a)
};
if(e.m_onClose){e.m_onClose.push(d)
}}if(c.addBoth){c.addBoth(b)
}else{b(c)
}return c
};
this.activateLastImDlg=function(b,a){if(gGallery&&gGallery.isMaximized()){return
}var c=-1;
var d,f,e;
if(b&&a){return
}for(var g in gWindows){if(g&&gWindows[g]){f=gWindows[g];
if((b&&!f.isPoppedOut())||(a&&f.isPoppedOut())){continue
}if(!f.isVisible||!f.isVisible()){continue
}if(f.isMinimized()){continue
}if(f.control!="imdlg"&&f.control!="buddylistdlg"){continue
}else{e=f.getZIndex()
}if((c<0)||(e<c)){c=e;
d=f
}}}if(d&&d.moveToTop){this.activateWindow(d)
}if(!d&&b&&!a){window.focus()
}};
this.activateNextWindow=function(c,a){if(gGallery&&gGallery.m_isGalleryOpen){return
}var b=-1;
var d,f,e;
if(c&&a){return
}for(var g in gWindows){if(g&&gWindows[g]){f=gWindows[g];
if((c&&!f.isPoppedOut())||(a&&f.isPoppedOut())){continue
}if(!f.isVisible||!f.isVisible()){continue
}if(f.control=="buddylistdlg"){e=1
}else{e=f.getZIndex()
}if(e>b){b=e;
d=f
}}}if(d&&d.moveToTop){this.activateWindow(d)
}if(!d&&c&&!a){window.focus()
}};
this.handleWindowClose=function(b){this.activateNextWindow(b.isPoppedOut(),!b.isPoppedOut());
if(meeboApp.isPopout()&&b.control=="imdlg"){var a="#"+b.getBuddy().getId();
gUIState.clear(a)
}};
this.activateWindow=function(a){gWindowMgr.deactivateWindows();
a.activateWindow()
};
this.deactivateWindows=function(){for(var b in gWindows){if(b){var a=gWindows[b];
if(a&&a.inactivateWindow&&a.isActive()){a.inactivateWindow(false)
}}}};
this.getActiveConvWindow=function(){var a=this.getActiveWindow();
if(a&&a.control&&a.control=="imdlg"&&!a.isMinimized()){return a
}return null
};
this.getActiveWindow=function(){for(var b in gWindows){if(b){var a=gWindows[b];
if(a&&a.isActive&&a.isActive()){return a
}}}};
this.getConvWindows=function(){var a=new Array();
for(var b in gWindows){if(gLog&&gDebugger&&gWindows[b]&&(gWindows[b].m_id==gDebugger.m_id)){continue
}if(b&&gWindows[b]&&gWindows[b].control&&(gWindows[b].control=="imdlg")){a.push(gWindows[b])
}}return a
};
this.getWindows=function(a){a=a||{};
var b=[];
for(var c in gWindows){var d=gWindows[c];
if("control" in a&&d.control!=a.control){continue
}if("app_id" in a){if(!d.getApplicationId||d.getApplicationId()!=a.app_id){continue
}}b.push(d);
b[c]=d
}return b
};
this.getApplicationWindows=function(a){if(!a){return[]
}return this.getWindows({app_id:a.app_id})
};
this.closeNonIMWindows=function(){for(var b in gWindows){if(b){var a=gWindows[b];
if(gLog&&a&&gDebugger&&(a.m_id==gDebugger.m_id)){continue
}if(a&&a.control=="imdlg"){continue
}if(a&&a.control=="chatlogdlg"){continue
}if(a&&a.m_id&&(a.m_id=="buddylistwin")){continue
}if(a&&a.m_id&&(a.m_id==getWelcomeDlgId())){continue
}if(a&&a.m_id&&(a.m_id==getReconnectDlgId())){continue
}if(a&&a.closeWindow){a.closeWindow()
}}}};
this.closeWindows=function(){for(var b in gWindows){if(b){var a=gWindows[b];
if(gLog&&a&&(a.m_id==gDebugger.m_id)){continue
}if(a&&a.closeWindow){a.closeWindow()
}}}};
this.onEventMgrChangeState=function(c,a,d,b){if(d=="done"){this.closeNonIMWindows()
}else{var e=gWindows[getReconnectDlgId()];
if(e){e.closeWindow()
}}};
this.onEventMgrNotify=function(c,a,b){this.createNotifyDlg({id:getUniqueId()+"-notify",caption:gLang.networkMessage},b)
};
this.onLogonChangeState=function(g,n,a,b){var e=b=="online"||b=="signingoff";
var f=g.isOnline(),d=g.getNetwork();
if(e!=f){if(f){this.updateOnlineWindows(g.getName(),g.getProtocol())
}else{this.updateOfflineWindows(g.getName(),g.getProtocol())
}}if(a=="online"){if(d=="myspace"){setTimeout(hitch(this,"checkMySpaceBuddyList",g),2000)
}}else{if(a=="error"){var k=g.getLastError(),h=k.type,l=k.description;
if(d=="myspace"&&h==2&&l=="No username set"){var m="http://profileedit.myspace.com/index.cfm?fuseaction=profile.username";
var c=gLang.needAMySpaceUsername+'<br><br><a href="'+m+'" target="_blank">'+gLang.setYourUsernameOnMySpace+"</a>";
gWindowMgr.createNotifyDlg({id:"myspace-username-notify",caption:gLang.setYourMySpaceUsername,w:300},c,{src:"network/myspace_24_online.png",w:24,h:24})
}else{if(h==16&&l=="AOL does not allow your screen name to authenticate via this site."){gWindowMgr.createNotifyDlg({id:"aol-authenticate-notify",caption:gLang.error},gLang.aolDoesntLikeYou)
}else{if(gEventMgr.getState()!="connecting"){this.createMiniLogonWindow(null,g)
}}}}}};
this.checkMySpaceBuddyList=function(a){if(!gBuddyList.getBuddies({logon:a}).length){gWindowMgr.createAddBuddyDlg(null,{logon:a})
}};
this.onUIChangeState=function(h,d){switch(h){case"cIM":break;
case"activePlt":if(d&&d.im){var a=d.im.substr(1);
var c=gBuddyList.getBuddyById(a);
var g=this.getConvWindow(c);
if(g){this.activateWindow(g);
g.restoreMinimizeWindow()
}}break;
default:if(h.charAt(0)=="#"){var a=h.substr(1);
if(d){var c=gBuddyList.getBuddyById(a);
if(!c){var f=parseBuddyId(a);
var e=meebo.util.normalizeLogon(f.user,f.protocol);
var b=gLogon.addLogon(f.user,e.network);
c=gBuddyList.addBuddy(f.name,b)
}var g=this.getConvWindow(c);
if(!g){g=this.createIMWindow(c,false);
if(meeboApp.isCIMPopout()){if(g._){g._("minimizeWindow")
}else{g.minimizeWindow()
}}}}}}};
this.updateOnlineWindows=function(a,f){var d=this.getConvWindows();
for(var c=0;
c<d.length;
c++){var e=d[c];
if(!e.m_bOffline){continue
}var b=e.m_imobject;
if(a&&f){if(b.getUser()!=a||b.getProtocol()!=f){continue
}}if(b.constructor==meebo.Room){if(!e.m_rejoinDiv){meeboApp.joinRoom(e.getImObject())
}else{e.m_rejoinDiv.style.display=""
}}else{e.setOffline(false)
}}};
this.updateOfflineWindows=function(a,f){var d=this.getConvWindows();
for(var c=0;
c<d.length;
c++){var e=d[c];
var b=e.m_imobject;
if(a&&f){if(b.getUser()!=a||b.getProtocol()!=f){continue
}}if(e.isAppAreaVisible()&&e.m_applicationRoom){if(!e.isGroupChat()){e.toggleAppArea()
}else{e.initAppLoadingOverlay(gLang.errorApplicationNotAvailable)
}}else{if(e.isGroupChat()){e.addHistoryIM(gLang.meeboMessage,gLang.meeboOffline+gLang.chatroomended,true,true)
}}e.setOffline(true)
}};
this.doHotKeys=function(b){var a=b.keyCode;
return true
};
this.checkMuteRooms=function(d,c){var b=this.getConvWindows();
for(var a=0;
a<b.length;
a++){if(b[a].isMeeboGroupChat()){if(d){b[a].showMuteControls()
}else{b[a].hideMuteControls()
}}}}
});
meeboApp.browser=function(){this.m_focusTime=0;
this.m_focusTimeStart=null;
this.init=function(){if(gTimerMgr){gTimerMgr.addTimer(function(){gBrowser.flashTitle()
},1000)
}this.setTitle(window,"meebo.com");
this.connectEventsToWin(window);
gPubSub.subscribe("meebo.EventMgr::changeState",this,"onEventMgrChangeState");
gPubSub.subscribe("meebo.EventMgr::networkRequestData",this,"onNetworkRequestData")
};
function a(f,d,e){if(!d&&f.event){d=f.event
}var g=d.target?d.target:d.srcElement;
var c=true;
if((g.tagName.toLowerCase()!="input"&&g.tagName.toLowerCase()!="textarea")||(g.tagName.toLowerCase()=="input"&&g.id=="focuser")){var b;
if(f.m_windowId){b=gWindows[f.m_windowId]
}else{b=gWindowMgr.getActiveWindow();
if(b&&b.isPoppedOut()){b=null
}}if(b&&b.isVisible()){c=e(d,b,g)
}}gBrowser.setFocus(f);
return c
}this.connectEventsToWin=function(c){var b=c.document;
b.onkeydown=function(d){try{if(d.keyCode==ui.KEY_ESC){ui.preventDefault(d)
}return a(c,d,function(g,e,h){if(e.onGlobalKeyDown){return e.onGlobalKeyDown(g,h)
}return true
})
}catch(f){}};
b.onkeypress=function(d){try{return a(c,d,function(g,e,h){if(e.onGlobalKeyPress){return e.onGlobalKeyPress(g,h)
}return true
})
}catch(f){}};
b.onmousedown=function(d){try{meeboApp.onInput()
}catch(f){}};
ui.connectEvent(c,"focus",this,"setFocus",true,true);
ui.connectEvent(c,"blur",this,"setUnfocus",true,true);
if(ui.isIE==7){ui.connectEvent(c,"focusie7",this,"setFocus",true,true)
}c.m_focus=true
};
this.disconnectEventsFromWin=function(c){var b=c.document;
b.onkeydown=null;
b.onkeypress=null;
ui.disconnectEvent(c,"focus");
ui.disconnectEvent(c,"blur");
if(ui.isIE==7){ui.disconnectEvent(c,"focusie7")
}};
this.setFavIcon=function(f,e){var d=e.document;
var b=d.getElementsByTagName("head")[0];
var c=d.createElement("link");
c.type="image/x-icon";
c.rel="shortcut icon";
c.href=f;
if(e.m_favIcon&&(c.href==e.m_favIcon.href)){return
}if(e.m_favIcon){b.removeChild(e.m_favIcon)
}e.m_favIcon=b.appendChild(c)
};
this.setFavIconSrc=function(b,c){c.m_favIconSrc=b
};
this.setTitle=function(b,c){b.document.title=c;
b.m_title=c
};
this.setFlash=function(e,b,c,d){e.m_previousFlash=e.m_flash;
e.m_flash={message:c,sender:b,unflashAll:d}
};
this.clearFlash=function(f,b){if(!f.m_flash){return
}var d=f.m_flash.unflashAll;
if(b){f.m_flash=f.m_previousFlash
}else{f.m_flash=f.m_previousFlash=null
}if(d){try{gWin.map(function(e){if(!e.m_flash||!e.m_flash.unflashAll){return
}if(b){e.m_flash=e.m_previousFlash
}else{e.m_flash=e.m_previousFlash=null
}})
}catch(c){}}};
this.onFlashTitle=function(d){var b=!meeboApp.util.hasMeeboExtension()||!MeeboExtension.getNotificationPreference("blink");
var c=d.document;
if(!d.m_flash||(d.m_flash&&d.m_focus)){if(b){c.title=d.m_title
}d.m_iconIndex=d.m_flashIndex=0;
this.clearFlash(d);
gBrowser.setFavIcon(gImages.getPath()+d.m_favIconSrc+".ico",d);
return
}if(d.m_iconIndex++%2){gBrowser.setFavIcon(gImages.getPath()+d.m_favIconSrc+".ico",d)
}else{gBrowser.setFavIcon(gImages.getPath()+d.m_favIconSrc+"-rev.ico",d)
}var e;
if(d.m_flashIndex==0){e=d.m_title
}else{if(d.m_flashIndex==1&&d===window){e=d.m_flash.sender+"!"
}else{e='"'+d.m_flash.message+'"'
}}if(b){c.title=e
}d.m_flashIndex=(d.m_flashIndex+1)%((d===window)?3:2)
};
this.flashTitle=function(){if(!window.gImages){return
}gWin.map(hitch(gBrowser,"onFlashTitle"))
};
this.setFocus=function(d,b){eventlog("focus");
var e;
if(!b){e=d
}else{e=gWin(b)
}if(e.m_focus){return
}e.m_focus=true;
this.clearFlash(e);
if(e.m_windowId){var f=gWindows[e.m_windowId];
if(f){if(!f.isActive()){gWindowMgr.activateWindow(f)
}f.onWindowFocus()
}}else{var c=gWindowMgr.getActiveConvWindow();
if(c){c.stopBuddyMessageFeedback()
}}this.incrementFocusTime();
if(!this.m_focusTimeStart){this.m_focusTimeStart=new Date().getTime()
}};
this.setUnfocus=function(c,b){eventlog("unfocus");
var d;
if(!b){d=c
}else{d=gWin(b)
}d.m_focus=false;
if(d.m_windowId){var e=gWindows[d.m_windowId];
if(e){e.onWindowUnfocus()
}}this.incrementFocusTime();
this.m_focusTimeStart=null;
if(gGallery&&gGallery.onRollOutLeaderboard){gGallery.onRollOutLeaderboard()
}};
this.incrementFocusTime=function(){if(this.m_focusTimeStart){var b=new Date().getTime();
var c=(b-this.m_focusTimeStart)||0;
this.m_focusTime+=c;
this.m_focusTimeStart=b
}};
this.onEventMgrChangeState=function(d,b,e){this.m_focusTime=0;
this.m_focusTimeStart=new Date().getTime();
if(e=="done"){var c=gEventMgr.inNetworkInterrupt()?gLang.reconnectHeader:gLang.goodbyeHeader;
gWin.map(function(f){gBrowser.setFlash(f,gLang.meeboMessage,c,true)
})
}else{if(e=="reconnecting"){this.clearFlash(window,true)
}}};
this.onNetworkRequestData=function(d,b,c){this.incrementFocusTime();
c.focusTime=Math.floor(this.m_focusTime/1000)
}
};
meeboApp.util={};
meeboApp.util.hasMeeboExtension=function(){return(typeof MeeboExtension!="undefined"&&MeeboExtension.xpcom.window==window)
};
meeboApp.util.isMeeboExtensionCompatible=function(){return true
};
meeboApp.util.MeeboExtensionNewWindowHandler=function(){meeboApp.updateStatusPanelIcon()
};
meeboApp.util.MeeboExtensionAutoLogin=function(){var a=function(){var c=MeeboExtension.retrieveLogin();
if(c){var f=c.network;
var e=c.username;
var d=c.password;
gLogon.setMeeboUser("","","");
var b=meebo.util.createAccount(e,f,d);
if(typeof b!="string"){gNetworkMgr.requestLogin("login",[b])
}}};
runInMainContext(null,a)
};
meeboApp.util.tree={};
meeboApp.util.tree.getBuddySortIndex=function(a){var b=a.getExtra();
return[(b.isOnline()?"0":"1"),(b.getType()=="chat"?"0":"1"),b.getAlias().toLowerCase(),b.getProtocol(),b.getUser()].join("/")
};
meeboApp.util.tree.getBuddyProtocolSortIndex=function(a){var b=a.getExtra();
return[(b.getType()=="chat"?"0":"1"),b.getProtocol(),meeboApp.util.tree.getBuddySortIndex(a)].join("/")
};
meeboApp.util.tree.getBuddyStatusSortIndex=function(a){var b=a.getExtra();
return[(b.getType()=="chat"?"0":"1"),(b.isOnline()?"0":"1"),(!b.isBlocked||!b.isBlocked()?"0":"1"),(!b.isMobile||!b.isMobile()?"0":"1"),(!b.isAway||!b.isAway()?"0":"1"),(!b.isIdle||!b.isIdle()?"0":"1"),meeboApp.util.tree.getBuddySortIndex(a)].join("/")
};
meeboApp.util.tree.getBuddyGroupChatSortIndex=function(a){var c=a.getExtra();
var b=a.getPresence&&a.getPresence();
if(!b){return c
}return[(c.isYourself()?"0":"1"),(b.isOnline()&&!b.isPending()?"0":"1"),(b.isPending()?"0":"1"),(!b.isOnline()?"0":"1"),b.getAlias().toLowerCase()].join("/")
};
meeboApp.util.tree.getGroupSortIndex=function(a){var c=a.getExtra(),b=c.getName();
return[(b==gLang.meeboChats?"0":"1"),(b==gLang.recentRooms?"0":"1"),(c!=gBuddyListDlg.m_offlineGroup?"0":"1"),b.toLowerCase()].join("/")
};
Class("meeboApp.util.search",function(){this.initialize=function(){this.reset()
};
this.reset=function(){this.m_root=null;
this.m_oldHtml=null;
this.m_searchText="";
this.m_markings=null
};
this.find=function(b,a){var c;
if(!this.m_root||this.m_searchText!=a){this.unhighlightLast();
c=this.findFirst(b,a)
}else{c=this.findNext()
}return c
};
this.findFirst=function(h,l){var f="";
var m=[];
function a(o){if(o.data){f+=o.data;
for(var n=0;
n<o.data.length;
n++){m.push(o)
}}if(!o.childNodes){return
}for(var n=0;
n<o.childNodes.length;
n++){a(o.childNodes[n])
}}function d(o){var n=m[o];
while(o>0&&m[o-1]==n){o--
}return o
}function c(){a(h);
var q=new RegExp(l,"gi");
var p;
while(p=q.exec(f)){var o=document.createRange();
var t=q.lastIndex-p[0].length;
var n=q.lastIndex-1;
o.setStart(m[t],t-d(t));
o.setEnd(m[n],n-d(n)+1);
var s=document.createElement("span");
s.setAttribute("isMarkedNode","true");
o.surroundContents(s)
}}function b(){var n=document.body.createTextRange();
n.moveToElementText(h);
var o=n.duplicate();
while(n.findText(l,1,0)&&o.inRange(n)){n.pasteHTML('<span isMarkedNode="true">'+n.htmlText+"</span>");
n.collapse(false)
}}function k(){var n=h.innerHTML.split(l);
h.innerHTML=n.join('<span isMarkedNode="true">'+l+"</span>")
}this.m_root=h;
this.m_searchText=l;
this.m_markings=[];
this.m_lastFind=-1;
var g=h.getElementsByTagName("span");
for(var e=0;
e<g.length;
e++){if(g[e].getAttribute("isMarkedNode")=="true"){g[e].removeAttribute("isMarkedNode")
}}if(!ui.isSafari&&document.createRange&&document.createRange().surroundContents){c()
}else{if(document.body.createTextRange&&document.body.createTextRange().findText){b()
}else{k()
}}var g=h.getElementsByTagName("span");
for(var e=0;
e<g.length;
e++){if(g[e].getAttribute("isMarkedNode")=="true"){this.m_markings.push(g[e])
}}return this.findNext()
};
this.findNext=function(){this.unhighlightLast();
return this.highlightNext()
};
this.unhighlightLast=function(){if(this.m_markings&&this.m_lastFind!=-1){removeClassName(this.m_markings[this.m_lastFind],"meeboChatLogViewerFind")
}};
this.highlightNext=function(){var a=null;
if(this.m_markings&&++this.m_lastFind<this.m_markings.length){addClassName(this.m_markings[this.m_lastFind],"meeboChatLogViewerFind");
a=this.m_markings[this.m_lastFind]
}else{this.reset()
}return a
}
});
function sortLogins(d,c){if(!d&&!c){return 0
}if(!d||!d.getName){return -1
}if(!c||!c.getName){return 1
}if(d.getNetwork()=="meebome"){return 1
}if(c.getNetwork()=="meebome"){return -1
}if(d.getName().toLowerCase()<c.getName().toLowerCase()){return -1
}if(d.getName()>c.getName()){return 1
}return 0
}function sortBuddies(e,d){if(!e&&!d){return 0
}if(!e||!e.getAlias||!e.isOnline){return -1
}if(!d||!d.getAlias||!d.isOnline){return 1
}if(e.isOnline()&&!d.isOnline()){return -1
}if(!e.isOnline()&&d.isOnline()){return 1
}var c=normalizeString(e.getAlias());
var f=normalizeString(d.getAlias());
if(c<f){return -1
}if(c>f){return 1
}return 0
}function getBuddyListId(){return"buddylistwin"
}function getMeeboChatProfileId(a){return normalizeString(a)+"-bprofile"
}function getChatGroupId(b,a){return normalizeString(a)+"-"+normalizeString(b)+"brow"
}function getFailSignOnDlgId(){return"failSignOnDlg"
}function getReconnectDlgId(){return"reconnectDlg"
}function getAddBuddyDlgId(){return"addBuddyDlg"
}function getAddBuddyGroupDlgId(){return"addBuddyGroupDlg"
}function getRemoveBuddyDlgId(){return"removeBuddyDlg"
}function getRemoveBuddyGroupDlgId(){return"removeBuddyGroupDlg"
}function getIMBuddyDlgId(){return"IMBuddyDlg"
}function getGroupChatDlgId(){return"GroupChatDlg"
}function getSignOnDlgId(){return"signOnDlg"
}function getMyMeeboId(){return"myMeeboId"
}function getCreateGroupChatDlgId(){return"createGroupChatDlg"
}function getStatusMenuDlgId(){return"statusMenuDlg"
}function getProfileId(a){return a.getId()+"-profile"
}function getJoinDlgId(){return"joinDlg"
}function getWelcomeDlgId(){return"welcomeWin"
}function getDebugDlgId(){return"debugWin"
}function getNoAccountsDlgId(){return"noAccountsDlg"
}function getAwayMenuId(){return"statusmenu"
}function getAwayEditMenuId(){return getAwayMenuId()+"edit"
}function getChatLogDlgId(){return"chatlogdlg"
}function getRoomInviteDlgId(a){return"roominvitedlg-"+a.getId()
}function getRoomWidgetDlgId(a){return"roomwidgetdlg-"+a.getId()
}function getAddWidgetDlgId(){return"addwidgetdlg"
}function getRoomGalleryDlgId(){return"roomgallerydlg"
}meeboApp.util.flashLoadMedia=function(b,a){if(gWindows[b]){gWindows[b].onFlashLoadMedia(a)
}};
meeboApp.util.flashShowAd=function(b,a){if(gWindows[b]){gWindows[b].onFlashShowAd(a)
}};
meeboApp.util.flashClickMedia=function(b,a){if(gWindows[b]){gWindows[b].onFlashClickMedia(a)
}};
meeboApp.util.flashClickRemove=function(b,a){if(gWindows[b]){gWindows[b].onClickRemove(a)
}};
meeboApp.util.flashClickAdd=function(b,a){if(gWindows[b]){gWindows[b].onMedia()
}};
meeboApp.util.flashHandleAdComplete=function(a){if(gWindows[a]){gWindows[a].onFlashAdComplete()
}};
gFlashVersion=getFlashVersion();
meeboApp.util.protocol={};
function buildAccountMenu(o,d,p,k,g,l,t,f,h,b,u){var c=new ui.menuheader(o,"",p,k,g,18,false,0,false,false,0).create(gWin(d));
d.appendChild(c.getElement());
var m=c.m_element.style;
if(f&&h){m.top=f+"px";
m.left=h+"px"
}b=b||{};
b.online=true;
var a=gLogon.getLogons(b);
a.sort(sortLogins);
var e=0;
for(var q=0,n;
(n=a[q]);
q++){var x=n.getNetwork();
var w=n.getDisplayName();
if(n.isAnonymous()){continue
}var v="network/"+x+"_14_online.gif";
c.addMenuItem(w,v,n,n==u);
e++
}if(e==0){return
}return c
}meeboApp.util.protocol.getBuddyProtocolIcon=function(b,d){var c=b.getNetwork(),a;
if(d){a="network/"+c+"_14_online.gif"
}else{if(b.isBlocked()){a="blocked_logo_small.gif"
}else{if(!b.isOnline()){a="network/"+c+"_14_offline.gif"
}else{if(b.isMobile()){a="mobile_logo_small.gif"
}else{a="network/"+c+"_14_"+(b.isAway()?"away":"online")+".gif"
}}}}return a
};
meeboApp.logonWaitDlg=function(){this.m_numWait=0;
this.m_html;
this.m_element;
this.m_win=window;
this.setPos=function(a,e,b,d){var c=$("wait")||this.m_element;
if(!c){return
}c.style.position="absolute";
if(a){c.style.left=a+"px"
}if(e){c.style.top=e+"px"
}if(b){c.style.width=b+"px"
}if(d){c.getElementsByTagName("div")[0].style.height=d+"px"
}};
this.positionRelativeTo=function(b){var c=posWithRespectTo(b,this.m_win.document.body);
var a=c.x+((b.offsetWidth/2)-(this.m_element.offsetWidth/2));
var d=c.y+((b.offsetHeight/2)-(this.m_element.offsetHeight/2));
this.setPos(a,d)
};
this.showWait=function(h,k,g){this.m_win=gWin(g);
this.m_win.document.body.style.cursor="default";
var a=$("wait");
var b=false;
if(!a){b=true;
a=this.m_win.document.createElement("div");
a.innerHTML='<b class="corner waitcorner">				<b class="waitcorner1"></b><b class="waitcorner2"></b>				<b class="waitcorner3"></b><b class="waitcorner4"></b>				<b class="waitcorner5"></b></b>				<div id="waitcontent"></div>				<b class="corner waitcorner"><b class="waitcorner5"></b>				<b class="waitcorner4"></b><b class="waitcorner3"></b>				<b class="waitcorner2"></b><b class="waitcorner1"></b></b>';
a.id="wait"
}this.m_element=a;
var e="<table><tr><td>"+h+"</tr></table>";
a.getElementsByTagName("div")[0].innerHTML=this.m_html=e;
a.style.visibility="visible";
if(k){var d=document.createElement("img");
d.src=k;
if(d.height){fixPng(d)
}else{d.className="fixPng";
d.onload=function(){fixPng(d)
}
}var c=document.createElement("td");
c.appendChild(d);
var f=a.getElementsByTagName("tr")[0];
f.insertBefore(c,f.firstChild)
}this.setPos(null,null,200,null);
if(b){this.m_win.document.body.appendChild(a)
}if(g){this.positionRelativeTo(g)
}};
this.hideWait=function(){this.m_win.document.body.style.cursor="";
this.setPos(-999,-999,0,0);
this.m_numWait=0;
removeElement($("wait"))
};
this.isShowing=function(){return this.m_element&&this.m_win&&this.m_element.parentNode==this.m_win.document.body
};
this.updateWait=function(a){if(!this.isShowing()){return
}this.showWait(this.m_html+'<br><span class="fineprint">'+a+"</span>")
};
this.decrementWait=function(){this.m_numWait--;
if(this.m_numWait<=0){this.hideWait()
}};
this.incrementWait=function(){this.m_numWait++
}
};
Class("meeboApp.info",ui.element,function(a){this.initialize=function(){this.m_win=window;
this.m_id="infoTooltip";
this.m_infoTimer;
this.m_hideTimer;
this.m_m2mTimer;
this.m_treeWithHover;
gPubSub.subscribe("meebo.EventMgr::changeState",this,"onEventMgrChangeState")
};
this.create=function(){this.m_element=this.m_win.document.createElement("div");
this.m_element.style.display="none";
this.m_win.document.body.appendChild(this.m_element);
this.m_element.id=this.m_id;
this.m_element.innerHTML='			<b class="corner"><b class="corner1"><b></b></b>			<b class="corner2"><b></b></b><b class="corner3"></b>			<b class="corner4"></b><b class="corner5"></b></b>			<div id="infoTooltipContent"></div>			<b class="corner"><b class="corner5"></b>			<b class="corner4"></b><b class="corner3"></b>			<b class="corner2"><b></b></b><b class="corner1"><b></b></b></b>';
ui.connectEvent(this.m_element,"mouseover",this,"onMouseOver");
ui.connectEvent(this.m_element,"mouseout",this,"onMouseOut")
};
this.getBody=function(){return $("infoTooltipContent")
};
this.moveToTop=function(){this.m_element.style.zIndex=gWindowMgr.getNextZIndex()+2
};
this.hideInfo=function(){clearTimeout(this.m_m2mTimer);
this.m_m2mTimer=-1;
this.clearTimeout();
this.m_element.style.display="none";
this.setTreeWithHover(null)
};
this.showInfo=function(l){if(this.m_m2mTimer!=-1){clearTimeout(this.m_m2mTimer)
}if(this.m_infoTimer!=-1){return
}var g=l.getExtra();
if(!g){return
}var c=l.getPresence?l.getPresence():null;
var d=this.m_element;
var f=this.getBody();
f.style.height="";
var k=l.getElement();
var e=posWithRespectTo(k);
var h=l.getTree().getElement();
var b=posWithRespectTo(h);
if(!this.isVisible()){this.setPos(-999,-999)
}this.m_element.style.display="";
this.setInfo(g,c);
this.positionRelativeTo(b.x,e.y-11,h.offsetWidth,k.offsetHeight);
this.makeVisible();
if(g.getType()=="buddy"){this.m_m2mTimer=setTimeout(hitch(g,"requestOnMeeboStatus"),500)
}};
this.positionRelativeTo=function(c,l,d,f){var b=this.getBody();
var e=ui.getClientRect(b);
var k=c+d-10;
var g=l;
if(b.offsetHeight>e.h){b.style.height=(e.h-50)+"px";
g=5
}else{if(g+b.offsetHeight>e.h){g=e.h-(b.offsetHeight+5)
}}if(k+d>e.w){k=c-b.offsetWidth+10
}this.setPos(k,g)
};
this.makeVisible=function(){this.m_element.style.display="";
this.moveToTop()
};
this.setInfo=function(d,c){var b=this.setInfoHtml(this.getInfoForBuddy(d,c));
var f=d.getIconURL();
if(f){var e=createImg(this.m_id+"-icon",b,48,48,f,false,false);
if(e){e.className="buddyIcon";
if(!b.firstChild){b.appendChild(e)
}else{b.insertBefore(e,b.firstChild)
}}}};
this.setInfoHtml=function(d){var c=this.m_win.document.createElement("div");
c.innerHTML=d;
cacheImgs(c);
var b=this.getBody();
b.innerHTML='<div style="clear: both;"></div>';
b.insertBefore(c,b.firstChild);
return c
};
this.getInfoForBuddy=function(d,c){var h="";
if(c&&c.getChat()&&c.getChat().getType()=="chat"){h+="<b>"+d.getName().split("@")[0]+"</b><br><br>";
var g=c.getMedia();
if(g.length){h+=gLang.mostRecentShares;
h+="<table border=0 cellpadding=2 cellspacing=2>";
for(var e=g.length-1;
e>=0;
e--){h+='<tr><td><div style="position: relative;"><img src="'+escapeHTML(g[e].thumbnailUrl)+'"								style="width: 50px; height: 50px;"><img path="'+escapeHTML(g[e].type)+'-frame.gif"								style="position: absolute; top: -1px; left: -1px;"></div></td><td style="color: #667788">'+escapeHTML(g[e].description)+"</td></tr>"
}h+="</table>"
}else{h+=gLang.noRecentShares
}if(c.getWarnCount()){h+="<br><br>"+gLang.warnCount+": "+c.getWarnCount()
}}else{h=meebo.util.emoticons.insertMeeboEmoticons(d.getInfo());
h=h.replace(/src="emoticons\//g,'src="'+gImages.getPath()+"emoticons/");
var f=d.getGroups();
for(var e=0;
e<f.length;
e++){f[e]=f[e].getName()
}var b="<b>"+(f.length==1?gLang.group:gLang.groups)+"</b>: "+f.join(", ")+"<br><br>";
h=this.insertName(d,!d.isOnline()?b:h||"<b>"+gLang.fetchingInfo+"</b>");
if(gShowChatlogLinks&&d.getType()=="chat"&&!d.isPrivate()){h+='<hr><div><a href="'+d.getChatlogURL()+'" target="_blank">'+gLang.viewChatLogs+"</a></div>"
}if(d.getType()=="buddy"){var k=d.getOnMeeboStatus();
h+='<div class="tooltipOnMeebo">';
if(k=="OnMeebo"){h+='<img align="left" src="'+gImages.getPath()+'network/meebome_14_online.gif">'+sprintf(gLang.onMeebo,escapeHTML(d.getAlias()))
}else{if(k!=null){h+='<a href="javascript:" onclick="meeboApp.initMeeboInvite(\''+d.getName()+"','"+d.getProtocol()+"','"+d.getUser()+"'); return false;\">"+sprintf(gLang.notOnMeebo,escapeHTML(d.getAlias()))+"</a>"
}}h+="</div>"
}}return h
};
this.clearTimeout=function(){clearTimeout(this.m_infoTimer);
this.m_infoTimer=-1
};
this.setTimeout=function(c,b){this.clearTimeout();
this.m_infoTimer=setTimeout(hitch(this,function(){this.m_infoTimer=-1;
c()
}),b)
};
this.setHideTimeout=function(b){this.clearHideTimeout();
b=b||0;
this.m_hideTimer=setTimeout(hitch(this,function(){this.m_hideTimer=-1;
this.hideInfo()
}),b)
};
this.clearHideTimeout=function(){clearTimeout(this.m_hideTimer);
this.m_hideTimer=-1
};
this.onMouseOver=function(){this.clearHideTimeout();
if(this.m_treeWithHover){this.m_treeWithHover.highlight(true)
}};
this.onMouseOut=function(){this.setHideTimeout(0);
if(this.m_treeWithHover){this.m_treeWithHover.highlight(false)
}};
this.isVisible=function(){return this.m_element.style.display!="none"
};
this.getTreeWithHover=function(){return this.m_treeWithHover
};
this.setTreeWithHover=function(b){this.clearHideTimeout();
if(this.m_treeWithHover==b){return
}if(this.m_treeWithHover){var c=this.m_treeWithHover.getExtra();
gPubSub.unsubscribe(c,"meebo.IMObject::changeInfo",this);
gPubSub.unsubscribe(c,"meebo.IMObject::changeIcon",this)
}this.m_treeWithHover=b;
if(!b){return
}var c=b.getExtra();
if(!c){return
}gPubSub.subscribe(c,"meebo.IMObject::changeInfo",this,"onBuddyChange");
gPubSub.subscribe(c,"meebo.IMObject::changeIcon",this,"onBuddyChange");
if(!this.isVisible()){this.setTimeout(hitch(this,function(){this.showInfo(b,true);
c.requestInfo()
}),500)
}else{this.clearTimeout();
this.showInfo(b);
this.setTimeout(hitch(c,"requestInfo"),500)
}};
this.clearTreeWithHover=function(){this.setHideTimeout(0)
};
this.handleGroupOn=function(){if(this.isVisible()){this.setPos(-999,-999);
this.setHideTimeout(500)
}};
this.onEventMgrChangeState=function(c,b,d){if(d=="done"){this.hideInfo()
}};
this.onBuddyChange=function(c,b){if(this.isVisible()){this.showInfo(this.m_treeWithHover)
}};
this.makeNameSplittable=function(b){b=b||"";
return ui.isGecko?makeTextSplittable(b):b
};
this.insertName=function(d,g){var c=d.getName();
var e=d.getNetwork();
var b=d.getLogin().getDisplayName();
var f="";
if(d.isMeebome()||d.getNetwork().isCIMPartner()||d.getNetwork()=="facebook"){c=d.getAlias()
}else{if(d.getType()=="chat"){c=d.getChatName()
}}if(e=="aim"){f='<a class="tooltipProfileLink" target="_blank" href="http://profiles.aim.com/'+c+'">('+gLang.profile.toLowerCase()+")</a>"
}return'<img align=left src="'+gImages.getPath()+"network/"+e+'_14_online.gif"><div class="tooltipUserName"><b>'+this.makeNameSplittable(escapeHTML(c))+"</b> "+f+"<br>("+this.makeNameSplittable(escapeHTML(b))+")</div>"+g
};
this.updateIdleInfo=function(e,d,f){if(!e||!f||(f==-1)){return e
}var m=e.indexOf("Idle:</b>");
var b=m+9;
if(m==-1){return e
}var h=e.indexOf("\n",m);
var q=e.slice(0,b);
q+="&nbsp;";
var c="";
if(!d){var o=e.indexOf("<b>Idle:");
if(o==-1){o=e.indexOf("<b> Idle:");
if(o==-1){return e
}}var n=e.slice(0,o);
if(h==-1){h=e.length
}var l=e.slice(h,e.length);
return n+l
}if(h!=-1){c=e.slice(h,e.length)
}var g=new Date().getTime();
g=g/1000;
var k=g-f;
var p=getTimeString(Math.floor(k));
return q+p+c
};
this.updatePersistenceInfo=function(d,c){var e=/<b>Description:<\/b> [\d]+/;
var b=getTimeString(Math.floor(c));
return d.replace(e,"<b>Time on page:</b> "+b)
}
});
Class("meeboApp.BuddyRow",ui.TreeNode,function(a){this.m_subscriptions={"meebo.IMObject::changeOnline":"onBuddyChangeOnline","meebo.IMObject::changeAlias":"markRedraw","meebo.Buddy::changeIdle":"onBuddyChangeIdle","meebo.Buddy::changeAway":"onBuddyChangeAway","meebo.Buddy::changeBusy":"onBuddyChangeBusy","meebo.Buddy::changeStatusMessage":"onBuddyChangeStatusMessage","meebo.Buddy::changeTyping":"markRedraw","meebo.Buddy::changeMobile":"markRedraw","meebo.Buddy::changeBlocked":"markRedraw"};
this.initialize=function(b,c){a(this,"initialize",[c]);
this.subscribe("Activate",this,"onActivate");
this.m_extra=b;
this.m_className+=" buddyRow";
this.m_headerClassName+=(b.isAway()?" away":"")+(b.isIdle()?" idle":"");
gPubSub.subscribeAll(this.m_extra,this,this.m_subscriptions)
};
this.getHeaderHTMLString=function(){var b=this.getImageClassName();
return'<span class="img '+b+(ui.isSafari||ui.isOpera?'">&nbsp;':'">')+'<div class="img" style="background-image: url('+this.getBackgroundImage(b)+');"></div></span><span class="name">'+escapeHTML(this.m_extra.getAlias())+'</span> <span class="status">'+escapeHTML(this.getStatusText())+"</span>"
};
this.getStatusText=function(){var b=this.m_extra,c;
if(!b.isOnline()){c=""
}else{if(b.isBusy()){c=" - "+gLang.busyShort
}else{c=b.getStatusMessage();
if(c){c=" - "+c
}}}return c
};
this.getImageClassName=function(){var c=this.m_extra;
var b="";
if(c.isBlocked()){b="blocked"
}else{if(!c.isOnline()){b="offline"
}else{if(c.getTyping()==1){b="typing"
}else{if(c.getTyping()==2){b="typed"
}else{if(c.isMobile()){b="mobile"
}else{if(c.isAway()||c.isBusy()){b="away"
}else{b="online"
}}}}}}return b
};
this.getBackgroundImage=function(b){var c="";
switch(b){case"blocked":case"typed":case"typing":case"mobile":c=gImages.getPath()+"status-icons"+(this.m_showFeedback||b=="typing"?"-ax":"")+".gif";
break;
default:c=gImages.getPath()+"network/"+this.m_extra.getNetwork()+(this.m_showFeedback?"-ax":"_14")+".gif"
}return c
};
this.showFeedback=function(b){if(this.m_showFeedback==b){return
}this.m_showFeedback=b;
this.toggleHeaderClassName(b,"messageFeedback");
this.markRedraw()
};
this.onActivate=function(){var b=new Date().getTime();
runInMainContext(gWindowMgr,"createIMWindow",this.m_extra,true);
startlogtime(this.m_extra.getId(),b)
};
this.onBuddyChangeOnline=function(c,b,d){if(!d){this.removeHeaderClassName("away");
this.removeHeaderClassName("idle")
}this.markRedraw()
};
this.onBuddyChangeStatusMessage=function(c,b,d){this.markRedraw()
};
this.onBuddyChangeAway=function(c,b,d){this.toggleHeaderClassName(d,"away");
this.markRedraw()
};
this.onBuddyChangeBusy=function(d,c,b){this.toggleHeaderClassName(b,"away");
this.markRedraw()
};
this.onBuddyChangeIdle=function(d,b,c){this.toggleHeaderClassName(c,"idle");
this.markRedraw()
};
this.destroy=function(){for(var b in this.m_subscriptions){gPubSub.unsubscribe(this.m_extra,b,this)
}}
});
Class("meeboApp.ChatRow",ui.TreeNode,function(a){this.initialize=function(b,c){a(this,"initialize",[c]);
this.subscribe("Activate",this,"onActivate");
this.m_extra=b;
this.m_className+=" roomRow";
this.m_subscriptions={"meebo.IMObject::changeOnline":"markRedraw","meebo.IMObject::changeAlias":"markRedraw"};
gPubSub.subscribeAll(this.m_extra,this,this.m_subscriptions)
};
this.getHeaderHTMLString=function(){return'<span class="img">'+(ui.isSafari||ui.isOpera?"&nbsp;":"")+'<div class="img" style="background-image: url('+gImages.getPath()+this.getImage()+');"></div></span><span class="name">'+escapeHTML(this.m_extra.getAlias())+"</span>"
};
this.getImage=function(){var c=this.m_extra;
var b="chats_logo_tiny";
if(!c.isOnline()){b+="_grayed.gif"
}else{var d=c.hasNewMessage()&&!c.isInChat();
b+=".gif"
}return b
};
this.getStatusText=function(){var c=this.m_extra;
var f=c.getCount();
var h=(f==1?gLang.onePerson:sprintf(gLang.multiPerson,f));
if(c.m_lastMsg>0){var g=(Math.floor(new Date().getTime()/1000))-c.m_lastMsg;
var k=Math.floor(g/86400);
var b=Math.floor(g/3600);
var d=Math.floor(g/60);
var e="";
if(k>0){e=k==1?gLang.lastMsgDayAgo:sprintf(gLang.lastMsgDaysAgo,k)
}else{if(b>0){e=b==1?gLang.lastMsgHourAgo:sprintf(gLang.lastMsgHoursAgo,b)
}else{if(d>0){e=d==1?gLang.lastMsgMinuteAgo:sprintf(gLang.lastMsgMinutesAgo,d)
}else{e=gLang.lastMsgLessMinuteAgo
}}}if(e){h+=", "+e
}}return h
};
this.onActivate=function(){meeboApp.joinRoom(this.m_extra);
gNetworkMgr.doUILog("buddylistdlg","roomrow","launch"+(this.m_extra.m_isPersonal?"-personal":""),true)
};
this.destroy=function(){for(var b in this.m_subscriptions){gPubSub.unsubscribe(this.m_extra,b,this)
}}
});
Class("meeboApp.imGroupRow",ui.TreeNode,function(a){this.initialize=function(b,c){a(this,"initialize",[c]);
this.m_extra=b;
this.m_bToggleHandle=true;
this.m_headerClassName+=" toggle-open"
};
this.createContent=function(){this.setToggled(gPrefs.getPref("gn:"+this.getExtra().getName(),false));
a(this,"createContent",arguments)
};
this.getText=function(){var b=this.m_extra.getBuddies({online:true});
return this.m_extra.getName()+" ("+b.length+"/"+b.totalLength+")"
};
this.dropHandle=function(c){if(typeof c!="object"){return
}var f=this.getExtra();
var e=f.getName();
var d=[];
for(var g in c){if(c[g].getType()!="buddy"&&c[g].getType()!="chat"){continue
}var b=c[g].getExtra();
if(b.hasGroup(f)||!b.getNetwork().supports("groups")){continue
}d.push(b)
}if(d.length){runInMainContext(gNetworkMgr,gNetworkMgr.requestMoveBuddy,hitch(gNetworkMgr,"receiveAddBuddy"),d,e);
return true
}};
this.dropHover=function(b){this.highlight(b)
}
});
Class("meeboApp.groupChatRow",ui.TreeNode,function(a){this.initialize=function(c,b){a(this,"initialize");
this.m_className+=" ImGroupChatRow";
this.m_indentation=0;
this.m_presence=b;
this.m_extra=c;
this.m_text=this.m_presence.getAlias();
this.m_badgeImg;
this.m_badgeSrc=null;
this.m_timeoutId=0;
this.m_id=this.generateId();
this.m_colors=["#D35900","#cccc00","#cc00cc","#00cccc","#00cc00","#cc0000","#0000cc","#000000","#88cc00","#00cc88","#cc0088","#f84","#f08","#44f","#f80","#08f"];
this.setColor()
};
this.createContent=function(){a(this,"createContent",arguments);
cacheImgs(this.getHeader());
this.updateBadgeImage()
};
this.getHeaderHTMLString=function(){return'<img path="'+this.getImage()+'" height="20" width="20" class="BuddyIcon" align="top" png="true"			><span class="label">'+escapeHTML(this.getText())+"</span>"
};
this.getPresence=function(){return this.m_presence
};
this.setExtra=function(b,c){this.m_presence=c;
this.m_extra=b;
this.setId(this.generateId());
this.setColor();
this.setText(this.getPresence().getAlias());
this.updateImage();
this.updateBadgeImage()
};
this.updateBadgeImage=function(){var b=null;
if(this.m_presence.isMuted()){b="muted.gif"
}else{if(this.m_presence.isOwner()||this.m_presence.isSubModerator()){b="moderator.gif"
}}if(this.m_badgeSrc==b){return
}this.m_badgeSrc=b;
if(b==null){removeElement(this.m_badgeImg)
}else{if(!this.m_badgeImg){this.m_badgeImg=createImg(this.m_id+"-badge",this.m_element,12,12,b,null,true);
this.m_badgeImg.className="BuddyBadge"
}else{gImages.requestImage(b,this.m_badgeImg)
}this.getHeader().appendChild(this.m_badgeImg)
}};
this.getColor=function(){return this.m_color
};
this.setColor=function(){var c=this.m_extra,b=c.getName();
for(var d=0,e=0;
d<b.length;
d++){e+=b.charCodeAt(d)
}this.m_color=this.m_colors[b==c.isYourself()?0:e%this.m_colors.length]
};
this.isPending=function(){return this.m_presence.isPending()
};
this.setPending=function(b){this.m_presence.setPending(b);
this.updateFont();
this.updateImage();
if(!b){if(this.m_timeoutId){clearTimeout(this.m_timeoutId)
}}else{this.m_timeoutId=setTimeout(hitch(this,"updateImage",true),30000)
}};
this.updateImage=function(b){gImages.requestImage(this.getImage(b),this.getHeader().firstChild)
};
this.getImage=function(e){var d=this.m_extra;
var c=this.m_presence;
var b="";
if(c.isPending()){if(!e){b+="miniwait_mid.gif"
}else{b+="miniwait_midstill.gif"
}}else{if(c.isMuted()){b+="blocked_logo_small.gif"
}else{if(d.getIconURL()){b=d.getIconURL()
}else{if(d.getNetwork()=="meebome"){b+="meebome_logo_"+(c.isOnline()?"bg":"off")+"_rooms.png"
}else{b+="network/"+d.getNetwork()+"_20_"+(c.isOnline()?"online":"offline")+".png"
}}}}return b
};
this.setText=function(b){this.m_text=b;
var c=this.getHeader().getElementsByTagName("span")[0];
if(c){setText(c,b)
}};
this.updateFont=function(b){this.toggleHeaderClassName(b,"showFeedback");
this.toggleHeaderClassName(this.m_presence.isPending(),"pending");
this.toggleHeaderClassName(!this.m_presence.isOnline(),"offline");
this.getHeader().style.color=this.m_presence.isOnline()?this.m_color:"gray"
};
this.generateId=function(){var b=this.m_presence.getChat();
return(b?b.getId():getUniqueId())+"-"+this.m_extra.getId()
}
});
Class("meeboApp.groupChatRoomRow",ui.TreeNode,function(a){this.initialize=function(d,c){a(this,"initialize");
this.m_className+=" ImGroupChatRoomRow";
this.m_indentation=0;
this.m_roomSize=c;
this.m_extra=d;
var b=d.split("___spill___");
this.m_spillNum=parseInt(b[1]);
this.m_text="  "+b.shift()+" #"+b.shift()+"   ("+this.m_roomSize+")";
this.m_id=this.generateId();
this.m_timeoutId=0;
this.m_presence=null;
this.m_colors=["#D35900","#cccc00","#cc00cc","#00cccc","#00cc00","#cc0000","#0000cc","#000000","#88cc00","#00cc88","#cc0088","#f84","#f08","#44f","#f80","#08f"];
this.setColor()
};
this.createContent=function(b){a(this,"createContent",arguments);
cacheImgs(this.getHeader());
this.updateFont()
};
this.getHeaderHTMLString=function(){return'<img path="'+this.getImage()+'" height="20" width="20" class="BuddyIcon" align="top" png="true"			><span class="label">'+escapeHTML(this.getText())+"</span>"
};
this.getColor=function(){return this.m_color
};
this.setColor=function(){this.m_color=this.m_colors[this.m_spillNum%this.m_colors.length]
};
this.updateImage=function(b){gImages.requestImage(this.getImage(b),this.getHeader().firstChild)
};
this.getImage=function(){var b="chats_logo_small.gif";
return b
};
this.setText=function(b){this.m_text=b;
var c=this.getHeader().getElementsByTagName("span")[0];
if(c){setText(c,b)
}};
this.generateId=function(){return this.m_extra
};
this.updateFont=function(b){this.toggleHeaderClassName(b,"showFeedback");
this.getHeader().style.color=this.m_color
}
});
Class("meeboApp.imDlg",ui.dlg,function(a){this.initialize=function(b){a(this,"initialize");
this.control="imdlg";
this.m_resizeTimerLength=75;
this.m_minHistoryH=(ui.isIE)?18:20;
this.m_minGroupChatHistoryH=250;
this.m_minHistoryW=185;
this.m_minMediaW=200;
this.m_fontbarH=25;
this.m_marginWidths=20;
this.m_statusH=15;
this.m_vertSliderSize=3;
this.m_horzSliderSize=4;
this.m_minMessageH=(ui.isIE)?20:18;
this.m_wbrCount=8;
this.m_minX=this.m_minHistoryW;
this.m_minY;
this.setImObject(b);
this.m_applicationRoom=null;
this.m_buddy=null;
this.m_groupChatId=null;
this.m_isMeebome=b.isMeebome();
this.m_prevSystemMsg;
this.m_bBlock=!b.m_bBlocked;
var c=gPrefs.getPref("font");
this.m_bBold=c.bBold;
this.m_bItalics=c.bItalics;
this.m_bUnderline=c.bUnderline;
this.m_fontSize=c.size;
this.m_fontColor=c.color;
this.m_greyText="#677788";
this.m_fontType=this.m_defaultFontType=c.type;
this.m_topToolbar;
this.m_topToolbarH=30;
this.m_topToolbarType="";
this.m_fontbar;
this.m_mediaList=null;
this.m_pendingMedia={};
this.m_loadedMedia={};
this.m_bannedMedia={};
this.m_mediaQueue=[];
this.m_sliderTop;
this.m_sliderBottom;
this.m_message;
this.m_history;
this.m_inviteMenu;
this.m_contentHeight=0;
this.m_contentWidth=0;
this.m_buddyListContextMenu;
this.m_buddyList;
this.m_trees={};
this.m_buddyListW=110;
this.m_buddyListSlider;
this.m_buddyListSliderImage;
this.m_guestGroup;
this.m_memberGroup;
this.m_groupBuddies;
this.m_buddyListMinW=99;
this.m_isMorphing=false;
this.m_bGroupChatOffline=false;
this.m_bGroupChatHidden=true;
this.m_viewChatLogLink=null;
this.m_bMediaResize=false;
this.m_bMediaDrag=false;
this.m_historyMediaRatio=0.5;
this.m_lastMediaWidth=0;
this.m_historyMediaSlider=null;
this.m_historyMediaSliderImage=null;
this.m_appAreaW=300;
this.m_minGroupChatMediaW=100;
this.m_maxGroupChatHistoryLines=150;
this.m_mediaPlayer=null;
this.m_mediaContainer=null;
this.m_mediaAd=null;
this.m_bAdShowing=false;
this.m_initialMediaItems=[];
this.m_bMediaRequested=false;
this.m_bMediaPlayerLoading=false;
this.m_bPlayerFocused=true;
this.m_chatInfoW=280;
this.m_chatInfoDescrW=210;
this.m_chatInfoH=50;
this.m_chatInfoMargin=8;
this.m_chatImg=null;
this.m_chatImgMargin=20;
this.m_mediaCreateTimeoutId=null;
this.m_mediaChangeTimeoutId=null;
this.m_trackingPixel=null;
this.m_platformUpsell=null;
this.m_platformUpsellType="none";
this.m_alreadyLoggedToggle=false;
this.m_appArea=null;
this.m_appList=null;
this.m_appOverlay=null;
this.m_appFrame=null;
this.m_appBar=null;
this.m_appBarHeight=28;
this.m_appLoadingOverlay=null;
this.m_appLoadingTimeoutId=null;
this.m_appLoadingTimeoutSec=20;
this.m_acceptAppLinks={};
this.m_animationAppArea=new ui.Animation({transition:ui.Animation.easeInOut,duration:400});
this.m_animationResizeAppArea=new ui.Animation({transition:ui.Animation.easeInOut,duration:400});
this.m_animationBuddyListArea=new ui.Animation({transition:ui.Animation.easeInOut,duration:400});
this.m_toggleDlgStartWidth=0;
this.m_toggleDlgStartHeight=0;
this.m_dlgStartWidth=0;
this.m_dlgStartHeight=0;
this.m_appAreaStartWidth=0;
this.m_appAreaStartHeight=0;
this.m_appAreaWidthDelta=0;
this.m_appAreaHeightDelta=0;
this.m_toggleGroupChatCallback=null;
this.m_isAppResizeLeft=false;
this.m_isAppResizeTop=false;
this.m_buddyListWidthDelta=0;
this.m_chatTitle=null;
this.m_chatDescription=null;
this.m_mediaHelp=null;
this.m_mediaHelpText=null;
this.m_bSync=true;
this.m_installFlashLink="<a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank' dontExpand='true'>";
this.m_bOffline=false;
this.m_temporaryRows={};
this.m_buddyBoldId={};
this.m_status;
this.m_overlay;
this.m_inputDiv;
this.m_inputPromptInput;
this.m_bBuddyIconTimerOverride=false;
this.m_buddyIconTimer;
this.m_buddyIconSrc;
this.m_buddyIcon;
this.m_buddyIconFloater;
this.m_maxBuddyIconW=50;
this.m_maxBuddyIconH=50;
this.m_scrollTimerInterval=80;
this.m_buddyIconTimerOverride;
this.m_resizeTimer=-1;
this.m_resizeTimerStart;
this.m_chatBtn;
this.m_profBtn;
this.m_addBtn;
this.m_blockBtn;
this.m_groupBtn;
this.m_popBtn;
this.m_inviteBtn;
this.m_time=0;
this.m_typingT=0;
this.m_typingTimer;
this.m_bHistoryAtBottom=false;
this.m_bRenamingBuddy=false;
this.m_isShowingPasswordPrompt=false;
this.m_isShowingAliasPrompt=false;
this.m_clickedMedia={};
this.m_shares={};
gPubSub.subscribe("meebo.LogonMgr::meeboUserLogon",this,"updateTopToolbar");
gPubSub.subscribe("meebo.BuddyList::addBuddyToGroup",this,"onBuddyChangeGroup");
gPubSub.subscribe("meebo.BuddyList::removeBuddyFromGroup",this,"onBuddyChangeGroup");
gPubSub.subscribe("ui.drag::startResize",this,"showAppIFrameOverlay");
gPubSub.subscribe("ui.drag::startMove",this,"showAppIFrameOverlay");
gPubSub.subscribe("ui.drag::stopResize",this,"hideAppIFrameOverlay");
gPubSub.subscribe("ui.drag::stopMove",this,"hideAppIFrameOverlay");
gPubSub.subscribe("meebo.ApplicationMgr::updateFavorites",this,"updateAppBar");
this.addOnMoveToTop(this,"onMoveToTop")
};
this.doSubscribe=function(c,f){if(!c||!this.m_element){return
}var e={"meebo.IMObject::changeOnline":"onBuddyChangeOnline","meebo.IMObject::changeAlias":"onBuddyChangeAlias","meebo.IMObject::changeIcon":"onBuddyChangeIcon","meebo.IMObject::changeInfo":"onBuddyChangeInfo","meebo.Buddy::changeMobile":"onBuddyChangeMobile","meebo.Buddy::changeBusy":"updateIMStatus","meebo.Buddy::changeAway":"updateIMStatus","meebo.Buddy::changeIdle":"updateIMStatus","meebo.Buddy::changeTyping":"updateIMStatus","meebo.Buddy::changeStatusMessage":"updateIMStatus","meebo.Chat::changeChatId":"onChatChangeChatId","meebo.Chat::addPresence":"onChatAddPresence","meebo.Chat::error":"onChatError","meebo.Room::changeWidgetHash":"updateTopToolbar","meebo.Room::sync":"handleSync","meebo.Room::changeModeratedUrls":"onRoomChangeModeratedUrls","meebo.Room::addMember":"onRoomAddMember","meebo.Room::invite":"onRoomInvite","meebo.ApplicationRoom::receiveIMMsg":"onReceiveAppIMMsg"};
var d=gPubSub[f?"subscribe":"unsubscribe"];
for(var b in e){d.call(gPubSub,c,b,this,e[b])
}};
this.getImObject=function(){return this.m_imobject
};
this.setImObject=function(c){if(this.m_imobject==c){return
}if(this.m_applicationRoom!=this.m_imobject){this.doSubscribe(this.m_imobject,false)
}if(this.m_imobject&&this.m_imobject.getType()=="buddy"){this.stopBuddyMessageFeedback()
}if(this.m_applicationRoom!=c){this.doSubscribe(c,true)
}if(this.getBody()){removeClassName(this.getBody(),this.control+"-"+this.m_imobject.getType());
addClassName(this.getBody(),this.control+"-"+c.getType())
}var b=this.m_imobject;
this.m_imobject=c;
if(this.m_createFnc){this.m_createFnc.a[0]=c
}if(b&&this.isGroupChat()&&this.m_imobject.getChatId()&&(this.m_imobject.constructor!=meebo.ApplicationRoom||this.m_applicationRoom)){this.onJoinGroupChat(this.m_imobject)
}if(this.m_imobject.getType()=="buddy"){this.m_imobject.requestOnMeeboStatus()
}};
this.getApplicationRoom=function(){return this.m_applicationRoom
};
this.setApplicationRoom=function(b){if(this.m_applicationRoom==b){return
}if(this.m_imobject!=this.m_applicationRoom){this.doSubscribe(this.m_applicationRoom,false)
}if(this.m_imobject!=b){this.doSubscribe(b,true)
}this.m_applicationRoom=b
};
this.getApplicationId=function(){var b=this.getApplicationRoom();
var c=b&&b.getApplication();
return(c&&c.app_id)
};
this.setId=function(b){gWindowMgr.reregisterWindow(this.m_id,b);
a(this,"setId",arguments)
};
this.isMeeboGroupChat=function(){return this.m_imobject.getType()=="chat"
};
this.isProtocolGroupChat=function(){return this.m_imobject.getType()=="protocolchat"
};
this.isGroupChat=function(){return this.isMeeboGroupChat()||this.isProtocolGroupChat()
};
this.isFlashInstalled=function(){return gFlashVersion.major>=8
};
this.isMediaFlaggable=function(){var b=this.m_imobject;
return !b.isModeratedUrls()||(b.isModeratedUrls()&&b.getYourself()&&b.getYourself().isOwner())
};
this.addToMediaBarDlgs=function(){gGallery.addWindowOnTop(this)
};
this.getSafeProtocol=function(b){if((b=="aim")&&meebo.util.isICQ(this.m_imobject.getName())){return"icq"
}return b
};
this.getIMChannels=function(){if(this.m_applicationRoom&&this.m_buddy&&this.m_applicationRoom.isGuestOnly()){var b=[this.m_applicationRoom,this.m_buddy]
}else{var b=[this.m_buddy||this.m_imobject]
}return b
};
this.sendIM=function(h){if(!this.m_message){return
}if(!stripWhitespace(this.m_message.getText())){this.m_message.clear();
return
}if(this.isMeeboGroupChat()&&!this.m_applicationRoom){var k=this.m_imobject.getLogin();
if(!gLogon.getMeeboUser()&&!k.isUserSpecifiedAlias()){this.showAliasPrompt(hitch(this,"sendIM",h));
return
}}var b=this.getIMChannels();
var l=[];
var c=escapeHTML(this.m_message.getText(),true);
c=c.replace(/\r\n/g,"<br>").replace(/\n/g,"<br>");
var m=this.m_message.formatMessage(c);
this.m_message.clear();
eventlog("imDlg sendIM setFocus");
if(gPrefs.getPref("audioSend")||(!gPrefs.getPref("audioSend")&&!gPrefs.getPref("audioReceive")&&!gSounds.isMuted())){gSounds.playSample("send")
}try{var d=/(^|[^'\"])(\bhttps?:\/\/[^\s\"\<\>)]+)/ig,f=null;
while(f=d.exec(c)){this.logShare(f[2])
}}catch(g){gNetworkMgr.doUILog(this.control,"exception",true,true)
}this.m_shares={};
this.addHistoryIM(this.m_imobject.getUser(),c);
if(b.length>1){gNetworkMgr.requestMultiSend(b,m)
}else{this.sendIMRequest(m,h,b[0])
}gPubSub.publish(this,"meeboApp.imDlg::sendIM",h);
this.m_typingT=0;
clearTimeout(this.m_typingTimer);
this.m_typingTimer=null
};
this.logShare=function(b){var c=meebo.util.getMeeboShareLink(b);
meebo.util.createTrackingPixel({component:"imDlg",type:"share",shareId:c||"link",fromMenu:(b in this.m_shares)},this.m_imobject.getLogin(),this.m_imobject)
};
this.verifyIMRequest=function(c,b){if(!b){if(c&&(c.msg!=this.m_prevSystemMsg)){this.addHistoryIM(gLang.meeboMessage,c.msg||gLang.imBuddyErrorHeader,true,true);
if(!(/unable to send message/i).test(c.msg)){this.m_prevSystemMsg=c.msg
}}}else{this.m_prevSystemMsg="";
if(this.isMeeboGroupChat()){this.m_imobject.setLastMsg()
}}};
this.sendIMRequest=function(f,e,b){b=b||this.m_imobject;
var c={sender:b.getUser(),receiver:b.getName(),protocol:b.getProtocol(),msg:f,mt:e};
var d=b.getChatId&&b.getChatId();
if(d){c.ch=d
}gNetworkMgr.doRequest("send",c,hitch(this,"verifyIMRequest"));
if(this.m_imobject.updateActivityTime){this.m_imobject.updateActivityTime()
}};
this.onBuddyChangeOnline=function(c,b,d){if(c.getType()!="buddy"){return
}if(this.isVisible()&&c.getLogin().isOnline()&&c.getWentOnlistTime()&&new Date().getTime()-c.getWentOnlistTime()>2000){this.addHistoryIM(gLang.meeboMessage,c.getOnlineStatus(),true,true)
}this.updateIMStatus()
};
this.onBuddyChangeGroup=function(d,b,c,e){if(this.m_imobject!=c){return
}this.updateTopToolbar();
this.updateIMStatus()
};
this.onPresenceChangeAlias=function(d,c,e,b){this.updateRow(this.m_trees[d.getBuddy().getId()]);
this.addHistoryIM(gLang.meeboMessage,sprintf(gLang.isNowKnownAs,escapeHTML(b),escapeHTML(e)),true,true)
};
this.onPresenceChangeModerator=function(d,c,b,e){this.updateRow(this.m_trees[d.getBuddy().getId()]);
gNetworkMgr.requestSpilloverRooms(hitch(this,"populateSpilloverRooms"),this.m_imobject.getChatName())
};
this.onBuddyChangeMobile=function(c,b,d){this.updateIMStatus();
if(this.isVisible()){this.addHistoryIM(gLang.meeboMessage,c.getOnlineStatus(),true,true)
}};
this.onBuddyChangeIcon=function(c,b,d){this.updateBuddyIcon(d);
this.updateBuddyIconPosition(this.isHistoryAtBottom())
};
this.onBuddyChangeAlias=function(c,b,d){if(c!=this.m_imobject){return
}this.setWindowCaption();
this.updateIMStatus();
if(this.m_chatTitle){this.m_chatTitle.setText(c.getAlias())
}};
this.onBuddyChangeInfo=function(c,b,d){if(this.isMeeboGroupChat()){this.updateChatInfo()
}};
this.onChatChangeChatId=function(c,b,d){if(this.isGroupChat()){this.setOffline(!d)
}if(d){this.onJoinGroupChat(c)
}else{if(c.constructor==meebo.ApplicationRoom){if(!this.isGroupChat()){if(this.getApplicationRoom()==c){this.addHistoryIM(gLang.meeboMessage,gLang.errorInApp,true,true)
}this.toggleAppArea(false)
}}}};
this.onJoinGroupChat=function(b){var d=b.getChatId();
if(!d||this.m_applicationRoom){return
}this.registerGroupChat(d);
if(this.isMeeboGroupChat()){this.clearOverlay();
this.updateTopToolbar();
gNotice.checkProbation();
if(b.getInvites()){var c=b.getInvites();
this.inviteBuddies(c.invitees,true,"roomCreateDlg",c.msg,c.msgIdx);
b.setInvites(null)
}}else{this.clearBuddyIcon();
this.setWindowCaption();
this.showGroupChat(d)
}};
this.onChatAddPresence=function(c,b,e){var d=e.getBuddy();
gPubSub.subscribe(e,"meebo.Presence::changeOnline",this,"onPresenceChangeOnline");
if(!this.m_applicationRoom||!meeboApp.platform.isStarted(this.m_applicationRoom.getChatName())){return
}var f=this.m_applicationRoom.getInvites();
if(f){this.m_applicationRoom.clearInvites();
this.inviteBuddies(f.invitees,false,"onstart")
}};
this.onChatError=function(c,b,e){var h="";
var d=c.constructor==meebo.ApplicationRoom;
var g={notAvailable:d?gLang.errorApplicationNotAvailable:gLang.errorRoomNotAvailable,full:d?gLang.errorApplicationFull:gLang.errorRoomFull};
switch(e){case"noexist":h=g.notAvailable;
break;
case"full":h=g.full;
break;
case"empty":h=g.notAvailable;
break;
default:h=g.notAvailable;
break
}var f=c.constructor==meebo.Room;
if(f){gWindowMgr.createNotifyDlg({id:getUniqueId(),caption:gLang.error,parent:this},h);
return
}if(this.isAppAreaVisible()){this.initAppLoadingOverlay(h,null,true)
}else{this.addHistoryIM(gLang.meeboMessage,h,true,true)
}};
this.onRoomChangeModeratedUrls=function(d,b,c){if(this.m_applicationRoom){return
}this.initMediaPlayer();
this.initMediaHelpText(c?"":gLang.pasteAURLInConv)
};
this.onRoomAddMember=function(e,b,d){var c=d.getPresence(e);
if(c){this.moveBuddy(c)
}};
this.onRoomInvite=function(d,b,c){if(d.constructor==meebo.ApplicationRoom&&d.getApplication()){this.addAppUserInvite(c);
meeboApp.platform.invite(d.getChatName(),{alias:c.getAlias()})
}this.addBuddy(c,true)
};
this.onPresenceChangeOnline=function(c,o,h){var p=this.m_applicationRoom||this.m_imobject,g=c.getBuddy();
var e=(p.getType()=="chat"&&!g.isMeeboUser()&&(c.getAlias()==g.getName().split("@")[0]||g.isWidgetUser()));
var n=this.m_trees[g.getId()];
if(h){if(this.getApplicationRoom()){g.setAlias(c.getAlias());
if(g.isYourself()){g.getLogin().setAlias(c.getAlias())
}else{if(!this.m_buddy&&this.m_imobject.constructor!=meebo.ApplicationRoom){t