jQuery.noConflict();

jQuery(document).ready(function(){

	
	jQuery('.ajax_menu').each(function(){
		var context=jQuery(this);
		jQuery('.BUHeader', context).each(function(){
			jQuery(this).click(function() {
				jQuery(this).next().show()
				openAccordeon(jQuery(this), context);
			});
			
			
			var h = jQuery(this).next().height();
			if (h > 2) {
				//current am anfang festsetzen
				current = jQuery(this);
			} else {
				//alle anderen verstecken
				jQuery(this).next().hide();
			}
		})
		
		
		jQuery('a[href=#]').attr("href", "javascript:void(0)");		
	})
	
	
	
});

current = null;

function openAccordeon(active, accordeon) {
		
	if (current) {
		//abbrechen wenn schon aktive
		if (active.attr('id') == current.attr('id')) return;
		current.next().animate({height:1},
	                           'slow',
	                            function(){jQuery(this).hide()});
	}
    jQuery(active.next()).animate({ height: active.attr('ajax:height')}, 'slow');
    current=active;
}



