/*
 * treeMenu 1.0 (2007-04-02)
 *
 * Tomasz Bielecki
 * Vobacom Technologies
 * for CMS 1.2 tree menu
 *
 * plugin for jQuery 1.1.1 (http://jquery.com)
 */

// Settings
var CSSR 	= 'tree_menu_flag_root';
var CSSH	= 'tree_menu_hover';

// Public methods
$.fn.treeMenu = function() {
	return this.each(function() {
		$(this).addClass(CSSR);
		addEvents(this);
	});
};

// Private methods
function addEvents(ul) {
	$('li', ul).hover(hoverOver,hoverOut);
};

function removeEvents(ul) {
	$('li', ul).unbind('mouseover');
};

function hoverOver() {
	$(this).addClass(CSSH).find('> a').addClass(CSSH);
};

function hoverOut() {
	$(this).removeClass(CSSH).find('> a').removeClass(CSSH);
};
