/* ap-event.gallery-display.js (ap-event.gallery-display.js) compressed and outputted: Mon, 03 Sep 2007 18:31:09 EDT */


ApEventClass=Class.create();ApEventClass.prototype={initialize:function(parentElement){this.pid=parseInt($F('gallery-display-pid'));this.lv=parseInt($F('gallery-display-ulv'));this.transport='/source/gallery/gallery-handler.php';this.par=parentElement;this.getfav=this.showHand.bind(this);this.deletepost=this.delPost.bindAsEventListener(this);this.setInplaceEditor=this.inplaceEditor.bind(this);if(this.pid){Event.observe($('getfav'),'click',this.getfav);}
if(this.lv<=10){$$(this.par+" input.rel-id").each(this.setInplaceEditor);}
$$(this.par+" a.post-delete").each(function(nod){Event.observe(nod,'click',this.deletepost);this.nojump(nod);}.bind(this));},nojump:function(elm){$(elm).onclick=function(){return false;};},showHand:function(ev){var uri=this.transport+'?getfavs='+this.pid,container='editthis';new Ajax.Updater(container,uri,{asynchronous:true,onComplete:function(){new Effect.Opacity(container,{duration:0.3,from:0.3,to:1.0,queue:'end'});},onLoading:function(){new Effect.Opacity(container,{duration:0.3,from:1.0,to:0.3});}});this.nojump(this.getEv(ev));},getEv:function(ev){var elm=Event.element(ev);Event.stop(ev);return(elm);},delPost:function(ev){var elm=this.getEv(ev),pid=$(elm).readAttribute('rel');if(pid)
new Ajax.Request('?deleteid='+pid,{asynchronous:true});Effect.DropOut('ID'+pid);},inplaceEditor:function(ev){var pid=$F(ev),o={h:this.transport,row:15,cols:75};if(!pid)
return;new Ajax.InPlaceEditor('post'+pid,o.h,{callback:function(form,value){return'quickedit='+pid+'&epost='+escape(value)},externalControl:'edit'+pid,rows:o.row,cols:o.cols,savingText:'Updating Post',loadTextURL:o.h+'?getpost='+pid});}}
new ApEventClass('div.post-row div.post-edit-options');