var slidestart=0;
var rAccordion = new Class({

	initialize: function(container, toggleClass, elementClass, options){
		this.container = container;
		this.tClass = toggleClass;
		this.eClass = elementClass;
		this.options = options;
		this.selector = '#' + this.container + ' > .';
		this.makeAccordion();
	},
	
	makeAccordion: function(){
		new Accordion(
			$$(this.selector+this.tClass),
			$$(this.selector+this.eClass),
			this.options
		).addEvents({
			'onActive': function(toggle){
				if(toggle.getParent().getStyle('height') != 0)
					toggle.getParent().setStyle('height', '');
			},
			'onComplete': function(a){
				if ($defined(a)) {
					var height = 0;
					a.getParent().getChildren().each(function(e){
						height = height + e.offsetHeight;
					});
					if(height != a.getParent().offsetHeight && a.getParent().offsetHeight != 0)
						a.getParent().setStyle('height','');
				}
			}
		});
		this.selector += this.eClass + ' > .';
		if($defined($$(this.selector)[0]))
			this.makeAccordion();
	}
	
});

window.addEvent('domready', function(){
	if($('redline')) do_redline();

	slidestart=Cookie.read('slidestart');
 	if ($chk(slidestart)){
	
	}else{
		slidestart=0;
	}

	new rAccordion('accordion', 'toggler', 'element', {
		alwaysHide: true,
		display:slidestart,
		onActive: function(toggle){
			toggle.addClass('active');
			toggle.setStyle('background','#CC0000 url(../styles/images/rechts.gif) no-repeat scroll 3px 1px');
		},
		onBackground: function(toggle){
			toggle.removeClass('active');
			toggle.setStyle('background','#CC0000 url(../styles/images/runter.gif) no-repeat scroll 3px 1px');

		}
	});
	Cookie.write('slidestart', '0');


});

function do_redline(){
	$('redline').addEvents({
	'mouseenter': function(){
		$('redlinex').set('tween', {
			duration: 1000,
			transition: Fx.Transitions.Bounce.easeOut 
		}).tween('margin-bottom', '0px');
	},
	'mouseleave': function(){
		$('redlinex').set('tween', {
			duration: 3000,
			transition: Fx.Transitions.Bounce.easeOut 
		}).tween('margin-bottom', '-27px');
	}
	});


}
function go_m(m){
for (var i = 1; i <= 9; i++){
		if ($('m'+i))
			$('m'+i).setStyle('border-bottom','0px solid #cc0000');
		}
		
		if ($('m8'))
		$('m'+m).setStyle('border-bottom','2px solid #cc0000');
}

function projekte(a,b){
	Cookie.write('projekt', a);
	Cookie.write('unter', b);
	window.location.href= "projekte.php";
}

