// JavaScript Document

var mapa=false;

window.onload=prepararMenusInicio;

function ocultar(id){
    id.style.display="none";
}

function BE(id){
	return document.getElementById(id);
	}

var entra=true;
function prepararMenusInicio()
{
    if(entra!=true) return;
    
    entra=false;
	if (!document.getElementsByTagName || !document.getElementById) return;
	

	var menu = BE("menu");
	
	if(menu==null){
	    setTimeout(prepararMenusInicio,3000);
	    return;
	}

	
	var enlaces= menu.getElementsByTagName("a");
	
	for(var i=0; i<enlaces.length; i++){
		
	 	enlaces[i].onmouseover = mostrarSubmenu; 
	 	//enlace.onmouseout = enlace.onblur = opcionOut;
	 	enlaces[i].onclick = mostrarSubmenu;
		
	}
	
	//Cargamos si tiene reproductor por voz
	var voz = BE("reproductor");
	if(voz!=null){
		voz.onclick =ReproducirVoz;
		}
	
	if(mapa==true)
	    loadM();
	
}

function ReproducirVoz(){
	get_id('ctl00_ContentPlaceHolder1_voz','es','fm');
	}

function mostrarSubmenu(){
	
	if (!document.getElementsByTagName || !document.getElementById) return;
	
	var menu = BE("submenu");
	var submenus= menu.getElementsByTagName("div");
	
	for(var i=0; i<submenus.length; i++){
	 	submenus[i].className = "oculto";
	}
	var aux=this.getAttribute("names");

	var aux=BE(aux);

	if(aux!=null){
		aux.className='';
		return false;
	}
	else return true;
}

setTimeout(prepararMenusInicio,3000);