<!--
// *******************************
// Apertura General de una ventana
// *******************************

function PopUp(url,pos,W,H,sc,st,to,ti) {

// posiciones pos C=centrada; F = Completa
// sc= 1/0 Scroll 
// st= 1/0 Status
// to= 1/0 ToolBar
// ti= Titulo ventana

if (pos == "T") {
var X = 0;
var Y = 0;
window.open(url,ti,'left=' + X + ', top=' + Y + ', ' + 'width=' + W + ', height=' + H + ', status=' + st + ', scrollbars=' + sc + ',toolbar=' + to + ' ,location=no,directories=no,menubar=no, noresize')
return true;
}

if (pos == "C") {
var X = (screen.width - W) / 2;
var Y = (screen.height - H) / 2;
window.open(url,ti,'left=' + X + ', top=' + Y + ', ' + 'width=' + W + ', height=' + H + ', status=' + st + ', scrollbars=' + sc + ',toolbar=' + to + ' ,location=no,directories=no,menubar=no, noresize')
return true;
}

if (pos == "F") {
var X = 0;
var Y = 0;
W = screen.availWidth;
H = screen.availheight;
window.open(url,ti,'left=' + X + ', top=' + Y + ', ' + 'width=' + W + ', height=' + H + ', status=' + st + ', scrollbars=' + sc + ',toolbar=' + to + ' ,location=no,directories=no,menubar=no, resizable=1')
}

}

// ajustar


function ajustar() {

var name = navigator.appName;

if (name == "Microsoft Internet Explorer") {
self.moveTo(0,0);
self.resizeTo(screen.availWidth, screen.availheight);
self.focus;
} else {
top.window.moveTo(0,0);
top.window.resizeTo(screen.availWidth,screen.availHeight);
top.window.focus;
}

}



// Apertura ventanas sites externos y Microsites --------------------------------------------------

function outurl(id) {
ok = confirm("Vas a entrar en un nuevo website.\nPara regresar a SCJ basta con que cierres la ventana")
url = id;
if (ok == true) {
PopUp(url,'F',10,10,1,1,1,'website')
} else {
return;
}
}

function docu(id) {
ok = confirm("Se abrira una nueva ventana con el documento")
url = id;
if (ok == true) {
PopUp(url,'F',10,10,1,1,1,'website')
} else {
return;
}
}



// Apertura ventanas recomendacion --------------------------------------------------

function recomendacion() {

var tnombre = document.r.tn.value;
var temail = document.r.tm.value;

if (tnombre == "") {
    alert("Olvidaste escribir tu Nombre.");
    document.r.tn.focus();
    return (false);
	}
	
if (temail == "") {
    alert("Olvidaste escribir tu Email.");
    document.r.tm.focus();
    return (false);
	}

	
document.r.tunombre.value = tnombre;
document.r.tuemail.value = temail;

document.r.tn.value = "";
document.r.tm.value = "";

PopUp('','C',330,120,0,0,0,'vrecom')
}

function recomendacion2() {

var snombre = document.g.sn.value;
var semail = document.g.sm.value;

if (snombre == "") {
    alert("Olvidaste escribir el Nombre de tu amigo.");
    document.g.sn.focus();
    return (false);
	}
	
if (semail == "") {
    alert("Olvidaste escribir el Email de tu amigo.");
    document.g.sm.focus();
    return (false);
	}

return true;
}


// Apertura ventanas pdf Documentos--------------------------------------------------

function generaPDF(file,tipo) {
tengoPDF = detectAcrobat()

if(tengoPDF) {
url = "/includes/generaPDF.asp?id=" + file +"&tipo=" + tipo
PopUp(url,'F',300,80,1,1,0,'verPDF')
} else {
alert("No tienes instalado el Adobe Acrobat Reader.\n\nPara poder visualizar documentos PDF, debes tener instalado este componente.\nConsulta con el Administrador para solucionar el problema.")
}
}


// carga PDF


function PDF(id) {
tengoPDF = detectAcrobat()

if(tengoPDF) {
url = "/includes/PDF.asp?id=" + id

X = 0;
Y = 0;
st = 1;
sc = 1;
to = 1;

W = screen.availWidth;
H = screen.availheight;
window.open(url,'documento','left=' + X + ', top=' + Y + ', ' + 'width=' + W + ', height=' + H + ', status=' + st + ', scrollbars=' + sc + ',toolbar=' + to + ' ,location=no,directories=no,menubar=yes, resizable=1')

// PopUp(url,'F',300,80,1,1,1,'PDF')


} else {
alert("No tienes instalado el Adobe Acrobat Reader.\n\nPara poder visualizar documentos PDF, debes tener instalado este componente.\nConsulta con el Administrador para solucionar el problema.")
}
}




// Carga PDF

function cargapdf(ira) {
var NS = (navigator.appName=="Netscape")?true:false; 

if (NS) {
top.window.moveTo(0,0);
top.window.resizeTo(screen.availWidth,screen.availHeight);
} else {
self.moveTo(0,0)
self.resizeTo(screen.availWidth, screen.availheight);
}
self.focus(); 

var url = ira;
window.location.href = url;
}

// webmail

function webmail() {
ok = confirm("El correo se abrirá en una nueva ventana")
url = "/includes/webmail.asp"
if (ok == true) {
PopUp(url,'F',10,10,1,1,0,'webmail')
} else {
return;
}
}


// Legal

function legal(id) {
url = "/includes/legal.asp?id=" + id;
PopUp(url,'T',400,350,1,1,0,'legal')
}


// Precarga Paginas ------------------------------------------------------------------

function precarga() {
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';
}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
}
}
}

// Apertura ventana Fotos

function foto(foto){
url = "/includes/foto.asp?foto=" + foto;
PopUp(url,'T',10,10,0,0,0,'Foto')
}

function fotolibre(ruta){
url = "/includes/fotolibre.asp?ruta=" + ruta;
PopUp(url,'T',10,10,0,0,0,'Foto')
}

function fotodehonmarzo(ruta){
url = "/includes/fotodehonmarzo.asp?ruta=" + ruta;
PopUp(url,'T',10,10,0,0,0,'Foto')
}

// Apertura ventana Fotos

function fotoreportaje(foto){
url = "/includes/fotoreportaje.asp?foto=" + foto;
PopUp(url,'C',10,10,0,0,0,'Foto')
}


function fotoexpone(foto){
url = "/includes/fotoexpone.asp?foto=" + foto;
W = screen.availWidth;
H = screen.availheight;
PopUp(url,'T',800,600,1,1,0,'Fotex')
}

function validarconsulta() {

if (document.f.rnombre.value == "") {
    alert("Olvidaste escribir tu Nombre.");
    document.f.rnombre.focus();
    return (false);
	}

if (document.f.remail.value == "") {
    alert("Olvidaste escribir tu Email.");
    document.f.remail.focus();
    return (false);
	}
	
if (document.f.rtexto.value == "") {
    alert("Olvidaste escribir tus Comentarios.");
    document.f.rtexto.focus();
    return (false);
	}
	
	return(true);
	
}


// crea hasp y valida login y password


function validarlogin() {

if (document.paso.user.value == "") {
    alert("Olvidaste escribir tu Nombre de Usuario.");
    document.paso.user.focus();
    return (false);
	}

if (document.paso.password.value == "") {
    alert("Olvidaste escribir tu Contraseña");
    document.paso.password.focus();
    return (false);
	}

var pw = document.paso.password.value;
hasp = hex_md5(pw);
document.paso.cifrado.value = hasp;
document.paso.submit();

}


// Detecta PDF

function detectAcrobat() {
pluginFound = detectPDF ();
if(!pluginFound && detectableWithVB) {
pluginFound = detectActiveXControl('PDF.PdfCtrl.1');
}
return pluginFound;
}


function detectPDF () {
if (!document.all && document.images) {
for (i = 0; i < navigator.mimeTypes.length; i++) {
if ((navigator.mimeTypes[i].suffixes.indexOf ("PDF") != -1)  || (navigator.mimeTypes[i].suffixes.indexOf ("pdf") != -1)) {
return true;
}
}
return false;
}
return true;
}


// valida formularios


function validarNOM() {

if (document.NOM.cadena.value == "") {
    alert("Debes escribir al menos parte del nombre y/o apellidos.");
    document.NOM.cadena.focus();
    return (false);
	}
	
	return(true);
}


function validarHOM() {

if (document.HOM.ciclo.value == "") {
    alert("Debes seleccionar uno de los ciclos de liturgia.");
    document.HOM.ciclo.focus();
    return (false);
	}
	
	return(true);
}


function validarFEC() {

	lond = document.FEC.fdesde.value.length + 0
	lonh = document.FEC.fhasta.value.length + 0

	lon = lond + lonh

	if (lon != 8) {
    alert("Error: Debes introducir el año con cuatro dígitos");
	document.FEC.fdesde.value = ""
	document.FEC.fhasta.value = ""
	document.FEC.fdesde.focus();
    return (false);
	}
	

	if (document.FEC.fdesde.value > document.FEC.fhasta.value){
	alert("Error: El Año desde debe ser menor que el hasta");
	return(false);
	}
	
	
	if (document.FEC.fdesde.value == "" || document.FEC.fhasta.value == "") {
    alert("Debes indicar el intervalo de años.");
    document.FEC.fdesde.focus();
    return (false);
	}
	
	return(true);
}

function validarONO() {

if (document.ONO.mes.value == "") {
    alert("Debes seleccionar uno de los meses.");
    document.ONO.mes.focus();
    return (false);
	}
	
	return(true);
}



// Apertura reportajes

function reportajes(){
url = "/includes/menu_reportajes.asp"
PopUp(url,'T',370,400,1,1,0,'reportaje')
}


// Diapos

// Apertura ventana para slide show de fotos

function diapos(carpeta,tit) {
url = "/scripts/diapos.asp?folder=" + carpeta + "&titulo=" + tit;
PopUp(url,'C',470,480,1,0,0,'slideshow')
}

function MostrarFlash(Pelicula, Ancho, Alto, Calidad, WMode)
{
    document.write('<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/get/shockwave/cabs/flash/swflash.cab width=' + Ancho + ' height=' + Alto +'>')
    document.write('<param name=movie value=' + Pelicula + ' />')
    document.write('<param name=quality value=' + Calidad + ' />')
	if (WMode != "")
	{
		document.write('<param name=wmode value=' + WMode + ' />')
	}
    document.write('<embed src=' + Pelicula + ' quality=' + Calidad + ' pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=' + Ancho + ' height=' + Alto + '></embed>')
    document.write('</object>')
}
//-->