var _RESIZE_DURATION=200;var _INITIAL_WIDTH=250;var _INITIAL_HEIGHT=50;var _CONTENTS_WIDTH=450;var _CONTENTS_HEIGHT=250;var _DEF_CONTENTS_WIDTH=450;var _DEF_CONTENTS_HEIGHT=250;var _CONTENT="Ein Fehler ist aufgetreten";var _TITLE="Fehlermeldung";var ErrorBox=new Class({initialize:function(b){this.options=Object.extend({resizeDuration:_RESIZE_DURATION,initialWidth:_INITIAL_WIDTH,initialHeight:_INITIAL_HEIGHT,contentsWidth:_CONTENTS_WIDTH,contentsHeight:_CONTENTS_HEIGHT,defContentsWidth:_DEF_CONTENTS_WIDTH,defContentsHeight:_DEF_CONTENTS_HEIGHT},b||{});this.eventPosition=this.position.bind(this);this.overlay=new Element("div").setProperty("id","error_overlay").injectInside(document.body);this.center=new Element("div").setProperty("id","error_center").setStyles({width:this.options.initialWidth+"px",height:this.options.initialHeight+"px",marginLeft:"-"+(this.options.initialWidth/2)+"px",display:"none"}).injectInside(document.body);this.contents=new Element("div").setProperty("id","error_contents").injectInside(this.center);this.bottom=new Element("div").setProperty("id","error_bottom").setStyle("display","none").injectInside(document.body);this.closelink=new Element("a").setProperties({id:"error_close_link",href:"#"}).injectInside(this.bottom);new Element("div").setStyle("clear","both").injectInside(this.bottom);this.closelink.onclick=this.overlay.onclick=this.close.bind(this);var c=this.nextEffect.bind(this);this.fx={overlay:new Fx.Tween(this.overlay,{property:"opacity",duration:500}).set(0),resize:new Fx.Morph(this.center,$extend({duration:this.options.resizeDuration,onComplete:c},this.options.resizeTransition?{transition:this.options.resizeTransition}:{})),contents:new Fx.Tween(this.contents,{property:"opacity",duration:500,onComplete:c}),bottom:new Fx.Morph(this.bottom,$extend({duration:400,onComplete:c},this.options.resizeTransition?{transition:this.options.resizeTransition}:{}))};var a=this;return this},position:function(){this.overlay.setStyles({top:Window.getScrollTop()+"px",height:Window.getHeight()+"px"})},close:function(){if(this.step<0){return false}this.step=-1;for(var a in this.fx){this.fx[a].cancel()}this.center.style.display=this.bottom.style.display="none";this.center.className="error_loading";this.fx.overlay.chain(this.setup.pass(false,this)).start(0);this.overlay.style.display="none";return false},open:function(a){if(this.step){return false}this.step=1;this.options.contentsWidth=this.options.defContentsWidth;this.options.contentsHeight=this.options.defContentsHeight;this.bottom.setStyles({opacity:"0",height:"0px",display:"none"});this.center.className="error_loading";this.fx.contents.set(0);this.nextEffect();this.position();this.setup(true);this.top=Window.getScrollTop()+(Window.getHeight()/15);this.center.setStyles({top:this.top+"px",display:""});this.fx.overlay.start(0.8);this.nextEffect();this.contents.empty();this.titlediv=new Element("div").addClass("title").set("html",a.title).injectInside(this.contents);this.contentdiv=new Element("div").addClass("content").set("html",a.content).injectInside(this.contents)},nextEffect:function(){switch(this.step++){case 1:this.center.className="";this.center.setStyle("cursor","default");this.bottom.setStyle("cursor","default");this.center.onclick=this.bottom.onclick="";this.contents.setStyles({width:this.options.contentsWidth+"px",height:this.options.contentsHeight+"px"});if(this.center.clientHeight!=this.contents.offsetHeight){this.fx.resize.start({height:this.contents.offsetHeight});break}this.step++;case 2:if(this.center.clientWidth!=this.contents.offsetWidth){this.fx.resize.start({width:this.contents.offsetWidth,marginLeft:-this.contents.offsetWidth/2});break}this.step++;case 3:this.top=Window.getScrollTop()+(Window.getHeight()/15);this.bottom.setStyles({top:(this.top+this.center.clientHeight)+"px",width:this.contents.style.width,marginLeft:this.center.style.marginLeft,display:""});this.fx.contents.start(1);break;case 4:this.fx.bottom.start({opacity:1,height:this.bottom.scrollHeight});case 5:this.titlediv.fade("show");this.contentdiv.fade("show");case 6:this.step=0}},setup:function(a){var c=$A($$("object"));c.extend($$(window.ActiveXObject?"select":"embed"));c.each(function(d){d.style.visibility=a?"hidden":""});var b=a?"addEvent":"removeEvent";window[b]("scroll",this.eventPosition)[b]("resize",this.eventPosition);this.step=0}});
