/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  June 9th 2009 9:30:10 AM PDT                                 */
/*      Machine:  10.16.139.110                                                */
/*       Source:  Global Cache                                                 */
/*     Location:  js/4w0b6re0rcowksk8.pkg.js h:d1xe6lgw                        */
/*       Locale:  en_US                                                        */
/*         Path:  js/4w0b6re0rcowksk8.pkg.js                                   */


function PageCacheFeedTracking(){this.data=[];}
copy_properties(PageCacheFeedTracking.prototype,{register:function(metadata,hash,type,undo,cat){var newEntry={'meta':metadata,'h':hash,'type':type,'undo':undo,'cat':cat};this.data.push(newEntry);},dispatch:function(){var async=new AsyncRequest().setMethod('POST').setURI('/ajax/feed_tracking_pagecache.php').setReadOnly(true).setOption('bundle',true).setData({'data':this.data}).send();return true;}});

function ft(metadata,hash,type,undo,cat){undo=undo?1:0;var asyncRequestPost=new AsyncSignal('/ajax/f.php',{'meta':metadata,'h':hash,'type':type,'undo':undo,'cat':cat}).send();return true;}
function ft2_link_controller(elem){if(URI.getRequestURI().getPath()!='/home.php'){return;}
var href=elem.href;var link_data={};while(elem&&elem!=document.body){var link_data_attr=elem.getAttribute('data-ft');if(link_data_attr){var attr=JSON.decode(link_data_attr);for(var i in attr){if(link_data[i]==undefined){link_data[i]=attr[i];}}}
elem=elem.parentNode;}
if(count(link_data)){link_data.dest=href;new AsyncSignal('/ajax/f2.php',{link_data:JSON.encode(link_data)}).send();}}
onloadRegister(function(){LinkController.registerFallbackHandler(ft2_link_controller);});

FriendSuggesterDialog={_dialog:null,_close_handler:null,_newcomer:null,show:function(newcomer,friend_added,close_handler,ref){this._close_handler=close_handler||bagofholding;friend_added=friend_added||false;this._newcomer=newcomer;var async=new AsyncRequest().setURI('/ajax/friend_suggester.php').setData({newcomer:newcomer,friend_added:friend_added}).setContextData('clicktype','Suggest a Friend',ref==="profile_others");this._dialog=new Dialog().setAsync(async).show();},cancelMultiselect:function(){this._dialog.hide();this._close_handler(false,null);},submitMultiselect:function(){var data=serialize_form($('friend_suggester_popup_form'));if(!data['ids']){try{fs.notice_show(_tx("You have not selected any friends. Select friends by clicking on their pictures."),true);}catch(ex){this.cancelMultiselect();Util.error('SUGGEST: could not warn user submitting an empty selection: %x',ex);}
return false;}
data['suggest']=1;var async=new AsyncRequest().setURI('/ajax/friend_suggester.php').setData(data);var dialog=new Dialog().setAsync(async);dialog.setCloseHandler(this._close_handler.bind(null,true,dialog));dialog.show();}};

function UntrustedLink(dom,hash,evt){this.dom=dom;this.url=dom.href;this.hash=hash;this.dom.listen('click',this.onclick.bind(this));this.dom.listen('mousedown',this.onmousedown.bind(this));this.dom.listen('mouseup',this.onmouseup.bind(this));this.dom.listen('mouseout',this.onmouseout.bind(this));this.onmousedown($E(evt));}
UntrustedLink.bootstrap=function(dom,hash,evt){if(dom.__untrusted){return;}
dom.__untrusted=true;new UntrustedLink(dom,hash,evt);}
UntrustedLink.prototype.getRewrittenURI=function(){return(new URI('/l.php')).setQueryData({u:this.url,h:this.hash}).setSubdomain('www');}
UntrustedLink.prototype.onclick=function(){(function(){this.dom.href=this.url;}).bind(this).defer(100);this.dom.href=this.getRewrittenURI();}
UntrustedLink.prototype.onmousedown=function(evt){if(evt.button==2){this.dom.href=this.getRewrittenURI();}}
UntrustedLink.prototype.onmouseup=function(){this.dom.href=this.getRewrittenURI();}
UntrustedLink.prototype.onmouseout=function(){this.dom.href=this.url;}

function Template(source){copy_properties(this,{_templateSource:source});}
copy_properties(Template.prototype,{getSource:function(){return this._templateSource;},render:function(template_data){var replaceFunction=function(data,all_matches,operator,key){var translator=htmlize;switch(operator){case'H':translator=function(s){return s;};break;}
return data[key]?translator(data[key]):'';}.curry(template_data||{});return this._templateSource.replace(/\$(H)?{(\w+)\}/g,replaceFunction);}});var TemplateRegistry={_storage:{},registerTemplate:function(name,template){if(typeof(template)=="string"){template=new Template(template);}
this._storage[name]=template;return this;},unregisterTemplate:function(name){delete this._storage[name];},hasTemplate:function(name){return name in this._storage;},getTemplate:function(name){if(this.hasTemplate(name)){return this._storage[name];}
return null;},registerServerSideTemplate:function(path,callback,synchronous,evaluate){callback=callback||bagofholding;synchronous=!!synchronous;evaluate=!!evaluate;if(this.hasTemplate(path)){callback();return this;}
var async=new AsyncRequest(path).setReadOnly(true).setMethod('GET').setOption('asynchronous',!synchronous).setOption('suppressEvaluation',!evaluate)
if(!synchronous){async.setErrorHandler(bind(this,this._registerErrorHandler,path)).setHandler(bind(this,this._registerHandler,path,callback));}
async.send();if(synchronous){this.registerTemplate(path,new Template(async.transport.responseText));callback();}
return this;},_registerErrorHandler:function(path,response){Util.warn('Failed to register template "%s"',path);},_registerHandler:function(path,evaluate,callback,response){var payload=response.getPayload();var template=null;if(evaluate){if(payload.template){template=payload.template;}}else{template=payload;}
if(template){this.registerTemplate(path,template);callback();}else{Util.error('No template found in response payload');}},_onRegisterTemplate:function(type,data){if(type=='template/registerTemplate'){if(!data||!data.name||!data.template){Util.warn('TemplateRegister: Invalid template data.')}else{this.registerTemplate(data.name,data.template);}
return false;}
Util.warn('TemplateRegister: Invalid arbiter message type: %s',type);return true;}}
Arbiter.subscribe('template/registerTemplate',TemplateRegistry._onRegisterTemplate.bind(TemplateRegistry),Arbiter.SUBSCRIBE_ALL);

function TemplateObject(template,data){data=data||{};if(!(template instanceof Template)){if(TemplateRegistry.hasTemplate(template)){template=TemplateRegistry.getTemplate(template);}else if(template instanceof URI){TemplateRegistry.registerServerSideTemplate(template.toString(),null,true);template=TemplateRegistry.getTemplate(template);}}
if(template==null){throw new Error("Template could not be found");}
var rendered=template.render(data);copy_properties(this,{_nodes:HTML(rendered).getNodes(),_template:template,_rendered:rendered});TemplateObject.bindNodes(this._nodes,this);}
copy_properties(TemplateObject,{bindNodes:function(nodes,scope){var all_nodes=[];for(var i=0;i<nodes.length;i++){if(nodes[i].nodeType==DOM.NODE_TYPES.ELEMENT){all_nodes.push(nodes[i]);var node_collection=nodes[i].getElementsByTagName('*');all_nodes=all_nodes.concat(to_array(node_collection));}}
for(var i=0;i<all_nodes.length;i++){var bind_point=all_nodes[i].getAttribute('bindPoint');var listeners=all_nodes[i].getAttribute('listen');if(bind_point){if(hasArrayNature(scope[bind_point])){scope[bind_point].push(all_nodes[i]);}else{scope[bind_point]=all_nodes[i];}}
if(listeners){listeners.replace(/(\w+) *: *(\w+)/g,function(node,match_str,event_name,handler){if(typeof(this[handler])=="function"){Event.listen(node,event_name,bind(this,this[handler]));}else{Event.listen(node,event_name,bind(this,TemplateObject._eventWrapper,handler));}}.bind(scope,all_nodes[i]));}}},_eventWrapper:function(handler_name,event){if(typeof(this[handler_name])=="function"){return this[handler_name](event);}else{Util.warn('Event wrapper [%s] not defined for template object',handler_name);return true;}}});copy_properties(TemplateObject.prototype,{getNodes:function(){return this._nodes;},getRendered:function(){return this._rendered;}});

var SocialGraphManager=function(){var _initialized=false;var _classType=-1;var _nodeID=-1;var _dialog=null;var _prepareAsyncData=function(data){if(!_initialized){return null;}
var required_data={'class':_classType,'node_id':_nodeID};copy_properties(data,required_data);return data;};var _send=function(uri,data,handler){new AsyncRequest().setURI(uri).setData(_prepareAsyncData(data)).setHandler(handler?handler:bagofholding).send();return false;};var _showDialog=function(uri,data){if(!(data=_prepareAsyncData(data))){return;}
var async=new AsyncRequest().setMethod('POST').setURI(uri).setData(data);_dialog=new Dialog().setModal(true).setAsync(async).show();return false;};return{init:function(classType,nodeID){_initialized=true;_classType=classType;_nodeID=nodeID;return this;},getCurrentNodeID:function(){return _nodeID;},showInviteDialog:function(){_showDialog('/ajax/social_graph/invite_dialog.php',{});},showAddAdminDialog:function(){_showDialog('/ajax/social_graph/add_admin_dialog.php',{});},showBrowseDialog:function(args){_showDialog('/ajax/social_graph/dialog/browse.php',args||{});},submitDialog:function(formID,target){if(_dialog){var data=serialize_form($(formID));_dialog.hide();if(data['ids']||data['email_addresses']){_showDialog(target,data);}}},cancelDialog:function(){if(_dialog){_dialog.hide();}},fetch:function(edge_type,meta,page,limit,handler){var uri='/ajax/social_graph/fetch.php';var data={'edge_type':edge_type,'page':page,'limit':limit};if(meta){copy_properties(data,meta);}
return _send(uri,data,handler);},search:function(query,meta,handler){var uri='/ajax/social_graph/search.php';var data={'query':query};if(meta){copy_properties(data,meta);}
return _send(uri,data,handler);},add:function(fbids,edge_type,meta,app_id,message,handler){var uri='/ajax/social_graph/add.php';var data={'fbids':fbids,'edge_type':edge_type,'app_id':app_id,'message':message};if(meta){copy_properties(data,meta);}
return _send(uri,data,handler);},remove:function(fbid,edge_type,ban,meta,message,handler){var uri='/ajax/social_graph/remove.php';var data={'fbid':fbid,'edge_type':edge_type,'ban':ban,'message':message};if(meta){copy_properties(data,meta);}
return _send(uri,data,handler);}};}();

function NewsFeedEditor(filterKey){this.modified=false;this.filterKey=filterKey;NewsFeedEditor.instance=this;}
NewsFeedEditor.prototype.setAutoUpdate=function(checkbox,checkedValue,uncheckedValue){this.modified=true;var value;if(checkbox.checked){value=checkedValue;}else{value=uncheckedValue;}
new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData({filter_key:this.filterKey,action:'auto_update',value:value}).send();}
NewsFeedEditor.prototype.addToNewsFeed=function(data){this.modified=true;new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData({filter_key:this.filterKey,action:data.action,value:data.id}).setHandler(function(payload){ObjectBrowserController.getController(data.element).removeItem(data.id);}).send();}
NewsFeedEditor.show=function(filterKey,onModified){if(NewsFeedEditor.instance){return false;}
if(!onModified){onModified=bagofholding;}
var async=new AsyncRequest().setMethod('GET').setReadOnly(true).setURI('/ajax/feed/hidden_people_settings.php').setData({filter_key:filterKey});new Dialog().setAsync(async).setCloseHandler(function(){if(NewsFeedEditor.instance){if(NewsFeedEditor.instance.modified){onModified();}
delete NewsFeedEditor.instance;}}).show();return false;}
Arbiter.inform("template\/registerTemplate", {"name":"\/templates\/UIActionMenu.tmpl","template":"\n<div class=\"UIActionMenu\" bindPoint=\"root\">\n  <span class=\"UIActionMenu_ButtonOuter\">\n    <span class=\"UIActionMenu_ButtonInner\"><\/span>\n    <span class=\"UIActionMenu_Icon\" bindPoint=\"icon\"><\/span>\n    <span class=\"UIActionMenu_Text\" bindPoint=\"text\"><\/span>\n    <span class=\"UIActionMenu_Chevron\"><\/span>\n  <\/span>\n  <div class=\"UIActionMenu_Menu\" bindPoint=\"menu\"><\/div>\n<\/div>\n"}, Arbiter.BEHAVIOR_PERSISTENT);

function UIActionMenu(title){copy_properties(this,{_title:title,root:null,icon:null,color:null,text:null,menu:null});this._selected=false;this._contentCallback=bagofholding;this._selectList=null;this.parent.construct(this,URI('/templates/UIActionMenu.tmpl'));this._initialize();}
UIActionMenu.extend('TemplateObject');copy_properties(UIActionMenu,{ICONS:{LOCK:'UIActionMenu_Lock'},COLORS:{BLUE:'UIActionMenu_Blue',GREY:'UIActionMenu_Grey'}});UIActionMenu.prototype._initialize=function(){var cancel=false,init=null;init=Event.listen(this.root,'mousedown',function(){this.buildMenu();init.remove();}.bind(this));if(ua.ie()){Event.listen(this.root,'mousedown',function(event){if(this.menuVisible()&&!DOM.contains(this.menu,event.getTarget())){document.body.blur();}}.bind(this));Event.listen(this.root,'activate',this.showMenu.bind(this));Event.listen(this.root,'deactivate',this.hideMenu.bind(this));Event.listen(this.root,'selectstart',Event.kill);}else{this.input=$N('input',{type:'button'});DOM.insertBefore(this.input,DOM.find(this.root,'span.UIActionMenu_ButtonInner'));Event.listen(this.root,'mousedown',function(event){var target=event.getTarget();if(DOM.contains(this.menu,target)){if(!DOM.isNode(target,'input')){setTimeout(function(){this.input.focus();}.bind(this),100);}
cancel=true;return;}
this.toggleMenu();this.input.focus();return false;}.bind(this));Event.listen(this.input,'blur',function(event){if(cancel){cancel=false;return;}
this.hideMenu();}.bind(this));}};UIActionMenu.prototype.menuVisible=function(){return CSS.hasClass(this.root,'UIActionMenu_Active');};UIActionMenu.prototype.hideMenu=function(){CSS.removeClass(this.root,'UIActionMenu_Active');return this;};UIActionMenu.prototype.showMenu=function(){CSS.addClass(this.root,'UIActionMenu_Active');return this;};UIActionMenu.prototype.toggleMenu=function(){if(this.menuVisible()){return this.hideMenu();}else{return this.showMenu();}};UIActionMenu.prototype.setAlignRight=function(right){CSS.conditionClass(this.root,'UIActionMenu_AlignRight',right);return this;};UIActionMenu.prototype.setContentCallback=function(fn){this._contentCallback=fn;return this;};UIActionMenu.prototype.setSuppressButton=function(suppress){CSS.conditionClass(this.root,'UIActionMenu_SuppressButton',suppress);return this;};UIActionMenu.prototype.setColor=function(color){switch(color){case UIActionMenu.COLORS.BLUE:case UIActionMenu.COLORS.GREY:if(this.color){CSS.removeClass(this.root,this.color);}
CSS.addClass(this.root,color);this.color=color;break;default:if(this.color){CSS.removeClass(this.root,this.color);this.color=null;}}
return this;};UIActionMenu.prototype.setIcon=function(icon){switch(icon){case UIActionMenu.ICONS.LOCK:CSS.addClass(this.root,'UIActionMenu_IconIncluded');CSS.addClass(this.icon,icon);break;default:CSS.removeClass(this.root,'UIActionMenu_IconIncluded');Util.error('invalid icon passed to `UIActionMenu.setIcon`');}
return this;};UIActionMenu.prototype._getContent=function(){var content=this._contentCallback();if(this.input){var inputs=DOM.scry(content,'input');inputs.each(function(input){Event.listen(input,'blur',function(){this.input.focus();}.bind(this));},this);}
return content;};UIActionMenu.prototype.setTitle=function(title){this._title=title;DOM.setContent(this.text,this._title);return this;};UIActionMenu.prototype.getNodes=function(){DOM.setContent(this.text,this._title);return[this.root];};UIActionMenu.prototype.buildMenu=function(){DOM.setContent(this.menu,this._getContent());return this;};UIActionMenu.prototype.useSelectList=function(items,callback,mode){mode=mode||UISelectList.MULTI_SELECT_MODE;this.setContentCallback(function(){this._selectList=new UISelectList().setMode(mode).setCallback(function(checked,key){this.hideMenu();callback&&callback(checked,key);}.bind(this)).addItems(items);return this._selectList.getElement();}.bind(this));return this;};UIActionMenu.prototype.resetSelectList=function(){this._selectList&&this._selectList.reset();};UIActionMenu.prototype.getSelectList=function(){return this._selectList;};

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