/*1326843843,176832698*/ if (window.CavalryLogger) { CavalryLogger.start_js(["e5oTb"]); } __d("AvailableListConstants",[],function(c,e,f,d,b){var a={ON_AVAILABILITY_CHANGED:'buddylist/availability-changed',ON_UPDATE_ERROR:'buddylist/update-error',ON_UPDATED:'buddylist/updated',ON_INTERFACES_CHANGED:'interfaces-changed',OFFLINE:0,IDLE:1,ACTIVE:2,MOBILE:3,LEGACY_OVERLAY_OFFLINE:-1,LEGACY_OVERLAY_ONLINE:0,LEGACY_OVERLAY_IDLE:1,legacyStatusMap:{'0':2,'1':1,'-1':0,'2':3},reverseLegacyStatusMap:{0:-1,1:1,2:0,3:2}};window.AvailableListConstants=d.exports=a;},3); __d("ChatConfig",["ChatConfigInitialData","copyProperties"],function(f,h,i,g,e){var b=h('ChatConfigInitialData');var d=h('copyProperties');var c={};var a=g.exports={get:function(k,j){return k in c?c[k]:j;},set:function(j){if(arguments.length>1){var k={};k[j]=arguments[1];j=k;}d(c,j);},getDebugInfo:function(){return c;}};a.set(b);},3); __d("PresenceUtil",["Cookie","Env","math-extensions","tx"],function(f,h,i,g,e){var a=h('Cookie');var b=h('Env');var c=h('math-extensions');f.tx=h('tx');var d=c.rand32()+1;f.PresenceUtil=g.exports={checkMaintenanceError:function(j){if(j.getError()==1356007)return true;return false;},getErrorDescription:function(j){var l=j.getError();var k=j.getErrorDescription();if(!k)k="An error occurred.";if(l==1357001)k="Your session has timed out. Please log in.";return k;},getSessionID:function(){return d;},hasUserCookie:function(){return b.user===a.get('c_user');}};},3); __d("dcode",[],function(d,f,g,e,c){var a,h={},b={_:'%',A:'%2',B:'000',C:'%7d',D:'%7b%22',E:'%2c%22',F:'%22%3a',G:'%2c%22ut%22%3a1',H:'%2c%22bls%22%3a',I:'%2c%22n%22%3a%22%',J:'%22%3a%7b%22i%22%3a0%7d',K:'%2c%22pt%22%3a0%2c%22vis%22%3a',L:'%2c%22ch%22%3a%7b%22h%22%3a%22',M:'%7b%22v%22%3a2%2c%22time%22%3a1',N:'.channel%22%2c%22sub%22%3a%5b',O:'%2c%22sb%22%3a1%2c%22t%22%3a%5b',P:'%2c%22ud%22%3a100%2c%22lc%22%3a0',Q:'%5d%2c%22f%22%3anull%2c%22uct%22%3a',R:'.channel%22%2c%22sub%22%3a%5b1%5d',S:'%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a',T:'%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a',U:'%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a',V:'%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a',W:'%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a',X:'%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1',Y:'%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a',Z:'%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d% 2c%22bl%22%3a%7b%22ac%22%3a'};(function(){var j=[];for(var i in b){h[b[i]]=i;j.push(b[i]);}j.reverse();a=new RegExp(j.join("|"),'g');})();d.Dcode=e.exports={encode:function(i){return encodeURIComponent(i).replace(/([_A-Z])|%../g,function(k,j){return j?'%'+j.charCodeAt(0).toString(16):k;}).toLowerCase().replace(a,function(j){return h[j];});},decode:function(i){return decodeURIComponent(i.replace(/[_A-Z]/g,function(j){return b[j];}));}};},3); __d("presence-cookie-manager",["Cookie","dcode","JSLogger","json","PresenceInitialData","PresenceUtil","URI"],function(q,s,t,r,p){q.CookieManager=function(){};var a=s('Cookie');var b=s('dcode');var c=s('JSLogger');s('json');var d=s('PresenceInitialData');var e=s('PresenceUtil');var f=s('URI');var o=d.cookieVersion;var h=d.dictEncode;var g='presence';var n={};var k=null;var l=null;var j=c.create('presence_cookie');function i(){try{var data=a.get(g);if(k===data){return l;}else{k=data;l=null;}if(data&&data.charAt(0)=='E')data=b.decode(data.substring(1));if(data){l=JSON.parse(data);return l;}}catch(u){j.warn('getcookie_error');}return null;}function m(){return parseInt(new Date().getTime()/1000,10);}q.presenceCookieManager=r.exports={register:function(v,u){n[v]=u;},store:function(){var u=i();if(u&&u.v&&on){i(w);return;}}t.register('state',f);(function(){var x=t.getSubCookie('state');if(!x){h.debug('null_state');i(f());return;}try{i(x);}catch(w){h.error('load_exception',{e:w.toString()});i(f());}})();r.PresenceState=s.exports={doSync:function(w){if(o)return;if(w){e();}else if(!p)p=e.defer();},registerStateStorer:function(w){m.push(w);},registerStateLoader:f unction(w){l.push(w);},get:function(){return k;},getInitial:function(){return g;}};},3); __d("presence-arbiter-message",[],function(b,d,e,c,a){b.PresenceMessage=c.exports={WINDOW_RESIZED:'presence/window-resized',TAB_CLOSED:'presence/tab-closed',TAB_OPENED:'presence/tab-opened',PRESENCE_UPDATER_READY:'presence/updater-ready',getAppMessageType:function(f,g){return 'presence/app_message:'+f+':'+g;},getArbiterMessageType:function(f){return 'presence/message:'+f;}};},3); __d("PresencePrivacy",["Arbiter","AsyncRequest","ChannelConstants","copyProperties","Env","JSLogger","MercuryRequireEnsure","presence-arbiter-message","PresenceUtil"],function(zf,zn,zo,zh,ze){var a=zn('Arbiter');var b=zn('AsyncRequest');var c=zn('ChannelConstants');var zc=zn('copyProperties');var d=zn('Env');var e=zn('JSLogger');var f=zn('MercuryRequireEnsure');var g=zn('presence-arbiter-message');var i=zn('PresenceUtil');if(zf.PresencePrivacy){zh.exports=zf.PresencePrivacy;}else{var m='/ajax/chat/privacy/settings.php';var n='/ajax/chat/privacy/online_policy.php';var o='/ajax/chat/privacy/visibility.php';var j='friend_visibility';var l='visibility';var k='online_policy';var zg={};var zp;var zj={};var zk;var zd;var zi;var zm=[];var zl=false;function p(){return e.create('blackbird');}var h=zc(new a(),{WHITELISTED:1,BLACKLISTED:-1,UNLISTED:0,ONLINE:1,OFFLINE:0,ONLINE_TO_WHITELIST:0,ONLINE_TO_BLACKLIST:1});function x(zr){var zq;for(zq in zr){var zs=zr[zq];if(zq==d.user){p().error('set_viewer_visibility');throw n ew Error("Invalid to set current user's visibility");}switch(zs){case h.WHITELISTED:case h.BLACKLISTED:case h.UNLISTED:break;default:p().error('set_invalid_friend_visibility',{id:zq,value:zs});throw new Error("Invalid state: "+zs);}}for(zq in zr)zg[zq]=zr[zq];h.inform('privacy-changed');}function y(zq,zs){var zr={};zr[zq]=zs;x(zr);}function za(zq){switch(zq){case h.ONLINE:case h.OFFLINE:break;default:p().error('set_invalid_visibility',{value:zq});throw new Error("Invalid visibility: "+zq);}zp=zq;h.inform('privacy-changed');h.inform('privacy-user-presence-changed');a.inform('chat/visibility-changed',{sender:this});}function z(zq){switch(zq){case h.ONLINE_TO_WHITELIST:case h.ONLINE_TO_BLACKLIST:break;default:throw new Error("Invalid default online policy: "+zq);}zd=zq;h.inform('privacy-user-presence-changed');h.inform('privacy-changed');}function zb(zr,zq){zl=true;zr.send();}function w(zr,zq){zm.push({request:zr,data:zq});if(!zl){next=zm.shift();zb(next.request,next.data);}}function u(zq,zr){var zs=zq.type;if( zs===j){var zu=zr.payload.user_availabilities;h.inform('privacy-availability-changed',{user_availabilities:zu});for(var zt in zq.settings)zj[zt]=zq.settings[zt];}else{if(zs===l){zk=zq.visibility;}else if(zs===k)zi=zq.online_policy;h.inform('privacy-user-presence-response');}p().log('set_update_response',{data:zq,response:zr});}function r(zq,zr){if(zp!==zk)za(zk);if(zd!==zi)z(zi);zc(zg,zj);h.inform('privacy-changed');zm=[];p().log('set_error_response',{data:zq,response:zr});}function s(zq){zl=false;if(zm.length>0){next=zm.shift();zb(next.request,next.data);}}function v(zs,zr){if(i!=null){var zq=zs.getData();zq.window_id=i.getSessionID();zs.setData(zq);}zs.setHandler(u.bind(this,zr)).setErrorHandler(r.bind(this,zr)).setTransportErrorHandler(r.bind(this,zr)).setFinallyHandler(s.bind(this)).setAllowCrossPageTransition(true);return zs;}function q(zs,zq,zr){return v(new b(zs).setData(zq),zr);}function t(zu,zq){var zt=zq.obj;if(zt.viewer_id!=d.user){p().error('invalid_viewer_for_channel_message',{type:zu,data:zq}); throw new Error("Viewer got from the channel is not the real viewer");}if(zt.window_id===i.getSessionID())return;var zr=zt.data;if(zt.event=='access_control_entry'){zr.target_ids.forEach(function(zv){y(zv,zr.setting);zj[zv]=zr.setting;});}else{if(zt.event=='visibility_update'){var zs=!!zr.visibility?h.ONLINE:h.OFFLINE;za(zs);zk=zs;}else if(zt.event=='online_policy_update'){z(zr.online_policy);zi=zr.online_policy;}h.inform('privacy-user-presence-response');}p().log('channel_message_received',{data:zq.obj});}zc(h,{WHITELISTED:1,BLACKLISTED:-1,UNLISTED:0,ONLINE:1,OFFLINE:0,ONLINE_TO_WHITELIST:0,ONLINE_TO_BLACKLIST:1,init:function(zs,zq,zr){zp=zk=zs;zd=zi=zq;zg=zc({},zr);zj=zc({},zr);zl=false;this.inform('initialized',this,a.BEHAVIOR_PERSISTENT);this.inform('privacy-changed');this.inform('privacy-user-presence-changed');p().log('initialized',{visibility:zs,policy:zq});a.inform('chat-visibility/initialized',this,a.BEHAVIOR_PERSISTENT);a.subscribe(g.getArbiterMessageType('privacy_changed'),t.bind(this));a.subscrib e(c.ON_CONFIG,function(zu,zt){var zw=zt.getConfig('visibility',null);if(zw!==null&&typeof(zw)!=='undefined'){var zv=zw?h.ONLINE:h.OFFLINE;za(zv);p().log('config_visibility',{vis:zv});}}.bind(this));a.subscribe('channel/visibility-config',function(zt,zu){var zv=zu?h.ONLINE:h.OFFLINE;if(zv!=zp){za(zv);p().log('config_visibility_old_channel',{vis:zv});}}.bind(this));},setVisibility:function(zt){zk=zp;za(zt);var zq={visibility:zt};var zr={type:l,visibility:zt};var zs=q(o,zq,zr);w(zs,zr);p().log('set_visibility',{data:zq});return zt;},getVisibility:function(){return zp;},setOnlinePolicy:function(zt){zi=zd;z(zt);var zq={online_policy:zt};var zr={type:k,online_policy:zt};var zs=q(n,zq,zr);w(zs,zr);p().log('set_online_policy',{data:zq});return zt;},getOnlinePolicy:function(){return zd;},getFriendVisibility:function(zq){return zg[zq]||h.UNLISTED;},allows:function(zq){if(this.getVisibility()===h.OFFLINE)return false;var zr=this.getOnlinePolicy();return zr===h.ONLINE_TO_WHITELIST?zg[zq]==h.WHITELISTED:zg[zq]!=h.BLACKLI STED;},setFriendsVisibility:function(zu,zy){if(zu.length>0){var zx={};for(var zs=0;zs=m)b.inform(c.ON_UPDATE_ERROR);}function zw(zzn){var zzm=zzn.getPayload();var zzk=zzm.buddy_list;if(!zzk){zv(zzn);return;}v.update(zzm.time);b.updateTime=v.get();zu=0;zzb=false;b.haveFullList=true;if(zzk.mobile_friends!=null)zzh(zzk.mobile_friends);var zzp=zzk.userInfos;if(zzp)w.setMulti(zzp);var zzl=zzk.nowAvailableList;var zzq=[];for(var zzo in zza)if(b.get(zzo)!==b.OFFLINE)zzq.push(zzo);zzq.forEach(function(zzr){z(b.OFFLINE,false);zza[zzr]=b.OFFLINE;});zn=zzk.userIsIdle;zzl&&b.addLegacyAvailableList(zzl);zy={};zx={};if(zzk.newAvailableList){b.presenceData=zzk.newAvailableList;b.haveFullList=true;}if(zzk.interfaces){zl=zzk.interfaces;b.inform(c.ON_INTERFACES_CHANGED,zl);}zzi();zzf();zzj();}function zzg(zzm){if(e.isShutdown()||!i.isOnline()){b._poller.stop();return;}zp=new Date();var zzl=false;if(new Date()-zo>n)zzl=true;zzb=true;var zzk=w.getCachedProfileIDs();zzm.setHandler(zw).setErrorHandler(zv).setOption('suppressErrorAlerts',true).setOption('retries',1).setData({user:j.user, available_user_info_ids:zzk,fetch_mobile:zzl}).setURI(u).setAllowCrossPageTransition(true);}function zc(zzk,zzm){for(var zzl in zzk){var zzo;var zzn;if(zzm){zzo=c.legacyStatusMap[zzk[zzl].ol];zzn=zzk[zzl].s;}else if(!zzk[zzl]){zzo=c.OFFLINE;}else if(zzk[zzl].i){zzo=c.IDLE;}else if(zzk[zzl].m){zzo=c.MOBILE;}else zzo=c.ACTIVE;zb(zzl,zzo,zzm,zzn);}}function zzi(zzk){var zzl=zg(zzk);y.debug('update_poller',zzl);b._poller&&b._poller.setTimePeriod(zzl);}function za(){b.haveFullList=false;zp=0;zo=0;zza={};zx={};zy={};zs={};zze++;zzf();}function zk(){zzi();if(i.isOnline()){b.update();}else za();}function zi(){zzi();if(e.disconnected()){za();}else if(!b.haveFullList)b.update();}function zj(zzl,zzk){zzk.chat_config=h.getDebugInfo();zzk.available_list_debug_info={};b.getAvailableIDs().forEach(function(zzm){zzk.available_list_debug_info[zzm]=b.getDebugInfo(zzm);});zzk.available_list_poll_interval=b._poller&&b._poller.getTimePeriod();}ze(b,{haveFullList:false,get:function(zzk){if(zzk==j.user)return c.ACTIVE;var zzl=c.OFF LINE;if(zzk in zza)zzl=zza[zzk];if(h&&h.get('blackbird')&&!s.allows(zzk))zzl=c.OFFLINE;if(zzl==c.OFFLINE)if(zs[zzk])zzl=c.MOBILE;return zzl;},getInterfaces:function(){return ze({},zl);},isUserIdle:function(){return zn;},isReady:function(){return b.haveFullList;},set:function(zzk,zzm,zzl){zb(zzk,zzm,true,null,zzl);},update:function(){if(new Date()-zpzz){y.debug('update_activity');b.update();}});if(h.get('blackbird')){s.subscribe('privacy-changed',zzf);s.subscribe('privacy-availability-changed',function(zzl,zzk){for(var zzm in zzk.user_availabilities)this.set(zzm,zzk.user_availabilities[zzm]);}.bind(b));s.subscribe('privacy-user-presence-response',b.update);}else a.subscribe('chat/visibility-changed',zk);if(h.get('channel_disconnect_warning')){e.subscribe([e.CONNECTED,e.RECONNECTING,e.SHUTDOWN,e.MUTE_WARNING,e.UNMUTE_WARNING],zi);}else e.subscribe(e.CONNECTED,b.update);zh.AvailableList= zt.exports=b;}); var ChatQuietLinks={silence:function(b){if(ua.firefox()>=4||ua.chrome())var a=Event.listen(document,'mousemove',function(){this._removeLinkHrefs(b);a.remove();}.bind(this));},_removeLinkHrefs:function(d){var c=DOM.scry(d,'a');for(var b=0;bc.get('warning_countdown_threshold_msec')){var zb=$N('a',{href:'#',className:'fbChatReconnectLink'},"Try again");zd=DOM._tx("Unable to connect to chat. {try-again-link}",{'try-again-link':zb});}else if(zc>1000){zd=_tx("Unable to connect to chat. Reconnecting in {seconds}...",{seconds:Math.floor(zc/1000 )});}else zd="Unable to connect to chat. Reconnecting...";return zd;}function i(zd,zb){if(w){clearTimeout(w);w=null;}if(zd===a.SHUTDOWN){f=h(zb);}else if(zd===a.CONNECTED){f=null;}else if(zd===a.RECONNECTING){var zc=zb;f=g(zc);if(zc>1000){if(zc>c.get('warning_countdown_threshold_msec')){if(za){za.remove();za=null;}za=Event.listen(r,'click',function(event){if(CSS.hasClass(event.getTarget(),'fbChatReconnectLink')){a.reconnect();return false;}});}w=setTimeout(bind(null,i,zd,zc-1000),1000,false);}}j();}function j(){var zf=ChatVisibility.isOnline();var zb=false;if(!zf){var zc='fbChatGoOnlineLink';var ze=c.get('blackbird')?"Go online":"available";var zd=$N('a',{href:'#',className:zc},ze);var zg=c.get('blackbird')?DOM._tx("{=Go online} to see who's online to chat.",{'=Go online':zd}):DOM._tx("You are unavailable to chat. Let friends see you as {=available}?",{'=available':zd});DOM.setContent(r,zg);Event.listen(r,'click',function(event){if(CSS.hasClass(event.getTarget(),zc)){if(ChatVisibility.isOnline()){p.error('si debar_go_online_while_online');p.rate('sidebar_go_online_error',c.get('blackbird'));}p.rate('sidebar_go_online',c.get('blackbird'));ChatVisibility.goOnline();return false;}});CSS.addClass(u,'offline');}else{CSS.removeClass(u,'offline');DOM.empty(r);if(a.disconnected()){CSS.addClass(u,'error');DOM.setContent(r,f);}else CSS.removeClass(u,'error');}t();}function k(){if(!ChatSidebar.isVisible()&&n)return;o=false;CSS.hide(u);CSS.removeClass(document.documentElement,'sidebarMode');s.hide();y.getCore().reset();p.rate('sidebar_hide',n);Arbiter.inform('sidebar/hide',ChatSidebar);}function t(){OrderedFriendsList.subscribe('initialized',function(){var zc=ChatSidebar.shouldShowSidebar();CSS.conditionClass(document.documentElement,'sidebarCapable',zc);if(ChatSidebar.isEnabled()&&zc){CSS.setStyle(u,'height',z.y+'px');v();var zb=z.y;$A(u.childNodes).forEach(function(zd){if(zd!==e)zb-=Vector2.getElementDimensions(zd).y;});CSS.setStyle(e,'height',zb+'px');this._maxItems=Math.floor((zb-8)/d);s.setNumTopFriends(this._maxItems) ;y.getData().setMaxResults(this._maxItems);Arbiter.inform('sidebar/resized',ChatSidebar);}else k();n=true;});}function v(){if(ChatSidebar.isVisible())return;o=true;CSS.show(u);CSS.addClass(document.documentElement,'sidebarMode');s.show();p.rate('sidebar_show',n);Arbiter.inform('sidebar/show',ChatSidebar);}function x(){chatOptions.setSetting('sidebar_mode',ChatSidebar.isEnabled());new AsyncRequest('/ajax/chat/settings.php').setHandler(bagofholding).setErrorHandler(bagofholding).setData({sidebar_mode:ChatSidebar.isEnabled()}).setAllowCrossPageTransition(true).send();}return {init:function(zc,zb,zd){ChatSidebar.init=bagofholding;requireLazy(['ChatConfig','ChannelConnection','ChannelConstants','ChatVisibility','PresencePrivacy'],function(zg,ze,zf,zh,zi){c=zg;a=ze;b=zf;ChatVisibility=zh;PresencePrivacy=zi;u=zc;s=zb;y=zd;e=DOM.find(zc,'div.fbChatSidebarBody');r=DOM.find(zc,'div.fbChatSidebarMessage div.message');zb.setScrollContainer(DOM.find(e,'div.uiScrollableAreaWrap'));zb.subscribe(['render','show','hide'],deb ounce(function(){var zj=zb.getRoot();var zk=ScrollableArea.getInstance(zj);zk&&zk.adjustGripper();}));ChatQuietLinks.silence(zc);Event.listen(window,'resize',t);Arbiter.subscribe('chat/option-changed',function(zk,zj){if(zj.name=="sidebar_mode"){l=!!chatOptions.getSetting('sidebar_mode');t();}});zd.subscribe(['respond','reset'],function(zj,zk){if(o)if(zk&&zk.value&&zk.value===zd.getCore().getValue()&&zd.getView().isVisible()){s.hide();}else s.show();});zd.getData().subscribe('beforeQuery',t);a.subscribe([a.CONNECTED,a.SHUTDOWN],i);if(c.get('channel_disconnect_warning')){a.subscribe(a.RECONNECTING,i);a.subscribe([a.MUTE_WARNING,a.UNMUTE_WARNING],j);}Arbiter.subscribe('buddylist-nub/initialized',function(zj,zk){Event.listen(zk.getButton(),'click',function(event){ChatSidebar.enable();return !ChatSidebar.shouldShowSidebar();});});Arbiter.subscribe('chat-options/initialized',function(zj,zk){l=!!zk.getSetting('sidebar_mode');Arbiter.subscribe('chat-visibility/initialized',function(zl){p.rate('sidebar_vis_init',c.ge t('blackbird'));j();Arbiter.subscribe('chat/visibility-changed',j);if(c.get('blackbird'))PresencePrivacy.subscribe('privacy-user-presence-changed',j);Arbiter.inform('sidebar/initialized',ChatSidebar,Arbiter.BEHAVIOR_PERSISTENT);});});});},disable:function(){if(!ChatSidebar.isEnabled())return;l=false;x();k();},enable:function(){if(ChatSidebar.isEnabled())return;l=true;x();t();!function(){if(ChatSidebar.isVisible())y.getCore().getElement().focus();}.defer();},hide:function(){m=true;k();},unhide:function(){m=false;t();},getBody:function(){return e;},getRoot:function(){return u;},getVisibleWidth:function(){return u&&u.offsetWidth||0;},isEnabled:function(){return l;},isViewportCapable:function(){z=Vector2.getViewportDimensions();return z.x>c.get('sidebar.minimum_width');},shouldShowSidebar:function(){return ChatSidebar.isViewportCapable()&&!m&&OrderedFriendsList.getList().length>c.get('sidebar.min_friends')&&!FbDesktopPlugin.shouldSuppressSidebar();},isVisible:function(){return o;},resize:t,toggle:function(){Chat Sidebar.isEnabled()?ChatSidebar.disable():ChatSidebar.enable();}};})(); function VideoEvents(){}Function.mixin(VideoEvents,'Arbiter',{ACTIVATING:'videochat/activating',LOGGING_IN:'videochat/logging_in',GETTING_TOKEN:'videochat/getting_token',CONNECTING:'videochat/connecting',SLOW_CONDITIONS:'videochat/slow_conditions',CALL_INCOMING:'videochat/call_incoming',CALL_CONNECTED:'videochat/call_connected',GOT_CALLEE:'videochat/got_callee',CALL_HANDLED:'videochat/call_handled',CALLEE_ANSWERING:'videochat/callee_answering',FATAL_ERROR:'videochat/fatal_error',CALL_IN_PROGRESS:'videochat/call_in_progress',NOT_AVAILABLE:'videochat/not_available',SERVER_ERROR:'videochat/server_error',ACTIVATE_FAILED:'videochat/activate_failed',ACTIVATE_TIMED_OUT:'videochat/activate_failed_time',WRONG_VERSION_ERROR:'videochat/wrong_version',FATAL_PLUGIN_ERROR:'videochat/plugin_fatality',SILENT_PLUGIN_ERROR:'videochat/plugin_silent_fatality',START_CALL_UI:'videochat/start_call_ui',START_CALL:'videochat/start_call',ANSWER_CALL:'videochat/answer_call',IGNORE_CALL:'videochat/ignore_call',CANCEL_CALL:'videochat/ca ncel_call',INSTALL_STARTED:'videochat/install_started',INSTALL_COMPLETED:'videochat/install_completed',log:function(a){window.console&&console.log&&console.log(a);},warn:function(a){window.console&&console.warn&&console.warn(a);},error:function(a){window.console&&console.error&&console.error(a);}}); var VideoChatPlugin=function(){};Function.mixin(VideoChatPlugin,'Arbiter',{INSTALL_TYPES:{JAVA:0,MANUAL:1},isSupported:function(){var b=ua.windows()&&((ua.ie()>=7&&!ua.ie64())||ua.firefox()>=3.6||ua.chrome()>=5);var a=(ua.osx()>10.4)&&(ua.firefox()>=3.6||ua.chrome()>=5||ua.safari()>=500);return (b||a);},notifyFromApplet:function(b,a){Arbiter.inform(String(b),{args:String(a)});},isInstalled:function(){var a=false;if(VideoChatPlugin.isSupported())if(VideoChatPlugin.usesActiveX()){var c=null;try{c=new ActiveXObject('SkypeLimited.SkypeWebPlugin');a=!!c;}catch(b){}c=null;}else a=VideoChatPlugin._getInstalledVersion();return a;},usesActiveX:function(){return ua.ie()&&ua.windows()&&!ua.opera();},setLogger:function(a){VideoChatPlugin.log=a||bagofholding;},embed:function(a){Bootloader.loadComponents('VideoChatPluginCore',function(){VideoChatPlugin.embed(a);});},remove:bagofholding,_getInstalledVersion:function(){if(!navigator)return null;navigator.plugins.refresh(false);mimeHandler=navigator.mimeTypes['application/sk ypesdk-plugin'];return mimeHandler&&mimeHandler.enabledPlugin;}}); var VideoChatView={RINGTONE_PATH:'/sound/bling.mp3',WINDOW_NAME_COOKIE_KEY:'vcpwn',TARGET_ID_COOKIE_KEY:'vctid',inIncomingCall:false,inOutgoingCall:false,inManualInstall:false,tokens:[],init:function(){VideoChatView.subscribe(VideoEvents.CALL_INCOMING,VideoChatView._onIncomingCall);VideoChatView.subscribe(VideoEvents.START_CALL_UI,function(a,b){if(!VideoChatView.inOutgoingCall){VideoChatView.inOutgoingCall=true;if(VideoChatPlugin.isInstalled()){VideoChatView.onOutgoingCall(b.idTarget);}else VideoChatView._invokeCore('promptInstall',b.idTarget);}});if(VideoChatPlugin.isSupported())CSS.addClass(document.documentElement,'videoCallEnabled');onbeforeunloadRegister(function(){if((VideoChatView.inIncomingCall||VideoChatView.inOutgoingCall)&&!VideoChatView.inManualInstall)return "Leaving this page will end your call.";});onleaveRegister(function(){if(VideoChatView.inIncomingCall||VideoChatView.inOutgoingCall){VideoEvents.inform(VideoEvents.CANCEL_CALL,{cause:'leave:page'});VideoChatView.inIncomingCall=false;VideoCha tView.inOutgoingCall=false;}});VideoChatView._checkPriorState();},subscribe:function(b,a){VideoChatView.tokens.push(VideoEvents.subscribe(b,a));},onProfileButtonClick:function(a){VideoChatView._invokeCore('onProfileButtonClick',a);},unload:function(){while(VideoChatView.tokens.length)VideoEvents.unsubscribe(VideoChatView.tokens.pop());},mightReloadPostInstall:function(){return ua.windows();},_showDialog:function(b,a){new Dialog().setAllowCrossPageTransition(true).setTop(a?85:125).setAsync(new AsyncRequest(b)).show();},_onIncomingCall:function(a,b){VideoChatView.inIncomingCall=true;VideoChatView._showDialog(URI('/ajax/chat/video/incoming_call.php').setQueryData({idTarget:b.idTarget,callId:b.callId}),true);},onOutgoingCall:function(a){VideoChatView.inOutgoingCall=true;VideoChatView._showDialog('/ajax/chat/video/outgoing_call.php?idTarget='+a);},_checkPriorState:function(){if(VideoChatView.mightReloadPostInstall()){var a=getCookie(VideoChatView.WINDOW_NAME_COOKIE_KEY);if(a){clearCookie(VideoChatView.WINDOW_NAME _COOKIE_KEY);var b=getCookie(VideoChatView.TARGET_ID_COOKIE_KEY);if(b){clearCookie(VideoChatView.TARGET_ID_COOKIE_KEY);if(getCookie(VideoChatView.TARGET_ID_COOKIE_KEY))return;if(VideoChatPlugin.isInstalled())VideoChatView.onOutgoingCall(b);}}}},_invokeCore:function(b){var a=Array.prototype.slice.call(arguments,1);Bootloader.loadComponents('VideoChatViewCore',function(){VideoChatView.initCore();VideoChatView[b].apply(VideoChatView,a);});}}; function PresenceIndicator(){}PresenceIndicator.prototype={init:function(b,a,d){this._id=b;this._firstname=a;this._tooltip=d;this._image=DOM.scry(this._tooltip,'i')[0];this._previousAvail=null;this._jslog=JSLogger.create('presence_indicator');Arbiter.subscribe('chat-visibility/initialized',function(e){this._jslog.log('vis_init',e);this._updateVisibility();}.bind(this));this._subscriptions=[Arbiter.subscribe([AvailableListConstants.ON_AVAILABILITY_CHANGED],this._updateAvailability.bind(this)),Arbiter.subscribe(['chat/visibility-changed'],this._updateVisibility.bind(this))];this._updateAvailability.bind(this).defer();var c=Event.listen(this._tooltip,'click',function(){requireLazy(['AvailableList'],function(e){if(this._previousAvail!=AvailableListConstants.OFFLINE)Chat.openTab(this._id);}.bind(this));}.bind(this));onleaveRegister(function(){c.remove();while(this._subscriptions.length)Arbiter.unsubscribe(this._subscriptions.pop());}.bind(this));},_updateAvailability:function(){requireLazy(['AvailableList','ChatC onfig'],function(a,b){if(!a.isReady())return;var e;var d;var c=a.get(this._id);if(c===this._previousAvail)return;this._previousAvail=c;switch(c){case AvailableListConstants.OFFLINE:e=b.get('blackbird')?_tx("{name} is offline",{name:this._firstname}):_tx("{name} is unavailable",{name:this._firstname});d='offline';break;case AvailableListConstants.IDLE:e=_tx("{name} is idle",{name:this._firstname});d='idle';break;case AvailableListConstants.ACTIVE:e=b.get('blackbird')?_tx("{name} is online",{name:this._firstname}):_tx("{name} is available",{name:this._firstname});d='online';break;case AvailableListConstants.MOBILE:e=_tx("{name} is available on mobile",{name:this._firstname});d='mobile';break;default:throw new Error('Invalid availability');}TooltipLink.setTooltipText(this._tooltip,e);CSS.setClass(this._image,d);}.bind(this));},_updateVisibility:function(){requireLazy(['ChatVisibility'],function(a){if(a.isOnline()){CSS.show(this._tooltip);}else CSS.hide(this._tooltip);}.bind(this));}};