if(!console)var console={};if(!console.log)console.log=function(){};document.observe('dom:loaded',function(){$$('a.external').each(function(a){a.target='_blank';});});;document.observe('dom:loaded',function(){if($('content').hasClassName('home')){new Ajax.Request('images/home/list.json',{method:'get',onSuccess:function(transport){var list=transport.responseText.evalJSON(true);if(list&&Object.isArray(list.items)&&list.items.length)
home.init(list.items);}});}});home={images:Array(),current:0,init:function(items){var img=$$('#content.home img')[0];var title=img.getAttribute('title');var container=new Element('div',{id:'image_container'});items.each(function(item,i){var img=new Element('img',{src:'images/home/'+item,width:'380',height:'263',alt:'ANNA – junge Klaenge',title:title}).setOpacity((i==0)?1:0);container.appendChild(img);home.images.push(img);});img.replace(container);new PeriodicalExecuter(home.advance,7);},advance:function(){var previous=home.images[home.current];home.current++;if(home.current>=home.images.length)home.current=0;var next=home.images[home.current];new Effect.Fade(previous,{duration:0.7,afterFinish:function(obj){new Effect.Appear(next,{duration:0.7});}});}};document.observe('dom:loaded',function(){if($('content').hasClassName('termine')){new Ajax.Request('images/termine/list.json',{method:'get',onSuccess:function(transport){var list=transport.responseText.evalJSON(true);if(list&&Object.isArray(list.items)&&list.items.length)
termine.init(list.items);}});}});termine={images:Array(),current:0,init:function(items){var img=$$('#content.termine #image_container img')[0];var title=img.getAttribute('title');var container=new Element('div',{id:'image_container'});items.each(function(item,i){var img=new Element('img',{src:'images/termine/'+item,width:'300',height:'227',alt:'ANNA – junge Klaenge',title:title}).setOpacity((i==0)?1:0);container.appendChild(img);termine.images.push(img);});img.replace(container);new PeriodicalExecuter(termine.advance,7);},advance:function(){var previous=termine.images[termine.current];termine.current++;if(termine.current>=termine.images.length)termine.current=0;var next=termine.images[termine.current];new Effect.Fade(previous,{duration:0.7,afterFinish:function(obj){new Effect.Appear(next,{duration:0.7});}});}};document.observe('dom:loaded',function(){if($('content').hasClassName('tickets')){var control=$$('#formular h3')[0];var form=$$('#formular form')[0];control.addClassName('interactive');control.observe('click',function(){control.toggleClassName('visible');if(control.hasClassName('visible'))Effect.BlindDown(form,{duration:0.3});else Effect.BlindUp(form,{duration:0.3});});form.hide();var message=($$('meta[name=language]')[0].getAttribute('content')=='en')?'Add more tickets':'Weitere Karten hinzufügen';var a=new Element('a').update(message);var div=new Element('div').update(a);$('kartenanzahl').insert(div);var index=2;var template='<div>'+$('kartenanzahl').select('div')[0].innerHTML+'</div>';a.observe('click',function(){var newFields=template.replace(/1/g,index);;div.insert({before:newFields});index++;ticketSelector();});var ticketSelector=function(){var selects=$$('#kartenanzahl select');if($('ehrbarsaal').checked){selects.each(function(i){var options=i.select('option');options.each(function(j){j.disabled=true;});options[0].disabled=false;options[1].disabled=false;if(options[2].selected||options[3].selected||options[4].selected||options[5].selected)options[0].selected=true;});}else if($('abonnement').checked){selects.each(function(i){var options=i.select('option');options.each(function(j){j.disabled=true;});options[0].disabled=false;options[1].disabled=false;if(options[2].selected||options[3].selected||options[4].selected||options[5].selected)options[0].selected=true;});}else{selects.each(function(i){i.select('option').each(function(j){j.disabled=false;});});}}
ticketSelector();$('ehrbarsaal').observe('change',ticketSelector);$('abonnement').observe('change',ticketSelector);$('einzeltickets').observe('change',ticketSelector);form.observe('submit',function(event){var error=false;[this.vorname,this.nachname].each(function(i){if($(i).getValue().blank()){i.addClassName('error');error=true;}else i.removeClassName('error');});if(!/^[\w-_]+(\.[\w-_]+)*@([\w-_]+\.)+[a-zA-Z]{2,5}$/.match($(this.email).getValue().strip())){this.email.addClassName('error');error=true;}else this.email.removeClassName('error');if(!($('herr').checked||$('frau').checked)){error=true;$('sex').addClassName('error');}else $('sex').removeClassName('error');if(error)event.stop();});}});document.observe('dom:loaded',function(){if($('content').hasClassName('team')){['susanne','martha','johannes','veronika'].each(function(i){$(i).select('p, img').invoke('hide');var elm=new Element('div',{'class':'person '+i});var handler_mouseover=function(){$$('#image img')[0].src='images/team/'+i+'.jpg';[$('susanne'),$('martha'),$('johannes'),$('veronika')].each(function(j){$(j).select('p, img, h3').invoke('hide');});$(i).select('p, img, h3').invoke('show');};var handler_mouseout=function(){$$('#image img')[0].src='images/team/ajk.jpg';};elm.observe('mouseover',handler_mouseover);elm.observe('mouseout',handler_mouseout);$(i).observe('mouseover',handler_mouseover);elm.setOpacity(0.001);elm.setStyle({'background':'#fff'});$('image').appendChild(elm);});$('content').addClassName('enhanced');}});Element.addMethods({hoverize:function(element,tagName){element=$(element);element.observe('mouseover',function(){this.addClassName('hover');});element.observe('mouseout',function(){this.removeClassName('hover');});return element;}});document.observe('dom:loaded',function(){[{path:'konzert_15_01_2009',height:'500'},{path:'konzert_19_02_2009',height:'470'},{path:'konzert_19_03_2009',height:'465'},{path:'konzert_16_04_2009',height:'467'},{path:'konzert_22_04_2009',height:'467'},{path:'konzert_18_03_2010',height:'467'},{path:'konzert_21_04_2010',height:'467'}].each(function(i){if($('content').hasClassName(i.path)){new Ajax.Request('images/'+i.path+'/list.json',{method:'get',onSuccess:function(transport){var list=transport.responseText.evalJSON(true);if(list&&Object.isArray(list.items)&&list.items.length)
concertGallery.init(list.items,i.path,i.height);}});}});});concertGallery={images:Array(),current:0,init:function(items,path,height){var container=new Element('div',{id:'image_container'});items.each(function(item,i){var img=new Element('img',{src:'images/'+path+'/'+item.path,width:'700',height:height,alt:'ANNA – junge Klaenge',title:'Foto: '+item.creator}).setOpacity((i==0)?1:0);container.appendChild(img);concertGallery.images.push(img);});$('gallery_container').appendChild(container);var controls=new Element('div',{id:'controls'});controls.appendChild(new Element('div',{id:'previous'}).observe('click',this.manualAdvanceBackwards).hoverize());controls.appendChild(new Element('div',{id:'next'}).observe('click',this.manualAdvance).hoverize());controls.appendChild(new Element('div',{id:'toggle'}).observe('click',this.toggleSlideshow).hoverize());var counter=new Element('span',{id:'counter'});counter.count=items.length;counter.update=function(i){this.innerHTML=(i+1)+' / '+this.count;}
counter.update(0);controls.appendChild(counter);$('gallery_container').appendChild(controls);this.toggleSlideshow();},stopSlideshow:function(){if(concertGallery.timer){concertGallery.timer.stop();concertGallery.timer=false;$('toggle').removeClassName('running');}},toggleSlideshow:function(){if(concertGallery.timer){concertGallery.timer.stop();concertGallery.timer=false;$('toggle').removeClassName('running');}else{concertGallery.timer=new PeriodicalExecuter(concertGallery.advance,9);$('toggle').addClassName('running');}},advance:function(){var previous=concertGallery.images[concertGallery.current];concertGallery.current++;if(concertGallery.current>=concertGallery.images.length)concertGallery.current=0;var next=concertGallery.images[concertGallery.current];$('counter').update(concertGallery.current);concertGallery.crossfade(previous,next);},manualAdvance:function(){concertGallery.stopSlideshow();concertGallery.advance();},manualAdvanceBackwards:function(){concertGallery.stopSlideshow();var previous=concertGallery.images[concertGallery.current];concertGallery.current--;if(concertGallery.current<0)concertGallery.current=concertGallery.images.length-1;var next=concertGallery.images[concertGallery.current];$('counter').update(concertGallery.current);concertGallery.crossfade(previous,next);},crossfade:function(previous,next){new Effect.Fade(previous,{duration:0.7,afterFinish:function(obj){concertGallery.images.invoke('hide');concertGallery.images.invoke('setOpacity',0);next.show();new Effect.Appear(next,{duration:0.7});}});}};