var BetterInfoBox=new Class({events:[],navy_box:null,textarea:null,title:null,initialize:function(b,a){this.title=b;this.win_size=window.getSize();if(a==null){a="/img/friends/x"}this.x_uri=a;this.init_textarea();this.init_overlay();this.init_navy_box()},init_navy_box:function(){this.navy_box=new Element("div",{"class":"navy_box",id:"navyBox",styles:{display:"block","z-index":"100001"}});this.navy_box_top=new Element("div",{"class":"navy_box_top"});this.box_title=new Element("h4",{html:"&raquo; "+this.title});var a=this;this.close_btn=new Element("img",{src:getStaticUri(this.x_uri),events:{click:function(){a.close_window()}}});this.content=new Element("div",{"class":"navy_box_content"});this.div_clear=new Element("div",{"class":"clear"});this.navy_box_bottom=new Element("div",{"class":"navy_box_bottom"});this.navy_box_top.adopt(this.box_title,this.close_btn);this.navy_box.grab(this.navy_box_top);this.content.adopt(this.textarea,this.div_clear);this.navy_box.adopt(this.content,this.navy_box_bottom)},init_textarea:function(){this.textarea=new Element("div",{"class":"navy_box_text"})},init_overlay:function(){var a=this;this.overlay=new Element("div",{id:"infobox_overlay",styles:{position:"absolute",left:"0px",top:"0px",width:"100%","z-index":"100000",background:"#000",opacity:"0.7"}});this.overlay_div=new Element("div",{styles:{position:"relative",width:"100%",height:"100%"},events:{click:function(){a.close_window()}}});this.overlay_info=new Element("p",{id:"overlay_info",styles:{"z-index":"100001",position:"absolute",right:"5px",bottom:"415px","font-size":"11px","font-weight":"bold",color:"#fff"},html:"kliknij na tło, by zamknąć okno"});this.overlay_div.grab(this.overlay_info);this.overlay.grab(this.overlay_div)},show:function(a){$$("select").setStyle("visibility","hidden");this.scroll_event();if(typeof(a)=="object"){this.textarea.empty();this.textarea.grab(a)}else{this.textarea.set("html",a)}$(document.body).grab(this.navy_box);$(document.body).grab(this.overlay);this.scroll_event();if(this.support_position_fixed()){this.overlay.setStyles({position:"fixed",top:this.overlay.getStyle("top").toInt()-window.getScroll().y,left:this.overlay.getStyle("left").toInt()-window.getScroll().x});this.navy_box.setStyles({position:"fixed",top:this.navy_box.getStyle("top").toInt()-window.getScroll().y,left:this.navy_box.getStyle("left").toInt()-window.getScroll().x})}else{$(window).addEvents({mousewheel:function(b){b.preventDefault()}});document.html.style.overflow="hidden";document.html.style.overflowY="hidden"}},add_on_close_event:function(a){this.events.push(a)},close_window:function(){$$("select").setStyle("visibility","visible");this.navy_box.dispose();this.overlay.dispose();this.events.each(function(a){a()});if(!this.support_position_fixed()){$(window).removeEvents("mousewheel");document.html.style.overflow="auto";document.html.style.overflowY="scroll"}},center_box:function(){var a=window.getScroll();this.navy_box.style.top=(this.win_size.y/2)-100+a.y+"px";this.navy_box.style.left=(this.win_size.x/2-350/2)+a.x+"px"},adjust_overlay:function(){var a=window.getScroll();this.overlay.setStyle("top",a.y-600+"px");this.overlay.setStyle("height",this.win_size.y+1000+"px")},scroll_event:function(){this.center_box();this.adjust_overlay()},support_position_fixed:function(){return Browser.Engine.gecko||Browser.Engine.presto||Browser.Engine.webkit}});
