
function aq_menu_init()
{
	//$$('ul.nav li.level0 ul.level0').each(Element.hide);
	$$('ul.nav li.level0 span > a').each(function (e){
		if (e.parentNode.parentNode.hasAttribute('onmouseover'))
		{
			e.setAttribute('href', '#');
			e.setAttribute('onclick', 'return false;');
		}
	});
	$$('ul.nav li.level0 span > a').each(function (element){
		$(element).observe('click', function(event){
			var htmlElement = Event.element(event).parentNode.parentNode;
			var ext = Element.extend(htmlElement);// li.level0

			if (ext.hasClassName('active'))
			{
				//ext.select('ul').each(Element.hide);
				new Effect.BlindUp(ext.select('ul').first(), {
					duration: 0.5,
					afterFinish:function() {
						ext.removeClassName('active');
					}
				});
			}
			else
			{
				ext.addClassName('active');
				new Effect.BlindDown(ext.select('ul').first(), {
					duration: 0.5
				});
			}
		return false;
	});
});
}

if (Prototype.Browser.IE) {
	Event.observe(window, 'load', function(){
		aq_menu_init();
	});
} else {
	document.observe("dom:loaded", function(){
		aq_menu_init();
	});
}

