DarkenBackground=Class.create();DarkenBackground.prototype={initialize:function(a,b){var c=this;a=a;var d={background:"black",height:"101%",width:"100%",left:0,top:0,opacity:0.25,position:"absolute"};this.element=new Element("div",{id:a});this.element.setStyle(d);if(b)this.obj=b;this.element.observe("click",function(){c.element.remove();c.obj&&c.obj.hide()});this.show()},show:function(){var a=$(a);a||(a=$("body").up());a||(a=$("#body").up());a&&a.insert(this.element)}};ShowModal=Class.create();
ShowModal.prototype={initialize:function(a){var b=$(a);b.addClassName("modal-dialog");var c=b.getDimensions(),d=document.viewport.getDimensions(),f=document.viewport.getScrollOffsets();new DarkenBackground("modal_bg"+a,b);if(c.height<d.height){a=(d.height-c.height)/2;b.setStyle({bottom:a+"px",position:"fixed"})}else{a=d.bottom;b.setStyle({bottom:a+"px",position:"absolute"})}if(c.width<d.width){a=(d.width-c.width+f.left)/2;b.setStyle({left:a+"px"})}else b.setStyle({left:f.left+"px"});var e=$(e);e||
(e=$("body").up());b=b.remove();e.insert(b);b.show()}};
