var tempo = 0;
function menu__back(mm_max){
	if( currentSelected!='sub_menu_0' && mainSelected!='top_menu_0' ) {
		for(j=1;j<=mm_max;j++){
			sub_menu = 'sub_menu_'+j;
			main_menu= 'top_menu_'+j;
			window.document.getElementById(sub_menu).style.display="none";
			window.document.getElementById(main_menu).className="none";
		}
		window.document.getElementById(currentSelected).style.display="block";
		window.document.getElementById(mainSelected).className="selected";
	}
}

function menu_back(m_max) {
	i_max = m_max;
	tempo = window.setTimeout("menu__back(i_max)",4000);
}


function menu_show(id,m_max,curr) {
	if (tempo != "undefined"){
		window.clearTimeout(tempo);
	}
	if (window.document.getElementById) {
		for(i=1;i<=m_max;i++){
			window.document.getElementById('sub_menu_'+i).style.display="none";
		}
		window.document.getElementById(id).style.display="block";
	} else if (window.document.all) {
		window.document.all[id].style.display="block";
	} else if (window.document.layers) {
		window.document.layers[id].display="block";
	}
}

function chg_main(curr,main_curr,chg_max){
	for(i=1;i<=chg_max;i++){
		document.getElementById('top_menu_'+i).className="none";
	}
	window.document.getElementById(main_curr).className="selected";
}

function chg_sub(curr){
	if (curr.style.background.slice(0,4) == 'rgb('){
		curr.style.background='none';
	}else{
		curr.style.background='#c9cae6';
	}
}