/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  December 17th 2009 4:02:46 PM PST                            */
/*      Machine:  10.16.139.108                                                */
/*       Source:  Global Cache                                                 */
/*     Location:  js/presence/beep.js h:jv5ibwte                               */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/presence/beep.js                                          */

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

function Beep(b,c){copy_properties(this,c);this.unread=true;this._owner=b;this._node=$(HTML(this.html).getNodes()[0]);CSS.setOpacity(this._node,'0');this._node.find('a.beeper_x').listen('click',this.remove.bind(this));var a=this._node.scry('a.undo_link');if(a.length==1)a[0].listen('click',this.onUndoClick.bind(this,a[0]));this._node.listen('mouseover',this.onMouseOver.bind(this));this._node.listen('mouseout',this.onMouseOut.bind(this));}copy_properties(Beep,{REMOVE_BEEP_ANIM_MS:250,UNDONE_BEEP_DELAY_MS:1000});copy_properties(Beep.prototype,{onMouseOver:function(event){this._node.addClass('UIBeep_Selected');this._selected=true;this.setEdges();},onMouseOut:function(event){this._node.removeClass('UIBeep_Selected');this._selected=false;this.setEdges();},onUndoClick:function(a){new AsyncRequest().setURI('/ajax/presence/undo_send.php').setData({alert_id:this.alertId}).setHandler(function(){DOM.replace(a,$N('span',{className:'undo_link'},_tx("Undone")));this.remove.bind(this).defer(Beep.UNDONE_BEEP_DELAY_MS);}.bind(this)).send();},xout:function(){this._owner.pause();var a=function(){this._owner.unpause();}.bind(this);ChatNotifications.showReportDialog(this.applicationName,this.onHideBeepSpam.bind(this,false),this.onHideBeepSpam.bind(this,true),a);},onHideBeepSpam:function(a){ChatNotifications.markAppNotificationSpam(this.applicationId,this.platformType,a);this._owner.hideBeepsByApplication(this.applicationId);presenceNotifications.hideNotifications(this.applicationId);this._owner.unpause(Beeper.DEFAULT_DELAY_MS);},remove:function(){animation(this._node).to('width',30).to('height',27).to('margin-left',169).to('opacity',0).duration(Beep.REMOVE_BEEP_ANIM_MS).ease(animation.ease.both).ondone(function(){this._node.remove();this._owner.beeps.remove(this);if(!this._owner.beeps.length){this._owner.reset();}else this._owner.updateEdges();}.bind(this)).go();this.fadeOut(Beep.REMOVE_BEEP_ANIM_MS);},markRead:function(){this.unread=false;},endFade:function(){if(this._node)this._node.removeClass('UIBeep_Fading');this._owner.setFading(false,this._isTop,this._isBottom);},fadeOut:function(a){this._node.addClass('UIBeep_Fading');this._owner.setFading(true,this._isTop,this._isBottom);var c=this._node.scry('img.beeper_pic');if(c&&c.length){c=c[0];animation(c).to('width',20).to('height',20).duration(a).blind().go();}var b=this._node.find('div.UIBeep_Icon');animation(b).from('width',40).to(20).duration(a).ondone(this.endFade.bind(this)).go();},fadeIn:function(a){this._owner.fadeIn(this._isTop,this._isBottom,a);animation(this._node).to('opacity',1).ease(animation.ease.both).duration(a).show().go();},setEdges:function(){if(this._isTop)this.setTop(true);if(this._isBottom)this.setBottom(true);},setBottom:function(a){this._isBottom=a;CSS.conditionClass(this._node,'UIBeep_Bottom',a);if(a)this._owner.setBottom(this._selected);},setTop:function(a){this._isTop=a;CSS.conditionClass(this._node,'UIBeep_Top',a);if(a)this._owner.setTop(this._selected);},getNode:function(){return this._node;}});

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