if(typeof Prototype=="undefined"){throw"Unable to load Shadowbox, Prototype framework not found"}var Shadowbox={};Shadowbox.lib=function(){var C={};var B=/(-[a-z])/gi;var A=function(E,F){return F.charAt(1).toUpperCase()};var D=function(F){var E;if(!(E=C[F])){E=C[F]=F.replace(B,A)}return E};return{adapter:"prototype",getStyle:function(F,E){return Element.getStyle(F,E)},setStyle:function(G,F,H){if(typeof F=="string"){var E={};E[D(F)]=H;F=E}Element.setStyle(G,F)},get:function(E){return $(E)},remove:function(E){Element.remove(E)},getTarget:function(E){return Event.element(E)},preventDefault:function(E){Event.stop(E)},getPageXY:function(F){var E=Event.pointer(F);return[E.x,E.y]},keyCode:function(E){return E.keyCode},addEvent:function(G,E,F){Event.observe(G,E,F)},removeEvent:function(G,E,F){Event.stopObserving(G,E,F)},append:function(F,E){Element.insert(F,E)}}}();if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox, no base library adapter found"}(function(){var version="2.0";var options={animate:true,animateFade:true,animSequence:"wh",flvPlayer:"flvplayer.swf",modal:false,overlayColor:"#000",overlayOpacity:0.0,flashBgColor:"#000000",autoplayMovies:true,showMovieControls:true,slideshowDelay:0,resizeDuration:0.55,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:"default",counterLimit:10,viewportPadding:20,handleOversize:"resize",handleException:null,handleUnsupported:"link",initialHeight:160,initialWidth:320,enableKeys:true,onOpen:null,onFinish:null,onChange:null,onClose:null,skipSetup:false,errors:{fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}},ext:{img:["png","jpg","jpeg","gif","bmp"],swf:["swf"],flv:["flv"],qt:["dv","mov","moov","movie","mp4"],wmp:["asf","wm","wmv"],qtwmp:["avi","mpg","mpeg"],iframe:["asp","aspx","cgi","cfm","htm","html","pl","php","php3","php4","php5","phtml","rb","rhtml","shtml","txt","vbs"]}};var SB=Shadowbox;var SL=SB.lib;var default_options;var RE={domain:/:\/\/(.*?)[:\/]/,inline:/#(.+)$/,rel:/^(light|shadow)box/i,gallery:/^(light|shadow)box\[(.*?)\]/i,unsupported:/^unsupported-(\w+)/,param:/\s*([a-z_]*?)\s*=\s*(.+)\s*/,empty:/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i};var cache=[];var gallery;var current;var content;var content_id="shadowbox_content";var dims;var initialized=false;var activated=false;var slide_timer;var slide_start;var slide_delay=0;var ua=navigator.userAgent.toLowerCase();var client={isStrict:document.compatMode=="CSS1Compat",isOpera:ua.indexOf("opera")>-1,isIE:ua.indexOf("msie")>-1,isIE7:ua.indexOf("msie 7")>-1,isSafari:/webkit|khtml/.test(ua),isWindows:ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1,isMac:ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1,isLinux:ua.indexOf("linux")!=-1};client.isBorderBox=client.isIE&&!client.isStrict;client.isSafari3=client.isSafari&&!!(document.evaluate);client.isGecko=ua.indexOf("gecko")!=-1&&!client.isSafari;var ltIE7=client.isIE&&!client.isIE7;var plugins;if(navigator.plugins&&navigator.plugins.length){var detectPlugin=function(plugin_name){var detected=false;for(var i=0,len=navigator.plugins.length;i<len;++i){if(navigator.plugins[i].name.indexOf(plugin_name)>-1){detected=true;break}}return detected};var f4m=detectPlugin("Flip4Mac");plugins={fla:detectPlugin("Shockwave Flash"),qt:detectPlugin("QuickTime"),wmp:!f4m&&detectPlugin("Windows Media"),f4m:f4m}}else{var detectPlugin=function(plugin_name){var detected=false;try{var axo=new ActiveXObject(plugin_name);if(axo){detected=true}}catch(e){}return detected};plugins={fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),qt:detectPlugin("QuickTime.QuickTime"),wmp:detectPlugin("wmplayer.ocx"),f4m:false}}var apply=function(o,e){for(var p in e){o[p]=e[p]}return o};var isLink=function(el){return el&&typeof el.tagName=="string"&&(el.tagName.toUpperCase()=="A"||el.tagName.toUpperCase()=="AREA")};SL.getViewportHeight=function(){var h=window.innerHeight;var mode=document.compatMode;if((mode||client.isIE)&&!client.isOpera){h=client.isStrict?document.documentElement.clientHeight:document.body.clientHeight}return h};SL.getViewportWidth=function(){var w=window.innerWidth;var mode=document.compatMode;if(mode||client.isIE){w=client.isStrict?document.documentElement.clientWidth:document.body.clientWidth}return w};SL.createHTML=function(obj){var html="<"+obj.tag;for(var attr in obj){if(attr=="tag"||attr=="html"||attr=="children"){continue}if(attr=="cls"){html+=' class="'+obj.cls+'"'}else{html+=" "+attr+'="'+obj[attr]+'"'}}if(RE.empty.test(obj.tag)){html+="/>"}else{html+=">";var cn=obj.children;if(cn){for(var i=0,len=cn.length;i<len;++i){html+=this.createHTML(cn[i])}}if(obj.html){html+=obj.html}html+="</"+obj.tag+">"}return html};var ease=function(x){return 1+Math.pow(x-1,3)};var animate=function(el,p,to,d,cb){var from=parseFloat(SL.getStyle(el,p));if(isNaN(from)){from=0}if(from==to){if(typeof cb=="function"){cb()}return}var delta=to-from;var op=p=="opacity";var unit=op?"":"px";var fn=function(ease){SL.setStyle(el,p,from+ease*delta+unit)};if(!options.animate&&!op||op&&!options.animateFade){fn(1);if(typeof cb=="function"){cb()}return}d*=1000;var begin=new Date().getTime();var end=begin+d;var timer=setInterval(function(){var time=new Date().getTime();if(time>=end){clearInterval(timer);fn(1);if(typeof cb=="function"){cb()}}else{fn(ease((time-begin)/d))}},10)};var clearOpacity=function(el){var s=el.style;if(client.isIE){if(typeof s.filter=="string"&&(/alpha/i).test(s.filter)){s.filter=s.filter.replace(/[\w\.]*alpha\(.*?\);?/i,"")}}else{s.opacity="";s["-moz-opacity"]="";s["-khtml-opacity"]=""}};var getComputedHeight=function(el){var h=Math.max(el.offsetHeight,el.clientHeight);if(!h){h=parseInt(SL.getStyle(el,"height"),10)||0;if(!client.isBorderBox){h+=parseInt(SL.getStyle(el,"padding-top"),10)+parseInt(SL.getStyle(el,"padding-bottom"),10)+parseInt(SL.getStyle(el,"border-top-width"),10)+parseInt(SL.getStyle(el,"border-bottom-width"),10)}}return h};var getPlayer=function(url){var m=url.match(RE.domain);var d=m&&document.domain==m[1];if(url.indexOf("#")>-1&&d){return"inline"}var q=url.indexOf("?");if(q>-1){url=url.substring(0,q)}if(RE.img.test(url)){return"img"}if(RE.swf.test(url)){return plugins.fla?"swf":"unsupported-swf"}if(RE.flv.test(url)){return plugins.fla?"flv":"unsupported-flv"}if(RE.qt.test(url)){return plugins.qt?"qt":"unsupported-qt"}if(RE.wmp.test(url)){if(plugins.wmp){return"wmp"}if(plugins.f4m){return"qt"}if(client.isMac){return plugins.qt?"unsupported-f4m":"unsupported-qtf4m"}return"unsupported-wmp"}else{if(RE.qtwmp.test(url)){if(plugins.qt){return"qt"}if(plugins.wmp){return"wmp"}return client.isMac?"unsupported-qt":"unsupported-qtwmp"}else{if(!d||RE.iframe.test(url)){return"iframe"}}}return"unsupported"};var handleClick=function(ev){var link;if(isLink(this)){link=this}else{link=SL.getTarget(ev);while(!isLink(link)&&link.parentNode){link=link.parentNode}}if(link){SB.open(link);if(gallery.length){SL.preventDefault(ev)}}};var toggleNav=function(id,on){var el=SL.get("shadowbox_nav_"+id);if(el){el.style.display=on?"":"none"}};var buildBars=function(cb){var obj=gallery[current];var title_i=SL.get("shadowbox_title_inner");title_i.innerHTML=obj.title||"";var nav=SL.get("shadowbox_nav");if(nav){var c,n,pl,pa,p;if(options.displayNav){c=true;var len=gallery.length;if(len>1){if(options.continuous){n=p=true}else{n=(len-1)>current;p=current>0}}if(options.slideshowDelay>0&&hasNext()){pa=slide_timer!="paused";pl=!pa}}else{c=n=pl=pa=p=false}toggleNav("close",c);toggleNav("next",n);toggleNav("play",pl);toggleNav("pause",pa);toggleNav("previous",p)}var counter=SL.get("shadowbox_counter");if(counter){var co="";if(options.displayCounter&&gallery.length>1){if(options.counterType=="skip"){var i=0,len=gallery.length,end=len;var limit=parseInt(options.counterLimit);if(limit<len){var h=Math.round(limit/2);i=current-h;if(i<0){i+=len}end=current+(limit-h);if(end>len){end-=len}}while(i!=end){if(i==len){i=0}co+='<a onclick="Shadowbox.change('+i+');"';if(i==current){co+=' class="shadowbox_counter_current"'}co+=">"+(++i)+"</a>"}}else{co=(current+1)+" "+SB.LANG.of+" "+len}}counter.innerHTML=co}cb()};var hideBars=function(anim,cb){var obj=gallery[current];var title=SL.get("shadowbox_title");var info=SL.get("shadowbox_info");var title_i=SL.get("shadowbox_title_inner");var info_i=SL.get("shadowbox_info_inner");var fn=function(){buildBars(cb)};var title_h=getComputedHeight(title);var info_h=getComputedHeight(info)*-1;if(anim){animate(title_i,"margin-top",title_h,0.35);animate(info_i,"margin-top",info_h,0.35,fn)}else{SL.setStyle(title_i,"margin-top",title_h+"px");SL.setStyle(info_i,"margin-top",info_h+"px");fn()}};var showBars=function(cb){var title_i=SL.get("shadowbox_title_inner");var info_i=SL.get("shadowbox_info_inner");var t=title_i.innerHTML!="";if(t){animate(title_i,"margin-top",0,0.35)}animate(info_i,"margin-top",0,0.35,cb)};var loadContent=function(){var obj=gallery[current];if(!obj){return}var changing=false;if(content){content.remove();changing=true}var p=obj.player=="inline"?"html":obj.player;if(typeof SB[p]!="function"){SB.raise("Unknown player "+obj.player)}content=new SB[p](content_id,obj);listenKeys(false);toggleLoading(true);hideBars(changing,function(){if(!content){return}if(!changing){SL.get("shadowbox").style.display=""}var fn=function(){resizeContent(function(){if(!content){return}showBars(function(){if(!content){return}SL.get("shadowbox_body_inner").innerHTML=SL.createHTML(content.markup(dims));toggleLoading(false,function(){if(!content){return}if(typeof content.onLoad=="function"){content.onLoad()}if(options.onFinish&&typeof options.onFinish=="function"){options.onFinish(gallery[current])}if(slide_timer!="paused"){SB.play()}listenKeys(true)})})})};if(typeof content.ready!="undefined"){var id=setInterval(function(){if(content){if(content.ready){clearInterval(id);id=null;fn()}}else{clearInterval(id);id=null}},100)}else{fn()}});if(gallery.length>1){var next=gallery[current+1]||gallery[0];if(next.player=="img"){var a=new Image();a.src=next.content}var prev=gallery[current-1]||gallery[gallery.length-1];if(prev.player=="img"){var b=new Image();b.src=prev.content}}};var setDimensions=function(height,width,resizable){resizable=resizable||false;var sb=SL.get("shadowbox_body");var h=height=parseInt(height);var w=width=parseInt(width);var view_h=SL.getViewportHeight();var view_w=SL.getViewportWidth();var border_w=parseInt(SL.getStyle(sb,"border-left-width"),10)+parseInt(SL.getStyle(sb,"border-right-width"),10);var extra_w=border_w+2*options.viewportPadding;if(w+extra_w>=view_w){w=view_w-extra_w}var border_h=parseInt(SL.getStyle(sb,"border-top-width"),10)+parseInt(SL.getStyle(sb,"border-bottom-width"),10);var bar_h=getComputedHeight(SL.get("shadowbox_title"))+getComputedHeight(SL.get("shadowbox_info"));var extra_h=border_h+2*options.viewportPadding+bar_h;if(h+extra_h>=view_h){h=view_h-extra_h}var drag=false;var resize_h=height;var resize_w=width;var handle=options.handleOversize;if(resizable&&(handle=="resize"||handle=="drag")){var change_h=(height-h)/height;var change_w=(width-w)/width;if(handle=="resize"){if(change_h>change_w){w=Math.round((width/height)*h)}else{if(change_w>change_h){h=Math.round((height/width)*w)}}resize_w=w;resize_h=h}else{var link=gallery[current];if(link){drag=link.player=="img"&&(change_h>0||change_w>0)}}}dims={height:h+border_h+bar_h,width:w+border_w,inner_h:h,inner_w:w,top:(view_h-(h+extra_h))/2+options.viewportPadding,resize_h:resize_h,resize_w:resize_w,drag:drag}};var resizeContent=function(cb){if(!content){return}setDimensions(content.height,content.width,content.resizable);if(cb){switch(options.animSequence){case"hw":adjustHeight(dims.inner_h,dims.top,true,function(){adjustWidth(dims.width,true,cb)});break;case"wh":adjustWidth(dims.width,true,function(){adjustHeight(dims.inner_h,dims.top,true,cb)});break;case"sync":default:adjustWidth(dims.width,true);adjustHeight(dims.inner_h,dims.top,true,cb)}}else{adjustWidth(dims.width,false);adjustHeight(dims.inner_h,dims.top,false);var c=SL.get(content_id);if(c){if(content.resizable&&options.handleOversize=="resize"){c.height=dims.resize_h;c.width=dims.resize_w}if(gallery[current].player=="img"&&options.handleOversize=="drag"){var top=parseInt(SL.getStyle(c,"top"));if(top+content.height<dims.inner_h){SL.setStyle(c,"top",dims.inner_h-content.height+"px")}var left=parseInt(SL.getStyle(c,"left"));if(left+content.width<dims.inner_w){SL.setStyle(c,"left",dims.inner_w-content.width+"px")}}}}};var adjustHeight=function(height,top,anim,cb){height=parseInt(height);var sb=SL.get("shadowbox_body");if(anim){animate(sb,"height",height,options.resizeDuration)}else{SL.setStyle(sb,"height",height+"px")}var s=SL.get("shadowbox");if(anim){animate(s,"top",top,options.resizeDuration,cb)}else{SL.setStyle(s,"top",top+"px");if(typeof cb=="function"){cb()}}};var adjustWidth=function(width,anim,cb){width=parseInt(width);var s=SL.get("shadowbox");if(anim){animate(s,"width",width,options.resizeDuration,cb)}else{SL.setStyle(s,"width",width+"px");if(typeof cb=="function"){cb()}}};var listenKeys=function(on){if(!options.enableKeys){return}SL[(on?"add":"remove")+"Event"](document,"keydown",handleKey)};var handleKey=function(e){var code=SL.keyCode(e);SL.preventDefault(e);if(code==81||code==88||code==27){SB.close()}else{if(code==37){SB.previous()}else{if(code==39){SB.next()}else{if(code==32){SB[(typeof slide_timer=="number"?"pause":"play")]()}}}}};var toggleLoading=function(on,cb){var loading=SL.get("shadowbox_loading");if(on){loading.style.display="";if(typeof cb=="function"){cb()}}else{var p=gallery[current].player;var anim=(p=="img"||p=="html");var fn=function(){loading.style.display="none";clearOpacity(loading);if(typeof cb=="function"){cb()}};if(anim){animate(loading,"opacity",0,options.fadeDuration,fn)}else{fn()}}};var fixTop=function(){SL.get("shadowbox_container").style.top=document.documentElement.scrollTop+"px"};var fixHeight=function(){SL.get("shadowbox_overlay").style.height=SL.getViewportHeight()+"px"};var hasNext=function(){return gallery.length>1&&(current!=gallery.length-1||options.continuous)};var toggleVisible=function(cb){var els,v=(cb)?"hidden":"visible";var hide=["select","object","embed"];for(var i=0;i<hide.length;++i){els=document.getElementsByTagName(hide[i]);for(var j=0,len=els.length;j<len;++j){els[j].style.visibility=v}}var so=SL.get("shadowbox_overlay");var sc=SL.get("shadowbox_container");var sb=SL.get("shadowbox");if(cb){SL.setStyle(so,{backgroundColor:options.overlayColor,opacity:0});if(!options.modal){SL.addEvent(so,"click",SB.close)}if(ltIE7){fixTop();fixHeight();SL.addEvent(window,"scroll",fixTop)}sb.style.display="none";sc.style.visibility="visible";animate(so,"opacity",parseFloat(options.overlayOpacity),options.fadeDuration,cb)}else{SL.removeEvent(so,"click",SB.close);if(ltIE7){SL.removeEvent(window,"scroll",fixTop)}sb.style.display="none";animate(so,"opacity",0,options.fadeDuration,function(){sc.style.visibility="hidden";sb.style.display="";clearOpacity(so)})}};Shadowbox.init=function(opts){if(initialized){return}if(typeof SB.LANG=="undefined"){SB.raise("No Shadowbox language loaded");return}if(typeof SB.SKIN=="undefined"){SB.raise("No Shadowbox skin loaded");return}apply(options,opts||{});var markup=SB.SKIN.markup.replace(/\{(\w+)\}/g,function(m,p){return SB.LANG[p]});var bd=document.body||document.documentElement;SL.append(bd,markup);if(ltIE7){SL.setStyle(SL.get("shadowbox_container"),"position","absolute");SL.get("shadowbox_body").style.zoom=1;var png=SB.SKIN.png_fix;if(png&&png.constructor==Array){for(var i=0;i<png.length;++i){var el=SL.get(png[i]);if(el){var match=SL.getStyle(el,"background-image").match(/url\("(.*\.png)"\)/);if(match){SL.setStyle(el,{backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+match[1]+",sizingMethod=scale);"})}}}}}for(var e in options.ext){RE[e]=new RegExp(".("+options.ext[e].join("|")+")s*$","i")}var id;SL.addEvent(window,"resize",function(){if(id){clearTimeout(id);id=null}id=setTimeout(function(){if(ltIE7){fixHeight()}resizeContent()},50)});if(!options.skipSetup){SB.setup()}initialized=true};Shadowbox.loadSkin=function(skin,dir){if(!(/\/$/.test(dir))){dir+="/"}skin=dir+skin+"/";document.write('<link rel="stylesheet" type="text/css" href="'+skin+'skin.css">');document.write('<script type="text/javascript" src="'+skin+'skin.js"><\/script>')};Shadowbox.loadLanguage=function(lang,dir){if(!(/\/$/.test(dir))){dir+="/"}document.write('<script type="text/javascript" src="'+dir+"shadowbox-"+lang+'.js"><\/script>')};Shadowbox.loadPlayer=function(players,dir){if(typeof players=="string"){players=[players]}if(!(/\/$/.test(dir))){dir+="/"}for(var i=0,len=players.length;i<len;++i){document.write('<script type="text/javascript" src="'+dir+"shadowbox-"+players[i]+'.js"><\/script>')}};Shadowbox.setup=function(links,opts){if(!links){var links=[];var a=document.getElementsByTagName("a"),rel;for(var i=0,len=a.length;i<len;++i){rel=a[i].getAttribute("rel");if(rel&&RE.rel.test(rel)){links[links.length]=a[i]}}}else{if(!links.length){links=[links]}}var link;for(var i=0,len=links.length;i<len;++i){link=links[i];if(typeof link.shadowboxCacheKey=="undefined"){link.shadowboxCacheKey=cache.length;SL.addEvent(link,"click",handleClick)}cache[link.shadowboxCacheKey]=this.buildCacheObj(link,opts)}};Shadowbox.buildCacheObj=function(link,opts){var href=link.href;var o={el:link,title:link.getAttribute("title"),player:getPlayer(href),options:apply({},opts||{}),content:href};var opt,l_opts=["player","title","height","width","gallery"];for(var i=0,len=l_opts.length;i<len;++i){opt=l_opts[i];if(typeof o.options[opt]!="undefined"){o[opt]=o.options[opt];delete o.options[opt]}}var rel=link.getAttribute("rel");if(rel){var match=rel.match(RE.gallery);if(match){o.gallery=escape(match[2])}var params=rel.split(";");for(var i=0,len=params.length;i<len;++i){match=params[i].match(RE.param);if(match){if(match[1]=="options"){eval("apply(o.options, "+match[2]+")")}else{o[match[1]]=match[2]}}}}return o};Shadowbox.applyOptions=function(opts){if(opts){default_options=apply({},options);options=apply(options,opts)}};Shadowbox.revertOptions=function(){if(default_options){options=default_options;default_options=null}};Shadowbox.open=function(obj,opts){this.revertOptions();if(isLink(obj)){if(typeof obj.shadowboxCacheKey=="undefined"||typeof cache[obj.shadowboxCacheKey]=="undefined"){obj=this.buildCacheObj(obj,opts)}else{obj=cache[obj.shadowboxCacheKey]}}if(obj.constructor==Array){gallery=obj;current=0}else{var copy=apply({},obj);if(!obj.gallery){gallery=[copy];current=0}else{current=null;gallery=[];var ci;for(var i=0,len=cache.length;i<len;++i){ci=cache[i];if(ci.gallery){if(ci.content==obj.content&&ci.gallery==obj.gallery&&ci.title==obj.title){current=gallery.length}if(ci.gallery==obj.gallery){gallery.push(apply({},ci))}}}if(current==null){gallery.unshift(copy);current=0}}}obj=gallery[current];if(obj.options||opts){this.applyOptions(apply(apply({},obj.options||{}),opts||{}))}var match,r;for(var i=0,len=gallery.length;i<len;++i){r=false;if(gallery[i].player=="unsupported"){r=true}else{if(match=RE.unsupported.exec(gallery[i].player)){if(options.handleUnsupported=="link"){gallery[i].player="html";var s,a,oe=options.errors;switch(match[1]){case"qtwmp":s="either";a=[oe.qt.url,oe.qt.name,oe.wmp.url,oe.wmp.name];break;case"qtf4m":s="shared";a=[oe.qt.url,oe.qt.name,oe.f4m.url,oe.f4m.name];break;default:s="single";if(match[1]=="swf"||match[1]=="flv"){match[1]="fla"}a=[oe[match[1]].url,oe[match[1]].name]}var msg=SB.LANG.errors[s].replace(/\{(\d+)\}/g,function(m,i){return a[i]});gallery[i].content='<div class="shadowbox_message">'+msg+"</div>"}else{r=true}}else{if(gallery[i].player=="inline"){var match=RE.inline.exec(gallery[i].content);if(match){var el;if(el=SL.get(match[1])){gallery[i].content=el.innerHTML}else{SB.raise("Cannot find element with id "+match[1])}}else{SB.raise("Cannot find element id for inline content")}}}}if(r){gallery.splice(i,1);if(i<current){--current}else{if(i==current){current=i>0?current-1:i}}--i;len=gallery.length}}if(gallery.length){if(options.onOpen&&typeof options.onOpen=="function"){options.onOpen(obj)}if(!activated){setDimensions(options.initialHeight,options.initialWidth);adjustHeight(dims.inner_h,dims.top,false);adjustWidth(dims.width,false);toggleVisible(loadContent)}else{loadContent()}activated=true}};Shadowbox.change=function(num){if(!gallery){return}if(!gallery[num]){if(!options.continuous){return}else{num=num<0?(gallery.length-1):0}}if(typeof slide_timer=="number"){clearTimeout(slide_timer);slide_timer=null;slide_delay=slide_start=0}current=num;if(options.onChange&&typeof options.onChange=="function"){options.onChange(gallery[current])}loadContent()};Shadowbox.next=function(){this.change(current+1)};Shadowbox.previous=function(){this.change(current-1)};Shadowbox.play=function(){if(!hasNext()){return}if(!slide_delay){slide_delay=options.slideshowDelay*1000}if(slide_delay){slide_start=new Date().getTime();slide_timer=setTimeout(function(){slide_delay=slide_start=0;SB.next()},slide_delay);toggleNav("play",false);toggleNav("pause",true)}};Shadowbox.pause=function(){if(typeof slide_timer=="number"){var time=new Date().getTime();slide_delay=Math.max(0,slide_delay-(time-slide_start));if(slide_delay){clearTimeout(slide_timer);slide_timer="paused"}toggleNav("pause",false);toggleNav("play",true)}};Shadowbox.closeAndReload=function(){if(!activated){return}listenKeys(false);toggleVisible(false);if(content){content.remove();content=null}
if(typeof slide_timer=="number"){clearTimeout(slide_timer)}slide_timer=null;slide_delay=0;if(options.onClose&&typeof options.onClose=="function"){options.onClose(gallery[current])}
activated=false;location.reload();};Shadowbox.close=function(){if(!activated){return}listenKeys(false);toggleVisible(false);if(content){content.remove();content=null}if(typeof slide_timer=="number"){clearTimeout(slide_timer)}slide_timer=null;slide_delay=0;if(options.onClose&&typeof options.onClose=="function"){options.onClose(gallery[current])}activated=false};Shadowbox.clearCache=function(){for(var i=0,len=cache.length;i<len;++i){if(cache[i].el){SL.removeEvent(cache[i].el,"click",handleClick);delete cache[i].el.shadowboxCacheKey}}cache=[]};Shadowbox.getPlugins=function(){return plugins};Shadowbox.getOptions=function(){return options};Shadowbox.getCurrent=function(){return gallery[current]};Shadowbox.getVersion=function(){return version};Shadowbox.getClient=function(){return client};Shadowbox.getContent=function(){return content};Shadowbox.getDimensions=function(){return dims};Shadowbox.raise=function(e){if(typeof options.handleException=="function"){options.handleException(e)}else{throw e}}})();if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox language file, base library not found."}Shadowbox.LANG={code:"de",of:"von",loading:"ladend",cancel:"Abbrechen",next:"Nächste",previous:"Vorige",play:"Abspielen",pause:"Pause",close:"Schließen",errors:{single:'Um den Inhalt anzeigen zu können muss die Browser-Erweiterung <a href="{0}">{1}</a> installiert werden.',shared:'Um den Inhalt anzeigen zu können müssen die beiden Browser-Erweiterungen <a href="{0}">{1}</a> und <a href="{2}">{3}</a> installiert werden.',either:'Um den Inhalt anzeigen zu können muss eine der beiden Browser-Erweiterungen <a href="{0}">{1}</a> oder <a href="{2}">{3}</a> installiert werden.'}};(function(){var F=Shadowbox;var L=F.lib;var A=F.getClient();var I;var M;var J="shadowbox_drag_layer";var K;var D=function(){I={x:0,y:0,start_x:null,start_y:null}};var E=function(N,O,C){if(N){D();var P=["position:absolute","height:"+O+"px","width:"+C+"px","cursor:"+(A.isGecko?"-moz-grab":"move"),"background-color:"+(A.isIE?"#fff;filter:alpha(opacity=0)":"transparent")];L.append(L.get("shadowbox_body_inner"),'<div id="'+J+'" style="'+P.join(";")+'"></div>');L.addEvent(L.get(J),"mousedown",H)}else{var Q=L.get(J);if(Q){L.removeEvent(Q,"mousedown",H);L.remove(Q)}}};var H=function(N){L.preventDefault(N);var C=L.getPageXY(N);I.start_x=C[0];I.start_y=C[1];M=L.get("shadowbox_content");L.addEvent(document,"mousemove",G);L.addEvent(document,"mouseup",B);if(A.isGecko){L.setStyle(L.get(J),"cursor","-moz-grabbing")}};var B=function(){L.removeEvent(document,"mousemove",G);L.removeEvent(document,"mouseup",B);if(A.isGecko){L.setStyle(L.get(J),"cursor","-moz-grab")}};var G=function(Q){var O=F.getContent();var R=F.getDimensions();var P=L.getPageXY(Q);var N=P[0]-I.start_x;I.start_x+=N;I.x=Math.max(Math.min(0,I.x+N),R.inner_w-O.width);L.setStyle(M,"left",I.x+"px");var C=P[1]-I.start_y;I.start_y+=C;I.y=Math.max(Math.min(0,I.y+C),R.inner_h-O.height);L.setStyle(M,"top",I.y+"px")};Shadowbox.img=function(O,N){this.id=O;this.obj=N;this.resizable=true;this.ready=false;var C=this;K=new Image();K.onload=function(){C.height=C.obj.height?parseInt(C.obj.height,10):K.height;C.width=C.obj.width?parseInt(C.obj.width,10):K.width;C.ready=true;K.onload="";K=null};K.src=N.content};Shadowbox.img.prototype={markup:function(C){return{tag:"img",id:this.id,height:C.resize_h,width:C.resize_w,src:this.obj.content,style:"position:absolute"}},onLoad:function(){var C=F.getDimensions();if(C.drag&&F.getOptions().handleOversize=="drag"){E(true,C.resize_h,C.resize_w)}},remove:function(){var C=L.get(this.id);if(C){L.remove(C)}E(false);if(K){K.onload="";K=null}}}})();(function(){var A=Shadowbox;var B=A.lib;Shadowbox.html=function(D,C){this.id=D;this.obj=C;this.height=this.obj.height?parseInt(this.obj.height,10):300;this.width=this.obj.width?parseInt(this.obj.width,10):500};Shadowbox.html.prototype={markup:function(C){return{tag:"div",id:this.id,cls:"html",html:this.obj.content}},remove:function(){var C=B.get(this.id);if(C){B.remove(C)}}}})();(function(){var A=Shadowbox;var B=A.lib;var D=A.getClient();Shadowbox.iframe=function(E,C){this.id=E;this.obj=C;this.height=this.obj.height?parseInt(this.obj.height,10):B.getViewportHeight();this.width=this.obj.width?parseInt(this.obj.width,10):B.getViewportWidth()};Shadowbox.iframe.prototype={markup:function(E){var C={tag:"iframe",id:this.id,name:this.id,height:"100%",width:"100%",frameborder:"0",marginwidth:"0",marginheight:"0",scrolling:"auto"};if(D.isIE){C.allowtransparency="true";if(!D.isIE7){C.src='javascript:false;document.write("");'}}return C},onLoad:function(){var C=(D.isIE)?B.get(this.id).contentWindow:window.frames[this.id];C.location=this.obj.content},remove:function(){var C=B.get(this.id);if(C){B.remove(C);if(D.isGecko){delete window.frames[this.id]}}}}})();if(typeof(Control)=='undefined')
Control={};var $proc=function(proc){return typeof(proc)=='function'?proc:function(){return proc};};var $value=function(value){return typeof(value)=='function'?value():value;};Object.Event={extend:function(object){object._objectEventSetup=function(event_name){this._observers=this._observers||{};this._observers[event_name]=this._observers[event_name]||[];};object.observe=function(event_name,observer){if(typeof(event_name)=='string'&&typeof(observer)!='undefined'){this._objectEventSetup(event_name);if(!this._observers[event_name].include(observer))
this._observers[event_name].push(observer);}else
for(var e in event_name)
this.observe(e,event_name[e]);};object.stopObserving=function(event_name,observer){this._objectEventSetup(event_name);if(event_name&&observer)
this._observers[event_name]=this._observers[event_name].without(observer);else if(event_name)
this._observers[event_name]=[];else
this._observers={};};object.observeOnce=function(event_name,outer_observer){var inner_observer=function(){outer_observer.apply(this,arguments);this.stopObserving(event_name,inner_observer);}.bind(this);this._objectEventSetup(event_name);this._observers[event_name].push(inner_observer);};object.notify=function(event_name){this._objectEventSetup(event_name);var collected_return_values=[];var args=$A(arguments).slice(1);try{for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};if(object.prototype){object.prototype._objectEventSetup=object._objectEventSetup;object.prototype.observe=object.observe;object.prototype.stopObserving=object.stopObserving;object.prototype.observeOnce=object.observeOnce;object.prototype.notify=function(event_name){if(object.notify){var args=$A(arguments).slice(1);args.unshift(this);args.unshift(event_name);object.notify.apply(object,args);}
this._objectEventSetup(event_name);var args=$A(arguments).slice(1);var collected_return_values=[];try{if(this.options&&this.options[event_name]&&typeof(this.options[event_name])=='function')
collected_return_values.push(this.options[event_name].apply(this,args)||null);for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};}}};Element.addMethods({observeOnce:function(element,event_name,outer_callback){var inner_callback=function(){outer_callback.apply(this,arguments);Element.stopObserving(element,event_name,inner_callback);};Element.observe(element,event_name,inner_callback);}});Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";if(!Prototype.Browser.IE){eventName={mouseenter:'mouseover',mouseleave:'mouseout'}[eventName]||eventName;}
return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};if(!(Prototype.Browser.IE)&&['mouseenter','mouseleave'].include(eventName)){wrapper=wrapper.wrap(function(proceed,event){var rel=event.relatedTarget;var cur=event.currentTarget;if(rel&&rel.nodeType==Node.TEXT_NODE)
rel=rel.parentNode;if(rel&&rel!=cur&&!rel.descendantOf(cur))
return proceed(event);});}
wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function wheel(event){var delta;if(event.wheelDelta)
delta=event.wheelDelta/120;else if(event.detail)
delta=-event.detail/3;if(!delta)
return;var custom_event=event.element().fire('mouse:wheel',{delta:delta});if(custom_event.stopped){event.stop();return false;}}
document.observe('mousewheel',wheel);document.observe('DOMMouseScroll',wheel);})();var IframeShim=Class.create({initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:void(0);',frameborder:0});$(document.body).insert(this.element);},hide:function(){this.element.hide();return this;},show:function(){this.element.show();return this;},positionUnder:function(element){var element=$(element);var offset=element.cumulativeOffset();var dimensions=element.getDimensions();this.element.setStyle({left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1}).show();return this;},setBounds:function(bounds){for(prop in bounds)
bounds[prop]+='px';this.element.setStyle(bounds);return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});if(typeof(Prototype)=="undefined")
throw"Control.Tabs requires Prototype to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.Tabs requires Object.Event to be loaded.";Control.Tabs=Class.create({initialize:function(tab_list_container,options){if(!$(tab_list_container))
throw"Control.Tabs could not find the element: "+tab_list_container;this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:'li a',setClassOnContainer:false,activeClassName:'active',defaultTab:'first',autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,options||{});(typeof(this.options.linkSelector=='string')?$(tab_list_container).select(this.options.linkSelector):this.options.linkSelector($(tab_list_container))).findAll(function(link){return(/^#/).exec(link.href.replace(window.location.href.split('#')[0],''));}).each(function(link){this.addTab(link);}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=='first')
this.setActiveTab(this.links.first());else if(this.options.defaultTab=='last')
this.setActiveTab(this.links.last());else
this.setActiveTab(this.options.defaultTab);var targets=this.options.targetRegExp.exec(window.location);if(targets&&targets[1]){targets[1].split(',').each(function(target){this.setActiveTab(this.links.find(function(link){return link.key==target;}));}.bind(this));}
if(this.options.autoLinkExternal){$A(document.getElementsByTagName('a')).each(function(a){if(!this.links.include(a)){var clean_href=a.href.replace(window.location.href.split('#')[0],'');if(clean_href.substring(0,1)=='#'){if(this.containers.keys().include(clean_href.substring(1))){$(a).observe('click',function(event,clean_href){this.setActiveTab(clean_href.substring(1));}.bindAsEventListener(this,clean_href));}}}}.bind(this));}},addTab:function(link){this.links.push(link);link.key=link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('/').last().replace(/#/,'');var container=$(link.key);if(!container)
throw"Control.Tabs: #"+link.key+" was not found on the page."
this.containers.set(link.key,container);link[this.options.hover?'onmouseover':'onclick']=function(link){if(window.event)
Event.stop(window.event);this.setActiveTab(link);return false;}.bind(this,link);},setActiveTab:function(link){if(!link&&typeof(link)=='undefined')
return;if(typeof(link)=='string'){this.setActiveTab(this.links.find(function(_link){return _link.key==link;}));}else if(typeof(link)=='number'){this.setActiveTab(this.links[link]);}else{if(this.notify('beforeChange',this.activeContainer,this.containers.get(link.key))===false)
return;if(this.activeContainer)
this.options.hideFunction(this.activeContainer);this.links.each(function(item){(this.options.setClassOnContainer?$(item.parentNode):item).removeClassName(this.options.activeClassName);}.bind(this));(this.options.setClassOnContainer?$(link.parentNode):link).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(link.key);this.activeLink=link;this.options.showFunction(this.containers.get(link.key));this.notify('afterChange',this.containers.get(link.key));}},next:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i+1]){this.setActiveTab(this.links[i+1]);throw $break;}}.bind(this));},previous:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i-1]){this.setActiveTab(this.links[i-1]);throw $break;}}.bind(this));},first:function(){this.setActiveTab(this.links.first());},last:function(){this.setActiveTab(this.links.last());}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(id){return Control.Tabs.instances.find(function(tab){return tab.links.find(function(link){return link.key==id;});});}});Object.Event.extend(Control.Tabs);if(typeof(Prototype)=="undefined")
throw"Control.TextArea requires Prototype to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.TextArea requires Object.Event to be loaded.";Control.TextArea=Class.create({initialize:function(textarea){this.onChangeTimeout=false;this.element=$(textarea);$(this.element).observe('keyup',this.doOnChange.bindAsEventListener(this));$(this.element).observe('paste',this.doOnChange.bindAsEventListener(this));$(this.element).observe('input',this.doOnChange.bindAsEventListener(this));if(!!document.selection){$(this.element).observe('mouseup',this.saveRange.bindAsEventListener(this));$(this.element).observe('keyup',this.saveRange.bindAsEventListener(this));}},doOnChange:function(event){if(this.onChangeTimeout)
window.clearTimeout(this.onChangeTimeout);this.onChangeTimeout=window.setTimeout(function(){this.notify('change',this.getValue());}.bind(this),Control.TextArea.onChangeTimeoutLength);},saveRange:function(){this.range=document.selection.createRange();},getValue:function(){return this.element.value;},getSelection:function(){if(!!document.selection)
return document.selection.createRange().text;else if(!!this.element.setSelectionRange)
return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd);else
return false;},replaceSelection:function(text){var scroll_top=this.element.scrollTop;if(!!document.selection){this.element.focus();var range=(this.range)?this.range:document.selection.createRange();range.text=text;range.select();}else if(!!this.element.setSelectionRange){var selection_start=this.element.selectionStart;this.element.value=this.element.value.substring(0,selection_start)+text+this.element.value.substring(this.element.selectionEnd);this.element.setSelectionRange(selection_start+text.length,selection_start+text.length);}
this.doOnChange();this.element.focus();this.element.scrollTop=scroll_top;},wrapSelection:function(before,after){this.replaceSelection(before+this.getSelection()+after);},insertBeforeSelection:function(text){this.replaceSelection(text+this.getSelection());},insertAfterSelection:function(text){this.replaceSelection(this.getSelection()+text);},collectFromEachSelectedLine:function(callback,before,after){this.replaceSelection((before||'')+$A(this.getSelection().split("\n")).collect(callback).join("\n")+(after||''));},insertBeforeEachSelectedLine:function(text,before,after){this.collectFromEachSelectedLine(function(line){},before,after);}});Object.extend(Control.TextArea,{onChangeTimeoutLength:500});Object.Event.extend(Control.TextArea);Control.TextArea.ToolBar=Class.create({initialize:function(textarea,toolbar){this.textarea=textarea;if(toolbar)
this.container=$(toolbar);else{this.container=$(document.createElement('ul'));this.textarea.element.parentNode.insertBefore(this.container,this.textarea.element);}},attachButton:function(node,callback){node.onclick=function(){return false;}
$(node).observe('click',callback.bindAsEventListener(this.textarea));},addButton:function(link_text,callback,attrs,title){var li=document.createElement('li');var a=document.createElement('a');a.setAttribute('title',title);a.href='#';this.attachButton(a,callback);li.appendChild(a);Object.extend(a,attrs||{});if(link_text){var span=document.createElement('span');span.innerHTML=link_text;a.appendChild(span);}
this.container.appendChild(li);}});var Showdown={};Showdown.converter=function(){var g_urls;var g_titles;var g_html_blocks;var g_list_level=0;this.makeHtml=function(text){g_urls=new Array();g_titles=new Array();g_html_blocks=new Array();text=text.replace(/~/g,"~T");text=text.replace(/\$/g,"~D");text=text.replace(/\r\n/g,"\n");text=text.replace(/\r/g,"\n");text="\n\n"+text+"\n\n";text=_Detab(text);text=text.replace(/^[ \t]+$/mg,"");text=_HashHTMLBlocks(text);text=_StripLinkDefinitions(text);text=_RunBlockGamut(text);text=_UnescapeSpecialChars(text);text=text.replace(/~D/g,"$$");text=text.replace(/~T/g,"~");return text;}
var _StripLinkDefinitions=function(text){var text=text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(wholeMatch,m1,m2,m3,m4){m1=m1.toLowerCase();g_urls[m1]=_EncodeAmpsAndAngles(m2);if(m3){return m3+m4;}else if(m4){g_titles[m1]=m4.replace(/"/g,"&quot;");}
return"";});return text;}
var _HashHTMLBlocks=function(text){text=text.replace(/\n/g,"\n\n");var block_tags_a="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"
var block_tags_b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"
text=text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,hashElement);text=text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement);text=text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,hashElement);text=text.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,hashElement);text=text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,hashElement);text=text.replace(/\n\n/g,"\n");return text;}
var hashElement=function(wholeMatch,m1){var blockText=m1;blockText=blockText.replace(/\n\n/g,"\n");blockText=blockText.replace(/^\n/,"");blockText=blockText.replace(/\n+$/g,"");blockText="\n\n~K"+(g_html_blocks.push(blockText)-1)+"K\n\n";return blockText;};var _RunBlockGamut=function(text){text=_DoHeaders(text);var key=hashBlock("<hr />");text=text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key);text=_DoLists(text);text=_DoCodeBlocks(text);text=_DoBlockQuotes(text);text=_HashHTMLBlocks(text);text=_FormParagraphs(text);return text;}
var _RunSpanGamut=function(text){text=_DoCodeSpans(text);text=_EscapeSpecialCharsWithinTagAttributes(text);text=_EncodeBackslashEscapes(text);text=_DoImages(text);text=_DoAnchors(text);text=_DoAutoLinks(text);text=_EncodeAmpsAndAngles(text);text=_DoItalicsAndBold(text);text=text.replace(/  +\n/g," <br />\n");return text;}
var _EscapeSpecialCharsWithinTagAttributes=function(text){var regex=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;text=text.replace(regex,function(wholeMatch){var tag=wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`");tag=escapeCharacters(tag,"\\`*_");return tag;});return text;}
var _DoAnchors=function(text){text=text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeAnchorTag);text=text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);text=text.replace(/(\[([^\[\]]+)\])()()()()()/g,writeAnchorTag);return text;}
var writeAnchorTag=function(wholeMatch,m1,m2,m3,m4,m5,m6,m7){if(m7==undefined)m7="";var whole_match=m1;var link_text=m2;var link_id=m3.toLowerCase();var url=m4;var title=m7;if(url==""){if(link_id==""){link_id=link_text.toLowerCase().replace(/ ?\n/g," ");}
url="#"+link_id;if(g_urls[link_id]!=undefined){url=g_urls[link_id];if(g_titles[link_id]!=undefined){title=g_titles[link_id];}}
else{if(whole_match.search(/\(\s*\)$/m)>-1){url="";}else{return whole_match;}}}
url=escapeCharacters(url,"*_");var result="<a href=\""+url+"\"";if(title!=""){title=title.replace(/"/g,"&quot;");title=escapeCharacters(title,"*_");result+=" title=\""+title+"\"";}
result+=">"+link_text+"</a>";return result;}
var _DoImages=function(text){text=text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeImageTag);text=text.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeImageTag);return text;}
var writeImageTag=function(wholeMatch,m1,m2,m3,m4,m5,m6,m7){var whole_match=m1;var alt_text=m2;var link_id=m3.toLowerCase();var url=m4;var title=m7;if(!title)title="";if(url==""){if(link_id==""){link_id=alt_text.toLowerCase().replace(/ ?\n/g," ");}
url="#"+link_id;if(g_urls[link_id]!=undefined){url=g_urls[link_id];if(g_titles[link_id]!=undefined){title=g_titles[link_id];}}
else{return whole_match;}}
alt_text=alt_text.replace(/"/g,"&quot;");url=escapeCharacters(url,"*_");var result="<img src=\""+url+"\" alt=\""+alt_text+"\"";title=title.replace(/"/g,"&quot;");title=escapeCharacters(title,"*_");result+=" title=\""+title+"\"";result+=" />";return result;}
var _DoHeaders=function(text){text=text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(wholeMatch,m1){return hashBlock("<h1>"+_RunSpanGamut(m1)+"</h1>");});text=text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(matchFound,m1){return hashBlock("<h2>"+_RunSpanGamut(m1)+"</h2>");});text=text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(wholeMatch,m1,m2){var h_level=m1.length;return hashBlock("<h"+h_level+">"+_RunSpanGamut(m2)+"</h"+h_level+">");});return text;}
var _ProcessListItems;var _DoLists=function(text){text+="~0";var whole_list=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(g_list_level){text=text.replace(whole_list,function(wholeMatch,m1,m2){var list=m1;var list_type=(m2.search(/[*+-]/g)>-1)?"ul":"ol";list=list.replace(/\n{2,}/g,"\n\n\n");;var result=_ProcessListItems(list);result=result.replace(/\s+$/,"");result="<"+list_type+">"+result+"</"+list_type+">\n";return result;});}else{whole_list=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;text=text.replace(whole_list,function(wholeMatch,m1,m2,m3){var runup=m1;var list=m2;var list_type=(m3.search(/[*+-]/g)>-1)?"ul":"ol";var list=list.replace(/\n{2,}/g,"\n\n\n");;var result=_ProcessListItems(list);result=runup+"<"+list_type+">\n"+result+"</"+list_type+">\n";return result;});}
text=text.replace(/~0/,"");return text;}
_ProcessListItems=function(list_str){g_list_level++;list_str=list_str.replace(/\n{2,}$/,"\n");list_str+="~0";list_str=list_str.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(wholeMatch,m1,m2,m3,m4){var item=m4;var leading_line=m1;var leading_space=m2;if(leading_line||(item.search(/\n{2,}/)>-1)){item=_RunBlockGamut(_Outdent(item));}
else{item=_DoLists(_Outdent(item));item=item.replace(/\n$/,"");item=_RunSpanGamut(item);}
return"<li>"+item+"</li>\n";});list_str=list_str.replace(/~0/g,"");g_list_level--;return list_str;}
var _DoCodeBlocks=function(text){text+="~0";text=text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(wholeMatch,m1,m2){var codeblock=m1;var nextChar=m2;codeblock=_EncodeCode(_Outdent(codeblock));codeblock=_Detab(codeblock);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");codeblock="<pre><code>"+codeblock+"\n</code></pre>";return hashBlock(codeblock)+nextChar;});text=text.replace(/~0/,"");return text;}
var hashBlock=function(text){text=text.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(g_html_blocks.push(text)-1)+"K\n\n";}
var _DoCodeSpans=function(text){text=text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(wholeMatch,m1,m2,m3,m4){var c=m3;c=c.replace(/^([ \t]*)/g,"");c=c.replace(/[ \t]*$/g,"");c=_EncodeCode(c);return m1+"<code>"+c+"</code>";});return text;}
var _EncodeCode=function(text){text=text.replace(/&/g,"&amp;");text=text.replace(/</g,"&lt;");text=text.replace(/>/g,"&gt;");text=escapeCharacters(text,"\*_{}[]\\",false);return text;}
var _DoItalicsAndBold=function(text){text=text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");text=text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");return text;}
var _DoBlockQuotes=function(text){text=text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(wholeMatch,m1){var bq=m1;bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0");bq=bq.replace(/~0/g,"");bq=bq.replace(/^[ \t]+$/gm,"");bq=_RunBlockGamut(bq);bq=bq.replace(/(^|\n)/g,"$1  ");bq=bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(wholeMatch,m1){var pre=m1;pre=pre.replace(/^  /mg,"~0");pre=pre.replace(/~0/g,"");return pre;});return hashBlock("<blockquote>\n"+bq+"\n</blockquote>");});return text;}
var _FormParagraphs=function(text){text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");var grafs=text.split(/\n{2,}/g);var grafsOut=new Array();var end=grafs.length;for(var i=0;i<end;i++){var str=grafs[i];if(str.search(/~K(\d+)K/g)>=0){grafsOut.push(str);}
else if(str.search(/\S/)>=0){str=_RunSpanGamut(str);str=str.replace(/^([ \t]*)/g,"<p>");str+="</p>"
grafsOut.push(str);}}
end=grafsOut.length;for(var i=0;i<end;i++){while(grafsOut[i].search(/~K(\d+)K/)>=0){var blockText=g_html_blocks[RegExp.$1];blockText=blockText.replace(/\$/g,"$$$$");grafsOut[i]=grafsOut[i].replace(/~K\d+K/,blockText);}}
return grafsOut.join("\n\n");}
var _EncodeAmpsAndAngles=function(text){text=text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");text=text.replace(/<(?![a-z\/?\$!])/gi,"&lt;");return text;}
var _EncodeBackslashEscapes=function(text){text=text.replace(/\\(\\)/g,escapeCharacters_callback);text=text.replace(/\\([`*_{}\[\]()>#+-.!])/g,escapeCharacters_callback);return text;}
var _DoAutoLinks=function(text){text=text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"<a href=\"$1\">$1</a>");text=text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(wholeMatch,m1){return _EncodeEmailAddress(_UnescapeSpecialChars(m1));});return text;}
var _EncodeEmailAddress=function(addr){function char2hex(ch){var hexDigits='0123456789ABCDEF';var dec=ch.charCodeAt(0);return(hexDigits.charAt(dec>>4)+hexDigits.charAt(dec&15));}
var encode=[function(ch){return"&#"+ch.charCodeAt(0)+";";},function(ch){return"&#x"+char2hex(ch)+";";},function(ch){return ch;}];addr="mailto:"+addr;addr=addr.replace(/./g,function(ch){if(ch=="@"){ch=encode[Math.floor(Math.random()*2)](ch);}else if(ch!=":"){var r=Math.random();ch=(r>.9?encode[2](ch):r>.45?encode[1](ch):encode[0](ch));}
return ch;});addr="<a href=\""+addr+"\">"+addr+"</a>";addr=addr.replace(/">.+:/g,"\">");return addr;}
var _UnescapeSpecialChars=function(text){text=text.replace(/~E(\d+)E/g,function(wholeMatch,m1){var charCodeToReplace=parseInt(m1);return String.fromCharCode(charCodeToReplace);});return text;}
var _Outdent=function(text){text=text.replace(/^(\t|[ ]{1,4})/gm,"~0");text=text.replace(/~0/g,"")
return text;}
var _Detab=function(text){text=text.replace(/\t(?=\t)/g,"    ");text=text.replace(/\t/g,"~A~B");text=text.replace(/~B(.+?)~A/g,function(wholeMatch,m1,m2){var leadingText=m1;var numSpaces=4-leadingText.length%4;for(var i=0;i<numSpaces;i++)leadingText+=" ";return leadingText;});text=text.replace(/~A/g,"    ");text=text.replace(/~B/g,"");return text;}
var escapeCharacters=function(text,charsToEscape,afterBackslash){var regexString="(["+charsToEscape.replace(/([\[\]\\])/g,"\\$1")+"])";if(afterBackslash){regexString="\\\\"+regexString;}
var regex=new RegExp(regexString,"g");text=text.replace(regex,escapeCharacters_callback);return text;}
var escapeCharacters_callback=function(wholeMatch,m1){var charCodeToEscape=m1.charCodeAt(0);return"~E"+charCodeToEscape+"E";}}
myGlobalHandlers={onCreate:function(){var w=$('working');if(w){Element.show(w);}},onComplete:function(){if(Ajax.activeRequestCount===0){var w=$('working');if(w){Element.hide(w);}}},onException:function(p1,p2){onComplete();},onError:function(){onComplete();}};Ajax.Responders.register(myGlobalHandlers);function getKeyCode(e){if(e.which){if(e.which>0){return e.which;}else if(e.keyCode){return e.keyCode;}else if(e.modifiers!==undefined){return e.modifiers;}else{return false;}}else if(e.keyCode){return e.keyCode;}else{e=window.event;return e.keyCode;}}
function getChildDivs(el){var divs=new Array();el=el.firstChild;while(el!==null){if(el.nodeName=="DIV"){divs.push(el);}
el=el.nextSibling;}
return divs;}
function nextLi(el){while(el=el.nextSibling){if(el.nodeName=="LI"){break;}}
return el;}
function load(url,placeholder,js){if(js===undefined){js=true;}
var myAjax=new Ajax.Updater(placeholder,url,{method:'get',evalScripts:js});}
function action(url,action,id,placeholder,js){load(url+'?action='+action+'&id='+id+'&url='+url+'&ph='+placeholder,placeholder,js);}
function saveForm(url,formName,placeholder,js){if(js===undefined){js=true;}
var pars=Form.serialize(formName);var myAjax=new Ajax.Updater(placeholder,url,{method:'post',parameters:pars,evalScripts:js});}
function postPars(url,pars,placeholder,js){if(js===undefined){js=true;}
var myAjax=new Ajax.Updater(placeholder,url,{method:'post',parameters:pars,evalScripts:js});}
function saveMultiForm(url,formNames,placeholder,js){if(js===undefined){js=true;}
var tmp=new Array();var someForm;for(var i=formNames.length;--i>=0;){someForm=$(formNames[i]);tmp.push(Form.serialize(someForm));}
var pars=tmp.join('&');var myAjax=new Ajax.Updater(placeholder,url,{method:'post',parameters:pars,evalScripts:js});}
function openPortalPopup(url){window.open(url,'TuF','width=500,height=400,scrollbars=yes');return false;}
function openFlashPopup(url){window.open(url,'TuF','width=652,height=512,scrollbars=yes');return false;}
var currentTimeout;function toggleKompetenz(id){var el=document.getElementById('kompetenz_'+id);if(el.style.display=='none'){el.style.display='block';document.getElementById('kompetenz_link_'+id).style.backgroundImage="url(../img/arrow_kt_down.gif)";}
else{el.style.display='none';document.getElementById('kompetenz_link_'+id).style.backgroundImage="url(../img/arrow_kt.gif)";}}
function toggleHover(link,id,active){var el=document.getElementById('kompetenz_'+id);if(active){if(el.style.display=='none'){link.style.backgroundImage="url(../img/arrow_kt_hover.gif)";}
else{link.style.backgroundImage="url(../img/arrow_kt_down_hover.gif)";}}
else{if(el.style.display=='none'){link.style.backgroundImage="url(../img/arrow_kt.gif)";}
else{link.style.backgroundImage="url(../img/arrow_kt_down.gif)";}}}
function toggleHoverNew(link,active){if(active){link.style.backgroundImage="url(../img/arrow_kt_hover.gif)";}
else{link.style.backgroundImage="url(../img/arrow_kt.gif)";}}
function simpleQuickSearch(searchValue){clearTimeout(currentTimeout);if(searchValue.strip().length>2){var ph=$('popup-suche');Element.update(ph,'<img style="top: 15px; position: relative;" src="/gh/img/spinner.gif"/>');Element.show(ph);currentTimeout=setTimeout('doSQS()',250);}else{Element.hide('popup-suche');}}
function doSQS(){saveForm('/gh/_search.html','qsForm','popup-suche');}
function editEbene(id){location.href='editEbene.html?id='+id;}
function editSondertext(id){location.href='editSondertext.html?id='+id;}
function openTestPreview(testId){window.open('/klettdf/swf/uebung.html?preview=true&testId='+testId,'Uebungen','width=1020,height=650,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,status=yes,menubar=no,locationbar=no,screenX=0,screenY=0');}
function openOriginalTest(testId,schuelerId){window.open('/klettdf/swf/uebung.html?preview=true&originaltest=true&username='+schuelerId+'&testId='+testId,'Uebungen','width=1020,height=650,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,status=yes,menubar=no,locationbar=no,screenX=0,screenY=0');}
function openItemPreview(testId,aufgabeId){if(aufgabeId>-1){window.open('/klettdf/swf/uebung.html?preview=true&testId='+testId+'&aufgabeId='+aufgabeId,'Uebungen','width=1020,height=650,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,status=yes,menubar=no,locationbar=no,screenX=0,screenY=0');}else{alert('Vorschau kann nicht angezeigt werden. Ist die Aufgabe schon gespeichert?');}}
function updateMedium(source,mediumId,uploadName,url){Shadowbox.close();var t=new Template('<input type="hidden" value="#{mediumId}" name="#{source}"/><a href="#{url}">#{uploadName}</a> (Speichern nicht vergessen!)');$('_'+source).update(t.evaluate({source:source,mediumId:mediumId,uploadName:uploadName,url:url}));}
function clearMedium(source){var t=new Template('<input type="hidden" value="" name="#{source}"/>??? (Speichern nicht vergessen!)');$('_'+source).update(t.evaluate({source:source}));return false;}
function addFehlschreibung(){return addFehlschreibung(true);}
function addFehlschreibung(withText){var kat='(noch nicht gespeichert)';if(withText){kat='(Kategorien kann man erst nach dem Speichern zuweisen)';}
var cnt=$F('cnt');var t=new Template('<input id="fehlschreibungen#{cnt}.text" type="text" name="fehlschreibungen[#{cnt}].text" onfocus="return switchKat(\'kat_#{cnt}\', this);" size="50"/> '+kat+'<br/>');var h=t.evaluate({cnt:cnt});$('cnt').value=++cnt;if(cnt==1){$('fs').update();}
$('fs').insert(h);return false;}
function openNewsPopup(id){Shadowbox.open({player:'iframe',title:'edit',content:_base+'backoffice/news/news.html?id='+id,height:420,width:990},{onClose:function(){alert("onClose");}});}
var DatePickerFormatter=Class.create();DatePickerFormatter.prototype={initialize:function(format,separator){if(Object.isUndefined(format))
format=["yyyy","mm","dd"];if(Object.isUndefined(separator))
separator="-";this._format=format;this.separator=separator;this._format_year_index=format.indexOf("yyyy");this._format_month_index=format.indexOf("mm");this._format_day_index=format.indexOf("dd");this._year_regexp=/^\d{4}$/;this._month_regexp=/^0\d|1[012]|\d$/;this._day_regexp=/^0\d|[12]\d|3[01]|\d$/;},match:function(str){var d=str.split(this.separator);if(d.length<3)
return false;var year=d[this._format_year_index].match(this._year_regexp);if(year){year=year[0]}else{return false}
var month=d[this._format_month_index].match(this._month_regexp);if(month){month=month[0]}else{return false}
var day=d[this._format_day_index].match(this._day_regexp);if(day){day=day[0]}else{return false}
return[year,month,day];},current_date:function(){var d=new Date;return this.date_to_string(d.getFullYear(),d.getMonth()+1,d.getDate());},date_to_string:function(year,month,day,separator){if(Object.isUndefined(separator))
separator=this.separator;var a=[0,0,0];a[this._format_year_index]=year;a[this._format_month_index]=month.toPaddedString(2);a[this._format_day_index]=day.toPaddedString(2);return a.join(separator);}};var DatePicker=Class.create();DatePicker.prototype={Version:'0.9.4',_relative:null,_div:null,_zindex:1,_keepFieldEmpty:false,_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],_dateFormat:[["dd","mm","yyyy"],"/"],_language:'fr',_language_month:$H({'fr':['Janvier','F&#233;vrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','D&#233;cembre'],'en':['January','February','March','April','May','June','July','August','September','October','November','December'],'sp':['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],'it':['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],'de':['Januar','Februar','M&#228;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],'pt':['Janeiro','Fevereiro','Mar&#231;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],'hu':['Janu&#225;r','Febru&#225;r','M&#225;rcius','&#193;prilis','M&#225;jus','J&#250;nius','J&#250;lius','Augusztus','Szeptember','Okt&#243;ber','November','December'],'lt':['Sausis','Vasaris','Kovas','Balandis','Gegu&#382;&#279;','Bir&#382;elis','Liepa','Rugj&#363;tis','Rus&#279;jis','Spalis','Lapkritis','Gruodis'],'nl':['januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december'],'dk':['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'],'no':['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],'lv':['Janv&#257;ris','Febru&#257;ris','Marts','Apr&#299;lis','Maijs','J&#363;nijs','J&#363;lijs','Augusts','Septembris','Oktobris','Novembris','Decemberis'],'ja':['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;','7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],'fi':['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&#228;kuu','Hein&#228;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],'ro':['Ianuarie','Februarie','Martie','Aprilie','Mai','Junie','Julie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],'zh':['1&#32;&#26376;','2&#32;&#26376;','3&#32;&#26376;','4&#32;&#26376;','5&#32;&#26376;','6&#32;&#26376;','7&#32;&#26376;','8&#32;&#26376;','9&#32;&#26376;','10&#26376;','11&#26376;','12&#26376;'],'sv':['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December']}),_language_day:$H({'fr':['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'],'en':['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],'sp':['Lun','Mar','Mie','Jue','Vie','S&#224;b','Dom'],'it':['Lun','Mar','Mer','Gio','Ven','Sab','Dom'],'de':['Mon','Die','Mit','Don','Fre','Sam','Son'],'pt':['Seg','Ter','Qua','Qui','Sex','S&#225;','Dom'],'hu':['H&#233;','Ke','Sze','Cs&#252;','P&#233;','Szo','Vas'],'lt':['Pir','Ant','Tre','Ket','Pen','&Scaron;e&scaron;','Sek'],'nl':['ma','di','wo','do','vr','za','zo'],'dk':['Man','Tir','Ons','Tor','Fre','L&#248;r','S&#248;n'],'no':['Man','Tir','Ons','Tor','Fre','L&#248;r','Sun'],'lv':['P','O','T','C','Pk','S','Sv'],'ja':['&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;','&#26085;'],'fi':['Ma','Ti','Ke','To','Pe','La','Su'],'ro':['Lun','Mar','Mie','Joi','Vin','Sam','Dum'],'zh':['&#21608;&#19968;','&#21608;&#20108;','&#21608;&#19977;','&#21608;&#22235;','&#21608;&#20116;','&#21608;&#20845;','&#21608;&#26085;'],'sv':['M&#229;n','Tis','Ons','Tor','Fre','L&#246;r','S&#246;n']}),_language_close:$H({'fr':'fermer','en':'close','sp':'cierre','it':'fine','de':'schliessen','pt':'fim','hu':'bez&#225;r','lt':'udaryti','nl':'sluiten','dk':'luk','no':'lukk','lv':'aizv&#275;rt','ja':'&#38281;&#12376;&#12427;','fi':'sulje','ro':'inchide','zh':'&#20851;&#32;&#38381','sv':'st&#228;ng'}),_todayDate:new Date(),_current_date:null,_clickCallback:Prototype.emptyFunction,_cellCallback:Prototype.emptyFunction,_id_datepicker:null,_disablePastDate:false,_disableFutureDate:true,_oneDayInMs:24*3600*1000,_topOffset:30,_leftOffset:0,_isPositionned:false,_relativePosition:true,_setPositionTop:0,_setPositionLeft:0,_bodyAppend:false,_showEffect:"appear",_showDuration:1,_enableShowEffect:true,_closeEffect:"fade",_closeEffectDuration:0.3,_enableCloseEffect:true,_closeTimer:null,_enableCloseOnBlur:false,_afterClose:Prototype.emptyFunction,getMonthLocale:function(month){return this._language_month.get(this._language)[month];},getLocaleClose:function(){return this._language_close.get(this._language);},_initCurrentDate:function(){this._df=new DatePickerFormatter(this._dateFormat[0],this._dateFormat[1]);this._current_date=$F(this._relative);if(!this._df.match(this._current_date)){this._current_date=this._df.current_date();if(!this._keepFieldEmpty)
$(this._relative).value=this._current_date;}
var a_date=this._df.match(this._current_date);this._current_year=Number(a_date[0]);this._current_mon=Number(a_date[1])-1;this._current_day=Number(a_date[2]);},initialize:function(h_p){this._relative=h_p["relative"];if(h_p["language"])
this._language=h_p["language"];this._zindex=(h_p["zindex"])?parseInt(Number(h_p["zindex"])):1;if(!Object.isUndefined(h_p["keepFieldEmpty"]))
this._keepFieldEmpty=h_p["keepFieldEmpty"];if(Object.isFunction(h_p["clickCallback"]))
this._clickCallback=h_p["clickCallback"];if(!Object.isUndefined(h_p["leftOffset"]))
this._leftOffset=parseInt(h_p["leftOffset"]);if(!Object.isUndefined(h_p["topOffset"]))
this._topOffset=parseInt(h_p["topOffset"]);if(!Object.isUndefined(h_p["relativePosition"]))
this._relativePosition=h_p["relativePosition"];if(!Object.isUndefined(h_p["showEffect"]))
this._showEffect=h_p["showEffect"];if(!Object.isUndefined(h_p["enableShowEffect"]))
this._enableShowEffect=h_p["enableShowEffect"];if(!Object.isUndefined(h_p["showDuration"]))
this._showDuration=h_p["showDuration"];if(!Object.isUndefined(h_p["closeEffect"]))
this._closeEffect=h_p["closeEffect"];if(!Object.isUndefined(h_p["enableCloseEffect"]))
this._enableCloseEffect=h_p["enableCloseEffect"];if(!Object.isUndefined(h_p["closeEffectDuration"]))
this._closeEffectDuration=h_p["closeEffectDuration"];if(Object.isFunction(h_p["afterClose"]))
this._afterClose=h_p["afterClose"];if(!Object.isUndefined(h_p["externalControl"]))
this._externalControl=h_p["externalControl"];if(!Object.isUndefined(h_p["dateFormat"]))
this._dateFormat=h_p["dateFormat"];if(Object.isFunction(h_p["cellCallback"]))
this._cellCallback=h_p["cellCallback"];this._setPositionTop=(h_p["setPositionTop"])?parseInt(Number(h_p["setPositionTop"])):0;this._setPositionLeft=(h_p["setPositionLeft"])?parseInt(Number(h_p["setPositionLeft"])):0;if(!Object.isUndefined(h_p["enableCloseOnBlur"])&&h_p["enableCloseOnBlur"])
this._enableCloseOnBlur=true;if(!Object.isUndefined(h_p["disablePastDate"])&&h_p["disablePastDate"])
this._disablePastDate=true;if(!Object.isUndefined(h_p["disableFutureDate"])&&!h_p["disableFutureDate"])
this._disableFutureDate=false;this._id_datepicker='datepicker-'+this._relative;this._id_datepicker_prev=this._id_datepicker+'-prev';this._id_datepicker_next=this._id_datepicker+'-next';this._id_datepicker_hdr=this._id_datepicker+'-header';this._id_datepicker_ftr=this._id_datepicker+'-footer';this._div=new Element('div',{id:this._id_datepicker,className:'datepicker',style:'display: none; z-index:'+this._zindex});this._div.innerHTML='<table><thead><tr><th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;">&nbsp;&lt;&lt;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="5"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;">&nbsp;&gt;&gt;&nbsp;</th></tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tfoot></table>';Event.observe(this._relative,'click',this.click.bindAsEventListener(this),false);document.observe('dom:loaded',this.load.bindAsEventListener(this),false);if(this._enableCloseOnBlur){Event.observe(this._relative,'blur',function(e){this._closeTimer=this.close.bind(this).delay(1);}.bindAsEventListener(this));Event.observe(this._div,'click',function(e){if(this._closeTimer){window.clearTimeout(this._closeTimer);this._closeTimer=null;}});}},load:function(){if(this._externalControl)
Event.observe(this._externalControl,'click',this.click.bindAsEventListener(this),false);if(this._relativeAppend){if($(this._relative).parentNode){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);$(this._relative).parentNode.appendChild(this._div);}}else{var body=document.getElementsByTagName("body").item(0);if(body){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);body.appendChild(this._div);}
if(this._relativePosition){var a_pos=Element.cumulativeOffset($(this._relative));this.setPosition(a_pos[1],a_pos[0]);}else{if(this._setPositionTop||this._setPositionLeft)
this.setPosition(this._setPositionTop,this._setPositionLeft);}}
this._initCurrentDate();$(this._id_datepicker_ftr).innerHTML=this.getLocaleClose();Event.observe($(this._id_datepicker_prev),'click',this.prevMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next),'click',this.nextMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_ftr),'click',this.close.bindAsEventListener(this),false);},_wrap_in_iframe:function(content){return(Prototype.Browser.IE)?"<div style='height:167px;width:185px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;width:180px'>"+content+"</div></div>":content;},visible:function(){return $(this._id_datepicker).visible();},click:function(){if($(this._id_datepicker)==null)this.load();if(!this._isPositionned&&this._relativePosition){var a_lt=Element.positionedOffset($(this._relative));$(this._id_datepicker).setStyle({'left':Number(a_lt[0]+this._leftOffset)+'px','top':Number(a_lt[1]+this._topOffset)+'px'});this._isPositionned=true;}
if(!this.visible()){this._initCurrentDate();this._redrawCalendar();}
eval(this._clickCallback());if(this._enableShowEffect){new Effect.toggle(this._id_datepicker,this._showEffect,{duration:this._showDuration});}else{$(this._id_datepicker).show();}},close:function(){if(this._enableCloseEffect){switch(this._closeEffect){case'puff':new Effect.Puff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'blindUp':new Effect.BlindUp(this._id_datepicker,{duration:this._closeEffectDuration});break;case'dropOut':new Effect.DropOut(this._id_datepicker,{duration:this._closeEffectDuration});break;case'switchOff':new Effect.SwitchOff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'squish':new Effect.Squish(this._id_datepicker,{duration:this._closeEffectDuration});break;case'fold':new Effect.Fold(this._id_datepicker,{duration:this._closeEffectDuration});break;case'shrink':new Effect.Shrink(this._id_datepicker,{duration:this._closeEffectDuration});break;default:new Effect.Fade(this._id_datepicker,{duration:this._closeEffectDuration});break;};}else{$(this._id_datepicker).hide();}
eval(this._afterClose());},setDateFormat:function(format,separator){if(Object.isUndefined(format))
format=this._dateFormat[0];if(Object.isUndefined(separator))
separator=this._dateFormat[1];this._dateFormat=[format,separator];},setPosition:function(t,l){var h_pos={'top':'0px','left':'0px'};if(!Object.isUndefined(t))
h_pos['top']=Number(t)+this._topOffset+'px';if(!Object.isUndefined(l))
h_pos['left']=Number(l)+this._leftOffset+'px';$(this._id_datepicker).setStyle(h_pos);this._isPositionned=true;},_getMonthDays:function(year,month){if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&(month==1))
return 29;return this._daysInMonth[month];},_buildCalendar:function(){var _self=this;var tbody=$(this._id_datepicker+'-tbody');try{while(tbody.hasChildNodes())
tbody.removeChild(tbody.childNodes[0]);}catch(e){};var trDay=new Element('tr');this._language_day.get(this._language).each(function(item){var td=new Element('td');td.innerHTML=item;td.className='wday';trDay.appendChild(td);});tbody.appendChild(trDay);var a_d=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];var d=new Date(this._current_year,this._current_mon,1,12);var startIndex=(!d.getDay())?6:d.getDay()-1;var nbDaysInMonth=this._getMonthDays(this._current_year,this._current_mon);var daysIndex=1;for(var j=startIndex;j<7;j++){a_d[0][j]={d:daysIndex,m:this._current_mon,y:this._current_year};daysIndex++;}
var a_prevMY=this._prevMonthYear();var nbDaysInMonthPrev=this._getMonthDays(a_prevMY[1],a_prevMY[0]);for(var j=0;j<startIndex;j++){a_d[0][j]={d:Number(nbDaysInMonthPrev-startIndex+j+1),m:Number(a_prevMY[0]),y:a_prevMY[1],c:'outbound'};}
var switchNextMonth=false;var currentMonth=this._current_mon;var currentYear=this._current_year;for(var i=1;i<6;i++){for(var j=0;j<7;j++){a_d[i][j]={d:daysIndex,m:currentMonth,y:currentYear,c:(switchNextMonth)?'outbound':(((daysIndex==this._todayDate.getDate())&&(this._current_mon==this._todayDate.getMonth())&&(this._current_year==this._todayDate.getFullYear()))?'today':null)};daysIndex++;if(daysIndex>nbDaysInMonth){daysIndex=1;switchNextMonth=true;if(this._current_mon+1>11){currentMonth=0;currentYear+=1;}else{currentMonth+=1;}}}}
for(var i=0;i<6;i++){var tr=new Element('tr');for(var j=0;j<7;j++){var h_ij=a_d[i][j];var td=new Element('td');var id=$A([this._relative,this._df.date_to_string(h_ij["y"],h_ij["m"]+1,h_ij["d"],'-')]).join('-');td.setAttribute('id',id);if(h_ij["c"])
td.className=h_ij["c"];var _curDate=new Date();_curDate.setFullYear(h_ij["y"],h_ij["m"],h_ij["d"]);if(this._disablePastDate||this._disableFutureDate){if(this._disablePastDate){var _res=(_curDate>=this._todayDate)?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}
if(this._disableFutureDate){var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}}else{this._bindCellOnClick(td,false);}
td.innerHTML=h_ij["d"];tr.appendChild(td);}
tbody.appendChild(tr);}
return tbody;},_bindCellOnClick:function(td,wcompare,compareresult,h_ij_c){var doBind=false;if(wcompare){if(compareresult){doBind=true;}else{td.className=(h_ij_c)?'nclick_outbound':'nclick';}}else{doBind=true;}
if(doBind){var _self=this;td.onclick=function(){$(_self._relative).value=String($(this).readAttribute('id')).replace(_self._relative+'-','').replace(/-/g,_self._df.separator);if(_self._cellCallback)
_self._cellCallback(this);_self.close();};}},_nextMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon+1>11){c_mon=0;c_year+=1;}else{c_mon+=1;}
return[c_mon,c_year];},nextMonth:function(){var a_next=this._nextMonthYear();var _nextMon=a_next[0];var _nextYear=a_next[1];var _curDate=new Date();_curDate.setFullYear(_nextYear,_nextMon,1);var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;if(this._disableFutureDate&&!_res)
return;this._current_mon=_nextMon;this._current_year=_nextYear;this._redrawCalendar();},_prevMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon-1<0){c_mon=11;c_year-=1;}else{c_mon-=1;}
return[c_mon,c_year];},prevMonth:function(){var a_prev=this._prevMonthYear();var _prevMon=a_prev[0];var _prevYear=a_prev[1];var _curDate=new Date();_curDate.setFullYear(_prevYear,_prevMon,1);var _res=(_curDate>=this._todayDate)?true:false;if(this._disablePastDate&&!_res)
return;this._current_mon=_prevMon;this._current_year=_prevYear;this._redrawCalendar();},_redrawCalendar:function(){this._setLocaleHdr();this._buildCalendar();},_setLocaleHdr:function(){var a_next=this._nextMonthYear();$(this._id_datepicker_next).setAttribute('title',this.getMonthLocale(a_next[0])+' '+a_next[1]);var a_prev=this._prevMonthYear();$(this._id_datepicker_prev).setAttribute('title',this.getMonthLocale(a_prev[0])+' '+a_prev[1]);$(this._id_datepicker_hdr).update('&nbsp;&nbsp;&nbsp;'+this.getMonthLocale(this._current_mon)+'&nbsp;'+this._current_year+'&nbsp;&nbsp;&nbsp;');}};
