// JavaScript Document

function mostrarOcultar(nombreCapa, tipo){
	var ci=new Array("dg","dcj","dcp","dcdc","dct","dca");
	var ce=new Array("oc1","bjz1","sol1","coz1","cmy1");

	//Ocultando capas internas
	for(i=0; i<6; i++){
		if( nombreCapa != ci[i] ){
			document.getElementById(ci[i]).style.visibility="hidden";
			document.getElementById(ci[i]).style.position="absolute";
		}
	}

	for(i=0; i<5; i++){
		if( nombreCapa != ce[i] ){
			document.getElementById(ce[i]).style.visibility="hidden";
			document.getElementById(ce[i]).style.position="absolute";
		//Volviendo a mostrar la capa padre
		}
		if( tipo == '2' ){
			document.getElementById('oc1').style.visibility="visible";
			document.getElementById('oc1').style.position="";		
		}
	}

	if( document.getElementById(nombreCapa).style.visibility == "visible" ){
		document.getElementById(nombreCapa).style.visibility="hidden";
		document.getElementById(nombreCapa).style.position="absolute";
	}
	else{
		document.getElementById(nombreCapa).style.visibility="visible";
		document.getElementById(nombreCapa).style.position="";
	}
}

function relojNormal(){
	var horarioActual = new Date();
	var horas=horarioActual.getHours();
	var minutos=horarioActual.getMinutes();
	var segundos=horarioActual.getSeconds();
	
	horas = (horas<=9)?("0"+horas):horas;
	minutos = (minutos<=9)?("0"+minutos):minutos;
	segundos = (segundos<=9)? ("0"+segundos):segundos;
	
	cadenaReloj = horas+":"+minutos+":"+segundos;
	
	document.getElementById('reloj').value = cadenaReloj;
	
	setTimeout("relojNormal()",1000);
}

//Cambiar los arrays para añadir o quitar imagenes y enlaces al rotativo
var carrusel = new Array(3);
	carrusel[0]="img/rotativo1.png";
	carrusel[1]="img/rotativo2.png";
	carrusel[2]="img/rotativo3.png";

var lnksCarrusel = new Array(3);
	lnksCarrusel[0]="#";
	lnksCarrusel[1]="#";
	lnksCarrusel[2]="#";
	
var opcCarrusel=0;

function carruselImagenes(){
	
	document.getElementById('imgcarr').src=carrusel[opcCarrusel];
	document.getElementById('lnkcarr').href=lnksCarrusel[opcCarrusel];
	if( opcCarrusel < carrusel.length-1 ){
		opcCarrusel = opcCarrusel + 1;
	}
	else{
		opcCarrusel=0;
	}
	setTimeout("carruselImagenes()",5000);
}

//Cambiar los arrays para añadir o quitar imagenes y enlaces al banner rotativo
var rotbanner = new Array(5);
	rotbanner[0]="img/banner_1.jpg";
	rotbanner[1]="img/banner_2.jpg";
	rotbanner[2]="img/banner_3.jpg";
	rotbanner[3]="img/banner_4.jpg";
	rotbanner[4]="img/banner_5.jpg";

var lnksRotbanner = new Array(5);
	lnksRotbanner[0]="#";
	lnksRotbanner[1]="#";
	lnksRotbanner[2]="#";
	lnksRotbanner[3]="#";
	lnksRotbanner[4]="#";		
	
var opcRotbanner=0;

function rotBannerImagenes(){
	
	document.getElementById('imgbanner').src=rotbanner[opcRotbanner];
	document.getElementById('lnkbanner').href=lnksRotbanner[opcRotbanner];
	if( opcRotbanner < rotbanner.length-1 ){
		opcRotbanner = opcRotbanner + 1;
	}
	else{
		opcRotBanner=0;
	}
	setTimeout("rotBannerImagenes()",5000);
}

