// JavaScript Document
var capa,capad,capat,capac,delayx
delayx=400;
function visible(idCapa,idCapad,idCapat,idCapac){
//alert(cuantas);
 //Para la capa 1
 if (document.layers) capa = eval("document." + idCapa);
 if (document.all) capa = eval(idCapa + ".style");
 if (document.getElementById) capa = eval('document.getElementById("' + idCapa + '").style');
 //Para la capa 2
 if (document.layers) capad = eval("document." + idCapad);
 if (document.all) capad = eval(idCapad + ".style");
 if (document.getElementById) capad = eval('document.getElementById("' + idCapad + '").style');
 //Para la capa 3
 if (document.layers) capat = eval("document." + idCapat);
 if (document.all) capat = eval(idCapat + ".style");
 if (document.getElementById) capat = eval('document.getElementById("' + idCapat + '").style');
 //Para la capa 4
 if (document.layers) capac = eval("document." + idCapac);
 if (document.all) capac = eval(idCapac + ".style");
 if (document.getElementById) capac = eval('document.getElementById("' + idCapac + '").style');

 //Decidiendo las visibilidades
 
 if ((capa.visibility == "hidden") || (capa.visibility == "hide"))
 {
  capa.visibility = (document.layers) ? "show" : "visible" ;
  capad.visibility = (document.layers) ? "hide" : "hidden" ;
  capat.visibility = (document.layers) ? "hide" : "hidden" ;
  capac.visibility = (document.layers) ? "hide" : "hidden" ;

 }
}
 
var tiempo 
function cambio(band,idCapa,idCapad,idCapat,idCapac,idCapaci)
{
	/*alert (band);
	alert (idCapa);
	alert (idCapad);
	alert (idCapat);
	alert (idCapac);
	alert (idCapaci);*/
	if(band)
	  {
		  tiempo = window.setTimeout("visible('" + idCapa + "','" + idCapad + "','" + idCapat + "','" + idCapac + "')", delayx);
	  }
	else
	  {
		if(tiempo)
		{
		  clearTimeout(tiempo);
		  tiempo=null;
		}
	  }
}


function getElement(e,f)
{
	if(document.layers)
	{
		f=(f)?f:self;
		if(f.document.layers[e]) 
		{
			return f.document.layers[e];
		}
		for(W=0;i<f.document.layers.length;W++) 
		{
			return(getElement(e,fdocument.layers[W]));
       	}
   	}
	if(document.all) 
	{
		return document.all[e];
	}
	return document.getElementById(e);
}

function habilitar(opcion) {
	if (opcion == '1'){ // click en cualquiera que no sea catalogos u organigrama
		document.getElementById('tb1').style.display='block';
		document.getElementById('tb2').style.display='none';
		document.getElementById('tb3').style.display='none';
	}
	if (opcion == '2'){ // click en catalogos
		document.getElementById('tb1').style.display='none';
		document.getElementById('tb2').style.display='block';
		document.getElementById('tb3').style.display='none';
	}
	if (opcion == '3'){ // click en organigrama
		document.getElementById('tb1').style.display='none';
		document.getElementById('tb2').style.display='none';
		document.getElementById('tb3').style.display='block';
	}
}


function diapositivas(es) {
	
	var x=0;
	var sum=0;
	var valor=0;
	var LIMITE = 27;
	
	
	if(es!='startd' && es!='endd')
		valor =  parseInt(document.getElementById(es).value);


    if(es=='nextd' && valor > LIMITE ) return;
	else if(es=='backd' && valor < 1 ) return;
	
	if(es=='startd') valor = 1;
	else if(es=='endd') valor = 27;			
	
	
	document.getElementById('backd').value = valor-1;
	document.getElementById('nextd').value = valor+1;
	
	
	for(x=1;x<=LIMITE;x++){	
		document.getElementById('img'+x).style.display='none';			
	}	
	
	document.getElementById('img'+valor).style.display='block';
	
	
}