/* ********************* 
Developed by Jungle Dev. :) 
http://jungle.in.ua/ 
********************* */

$(document).ready( function() {

	$('.mn').find("a").each( function( i ){ 
		var node = $(this);
		var parent = node.parent();

		if ( node.text().match(/^\+/) ){
			node.text( node.text().split("+ ")[1] );
			parent.append( '<ul class="mnSub"></ul>')
			parent.find("ul").hide();
			node.toggle(
				function(){ 
					$(this).addClass("opened");
					$(this).parent().find("ul").slideDown( "fast" );

				},
				function(){ 
					$(this).removeClass("opened");
					$(this).parent().find("ul").slideUp( "fast" ) 
				}
			);
		};
		if ( node.text().match(/^\*/) ) {
			node.text( node.text().split("* ")[1] );
			parent.prev().find("ul").append(parent);
			if ( node.hasClass("here") ){
				parent.parent().prev().click();
				 
			};
		}
	} );

	$("h2").each( function() {
		var node = $(this);
		if ( node.text().match(/^\+/) ){
			node.text( node.text().split("+ ")[1] );
		}
		if ( node.text().match(/^\*/) ) {
			node.text( node.text().split("* ")[1] );
		}
	});
});                         
