window.addEvent("domready",TB_init);TB_WIDTH=0;TB_HEIGHT=0;var TB_doneOnce=0;function TB_init(){$$("a.smoothbox").each(function(a){a.onclick=TB_bind})}function TB_bind(b){var b=new Event(b);b.preventDefault();this.blur();var a=this.title||this.name||"";var c=this.rel||false;TB_show(a,this.href,c);this.onclick=TB_bind;return false}function TB_show(r,e,b){if(!$("TB_overlay")){new Element("iframe").setProperty("id","TB_HideSelect").injectInside(document.body);$("TB_HideSelect").setOpacity(0);new Element("div").setProperty("id","TB_overlay").injectInside(document.body);$("TB_overlay").setOpacity(0);TB_overlaySize();new Element("div").setProperty("id","TB_load").injectInside(document.body);$("TB_load").innerHTML="<img src='loading.gif' />";TB_load_position();new Fx.Style("TB_overlay","opacity",{duration:400,transition:Fx.Transitions.sineInOut}).start(0,0.6)}if(!$("TB_load")){new Element("div").setProperty("id","TB_load").injectInside(document.body);$("TB_load").innerHTML="<img src='loading.gif' />";TB_load_position()}if(!$("TB_window")){new Element("div").setProperty("id","TB_window").injectInside(document.body);$("TB_window").setOpacity(0)}$("TB_overlay").onclick=TB_remove;window.onscroll=TB_positionEffect;var s=e.match(/(.+)?/)[1]||e;var p=/\.(jpe?g|png|gif|bmp)/gi;if(s.match(p)){var v={caption:"",url:"",html:""};var m=v,n=v,a="";if(b){function j(w,x,i){return{caption:w.title,url:w.href,html:"<span id='TB_"+x+"'>&nbsp;&nbsp;<a href='#'>"+i+"</a></span>"}}var c=[];$$("a.smoothbox").each(function(i){if(i.rel==b){c[c.length]=i}});var u=false;for(var q=0;q<c.length;q++){var k=c[q];var g=k.href.match(p);if(k.href==e){u=true;a="Image "+(q+1)+" of "+(c.length)}else{if(u){n=j(k,"next","Next &gt;");break}else{m=j(k,"prev","&lt; Prev")}}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var z=window.getWidth()-150;var D=window.getHeight()-150;var A=imgPreloader.width;var w=imgPreloader.height;if(A>z){w=w*(z/A);A=z;if(w>D){A=A*(D/w);w=D}}else{if(w>D){A=A*(D/w);w=D;if(A>z){w=w*(z/A);A=z}}}TB_WIDTH=A+30;TB_HEIGHT=w+60;$("TB_window").innerHTML+="<a href='' id='TB_ImageOff' title='Schliessen'><img id='TB_Image' src='"+e+"' width='"+A+"' height='"+w+"' alt='"+r+"'/></a><div id='TB_caption'>"+r+"<div id='TB_secondLine'>"+a+m.html+n.html+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Schliessen'>schliessen</a></div>";$("TB_closeWindowButton").onclick=TB_remove;function i(x){return function(){$("TB_window").remove();new Element("div").setProperty("id","TB_window").injectInside(document.body);TB_show(x.caption,x.url,b);return false}}var C=i(m);var B=i(n);if($("TB_prev")){$("TB_prev").onclick=C}if($("TB_next")){$("TB_next").onclick=B}document.onkeydown=function(x){var x=new Event(x);switch(x.code){case 27:TB_remove();break;case 190:if($("TB_next")){document.onkeydown=null;B()}break;case 188:if($("TB_prev")){document.onkeydown=null;C()}break}};$("TB_ImageOff").onclick=TB_remove;TB_position();TB_showWindow()};imgPreloader.src=e}else{var d=e.match(/\?(.+)/)[1];var t=TB_parseQuery(d);TB_WIDTH=(t.width*1)+30;TB_HEIGHT=(t.height*1)+40;var h=TB_WIDTH-30,o=TB_HEIGHT-45;if(e.indexOf("TB_iframe")!=-1){urlNoQuery=e.split("TB_");$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+r+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Schliessen'>schliessen</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(h+29)+"px;height:"+(o+17)+"px;' onload='TB_showWindow()'> </iframe>"}else{$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+r+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>schliessen</a></div></div><div id='TB_ajaxContent' style='width:"+h+"px;height:"+o+"px;'></div>"}$("TB_closeWindowButton").onclick=TB_remove;if(e.indexOf("TB_inline")!=-1){$("TB_ajaxContent").innerHTML=($(t.inlineId).innerHTML);TB_position();TB_showWindow()}else{if(e.indexOf("TB_iframe")!=-1){TB_position();if(frames.TB_iframeContent==undefined){$(document).keyup(function(w){var i=w.keyCode;if(i==27){TB_remove()}});TB_showWindow()}}else{var f=function(){TB_position();TB_showWindow()};var l=new Ajax(e,{method:"get",update:$("TB_ajaxContent"),onComplete:f}).request()}}}window.onresize=function(){TB_position();TB_load_position();TB_overlaySize()};document.onkeyup=function(i){var i=new Event(i);if(i.code==27){TB_remove()}}}function TB_showWindow(){if(TB_doneOnce==0){TB_doneOnce=1;var a=new Fx.Style("TB_window","opacity",{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){if($("TB_load")){$("TB_load").remove()}}}).start(0,1)}else{$("TB_window").setStyle("opacity",1);if($("TB_load")){$("TB_load").remove()}}}function TB_remove(){$("TB_overlay").onclick=null;document.onkeyup=null;document.onkeydown=null;if($("TB_imageOff")){$("TB_imageOff").onclick=null}if($("TB_closeWindowButton")){$("TB_closeWindowButton").onclick=null}if($("TB_prev")){$("TB_prev").onclick=null}if($("TB_next")){$("TB_next").onclick=null}new Fx.Style("TB_window","opacity",{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){$("TB_window").remove()}}).start(1,0);new Fx.Style("TB_overlay","opacity",{duration:400,transition:Fx.Transitions.sineInOut,onComplete:function(){$("TB_overlay").remove()}}).start(0.6,0);window.onscroll=null;window.onresize=null;$("TB_HideSelect").remove();TB_init();TB_doneOnce=0;return false}function TB_position(){$("TB_window").setStyles({width:TB_WIDTH+"px",left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+"px",top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+"px"})}function TB_positionEffect(){new Fx.Styles("TB_window",{duration:75,transition:Fx.Transitions.sineInOut}).start({left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+"px",top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+"px"})}function TB_overlaySize(){$("TB_overlay").setStyles({height:"0px",width:"0px"});$("TB_HideSelect").setStyles({height:"0px",width:"0px"});$("TB_overlay").setStyles({height:window.getScrollHeight()+"px",width:window.getScrollWidth()+"px"});$("TB_HideSelect").setStyles({height:window.getScrollHeight()+"px",width:window.getScrollWidth()+"px"})}function TB_load_position(){if($("TB_load")){$("TB_load").setStyles({left:(window.getScrollLeft()+(window.getWidth()-56)/2)+"px",top:(window.getScrollTop()+((window.getHeight()-20)/2))+"px",display:"block"})}}function TB_parseQuery(c){if(!c){return{}}var e={};var b=c.split(/[;&]/);for(var a=0;a<b.length;a++){var d=b[a].split("=");if(!d||d.length!=2){continue}e[unescape(d[0])]=unescape(d[1]).replace(/\+/g," ")}return e};