function over(img,ruta) {
  img.src=ruta;
}
function out(img,ruta) {
  img.src=ruta;
}

var ocultar="";
var ocultar2="";
function abre(iden) {
    var este = document.getElementById(iden);
    if (este.style.display == 'block')
      este.style.display = 'none';
    else
      este.style.display = 'block';
    if (ocultar!= "" && este!=ocultar) {
      ocultar.style.display = 'none';
    }
    ocultar=document.getElementById(iden);
	parent.centro.height = null;
	parent.centro.height = tabla.offsetHeight+70;
}

function abreSub(iden) {
    var este = document.getElementById(iden);
    if (este.style.display == 'block')
      este.style.display = 'none';
    else
      este.style.display = 'block';
    if (ocultar2!= "" && este!=ocultar2) {
      ocultar2.style.display = 'none';
    }
    ocultar2=document.getElementById(iden);
	parent.centro.height = null;
	parent.centro.height = tabla.offsetHeight+70;	
}


//VARIABLE Q ALMACENA EL INDICE DEL ARRAY Q CONTIENE LA ULTIMA FOTO CARGADA
var actual=0;
var ancho;
var alto;

// FUNCION Q CARGA LA ULTIMA IMAGEN DEL ARRAY
function ultima() {
  // DESHABILITAMOS LOS BOTONES PARA PASAR A LA SIGUIENTE Y EL BOTON DE ULTIMA
  // ESTABLECER EL VALOR DEL CAMPO Q INDICA EL NUM D IMAGEN ACTUAL
  // ESTABLECER EL VALOR DE LOS BOTONES SIGUIENTE Y ANTERIOR
  actual=Fotos.length-1;
  etiq=actual+2;
  document.Foto.src=Fotos[actual];
  document.formulario.numero.value=actual+1;
  document.formulario.anterior.value = actual+" <<";
  document.formulario.siguiente.value = ">> "+etiq;
  document.formulario.siguiente.disabled = true;
  document.formulario.Ultima.disabled = true;

  // SI ANTERIORMENTE LLEGAMOS A LA PRIMERA FOTO, HABILITADOS DE NUEVO 
  // LOS BOTONES DE ANTERIOR Y PRIMERA
  if (actual > 0) {
    document.formulario.anterior.disabled = false;
    document.formulario.Primera.disabled = false;
  }
}

var foto=null;
function abrir_grande() {
	//ventana=nombre.substring(0, strlen-4);
	win = window.open('',actual,'toolbar=no,location=no,directories=no,status=nos,menubar=no,scrollbars=no,resizable=no,height=1,width=1,top=50,left=10');
	win.document.writeln ('<html>');
	win.document.writeln ('<head><title>Pensión Reina Isabel</title></head>');
	win.document.writeln ('<script>');
	win.document.writeln ('if (document.layers) {n=1;ie=0;}');
	win.document.writeln ('if (document.all) {n=0;ie=1;}');
	win.document.writeln ('function redimensiona()');
	win.document.writeln ('{');
	win.document.writeln ('ancho=document.imagen.width;');
	win.document.writeln ('alto=document.imagen.height;');
	win.document.writeln ('if (n)');
	win.document.writeln ('	{');
	win.document.writeln ('window.resizeTo(ancho+2,alto+2);');
	win.document.writeln ('	}');
	win.document.writeln ('else');
	win.document.writeln ('	{');
	win.document.writeln ('window.resizeTo(ancho+10,alto+29);');
	win.document.writeln ('	}');
	win.document.writeln ('}');
	win.document.writeln ('</script>');
	win.document.writeln ('<body ONCLICK="javascript:window.close()" topmargin="0" leftmargin="0" marginwidth="no" marginheight="no">');
	win.document.writeln ('<table style="background-repeat: no-repeat; background-position: center center;" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">');
  	win.document.writeln ('<tr>');
	win.document.writeln ('<td align="center" valign="middle"><img ONLOAD="redimensiona();" name=imagen src="'+ Fotos[actual] +'"></td>');
	win.document.writeln ('</tr>');
	win.document.writeln ('</table>');
	win.document.writeln ('</body>');
	win.document.writeln ('</html>');
	win.document.writeln ('<script>redimensiona();</script>');
}

function abrir_grande2(foto,ventana) {
	//ventana=nombre.substring(0, strlen-4);
	win = window.open('',ventana,'toolbar=no,location=no,directories=no,status=nos,menubar=no,scrollbars=no,resizable=no,height=1,width=1,top=50,left=10');
	win.document.writeln ('<html>');
	win.document.writeln ('<head><title>Pensión Reina Isabel</title></head>');
	win.document.writeln ('<script>');
	win.document.writeln ('if (document.layers) {n=1;ie=0;}');
	win.document.writeln ('if (document.all) {n=0;ie=1;}');
	win.document.writeln ('function redimensiona()');
	win.document.writeln ('{');
	win.document.writeln ('ancho=document.imagen.width;');
	win.document.writeln ('alto=document.imagen.height;');
	win.document.writeln ('if (n)');
	win.document.writeln ('	{');
	win.document.writeln ('window.resizeTo(ancho+2,alto+2);');
	win.document.writeln ('	}');
	win.document.writeln ('else');
	win.document.writeln ('	{');
	win.document.writeln ('window.resizeTo(ancho+10,alto+29);');
	win.document.writeln ('	}');
	win.document.writeln ('}');
	win.document.writeln ('</script>');
	win.document.writeln ('<body ONCLICK="javascript:window.close()" topmargin="0" leftmargin="0" marginwidth="no" marginheight="no">');
	win.document.writeln ('<table style="background-repeat: no-repeat; background-position: center center;" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">');
  	win.document.writeln ('<tr>');
	win.document.writeln ('<td align="center" valign="middle"><img ONLOAD="redimensiona();" name=imagen src="'+ foto +'"></td>');
	win.document.writeln ('</tr>');
	win.document.writeln ('</table>');
	win.document.writeln ('</body>');
	win.document.writeln ('</html>');
	win.document.writeln ('<script>redimensiona();</script>');
}
function hoy_tipo1(){
	fecha = new Date();
	mes = fecha.getMonth();
	diaMes = fecha.getDate();
	anio = fecha.getFullYear();
	dia = fecha.getDay();
	dias = new Array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado');
	meses = new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
    document.write (diaMes + " de " + meses[mes] + " de " + anio);
}

function validar(campo)
  {
    formulario=eval("document.forms[0].elements[campo]");  //llamando solicitud al formulario con el parámetro name

    if (formulario.value == "" || formulario.value == "nada")
      {
	alert ("Existen campos vacíos, asegurese de darles un valor");
	return false;
      }
    else
      {
        return true;
     }
  }


