(function ()
{
	var menus = [];
	window.uvaga_menu = function (anker, anker2, area, active_class, passive_class, evt)
	{
		var is_display = false;
		var self = this;
		evt = evt || 'mouseover';

		this.toggle = function (flag)
		{
			if (typeof(flag)=='undefined') flag = !is_display;
			anker2.className = flag ? active_class : passive_class;
			area.style.display = flag ? '' : 'none';
			is_display = flag;
		}

		var _toggle = this.toggle;

		this._out = function () {};

		(function (ev)
		{
			if (is_display) return false;
			ev.stopPropagation();ev.preventDefault();

			for (var i = 0; i < menus.length; i++)
				if (menus[i] != self) menus[i].toggle(0);

			self.toggle(1);
		}).attach(evt, anker);

		(function (ev)
		{
			if (is_display) self.toggle(0);
		}).attach('click', document);

		var time;
		(function ()
		{
			if (time) clearTimeout(time);
		}).attach('mouseover', area).attach('mouseover', anker);

		(function ()
		{
			if (time) clearTimeout(time);
			time = setTimeout(self._out, 500);
		}).attach('mouseout', area).attach('mouseout', anker);

		menus.push(this);
	}
})()

function check(what)
{
	var item;
	for (i = 0; i < 20; i++)
	{    	item = document.getElementById('search' + i);
    	if (item)
    	{
     		if (what == i)
     		{
     			item.className = 'active';
     			document.getElementById('part').value = what;
     		}
     		else
     		{       			item.className = '';
     		}
     	}
	}

}

