/*
HTTP Host: static.ak.fbcdn.net
Generated: March 17th 2010 1:17:41 AM PDT
Machine: 10.16.139.109
Locale: nu_ll
Path: js/dacf3uyz648ww8o0.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/dacf3uyz648ww8o0.pkg.js"]); }

function NewsFeedEditor(a){this.modified=false;this.filterKey=a;NewsFeedEditor.instance=this;}NewsFeedEditor.prototype.addToNewsFeed=function(a){this.modified=true;new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData({filter_key:this.filterKey,action:a.action,value:a.id}).setHandler(function(b){ObjectBrowserController.getController(a.element).removeItem(a.id);}).send();};NewsFeedEditor.show=function(b,c){if(NewsFeedEditor.instance)return false;if(!c)c=bagofholding;var a=new AsyncRequest().setMethod('GET').setReadOnly(true).setURI('/ajax/feed/hidden_people_settings.php').setData({filter_key:b});new Dialog().setAsync(a).setCloseHandler(function(){if(NewsFeedEditor.instance){if(NewsFeedEditor.instance.modified)c();delete NewsFeedEditor.instance;}}).show();return false;};
function FriendsPage(e,d,j,i,f,c,b){this._cache={};this._friendCache={};this._listDownloadComplete=false;this._phonebookDownloadComplete=false;this._RecentlyUpdatedDownloadComplete=false;this._currentView=null;this._pagelet=f;this._currentNetworkFilter=false;this._filterKeys=b;this._filterKeys.default_view=b.all_connections;this._mainNav=e;this._listNav=d;this._listNav.setCreateLinkHandler(this._showMFS.bind(this,true));this._networkFiltersTypeMap={};this._networkFilters={};this._friendContainer=$('FriendsPage_Container');this._itemsPerPage=50;this._searchResultsPerPage=25;this._offsetMap={};if(this._getNavSelectedItem()){var a=this._getNavSelectedItem().data;var h=URI().getQueryData();if(h.filter_network)a.filter_network=h.filter_network;}else{var a={filter:this._filterKeys.find_friends};var h=a;}if(!h.offset)h.offset=0;a.offset=h.offset;PageTransitions.registerHandler(this._pageTransitionHandler.bind(this));var g=function(l){var m=URI.getRequestURI();var k={filter:this._currentView,offset:l};if(this._currentNetworkFilter!==false)k.filter_network=this._currentNetworkFilter;m.setQueryData(k);m.go();}.bind(this);this._pagerTop=new UIPager(0,this._itemsPerPage,a.offset,g);this._pagerBottom=new UIPager(0,this._itemsPerPage,a.offset,g);this._pagerTop.setSummaryTextHandler(this._getPagerSummaryText.bind(this));this._pagerBottom.setSummaryTextHandler(this._getPagerSummaryText.bind(this));this._toolbarTop=j;this._toolbarBottom=i;this._createListButton=new UIActionButton(_tx("Create New List"));this._createListButton.setOnclick(this._createListButtonClick.bind(this));this._toolbarTop.addButton(this._createListButton,'left');this._editListButton=new UIActionButton(_tx("Edit List"));this._editListButton.setOnclick(this._editListButtonClick.bind(this));this._toolbarTop.addButton(this._editListButton,'left');this._toolbarTop.addContent(this._pagerTop.getRoot(),'right');this._toolbarBottom.addContent(this._pagerBottom.getRoot(),'right');this._deleteListButton=new UIActionButton(_tx("Delete List"));this._deleteListButton.setOnclick(this._deleteListButtonClick.bind(this));this._toolbarTop.addButton(this._deleteListButton,'left');this._searchInput=$('FriendsPage_Search');this._statusContainer=$('FriendsPage_StatusContainer');this._statusMessage=this._statusContainer.find('h2.FriendsPage_SimpleStatus');this._setNavLoading(true);Arbiter.subscribe(FriendsPage.ARBITER_NETWORK_FILTERS_DONE,this._setShowNetworkFilters.bind(this,true));TemplateRegistry.registerServerSideTemplate('/templates/UIObjectListing.tmpl',null,true,false);new AsyncRequest().setMethod('GET').setReadOnly(true).setURI('/ajax/typeahead_search.php?'+c).setErrorHandler(function(){}).setTransportErrorHandler(function(){}).setHandler(function(k,q){this._setNavLoading(false);this._typeaheadFriends=[];var m=q.payload.entries;var r={};r[search_friend_source.TYPES.USER]=1;r[search_friend_source.TYPES.PAGE]=1;r[search_friend_source.TYPES.CONNECTION]=1;for(var n=0;n<m.length;n++){if(!r[m[n].ty])continue;this._typeaheadFriends.push(m[n]);var l={title:m[n].t,type:m[n].ty,subtitle:m[n].n,id:m[n].i,pic:m[n].it,pending:m[n].pnd};if(m[n].a){l.href='/'+escapeURI(m[n].a);}else l.href='/profile.php?id='+m[n].i;this._friendCache[l.id]=l;}this._cache[this._filterKeys.default_view]={};this._cache[this._filterKeys.default_view].members=[];this._cache[this._filterKeys.default_view].filter=this._filterKeys.default_view;this._cache[this._filterKeys.default_view].type=this._filterKeys.default_view;for(var p in this._friendCache)this._cache[this._filterKeys.default_view].members.push(this._friendCache[p].id);this._setupSearch();var o=this._getNavItem(k.filter);if(!(o.data&&o.data.is_pagelet))this._getFriends(k,false);}.bind(this,a)).send();this._getFriendLists();Arbiter.subscribe(Arbiter.LIST_EDITOR_LISTS_CHANGED,this._listEditorSave.bind(this),Arbiter.SUBSCRIBE_NEW);}copy_properties(FriendsPage,{ARBITER_NETWORK_FILTERS_DONE:'FriendsPage/network_filters_done'});FriendsPage.prototype._pageTransitionHandler=function(b){if(b.getPath()=='/friends/index.php'||b.getPath()=='/friends/'||b.getPath()=='/people/'||b.getPath()=='/people/index.php'||b.getPath()=='/friends/new/'||b.getPath()=='/friends/new/index.php'){var a=b.getQueryData();if(!a.offset)a.offset=0;this._selectNavItem(a.filter);this._getFriends(a,true);return true;}return false;};FriendsPage.prototype._getNavItem=function(a){var c=this._mainNav.getItems().concat(this._listNav.getItems());for(var b=0;b<c.length;b++)if(c[b].data&&a==c[b].data.filter)return c[b];return false;};FriendsPage.prototype._selectNavItem=function(a){var b=this._getNavItem(a);if(b)if(this._mainNav.getItems().contains(b)){this._mainNav.selectItem(b);this._listNav.deselectAll();}else if(this._listNav.getItems().contains(b)){this._listNav.selectItem(b);this._mainNav.deselectAll();}};FriendsPage.prototype._getNavSelectedItem=function(){return this._mainNav.getSelectedItem()||this._listNav.getSelectedItem();};FriendsPage.prototype._setNavLoading=function(a){this._mainNav.setLoading(a);this._listNav.setLoading(a);};FriendsPage.prototype._getFriendLists=function(){if(this._listDownloadComplete)return;var a=new AsyncRequest().setURI('/friends/ajax/superfriends.php').setReadOnly(true).setOption('retries',0).setMethod('GET').setData({all_lists:true}).setHandler(this._getFriendListsHandler.bind(this)).setFinallyHandler(bagofholding).send();};FriendsPage.prototype._getFriendListsHandler=function(d){var b=d.payload.collections;for(var c=0;c<b.length;c++){var a=b[c].filter;this._cache[a]=b[c];}this._listDownloadComplete=true;this._updateAllFriendListings();};FriendsPage.prototype._getNetworkFilters=function(){if(this._networkFiltersDownloadComplete||this._networkFiltersLoading)return;this._networkFiltersLoading=true;var a=new AsyncRequest().setURI('/friends/ajax/superfriends_filters.php').setReadOnly(true).setOption('retries',0).setMethod('GET').setHandler(this._getNetworkFiltersHandler.bind(this)).send();};FriendsPage.prototype._getNetworkFiltersHandler=function(d){var c=d.payload;this._networkNames=c.network_names;this._networkFilters=c.networks;this._networkTypes=c.network_types;for(var a in this._networkFilters)for(var b in this._networkFilters[a])this._networkFiltersTypeMap[b]=a;this._networkFiltersLoading=false;this._networkFiltersDownloadComplete=true;Arbiter.inform(FriendsPage.ARBITER_NETWORK_FILTERS_DONE,{});};FriendsPage.prototype._setShowNetworkFilters=function(d){if(!d){this._toolbarTop.setShowSecondaryContent(false);return;}if((this._currentView!=this._filterKeys.browse)||!this._networkFiltersDownloadComplete)return;if(!this._toolbarFilters){if(hasArrayNature(this._networkFilters)&&this._networkFilters.length==0)return;this._toolbarFilters=$N('div',{className:'FriendsPage_ToolbarFilters'});var c=$N('span',{className:'FriendsPage_ToolbarFiltersLabel'});c.setContent(_tx("Browse by:"));this._toolbarFilters.appendContent(c);this._primaryNetworkFilterSelect=$N('select',{className:'FriendsPage_ToolbarFiltersPrimarySelect'});this._primaryNetworkFilterSelect.listen('change',function(e){this._setNetworkFilters(get_form_select_value(this._primaryNetworkFilterSelect),false,true);}.bind(this));this._primaryNetworkFilterSelect.options[0]=new Option(_tx("Choose an option..."),'');var a=1;for(var b in this._networkTypes){this._primaryNetworkFilterSelect.options[a]=new Option(this._networkTypes[b],b);a++;}this._secondaryNetworkFilterSelect=$N('select');this._secondaryNetworkFilterSelect.addClass('hidden_elem');this._secondaryNetworkFilterSelect.listen('change',function(e){this._setNetworkFilters(get_form_select_value(this._primaryNetworkFilterSelect),get_form_select_value(this._secondaryNetworkFilterSelect),true);}.bind(this));this._toolbarFilters.appendContent(this._primaryNetworkFilterSelect);this._toolbarFilters.appendContent(this._secondaryNetworkFilterSelect);this._toolbarTop.addSecondaryContent(this._toolbarFilters);}this._toolbarTop.setShowSecondaryContent(true);};FriendsPage.prototype._setNetworkFilters=function(c,e,d){if(!this._toolbarFilters)return;if(!c){this._primaryNetworkFilterSelect.selectedIndex=0;this._secondaryNetworkFilterSelect.addClass('hidden_elem');}else{this._secondaryNetworkFilterSelect.removeClass('hidden_elem');set_form_select_value(this._primaryNetworkFilterSelect,c);this._secondaryNetworkFilterSelect.options.length=0;this._secondaryNetworkFilterSelect.options[0]=new Option(_tx("Choose an option..."),'');var a=1;for(var b in this._networkFilters[c]){this._secondaryNetworkFilterSelect.options[a]=new Option(this._networkNames[b],b);a++;}if(e===false){this._secondaryNetworkFilterSelect.selectedIndex=0;}else{set_form_select_value(this._secondaryNetworkFilterSelect,e);if(d){var f=URI.getRequestURI();f.setQueryData({filter:this._filterKeys.browse,filter_network:e,offset:0});f.go();}}}};FriendsPage.prototype._getPhonebook=function(){if(this._phonebookDownloadComplete||this._phonebookLoading)return;this._phonebookLoading=true;this._setNavLoading(true);var a=new AsyncRequest().setURI('/friends/ajax/superfriends_phonebook.php').setReadOnly(true).setOption('retries',0).setMethod('GET').setHandler(this._getPhonebookHandler.bind(this)).send();};FriendsPage.prototype._getPhonebookHandler=function(c){this._phonebookLoading=false;this._phonebookDownloadComplete=true;var b=c.payload;var a=keys(b.phone);this._cache[this._filterKeys.phonebook]={members:a,key:this._filterKeys.phonebook,filter:this._filterKeys.phonebook};this._phonebook=b.phone;};FriendsPage.prototype._getRecentlyUpdated=function(){if(this._recentlyUpdatedDownloadComplete||this._recentlyUpdatedLoading)return;this._recentlyUpdatedLoading=true;this._setNavLoading(true);var a=new AsyncRequest().setURI('/friends/ajax/superfriends_recently_updated.php').setReadOnly(true).setOption('retries',0).setMethod('GET').setHandler(this._getRecentlyUpdatedHandler.bind(this)).send();};FriendsPage.prototype._getRecentlyUpdatedHandler=function(a){this._recentlyUpdatedDownloadComplete=true;this._recentlyUpdatedLoading=false;this._cache[this._filterKeys.recently_updated]={members:a.payload.members,key:this._filterKeys.recently_updated,filter:this._filterKeys.recently_updated};this._recentlyUpdated=a.payload.recently_updated;};FriendsPage.prototype._getFriendListsSorted=function(){var a=[];for(var b in this._cache)if(this._cache[b].editable)a.push(this._cache[b]);return a.sort(function(c,d){return (c.name==d.name)?0:(c.name<d.name?-1:1);});};FriendsPage.prototype._getListsForFriend=function(e){var d={};var c=this._getFriendListsSorted();for(var a=0;a<c.length;a++)for(var b=0;b<c[a].members.length;b++)if(c[a].members[b]==e){d[c[a].filter]=true;b=c[a].members.length;}return d;};FriendsPage.prototype._setupSearch=function(){this._searchSource=new static_source();this._searchSource.values=this._typeaheadFriends;this._searchSource.build_index();this._searchInput.listen('keyup',function(b){this._currentView=this._filterKeys.default_view;this._nextView=this._currentView;if(!this._searchInput.value||this._searchInput.value.length==0){this._paintFriends(this._cache[this._filterKeys.default_view],false,0);return;}var e=this._searchSource.search_value(this._searchInput.value);var d=[];for(var c=0;c<e.length;c++)d.push(e[c].i);var a={members:d,editable:false,filter:this._filterKeys.default_view,search:true};this._paintFriends(a,false,0,this._searchInput.value);}.bind(this));};FriendsPage.prototype._editFriendsAsync=function(e,b,a,c){var d={members:e,list_id:b,action:a,name:c};new AsyncRequest().setURI('/friends/ajax/superfriends_add.php').setData(d).send();};FriendsPage.prototype._addFriend=function(e,c){var d=[];for(var b=0;b<e.length;b++){var a=this._existsInList(e[b],c);if(this._friendCache[e[b]]&&!a){this._cache[c].members.push(e[b]);this._updateFriendListing(e[b]);d.push(e[b]);}}if(d.length>0)this._editFriendsAsync(d,this._cache[c].value,'add');};FriendsPage.prototype._removeFriend=function(g,c){if(this._existsInList(g,c)){this._editFriendsAsync([g],this._cache[c].value,'remove');var b=this._cache[c];for(var a=0;a<b.members.length;a++)if(b.members[a]==g){b.members.splice(a,1);break;}if(this._displayedObjectsMap[g]&&this._currentView==c){this._displayedObjectsMap[g].getActionControl().hideMenu();DOM.remove(this._displayedObjectsMap[g].root);for(var a=0;a<this._displayedObjects.length;a++)if(this._displayedObjects[a].root===this._displayedObjectsMap[g].root){this._displayedObjects.splice(a,1);break;}delete this._displayedObjectsMap[g];var f=URI().getQueryData();var d=f.offset?f.offset:0;var e=this._cache[c].members.length;this._pagerTop.resetPager(e,this._itemsPerPage,d);this._pagerBottom.resetPager(e,this._itemsPerPage,d);}else this._updateFriendListing(g);}};FriendsPage.prototype._existsInList=function(e,d){var a=false;var c=this._cache[d].members;for(var b=0;b<c.length;b++)if(c[b]==e){a=true;break;}return a;};FriendsPage.prototype._pageletHandler=function(a){$('FriendsPage_ListingViewContainer').addClass('hidden_elem');$('FriendsPage_PageletContainer').removeClass('hidden_elem');this._setNavLoading(false);if(a)PageTransitions.transitionComplete();};FriendsPage.prototype._getFriends=function(c,f){var b=c.filter;this._hideStatusMessage();var d=this._getNavItem(b);if(d.data.is_pagelet){this._setNavLoading(true);this._pagelet=new UIPagelet('FriendsPage_PageletContainerContent');this._pagelet.setHandler(this._pageletHandler.bind(this,f));this._pagelet.go(d.data.pagelet_path);return;}if(b==this._filterKeys.browse)this._getNetworkFilters();if(b==this._filterKeys.phonebook)this._getPhonebook();if(b==this._filterKeys.recently_updated)this._getRecentlyUpdated();if(this._cache[b]&&!c.filter_network){this._currentView=b;this._currentNetworkFilter=false;this._nextView=b;this._setNavLoading(false);this._paintFriends(this._cache[b],f,c.offset);}else if(b==this._filterKeys.browse){if(!this._networkFiltersDownloadComplete){this._setNavLoading(true);setTimeout(this._getFriends.bind(this,c,f),100);return;}this._setNavLoading(false);this._currentView=b;this._nextView=b;if(c.filter_network){this._currentNetworkFilter=c.filter_network;var e=this._networkFiltersTypeMap[c.filter_network];c.members=this._networkFilters[e][c.filter_network];}else{c.members=[];this._setNetworkFilters(false,false);}this._paintFriends(c,f,c.offset);}else{this._nextView=b;if((!this._listDownloadComplete&&c.type==this._filterKeys.list)||(!this._phonebookDownloadComplete&&b==this._filterKeys.phonebook)||(!this._recentlyUpdatedDownloadComplete&&b==this._filterKeys.recently_updated)){setTimeout(this._getFriends.bind(this,c,f),100);return;}this._setNavLoading(true);var a=new AsyncRequest().setURI('/friends/ajax/superfriends.php').setReadOnly(true).setOption('retries',0).setMethod('GET').setData(c).setHandler(this._getFriendsHandler.bind(this,f,c.offset)).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).setFinallyHandler(bagofholding).send();}};FriendsPage.prototype._getFriendsHandler=function(h,e,g){this._setNavLoading(false);var f=g.payload;var b=f.collections;for(var c=0;c<b.length;c++){var a=b[c].filter;this._cache[a]=b[c];for(var d in b[c].member_data)this._friendCache[d]=b[c].member_data[d];}if(f.current_view)if(this._nextView==f.current_view){this._currentView=f.current_view;this._currentNetworkFilter=false;this._paintFriends(this._cache[f.current_view],h,e);}};FriendsPage.prototype._paintFriends=function(n,zd,k,d){var h=d?this._searchResultsPerPage:this._itemsPerPage;k=parseInt(k);if(n.paginated&&!n.start){var f=h+k;if(f>n.count)f=n.count;if(f>n.members.length){var ze={start:this._offsetMap[k]||k,limit:h};this._setNavLoading(true);new AsyncRequest().setMethod('GET').setReadOnly(true).setURI('/friends/ajax/superfriends.php').setData({filter:n.filter,value:ze}).setHandler(function(zh){var zf=zh.payload.collections.pop();if(zf.last_used)this._offsetMap[k+h]=zf.last_used+1;for(var zg in zf.member_data)this._friendCache[zg]=zf.member_data[zg];this._paintFriends(zf,zd,k,d);this._setNavLoading(false);}.bind(this)).send();return;}}$('FriendsPage_PageletContainer').addClass('hidden_elem');var zc=n.count;if(zc===undefined)zc=d?h:n.members.length;var m=d?0:zc;var l=d?0:h;CSS.conditionClass($('FriendsPage_BottomToolbar'),'hidden_elem',m<=l);this._pagerTop.resetPager(m,l,k);this._pagerBottom.resetPager(m,l,k);if(n.filter_network){var s=this._networkFiltersTypeMap[n.filter_network];var y=n.filter_network;}else{var s=false;var y=false;}this._setShowNetworkFilters(n.filter==this._filterKeys.browse);if(n.filter==this._filterKeys.browse)this._setNetworkFilters(s,y,false);if(n.members.length==0){$('FriendsPage_ListingViewContainer').removeClass('hidden_elem');$('FriendsPage_ContentContainer').addClass('hidden_elem');$('FriendsPage_BlankStateContainer').removeClass('hidden_elem');$('FriendsPage_BlankStateContainer').setContent(this._getBlankStateContent(n.filter,d));}else{$('FriendsPage_BlankStateContainer').addClass('hidden_elem');$('FriendsPage_ContentContainer').removeClass('hidden_elem');$('FriendsPage_ListingViewContainer').removeClass('hidden_elem');var o=n.members;var za=[];for(var e=0;e<o.length;e++){if(!this._friendCache[o[e]])continue;var j={};copy_properties(j,this._friendCache[o[e]]);za.push(j);}if(!d&&n.filter!=this._filterKeys.recently_added&&n.filter!=this._filterKeys.incoming_fans&&n.filter!=this._filterKeys.recently_updated)za=za.sort(function(zf,zg){return zf.title.toString().localeCompare(zg.title.toString());});if(!n.start)za=za.slice(k,k+h);var x=[];this._displayedObjects=[];this._displayedObjectsMap={};for(var e=0;e<za.length;e++){if(d)za[e].title=HTML(typeahead_source.highlight_found(za[e].title,d));var g=keys(this._getListsForFriend(za[e].id));if(za[e].pending){za[e].subtext=_tx("Friend Request Pending");}else za[e].subtext=this._getListsForFriendSubtext(g);var w=new UIObjectListing(za[e]);if(d)w.setBoldTitle(false);if((za[e].type==search_friend_source.TYPES.USER)||(za[e].type==search_friend_source.TYPES.CONNECTION)||(za[e].type==search_friend_source.TYPES.PAGE)){if(n.filter==this._filterKeys.phonebook){var p=null;var a=null;var r=$N('div',{className:'FriendsPage_PhonebookRight'});if(this._phonebook[za[e].id].cell){var a=$N('div',{className:'FriendsPage_PhonebookCell'});var b=$N('span',{className:'FriendsPage_PhonebookLabel'},_tx("MOBILE"));a.setContent([b,this._phonebook[za[e].id].cell]);r.appendContent(a);}if(this._phonebook[za[e].id].phone){var p=$N('div',{className:'FriendsPage_PhonebookLand'});var q=$N('span',{className:'FriendsPage_PhonebookLabel'},_tx("LAND"));p.setContent([q,this._phonebook[za[e].id].phone]);r.appendContent(p);}if(p&&a)r.addClass('FriendsPage_PhonebookBoth');w.setRightContent(r);}else if(n.filter==this._filterKeys.recently_updated){var u=this._recentlyUpdated[za[e].id];var t=$N('div',{className:'FriendsPage_RecentlyUpdated'});var c=$N('div',{className:'FriendsPage_RecentlyUpdatedContent'},HTML(u.diff));var z=$N('div',{className:'FriendsPage_RecentlyUpdatedTime'},HTML(u.updated_time_relative));t.setContent([c,z]);w.setRightContent(t);}else{var i=new UIActionMenu(this._getFriendListMenuTitle(g.length));i.setAlignRight(true);i.setContentCallback(this._getFriendListMenu.bind(this,za[e].id,i));i.setSuppressButton(true);w.setActionControl(i);if(n.search||n.filter==this._filterKeys.all_friends||n.filter==this._filterKeys.all_connections||n.filter==this._filterKeys.outgoing_fans||n.filter==this._filterKeys.recently_added){var zb=null;var v=null;if(za[e].type==search_friend_source.TYPES.PAGE||za[e].type==search_friend_source.TYPES.CONNECTION||za[e].type==search_friend_source.TYPES.USER){zb=za[e].pending?_tx("Remove Request"):_tx("Remove Connection");v=this._showRemoveConnectionDialog.bind(this,za[e].id,za[e].pending);}if(v!=null)w.setRemoveControl(true,v,zb);}}}else if(n.filter==this._filterKeys.incoming_fans)w.setRemoveControl(true,this._showRemoveConnectionDialog.bind(this,za[e].id,false,true,za[e].title),_tx("Remove Fan"));w.paint();x.push(w.root);this._displayedObjects.push(w);this._displayedObjectsMap[za[e].id]=w;}delete za;this._friendContainer.setContent(x);}this._selectNavItem(n.filter);this._setEditable(n.editable,n.deletable);DOMScroll.scrollTo(new Vector2(0,0,'document'),false);if(zd)PageTransitions.transitionComplete();};FriendsPage.prototype._getListsForFriendSubtext=function(c){var b=[];for(var a=0;a<c.length;a++)if(this._cache[c[a]])b.push(this._cache[c[a]].name);return b.join(', ');};FriendsPage.prototype._getFriendListMenu=function(l,h){var g=this._getFriendListsSorted();var i=[];if(g.length>0){var f=new UISelectList();var k=this._getListsForFriend(l);for(var c=0;c<g.length;c++){var j=k[g[c].filter]?true:false;f.addItem(g[c].name,j,g[c].filter);}f.setCallback(function(p,o,m,n){if(m){this._addFriend([p],n);}else this._removeFriend(p,n);o.hideMenu();}.bind(this,l,h));i.push(f.getElement());}else{var a=$N('div',{className:'FriendsPage_MenuBlankState'});a.setContent(_tx("You have no lists."));i.push(a);}var e=$N('div',{className:'FriendsPage_NewList'});var d=$N('input',{type:'text',className:'FriendsPage_NewListInput inputtext'});e.setContent(d);i.push(e);new TextInputControl(d).setPlaceholderText(_tx("Create New List"));d.listen('focus',this._genNewListId.bind(this));d.listen('keypress',function(o,n,q,m){if(Event.getKeyCode(m)==KEYS.RETURN){var p=n.getControl().getValue();this._menuCreateList(o,p,q);return false;}}.bind(this,h,d,l));var b=$N('div',{className:'FriendsPage_MenuContainer'});b.setContent(i);return b;};FriendsPage.prototype._menuCreateList=function(b,a,c){if(!this._newListId&&this._generatingNewListId){this._setNavLoading(true);setTimeout(this._menuCreateList.bind(this,b,a,c),100);}else if(this._newListId&&!this._generatingNewListId){this._setNavLoading(false);this._createNewList(this._newListId,a,[c],false,true);this._newListId=false;b.hideMenu();}};FriendsPage.prototype._genNewListId=function(){if(!this._newListId&&!this._generatingNewListId){this._generatingNewListId=true;new AsyncRequest().setURI('/friends/ajax/superfriends_newlist.php').setHandler(function(a){this._newListId=a.payload.fbid;this._generatingNewListId=false;}.bind(this)).send();}};FriendsPage.prototype._getFriendListMenuTitle=function(a){if(a<1){return _tx("Add to List");}else if(a==1){return _tx("1 List");}else return _tx("{number_of_lists} Lists",{number_of_lists:a});};FriendsPage.prototype._updateFriendListing=function(d){if(this._displayedObjectsMap[d]){var c=this._displayedObjectsMap[d];var b=c.getActionControl();var a=keys(this._getListsForFriend(d));c.getActionControl().setTitle(this._getFriendListMenuTitle(a.length));c.setSubtext(this._getListsForFriendSubtext(a));}};FriendsPage.prototype._dirtyAllMenus=function(){if(this._displayedObjectsMap)for(var a in this._displayedObjectsMap){var b=this._displayedObjectsMap[a].getActionControl();b.setDirty(true);}};FriendsPage.prototype._updateAllFriendListings=function(){if(this._displayedObjectsMap)for(var a in this._displayedObjectsMap)this._updateFriendListing(a);};FriendsPage.prototype._setEditable=function(b,a){this._editListButton.setDisabled(!b);this._deleteListButton.setDisabled(!a);};FriendsPage.prototype._showStatusMessage=function(a){DOM.setContent(this._statusMessage,a);this._statusContainer.removeClass('hidden_elem');};FriendsPage.prototype._hideStatusMessage=function(){this._statusContainer.addClass('hidden_elem');};FriendsPage.prototype._createListButtonClick=function(){if(this._cache[this._filterKeys.default_view].members.length==0){new Dialog().setTitle(_tx("Create New List")).setBody(_tx("Lists help you organize your Facebook friends. Once you find some friends, you can come back here to create a list.")).setButtons(Dialog.CLOSE).show();return false;}this._showMFS(true);return false;};FriendsPage.prototype._getBlankStateContent=function(b,g){var c=$N('div',{className:'FriendsPage_BlankStateContainer'});var e=$N('div',{className:'FriendsPage_BlankStateMessage'});var d=$N('a',{className:'FriendsPage_BlankStateLink'});c.setContent([e,d]);if(this._cache[b]){var h=this._cache[b].type;if(h==this._filterKeys.list){e.setContent(_tx("You have no friends in this list."));d.setContent(_tx("Add friends to list..."));d.setAttribute('href','#');d.listen('click',function(j){this._showMFS(false,j);return false;}.bind(this,b));}else if(h==this._filterKeys.all_friends){e.setContent(_tx("You do not have any friends. Once you find some friends, they will appear here."));d.setContent(_tx("Find friends..."));var i=URI.getRequestURI();i.setQueryData({filter:this._filterKeys.find_friends});d.href=i.toString();}else if(h==this._filterKeys.network){var f=this._cache[b].name;e.setContent(_tx("You have no friends in this network. When you add a friend that is in the {name_of_network} network, they will appear in this filter.",{name_of_network:f}));d.setContent(_tx("Find friends in the {name_of_network} network...",{name_of_network:f}));var i=new URI('/srch.php');i.setQueryData({n:this._cache[b].value});d.href=i.toString();}else if(h==this._filterKeys.recently_added){e.setContent(_tx("This filter shows people that you have recently added as friends. When you add new friends, they will appear here for two weeks."));d.setContent(_tx("Find friends..."));var i=URI.getRequestURI();i.setQueryData({filter:this._filterKeys.find_friends});d.href=i.toString();}else if(h==this._filterKeys.recently_updated){e.setContent(_tx("You have no friends with recently updated profiles."));d.setContent(_tx("Find friends..."));var i=URI.getRequestURI();i.setQueryData({filter:this._filterKeys.find_friends});d.href=i.toString();}else if(h==this._filterKeys.mobile_subscriptions){e.setContent(_tx("You are not subscribed to anyone via SMS."));d.setContent(_tx("Add friends to list..."));d.setAttribute('href','#');d.listen('click',function(j){this._showMFS(false,j);return false;}.bind(this,b));}}else if(g){e.setContent(_tx("You have no friends whose name contains \"{search_term}\".",{search_term:g}));d.setContent(_tx("Search Facebook for \"{search_term}\"...",{search_term:g}));var i=new URI('/search/');i.setQueryData({q:g});d.href=i.toString();}else if(this._getNavItem(b).data.type==this._filterKeys.browse){var a=this._cache[this._filterKeys.all_friends];if(a&&a.members.length==0){e.setContent(_tx("You do not have any friends. Once you find some friends, you can return here to browse them by different criteria."));d.setContent(_tx("Find friends..."));var i=URI.getRequestURI();i.setQueryData({filter:this._filterKeys.find_friends});d.href=i.toString();}else if(this._networkFilters&&hasArrayNature(this._networkFilters)){e.setContent(_tx("None of your friends are in any networks."));d.addClass('hidden_elem');}else{e.setContent(_tx("Use the dropdown menu above to browse your friends by network."));d.addClass('hidden_elem');}}return c;};FriendsPage.prototype._getPagerSummaryText=function(a,e,b){if(e==0)return '';if(e<=b){if(e==1){return _tx("1 Connection");}else return _tx("{num_connections} Connections",{num_connections:e});}else{if(a+b<e){var c=((a/b+1)*b);}else var c=e;var d=_tx("{starting_offset}-{ending_offset} of {number_of_friends} connections",{starting_offset:(a+1),ending_offset:c,number_of_friends:e});return d;}};FriendsPage.prototype._editListButtonClick=function(){var a=this._cache[this._currentView].type;if(a==this._filterKeys.list||a==this._filterKeys.mobile_subscriptions){this._showMFS(false,this._currentView);}else if(a==this._filterKeys.news_feed){var b=function(){delete this._cache[this._filterKeys.news_feed];data=URI().getQueryData();if(!data.offset)data.offset=0;this._getFriends(data,false);}.bind(this);NewsFeedEditor.show(this._filterKeys.news_feed,b);}return false;};FriendsPage.prototype._deleteListButtonClick=function(){var a=Dialog.newButton('delete',_tx("Delete List"));var b=new Dialog().setTitle(_tx("Delete List?")).setBody(_tx("Are you sure you want to delete this list? This cannot be undone.")).setButtons([a,Dialog.CANCEL]);b.setHandler(function(e,c){var d=this._cache[e];var f=this._getNavItem(d.filter);if(f){this._listNav.removeItem(f);this._editFriendsAsync([],d.value,'delete');delete this._cache[e];URI.getRequestURI().setQueryData({filter:this._filterKeys.all_friends,offset:0}).go();}}.bind(this,this._currentView));b.show();return false;};FriendsPage.prototype._removeConnectionFromUI=function(c,e){var d=this._cache[e].members;for(var b=0;b<d.length;b++)if(d[b]==c){d.splice(b,1);break;}if(this._displayedObjectsMap[c]){var a=this._displayedObjectsMap[c].getActionControl();if(a)a.hideMenu();DOM.remove(this._displayedObjectsMap[c].root);for(var b=0;b<this._displayedObjects.length;b++)if(this._displayedObjects[b].root===this._displayedObjectsMap[c].root){this._displayedObjects.splice(b,1);break;}delete this._displayedObjectsMap[c];}delete this._friendCache[c];if(d.length==0)this._paintFriends(this._cache[e],false,0);};FriendsPage.prototype._showRemoveConnectionDialog=function(c,f,d,e){var a=Dialog.newButton('remove',_tx("Remove"));var b=new Dialog().setButtons([a,Dialog.CANCEL]);var g={profile:e||this._friendCache[c].title};if(d){b.setBody(_tx("Are you sure you want to remove {profile} from your list of fans?",g));b.setTitle(_tx("Remove {profile} from My Fans?",g));}else if(f){b.setBody(_tx("Are you sure you want to remove your request to connect to {profile}?",g));b.setTitle(_tx("Remove request to connect to {profile}?",g));}else{b.setBody(_tx("Are you sure you want to remove your connection to {profile}?",g));b.setTitle(_tx("Remove connection to {profile}?",g));}b.setHandler(function(i,h){new AsyncRequest().setURI('/friends/ajax/remove_friend.php').setData({friend:i,type:d?'fan':'friend'}).send();this._removeConnectionFromUI(i,this._filterKeys.default_view);}.bind(this,c));b.show();};FriendsPage.prototype._showMFS=function(c,a){if(!c){var b=this._cache[a].value;}else var b=null;Dialog.bootstrap(DialogBootstrapEndpoints.LIST_EDITOR,{new_list:c,list_id:b});return false;};FriendsPage.prototype._listEditorSave=function(e,b){if(e==Arbiter.LIST_EDITOR_LISTS_CHANGED)if(b.is_new_list){this._createNewList(b.list_info.list_id,b.list_info.name,b.list_info.members,false,false);}else{var c=b.list_info.list_id;var a=this._filterKeys.list+'_'+c;if(c==this._filterKeys.mobile_list_id){a=this._filterKeys.mobile_subscriptions;}else{var d=b.list_info.name;this._listNav.setItemTitle(this._getNavItem(a),d);this._cache[a].name=d;}this._cache[a].members=b.list_info.members;this._getFriends({filter:a,offset:0},false);this._selectNavItem(a);}};FriendsPage.prototype._createNewList=function(g,h,i,k,a){if(a)this._editFriendsAsync(i,g,'create',h);var b=this._filterKeys.list+'_'+g;this._cache[b]={members:i,value:g,type:this._filterKeys.list,editable:true,name:h,filter:b,deletable:true};var c={filter:b,type:this._filterKeys.list,value:g,editable:true};var d=URI.getRequestURI();d.setQueryData({filter:b});var f=this._listNav.getItems();var j=1;for(var e=0;e<f.length;e++)if(f[e].data.type==this._filterKeys.list){j=e;break;}this._listNav.addItem(h,d.toString(),j,'/images/friend_lists/friend_list_icon_with_hover.gif',c);if(k){d.go();}else{for(var e=0;e<i.length;e++)this._updateFriendListing(i[e]);this._dirtyAllMenus();}};

if (window.Bootloader) { Bootloader.done(["js\/dacf3uyz648ww8o0.pkg.js"]); }