/******
* Control de menus mediante capas
*
* @project		Portal Dirección General de Formación Profesional y Educación de Adultos
* @author  		Teide Soft, s.l. - Pedro Manuel Pérez Méndez
* @date			15.03.2006
* @version		0.01
* 
* tab: 
*/


var tempor = new Array(null,null,null,null);
var contador = new Array(0,0,0,0);
var nameCampo = new Array('carrusel0','carrusel1','carrusel2','carrusel3');
var nameTexto = new Array('texto0', 'texto1','texto2','texto3');
var tiempos = new Array(8000,8000,8000, 8000);

function cambio(nElemento){
	contador[nElemento]+= 1;
	var lista = eval('listaP' + nElemento);
	var textos = eval('textoP' + nElemento);
	var enlace='';
	
	if (contador[nElemento] >=lista.length)
		contador[nElemento] = 0;
	document.getElementById(nameCampo[nElemento]).src = lista[contador[nElemento]];
	
	
	if (textos[(contador[nElemento]*2)+1]!= null)
	{
		document.getElementById("RefCarrusel" + [nElemento]).href = textos[(contador[nElemento]*2)+1];
		document.getElementById("RefCarrusel" + [nElemento]).title = textos[(contador[nElemento]*2)] + " (Ventana Nueva)";
	}
	else
	{
		document.getElementById("RefCarrusel" + [nElemento]).href = '#';
	}
	
	
	
	if (nameTexto[nElemento] != '') {

		//enlace = textos[(contador[nElemento]*2)+1];

		if (textos[contador[nElemento]*2] != null){
		document.getElementById(nameTexto[nElemento]+'1').innerHTML =  textos[contador[nElemento] * 2];
		}
	}
	//document.getElementById(nameLink[nElemento]).href = 'plnFoto.asp?img=' + lista[contador[nElemento]];
	tempor[nElemento] = setTimeout("cambio(" + nElemento + ")",tiempos[nElemento]);
}

function executeOnLoad(){
	if(typeof(listaP0)!="undefined"){
		cambio(0);
	}
	if(typeof(listaP1)!="undefined"){
		cambio(1);
	}
	if(typeof(listaP2)!="undefined"){
		cambio(2);
	}
	if(typeof(listaP3)!="undefined"){
		cambio(3);
	}
}
function parar(nElemento){
	clearTimeout(tempor[nElemento]);
}

/* Carrusel de fotos */



