/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  July 23rd 2009 4:00:31 PM PDT                                */
/*      Machine:  10.16.140.109                                                */
/*       Source:  Local Cache                                                  */
/*     Location:  rsrc:2:c17d89mw:en_US:/html/js/9uersg5djz8k4o4g.pkg.js:141   */
/*       Locale:  en_US                                                        */
/*         Path:  js/9uersg5djz8k4o4g.pkg.js                                   */


function typeahead_mentions(element,source,options){this.element=$(element);options=copy_properties({delimiter:'@',anchor_block:true,max_display:4,max_results:4,submit_keydown_return:false,auto_select:false},options||{});this.selected=null;source=new search_friend_source(source,true);source.allowTypes([search_friend_source.TYPES.USER,search_friend_source.TYPES.PAGE,search_friend_source.TYPES.APP,search_friend_source.TYPES.GROUP,search_friend_source.TYPES.EVENT]);this.parent.construct(this,element,source,options);CSS.addClass(this.list,'typeahead_mentions');CSS.addClass(this.dropdown,'typeahead_search');this.initializeEvents();this.hide();}
typeahead_mentions.extend('typeaheadpro');copy_properties(typeahead_mentions.prototype,{_onchange:bagofholding,set_class:bagofholding,set_value:bagofholding,update_class:bagofholding,recalc_scroll:bagofholding,clear_placeholder:bagofholding,initializeEvents:function(){this.shouldClean=!ua.safari();if(!this.shouldClean){return;}
if(document.selection){Event.listen(this.element,'paste',function(){setTimeout(this.cleanup.bind(this),100);}.bind(this));}else{var timer,element=this.element,nodeCount=element.childNodes.length,charCount=DOM.getText(element).length;var check=function(){if(!this.shouldClean||element.hasClass('DOMControl_placeholder')){this.shouldClean=true;return;}
if(Math.abs(nodeCount-element.childNodes.length)>2||Math.abs(charCount-DOM.getText(element).length)>5){this.cleanup();}
this.focusInput();}.bind(this);addEventBase(element,'DOMCharacterDataModified',function(){charCount=DOM.getText(element).length;nodeCount=element.childNodes.length;});addEventBase(element,'DOMNodeInserted',function(){clearTimeout(timer);timer=setTimeout(check,25);});}},show:function(){this.visible=true;if(this.focused){var pos=Vector2.getElementPosition(this.anchor);CSS.setStyle(this.dropdown,'top',pos.y+this.anchor.offsetHeight+'px');CSS.setStyle(this.dropdown,'left',pos.x-6+'px');CSS.setStyle(this.dropdown,'width',this.anchor.offsetWidth+12+'px');CSS.setStyle(this.dropdown,'display','');}},get_value:function(){var range=Text.getRange(),node=Text.getFocusNode(range,this.element),value=Text.getFocusValue(range,node),offset=Text.getFocusOffset(range,node);if(!range||!value||range.collapsed===false){return'';}
var index=value.lastIndexOf(this.delimiter,offset);if(index<0||(index>0&&((/\w/).test(value.charAt(index-1))||value.charAt(offset-1)==' '))){return'';}
return value.slice(index,offset);},check_value:function(){if(DOM.getText(this.element).lastIndexOf(this.delimiter)==-1){if(this.value==this.delimiter){this.hide();}
return;}
if(!this.ready){if(!this.loading){this.loading=true;this.source.initialize(function(){this.ready=true;this.results_text=this.delimiter;this.check_value();}.bind(this));this.set_message(_tx("Loading..."));this.show();}
return;}
var value=this.get_value();if(value==this.delimiter){this.set_message(_tx("Type the name of someone or something..."));this.show();}
if(value!=this.value){this.dirty_results();this.value=value;}},_onblur:function(event){this.fixBreak();this.hide();},_onfocus:function(event){this.fixBreak();this.focused=true;this.results_text='';},_onkeydown:function(event){event=$E(event);var code=event?event_get_keypress_keycode(event):-1;if(window.getSelection&&code==KEYS.BACKSPACE){var node=Text.getFocusNode(),offset=Text.getFocusOffset();if(offset==0){node=node.previousSibling;}else if(node==this.element&&offset>0){node=this.element.childNodes[offset-1];}
if(this.isMention(node)){DOM.remove(node);}}
if(!this.visible&&document.selection&&code==KEYS.RETURN){Text.insertBreak();event.kill();}
if(this.visible){if(code==KEYS.UP||code==KEYS.DOWN||code==KEYS.RETURN){event.kill();}
return this.parent._onkeydown(event);}},_onkeypress:function(event){if(this.visible){return this.parent._onkeypress(event);}},_onkeyup:function(event){this.check_value();if(this.visible){return this.parent._onkeyup(event);}},_onselect:function(selected){if(!selected){return;}
var value=this.value,nodes=this.element.childNodes;this.shouldClean=false;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(this.isText(node)){var text=node.data,index=text.lastIndexOf(value,Text.getFocusOffset());if(index>-1){var mention=this.createMention(selected,value);var prefix=document.createTextNode(text.substring(0,index).replace(/\s*$/g,'')+' ');node.data=' '+text.substring(index+value.length).replace(/^\s*/g,'');this.element.insertBefore(mention,node);this.element.insertBefore(prefix,mention);this.focusAfter(mention);break;}}}
this.hide();},completeSubstrings:function(partial,canonical){var canonical=typeahead_source.tokenize(canonical,false,true),partial=typeahead_source.tokenize(partial);canonical.sort(function(a,b){return b.length-a.length;});var flattened=typeahead_source.tokenize(canonical.join(' ')),results=[];partial.each(function(ii){for(var jj=flattened.length;jj--;){if(flattened[jj].lastIndexOf(ii,0)==0){results.push(canonical[jj]);flattened[jj]='';break;}}});return results.join(' ');},createSpacer:function(){var span=document.createElement('span');span.innerHTML='&nbsp;';return span.removeChild(span.firstChild);},createMention:function(obj,value){var data={id:obj.i,text:obj.t};if(value&&obj.ty=='u'){data.substring=this.completeSubstrings(value.substring(1),data.text);}
var mention=$N('a',{href:'#',tabIndex:-1,title:data.text,className:'mention',unselectable:'on',contentEditable:false,oncontextmenu:Event.kill,onclick:Event.kill,onfocus:Event.kill},$N('span',{contentEditable:!!document.selection},(data.substring||data.text)));Event.listen(mention,'mousedown',this.selectMention.bind(this,mention));Event.listen(mention,'dblclick',function(){DOM.remove(mention);});DataStore.set(mention,'mention',data);return mention;},selectMention:function(mention,event){if(!mention){return;}
if(event){event.kill();}
var prev=mention.previousSibling;if(!prev||(this.isText(prev)&&!prev.nodeValue.trim())){DOM.remove(prev);DOM.insertBefore(this.createSpacer(),mention);}
setTimeout(function(){this.element.focus();if(!mention.parentNode){var offset=prev.length;this.normalize();Text.setFocus(prev,offset);}else{Text.selectNode(mention);}}.bind(this),0);},focusAfter:function(node){this.normalize();setTimeout(function(){this.element.focus();Text.setFocusAfter(node);}.bind(this),0);},normalize:function(){var node=this.element.firstChild;while(node){var next=node.nextSibling;if(this.isText(node)&&this.isText(next)){node.data+=next.data;this.element.removeChild(next);}else{node=node.nextSibling;}}},cleanup:function(){if(!this.shouldClean){return;}
this.shouldClean=false;var nodes=this.element.childNodes,dirty=false;for(var i=nodes.length;i--;){var node=nodes[i];if(!this.isText(node)&&!this.isMention(node)&&!this.isBreak(node)){this.element.replaceChild(document.createTextNode(DOM.getText(node)),node);dirty=true;}}
if(dirty){this.normalize();}
this.shouldClean=true;},getMessage:function(){var message=$A(this.element.childNodes).map(function(node){if(this.isBreak(node)){return"\n";}
var data=this.isMention(node);if(data){return'@['+data.id+':'+(data.substring||data.text)+']';}
return DOM.getText(node).replace('\u00A0',' ','g');},this);return message.join('').trim();},setMessage:function(message){DOM.setText(this.element,message);this.fixBreak();},focusInput:function(){this.element.focus();},isBreak:function(node){return DOM.isNode(node,'br');},isText:function(node){return DOM.isNode(node,['#text','#whitespace']);},isMention:function(node){return DOM.isNode(node,'a')&&DataStore.get(node,'mention');},fixBreak:document.selection?bagofholding:function(){var last=this.element.lastChild;if(!last||!this.isBreak(last)){this.element.appendChild($N('br'));}},fixNodes:document.selection?bagofholding:function(){var nodes=this.element.getElementsByTagName('a');for(var i=nodes.length;i--;){var node=nodes[i],next=node.nextSibling,prev=node.previousSibling;if(!prev||!prev.nodeValue.trim()){DOM.insertBefore(this.createSpacer(),node);}
if(!next||!next.nodeValue.trim()){DOM.insertAfter(node,this.createSpacer());}}}});var Text=(function(){if(window.getSelection){functions={getRange:function(selection){selection=selection||this.getSelection();return selection.rangeCount>0?selection.getRangeAt(0):null;},getSelection:function(){return window.getSelection();},getFocusNode:function(range){range=range||this.getRange();return range&&range.endContainer;},getFocusValue:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);return node.data;},getFocusOffset:function(range,node){range=range||this.getRange();return range.endOffset||0;},setFocus:function(node,offset){if(!node){return;}
this.getSelection().collapse(node,offset);},setFocusAfter:function(node,offset){if(!offset&&offset!==0){offset=1;}
this.setFocus(node.nextSibling,offset);},insertBreak:function(){},selectNode:function(node){if(!node){return;}
var sel=this.getSelection(),range=this.getRange(sel);sel.collapse(node,0);range.selectNode(node);sel.addRange(range);}};}
else if(document.selection){functions={getRange:function(){return this.getSelection().createRange();},getSelection:function(){return document.selection;},getFocusNode:function(range,node){if(node){return node;}
range=range||this.getRange();return range.parentElement();},getFocusValue:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);return node.innerText;},getFocusOffset:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);var parent=node,offset=0;while(parent==node){range.moveStart('character',-1);parent=range.parentElement();offset++;}
return range.text.length;},setFocus:function(node,offset){var range=this.getRange(),element=range.parentElement(),length=0,children=[],prev=node.previousSibling;while(prev){var temp=prev.previousSibling;children.push(element.removeChild(prev));prev=temp;}
range.moveToElementText(element);range.collapse();range.moveEnd('character',(offset+length));range.collapse(false);range.select();for(var i=0;i<children.length;i++){element.insertBefore(children[i],element.firstChild);}},setFocusAfter:function(node){var range=this.getRange();range.moveToElementText(node);range.moveEnd('character',2);range.collapse(false);range.select();},insertBreak:function(){var range=this.getRange();range.pasteHTML('<br/>');range.moveEnd('character',1);range.collapse();range.select();},selectNode:function(node){var range=this.getRange();range.moveToElementText(node);range.moveStart('character',-1);range.moveEnd('character',1);range.select();}};}
return functions;})();

function UIComposerAttachmentArea(composer,root){this.composer=composer;this.root=root;this.area=root.find('div.UIComposer_AttachmentArea_Cache');this.cache={};this.visible=null;this.attachment={};this.dirtyOnReset=false;var closeButton=root.find('a.UIComposer_AttachmentArea_CloseButton');Event.listen(closeButton,'click',function(event){Event.kill(event);composer.reset(true);});}
UIComposerAttachmentArea.prototype={show:function(attachment,extraData){this.composer.addState(UIComposer.STATE.ATTACHMENT_AREA);this.attachment=attachment;this.dirtyOnReset=false;if(ua.ie()<7){this.area.setStyle('width',this.area.offsetWidth);}
var app_id=attachment.app_id;if(this.cache[app_id]&&!extraData){this.showAttachment(app_id);}else{this.loadAttachment(app_id,extraData);}},loadAttachment:function(app_id,extraData){var data={app_id:app_id,composer_id:this.composer.id,stream_id:this.composer.targetID};if(extraData){copy_properties(data,{data:extraData});}
new AsyncRequest().setURI(UIComposerAttachmentArea.ENDPOINT).setData(data).setHandler(UIComposerAttachmentArea.handleResponse.bind(this,extraData)).setErrorHandler(this.composer.handleError.bind(this.composer)).setTransportErrorHandler(this.composer.handleError.bind(this.composer)).send();},showAttachment:function(app_id){if(!this.composer.hasState(UIComposer.STATE.ATTACHMENT_AREA)){return;}
this.visible=this.cache[app_id];this.visible.addClass(UIComposerAttachmentArea.CLASS.VISIBLE);this.composer.addState(UIComposer.STATE.ATTACHMENT_LOADED);this.fireAttachmentEvent('load');},createAttachment:function(payload){var element=$N('div',{className:UIComposerAttachmentArea.CLASS.CACHED});this.area.appendChild(element).setContent(HTML(payload.html));return element;},setAttachment:function(controller){if(this.attachment){this.attachment.controller=controller;controller.initialize(this.composer,this.cache[this.attachment.app_id],this.attachment.app_id);}
return this;},getAttachment:function(){if(this.attachment&&this.attachment.controller){return this.attachment.controller;}
return null;},getData:function(){if(this.attachment&&this.attachment.controller){return this.attachment.controller.getData();}
return null;},getEndpoint:function(forbid_override){if(this.attachment&&this.attachment.controller){return this.attachment.controller.getEndpoint(forbid_override);}
return null;},post:function(){if(!this.visible){return;}
var data=this.getData();var endpoint=this.getEndpoint(true);if(!data||!endpoint){return;}
data.composer_id=this.composer.id;this.composer.removeState(UIComposer.STATE.ATTACHMENT_LOADED);new AsyncRequest().setURI(endpoint).setData(data).setHandler(UIComposerAttachmentArea.handleResponse.bind(this,null)).setErrorHandler(this.composer.handleError.bind(this.composer)).send();},reset:function(){if(!this.visible){return;}
this.visible.removeClass(UIComposerAttachmentArea.CLASS.VISIBLE);this.visible=null;if(this.dirtyOnReset){var app_id=this.attachment.app_id;this.cache[app_id].remove();this.cache[app_id]=null;}
this.fireAttachmentEvent('reset');},fireAttachmentEvent:function(event){if(this.attachment&&this.attachment.controller){this.attachment.controller[event]();}}};copy_properties(UIComposerAttachmentArea,{handleResponse:function(extraData,response){var app_id=this.attachment.app_id,attachment=this.cache[app_id],payload=response.getPayload(),error=response.getError(),errIsWarning=response.getErrorIsWarning();if(error&&errIsWarning){this.composer.showError(response.getErrorSummary(),response.getErrorDescription());}
if(!attachment){this.cache[app_id]=this.createAttachment(payload);this.dirtyOnReset=!!extraData;}else{attachment.setContent(HTML(payload.html));this.dirtyOnReset=true;}
this.showAttachment(app_id);}});copy_properties(UIComposerAttachmentArea,{CLASS:{CACHED:'UIComposer_Attachment_Cached',VISIBLE:'UIComposer_Attachment_Visible'},ENDPOINT:'/ajax/composer/attachment.php',PARAM_STRUCTURE:'app_data[attachment][params]'});

function UIComposer(root,input,user,options){if(!root){throw new Error('UIComposer instantiated with no root.');return false;}
this.root=root;this.id=root.id;this.input=input;this.user=user;this.initialize=this.initialize.bind(this,options);this.resetState=this.root.className;this.initializeAttachments(options.attachments);this.initializeLocation(options.locationActivated);UIComposer.storeInstance(root.id,this);onunloadRegister(function(){delete UIComposer.instances[root.id];},true);if(options.autoload){this.ensureInitialized();}}
UIComposer.prototype={ensureInitialized:function(focus){if(this.initialized){return;}
this.initialized=true;this.initialize(focus);},initialize:function(overrides,focus){var options={contentArea:null,endpoint:'/ajax/updatestatus.php',autoload:null,autoloadData:null,targetID:0,attachments:[],contextData:{},placeholder:null,privacyWidget:null,privacyOptions:{},maxInputLength:0,typeaheadSource:null,locationActivated:false,overrideAttachmentEndpoint:false,sourceAppID:null,initialTextareaHeight:36};copy_properties(this,copy_properties(options,overrides));this.lastLoc=null;this.shouldHide=true;this.submitButton=DOM.scry(this.root,'li.UIComposer_SubmitButton a')[0]||null;this.privacyButton=DOM.scry(this.root,'li.UIComposer_PrivacyButton')[0]||null;this.privacyCallout=DOM.scry(this.root,'div.UIComposer_PrivacyCallout')[0]||null;if(options.typeaheadSource){this.initializeMentions(options.typeaheadSource);}else{this.initializeTextarea(options.maxInputLength,options.initialTextareaHeight);}
this.initializeAutoscrape(focus);this.initializeEvents();if(options.autoload){this.loadAttachment(options.autoload,options.autoloadData);}},initializeAttachments:function(attachments){if(!attachments.length){return;}
this.apps=attachments.map(function(attachment){return attachment.app_id;});this.attachments=attachments;var attachmentList=this.root.find('ul.UIComposer_Attachments');var attachmentArea=this.root.find('div.UIComposer_AttachmentArea');this.attachmentList=new UIComposerAttachmentList(this,attachmentList);this.attachmentArea=new UIComposerAttachmentArea(this,attachmentArea);},initializeLocation:function(locationActivated){this.locationField=DOM.scry(this.root,'div.UIComposer_LocationField')[0]||null;this.locationButton=DOM.scry(this.root,'li.UIComposer_LocationButton')[0]||null;if(this.locationButton){this.locationButton.find('a').listen('click',this.toggleLocSetting.bind(this));}
if(locationActivated){this.locationButton.find('.UIActionButton').removeClass('UIActionButton_SuppressButton').addClass('UIActionButton_Active');this.addState(UIComposer.STATE.LOC_ACTIVATED);}},initializeTextarea:function(maxLength,initialHeight){new TextAreaControl(this.input).setMaxLength(maxLength).setOriginalHeight(initialHeight).setAutogrow(true).onfocus();this.input.onfocus='';},initializeMentions:function(source){if(ua.firefox()<3||ua.safariPreWebkit()||ua.opera()){return;}
var input=$N('div',{id:this.input.id,className:'Mentions_Input',contentEditable:true},document.createTextNode(''));CSS.setStyle(input,'width',this.input.offsetWidth+'px');DOM.replace(this.input,input);this.input=input;var mentions=new typeahead_mentions(input,source);this.getMessage=mentions.getMessage.bind(mentions);this.setMessage=mentions.setMessage.bind(mentions);this.focusInput=mentions.focusInput.bind(mentions);},initializeAutoscrape:function(focus){var detector=new UrlDetector(this.input);detector.subscribe('urlDetected',this.autoScrape.bind(this));detector.setSuppressDetectionCheck(this.hasState.bind(this,UIComposer.STATE.ATTACHMENT_AREA));if(focus){detector.startDetectionInterval();}},initializeEvents:function(){addEventBase(this.input,'focus',this.focus.bind(this));if(this.locationButton){var link=this.locationButton.find('a.UIActionButton');Event.listen(link,'click',this.toggleLocSetting.bind(this));}
if(this.attachmentArea){var cancelHide=function(){this.shouldHide=false;}.bind(this);Event.listen(this.root,'click',cancelHide);Event.listen(this.root,'mousedown',cancelHide);Event.listen(document.body,'click',function(){if(this.shouldHide){this.blur();}
this.shouldHide=true;}.bind(this));}},focus:function(){this.ensureInitialized(true);if(!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)&&this.hasState(UIComposer.STATE.LOC_ACTIVATED)&&this.locationField){this.populateLoc();}
if(this.privacyWidget){if(this.privacyOptions.change_default_dialog&&!this.privacyChangedToken){this.privacyChangedToken=this.privacyWidget.subscribe('privacyChanged',function(type,privacy_data){this.showChangeDefaultPrivacyDialog(privacy_data);}.bind(this));}
if(this.privacyOptions.callout&&!this.privacyMenuActivatedToken){this.privacyMenuActivatedToken=this.privacyWidget.subscribe('menuActivated',function(type,data){this.closePrivacyCallout();this.privacyWidget.unsubscribe(this.privacyMenuActivatedToken);delete this.privacyMenuActivatedToken;}.bind(this));}}
var message=this.getMessage().trim();if(!message||message==this.placeholder){this.input.removeClass('DOMControl_placeholder');this.clearMessage();}
this.showPrivacyCallout();return this.addState(UIComposer.STATE.INPUT_FOCUSED);},blur:function(){if(this.privacyWidget&&this.privacyWidget.dialogOpen()){if(!this.privacyCloseDialogToken){this.privacyCloseDialogToken=this.privacyWidget.subscribe('closeDialog',function(){this.privacyWidget.unsubscribe(this.privacyCloseDialogToken);delete this.privacyCloseDialogToken;}.bind(this));}}else{if(this.attachmentList&&!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.removeState(UIComposer.STATE.INPUT_FOCUSED);if(!this.getMessage()){this.clearMessage();}}
this.hidePrivacyCallout();this.hideLocField();}
if(!this.getMessage().trim()&&!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.resetMessage();}
return this;},autoScrape:function(event,url){this.loadAttachment(UIComposer.APP_ID_POSTED,{url:url});},setAttachment:function(controller){this.attachmentArea.setAttachment(controller);return this;},getAttachment:function(){return this.attachmentArea.getAttachment();},setSourceAppId:function(sourceAppID){this.sourceAppID=sourceAppID;return this;},getSourceAppId:function(){return this.sourceAppID;},loadAttachment:function(app_id,extraData){this.ensureInitialized();var attachment=this.attachments[this.apps.indexOf(app_id)];if(this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.reset(true,false,false);}
if(!attachment){this.input.blur();return this.blur();}
this.attachmentList.select(attachment,extraData);this.focus();},showAttachment:function(attachment,extraData){this.focus();this.hideLocWidget();if(attachment.supports_privacy){this.showPrivacyWidget();}else{this.hidePrivacyWidget();}
this.hidePrivacyCallout();this.attachmentArea.show(attachment,extraData);return this;},reset:function(resetAttachment,resetMessage,focusInput){if(resetAttachment&&this.attachmentArea){this.attachmentList.reset();this.attachmentArea.reset();this.removeState(UIComposer.STATE.ATTACHMENT_AREA);this.removeState(UIComposer.STATE.ATTACHMENT_LOADED);}
this.removeLoc();this.showPrivacyWidget();this.showLocWidget();this.enable();if(resetMessage){this.resetMessage();}
if(focusInput!==false){this.focusInput();}else{this.removeState(UIComposer.STATE.INPUT_FOCUSED);}
this.shouldHide=true;return this;},addState:function(state){this.root.addClass(state);return this;},removeState:function(state){this.root.removeClass(state);return this;},hasState:function(state){return this.root.hasClass(state);},toggleState:function(state){CSS.toggleClass(this.root,state);return this;},disable:function(){this.input.disabled=true;return this.addState(UIComposer.STATE.INPUT_DISABLED).disableButton();},enable:function(){this.input.disabled=false;return this.removeState(UIComposer.STATE.INPUT_DISABLED).enableButton();},disableButton:function(){this.disabled=true;this.submitButton.addClass('UIActionButton_Disabled');return this;},enableButton:function(){this.disabled=false;this.submitButton.removeClass('UIActionButton_Disabled');return this;},getPrivacyData:function(){if(this.privacyWidget){return this.privacyWidget.getData();}
return null;},getData:function(){var endpoint=this.getEndpoint();var data={},message=this.getMessage();if(!this.isValidPost()){return null;}
if(endpoint==this.endpoint){copy_properties(data,this.targetID>0?UIComposer.TARGET_DATA:UIComposer.HOME_DATA);copy_properties(data,{status:message,target_id:this.targetID,profile_id:this.user,app_id:this.sourceAppID,privacy_data:{}});if(this.lastLoc){this.lastLoc.timestamp=Math.floor(this.lastLoc.timestamp.getTime()/1000);data.composer_loc_data=JSON.encode(this.lastLoc);}
if(this.attachmentArea&&this.attachmentArea.visible){copy_properties(data,this.attachmentArea.getData());if(!data.app_id){data.app_id=this.attachmentArea.attachment.app_id;}}}else{data=this.attachmentArea.getData();if(data){copy_properties(data,{id:this.user,target_id:this.targetID,app_id:this.attachmentArea.attachment.app_id,action:'post',button:'publish_button',comment_text:message});if(this.attachmentArea.attachment.supports_privacy){data.privacy_data={};}}}
if(data){data.composer_id=this.id;if(this.privacyWidget&&data.privacy_data){copy_properties(data.privacy_data,this.getPrivacyData());}
if(this.contextData){copy_properties(data,this.contextData);}}
return data;},isValidPost:function(){var message=this.getMessage();if(message==this.placeholder){return false;}
if(this.endpoint==this.getEndpoint()&&!message){return false;}
return true;},getEndpoint:function(){var endpoint;if(this.hasState(UIComposer.STATE.ATTACHMENT_LOADED)){endpoint=this.attachmentArea.getEndpoint();}
return endpoint||this.endpoint;},post:function(){if(this.disabled||!this.initialized){return false;}
if(this.privacyOptions.everyone_warning&&this.privacyWidget&&this.privacyWidget.isEveryonePrivacy()){this.showConfirmEveryonePrivacyDialog();return false;}
this._post();return false;},_post:function(){var endpoint=this.getEndpoint(),data=this.getData();this.logActions();if(!data){return false;}
this.disable();var req=new AsyncRequest().setURI(endpoint).setData(data).setHandler(bind(this,handle_require_email_conf_response,this.handleResponse.bind(this),null,null)).setErrorHandler(this.handleError.bind(this)).setFinallyHandler(this.enable.bind(this));for(key in this.contextData){req.setContextData(key,this.contextData[key]);}
req.send();},handleError:function(response){var error=response.getError();var payload=response.getPayload();switch(error){case kError_Platform_CallbackValidationFailure:return this.showError(payload.errorTitle,payload.errorMessage);case kError_Platform_ApplicationResponseInvalid:return this.showError(payload.errorTitle,payload.showDebug?payload.errorMessage:_tx("There was an application error. Please try again later."));default:this.shouldHide=false;this.reset();return this.showError(response.getErrorSummary(),response.getErrorDescription());}},handleResponse:function(response){var error=response.getError();var errIsWarning=response.getErrorIsWarning();this.reset(true,true).publish(response);if(error&&errIsWarning){this.showError(response.getErrorSummary(),response.getErrorDescription());}},logActions:function(){var data={target_id:this.targetID};if(this.attachmentArea&&!is_empty(this.attachmentArea.attachment)){data.app_id=this.attachmentArea.attachment.app_id;}
if(this.privacyWidget){data.privacy_default_value=this.privacyWidget.getDefaultValue();data.privacy_value=this.privacyWidget.getValue();}
new AsyncSignal('/ajax/composer/logging.php',data).send();},publish:function(response){var content_area=this.contentArea;if(content_area&&content_area.addContent){var markup=response,status,story;if(response.getPayload){var payload=response.getPayload();status=payload.status;markup=payload.markup;if(payload.payload_is_content){story=payload;}}
story=story||HTML(markup).getRootNode();var displayDelay=500;content_area.addContent(story,displayDelay);if(content_area.setStatus&&status){setTimeout(function(){content_area.setStatus(status);},displayDelay);}}
if(this.privacyWidget){this.privacyWidget.reset();}
return this;},populateLoc:function(){var new_results=false;var _populateLoc=function(pos){if(!this.hasState(UIComposer.STATE.LOC_ACTIVATED)||!this.hasState(UIComposer.STATE.INPUT_FOCUSED)||this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){return;}
if(this.lastLoc&&new_results!==false&&pos.coords.accuracy>=this.lastLoc.coords.accuracy){return;}
new_results=true;var desc=pos.desc.label||pos.desc.street||pos.desc.region;if(!desc){return;}
this.locationField.setContent(_tx("near {place}",{place:desc}));this.lastLoc=pos;if(!shown(this.locationField)){animation(this.locationField).to('height','auto').from('height',0).to('opacity',1).from('opacity',0).show().duration(100).ease(animation.ease.end).go();}};var error_count=0;var _errorCase=function(locError){if(++error_count>=2){return this.removeLoc();}};var _finder=function(){navigator.geolocation.getCurrentPosition(_populateLoc.bind(this),_errorCase.bind(this),{maximumAge:1000*60*60,enableHighAccuracy:false});navigator.geolocation.getCurrentPosition(_populateLoc.bind(this),_errorCase.bind(this),{maximumAge:1000*60*10,enableHighAccuracy:true});};Bootloader.loadComponents(['geolocation'],_finder.bind(this));},removeLoc:function(){if(this.locationField){this.locationField.empty();this.hideLocField();this.shouldHide=true;}
this.lastLoc=null;},toggleLocSetting:function(){this.toggleState(UIComposer.STATE.LOC_ACTIVATED);this.locationButton.find('.UIActionButton').toggleClass('UIActionButton_SuppressButton').toggleClass('UIActionButton_Active');var locationActivated=this.hasState(UIComposer.STATE.LOC_ACTIVATED);new AsyncRequest('/ajax/geo/setting.php').setData({collect:locationActivated}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();if(locationActivated){this.input.focus();this.populateLoc();}else{this.removeLoc();}
document.body.blur();return false;},showLocWidget:function(){show(this.locationButton);},hideLocWidget:function(){hide(this.locationButton);this.removeLoc();},hideLocField:function(){hide(this.locationField);},showPrivacyWidget:function(){show(this.privacyButton);},hidePrivacyWidget:function(){hide(this.privacyButton);},showPrivacyCallout:function(){this.root.scry('div.UIComposer_PrivacyCallout').map(show);},hidePrivacyCallout:function(){this.root.scry('div.UIComposer_PrivacyCallout').map(hide);},closePrivacyCallout:function(){this.hidePrivacyCallout();this.savePrivacyData('close','callout',function(){this.root.scry('div.UIComposer_PrivacyCallout').map(DOM.remove);}.bind(this));},savePrivacyData:function(data_key,response_key,callback){response_key=response_key||data_key;callback=callback||bagofholding;var data={};data[data_key]=true;new AsyncRequest().setData(data).setURI('/ajax/privacy/save_composer_data.php').setHandler(function(response){var payload=response.getPayload();this.privacyOptions[response_key]=payload[response_key];callback();}.bind(this)).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();},showChangeDefaultPrivacyDialog:function(privacy_data){var callback=function(){this.privacyWidget.unsubscribe(this.privacyChangedToken);delete this.privacyChangedToken;}.bind(this);new Dialog().setAsync(new AsyncRequest().setURI('/ajax/privacy/change_default_dialog.php').setData({privacy_data:privacy_data})).setHandler(this.savePrivacyData.bind(this,'seen_changed_default','change_default_dialog',callback)).show();},showConfirmEveryonePrivacyDialog:function(){new Dialog().setAsync(new AsyncRequest().setURI('/ajax/privacy/confirm_everyone_dialog.php')).setHandler(this.savePrivacyData.bind(this,'seen_everyone','everyone_warning',this._post.bind(this))).show();},getContextData:function(){return this.contextData;},resetMessage:function(){this.input.addClass('DOMControl_placeholder');this.input.setStyle('height','');this.setMessage(this.placeholder);},clearMessage:function(){this.setMessage('');},getMessage:function(){return this.input.value.trim();},setMessage:function(message){this.input.value=message;},showError:function(title,message){new ErrorDialog().setTitle(title).setBody(message||_tx("There was an application error. Please try again later.")).setButtons([Dialog.OK]).show();},focusInput:function(){this.input.select();this.input.focus();}};copy_properties(UIComposer,{instances:{},getInstance:function(id){return this.instances[id]||{post:bagofholding};},storeInstance:function(id,composer){this.instances[id]=composer;},focusInstance:function(id){var instances=this.instances;onloadRegister(function(){instances[id].focus();setTimeout(function(){instances[id].input.focus();},0);});},animation:function(element,callback){return animation(element).ondone(callback||bagofholding).ease(animation.ease.end).duration(200);}});copy_properties(UIComposer,{DIALOG_WIDTH:560,DIALOG_WIDTH_PIC:620,APP_ID_POSTED:2309869772,HOME_DATA:{action:'HOME_UPDATE',home_tab_id:1,profile_id:null,status:null,target_id:null},TARGET_DATA:{action:'PROFILE_UPDATE',profile_id:null,status:null,target_id:null},STATE:{PIC_NONE:'UIComposer_STATE_PIC_NONE',PIC_INSIDE:'UIComposer_STATE_PIC_INSIDE',PIC_OUTSIDE:'UIComposer_STATE_PIC_OUTSIDE',LOC_ACTIVATED:'UIComposer_STATE_LOC_ACTIVATED',INPUT_FOCUSED:'UIComposer_STATE_INPUT_FOCUSED',INPUT_DISABLED:'UIComposer_STATE_INPUT_DISABLED',ATTACHMENT_AREA:'UIComposer_STATE_ATTACHMENT_AREA',ATTACHMENT_LOADED:'UIComposer_STATE_ATTACHMENT_LOADED'}});

function UIComposerAttachmentList(composer,root){this.composer=composer;this.root=root;this.title=composer.root.find('div.UIComposer_AttachmentTitle');var attachments=composer.attachments,items=$A(DOM.scry(root,'li.UIComposer_Attachment a')),count=items.length;var initializeItem=function(item,index){var attachment=attachments[index];attachment.index=index;Event.listen(item,'click',this.select.bind(this,attachment,null));}.bind(this);var buildItem=function(attachment,index){var item=$N('a',{href:"#",className:'UIComposer_MoreItem'},[$N('span',{className:'UIComposer_MoreIcon',style:{backgroundImage:'url('+attachment.menu_icon+')'}}),HTML(attachment.caption)]);initializeItem(item,index+count);return item;};items.each(initializeItem);if(attachments.length>count){this.menu=new UIActionMenu().setSuppressButton(true).setSuppressText(true).setTooltip(_tx("More")).setContentCallback(function(){return $N('div',attachments.slice(count).map(buildItem));});root.appendChild($N('li',{className:'UIComposer_More'},this.menu.root));}}
UIComposerAttachmentList.prototype={select:function(attachment,extraData){this.title.setContent(attachment.caption);this.title.setStyle('backgroundImage','url('+attachment.icon+')');this.composer.showAttachment(attachment,extraData);if(this.menu){this.menu.hideMenu();}
hide(this.root);document.body.blur();return false;},reset:function(){show(this.root);}};

function OnVisible(element,handler){this.targetY=Vector2.getElementPosition(element).y;var scroll_listener=function(){var y=Vector2.getScrollPosition().y+
Vector2.getViewportDimensions().y;if(y>this.targetY){this.remove();handler();}
return true;}.bind(this);if(DOMScroll.usingScrollWrapper()){var scroll_target=DOMScroll.getScrollRoot();}else{var scroll_target=window;}
this.scrollListener=Event.listen(scroll_target,'scroll',scroll_listener);this.resizeListener=Event.listen(window,'resize',scroll_listener);scroll_listener();}
copy_properties(OnVisible.prototype,{remove:function(){if(this.scrollListener){this.scrollListener.remove();this.resizeListener.remove();this.scrollListener=this.resizeListener=null;}}});

function UIIntentionalStream(root,instanceName,newest,oldest,hiddenCount,hiddenIDCount,storyCount,hasAdditionalStories,activeFilter,showAll){if(!root){throw new Error('UIIntentionalStream instantiated with no root.');}
copy_properties(this,{id:root.id,root:root,instanceName:instanceName,newest:newest,oldest:oldest,hiddenCount:hiddenCount,hiddenIDCount:hiddenIDCount,storyCount:storyCount,hasAdditionalStories:hasAdditionalStories,activeFilter:activeFilter,showAll:showAll,isAutoRefreshing:false,hasPendingRefresh:false,storyInterval:null,lastRefresh:new Date().getTime(),presenceCheckCounter:0,ignoreQueueTurningActive:false,storyQueue:[],storyQueueCount:0,showNewStories:root.find('div.UIIntentionalStream_ShowNewStories'),showNewStoriesMsg:root.find('a.UIIntentionalStream_ShowNewStories_Msg'),pageloadTime:new Date().getTime(),heavyRefreshCount:0,pushRefreshCount:0,pollRefreshCount:0,scrollLoadIsDone:false,error:root.find('div.UIIntentionalStream_Error'),pager:root.find('div.UIIntentionalStream_Pager'),showMore:root.find('div.UIIntentionalStream_ShowMore'),hiddenInfo:root.find('div.UIIntentionalStream_HiddenInfo'),streamContent:root.find('div.UIIntentionalStream_Content'),requestNum:0,firstStory:null,forceRefresh:false,showAll:false});this.setAutoRefreshConfig({});onunloadRegister(this.unload.bind(this));this.userActivity();this.updateFirstStory();this.updatePager();CSS.removeClass(this.pager,'hidden_elem');this.uaToken=UserActivity.subscribe(this.userActivity.bind(this));if(!UIIntentionalStream.instances){UIIntentionalStream.instances={};}
UIIntentionalStream.instances[instanceName]=this;UIIntentionalStream.instance=this;}
UIIntentionalStream.prototype.unload=function(){if(this.logDetail&&this.allowAutoRefresh){var open_time=new Date().getTime()-this.pageloadTime;scribe_log('nile_refresh_detail','unload_stat '+open_time+' '+this.heavyRefreshCount+' '+this.pushRefreshCount+' '+this.pollRefreshCount);}
this.enableAutoRefresh(false);UIIntentionalStream.instance=null;UIIntentionalStream.instances[this.instanceName]=null;UserActivity.unsubscribe(this.uaToken);this.clearScrollLoader();}
UIIntentionalStream.getInstance=function(instanceName){return UIIntentionalStream.instances[instanceName];}
UIIntentionalStream.handleNewStoryMessage=function(type,data){var stream=UIIntentionalStream.instance;if(stream&&!stream.queueIsFull()){stream.pushRefreshCount++;stream.updateStream();}}
UIIntentionalStream.callOnInstance=function(fn_name){return function(){if(UIIntentionalStream.instance){var fn=UIIntentionalStream.instance[fn_name];return fn.apply(UIIntentionalStream.instance,arguments);}else{return null;}}}
UIIntentionalStream.prototype.presenceStreamCheck=function(time,asyncData,forceUpdate){if(!this.allowAutoRefresh||!this.presenceLoopPerPoll){return false;}
if(!presenceNotifications.requiresUpdate(time,asyncData,forceUpdate)){return false;}
if(!this.needsRefresh()){return false;}
++this.presenceCheckCounter;if(this.presenceCheckCounter>=this.presenceLoopPerPoll){var extraData=this.getCurrentParams();extraData.newest=this.newest;extraData.last_refresh=this.getMSSinceLastRefresh();this.lastPresenceRequestNum=++this.requestNum;asyncData['stream_query']=extraData;this.presenceCheckCounter=0;return true;}
return false;}
UIIntentionalStream.prototype._getUpdateInsertType=function(){if(this.isDarkRefresh){return UIIntentionalStream.REFRESH_DARK;}else if(this.queueNewStories){return UIIntentionalStream.REFRESH_QUEUE;}else{return UIIntentionalStream.REFRESH_PREPEND;}}
UIIntentionalStream.prototype.presenceStreamResponse=function(payload,time){this.lastRefresh=new Date().getTime();this.heavyRefreshCount++;this.handleResponsePayload(this.lastPresenceRequestNum,this._getUpdateInsertType(),payload);this.lastPresenceRequestNum=0;}
UIIntentionalStream.prototype.setStoryInterval=function(rate){this.storyInterval=rate;return this;}
UIIntentionalStream.prototype.setAutoRefreshConfig=function(config){config=config||{};var long_time=24*60*60*1000;this.allowAutoRefresh=coalesce(config.allow_auto_refresh,false);this.inactiveThreshold=coalesce(config.inactive_threshold,0);this.activeRefreshTime=coalesce(config.fast_refresh_rate,long_time);this.inactiveRefreshTime=coalesce(config.slow_refresh_rate,long_time);this.allowPolling=coalesce(config.allow_polling,false);this.refreshFactor=coalesce(config.refresh_factor,10);this.queueNewStories=coalesce(config.queue_new_stories,true);this.isDarkRefresh=coalesce(config.dark,false);this.presenceLoopPerPoll=coalesce(config.presence_loop_per_poll,0);this.maxQueueSize=coalesce(config.max_queue_size,0);this.minRefreshInterval=coalesce(config.min_refresh_interval,60*1000);this.logDetail=coalesce(config.log_detail,false);this.ignoreQueueTurningActive=coalesce(config.ignore_queue_turning_active,false);return this;}
UIIntentionalStream.prototype.queueIsFull=function(){return(this.maxQueueSize&&this.storyQueueCount>=this.maxQueueSize);}
UIIntentionalStream.prototype.shouldAutoRefresh=function(){return this.isAutoRefreshing&&this.allowAutoRefresh;}
UIIntentionalStream.prototype.userActivity=function(){var wasInactive=this.isInactive();this.lastActivity=(new Date().getTime());if(wasInactive&&this.allowAutoRefresh&&this.needsRefresh(true)){this.updateStream();this.schedulePoll(this.getRefreshInterval());}
return true;}
UIIntentionalStream.prototype.getMSSinceLastActivity=function(){return(new Date().getTime())-this.lastActivity;}
UIIntentionalStream.prototype.getMSSinceLastRefresh=function(){return(new Date().getTime())-this.lastRefresh;}
UIIntentionalStream.prototype.isInactive=function(){return this.getMSSinceLastActivity()>this.inactiveThreshold;}
UIIntentionalStream.prototype.getRefreshInterval=function(){if(this.isInactive()){return this.inactiveRefreshTime;}else{if(this.storyInterval!=null){var interval=this.storyInterval*this.refreshFactor;return Math.max(interval,this.activeRefreshTime);}else{return this.activeRefreshTime;}}}
UIIntentionalStream.prototype.enableAutoRefresh=function(enabled,immediate){this.isAutoRefreshing=enabled;if(enabled){var delay=immediate?0:this.getRefreshInterval();this.schedulePoll(delay);}else{this.cancelUpdate();}}
UIIntentionalStream.prototype.cancelUpdate=function(){if(this.updateTask){clearTimeout(this.updateTask);this.updateTask=null;}}
UIIntentionalStream.prototype.schedulePoll=function(delay){this.cancelUpdate();if(this.allowPolling){this.updateTask=setTimeout(this.runUpdatePoll.bind(this),delay);}}
UIIntentionalStream.prototype.needsRefresh=function(turningActive){return!(this.hasPendingRefresh||(!(turningActive&&this.ignoreQueueTurningActive)&&this.queueIsFull())||this.getMSSinceLastRefresh()<this.minRefreshInterval);}
UIIntentionalStream.prototype.runUpdatePoll=function(){this.updateTask=null;if(!this.shouldAutoRefresh()){return;}
if(this.needsRefresh()){this.pollRefreshCount++;this.updateStream();}
this.schedulePoll(this.getRefreshInterval());}
UIIntentionalStream.prototype.updateStream=function(flush_on_complete){if(!this.allowAutoRefresh){return;}
this.loadNewer({showLoader:false,ignoreSelf:true,flushOnComplete:flush_on_complete,insertType:this._getUpdateInsertType()});}
UIIntentionalStream.prototype.clearScrollLoader=function(){if(this.currentScrollListener){this.currentScrollListener.remove();this.currentScrollListener=null;}
this.scrollLoadIsDone=true;}
UIIntentionalStream.prototype.loadMoreOnScroll=function(loadMoreStoryID,count){if(this.scrollLoadIsDone){return;}
var scroll_handler=function(){this.clearScrollLoader();this.loadOlder({count:count,showLoader:false});}.bind(this);if(ge(loadMoreStoryID)){this.currentScrollListener=new OnVisible($(loadMoreStoryID),scroll_handler);}else{this.scroll_handler();}}
UIIntentionalStream.prototype.updatePageCache=function(){this.loadNewer({bundleAsync:true,showLoader:false,ignoreReqNum:true});}
UIIntentionalStream.prototype.getID=function(){return this.id;}
UIIntentionalStream.prototype.showPositioned=function(element,type,kwargs){if(type==UIIntentionalStream.REFRESH_APPEND){this.root.appendContent(element);}else if(type==UIIntentionalStream.REFRESH_PREPEND){this.root.prependContent(element);}else if(type==UIIntentionalStream.REFRESH_EXPAND){DOM.insertAfter($(kwargs.expandStoryID),element);}
element.setStyle('display','block');if(element.src){element.src=element.src;}}
UIIntentionalStream.showHidden=function(){var req=URI.getRequestURI();req.addQueryData({'show_hidden':true});goURI(req);DOMScroll.scrollTo($('home_stream'),false);return false;}
UIIntentionalStream.prototype.showHiddenPeople=function(filterKey){if(filterKey==undefined){filterKey=this.getCurrentFilterKey();}
var onModified=function(){var data=this.getCurrentParams();this.refresh(UIIntentionalStream.REFRESH_TRANSITION,data);DOMScroll.scrollTo($('home_stream'),false);}.bind(this);NewsFeedEditor.show(filterKey,onModified);return false;}
UIIntentionalStream.prototype.getCurrentFilterKey=function(){var params=this.getCurrentParams();if(params){return params.filter;}
return null;}
UIIntentionalStream.prototype.loadOlder=function(kwargs){kwargs=kwargs||{};if(!this.oldest){return;}
var params=this.getCurrentParams();params.oldest=this.oldest;if(kwargs.count){params.delay_load_count=kwargs.count;}
this.refresh(UIIntentionalStream.REFRESH_APPEND,params,kwargs);return this;}
UIIntentionalStream.prototype.loadNewer=function(kwargs){if(!this.newest){return;}
kwargs=kwargs||{};var extraData=this.getCurrentParams();extraData.newest=this.newest;if(kwargs.ignoreSelf){extraData.ignore_self=true;}
extraData.load_newer=true;var type=coalesce(kwargs.insertType,UIIntentionalStream.REFRESH_PREPEND);this.lastRefresh=new Date().getTime();this.refresh(type,extraData,kwargs);return this;}
UIIntentionalStream.prototype.getCurrentParams=function(){var params={};var qdata=URI.getRequestURI(true,true).getQueryData();var valid_param=this.getValidParams();if(valid_param){valid_param.forEach(function(i){params[i]=qdata[i];});}else{params=qdata;}
params.hidden_count=this.hiddenCount||0;return params;}
UIIntentionalStream.prototype.setHomeFilter=function(home_filter){this._homeFilter=home_filter;}
UIIntentionalStream.prototype.setHomeFilterLoading=function(loading){if(this._homeFilter){this._homeFilter.setLoading(loading);}}
UIIntentionalStream.prototype.pillRefresh=function(allParam){var req=URI.getRequestURI();var qdata=req.getQueryData();req.setQueryData({'all':allParam});if('filter'in qdata){req.addQueryData({'filter':qdata.filter});}
goURI(req);}
UIIntentionalStream.prototype.refresh=function(type,data,kwargs){kwargs=kwargs||{};var requestNum=++this.requestNum;var bundleAsync=coalesce(kwargs.bundleAsync,false);var showLoader=coalesce(kwargs.showLoader,true);var instanceName=this.instanceName;var handler=function(response){UIIntentionalStream.getInstance(instanceName).handleResponse(requestNum,type,response,kwargs);};var errHandler=function(response){UIIntentionalStream.getInstance(instanceName).handleError(requestNum,type,response);};var finallyHandler=function(response){UIIntentionalStream.getInstance(instanceName).handleFinally(type,response);};if(!data.request_type){data.request_type='none';}
var is_replayable=true;if(data.newest){is_replayable=false;}
if(data.filter){this.activeFilter=data.filter;}else{data.filter=this.activeFilter;}
if('all'in data){this.showAll=data.all;}else{data.all=this.showAll;}
kwargs['all']=parseInt(data.all)?1:0;this.hasPendingRefresh=true;new AsyncRequest().setURI(this.getEndpoint()).setReadOnly(true).setOption('retries',0).setMethod('GET').setData(data).setOption('bundle',bundleAsync).setReplayable(is_replayable).setHandler(handler).setErrorHandler(errHandler).setTransportErrorHandler(errHandler).setFinallyHandler(finallyHandler).send();if(type==UIIntentionalStream.REFRESH_TRANSITION){this.storyCount=0;this.hasAdditionalStories=true;hide(this.pager);this.clearQueue();this.clearScrollLoader();this.oldest=this.newest=null;}
if(type==UIIntentionalStream.REFRESH_APPEND&&showLoader){this.pager.addClass('UIIntentionalStream_PagerLoading');}
if(showLoader){this.setHomeFilterLoading(true);}}
UIIntentionalStream.prototype.updateFirstStory=function(content){content=$(content||this.streamContent);var story=content.scry(UIIntentionalStream.FIRST_STORY_SELECTOR)[0];if(this.firstStory){CSS.removeClass(this.firstStory,UIIntentionalStream.FIRST_STORY_CLASS);}
if(story){CSS.addClass(story,UIIntentionalStream.FIRST_STORY_CLASS);}
this.firstStory=story;}
UIIntentionalStream.prototype.addContent=function(content,delay){CSS.addClass(content,UIIntentionalStream.FIRST_STORY_CLASS);this.addContentPrepend($N('div',{className:'UIStream'},content),delay);}
UIIntentionalStream.prototype.addContentPrepend=function(content,delay){this.updateFirstStory(content);if(ua.ie()<=7){CSS.setStyle(content,'display','none');this.streamContent.prependContent(content);setTimeout(function(){CSS.setStyle(content,'display','');},delay);}else{CSS.setStyle(content,'overflow','hidden');CSS.setStyle(content,'height','0px');CSS.setOpacity(content,'0');this.streamContent.prependContent(content);var anim=animation(content).to('height','auto').to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION);if(delay){setTimeout(anim.go.bind(anim),delay);}else{anim.go();}}}
UIIntentionalStream.prototype.addContentAppend=function(content){this.streamContent.appendContent(content);this.clearFirst(content);}
UIIntentionalStream.prototype.unfollow=function(data){var asyncData={value:data.id,action:'unfollow',filter_key:this.getCurrentFilterKey()};var asyncHandler=function(){var count=UIIntentionalStream.forEachStory(data.id,hide);this.hiddenCount+=count;this.hiddenIDCount++;this.updatePager();}.bind(this);new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData(asyncData).setReplayable(true).setHandler(asyncHandler).send();var selected_story=$(data.storyID);var msg_div=$N('div',{className:'unfollow_message'});var undo_link=$N('a',{className:'unfollow_undo','href':'#'},HTML(_tx("Undo")));var show_hidden_link=$N('a',{onclick:this.showHiddenPeople.shield(this)},HTML(_tx("Edit Options")));undo_link.listen('click',this.undoUnfollow.bind(this,data,msg_div));var unfollow_msg;if(!data.isApp){unfollow_msg=_tx("<strong>{name} has been hidden from your News Feed.<\/strong><br>In the future, you won't see posts from {first_name}.  ",{'name':data.name,'first_name':data.firstName});}else{unfollow_msg=_tx("<strong>{application} has been hidden from your News Feed.<\/strong><br>In the future, you won't see posts from {application}.  ",{'application':data.name});}
msg_content=[undo_link,HTML(unfollow_msg),' (',show_hidden_link,')'];msg_div.setContent($N('p',msg_content));hide(msg_div);DOM.insertBefore(msg_div,selected_story);var count=UIIntentionalStream.forEachStory(data.id,hide);CSS.setOpacity(msg_div,'0');show(msg_div);if(count>1){DOMScroll.scrollTo(msg_div,false,true);}
animation(msg_div).to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION).ondone(function(){setTimeout(function(){animation(msg_div).to('opacity','0').checkpoint().ease(animation.ease.both).to('height','0').to('padding','0').blind().duration(UIIntentionalStream.ANIMATION_DURATION).ondone(function(){if(msg_div.parentNode){msg_div.remove();}}).go();},10*1000);}).go();return false;}
UIIntentionalStream.forEachStory=function(id,fn){var stories=UIIntentionalStream.getStoriesByAssoc(id);stories.forEach(fn);return stories.length;}
UIIntentionalStream.prototype.undoUnfollow=function(data,msg_div){var asyncData={value:data.id,action:'undo_unfollow',filter_key:this.getCurrentFilterKey()};var asyncHandler=function(){var count=UIIntentionalStream.forEachStory(data.id,show);this.hiddenCount-=count;this.hiddenIDCount--;this.updatePager();}.bind(this);new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData(asyncData).setReplayable(true).setHandler(asyncHandler).send();var count=UIIntentionalStream.forEachStory(data.id,show);if(count>1){DOMScroll.scrollTo(msg_div,false,true);}
msg_div.remove();return false;}
UIIntentionalStream.prototype.updatePager=function(){var show_hidden_link=null;var edit_prefs_link=null;if(this.hiddenCount>0){var story_count_text;if(this.hiddenCount==1){story_count_text=_tx("1 Hidden Post");}else{story_count_text=_tx("{count} Hidden Posts",{'count':this.hiddenCount});}
show_hidden_link=$N('a',{href:'#'},_tx("Show {count-stories}",{'count-stories':story_count_text}));Event.listen(show_hidden_link,'click',UIIntentionalStream.showHidden);}
if(this.hiddenIDCount>0){edit_prefs_link=$N('a',{href:'#'},_tx("Edit Options"));Event.listen(edit_prefs_link,'click',this.showHiddenPeople.shield(this));}
var bottom_info='';if(show_hidden_link&&edit_prefs_link){bottom_info=[show_hidden_link,HTML(' &#183; '),edit_prefs_link];}else if(show_hidden_link){bottom_info=[show_hidden_link];}else if(edit_prefs_link){bottom_info=[edit_prefs_link];}
if(!this.storyCount||!this.hasAdditionalStories){hide(this.showMore);if(this.hiddenIDCount){show(this.pager);}else{hide(this.pager);}}else{show(this.showMore);show(this.pager);}
DOM.setContent(this.hiddenInfo,bottom_info);}
UIIntentionalStream.getStoriesByAssoc=function(assoc){return DOM.scry(UIIntentionalStream.instance.root,'div.aid_'+assoc);}
UIIntentionalStream.prototype.handleResponse=function(requestNum,type,response,kwargs){var ignore_req_num=response.isReplay()||kwargs.ignoreReqNum;Arbiter.inform(UIIntentionalStream.EVENT_HANDLE_RESPONSE,{filter:kwargs.filter,all:kwargs.all});return this.handleResponsePayload(requestNum,type,response.getPayload(),ignore_req_num,kwargs);}
UIIntentionalStream.prototype.handleDuplicateStories=function(content){var modified_textareas=[];var new_stories=content.scry("div.UIStory");for(var i=0;i<new_stories.length;i++){var new_story=new_stories[i];var story_id=new_story.id;var current_story=ge(story_id);if(!current_story){continue;}
var old_textareas=current_story.scry("textarea.add_comment_text");if(old_textareas.length==1){var old_textarea=old_textareas[0];if(old_textarea.hasClass("DOMControl_autogrow")){var new_textareas=new_story.scry("textarea.add_comment_text");if(new_textareas.length!=0){var new_textarea=new_textareas[0];new_textarea.value=old_textarea.value;modified_textareas.push(new_textarea);}}}
animation(current_story).to('height','0px').to('opacity','0').duration(UIIntentionalStream.ANIMATION_DURATION).ease(animation.ease.end).ondone(function(){DOM.remove(current_story)}).go();}
return modified_textareas;}
UIIntentionalStream.prototype.handleResponsePayload=function(requestNum,type,payload,ignore_request_num,kwargs){kwargs=kwargs||{};if(is_empty(payload)){return;}
if(payload.autoRefreshConfig){this.setAutoRefreshConfig(payload.autoRefreshConfig);}
this.setHomeFilterLoading(false);if(type==UIIntentionalStream.REFRESH_APPEND){this.pager.removeClass('UIIntentionalStream_PagerLoading');}
if(type==UIIntentionalStream.REFRESH_EXPAND){$(kwargs.expandStoryID).find('div.UIIntentionalStory_CollapsedStories').removeClass('UIIntentionalStory_CollapsedStoriesLoading').addClass('hidden_elem');}
hide(this.error);if(!ignore_request_num&&requestNum!=this.requestNum){return;}
this.hiddenCount=payload.hiddenCount;this.hiddenIDCount=payload.hiddenIDCount;this.storyCount+=payload.storyCount;if('newestStoryTime'in payload&&payload.newestStoryTime>this.newest){this.newest=payload.newestStoryTime;}
if('oldestStoryTime'in payload&&(!this.oldest||payload.oldestStoryTime<this.oldest)){this.oldest=payload.oldestStoryTime;}
if('hasAdditionalStories'in payload){this.hasAdditionalStories=payload.hasAdditionalStories;}else if(type==UIIntentionalStream.REFRESH_APPEND&&payload.storyCount==0){this.hasAdditionalStories=false;}
this.updatePager();if(payload.html){var content=HTML(payload.html).getRootNode();switch(type){case UIIntentionalStream.REFRESH_QUEUE:this.queueStories(content,payload.storyCount);break;case UIIntentionalStream.REFRESH_PREPEND:this.addContentPrepend(content);break;case UIIntentionalStream.REFRESH_APPEND:this.addContentAppend(content);this.clearScrollLoader();break;case UIIntentionalStream.REFRESH_TRANSITION:this.streamContent.setContent(content);this.updateFirstStory();DOMScroll.scrollTo(new Vector2(0,0,"document"),false);break;case UIIntentionalStream.REFRESH_DARK:break;case UIIntentionalStream.REFRESH_EXPAND:CSS.setStyle(content,'overflow','hidden');CSS.setOpacity(content,'0');DOM.insertAfter($(kwargs.expandStoryID),content);animation(content).to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION).go();break;}}
if(kwargs.flushOnComplete){this._flushQueue();}}
UIIntentionalStream.prototype.clearQueue=function(delay){delay=delay||0;this.storyQueue=[];this.storyQueueCount=0;if(delay){setTimeout(function(){animation(this.showNewStories).to('opacity','0').checkpoint().to('height','0').hide().duration(150).go();}.bind(this),delay);}else{hide(this.showNewStories);}}
UIIntentionalStream.prototype.flushQueue=function(){if(this.getMSSinceLastRefresh()<this.minRefreshInterval){this._flushQueue();}else{this.updateStream(true);}}
UIIntentionalStream.prototype._flushQueue=function(){var stories=[];var newStories=$N('div',{className:'UIStream'});this.storyQueue.forEach(function(stream,i){if(i!=0){this.clearFirst(stream);}
newStories.appendContent($A(stream.childNodes));stream.remove();}.bind(this));var modified_textareas=this.handleDuplicateStories(newStories);this.addContentPrepend(newStories);for(var i=0;i<modified_textareas.length;i++){modified_textareas[i].onfocus();modified_textareas[i].onblur();}
this.clearQueue(UIIntentionalStream.ANIMATION_DURATION);}
UIIntentionalStream.prototype.clearFirst=function(content){var first=DOM.scry(content,UIIntentionalStream.FIRST_STORY_SELECTOR)[0];if(first){CSS.removeClass(first,UIIntentionalStream.FIRST_STORY_CLASS);}}
UIIntentionalStream.prototype.queueStories=function(content,numStories){var showMessage=(this.storyQueueCount==0);hide(content);this.streamContent.prependContent(content);this.storyQueue=[content].concat(this.storyQueue);var countString='';if(numStories){this.storyQueueCount+=numStories;countString=this.storyQueueCount;}
var msg;if(this.storyQueueCount==1){msg=_tx("SHOW 1 NEW POST");}else{msg=_tx("SHOW {count} NEW POSTS",{count:countString});}
this.showNewStoriesMsg.setContent(HTML(msg));if(showMessage){CSS.setStyle(this.showNewStories,'height','0');CSS.setStyle(this.showNewStories,'display','block');animation(this.showNewStories).to('height','auto').to('opacity','1').go();}}
UIIntentionalStream.prototype.handleError=function(requestNum,type,response){if(!response.isReplay()&&requestNum!=this.requestNum){return;}
this.setHomeFilterLoading(false);if(type==UIIntentionalStream.REFRESH_PREPEND){this.pager.removeClass('UIIntentionalStream_PagerLoading');}
if(type==UIIntentionalStream.REFRESH_EXPAND){$(kwargs.expandStoryID).find('div.UIIntentionalStory_CollapsedStories').removeClass('UIIntentionalStory_CollapsedStoriesLoading');}
var error=response.getError();if(error==kError_Async_NotLoggedIn){var title=_tx("Feed Error");var msg=_tx("Your session has timed out. Please {login}.",{'login':'<a href="/login.php">'+_tx("log in")+'</a>'});new ErrorDialog().showError(title,msg);}
if(type!=UIIntentionalStream.REFRESH_PREPEND){this.showPositioned(this.error,type);}}
UIIntentionalStream.prototype.handleFinally=function(type){if(type==UIIntentionalStream.REFRESH_TRANSITION){PageTransitions.transitionComplete();}
this.hasPendingRefresh=false;}
UIIntentionalStream.prototype.getValidParams=function(){return UIIntentionalStream.VALID_PARAMS;}
UIIntentionalStream.prototype.getEndpoint=function(){return UIIntentionalStream.ENDPOINT;}
UIIntentionalStream.prototype.registerShowNewStoriesKey=function(){KeyEventController.registerKey("u",function(event,type){if(event.getModifiers().shift){if(this.doShowNewStories&&this.storyQueueCount>0){this.doShowNewStories();return false;}}}.bind(this));}
copy_properties(UIIntentionalStream,{ANIMATION_DURATION:300,REFRESH_TRANSITION:1,REFRESH_PREPEND:2,REFRESH_APPEND:3,REFRESH_QUEUE:4,REFRESH_DARK:5,REFRESH_EXPAND:6,FIRST_STORY_CLASS:'UIStory_First',FIRST_STORY_SELECTOR:'div.UIStory_First',PAGER_SELETOR:'div.UIIntentionalStream_Pager',PAGER_INNER_SELETOR:'div.UIIntentionalStream_PagerInner',EVENT_HANDLE_RESPONSE:'handleResponse',VALID_PARAMS:['filter','show_hidden'],ENDPOINT:'/ajax/intent.php',_presenceInit:false});UIIntentionalStream.presenceRegister=function(){if(UIIntentionalStream._presenceInit){return true;}
var checkCB=UIIntentionalStream.callOnInstance('presenceStreamCheck');var responseCB=UIIntentionalStream.callOnInstance('presenceStreamResponse');presenceUpdater.register('stream_update',checkCB,responseCB,bagofholding,bagofholding);Arbiter.subscribe(Presence.getArbiterMessageType('feedpub'),UIIntentionalStream.handleNewStoryMessage);UIIntentionalStream._presenceInit=true;};

UIIntentionalStory={setup:function(root,data){if(!root||!data){return null;}
if(data.unfollow){var hover=Event.listen(root,'mouseover',function(){this.createUnfollowMenu(root,data);hover.remove();}.bind(this));}},createUnfollowMenu:function(root,data){var menuRoot=root.scry('div.UIStory_Hide')[0];if(!menuRoot){return;}
var title=data.title;data=data.unfollow;var menu=new UIActionMenu();var list=new UISelectList();var listCallback=function(root,menu,list,checked,data){menu.hideMenu();list.reset();var unfollowData=copy_properties({storyID:root.id},data);UIIntentionalStream.instance.unfollow(unfollowData);}.bind(this,root,menu,list);list.setMode(UISelectList.SINGLE_SELECT_MODE).setCallback(listCallback);data.users.each(function(user){list.addItem(HTML(user.hideString),false,user);});if(data.app){list.addItem(HTML(data.app.hideString),false,data.app);}
menu.setTitle(title).setContentCallback(list.getElement.bind(list)).setSuppressButton(true).setAlignRight(true);menuRoot.setContent(menu.getNodes());},_moreDetails:{},expandStory:function(story_id,actor_id,newest,oldest){var data=UIIntentionalStream.instance.getCurrentParams();data.expand_story_uid=actor_id;data.newest=newest;data.oldest=oldest;var kwargs={expandStoryID:story_id,showLoader:false};$(story_id).find('div.UIIntentionalStory_CollapsedStories').addClass('UIIntentionalStory_CollapsedStoriesLoading');UIIntentionalStream.instance.refresh(UIIntentionalStream.REFRESH_EXPAND,data,kwargs);},morePrivacyDetails:function(fbid,row,elem){if(is_empty(this._moreDetails)){onunloadRegister(function(){this._moreDetails={};}.bind(this));}
if(this._moreDetails[fbid]){return;}
this._moreDetails[fbid]=true;new AsyncRequest().setURI('/ajax/privacy/more_details.php').setData({fbid:fbid,privacy_data:row}).setHandler(function(response){var explanation=response.getPayload().explanation;DOM.setContent(DOM.find(elem,'span.UITooltip_Text'),explanation);}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();}};

function ProfileStream(profile_id,viewer_id,max_time,filter,see_more,can_edit,is_page,is_split){this.profile_id=profile_id;this.viewer_id=viewer_id;this.filter=filter;this.can_edit=can_edit;this.is_page=is_page;this.is_split=is_split;this.min_time=0;this.max_time=max_time;this.ajax_endpoint_uri='/ajax/stream/profile.php';this.streamElem=$('profile_minifeed');this.streamContainerElem=$('profile_stream_container');this.loadingElem=ge('profile_stream_filters_posts_loading');this.settingsElem=ge('profile_settings');this.pagerNextElem=ge('profile_pager_next');this.cache={};this.cache[this.filter]={'html':this.streamElem.innerHTML,'max_time':this.max_time,'see_more':see_more}
if(ProfileStream.instance){delete ProfileStream.instance;}
ProfileStream.instance=this;return this;}
ProfileStream.getInstance=function(){return ProfileStream.instance;}
ProfileStream.animationDuration=300;ProfileStream.dirtyCache=function(){if(stream=ProfileStream.getInstance()){stream.cache={};}}
ProfileStream.FILTER={'ALL_POSTS':1,'POSTS_BY_ME':2,'POSTS_BY_OTHERS':3,'SINGLE_STORY':4,'SETTINGS':-1}
ProfileStream.clearStatus=function(profile_id){new AsyncRequest().setURI('/ajax/updatestatus.php').setData({'profile_id':profile_id,'clear':1}).setHandler(ProfileStream.clearStatusUI).send();}
ProfileStream.clearStatusUI=function(){var ps=$('profile_status');animation(ps).to('opacity',0).duration(200).ondone(function(){CSS.addClass(ps,'hidden_elem');}).go();}
ProfileStream.prototype.setStatus=function(status){if(this.can_edit&&status){var ps=ge('profile_status');if(!ps){return;}
var duration=150;var st=$('status_text');var sti=$('status_time_inner');var callback=function(){st.setContent(HTML(status));sti.setContent(HTML(_tx("a moment ago&nbsp;")));var status_source=ge('status_source');var status_mobile=ge('status_mobile_indicator');if(status_source){CSS.addClass(status_source,'hidden_elem');}
if(status_mobile){CSS.addClass(status_mobile,'hidden_elem');}
CSS.removeClass(ps,'hidden_elem');new animation(ps).to('opacity',1).duration(duration).go();};if(DOM.getText(st).trim()){new animation(ps).to('opacity',0).duration(duration).ondone(callback).go();}else{CSS.setOpacity(ps,0);duration=300;callback();}}}
ProfileStream.prototype.addContent=function(content){var ondone=bagofholding;var hide=false;var message=null;if(this.filter!=ProfileStream.FILTER.ALL_POSTS){if(this.can_edit&&this.filter!=ProfileStream.FILTER.POSTS_BY_ME){hide=true;message=this.is_split?_tx("This post will be moved to the Stream tab."):_tx("This post will appear in your filter.");}
if(!this.can_edit&&this.filter!=ProfileStream.FILTER.POSTS_BY_OTHERS){hide=true;message=this.is_split?_tx("This post will be moved to the Wall tab."):(this.is_page?_tx("This post will appear in the Fans filter."):_tx("This post will appear in the Friends filter."));}}
if(hide){var status=HTML('<div class="status">'+message+'</div>');content=DOM.create('div',{},[status,content]);ondone=function(){animation(content).duration(6000).checkpoint().to('opacity','0').duration(ProfileStream.animationDuration).ondone(function(){DOM.remove(content);}).go();}}
CSS.setStyle(content,'height','0px');CSS.setOpacity(content,'0');var oldFirst=this.streamElem.find('div.UIIntentionalStory_Profile_First');if(oldFirst){oldFirst.removeClass('UIIntentionalStory_Profile_First');}
CSS.addClass(content,'UIIntentionalStory_Profile_First');$(this.streamElem).prependContent(content);ProfileStream.dirtyCache();new animation(content).to('height','auto').to('opacity','1').duration(ProfileStream.animationDuration).ondone(ondone).go();var empty=this.streamElem.scry('div.empty_wall');if(empty.length){new animation(empty[0]).to('opacity','0').duration(ProfileStream.animationDuration).ondone(function(){DOM.remove(empty[0]);}).go();}}
ProfileStream.prototype.fadeAndSwap=function(e1,e2){animation(e1).to('opacity',0).duration(100).hide().ondone(function(){CSS.setOpacity(e2,0);animation(e2).to('opacity',1).from(0).duration(100).show().go();}).go();return true;}
ProfileStream.prototype.showSettings=function(filter){if(this.filter==ProfileStream.FILTER.SETTINGS){return false;}
this.filter=ProfileStream.FILTER.SETTINGS
this.fadeAndSwap(this.streamContainerElem,this.settingsElem);return false;}
ProfileStream.prototype.loadStream=function(fade){var apply_content=function(content_html,fade_and_swap){DOM.setContent(this.streamElem,HTML(content_html));if(fade_and_swap){this.fadeAndSwap(this.settingsElem,this.streamContainerElem);}}.bind(this);var request_max_time=this.max_time;if(this.min_time==0&&this.cache[this.filter]){this.max_time=this.cache[this.filter].max_time;CSS.conditionClass(this.pagerNextElem,'hidden_elem',!this.cache[this.filter].see_more);apply_content(this.cache[this.filter].html,fade);fade=false;}
if(this.loadingElem){CSS.addClass(this.loadingElem.firstChild,'isLoading');}
this.loading=true;new AsyncRequest().setMethod('GET').setReadOnly(true).setURI(this.ajax_endpoint_uri).setData({profile_id:this.profile_id,viewer_id:this.viewer_id,filter:this.filter,max_time:request_max_time}).setContextData('clicktype','Filter Stories or Pagination',this.viewer_id!=this.profile_id).setHandler(function(response){if(this.max_time==0){this.cache[this.filter]={'html':response.payload.stream_html,'max_time':response.payload.max_time,'see_more':response.payload.see_more};}
this.max_time=response.payload.max_time;CSS.conditionClass(this.pagerNextElem,'hidden_elem',!response.payload.see_more);apply_content(response.payload.stream_html,fade);}.bind(this)).setFinallyHandler(function(){this.loading=false;if(this.loadingElem){CSS.removeClass(this.loadingElem.firstChild,'isLoading');}}.bind(this)).send();}
ProfileStream.prototype.showStream=function(filter){if(this.loading){return false;}
var orig_filter=this.filter;this.filter=filter;this.min_time=0;this.max_time=0;this.loadStream(orig_filter==ProfileStream.FILTER.SETTINGS);return false;}
ProfileStream.prototype.showMore=function(filter,is_scroll_load){CSS.addClass(this.pagerNextElem,'page_loading');this.loading=true;new AsyncRequest().setMethod('GET').setReadOnly(true).setURI(this.ajax_endpoint_uri).setData({profile_id:this.profile_id,viewer_id:this.viewer_id,filter:this.filter,is_scroll_load:is_scroll_load,max_time:this.max_time}).setContextData('clicktype','Filter Stories or Pagination',this.viewer_id!=this.profile_id).setHandler(function(response){CSS.conditionClass(this.pagerNextElem,'hidden_elem',!response.payload.see_more);DOM.appendContent(this.streamElem,HTML(response.payload.stream_html));this.max_time=response.payload.max_time;if(this.min_time==0){this.cache[this.filter]={'html':this.streamElem.innerHTML,'max_time':this.max_time,'see_more':response.payload.see_more};}}.bind(this)).setFinallyHandler(function(){this.loading=false;CSS.removeClass(this.pagerNextElem,'page_loading');}.bind(this)).send();}
ProfileStream.hideStory=function(story_id,profile_id,story_key,story_type,app_link){var delete_fn=function(){var story=$(story_id);var collapse=story;if(CSS.hasClass(story,'UIRecentActivityStory')){var container=story.parentNode;if(CSS.hasClass(container,'UIStream_Chunk')){if(container.childNodes.length==1){collapse=container;container=container.parentNode;if(container.childNodes.length==1){collapse=container.parentNode.parentNode;}}}else{if(container.childNodes.length==1){collapse=container.parentNode.parentNode;}}}else if(CSS.hasClass(story,'UIIntentionalStory_Profile_First')){CSS.removeClass(story,'UIIntentionalStory_Profile_First');if(CSS.hasClass(story.nextSibling,'UIIntentionalStory')){CSS.addClass(story.nextSibling,'UIIntentionalStory_Profile_First');}}
var checkBox=ge('revoke_permission');var revoke_permission=checkBox&&checkBox.checked;new AsyncRequest().setURI('/ajax/minifeed.php').setData({'profile_fbid':profile_id,'ministory_key':story_key,'story_type':story_type,'revoke_permission':revoke_permission}).setHandler(function(response){if(response.getPayload().status_cleared){ProfileStream.clearStatusUI();}
DOM.remove(collapse);}).setErrorHandler(function(response){ErrorDialog.showAsyncError(response);CSS.removeClass(collapse,'hidden_elem');animation(collapse).to('height','auto').duration(300).ease(animation.ease.end).go();}).setFinallyHandler(ProfileStream.dirtyCache).send();animation(collapse).to('height','0px').duration(300).ease(animation.ease.end).ondone(function(){CSS.addClass(collapse,'hidden_elem')}).go();}
var body=_tx("Are you sure you want to delete this post?");if(app_link){var option=ProfileStream._createDialogOptionField('revoke_permission',_tx("Don't allow {app_name} to publish without asking me",{'app_name':app_link}));body+='<br/><br/>'+option;}
Dialog.createConfirmationDialog(body,_tx("Delete Post"),Dialog.newButton('delete_story_'+story_id,_tx("Delete"),null,delete_fn)).show();}
ProfileStream._createDialogOptionField=function(id,message){var markup='<div class="dialog_option">'+'<input type="checkbox" id="'+id+'"/>'+'<span class="dialog_option_text">'+message+'</span>'+'</div>';return markup;}

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