var lastEl;
var hide = null;

document.observe('dom:loaded', function(){
	$$('.a_menu').each(function(element){
		element.onmouseover = function(){
			if (hide != null){
				hide.stop();
			}
			if (lastEl){
				$(lastEl).hide();
			}
			lastEl = element.rel;
			$(element.rel).show();
			return false;
		}
		element.onmouseout = function(){
			hide = new PeriodicalExecuter(hideMenu, 0.5);
			lastEl = element.rel;
			return false;
		}
	});
	$$('.submenu').each(function(element){
		element.onmouseover = function(){
			hide.stop();
		}
		element.onmouseout = function(){
			hide = new PeriodicalExecuter(hideMenu, 0.5);
		}
	});
	$$('.p_link').each(function(element){
		element.onmouseover = function(){
			new Effect.Opacity(element.down('.p_grey'),{
				to: 0.0,
				duration: 0.15
			});
		}
		element.onmouseout = function(){
			new Effect.Opacity(element.down('.p_grey'),{
				to: 1.0,
				duration: 0.15
			});
		}
	});
	
});

function hideMenu(){
	$(lastEl).hide();
}

function showPlace(obj) {
	var item = $(obj);
	item.style.display = ((item.style.display=="block")?"none":"block");
}

function selectPlace(name,value){
	$(name).value = value;
	$(name+'_sel_value').innerHTML = value;
}

function questionSet(itemobj) {
	itemobj.parentNode.className = ((itemobj.parentNode.className=="")?"active":"");
}
