
Init = function (){
	var submenus = $('mainmenu').select('ul.submenu');
	var submenus2 = $('mainmenu').select('ul.search');
	var arr = submenus.concat(submenus2);
	if (arr) {
		for (var i=0; i<arr.length; i++) {
			var re = new RegExp("^submenu_(\\d+)");
			if (arr[i].id.match(re))
				new DropDownMenu(arr[i].id.substr(8));
		}
	}
}

window.onload = Init;

var DropDownMenu = Class.create();

DropDownMenu.prototype = {
	initialize: function(id) {
		this.element = $('submenu_'+id);
		this.caller = $('menu_'+id);
		/*
		this.divHider = $('divHider');
		this.divHider.style.display = 'none';
		this.frameHider = $('frameHider');
		*/
		this.caller.fx1 = this.onMouseOverMenu.bindAsEventListener(this, this.caller);
		this.caller.fx2 = this.onMouseOutMenu.bindAsEventListener(this, this.caller);
		Event.observe(this.caller, 'mouseover', this.caller.fx1);
		Event.observe(this.caller, 'mouseout', this.caller.fx2);
		Event.observe(this.element, 'mouseover', this.caller.fx1);
		Event.observe(this.element, 'mouseout', this.caller.fx2);

	},

	onMouseOverMenu: function(event, a) {
		a.addClassName('visited');
	},

	onMouseOutMenu: function(event, a) {
		a.removeClassName('visited');
	}

}
