var OverlayWindow,swfBin,oDlg;swfBin={};oDlg={};window.addEvent("domready",function(){$("darboven-enter").setStyle("display","none");swfBin.logo=new Swiff(sBaseUrl+"sys/app/assets/gfx/swf/top_logo.swf",{id:"darboven_swf_logo",width:560,height:125,params:{wMode:"transparent"},container:$("darboven_swf_logo_bin")});swfBin.winieta=new Swiff(sBaseUrl+"sys/app/assets/gfx/swf/top_intro.swf",{id:"darboven_swf_winieta",width:560,height:190,params:{wMode:"transparent"},container:$("darboven_winieta_bin")});swfBin.diagram=new Swiff("intro_diagram.swf",{id:"darboven_swf_diagram",width:770,height:700,params:{wMode:"transparent"},container:$("flashContent")});new OverlayWindow($("dummy_H"),[{path:sBaseUrl+"rabaty/dla_domu.html",onComplete:function(){$("overlay_scrollbar").setStyle("height",250);$("overlay_scroll_bin").setStyle("display","block")}},handleButtonsHome],{removeLink:true});new OverlayWindow($("dummy_B"),[{path:sBaseUrl+"rabaty/dla_biura.html",onComplete:function(){$("overlay_scrollbar").setStyle("height",40);$("overlay_scroll_bin").setStyle("display","block")}},handleButtonsBureau],{removeLink:true,bin_class:"bin_bureau",jjdp_rabat_biuro:true});new OverlayWindow($("dummy_C"),[{path:sBaseUrl+"rabaty/dla_lokalu.html"},handleButtonsCafe],{removeLink:true,bin_class:"bin_cafe"});if($$("#login_reg a").length){new OverlayWindow($$("#login_reg a")[1],[{path:sBaseUrl+"zapomniane-haslo"}],{removeLink:true})}});OverlayWindow=new Class({Implements:[Options,Events],options:{mask_id:"overlay_mask",mask_second_id:"overlay_hidden",mask_class:"body_mask",mask_second_class:"overlay_second",bin_class:"overlay_div",bin_id:"overlay_bin",header_class:"overlay_title",header_inner_class:"overlay_inner_title",header_txt:"",header_inner_html:"",header_close_html:"",header_close_class:"overlay_close",content_id:"overlay_txt",content_wrapper_id:"overlay_scroll_wrapper",content_scroll_bin_id:"overlay_scroll_bin",content_scrollbar_id:"overlay_scrollbar",content_scrolltrack_id:"overlay_scrolltrack",scroll_window_height_offset:250,rescale_scroll_wrapper:false,scrollbar_height_offset:0,use_spinner:true,hide_scrollbar:false,scrollbar_related_to:"overlay_bin",bin_height_offset:180,bin_width_offset:250,content_width_offset:290,removeLink:false,onAllLoaded:function(){},jjdp_rabat_biuro:false},initialize:function(c,a,b){this.trigger=$(c);this.content_to_load=a;this.setOptions(b);this.oOverlayElems={};this.oOverlayAssets={};this.active=false;this.attachOnClick();if(this.options.removeLink){this.trigger.set("href","javascript:void(0)")}},attachOnClick:function(){this.trigger.addEvent("click",function(b){if(b){b.stop()}this.active=true;vp_y_offset=window.getScroll().y;this.oOverlayAssets.mask=new Mask(document.body,{id:this.options.mask_id,"class":this.options.mask_class,style:{opacity:0}});this.oOverlayAssets.mask_tween=new Fx.Tween(this.oOverlayAssets.mask);this.oOverlayAssets.mask.show();this.oOverlayAssets.mask_second=new Mask(document.body,{id:this.options.mask_second_id,"class":this.options.mask_second_class});this.oOverlayAssets.mask_second_tween=new Fx.Tween(this.oOverlayAssets.mask_second);this.oOverlayAssets.mask_second.show();this.oOverlayElems.bin=new Element("div",{"class":this.options.bin_class,id:this.options.bin_id});this.oOverlayElems.bin.setStyle("top",vp_y_offset);this.oOverlayElems.header=new Element("div",{html:this.options.header_txt,"class":this.options.header_class});this.oOverlayElems.header_inner=new Element("div",{html:this.options.header_inner_html,"class":this.options.header_inner_class});this.oOverlayElems.header_close=new Element("div",{html:this.options.header_close_html,"class":this.options.header_close_class});this.oOverlayElems.content_wrapper=new Element("div",{id:this.options.content_wrapper_id});this.oOverlayElems.content_scroll_bin=new Element("div",{id:this.options.content_scroll_bin_id});this.oOverlayElems.content_scrollbar=new Element("div",{id:this.options.content_scrollbar_id});this.oOverlayElems.content_scrolltrack=new Element("div",{id:this.options.content_scrolltrack_id});this.oOverlayElems.content=new Element("div",{id:this.options.content_id});vp=window.getSize();this.oOverlayElems.bin.setStyles({});this.oOverlayElems.content_wrapper.setStyles({width:800});this.oOverlayElems.content_scroll_bin.setStyles({height:(580-this.options.scroll_window_height_offset)});this.oOverlayElems.content_scrolltrack.setStyles({height:(580-this.options.scroll_window_height_offset)});if(this.options.rescale_scroll_wrapper===true){this.oOverlayElems.content_wrapper.setStyles({height:(vp.y-this.options.scroll_window_height_offset)})}this.oOverlayAssets.mask_tween.start("opacity",0.8);this.oOverlayAssets.mask_second_tween.start("opacity",1);this.oOverlayAssets.mask_second.addEvent("click",function(){this.active=false;$try(function(){clearTimeout(globalTimer)});this.oOverlayAssets.mask_tween.start("opacity",0);this.oOverlayAssets.mask_second.destroy();if(Browser.ie7||Browser.ie8){return}this.oOverlayAssets.mask.destroy();this.oOverlayElems.header.destroy();this.oOverlayElems.content.destroy();this.oOverlayElems.bin.destroy();window.removeEvents("scroll")}.bind(this));this.oOverlayElems.header_close.inject(this.oOverlayElems.header);this.oOverlayElems.header.inject(this.oOverlayAssets.mask_second);this.oOverlayElems.content.inject(this.oOverlayElems.content_wrapper);this.oOverlayElems.content_wrapper.inject(this.oOverlayElems.bin);this.oOverlayElems.content_scroll_bin.inject(this.oOverlayElems.bin);this.oOverlayElems.content_scrolltrack.inject(this.oOverlayElems.content_scroll_bin);this.oOverlayElems.content_scrollbar.inject(this.oOverlayElems.content_scroll_bin);this.oOverlayElems.bin.inject(this.oOverlayAssets.mask_second);if(this.options.hide_scrollbar===true){this.oOverlayElems.content_scroll_bin.setStyle("opacity",0)}this.oOverlayElems.bin.addEvent("click",function(c){c.stopPropagation()}.bind(this));this.oOverlayElems.bin.addEvent("mousewheel",function(c){c.stop();c=new Event(c);if(c.wheel<0){if((parseInt(this.oOverlayElems.content_scroll_bin.getStyle("height"))-parseInt(this.oOverlayElems.content_scrollbar.getStyle("top"))-parseInt(this.oOverlayElems.content_scrollbar.getStyle("height")))>20){this.oOverlayElems.content_scrollbar.setStyle("top",parseInt(this.oOverlayElems.content_scrollbar.getStyle("top"))+20)}else{this.oOverlayElems.content_scrollbar.setStyle("top",parseInt(this.oOverlayElems.content_scroll_bin.getStyle("height"))-parseInt(this.oOverlayElems.content_scrollbar.getStyle("height")))}this.scrollContent()}else{if(c.wheel>0){if(parseInt(this.oOverlayElems.content_scrollbar.getStyle("top"))>20){this.oOverlayElems.content_scrollbar.setStyle("top",parseInt(this.oOverlayElems.content_scrollbar.getStyle("top"))-20)}else{this.oOverlayElems.content_scrollbar.setStyle("top",0)}this.scrollContent()}}}.bind(this));this.oOverlayElems.header_close.addEvent("click",function(c){this.oOverlayAssets.mask_second.fireEvent("click")}.bind(this));this.bin_coords=this.oOverlayElems.bin.getCoordinates();this.oOverlayElems.header.setStyles({width:890,left:(!Browser.Engine.trident5)?this.bin_coords.left:this.bin_coords.left,top:(this.bin_coords.top+12)});var a=new Drag.Move(this.oOverlayElems.content_scrollbar,{container:this.oOverlayElems.content_scroll_bin,onDrag:function(c,d){this.scrollContent()}.bind(this),snap:0});this.loadContent()}.bind(this))},loadContent:function(){this.content_to_load.each(function(a){if($type(a)=="object"){new Request.HTML({url:a.path,method:"post",data:a.post_data,append:this.oOverlayElems.content,onComplete:function(){this.oOverlayElems.content_scrollbar.setStyle("height",Math.floor((parseInt(this.oOverlayElems.bin.getStyle("height"))-this.options.scrollbar_height_offset)*parseInt(this.oOverlayElems.content_scroll_bin.getStyle("height"))/(parseInt(this.oOverlayElems.content.getStyle("height")))));this.scrollBinHeight=parseInt(this.oOverlayElems.content_scroll_bin.getStyle("height"));this.scrollbarHeight=parseInt(this.oOverlayElems.content_scrollbar.getStyle("height"));this.binHeight=parseInt(this.oOverlayElems.bin.getStyle("height"));this.contentHeight=parseInt(this.oOverlayElems.content.getStyle("height"));if($(this.options.content_id)){if(parseInt($(this.options.content_id).getStyle("height"))<parseInt($(this.options.scrollbar_related_to).getStyle("height"))){this.oOverlayElems.content_scroll_bin.setStyle("display","none")}}if(a.onComplete){$try(a.onComplete)}}.bind(this)}).send()}else{if($type(a)=="function"){$try(a)}else{if($type(a)=="string"){this.oOverlayElems.content.appendText(a)}}}},this);this.oOverlayElems.bin.setStyle("opacity",1);this.fireEvent("allLoaded");return},scrollContent:function(){this.scrollbarOffset=parseInt(this.oOverlayElems.content_scrollbar.getStyle("top"));if(this.options.jjdp_rabat_biuro){this.scrollBinHeight=160}this.scrollRatio=this.scrollbarOffset/this.scrollBinHeight;this.oOverlayElems.content.setStyle("top",-Math.floor((this.contentHeight+70)*this.scrollRatio))},hide:function(){this.oOverlayAssets.mask_tween.start("opacity",0);this.oOverlayAssets.mask_second_tween.start("opacity",0);(function(){this.oOverlayAssets.mask.destroy();this.oOverlayAssets.mask_second.destroy();this.oOverlayElems.header.destroy();this.oOverlayElems.content.destroy();this.oOverlayElems.bin.destroy()}.bind(this)).delay(750)},destroy:function(){$try(function(){clearTimeout(globalTimer)});this.oOverlayAssets.mask.destroy();this.oOverlayAssets.mask_second.destroy();this.oOverlayElems.header.destroy();this.oOverlayElems.content.destroy();this.oOverlayElems.bin.destroy()}});XHR_Wrapper=new Class({Implements:[Options],options:{sendNow:true,method:"post",useSpinner:false,spinnerTarget:document.body,update:null,append:null,evalScripts:true,link:"ignore",onRequest:function(){},onProgress:function(){},onComplete:function(){},onSuccess:function(){},onFailure:function(){},onException:function(){}},initialize:function(c,b,a){this.setOptions(b);this.xhr=new Request.HTML({url:c,data:Object.toQueryString(a),method:this.options.method,update:this.options.update,append:this.options.append,useSpinner:this.options.useSpinner,spinnerTarget:this.options.spinnerTarget,onRequest:this.options.onRequest,onProgress:this.options.onProgress,onComplete:this.options.onComplete,onSuccess:this.options.onSuccess,onFailure:this.options.onFailure,onException:this.options.onException});if(this.options.sendNow==true){this.send()}},send:function(){this.xhr.send()}});function fire_home(){$("dummy_H").fireEvent("click")}function fire_bureau(){$("dummy_B").fireEvent("click")}function fire_cafe(){$("dummy_C").fireEvent("click")}function handleButtonsCafe(){oDlg.also_check=new Element("div",{id:"dlg_also_check",html:"Sprawdź też rabaty:"});oDlg.goto_home=new Element("div",{id:"dlg_goto_home"});oDlg.goto_bureau=new Element("div",{id:"dlg_goto_bureau"});oDlg.ilustracja=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/intro/img_lokal.png","class":"intro_ill_img"});oDlg.goto_bureau.setStyle("left",165);oDlg.badge_1=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_c_1.png","class":"rabat_badge_1c",styles:{left:512,top:116}});oDlg.badge_2=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_c_2.png","class":"rabat_badge_2c",styles:{left:512,top:181}});oDlg.badge_3=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_c_3.png","class":"rabat_badge_3c",styles:{left:512,top:245}});oDlg.goto_bureau.addEvent("click",function(a){if(a){a.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_B").fireEvent("click")});oDlg.goto_home.addEvent("click",function(a){if(a){a.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_H").fireEvent("click")});$("overlay_bin").adopt(oDlg.also_check);$("overlay_bin").adopt(oDlg.goto_home);$("overlay_bin").adopt(oDlg.goto_bureau);$("overlay_bin").adopt(oDlg.dalej_bin);$("overlay_bin").adopt(oDlg.ilustracja);$$("#overlay_txt")[0].adopt(oDlg.badge_1);$$("#overlay_txt")[0].adopt(oDlg.badge_2);$$("#overlay_txt")[0].adopt(oDlg.badge_3)}function handleButtonsBureau(){oDlg.also_check=new Element("div",{id:"dlg_also_check",html:"Sprawdź też rabaty:"});oDlg.goto_home=new Element("div",{id:"dlg_goto_home"});oDlg.goto_cafe=new Element("div",{id:"dlg_goto_cafe"});oDlg.ilustracja=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/intro/img_biuro.png","class":"intro_ill_img_b"});oDlg.goto_cafe.setStyle("left",165);oDlg.badge_1=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_b_1.png","class":"rabat_badge_1b"});oDlg.badge_2=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_b_2.png","class":"rabat_badge_2b"});oDlg.badge_3=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_b_3.png","class":"rabat_badge_3b"});oDlg.goto_home.addEvent("click",function(a){if(a){a.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_H").fireEvent("click")});oDlg.goto_cafe.addEvent("click",function(a){if(a){a.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_C").fireEvent("click")});$("overlay_bin").adopt(oDlg.also_check);$("overlay_bin").adopt(oDlg.goto_home);$("overlay_bin").adopt(oDlg.goto_cafe);$("overlay_bin").adopt(oDlg.dalej_bin);$("overlay_bin").adopt(oDlg.ilustracja);$$("#overlay_txt")[0].adopt(oDlg.badge_1);$$("#overlay_txt")[0].adopt(oDlg.badge_2);$$("#overlay_txt")[0].adopt(oDlg.badge_3)}function handleButtonsHome(a){oDlg.also_check=new Element("div",{id:"dlg_also_check",html:"Sprawdź też rabaty:"});oDlg.goto_cafe=new Element("div",{id:"dlg_goto_cafe"});oDlg.goto_bureau=new Element("div",{id:"dlg_goto_bureau"});oDlg.ilustracja=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/intro/img_dom.png","class":"intro_ill_img"});oDlg.goto_bureau.setStyle("left",165);oDlg.badge_1=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_h_1.png","class":"rabat_badge_1",styles:{left:512,top:103}});oDlg.badge_2=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_h_2.png","class":"rabat_badge_2",styles:{left:512,top:167}});oDlg.badge_3=new Element("img",{src:sBaseUrl+"sys/app/assets/gfx/rabat_h_3.png","class":"rabat_badge_3",styles:{left:512,top:231}});oDlg.goto_bureau.addEvent("click",function(b){if(b){b.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_B").fireEvent("click")});oDlg.goto_cafe.addEvent("click",function(b){if(b){b.stop()}$$(".overlay_second")[0].fireEvent("click");$("dummy_C").fireEvent("click")});$("overlay_bin").adopt(oDlg.also_check);$("overlay_bin").adopt(oDlg.goto_cafe);$("overlay_bin").adopt(oDlg.goto_bureau);$("overlay_bin").adopt(oDlg.ilustracja);$$("#overlay_txt")[0].adopt(oDlg.badge_1);$$("#overlay_txt")[0].adopt(oDlg.badge_2);$$("#overlay_txt")[0].adopt(oDlg.badge_3)};
