function AbrirCentro(url,nompopup,popW,popH,resizable,scroll){
	w = screen.availWidth;
	h = screen.availHeight;
	var leftPos = (w-popW)/2; topPos = (h-popH)/2;
	leftPos = leftPos - 20;
	topPos = topPos - 20;
	window.open(url,nompopup,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',resizable=' + resizable + ',scrollbars=' + scroll );
}

function FechaActual () {
	marcacion = new Date() 
	Hora = marcacion.getHours() 	
	Minutos = marcacion.getMinutes() 
	Segundos = marcacion.getSeconds()
    var meridiano   
  
    if (Hora > 12) {   
        Hora -= 12   
        meridiano = " P.M."  
    } else {   
        meridiano = " A.M."  
    }   
               
    if (Hora < 10)   
        ValorHora = "0" + Hora   
    else  
        ValorHora = "" + Hora   
  
    if (Minutos < 10)   
        ValorHora += ":0" + Minutos   
    else  
        ValorHora += ":" + Minutos   
               
    if (Segundos < 10)   
        ValorHora += ":0" + Segundos   
    else  
        ValorHora += ":" + Segundos   
           
    ValorHora += meridiano
	var Dia = new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado","Domingo"); 
	var Mes = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); 
	var Hoy = new Date(); 
	var Anio = Hoy.getFullYear(); 
	var Fecha = Dia[Hoy.getDay()] + " " + Hoy.getDate() + " de " + Mes[Hoy.getMonth()]; 
	FechaTotal = "<p>Asia, " + Fecha + " " + ValorHora + "</p>"

	document.getElementById('FechaReloj').innerHTML = FechaTotal 
	setTimeout("FechaActual()",1000)
}

function CurrentDate () {
	marcacion = new Date() 
	Hora = marcacion.getHours() 	
	Minutos = marcacion.getMinutes() 
	Segundos = marcacion.getSeconds()
    var meridiano   
  
    if (Hora > 12) {   
        Hora -= 12   
        meridiano = " P.M."  
    } else {   
        meridiano = " A.M."  
    }   
               
    if (Hora < 10)   
        ValorHora = "0" + Hora   
    else  
        ValorHora = "" + Hora   
  
    if (Minutos < 10)   
        ValorHora += ":0" + Minutos   
    else  
        ValorHora += ":" + Minutos   
               
    if (Segundos < 10)   
        ValorHora += ":0" + Segundos   
    else  
        ValorHora += ":" + Segundos   
           
    ValorHora += meridiano
	var Dia = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"); 
	var Mes = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 
	var Hoy = new Date(); 
	var Anio = Hoy.getFullYear(); 
	var Fecha = Dia[Hoy.getDay()] + " " + Hoy.getDate() + " of " + Mes[Hoy.getMonth()]; 
	FechaTotal = "<p>Asia, " + Fecha + " " + ValorHora + "</p>"

	document.getElementById('FechaReloj').innerHTML = FechaTotal 
	setTimeout("CurrentDate()",1000)
}


function OverImg(name) {
	actual = document.getElementById(name).src
	total = actual.length
	tipo = actual.substr(total-3,total)
	if (tipo=="jpg") {
		formato = "jpg"
	} else {
		formato = "gif"
	}
	document.getElementById(name).src = "images/" + name + "_over." + formato;
}

function OutImg(name) {
	actual = document.getElementById(name).src
	total = actual.length
	tipo = actual.substr(total-3,total)
	if (tipo=="jpg") {
		formato = "jpg"
	} else {
		formato = "gif"
	}	
	document.getElementById(name).src = "images/" + name + "." + formato;
}

function EsEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
		return true;
	} else {
		return false;
	}
}

function Montos(string) {
    var valid = "0123456789.";
    var rpta = '';
    for (var i=0; i<string.length; i++){
        val = string.substring(i, i+1);
        if (valid.indexOf(val) > -1) rpta += val;
    }
    return rpta;
}

function Enteros(string) {
    var valid = "0123456789";
    var rpta = '';
    for (var i=0; i<string.length; i++){
        val = string.substring(i, i+1);
        if (valid.indexOf(val) > -1) rpta += val;
    }
    return rpta;
}

function Caracteres(string) {
    var invalid = "!ρΡ΄αινσϊΑΙΝΣΪ{}[]";
    var rpta = '';
    for (var i=0; i<string.length; i++){
        inval = string.substring(i, i+1);
        if (invalid.indexOf(inval) > -1) rpta += inval;
    }
    return rpta;
}

function Espacio(string) {
    var invalid = " ";
    var rpta = '';
    for (var i=0; i<string.length; i++){
        inval = string.substring(i, i+1);
        if (invalid.indexOf(inval) > -1) rpta += inval;
    }
    return rpta;
}

function Puntos(string) {
    var invalid = ".";
    var rpta = '';
    for (var i=0; i<string.length; i++){
        inval = string.substring(i, i+1);
        if (invalid.indexOf(inval) > -1) rpta += inval;
    }
    return rpta;
}

function Over(src,color) {
    src.bgColor=color; src.style.cursor="hand";
} 

function Out(src,color) { 
    src.bgColor=color; src.style.cursor="default"; 
}

/* Front End */
function Galeria(galeria,idioma) {
	if (idioma == "E") {
		document.spbwebsite.action = "sociales.php"
	} else {
		document.spbwebsite.action = "sociales_eng.php"		
	}
	document.spbwebsite.codigo.value = galeria
	document.spbwebsite.submit()	
}
function Idioma(idioma) {
	document.spbwebsite.idioma.value = idioma
	document.spbwebsite.submit()
}
function Buscar(idioma) {
	document.spbwebsite.proceso.value = "buscar"	
	if (document.spbwebsite.buscador.value == "") {
		alert("Debe de ingresar un valor para realizar la busqueda.")
		return
	} else {
		if (document.spbwebsite.proceso.value == "buscar") {
			if (idioma == "E") { 
				document.spbwebsite.action = "busqueda.php"
			} else {
				document.spbwebsite.action = "busqueda_eng.php"
			}
			document.spbwebsite.submit()		
		}
	}
}
function BuscarAsociado(idioma) {
	document.spbwebsite.proceso.value = "buscar"	
	if (document.spbwebsite.buscador_asociados.value == "") {
		alert("Debe de ingresar un valor para realizar la busqueda.")
		return
	} else {
		if (document.spbwebsite.proceso.value == "buscar") {
			document.spbwebsite.action = "temporal.php"
			document.spbwebsite.submit()		
		}
	}
}

function Suscribirse() {
	document.spbwebsite.proceso.value = "suscribir"	
	if (document.spbwebsite.email_suscripcion.value == "") {
		alert("Debe de ingresar un Email.")
		document.spbwebsite.email_suscripcion.focus()
		return
	} else {
		if (!EsEmail(document.spbwebsite.email_suscripcion.value)) {		
			alert("Debe de ingresar un Email valido.")
			document.spbwebsite.email_suscripcion.focus()
			return	
		} else {
			if (document.spbwebsite.proceso.value == "suscribir") {
				document.spbwebsite.action = "suscribir.php"
				document.spbwebsite.submit()		
			}			
		}
	}
}

function Revista(codigo) {
	url = "visor_revista.php?id=" + codigo
	window.open(url,'Revista')
	//AbrirCentro(url,'Revista',1000,720,'no','no')
}

var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }
/* Front End */
/* Back End */
function ChequearTodos(chkbox) {
	for (var i=0;i < document.manager.elements.length;i++) {
		var elemento = document.manager.elements[i];		
		if ((elemento.type == "checkbox") && (elemento.name.substring(0,6) != "todosC") && (elemento.name.substring(0,5) != "placa") && (elemento.name.substring(0,6) != "fuente") && (elemento.name.substring(0,7) != "memoria") && (elemento.name.substring(0,5) != "video") && (elemento.name.substring(0,5) != "disco")) {
			elemento.checked = chkbox.checked
		}
	}
}
function Cancelar() {
	document.manager.proceso.value = "cancelar"
	document.manager.submit()
}
function Activar(seccion) {
	estado = 0
    for (i = 0; i < document.manager.length; i++)
		if (document.manager.elements[i].name.substring(0,3) == "chk") {
			if (document.manager.elements[i].checked == true) {
				estado = 1
			}
		}
	if (estado == 0) {
		if (seccion == "U") { alert("Debe de seleccionar un Usuario.") }
		if (seccion == "CP") { alert("Debe de seleccionar una Categoria.") }
		if (seccion == "SCP") { alert("Debe de seleccionar una SubCategoria.") }
		if (seccion == "A") { alert("Debe de seleccionar un Asociado.") }
		if (seccion == "S") { alert("Debe de seleccionar una Seccion.") }
		if (seccion == "B") { alert("Debe de seleccionar un Banner.") }
		if (seccion == "R") { alert("Debe de seleccionar una Revista.") }
		if (seccion == "G") { alert("Debe de seleccionar una Galeria.") }
		if (seccion == "E") { alert("Debe de seleccionar un Evento.") }
		if (seccion == "N") { alert("Debe de seleccionar una Noticia.") }		
		if (seccion == "SU") { alert("Debe de seleccionar un Suscrito.") }		
		if (seccion == "CM") { alert("Debe de seleccionar un Comentario.") }		
		return
	}
	document.manager.activar.value = true
	document.manager.submit()
}
function Desactivar(seccion) {
	estado = 0
    for (i = 0; i < document.manager.length; i++)
		if (document.manager.elements[i].name.substring(0,3) == "chk") {
			if (document.manager.elements[i].checked == true) {
				estado = 1
			}
		}
	if (estado == 0) {
		if (seccion == "U") { alert("Debe de seleccionar un Usuario.") }
		if (seccion == "CP") { alert("Debe de seleccionar una Categoria.") }
		if (seccion == "SCP") { alert("Debe de seleccionar una SubCategoria.") }
		if (seccion == "A") { alert("Debe de seleccionar un Asociado.") }
		if (seccion == "S") { alert("Debe de seleccionar una Seccion.") }
		if (seccion == "B") { alert("Debe de seleccionar un Banner.") }
		if (seccion == "R") { alert("Debe de seleccionar una Revista.") }
		if (seccion == "G") { alert("Debe de seleccionar una Galeria.") }
		if (seccion == "E") { alert("Debe de seleccionar un Evento.") }
		if (seccion == "N") { alert("Debe de seleccionar una Noticia.") }		
		if (seccion == "SU") { alert("Debe de seleccionar un Suscrito.") }		
		if (seccion == "CM") { alert("Debe de seleccionar un Comentario.") }		
		return
	}
	document.manager.desactivar.value = true
	document.manager.submit()
}
function Eliminar(seccion) {
	estado = 0
    for (i = 0; i < document.manager.length; i++)
		if (document.manager.elements[i].name.substring(0,3) == "chk") {
			if (document.manager.elements[i].checked == true) {
				estado = 1
			}
		}
	if (estado == 0) {
		if (seccion == "U") { alert("Debe de seleccionar un Usuario.") }
		if (seccion == "CP") { alert("Debe de seleccionar una Categoria.") }
		if (seccion == "SCP") { alert("Debe de seleccionar una SubCategoria.") }
		if (seccion == "A") { alert("Debe de seleccionar un Asociado.") }
		if (seccion == "S") { alert("Debe de seleccionar una Seccion.") }
		if (seccion == "B") { alert("Debe de seleccionar un Banner.") }
		if (seccion == "R") { alert("Debe de seleccionar una Revista.") }
		if (seccion == "G") { alert("Debe de seleccionar una Galeria.") }
		if (seccion == "E") { alert("Debe de seleccionar un Evento.") }
		if (seccion == "N") { alert("Debe de seleccionar una Noticia.") }		
		if (seccion == "SU") { alert("Debe de seleccionar un Suscrito.") }		
		if (seccion == "CO") { alert("Debe de seleccionar un Contactenos.") }		
		if (seccion == "CM") { alert("Debe de seleccionar un Comentario.") }		
		return
	}
	document.manager.eliminar.value = true
	document.manager.submit()
}
function Suscribir(seccion) {
	estado = 0
    for (i = 0; i < document.manager.length; i++)
		if (document.manager.elements[i].name.substring(0,3) == "chk") {
			if (document.manager.elements[i].checked == true) {
				estado = 1
			}
		}
	if (estado == 0) {
		if (seccion == "C") { alert("Debe de seleccionar un Cliente.") }
		return
	}
	document.manager.suscribir.value = true
	document.manager.submit()
}
function Desuscribir(seccion) {
	estado = 0
    for (i = 0; i < document.manager.length; i++)
		if (document.manager.elements[i].name.substring(0,3) == "chk") {
			if (document.manager.elements[i].checked == true) {
				estado = 1
			}
		}
	if (estado == 0) {
		if (seccion == "C") { alert("Debe de seleccionar un Cliente.") }
		return
	}
	document.manager.desuscribir.value = true
	document.manager.submit()
}
function Borrar() {
	document.manager.proceso.value = "borrar"
	document.manager.submit()
}
function Cerrar() {
	tNavegador = navigator.appName
	if (tNavegador == "Microsoft Internet Explorer") {	
		opener.window.manager.action = document.manager.destino.value
		opener.window.manager.submit()
	}
	if (tNavegador == "Netscape") {
		window.opener.document.manager.action = document.manager.destino.value
		window.opener.document.manager.submit()		
	}
	window.close()
}
/* Back End */