/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  May 5th 2009 10:04:17 AM PDT                                 */
/*      Machine:  10.16.139.108                                                */
/*       Source:  Global Cache                                                 */
/*     Location:  js/d85sewms2wgscgk0.pkg.js h:wiltdzgq                        */
/*       Locale:  en_US                                                        */
/*         Path:  js/d85sewms2wgscgk0.pkg.js                                   */


var message_dialog={show:function(to_uid,subj,message,ref){subj=subj?subj:'';message=message?message:'';var data={'id':to_uid,'subject':subj,'message':message};var async=new AsyncRequest().setMethod('POST').setData(data).setContextData('clicktype','Send a Message',ref==="profile_others").setURI('/ajax/inbox/composer.php');new Dialog().setClassName('message_dialog').setStackable(true).setContentWidth(500).setAsync(async).show();return false;},send:function(button){var data=serialize_form(button.form);data['action']='compose';new AsyncRequest().setURI('/ajax/inbox/ajax.php').setData(data).setHandler(bind(null,message_dialog.send_handle,button)).setErrorHandler(bind(null,message_dialog.send_error,button)).send();},send_handle:function(button,r){var payload=r.getPayload();var dialog=Dialog.getCurrent();if(dialog){dialog.setTitle(payload.title).setBody(payload.content).setButtons([Dialog.OK]).clearHandler().show();if(!payload.error){dialog.setAutohide(2000);}}},send_error:function(button,r){var dialog=Dialog.getCurrent();if(dialog){if(r.getError()==kError_Inbox_DuplicateMessages){dialog.hide();return;}
dialog.setTitle(_tx("Error")).setBody(_tx("Sorry, an unknown error occurred")).setButtons([Dialog.OK]).clearHandler().show().setAutohide(1100);}}};function _message_composer_link_handler(link){var current_uri=URI();if(current_uri.getFragment().match(/^\/inbox\//)){return true;}
var uri=new URI(link.href);if(uri.getPath()=='/inbox/'){var query=uri.getQueryData();if((typeof query.compose!="undefined")&&(typeof query.id!="undefined")&&(query.id<2200000000)){message_dialog.show(query.id);return false;}}
return true;}

function show_poke_dialog(uid,pobj,DEPRECATED,parent,refresh,first_name,ref){new PokeController(uid,pobj,parent,refresh,first_name,ref);return false;}
function PokeController(uid,pokeback_obj,parent,refresh,first_name,ref){copy_properties(this,{uid:uid,pokeback:(pokeback_obj?1:0),pokeback_obj:pokeback_obj,failed_captcha:0,parent:parent,refresh:refresh,dialog:null,first_name:first_name,title:null,ref:ref});this.show();}
PokeController.prototype.show=function(){new AsyncRequest('/ajax/poke.php').setData({can_poke:this.uid,pokeback:this.pokeback,failed_captcha:this.failed_captcha}).setContextData('clicktype','Poke',this.ref==="profile_others").setReplayable(false).setHandler(this.onresponse.bind(this)).send();}
PokeController.prototype.onresponse=function(response){var p=response.getPayload();this.dialog=new Dialog();this.title=p.dialog_title;if(!p.status||p.warned){this.dialog.setModal(true);}
if(p.status){this.dialog.setTitle(this.title).setBody(p.dialog_contents).setButtons([Dialog.newButton('poke',_tx("Poke"),'',this.poke.bind(this)),Dialog.CANCEL]).show();}else{this.dialog.setTitle(this.title).setBody(p.dialog_contents).setButtons([Dialog.OK]).show();}}
PokeController.prototype.poke=function(){var data={uid:this.uid,pokeback:this.pokeback};var captcha_form=ge('captcha_form');if(captcha_form){var captcha_elements=captcha_form.getElementsByTagName('input');for(var i=0;i<captcha_elements.length;i++){data[captcha_elements[i].name]=captcha_elements[i].value;}}
this.show_onpoke_dialog=true;new AsyncRequest('/ajax/poke.php').setData(data).setHandler(this.onpoke.bind(this)).send();return false;}
function remove_poke(obj,rem_class,parent_class,poke){new AsyncRequest().setURI('/ajax/poke.php').setData({'p':poke}).setHandler(function(){hide_poke_obj(obj,rem_class,parent_class);}).send();}
function hide_poke_obj(obj,rem_class,parent_class){obj=ge(obj);if(obj&&parent_class){pobj=obj;while(!CSS.hasClass(pobj,parent_class)&&pobj.parentNode){pobj=pobj.parentNode;}}
if(obj&&rem_class){while(!CSS.hasClass(obj,rem_class)&&obj.parentNode){obj=obj.parentNode;}
if(obj){if(DOM.scry(pobj,'div.ind_poke').length<=1){DOM.remove(pobj);}else{DOM.remove(obj);}}}
return false;}
PokeController.prototype.onpoke=function(response){var p=response.getPayload();if(!p.captcha){this.dialog.setAutohide(100);this.failed_captcha=1;this.show();return;}
if(this.pokeback){var poke_parent_str=this.parent||'sidebar_item pokes';hide_poke_obj(this.pokeback_obj,'ind_poke','pokes');if(this.refresh){update_poke_summary(this.refresh,'poke_start_index','poke_end_index','poke_total');}}
if(this.show_onpoke_dialog){this.dialog.setTitle(this.title).setBody(p.dialog_contents).setButtons([Dialog.OK]).show();if(p.status){this.dialog.setAutohide(1100);}
this.show_onpoke_dialog=false;}}
function update_poke_summary(display_obj,start,end,total){var start_count=$(start).innerHTML;var end_count=$(end).innerHTML-1;var total_count=$(total).innerHTML-1;$(end).innerHTML=end_count;$(total).innerHTML=total_count;$(display_obj).innerHTML=_gen_poke_summary_text(start_count,end_count,total_count);}
function _gen_poke_summary_text(start,end,total){if(total==1){return _tx("Displaying the only poke.");}else if(total==0||end<start){return _tx("I've got nothing for you.");}else if(end==total){return _tx("Displaying all {number} pokes.",{'number':total});}else{return _tx("Displaying pokes {start} - {end} of {total}.",{'start':start,'end':end,'total':total});}}

function show_removefriend_dialog(to_uid,button_text,ref){this.onResponse=function(asyncResponse){var payload=asyncResponse.getPayload();if(payload.status){var remove_friend_function=function(){this.onResponsePost=function(asyncResponsePost){var payloadPost=asyncResponsePost.getPayload();dialog.setTitle(payloadPost.dialog_title).setBody(payloadPost.dialog_contents).setButtons([Dialog.OK]).show();if(payloadPost.status){window.location.reload();dialog.setAutohide(1600);}};asyncRequestPost=new AsyncRequest().setURI('/ajax/removefriend.php').setData({'uid':to_uid}).setHandler(bind(this,'onResponsePost')).send();}
var dialog=new Dialog().setTitle(payload.dialog_title).setBody(payload.dialog_contents).setButtons([Dialog.newButton('remove-friend',button_text,'',remove_friend_function),Dialog.CANCEL]).show();}else{new Dialog().setTitle(payload.dialog_title).setBody(payload.dialog_contents).setButtons([Dialog.OK]).show();}};new AsyncRequest().setURI('/ajax/removefriend.php').setData({'can_remove':to_uid}).setContextData('clicktype','Remove a Friend',ref==="profile_others").setHandler(bind(this,'onResponse')).setErrorHandler(bind(this,'onError')).send();return false;}

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