/*1306808390,169775811*/

if (window.CavalryLogger) { CavalryLogger.start_js(["xHjln"]); }

var NotificationCounter=(function(){var a={messages:0,notifications:0,requests:0};return {init:function(){Arbiter.subscribe('update_title',this._handleUpdate.bind(this));Arbiter.subscribe('jewel/count-updated',this._handleCountUpdate.bind(this));},getCount:function(){return a.requests+a.messages+a.notifications;},updateTitle:function(){var b=DocumentTitle.get();var c=this.getCount();DocumentTitle.set(c?b+' ('+c+')':b,true);},_handleCountUpdate:function(c,b){a[b.jewel]=b.count;this.updateTitle();},_handleUpdate:function(c,b){this.updateTitle();}};})();
function RenderManager(a){copy_properties(this,{_isDirty:false,_obj:a});}copy_properties(RenderManager.prototype,{dirty:function(){if(!this._isDirty){this._isDirty=true;bind(this,this.doPaint).defer();}},doPaint:function(){this._isDirty=false;this._obj.paint();}});
function CounterDisplay(a,g,h,e,d,b){copy_properties(this,{_name:a,_valueNode:$(g),_wrapperNode:$(h)||null,_statusClass:d,_rm:new RenderManager(this),_arbiterSubscription:null,_count:0});var c=this._valueNode.firstChild;if(c){var f=parseInt(c.nodeValue,10);if(!isNaN(f))this._count=f;}this._statusNode=e?$(e):null;this._subscribeAll();CounterDisplay.instances.push(this);if(!b)onleaveRegister(this._destroy.bind(this),true);}copy_properties(CounterDisplay,{EVENT_TYPE_ADJUST:'CounterDisplay/adjust',EVENT_TYPE_UPDATE:'CounterDisplay/update',instances:[],adjustCount:function(a,b){Arbiter.inform(CounterDisplay.EVENT_TYPE_ADJUST+'/'+a,b);},setCount:function(a,b){Arbiter.inform(CounterDisplay.EVENT_TYPE_UPDATE+'/'+a,b);}});CounterDisplay.mixin({_destroy:function(){delete this._valueNode;delete this._wrapperNode;if(this._arbiterSubscription){Arbiter.unsubscribe(this._arbiterSubscription);delete this._arbiterSubscription;}CounterDisplay.instances.remove(this);},adjustCount:function(a){this._count=Math.max(0,this._count+a);this._rm.dirty();return this;},setCount:function(a){this._count=Math.max(0,a);this._rm.dirty();return this;},paint:function(){DOM.setContent(this._valueNode,this._count);if(this._wrapperNode)CSS.conditionClass(this._wrapperNode,'hidden_elem',this._count<=0);if(this._statusClass&&this._statusNode)CSS.conditionClass(this._statusNode,this._statusClass,this._count>0);},_subscribeAll:function(){var a=[CounterDisplay.EVENT_TYPE_ADJUST+'/'+this._name,CounterDisplay.EVENT_TYPE_UPDATE+'/'+this._name];this._arbiterSubscription=Arbiter.subscribe(a,this._onInform.bind(this),Arbiter.SUBSCRIBE_NEW);},_onInform:function(a,b){b=parseInt(b);if(isNaN(b))return;if(a.indexOf(CounterDisplay.EVENT_TYPE_ADJUST)!=-1){this.adjustCount(b);}else if(a.indexOf(CounterDisplay.EVENT_TYPE_UPDATE)!=-1){this.setCount(b);}else return;return;}});
function MenubarMessageController(b,a){}copy_properties(MenubarMessageController,{ensureInitialized:function(c,b,a){if(MenubarMessageController.initialized||!ge(b))return false;var d=new MenubarMessageController(c,b);MenubarMessageController.instance=d;d.ensureInitialized(c,b,a);MenubarMessageController.initialized=true;}});copy_properties(MenubarMessageController.prototype,{ensureInitialized:function(c,b,a){this.menu=ge(b);var d=[CounterDisplay.EVENT_TYPE_ADJUST+'/messages_unread',CounterDisplay.EVENT_TYPE_UPDATE+'/messages_unread'];Arbiter.subscribe(d,this.onCounterUpdate.bind(this),Arbiter.SUBSCRIBE_NEW);Arbiter.subscribe(PresenceMessage.getArbiterMessageType('messages_seen'),function(){Arbiter.inform('jewel/count-updated',{jewel:'messages',count:0},Arbiter.BEHAVIOR_STATE);});this._dirty=a;this.mouseOverListener=Event.listen($(c),'mouseover',this.doRefetch.bind(this));},doRefetch:function(){if(this._dirty){this._dirty=false;this._fetch();}},_fetch:function(){new AsyncRequest().setURI('/ajax/gigaboxx/endpoint/ListThreads.php').setMethod('GET').setReadOnly(true).setHandler(this.onFetchComplete.bind(this)).setData({folder:'[fb]messages',start:0,limit:5,previews:true}).send();},onFetchComplete:function(a){if(this.menu)DOM.setContent(this.menu,HTML(a.payload));},onCounterUpdate:function(){this._dirty=true;}});
var Jewel={markSeen:function(b,c,a){if(c){CSS.removeClass(a,'jewelNew');if(b=='[fb]messages'){MenubarMessageController.instance.doRefetch();Arbiter.inform('jewel/messages-updated',{jewel:'messages',count:0},Arbiter.BEHAVIOR_STATE);}else if(b=='[fb]requests')Arbiter.inform('jewel/requests-updated',{jewel:'requests',count:0},Arbiter.BEHAVIOR_STATE);new AsyncSignal('/ajax/gigaboxx/endpoint/UpdateLastSeenTime.php',{folder:b}).send();}else if(/requests/.test(b))DOM.scry(a,'li.jewelItemNew').each(function(d){CSS.removeClass(d,'jewelItemNew');});}};
_PERSISTENT_BACKENDS={localstorage:LocalStorage};function LocalStorage(){this._store=window.localStorage;}LocalStorage.available=function(){return window.localStorage?true:false;};copy_properties(LocalStorage.prototype,{keys:function(){var b=[];for(var a=0;a<this._store.length;a++)b.push(this._store.key(a));return b;},get:function(a){return this._store.getItem(a);},set:function(a,b){this._store.setItem(a,b);},remove:function(a){this._store.removeItem(a);},clear:function(){this._store.clear();}});function CacheStorage(d,b){this._key_prefix=b||'_cs_';this._magic_prefix='_@_';if(d=='AUTO')for(var c in _PERSISTENT_BACKENDS){var a=_PERSISTENT_BACKENDS[c];if(a.available()){d=c;break;}}if(d)if(!_PERSISTENT_BACKENDS[d]){this._backend=null;}else this._backend=new _PERSISTENT_BACKENDS[d]();this._memcache={};}copy_properties(CacheStorage.prototype,{keys:function(){var d=[];if(this._backend){var a=this._backend.keys();for(var b=0;b<a.length;b++)if(a[b].substr(0,this._key_prefix.length)==this._key_prefix)d.push(a[b].substr(this._key_prefix.length));return d;}for(var c in this._memcache)d.push(c);return d;},set:function(b,a){this._memcache[b]=a;if(this._backend){if(typeof a=='string'){a=this._magic_prefix+a;}else a=JSON.stringify(a);this._backend.set(this._key_prefix+b,a);}},get:function(b,c){if(this._memcache[b]!==undefined)return this._memcache[b];var d=undefined;if(this._backend){var d=this._backend.get(this._key_prefix+b);if(d!==null){if(d.substr(0,this._magic_prefix.length)==this._magic_prefix){d=d.substr(this._magic_prefix.length);}else d=JSON.parse(d);this._memcache[b]=d;}else d=undefined;}if(d===undefined&&c!==undefined){d=c;this._memcache[b]=d;if(this._backend){if(typeof d=='string'){var a=this._magic_prefix+d;}else var a=JSON.stringify(d);this._backend.set(this._key_prefix+b,a);}}return d;},remove:function(a){delete this._memcache[a];if(this._backend)this._backend.remove(this._key_prefix+a);}});
function PageCache(a,b){if(this===window)return new PageCache(a,b);this._MAX_PAGE_NUM=typeof a=='undefined'?5:a;this._MAX_TTL=typeof b=='undefined'?600000:b;this._storage=new CacheStorage();}copy_properties(PageCache.prototype,{_normalizeURI:function(a){a=new URI(a);if(a.getPath()=='/')a.setPath('/home.php');return a.getUnqualifiedURI().setFragment('').removeQueryData('ref').toString();},addPage:function(c,b){c=this._normalizeURI(c);var a=this._storage.get(c,{});a.normalized_uri=new URI(c);copy_properties(a,b);a.accessTime=a.genTime=(new Date()).getTime();this._clearCache();},updatePage:function(c,a){c=this._normalizeURI(c);var b=this._storage.get(c);if(typeof b==='undefined')return;copy_properties(b,a);this._storage.set(c,b);},isPageInCache:function(b){var a=this._storage.get(this._normalizeURI(b));return (typeof a!=='undefined');},invalidatePage:function(a){a=this._normalizeURI(a);this._storage.remove(a);},getPage:function(b){this._clearCache();b=this._normalizeURI(b);var a=this._storage.get(b);if(typeof a==='undefined')return null;a.accessTime=(new Date()).getTime();return a;},getPageUris:function(){return this._storage.keys();},_clearCache:function(){var b=(new Date()).getTime();var d=null;var f=0;var a=this._storage.keys();for(var c=0;c<a.length;c++){var h=a[c];var e=this._storage.get(h);var g=e.ttl||this._MAX_TTL;if(e.genTime<b-g){this._storage.remove(h);continue;}if(!d||this._storage.get(d).accessTime>e.accessTime)d=h;f++;}if(f>this._MAX_PAGE_NUM&&d)this._storage.remove(d);}});
var Quickling=window.Quickling||{isActive:function(){return Quickling._is_active||false;},isFeatureEnabled:function(a){return Quickling._capabilities&&Quickling._capabilities[a];},init:function(c,b,a){if(Quickling._is_initialized)return;copy_properties(Quickling,{_is_initialized:true,_is_active:true,_session_length:b,_capabilities:a,_is_in_transition:false,_title_interval:false,_ie_cache_title:'',_cache_hit:false,_version:c});Quickling._instrumentTimeoutFunc('setInterval');Quickling._instrumentTimeoutFunc('setTimeout');PageTransitions.registerHandler(Quickling._transitionHandler,1);if(Quickling.isFeatureEnabled('page_cache')){Quickling._cache=new PageCache();Arbiter.subscribe("pre_page_transition",Quickling._onPrePageTransition);Arbiter.subscribe(Arbiter.NEW_NOTIFICATIONS,Quickling._onNotifications);Arbiter.subscribe(AsyncRequest.REPLAYABLE_AJAX,Quickling._onReplayableAjax);Arbiter.subscribe(Arbiter.PAGECACHE_INVALIDATE,Quickling._onCacheInvalidates);}},_onPrePageTransition:function(b,a){if(Quickling.isFeatureEnabled('page_cache')&&(page=Quickling._cache.getPage(a.from))&&!page.incremental_updates){invoke_callbacks(page.onpagecache);page.refresh_pagelets.forEach(function(c){var d=Quickling._getPageletById(c);d&&d.refresh(true);});page.incremental_updates=AsyncRequest.stashBundledRequest();}},_onNotifications:function(b,a){Quickling._cache=new PageCache();},_onCacheInvalidates:function(c,b){if(Quickling.isFeatureEnabled('page_cache')&&b&&b.length)for(var a=0;a<b.length;a++){if(parseInt(b[a],10)!==0)continue;if(Quickling._cache.isPageInCache(PageTransitions.getMostRecentURI()))break;Quickling._cache=new PageCache();return;}},registerPageCacheHook:function(a,c){if(!Quickling._is_initialized||!Quickling._is_active||Quickling._is_in_transition||!Quickling.isFeatureEnabled('page_cache'))return;var b=PageTransitions.getMostRecentURI();var e=Quickling._cache.getPage(b);if(e){if(c)for(var d=0;d<e.replays.length;d++)if(e.replays[d][0]==c){e.replays.splice(d,1);d--;}e.replays.push([c,a]);}},_onReplayableAjax:function(c,b){if((PageTransitions.getNextURI().toString()!=PageTransitions.getMostRecentURI().toString()))return;if(Quickling._is_in_transition)return;var a=Quickling._whitelist_regex;if(!a)a=Quickling._whitelist_regex=new RegExp(env_get('pagecache_whitelist_regex'));if(a.test(URI(b.getURI()).getPath()))return;Quickling.registerPageCacheHook(bind(b,b.replayResponses),b._replayKey);},_startQuicklingTransition:function(){Quickling._is_in_transition=true;window.channelManager&&window.channelManager.setActionRequest(true);},_stopQuicklingTransition:function(){(function(){Quickling._is_in_transition=false;}).defer();},isCacheHit:function(){return Quickling._cache_hit;},goHashOrGoHere:function(d){var c=URI.getRequestURI();var b=c.getFragment();if(b.startsWith('/')){var a=b;}else var a=d;setTimeout(function(){PageTransitions.go(a,true);},0);},isPageActive:function(e){if(e=='#')return false;e=new URI(e);if(e.getDomain()&&e.getDomain()!=URI().getDomain())return false;var b=Quickling.isPageActive.regex;if(!b)b=Quickling.isPageActive.regex=new RegExp(env_get('quickling_inactive_page_regex'));if(e.getPath()=='/l.php'){var c=e.getQueryData().u;if(c){c=URI(unescape(c)).getDomain();if(c&&c!=URI().getDomain())return false;}}var d=e.getPath();var a=e.getQueryData();if(a)d+='?'+URI.implodeQuery(a);if(b.test(d))return false;return true;},_getPageletById:function(a){return window.__UIControllerRegistry&&window.__UIControllerRegistry[a];},_setHTML:function(a,b){if(ua.ie()<=6){a.innerHTML=b;}else DOM.setContent(a,HTML(b).setDeferred(true));},_transitionHandler:function(h){AjaxPipeRequest.setCurrentRequest(null);if(Quickling._isTimeToRefresh())return false;if(!Quickling.isPageActive(h))return false;window.ExitTime=(new Date()).getTime();removeHook('onafterloadhooks');removeHook('onloadhooks');_runHooks('onleavehooks');Arbiter.inform('onload/exit',true);Quickling._startQuicklingTransition();$('content').style.visibility="visible";var e;if(Quickling.isFeatureEnabled('page_cache')&&(e=Quickling._cache.getPage(h))){var d=null;var f=window.ExitTime;var g=null;var a=new Arbiter();a.registerCallback(function(){if(AjaxPipeRequest.getCurrentRequest()!==d)return;if(d)if(d.cavalry){var i=null;if(g)i=g-f;d.cavalry.setTimeStamp('t_domcontent',null,null,i);d.cavalry.setTimeStamp('t_hooks',null,null,i);d.cavalry.setTimeStamp('t_layout',null,null,i);d.cavalry.setTimeStamp('t_onload',null,null,i);}Quickling._cache_hit=true;invoke_callbacks(e.onafterload);invoke_callbacks(e.onafterpagecache);Quickling._cache_hit=false;Quickling._stopQuicklingTransition();},['pagecache_update','tti_pagecache']);d=AsyncRequest.setBundledRequestProperties({stashedRequests:e.incremental_updates,callback:function(){if(d&&d.cavalry)d.cavalry&&d.cavalry.setTimeStamp('t_html');a.inform('pagecache_update',true,Arbiter.BEHAVIOR_EVENT);},onInitialResponse:function(j){var i=j.getPayload();if(i.redirect&&i.force){return false;}else return true;},extra_data:{uri:e.normalized_uri.getQualifiedURI().toString(),version:Quickling._version},start_immediately:true});var c=$('content');c.style.visibility="hidden";AjaxPipeRequest.setCurrentRequest(d);AjaxPipeRequest.clearCanvas('content');Bootloader.loadResources(e.css.concat(e.js),null,true);Quickling._changePageTitle(e.title);Quickling._replaceSyndicationLinks(e.syndication_links||[]);var b=e.body_class||'';CSS.setClass(document.body,b);e.html=e.html.replace(/<span class=["']?muffin_tracking_pixel_start['"]?><\/span>.*?<span class=["']?muffin_tracking_pixel_end['"]?><\/span>/ig,'');Quickling._setHTML(c,e.html);if(c&&c.style.height=='1234px')c.style.height='';PageTransitions.transitionComplete(true);Quickling._cache_hit=true;invoke_callbacks(e.jscc);invoke_callbacks(e.onload);Quickling._cache_hit=false;e.replays.forEach(function(i){i[1]();});e.refresh_pagelets.forEach(function(i){var j=document.getElementById(i);if(j)j.innerHTML='';});setTimeout(function(){PageTransitions.restoreScrollPosition();$('content').style.visibility="visible";g=(+new Date());a.inform('tti_pagecache',true,Arbiter.BEHAVIOR_EVENT);},20);}else new QuickPipeRequest(h).setCanvasId('content').send();return true;},_changePageTitle:function(a){a=a||'Facebook';DocumentTitle.set(a);if(ua.ie()){Quickling._ie_cache_title=a;if(!Quickling._title_interval)Quickling._title_interval=window.setInterval(function(){var b=Quickling._ie_cache_title;var c=DocumentTitle.get();if(b!=c)DocumentTitle.set(b);},5000,false);}},_replaceSyndicationLinks:function(d){var c=document.getElementsByTagName('link');for(var b=0;b<c.length;++b){if(c[b].rel!='alternate')continue;DOM.remove(c[b]);}if(d.length){var a=DOM.find(document,'head');a&&DOM.appendContent(a,HTML(d[0]));}},cacheResponse:function(g,a,c,f){var e=g.payload;c=c?c:PageTransitions.getNextURI();Quickling._cache.addPage(c,{title:e.title,syndication:e.syndication||[],body_class:e.body_class,html:$("content").innerHTML,js:e.js||[],css:e.css||[],jscc:e.jscc?[e.jscc]:[],onload:e.onload||[],onafterload:e.onafterload||[],refresh_pagelets:e.refresh_pagelets||[],onpagecache:e.onpagecache||[],onafterpagecache:e.onafterpagecache||[],ttl:e.page_cache_ttl,replays:[]});if(f){var d=f.getAllCachedPagelets();for(var b in d)Quickling.cacheAndExecResponse(d[b],c,true);}if(a){invoke_callbacks(e.onload);onafterloadRegister(function(){invoke_callbacks(e.onafterload);});}},cacheAndExecResponse:function(c,b,d){var a=Quickling._cache.getPage(b);if(a){if(c.html)a.html=c.html;c.jscc&&a.jscc.push(c.jscc);a.js=a.js.concat(c.js||[]);a.css=a.css.concat(c.css||[]);a.onload=a.onload.concat(c.onload||[]);a.onafterload=a.onafterload.concat(c.onafterload||[]);a.onpagecache=a.onpagecache.concat(c.onpagecache||[]);a.onafterpagecache=a.onafterpagecache.concat(c.onafterpagecache||[]);a.refresh_pagelets=a.refresh_pagelets.concat(c.refresh_pagelets||[]);}if(!d){invoke_callbacks(c.onload);onafterloadRegister(function(){invoke_callbacks(c.onafterload);});}},_isTimeToRefresh:function(){Quickling._load_count=(Quickling._load_count||0)+1;return Quickling._load_count>=Quickling._session_length;},_instrumentTimeoutFunc:function(a){window[a+'_native']=(function(c){var b=function b(e,d){return c(e,d);};return b;})(window[a]);window[a]=function _setTimeout(d,c,b){var e=window[a+'_native'](d,c);if(c>0)if(b!==false)onleaveRegister(function(){clearInterval(e);});return e;};}};function QuickPipeRequest(b){var a={version:Quickling._version};this.parent.construct(this,b,{quickling:a});}QuickPipeRequest.extend('AjaxPipeRequest');copy_properties(QuickPipeRequest.prototype,{_preBootloadFirstResponse:function(b){var a=b.getPayload();if(Quickling.isFeatureEnabled('page_cache')&&a.page_cache_ttl)this._onPageDisplayed=bind(null,Quickling.cacheResponse,b,false,PageTransitions.getNextURI());DOMScroll.scrollTo(new Vector2(0,0,'document'),false);return true;},_fireDomContentCallback:function(){this._request.cavalry&&this._request.cavalry.setTimeStamp('t_domcontent');Quickling._stopQuicklingTransition();PageTransitions.transitionComplete();this._onPageDisplayed&&this._onPageDisplayed(this.pipe);this.parent._fireDomContentCallback();},_fireOnloadCallback:function(){if(this._request.cavalry){this._request.cavalry.setTimeStamp('t_hooks');this._request.cavalry.setTimeStamp('t_layout');this._request.cavalry.setTimeStamp('t_onload');}this.parent._fireOnloadCallback();},_redirect:function(a){if(a.redirect){if(a.force||!Quickling.isPageActive(a.redirect)){go_or_replace(window.location,URI(a.redirect).removeQueryData(['quickling','ajaxpipe']),true);}else PageTransitions.go(a.redirect,true);return true;}else return false;},_versionCheck:function(a){if(a.version!=Quickling._version){go_or_replace(window.location,URI(a.uri).removeQueryData(['quickling','ajaxpipe']),true);return false;}else return true;},_processFirstResponse:function(c){var b=c.getPayload();Quickling._changePageTitle(b.title);Quickling._replaceSyndicationLinks(b.syndication||[]);var a=b.body_class||'';CSS.setClass(document.body,a);if(b.hasOnbeforeshow)$('content').style.visibility='hidden';}});function onpagecacheRegister(a,b){b=(b===undefined?'':String(b));Quickling.registerPageCacheHook(a,b);}
function NotificationList(a){this.alertIds=[];this.alertsObj={};this.unreadCount=0;this.contentRoot=a;this.noItemsElement=null;this.ITEM_TAG='li';this.ITEM_CLASS='notification';this.NO_ITEMS_ID='jewelNoNotifications';this.NO_ITEMS_CLASS='empty';}copy_properties(NotificationList,{ITEM_UNREAD_CLASS:'jewelItemNew',MARK_READ_TYPE:'mark_read',UNREAD_COUNT_CHANGE_TYPE:'unread_count_change',getIdFromDom:function(a){return parseInt(a.getAttribute('id').replace('notification_',''),10);}});NotificationList.mixin('Arbiter',{reset:function(){for(var a in this.alertsObj)this.remove(a);},fromDom:function(){this.reset();var e=this.ITEM_TAG+'.'+this.ITEM_CLASS;var c=DOM.scry(this.contentRoot,e);for(var d=c.length-1;d>=0;--d){var b=c[d];var a=NotificationList.getIdFromDom(b);this.insert(a,null);}},insert:function(a,b,c){a=parseInt(a,10);if(this.alertsObj[a])if(!(c&&b)){return false;}else this.remove(a);b&&DOM.prependContent(this.contentRoot,HTML(b));this.alertIds.unshift(a);this.alertsObj[a]=$('notification_'+a);if(1==this.size())hide(this.NO_ITEMS_ID);if(this.isUnreadId(a)){this.unreadCount++;this.inform(NotificationList.UNREAD_COUNT_CHANGE_TYPE);}return true;},showNoNotifications:function(){if(null==this.noItemsElement)this.noItemsElement=ge(this.NO_ITEMS_ID);if(null==this.noItemsElement){this.noItemsElement=$N(this.ITEM_TAG,{id:this.NO_ITEMS_ID,className:this.NO_ITEMS_CLASS},_tx("No tienes notificaciones nuevas"));DOM.appendContent(this.contentRoot,this.noItemsElement);}CSS.show(this.NO_ITEMS_ID);},remove:function(b){var a=this.alertsObj[b];if(!this.alertsObj[b])return false;this.markRead([b]);DOM.remove(a);delete this.alertsObj[b];this.alertIds.splice(this.alertIds.indexOf(b),1);if(this.isEmpty())this.showNoNotifications();return true;},getUnreadIds:function(a){var c=[];a=a||this.alertIds;for(var b=0;b<a.length;b++)if(this.isUnreadId(a[b]))c.push(a[b]);return c;},isUnreadId:function(a){var b=this.alertsObj[a];return (b&&CSS.hasClass(b,NotificationList.ITEM_UNREAD_CLASS));},markRead:function(a){a=a?a.filter(this.isUnreadId.bind(this)):this.getUnreadIds();for(var c=0;c<a.length;c++){var b=this.alertsObj[a[c]];b&&this.inform(NotificationList.MARK_READ_TYPE,b);}this.unreadCount-=a.length;a.length&&this.inform(NotificationList.UNREAD_COUNT_CHANGE_TYPE);},markReadNow:function(){var b=this.unreadCount;for(var a in this.alertsObj)CSS.removeClass(this.alertsObj[a],NotificationList.ITEM_UNREAD_CLASS);this.unreadCount=0;this.changed>0&&this.inform(NotificationList.UNREAD_COUNT_CHANGE_TYPE);},insertMany:function(d,e){var f=0;if('object'==typeof d&&!is_empty(d)){if(is_empty(e)){e=[];for(var b in d)e.push(b);e.sort(function(g,h){return h-g;});}for(var a=e.length-1;a>=0;--a){var c=e[a];if(this.insert(c,d[c],true))f++;}}if(0===f&&this.isEmpty()){this.showNoNotifications();}else hide(this.NO_ITEMS_ID);return f;},isEmpty:function(){return 0==this.size();},size:function(){return this.alertIds.length;}});function Notifications(a){this.count=a.count||0;this.countNew=a.countNew||0;this.updateTime=a.updateTime||new Date().getTime();this.user=Env.user;this.cache_version=a.cacheVersion||0;this.allowDesktopNotifications=a.allowDesktopNotifications||false;this.latest_notif_time=a.latestNotif||0;this.latest_read_notif_time=a.latestReadNotif||0;this.update_period=a.updatePeriod||60000;this.notifReceivedType=a.notifReceivedType||'notification';this.wrapperID=a.wrapperID||'notificationsWrapper';this.contentID=a.contentID||'jewelNotifs';this.timeElement='small.time';this._init();}Notifications.BEEPS_EXPIRED='beeper/beeps_expired';Notifications.prototype={_init:function(){this.cookieName='notifications_'+this.user;this.beepsExpiredToken=null;this.updateCheckCount=0;this.wrapper=ge(this.wrapperID);this.content=ge(this.contentID);this.loadingIndicator=ge(this.contentID+'_loading_indicator');this.countSpan=ge('presence_notifications_count');NotificationCounter.init();this.alertList=new NotificationList(this.content);this._updateCount();this.initializeEvents();Arbiter.subscribe(PresenceMessage.getArbiterMessageType(this.notifReceivedType),this._handleNotificationMsg.bind(this));Arbiter.subscribe(PresenceMessage.getArbiterMessageType('notifications_read'),this._handleNotificationsReadMsg.bind(this));MessagingEvents.subscribe('count/unread',this._updateInboxUnreadCount.bind(this));MessagingEvents.subscribe('count/unseen',this._updateInboxUnseenCount.bind(this));MessagingEvents.subscribe('count/other_unseen',this._updateInboxOtherUnseenCount.bind(this));this._poller=new Poller(this.update_period,this._update.bind(this));if(this.wrapper){this.countSpan=DOM.find(this.wrapper,'span.jewelCount span');this.isTabOpen()&&this.fetch();}},fromDom:function(){this.alertList.fromDom();},initializeEvents:function(){var a=null;Event.listen(this.content,{mouseover:function(event){var b=event.getTarget();a=Parent.byTag(b,'li');if(a&&b!=a)CSS.addClass(a,'selected');},mouseout:function(event){a&&CSS.removeClass(a,'selected');a=null;}});Toggler.listen('show',this.wrapper,function(){this.fetch();}.bind(this));},signalMarkRead:function(a){a=a||[];var b={render:0};for(var c=0;c<a.length;++c)b['alert_ids['+c+']']=a[c];new AsyncSignal('/ajax/presence/notifications_read.php',b).send();},markRead:function(c,a,b){if(this.countNew===0)return;typeof b!='undefined'&&(this.countNew=b);c&&this.signalMarkRead(a);this.alertList.markRead(a);this._updateCount();},_updateErrorHandler:function(a){},_updateURI:'/ajax/presence/update.php',_update:function(a){a.setHandler(this._handleUpdate.bind(this)).setOption('suppressErrorAlerts',true).setErrorHandler(this._updateErrorHandler.bind(this)).setData({user:this.user,notif_latest:this.latest_notif_time,notif_latest_read:this.latest_read_notif_time}).setURI(this._updateURI).setAllowCrossPageTransition(true);},_updateInboxOtherUnseenCount:function(a,b){CounterDisplay.setCount('other_unseen',b);},_updateInboxUnreadCount:function(a,b){CounterDisplay.setCount('messages_unread',b);},_updateInboxUnseenCount:function(a,b){CounterDisplay.setCount('messages_unseen',b);Arbiter.inform('jewel/count-updated',{jewel:'messages',count:b},Arbiter.BEHAVIOR_STATE);},_handleUpdate:function(b){var a=b.payload.notifications;if(!a.no_change){if(this.count!=a.count)this.count=a.count;this.updateTime=b.payload.time;this.latest_notif_time=a.latest_notif;this.latest_read_notif_time=a.latest_read_notif;this.countNew=a.countNew;this._updateDisplayDelayed();this.alertList.insertMany(a.markup_map,a.order);Arbiter.inform(Arbiter.NEW_NOTIFICATIONS,a);}},_updateDisplayDelayed:function(){if(typeof Beeper!='undefined'){this.beepsExpiredToken=Arbiter.subscribe(Notifications.BEEPS_EXPIRED,this._updateDisplay.bind(this));}else this._updateDisplay();},_updateDisplay:function(){if(!this.content)return;this._updateCount();if(this.beepsExpiredToken)Arbiter.unsubscribe(this.beepsExpiredToken);},_updateCount:function(){Arbiter.inform('jewel/count-updated',{jewel:'notifications',count:this.countNew},Arbiter.BEHAVIOR_STATE);},fetch:function(){var a=URI('/ajax/presence/notifications_read.php');a.setQueryData({time:this.latest_notif_time,user:this.user,version:this.cache_version,render:1,locale:Env.locale});new AsyncRequest().setURI(a).setStatusElement(this.loadingIndicator).setMethod('GET').setReadOnly(true).setHandler(this.fetchHandler.bind(this)).setAllowCrossPageTransition(true).send();return true;},fetchHandler:function(b){var a=b.getPayload();this.alertList.insertMany(a.markup_map,a.order);this.loadingIndicator&&CSS.hide(this.loadingIndicator);this.loadingIndicator=null;this.markRead(false);this.fetch=this.markRead.shield(this,true);},_mergeNotification:function(b,c,d){var a=!this.alertList.isUnreadId(b);this.alertList.insert(b,c,true);this.latest_notif_time=0;if(a){this.count++;if(d)this.countNew++;this._updateCount();}if(this.isTabOpen())this._merged_mouseover_handler=Event.listen(this.content,'mouseover',(function(){this._merged_mouseover_handler.remove();this.markRead(true);}).bind(this));},_handleNotificationMsg:function(d,a){var b=a.obj;if(typeof this.useDesktopNotifications=='undefined'){var c;this.useDesktopNotifications=this.allowDesktopNotifications&&window.webkitNotifications&&window.webkitNotifications.checkPermission()===0;}if(this.useDesktopNotifications)Bootloader.loadComponents('desktop-notifications',function(){DesktopNotifications.addNotification(b.alert_id);});if(b.markup){this._mergeNotification(b.alert_id,b.markup,b.unread);}else this._poller.requestNow();},_handleNotificationsReadMsg:function(c,a){var b=a.obj;if(typeof Beeper!='undefined')Beeper.getInstance().markRead(false,b.alert_ids);this.markRead(false,b.alert_ids,b.num_unread);},isTabOpen:function(){return this.wrapper&&CSS.hasClass(this.wrapper,'jewelOn');}};
function OriginalNotifications(a){this.parent.construct(this,a);}OriginalNotifications.extend('Notifications');copy_properties(OriginalNotifications.prototype,{_init:function(){this.parent._init();this.alertList.subscribe(NotificationList.MARK_READ_TYPE,this._animateMarkRead.bind(this));},markRead:function(c,a,b){this.parent.markRead(c,a,b||0);},fetchHandler:function(c){this.parent.fetchHandler(c);var b=c.getPayload();var d=b.generated;var a=Math.round((new Date()).getTime()/1000);if(a-d>15){d=a;this.alertList.markReadNow();}Bootloader.loadComponents('live-timer',function(){LiveTimer.restart(d);LiveTimer.startLoop(0);});},_mergeNotification:function(a,b,c){this.parent._mergeNotification(a,b,c);var d=this.alertList.alertsObj[a];if(d)Bootloader.loadComponents('live-timer',function(){LiveTimer.addTimeStamps(d);});},_animateMarkRead:function(a,b){animation(b).duration(5000).checkpoint().to('backgroundColor','#FFFFFF').duration(2250).ondone(CSS.removeClass.bind(null,b,NotificationList.ITEM_UNREAD_CLASS)).go();}});
function SearchDataSource(a){this.minResults=3;this.maxResults=8;this.lazyonload=true;this.templateEntries={};this.detemplatizedCache={};this.maxTemplateResults=3;this.parent.construct(this,a);}SearchDataSource.extend('DataSource');SearchDataSource.prototype={init:function(){this.parent.init();this._leanPayload=null;this._bootstrapRequestsPending=0;this._criticalOnly=true;this.updateMaxResults();Event.listen(window,'resize',this.updateMaxResults.bind(this));},dirty:function(){this.parent.dirty();this.tokensByField={};this.fetchOnUseRequests=[];},asyncErrorHandler:function(a){if(window.Dialog&&Dialog.getCurrent()==null&&a.getError()==1400003)AsyncResponse.verboseErrorHandler(a);},fetch:function(b,a,c){c=c||{};c.fetch_start=this.time();this.parent.fetch(b,a,c);},fetchHandler:function(e,c){var d=e.getPayload();var f=copy_properties({fetch_end:this.time()},c);var b=f.value?Arbiter.BEHAVIOR_EVENT:Arbiter.BEHAVIOR_PERSISTENT;this.inform('endpointStats',f,b);if(c.type=='lean'){this._leanPayload=d;this.processLean();}else{this.parent.fetchHandler(e,c);if(c.bootstrap&&!d.no_data&&this._bootstrapRequestsPending>0){c.bootstrap=false;--this._bootstrapRequestsPending;!this._bootstrapRequestsPending&&this.bootstrapPostProcess();}if(d.stale||d.no_data||d.token!==this.token){var a=copy_properties({},e.getRequest().getData());if(a.stale_ok||a.lazy){a.stale_ok=0;a.lazy=0;a.token=this.token;this.fetchOnUse(a,c);}}}},addEntries:function(a,c,b){a=(a||[]).filter(function(d){if(!d.template)return true;this.templateEntries[d.template]=d;return false;},this);this.parent.addEntries(a,c,b);},buildQueryResults:function(d,c){var a=this.parent.buildQueryResults(d,c);var b=this.buildTemplateResults(d.trim(),c);return a.concat(b);},buildTemplateResults:function(k,h){if(k in this.detemplatizedCache)return this.detemplatizedCache[k];var a=this.getBestTemplateMatch(h);if(!a)return [];var i=this.templateEntries[a.template];var c=[];var j=this.buildCacheResults(a.user_tokens,this.localCache);var f=this.maxTemplateResults;for(var e=0;e<j.length&&c.length<f;++e){var b=this.data[j[e]];if(b.type!='user')continue;var d={};copy_properties(d,i);d.text=d.text.replace('@user',b.text);d.path=d.path.replace('@uid',b.uid);d.uid+='_'+b.uid;d.photo=b.photo;c.push(d);}var g=this.processEntries(c,k);return (this.detemplatizedCache[k]=g);},getBestTemplateMatch:function(c){var a=null;for(var d in this.templateEntries){var b=this.matchAgainstTemplate(c,d);if(b&&(!a||b.score>a.score))a=b;}return a;},matchAgainstTemplate:function(d,f){var g=f.split(/\s+/);var c=f.match(/@/g).length;var e={template:f,score:0,user_tokens:[]};for(var a=0;a<d.length;++a){for(var b=0;b<g.length;++b)if(g[b].indexOf(d[a])===0){e.score+=d[a].length;break;}if(b==g.length)e.user_tokens.push(d[a]);}if(!e.score||(e.user_tokens.length<c))return null;return e;},getQueryData:function(c,b){var a=[];b.each(function(d){a.push(d.split('_')[0]);});return this.parent.getQueryData(c,a);},bootstrapPostProcess:function(){var a={time:this.time()};this.inform('bootstrapped',a,Arbiter.BEHAVIOR_PERSISTENT);this.processLean();this.value&&this.query(this.value);},processLean:function(){if(this._leanPayload){var a=this._leanPayload.entries;for(var b in a)if(this.data.hasOwnProperty(b))this.data[b].index=a[b];this._leanPayload=null;}},getFieldTokens:function(c,b){if(!this.tokensByField.hasOwnProperty(c))this.tokensByField[c]={};if(!this.tokensByField[c].hasOwnProperty(b)){var a=this.data[c][b];this.tokensByField[c][b]=a?TypeaheadUtil.tokenize(a.join?a.join(' '):a):[];}return this.tokensByField[c][b];},updateMaxResults:function(){var a=window.innerHeight||document.documentElement.clientHeight;var b=Math.ceil(2+((a-370)/56));this.numResults=Math.max(this.minResults,Math.min(this.maxResults,b));this.respond(this.value,this.buildUids(this.flatValue));},mergeUids:function(a,c,b,e){var d=function(f,g){var h=this.data[f];var i=this.data[g];if((h.extended_match||false)!==(i.extended_match||false))return h.extended_match?1:-1;if(h.index!==i.index)return h.index-i.index;if(h.text.length!==i.text.length)return h.text.length-i.text.length;if(h.text!==i.text)return h.text<i.text?-1:1;return h.uid<i.uid?-1:1;}.bind(this);this.checkExtendedMatch(e,a);this.checkExtendedMatch(e,c);return a.sort(d).concat(c,b);},checkExtendedMatch:function(c,d){for(var a=0;a<d.length;++a){var b=this.data[d[a]];b.extended_match=b.tokens&&!TypeaheadUtil.isPrefixMatch(c,this.getFieldTokens(b.uid,'text'));}},multifetch:function(e,b){var d=copy_properties(b,this.bootstrapData);d.stale_ok=1;for(var f=0;f<e.length;++f){var a=copy_properties({filter:e[f]},d);var c={bootstrap:true,type:e[f].join('_')};this.fetch(this.bootstrapEndpoint,a,c);++this._bootstrapRequestsPending;}},fetchOnUse:function(a,b){for(var c in this.bootstrapData)!a.hasOwnProperty(c)&&(a[c]=this.bootstrapData[c]);if(this._criticalOnly){this.fetchOnUseRequests.push({args:a,ctx:b});}else this.fetch(this.bootstrapEndpoint,a,b);},fetchLean:function(){var a={filter:['user'],no_cache:1};if(this.leanOnAllTypes)a={no_cache:1};a.options=$A(a.options);a.options.push('lean');this.fetchOnUse(a,{type:'lean'});},bootstrap:function(a){if(!a){this._criticalOnly=false;this.flushFetchOnUseRequests();}if(this._bootstrapped)return;if(this.bootstrapData.filter){this.fetch(this.bootstrapEndpoint,this.bootstrapData);}else{var b={filter:['event'],no_cache:1};this.fetchOnUse(b,{type:'event'});var d=[['user'],['app','page','group']];var c=this._criticalOnly&&this.lazyonload?{lazy:1}:{};this.multifetch(d,c);}this.fetchLean();this._bootstrapped=true;},flushFetchOnUseRequests:function(){var c=this.fetchOnUseRequests.length;for(var b=0;b<c;++b){var a=this.fetchOnUseRequests[b];this.fetch(this.bootstrapEndpoint,a.args,a.ctx);}this.fetchOnUseRequests=[];},onLoad:function(a,b){this.inform('onload',{time:this.time()},Arbiter.BEHAVIOR_PERSISTENT);if(a)this.bootstrap.bind(this,b).defer();},time:function(){return +new Date();}};
function SearchTypeaheadCore(a){this.parent.construct(this,a);}SearchTypeaheadCore.extend('TypeaheadCore');SearchTypeaheadCore.prototype={init:function(a,f,d){this.parent.init(a,f,d);var b=Parent.byTag(d,'form'),c=this.reset.bind(this);if(b){var e=DOM.find(b,'input.search_sid_input');Event.listen(b,'submit',function(){if(this.data&&this.data.queryData)e.value=this.data.queryData.sid;c.defer();}.bind(this),Event.Priority.URGENT);}},select:function(){this.reset();this.element.focus();(function(){this.element.blur();}).bind(this).defer();},handleTab:function(event){var a=this.view.getQuerySuggestion(this.value);if(a){Input.setValue(this.element,a);this.checkValue();event.kill();}else this.parent.handleTab(event);}};
function SearchTypeaheadRecorder(a){this.init(a);this.initEvents();}SearchTypeaheadRecorder.prototype={init:function(a){this.core=a.getCore();this.data=a.getData();this.view=a.getView();this.element=this.core.getElement();this.initTime=this.time();this._onloadTime=0;this.initStartTime=$('search_first_focus').value;this.bootstrapStats={bootstrapped:0};this._reset();},_reset:function(){this.stats={};this.avgStats={};var a=Math.random();this.data.setQueryData({sid:a});this.view.setSid(a);this.recordStat('sid',a);},initEvents:function(){this.core.subscribe('focus',function(event){if(!this.stats['session_start_time'])this.recordStat('session_start_time',this.time());}.bind(this));this.core.subscribe('blur',function(event){this.recordStat('session_end_time',this.time());this.submit();}.bind(this));this.view.subscribe('select',function(a,b){this.recordSelectInfo(b);}.bind(this));this.view.subscribe('render',function(a,b){this.recordRender(b);}.bind(this));this.data.subscribe('activity',function(a,b){this.recordStat('pending_request',b.activity);}.bind(this));this.data.subscribe('beforeQuery',function(a,b){if(!b.value)return;if(!this.stats.first_query_time)this.recordStat('first_query_time',this.time());this.query=b.value;this.recordCountStat('num_queries');}.bind(this));this.data.subscribe('queryEndpoint',function(a,b){this.recordCountStat('num_search_ajax_requests');this.recordAvgStat('endpoint_query_length',b.value.length);}.bind(this));this.data.subscribe('onload',function(a,b){this._onloadTime=b.time;}.bind(this));this.data.subscribe('bootstrapped',function(a,b){this.bootstrapStats.endTime=b.time;this.bootstrapStats.bootstrapped=1;}.bind(this));this.data.subscribe('endpointStats',function(a,c){var b=c.fetch_end-c.fetch_start;if(c.value){this.recordAvgStat('search_endpoint_ms_from_js',b);}else this.bootstrapStats[c.type]=b;}.bind(this));this.data.subscribe('query',function(a,b){this.recordAvgStat('num_results_from_cache',b.results.length);}.bind(this));Event.listen(this.element,'keydown',function(event){if(Event.getKeyCode(event)==KEYS.BACKSPACE)this.recordCountStat('backspace_count');}.bind(this));},recordStat:function(a,b){this.stats[a]=b;},recordCountStat:function(a){var b=this.stats[a];this.stats[a]=b?b+1:1;},recordAvgStat:function(a,b){if(this.avgStats[a]){this.avgStats[a][0]+=b;++this.avgStats[a][1];}else this.avgStats[a]=[b,1];},recordRender:function(a){this.results=a.filter(function(b){return b.type!='calltoaction'&&b.type!='header';});if(this.results.length>0&&!this.stats.first_result_time)this.recordStat('first_result_time',this.time());},recordSelectInfo:function(c){var f=c.selected;var b=c.index-f.groupIndex-1;var d={href:f.path};var a=f.dataGT?{gt:JSON.parse(f.dataGT)}:{};user_action(d,'a',null,null,a);if(f.uid=='search'){this.recordStat('selected_search',1);}else{var g=f.rankType||f.render_type||f.type;var e=(g=='friend'?'user':g);this.recordStat('selected_'+e,1);this.recordStat('selected_position',b);this.recordStat('selected_type',g);this.recordStat('selected_name_length',f.text.length);this.recordStat('selected_id',f.uid);this.recordStat('selected_degree',f.bootstrapped?1:2);this.recordStat('selected_extended_match',f.extended_match);}this.recordStat('selected_with_mouse',c.clicked?1:0);},_dataToSubmit:function(){this.recordStat('candidate_results',this.buildResults());this.recordStat('query',this.query);this.recordStat('init_time',this.initTime);if(this.initStartTime){this.recordStat('init_start_time',this.initStartTime);this.recordStat('onload_time',this._onloadTime);this.initStartTime=0;}this.recordStat('bootstrapped',this.bootstrapStats.bootstrapped);if(this.bootstrapStats.endTime){this.recordStat('bootstrapped_time',this.bootstrapStats.endTime);this.recordStat('user_bootstrap_ms',this.bootstrapStats.user);this.recordStat('other_bootstrap_ms',this.bootstrapStats.app_page_group);this.bootstrapStats.endTime=0;}this.recordStat('max_results',this.data.numResults);var a=this.stats;for(var c in this.avgStats){var b=this.avgStats[c];a[c]=b[0]/b[1];}return a;},buildResults:function(){var a=(this.results||[]).map(function(d,c){var e=d.rankType||d.render_type||d.type;var b=d.bootstrapped?1:0;if(typeof d.groupIndex=='number')return [d.groupIndex,d.indexInGroup,d.uid,e,b];return [0,c,d.uid,e,b];});return JSON.stringify(a);},submit:function(){var a=this._dataToSubmit();if(count(a)>0)new AsyncRequest().setURI('/ajax/typeahead/record_metrics.php').setMethod('POST').setData({stats:a}).setOption('handleErrorAfterUnload',true).setErrorHandler(function(b){a.retry=true;new AsyncRequest().setURI('/ajax/typeahead/record_metrics.php').setMethod('POST').setData({stats:a}).setOption('asynchronous',false).send();}).send();this._reset();},time:function(){return (new Date()).getTime();}};
function SearchTypeaheadView(a,b){this.parent.construct(this,a,b);}SearchTypeaheadView.extend('TypeaheadView');SearchTypeaheadView.prototype={queryData:{init:'quick'},render:function(d,b,c){var a=b.length;b=this.buildBuckets(b);if(d)b.push(this.buildSeeMore(d,a));return this.parent.render(d,b,c);},buildBuckets:function(f){var b=[];var h={};for(var d=0;d<f.length;++d){var c=f[d];var g=c.render_type||c.type;if(!h.hasOwnProperty(g)){h[g]=b.length;b.push([this.buildBucketHeader(g)]);}c.classNames=g;c.groupIndex=h[g];c.indexInGroup=b[c.groupIndex].length-1;b[c.groupIndex].push(c);}var a=[];for(var e=0;e<b.length;++e)a=a.concat(b[e]);return a;},buildSeeMore:function(d,b){var a='<span class="seeMore">'+(b>0?_tx("Ver m\u00e1s resultados para {query}",{query:htmlize(d)}):_tx("Ver resultados de {query}",{query:htmlize(d)}))+'<span class="arrow"></span></span>';if(b>0)a+='<span class="subtext">'+(b==1?_tx("Mostrando resultados principales"):_tx("Mostrando los primeros {number} resultados",{number:b}))+'</span>';var c=URI('/search.php').addQueryData(this.searchPageQueryData(d))+'';return {uid:'search',text:d,type:'calltoaction',path:c,markup:a};},buildBucketHeader:function(a){return this.typeObjects[a];},renderer:function(c,f){var j=c.markup||htmlize(c.text);var h=htmlize(c.subtext);var a=htmlize(c.category);var g=c.photo;var d=c.is_external;var e='',i='';var b=' class="'+(c.classNames||c.type)+'"';if(c.path){var k=c.path;if(!(/^https?\:\/\//).test(k))k=Env.www_base+k.substr(1);k+=(k.indexOf('?')>0?'&':'?')+'ref=ts';e=' href="'+k+'"';}if(d)i=' target="_blank"';if(a&&d)a+='<span class="arrow"></span>';return ['<li',b,'>','<a',e,i,' rel="ignore">',(g?('<img src="'+g+'" alt="" class="photo"/>'):''),(j?('<span class="text">'+j+'</span>'):''),(a?('<span class="category">'+a+'</span>'):''),(h?('<span class="subtext">'+h+'</span>'):''),'</a>','</li>'];},searchPageQueryData:function(b){var a=copy_properties({q:b},this.queryData||{});return a;},select:function(b){var e=this.results[this.index];if(!e||e.type=='header')return;var d=this.index,c=this.items[d],a=DOM.find(c,'a');this.parent.select(b);if(a&&a.href)if(a.target=='_blank'){window.open(a.href);}else goURI(a.href);},buildMarkup:function(a){return '<div class="search">'+this.parent.buildMarkup(a)+'</div>';},setSid:function(a){this.queryData.tas=a;},getQuerySuggestion:function(c){var a=this.results[this.index];var b=a&&a.type!='header'?a.text.toLowerCase():'';return b==c.toLowerCase()?'':b;},getDefaultIndex:function(c){var a=(this.autoSelect&&!this.disableAutoSelect);var b=c.length===0?-1:(c[0].type=='header'?1:0);return this.index<0&&!a?-1:b;},prev:function(){if(this.results[this.index-1]&&this.results[this.index-1].type=='header')this.index--;return this.parent.prev();},next:function(){if(this.results[this.index+1]&&this.results[this.index+1].type=='header')this.index++;return this.parent.next();}};
add_properties('TypeaheadBehaviors',{searchRecorderBasic:function(a){a.subscribe('init',function(b,c){new SearchTypeaheadRecorder(a);});}});
add_properties('TypeaheadBehaviors',{showLoadingIndicator:function(a){a.subscribe('activity',function(b,c){CSS.conditionClass(a.getElement(),'typeaheadLoading',c.activity);});}});
add_properties('TypeaheadRenderers',{basic:function(b,d){var f=b.markup||htmlize(b.text);var e=htmlize(b.subtext);var c=b.icon;var a='';if(b.type)a=' class="'+b.type+'"';return ['<li',a,'>',(c?'<img src="'+c+'" alt=""/>':''),(f?'<span class="text">'+f+'</span>':''),(e?'<span class="subtext">'+e+'</span>':''),'</li>'];}});
