jQuery.fn.quickMenuTree = function() {
    return this.each(function(){
	
		    //set variables
        var $tree = $(this);
        var $roots = $tree.find('li');
        
		    //set last list-item as variable (to allow different background graphic to be applied)

		
		    //add class to allow styling
        $tree.addClass('menu_tree');
		
		    //hide all lists inside of main list by default
        $tree.find('ul.level2').hide();
        $tree.find('ul.selected').show();
		
		    //iterate through all list items
        $roots.each(function(){
            if ($(this).children('ul').length > 0) {
				        //add expand/contract control
                $(this).addClass('root');//.prepend('<span class="expand">');
              //  $(this).addClass('root').prepend('<span class="expand" />');  //jesli ma byc ikonka z +
               // $(this).append('</span>');
            }
        }); //end .each

		    //handle clicking on expand/contract control
        $('.expand').toggle(
			       //if it's clicked once, find all child lists and expand
            function(){
                $(this).toggleClass('contract').nextAll('ul.level2').slideDown();
            },
			       //if it's clicked again, find all child lists and contract
            function(){
                $(this).toggleClass('contract').nextAll('ul.level2').slideUp();
            }
        );
    });
};
