function rollOver(imgId,imgSrc)
{
	imgSrc.background=imgId;
}

function showHide(capa,estado)
{
	eval ("document.getElementById('submenu"+capa+"').style.visibility = '"+estado+"'");
	if (estado="visible") eval ("flecha"+capa+".src='/salaprensa/es/docs/img/menu_flecha_on.gif'");
	else eval ("flecha"+capa+".src='/salaprensa/es/docs/img/menu_flecha.gif'");
}

//var numMenus=4;

// Cuándo el menú principal tiene imagen de fondo
/*
function hideAll()
{
	for (i=1;i<=numMenus;i++)
	{
		eval ("document.getElementById('subMenu0"+i+"').style.visibility = 'hidden'");
		eval ("tdmenu"+i+".background=''");
		eval ("flecha0"+i+".src='/salaprensa/es/docs/img/menu_flecha.gif'");
	}
	if (activo !=0)
	{
		eval ("tdmenu"+activo+".background='/salaprensa/es/docs/img/menu_bg_on.gif'");
	}
}
*/


// Cuándo el menú principal tiene colores con estilos
function hideAll()
{
	for (i=1;i<=numMenus;i++)
	{
		eval ("document.getElementById('subMenu0"+i+"').style.visibility = 'hidden'");
		eval ("document.getElementById('tdmenu"+i+"').style.backgroundColor='"+colorMenuOff+"'");
		eval ("document.getElementById('tdmenu"+i+"').style.color='"+txtMenuOff+"'");
		eval ("flecha0"+i+".src='/salaprensa/es/docs/img/menu_flecha.gif'");
	}
	if (activo !=0)
	{
		eval ("document.getElementById('tdmenu"+activo+"').style.backgroundColor='"+colorMenuOn+"'");
		eval ("document.getElementById('tdmenu"+activo+"').style.color='"+txtMenuOn+"'");
	}
}


var timerID = null;
var rollID = null;
var timerOn = false;
var timecount = 500;	

function startTime() 
{
	if (timerOn == false) 
	{
       	timerID = setTimeout( "hideAll()" , timecount);
		timerOn = true;
	}
}

function stopTime() 
{
	if (timerOn) 
	{
		clearTimeout(timerID);
       	timerID = null;
		rollID = null;
    	timerOn = false;
    }
}	

// Cuándo el menú principal tiene imagen de fondo
function subMenu(imgId,imgSrc,capa,estado)
{
	if(imgId!="") rollOver(imgId,imgSrc);
	showHide(capa,estado);
}

// Cuándo el menú principal no tiene imagen de fondo, son estilos
function rollOverMenu(capaM,colorM,textoM,capaSM,estadoSM)
{
	eval ("document.getElementById('"+capaM+"').style.backgroundColor = '"+colorM+"'");
	eval ("document.getElementById('"+capaM+"').style.color = '"+textoM+"'");
	showHide(capaSM,estadoSM);
}

function rollOverSM(capa,color,texto)
{
	eval ("document.getElementById('"+capa+"').style.backgroundColor = '"+color+"'");
	eval ("document.getElementById('"+capa+"').style.color = '"+texto+"'");
}

var activo = 0;
function activar(num)
{
	activo = num;
}

function colocarSubMenus(num)
{
	var posicion = ((document.body.clientWidth-769)/2)+23;
	document.getElementById("subMenu01").style.left = posicion;
	for (i=1;i<num;i++)
	{
		sm = i+1;
		eval("anchura = document.getElementById('tdmenu"+i+"').clientWidth + 2");
		posicion = posicion + anchura;
		document.getElementById("subMenu0"+sm+"").style.left = posicion;
	}
}

function irURL(nombre){

	if(nombre.substring(0,1)=='$')
		document.location.href = "javascript:void(window.open('" + nombre.substring(1,nombre.length) + "'))";
	else
		document.location.href = nombre;

}
