jQuery.fn.tree = function (){
	/*options*/
	/*в перспективе*/
	return this.each(function() {
		var tree = $(this);
		/*немного стилей*/
		$(tree).css({listStyleType: 'none'});
		$("ul", tree).css({listStyleType: 'none'});
		/*всегда развернутая ветка*/
		$(".fixed").parents().filter("li").addClass("fixed");
		$("li:not(.fixed) > span", tree)
		.css({cursor: 'pointer'})
		.click(function(){
			/*сбросим текущую ветку*/
			$("li.extended", tree).removeClass("extended");
			$("~ul", this).slideToggle();
			/*пометим текущую ветку*/
			$(this).parents("li").filter("li").addClass("extended");
			/*свернем остальное*/
			$("li:not(.extended):not(.fixed) ul", tree).slideUp();			
		})
		/*Сворачиваем меню по умолчанию*/
		.find("~ul")
		.hide();			
	});	
}
