<!--
//POPUP DE PAGINA HTML
function popupHtml(mypage, myname, w, h) {
	var props = '';
	var orig_w = w;
	var scroll = '0';
	var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
	if (winl < 0) { winl = 0; w = screen.availWidth -6; scroll = 1;}
	if (wint < 0) { wint = 0; h = screen.availHeight - 32; scroll = 1;}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, 'myThumb', winprops)
	return false;
}
//POPUP DE IMAGEN
function popupImg(mypage, myname, w, h,fit_to_screen, imgtoolbar) {
	var props = '';
	var orig_w = w;
	var scroll = '';
	var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
	if (winl < 0) { winl = 0; w = screen.availWidth -6; scroll = 1;}
	if (wint < 0) { wint = 0; h = screen.availHeight - 32; scroll = 1;}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open('', 'myThumb', winprops)
	win.document.open();
	win.document.write('<html><head>');
	if (imgtoolbar==0) { win.document.write('<meta http-equiv="imagetoolbar" content="false" />'); }
	//win.document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
  	//win.document.write("function click() { window.close(); } ");  // bei click  schliessen
  	//win.document.write("document.onmousedown=click ");
  	//win.document.write('</scr' + 'ipt>');
	win.document.write('<title>'+myname+'</title></head>');
	win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="window.close()">');

if (fit_to_screen) {

var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth - 23;

}
else if(ie4) {
sbreite = document.body.clientWidth - 6;
}

	if (orig_w>sbreite) { rw = 'width='+sbreite;} else {rw = '';}
	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" '+rw+'\></body></html>');
} else {

	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" ></body></html>');
	}

	win.document.close();
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

return false;
}

function imprimirPagina() { if (window.print) window.print(); else alert("Lo siento, pero tu navegador no soporta la impresion desde la web. Utiliza los comandos del menu de tu navegador."); } 

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección de e-mail válida.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es necesario.\n'; }
  } if (errors) alert('Atención:\n'+errors);
  return (errors == '');
}

//SLIDE SHOW IMAGENES
//intervalo (en milisegundos)
var slidespeed=5000
//imagenes
var slideimages=new Array("images/cabecera2a.gif","images/cabecera2b.gif","images/cabecera2c.gif","images/cabecera2d.gif","images/cabecera2e.gif","images/cabecera2f.gif","images/cabecera2g.gif","images/cabecera2h.gif","images/cabecera2i.gif","images/cabecera2j.gif","images/cabecera2k.gif","images/cabecera2l.gif","images/cabecera2m.gif","images/cabecera2n.gif")
//abrir links
var newwindow=0

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}
//////////////////////////////////
function winopen(enlace,width,height,scrol) {
	window.open(enlace,'newWin','width='+width+',height='+height+',scrollbars='+scrol)
	return false
}
//////////////////////////////////
function ocultarLaterales () {
	if(document.getElementById('lateral_der')) {
		document.getElementById('lateral_der').style.display='none';		
	}
	if(document.getElementById('lateral_izq')) {
		document.getElementById('lateral_izq').style.display='none';	
	}
	if(document.getElementById('centro')) {
		document.getElementById('centro').style.width='100%';
		document.getElementById('centro').style.margin='0px';
	}
	if(document.getElementById('mostrar')) {
		document.getElementById('mostrar').style.display='inline';
	}
	if(document.getElementById('ocultar')) {
		document.getElementById('ocultar').style.display='none';
	}
	return false;
}
function mostrarLaterales () {
	if(document.getElementById('lateral_der')) {
		document.getElementById('lateral_der').style.display='inline';
	}
	if(document.getElementById('lateral_izq')) {
		document.getElementById('lateral_izq').style.display='inline';
	}
	if(document.getElementById('centro')) {
		document.getElementById('centro').style.width='61%';
		document.getElementById('centro').style.margin='0px 0px 0px 18%';
	}
	if(document.getElementById('ocultar')) {
		document.getElementById('ocultar').style.display='inline';
	}
	if(document.getElementById('mostrar')) {
		document.getElementById('mostrar').style.display='none';
	}
	return false;	
}
function controlSubs (id) {
	var subs = document.all;
	if (subs) {
		for(i=0;i<subs.length;i++){
			if(subs[i].name == id) {			
				if  (subs[i].style.display == "")
					subs[i].style.display = "none";
				if (subs[i].style.display == "none") {
					subs[i].style.display = "inline";
				} else {
					subs[i].style.display = "none";
				}
			}
		}
	}
	return false;
}
function visual (page) {
	popupHtml(page, 'video', '400', '400');
	return false;
}
function visualC (page) {
	popupHtml(page, 'video', screen.width, screen.height);
	return false;
}

function CalculePascua (Agno, Calendario) {
   if (Calendario == "GREGORIANO") {
      a=Agno%19
      b=Math.floor(Agno/100)
      c=Agno%100
      d=Math.floor(b/4)
      e=b%4
      f=Math.floor((b+8)/25)
      g=Math.floor((b-f+1)/3)
      h=(19*a+b-d-g+15)%30
      i=Math.floor(c/4)
      k=c%4
      l=(32+2*e+2*i-h-k)%7
      m=Math.floor((a+11*h+22*l)/451)
      p=(h+l-7*m+114)
      // Devuelve un registro Registro.Dia_Res / Registro.Mes_Res
      return {Dia : (p%31)+1, Mes : Math.floor(p/31)}
   } else if (calendario == "JULIANO") {
      // Para años anteriores a 1583 (Calendário Juliano):
      a = Agno % 4
      b = Agno % 7
      b = Agno % 19
      d = (19*c + 15) % 30
      e = (2*a + 4*b - d + 34) % 7
      f = Math.floor((d + e + 114) / 31)
      g = (d + e + 114) % 31
      // Devuelve un registro Registro.Dia_Res / Registro.Mes_Res
      return {Dia : g+1, Mes : f}
   } else return {Dia : 0, Mes : 0}
} // CalculePascua

function EsBisiesto (Agno) {
// Los cálculos del año bisiesto cambiam a partir de la reforma Gregoriana del 1582
// 1. A partir Octubre 15 de 1582, i.e. a partir de 1583 (año > 1583): 
//    Un año es bisiesto si es divisible por 4, excepto aquellos divisibles por 100 pero no por 400.
// 2. Antes de Octubre 4 de 1582, i.e. antes de 1581 (año < 1583): 
//    Un año es bisiesto si es divisible por 4.
   if (Agno%4 == 0) {
      if (Agno > 1583)
         if (Agno%100 == 0 && Agno%400 != 0) { return false }
      return true
   } else { return false }
} // Es bisiesto
    
function numDiasMes(mes,Agno){
// Devuelve la cantidad de Dias del mes
// 0 si ha error
   if (mes<1 || mes>12 || Agno<=0) {  return 0 }

   if(mes==2) { 
   // Si un año es bisiesto, Febrero tendrá 29 días y no 28
      if (EsBisiesto (Agno)) return 29
      else return 28
   } 
   else if (mes==7) { return 31 }
   else { return 30 +((mes % 7) % 2) }
} // numDiasMes

function FechaRelativa (Dia, Mes, Agno, DiferenciaDias) {
// Devuelve un registro con dos enteros con una fecha relativa a la 
// Pascua (Resurrección), sumando (en forma positiva o negativa) 
// una cantidad de dias

   var ndiasmes=0

   if (DiferenciaDias == 0) return {Dia:Dia,Mes:Mes,Ano:Agno}
 
   if (DiferenciaDias > 0) {
      Dia++   
      // Avanza mes tras mes hasta llegar a la fecha relativa
      while (DiferenciaDias>0) {
         ndiasmes = numDiasMes(Mes,Agno)
         if (DiferenciaDias > ndiasmes - Dia + 1) {
            if (Mes < 12) { Mes++ }
            else { Mes=1; Agno++ }
            DiferenciaDias -= ndiasmes - Dia + 1;
            Dia = 1
         } else { 
            Dia += DiferenciaDias - 1
            DiferenciaDias = -1
         }
      } // end while
   } // Endif
   else { // DiferenciaDias > 0
      DiferenciaDias *= -1;
      while (DiferenciaDias>0) {
         if (DiferenciaDias >= Dia) {
            if (Mes > 1) {Mes--}
            else { Mes=12; Agno-- }
            // dias del mes anterior
            DiferenciaDias -= Dia;
            ndiasmes = numDiasMes(Mes,Agno)
            Dia = ndiasmes
         } else { 
            Dia -= DiferenciaDias
            DiferenciaDias = -1;
         }
      } // end while
   } // End else
   
   //formateamos el mes y el dia
   if(Dia.toString().length < 2) Dia = '0'+Dia.toString();
   if(Mes.toString().length < 2) Mes = '0'+Mes.toString();

   return {Dia : Dia, Mes : Mes, Ano : Agno}
} // FechaRelativa

function faltanDias(anioEstablecido){
	
var today=new Date()
var todayy=today.getFullYear()
var todaym=today.getMonth()
var todayd=today.getDate()

var pascua = CalculePascua((anioEstablecido == undefined)?todayy:anioEstablecido,"GREGORIANO");
var domingoRamos = FechaRelativa(pascua.Dia,pascua.Mes,(anioEstablecido == undefined)?todayy:anioEstablecido,-7);
	
var yr = domingoRamos.Ano; //formato yyyy
var m = domingoRamos.Mes; //formato mm
var d = domingoRamos.Dia; //formato dd
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

if(todayy < 2000){
var todayy = todayy + 1900;
}

var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)

if(difference < 0){
var difference= difference * (-1);
} else if(difference > 0){
faltanDias(todayy+1);
return;
}

if(difference == 0)
	document.write("Hoy es Domingo de Ramos!!!")
else
	document.write("Faltan " +difference+ " d&iacute;as para el Domingo de Ramos")
}

function contador(campo, limite_max) {
  if (campo.value.length > limite_max)
    campo.value = campo.value.substring(0, limite_max);
  else 
    document.getElementById("contador_"+campo.name).value = limite_max - campo.value.length;
}
-->
