window.addEvent('domready', function() {
	
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#4BB314');
			
			//NEW TEST START
			var anzahl_referenzen = 3;
			for(var i=1;i<=anzahl_referenzen;i++){
				document.getElementById("img_slide_show_container"+i).style.display = "none";
				if(toggler.id == "sub_point"+i){
					document.getElementById("img_slide_show_container"+i).style.display = "block";
				}
			}
			//NEW TEST END
			
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#777777');
		}
	});

	//add click event to the "add section" link
	$('add_section').addEvent('click', function(event) {
		event.stop();
		
		// create toggler
		var toggler = new Element('h3', {
			'class': 'toggler',
			'html': 'Common descent'
		});
		
		// create content
		var content = new Element('div', {
			'class': 'element',
			'html': '<p>kolly+schweizer</p>'
		});
		
		// position for the new section
		var position = 0;
		
		// add the section to our myAccordion using the addSection method
		myAccordion.addSection(toggler, content, position);
	});
});
