var $jslide = jQuery.noConflict();

$jslide(document).ready(function() {
	
	// hide and add open-link to all .toggle-elements
	var is_visible = false;
	$jslide('.toggle').prev().append(' <a href="#" class="toggleLink">mehr</a>');
	$jslide('.toggle').hide();
	$jslide('a.toggleLink').click(function() {
		is_visible = !is_visible;
		$jslide(this).html( (!is_visible) ? "mehr" : "schliessen");
		
		// toggle the display - uncomment the next line for a basic "accordion" style
		//$('.toggle').hide();$('a.toggleLink').html(showText);
		$jslide(this).parent().next('.toggle').toggle('slow');
		
		// return false so any link destination is not followed
		return false;
	});
	
	// toggle target ("#xx-target") by link ("#xx")
	$jslide('.toggle_link').wrapInner('<a href="#" class="toggleControlLink"/>')
	$jslide('.toggle_target').hide();
	$jslide('a.toggleControlLink').click(function() {
		var id = "#" + $jslide(this).parent().attr('id') + "-target";
		$jslide(id).toggle('slow');
		// return false so any link destination is not followed
		return false;
	});
	
	
	// fold menu
	$jslide('ul#menu-hauptmenu li ul li').hide(); // hide all subpages
	$jslide('ul#menu-hauptmenu li.current_page_item ul li').show(); // show subpages of current page
	$jslide('ul#menu-hauptmenu li.current_page_parent ul li').show(); // show other pages of current sub-level
	
	 
});
