// JavaScript Document
var nav4 = window.Event ? true : false;
function js_valida_numero(evt)
{	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}


// Escribe la fecha completa

function fechac()
{
var now = new Date()
var dia = now.getDay()
var mes = now.getMonth()
var anio = now.getYear()
var fecha

fecha = now.getDate() + " de "

//El nombre del mes

if(mes==0){
 fecha=fecha + "Enero"
}else if(mes==1){
 fecha=fecha + "Febrero"
}else if(mes==2){
 fecha=fecha + "Marzo"
}else if(mes==3){
 fecha=fecha + "Abril"
}else if(mes==4){
 fecha=fecha + "Mayo"
}else if(mes==5){
 fecha=fecha + "Junio"
}else if(mes==6){
 fecha=fecha + "Julio"
}else if(mes==7){
 fecha=fecha + "Agosto"
}else if(mes==8){
 fecha=fecha + "Setiembre"
}else if(mes==9){
 fecha=fecha + "Octubre"
}else if(mes==10){
 fecha=fecha + "Noviembre"
}else{
 fecha=fecha + "Diciembre"
}

if (anio < 1900)
		{
		anio =anio + 1900;
		
		}


fecha = fecha + " del " + anio
return fecha;
}


function js_Permut (flag,img) {
   if (document.images) {
        if (document.images[img].permloaded) {
            if (flag==1) document.images[img].src = document.images[img].perm.src
            else document.images[img].src = document.images[img].perm.oldsrc
        }
   }
}

function js_preloadPermut (img,adresse) {
   if (document.images) {
        img.onload = null;
        img.perm = new Image ();
        img.perm.oldsrc = img.src;
        img.perm.src = adresse;
        img.permloaded = true;
   }
}

function Verificar_Usuario()
{

if (document.frmUsuario.txtUsuario.value=="")
{
 alert("Debe de escribir el usuario")
 document.frmUsuario.txtUsuario.focus()
}else if (document.frmUsuario.txtClave.value=="")
{
 alert("Debe de escribir la clave")
 document.frmUsuario.txtClave.focus()
}else{
 document.frmUsuario.submit()
}

}

function Buscar()
{
document.frmBusqueda.submit()
}

function limpiar_usuario()
{
	document.frm_usuario.dsc_login.value=''
	document.frm_usuario.dsc_nombre.value=''
	document.frm_usuario.list_entidades.value=''
	document.frm_usuario.dsc_clave.value=''
	document.frm_usuario.dsc_clave1.value=''
	document.frm_usuario.dsc_mail.value=''
	
}


//*************************************************************************
// Valida datos al crear un nuevo usuario
//*************************************************************************
function Validar_Administrador(Tipo)
{

	//****Nombre
	if (document.frm_usuario.txtNombre.value=='')
	{
		alert('Ingrese el nombre del usuario')
		document.frm_usuario.txtNombre.focus()
		return;
	}
	
	//****DNI
	if (document.frm_usuario.txtDNI.value=='')
	{
		alert('Ingrese el dni del usuario')
		document.frm_usuario.txtDNI.focus()
		return;
	}
	
	//****Cargo
	if (document.frm_usuario.txtCargo.value=='')
	{
		alert('Ingrese el cargo o profesión del usuario')
		document.frm_usuario.txtCargo.focus()
		return;
	}	
	
	//****Login
	if (document.frm_usuario.txtUsuario.value=='')
	{
		alert('Ingrese el login de usuario')
		document.frm_usuario.txtUsuario.focus()
		return;
	}
	
	//****Clave
	if (document.frm_usuario.txtClave.value=='')
	{
		alert('Ingrese la clave de usuario')
		document.frm_usuario.txtClave.focus()
		return;
	}
		
	dsc_clave=document.frm_usuario.txtClave.value
		
	if (dsc_clave.length<4)		
	{
		alert('La clave debe tener más de tres caracteres')
		document.frm_usuario.txtClave.focus()
		return;
	}

	if (document.frm_usuario.txtReClave.value=='')
	{
		alert('Ingrese la confirmación de su clave')
		document.frm_usuario.txtReClave.focus()
		return;
	}
	
		
	if (document.frm_usuario.txtClave.value!=document.frm_usuario.txtReClave.value)
	{
		alert('Las claves ingresadas no coinciden')
		document.frm_usuario.txtClave.focus()
		return;
	}	
	
	if (Tipo=="I"){
	
	if(confirm('¿Desea ingresar el nuevo usuario?'))	
	{
		document.frm_usuario.submit();		
	}
	
	}else{
	
	if(confirm('¿Desea modificar el usuario seleccionado?'))	
	{
		document.frm_usuario.submit();		
	}
		
	
	}
	
	
}

function Eliminar_Usuario(Codigo,Tipo)
{

	   if(confirm('Esta a punto de eliminar al usuario seleccionado, \n\n                ¿desea continuar?'))
		{
   		 document.location.href='../mantenimiento/par_modi_usuario.php?txtCodigo=' + Codigo + '&txt_tipo_accion=' + Tipo
		}

}

function Agregar_Permiso(Codigo)
{
  if (document.frm_usuario.lblpermiso.value!="") {
	Permiso=document.frm_usuario.lblpermiso.value	
    document.location.href='../permisos/ing_permiso.php?Codigo=' + Codigo + '&Permiso=' + Permiso
  }else{
    alert("Debe de seleccionar un permiso")
	return
  }
}

function Eliminar_Permiso(Permiso,Codigo)
{

	   if(confirm('Esta a punto de eliminar el permiso seleccionado, \n\n                ¿desea continuar?'))
		{
   		 document.location.href='../permisos/del_permiso.php?Codigo=' + Codigo + '&Permiso=' + Permiso 
		}

}

//*************************************************************************
// Valida datos al crear un nuevo usuario
//*************************************************************************
function Validar_Usuario(Tipo)
{

	//****Nombre
	if (document.frm_usuario.txtEmpresa.value=='')
	{
		alert('Ingrese el nombre de la empresa')
		document.frm_usuario.txtEmpresa.focus()
		return;
	}
	//****Apellido Paterno
	if (document.frm_usuario.txtTelEmpre.value=='')
	{
		alert('Ingrese el teléfono de la empresa')
		document.frm_usuario.txtTelEmpre.focus()
		return;
	}
	
	//****Apellido Materno
	if (document.frm_usuario.txtNombre.value=='')
	{
		alert('Ingrese los nombres del doctor')
		document.frm_usuario.txtNombre.focus()
		return;
	}
	
	//****DNI
	if (document.frm_usuario.txtDireccion.value=='')
	{
		alert('Ingrese la dirección o domicilio')
		document.frm_usuario.txtDireccion.focus()
		return;
	}
	
	//****Cargo
	if (document.frm_usuario.txtProvincia.value=='')
	{
		alert('Ingrese la provincia')
		document.frm_usuario.txtProvincia.focus()
		return;
	}	
	
		//****Cargo
	if (document.frm_usuario.txtDistrito.value=='')
	{
		alert('Ingrese la distrito')
		document.frm_usuario.txtDistrito.focus()
		return;
	}
	
	if (Tipo=="I"){
	
	if(confirm('¿Desea ingresar el nuevo doctor?'))	
	{
		document.frm_usuario.submit();		
	}
	
	}else{
	
	if(confirm('¿Desea modificar al doctor?'))	
	{
		document.frm_usuario.action="upd_Doctor.php"
		document.frm_usuario.submit();		
	}
	
	}
	
}


function Validar_Imagen(){

if (document.frm_imagen.txt_imagen_orden.value==""){
 alert("Debe de escribir el orden de la imagen")
 document.frm_imagen.txt_imagen_orden.focus()
}else if (document.frm_imagen.txt_imagen_nombre.value==""){
 alert("Debe de escribir el nombre de la imagen")
 document.frm_imagen.txt_imagen_nombre.focus()
}else if (document.frm_imagen.archivo.value==""){
 alert("Debe de seleccionar un archivo")
 document.frm_imagen.archivo.focus()
}else{
 document.frm_imagen.action='enviar_imagen.php'
 document.frm_imagen.submit()
}
}

function Eliminar_Imagen(Codigo,Archivo,Doctor)
{

	   if(confirm('Esta a punto de eliminar la imagen seleccionada, \n\n                ¿desea continuar?'))
		{
   		 document.location.href='del_imagenes.php?Codigo=' + Codigo + '&Archivo=' + Archivo + '&Doctor=' + Doctor
		}

}

function Votar_Imagen(Codigo,Doctor)
{

	   if(confirm('Esta a punto de dar un voto por la imagen seleccionada, \n\n                ¿desea continuar?'))
		{
   		 document.location.href='votar.php?Codigo=' + Codigo + '&Doctor=' + Doctor
		}

}

function abrir_votacion()
{
    window.open('mas_votados.php',"","height=300,width=550,resizable=0,noresize=0,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=yes");
}


function Eliminar_miembro_Doctor(Miembro,Codigo)
{

	   if(confirm('Esta a punto de eliminar el miembro seleccionado, \n\n                ¿desea continuar?'))
		{
   		 document.location.href='../permisos/del_miembro_doctor.php?Codigo=' + Codigo + '&Miembro=' + Miembro 
		}

}

function js_elimina_video(pk_id_video)
{

	if(confirm('¿Desea eliminar los datos del video seleccionado?'))	
	{
	 document.location.href='../mantenimiento/par_modi_video.php?txt_id_video=' + pk_id_video + '&txt_tipo_accion=E' 
	}

}


function js_validar_video()
{

if (document.frm_video.txt_video_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_video.txt_video_orden.focus()
 return;
}

if (document.frm_video.txt_video_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_video.txt_video_nombre.focus()
 return;
}

if (document.frm_video.txt_video_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_video.txt_video_descripcion.focus()
 return;
}

<!---->
if (document.frm_video.txt_tipo_accion.value=="I")
{
if (document.frm_video.archivo.value==""){
 alert('La ruta de la imágen no puede estar en blanco')
 document.frm_video.archivo.focus()
 return;
}
}

if (document.frm_video.txt_tipo_accion.value=="I")
{
if (document.frm_video.archivo2.value==""){
 alert('La ruta de la video no puede estar en blanco')
 document.frm_video.archivo2.focus()
 return;
}
}

if (document.frm_video.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la imágen?'))	
		{
			document.frm_video.action='../mantenimiento/par_modi_video.php'
			document.frm_video.submit()
		}

}

<!---->

function js_validar_galeria()
{

if (document.frm_imagen.txt_galeria_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_imagen.txt_galeria_orden.focus()
 return;
}

if (document.frm_imagen.txt_galeria_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_galeria_nombre.focus()
 return;
}

if (document.frm_imagen.txt_galeria_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_imagen.txt_galeria_descripcion.focus()
 return;
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{
if (document.frm_imagen.archivo.value==""){
 alert('La ruta de la imágen no puede estar en blanco')
 document.frm_imagen.archivo.focus()
 return;
}
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la imágen?'))	
		{
			document.frm_imagen.action='../mantenimiento/par_modi_galeria.php'
			document.frm_imagen.submit()
		}

}





////////////

<!---->

function js_validar_evento()
{

if (document.frm_imagen.txt_evento_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_imagen.txt_evento_orden.focus()
 return;
}

if (document.frm_imagen.txt_evento_fecha.value==""){
 alert('la Fecha no puede estar en blanco')
 document.frm_imagen.txt_evento_fecha.focus()
 return;
}

if (document.frm_imagen.txt_evento_fecha.value==""){
 alert('la Fecha no puede estar en blanco')
 document.frm_imagen.txt_evento_fecha.focus()
 return;
}

if (document.frm_imagen.txt_evento_hora.value==""){
 alert('la hora no puede estar en blanco')
 document.frm_imagen.txt_evento_hora.focus()
 return;
}

if (document.frm_imagen.select_web.value==""){
 alert('la mesa no puede estar en blanco')
 document.frm_imagen.select_web.focus()
 return;
}

if (document.frm_imagen.txt_evento_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_evento_nombre.focus()
 return;
}

if (document.frm_imagen.txt_evento_direccion.value==""){
 alert('La direccion no puede estar en blanco')
 document.frm_imagen.txt_evento_direccion.focus()
 return;
}

if (document.frm_imagen.txt_evento_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_imagen.txt_evento_descripcion.focus()
 return;
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{
if (document.frm_imagen.archivo.value==""){
 alert('La ruta de la imágen no puede estar en blanco')
 document.frm_imagen.archivo.focus()
 return;
}
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la imágen?'))	
		{
			document.frm_imagen.action='../mantenimiento/par_modi_evento.php'
			document.frm_imagen.submit()
		}

}
///////////////









function js_validar_tema()
{

if (document.frm_tematicos.txt_tema_nivel1.value==""){
 alert('El nivel 1 no puede estar en blanco')
 document.frm_tematicos.txt_tema_nivel1.focus()
 return;
}

if (document.frm_tematicos.txt_tema_nivel2.value==""){
 alert('El nivel 2 no puede estar en blanco')
 document.frm_tematicos.txt_tema_nivel2.focus()
 return;
}

if (document.frm_tematicos.txt_tema_nivel3.value==""){
 alert('El nivel 3 no puede estar en blanco')
 document.frm_tematicos.txt_tema_nivel3.focus()
 return;
}

if (document.frm_tematicos.txt_tema_nivel4.value==""){
 alert('El nivel 4 no puede estar en blanco')
 document.frm_tematicos.txt_tema_nivel4.focus()
 return;
}

if (document.frm_tematicos.txt_tema_nombre.value==""){
 alert('El nombre del tema no puede estar en blanco')
 document.frm_tematicos.txt_tema_nombre.focus()
 return;
}

if (document.frm_tematicos.txt_tema_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_tematicos.txt_tema_descripcion.focus()
 return;
}

if (document.frm_tematicos.txt_tema_descriptores.value==""){
 alert('Los descriptores no pueden estar en blanco')
 document.frm_tematicos.txt_tema_descriptores.focus()
 return;
}

	Tipo = document.frm_tematicos.txt_tipo_accion.value
	
	if(Tipo=='M')
	{
	
	if(confirm('¿Desea actualizar los datos del tema?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}else{
	
	if(confirm('¿Desea ingresar los datos del tema?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}

}



function js_validar_encuesta()
{

if (document.frm_imagen.txt_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_nombre.focus()
 return;
}

if (document.frm_imagen.txt_opcion1.value==""){
 alert('La opcion no puede estar en blanco')
 document.frm_imagen.txt_opcion1.focus()
 return;
}

if (document.frm_imagen.txt_opcion2.value==""){
 alert('La opcion no puede estar en blanco')
 document.frm_imagen.txt_opcion2.focus()
 return;
}

if (document.frm_imagen.txt_opcion3.value==""){
 alert('La opcion no puede estar en blanco')
 document.frm_imagen.txt_opcion3.focus()
 return;
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la encuesta?'))	
		{
			document.frm_imagen.action='../mantenimiento/par_modi_encuesta.php'
			document.frm_imagen.submit()
		}

}






function js_validar_opcion()
{

if (document.frm_imagen.txt_opcion.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_opcion.focus()
 return;
}


if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la encuesta?'))	
		{
			document.frm_imagen.action='../mantenimiento/par_modi_opcion.php'
			document.frm_imagen.submit()
		}

}


function js_validar_opcion2()
{

if (document.frm_imagen.txt_opcion.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_opcion.focus()
 return;
}


if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la encuesta?'))	
		{
			document.frm_imagen.action='../mantenimiento/par_modi_titulo.php'
			document.frm_imagen.submit()
		}

}










function js_editar_tema_municipalidad(pk_id_tematico,pk_id_entidad)
{

document.location.href='par_form_tematicos.php?pk_id_tematico=' + pk_id_tematico + '&pk_id_entidad=' + pk_id_entidad + "&ch_tipo_accion=M"

}

function js_elimina_tema_municipalidad(pk_id_entidad,pk_id_tematico)
{

	if(confirm('¿Desea eliminar los datos del tema?'))	
	{
	 document.location.href='../mantenimiento/par_modi_tematicos.php?txt_id_tematico=' + pk_id_tematico + '&txt_id_entidad=' + pk_id_entidad + '&txt_tipo_accion=E'	
	}

}

function js_ver_subtemas_municipalidad(pk_id_tematico,pk_id_entidad)
{

document.location.href='par_list_subtemas.php?pk_id_tematico=' + pk_id_tematico + '&pk_id_entidad=' + pk_id_entidad

}


function js_validar_subtema()
{

frm_tematicos.onsubmit(1);

if (document.frm_tematicos.txt_subtema_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_tematicos.txt_subtema_orden.focus()
 return;
}

if (document.frm_tematicos.txt_subtema_pagina.value==""){
 alert('La página no puede estar en blanco')
 document.frm_tematicos.txt_subtema_pagina.focus()
 return;
}

if (document.frm_tematicos.txt_subtema_titulo.value==""){
 alert('El titulo no puede estar en blanco')
 document.frm_tematicos.txt_subtema_titulo.focus()
 return;
}

if (document.frm_tematicos.txt_subtema_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_tematicos.txt_subtema_descripcion.focus()
 return;
}

	Tipo = document.frm_tematicos.txt_tipo_accion.value
	
	if(Tipo=='M')
	{
	
	if(confirm('¿Desea actualizar los datos del sub-tema?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}else{
	
	if(confirm('¿Desea ingresar los datos del sub-tema?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}

}

function js_editar_subtema_municipalidad(pk_id_tematico_desc,pk_id_tematico,pk_id_entidad)
{

document.location.href='par_form_subtemas.php?pk_id_tematico_desc='+ pk_id_tematico_desc + '&pk_id_tematico=' + pk_id_tematico + '&pk_id_entidad=' + pk_id_entidad + '&ch_tipo_accion=M'

}

function js_elimina_subtema_municipalidad(pk_id_entidad,pk_id_tematico,pk_id_tematico_desc)
{

	if(confirm('¿Desea eliminar los datos del sub-tema?'))	
	{
	 document.location.href='../mantenimiento/par_modi_subtematicos.php?txt_id_subtematico=' + pk_id_tematico_desc + '&txt_id_tematico=' + pk_id_tematico + '&txt_id_entidad=' + pk_id_entidad + '&txt_tipo_accion=E'	
	}

}


function js_validar_paso()
{

if (document.frm_tematicos.txt_paso_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_tematicos.txt_paso_orden.focus()
 return;
}

if (document.frm_tematicos.txt_paso_descripcion.value==""){
 alert('La descripción no puede estar en blanco')
 document.frm_tematicos.txt_paso_descripcion.focus()
 return;
}


	Tipo = document.frm_tematicos.txt_tipo_accion.value
	
	if(Tipo=='M')
	{
	
	if(confirm('¿Desea actualizar los datos del paso?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}else{
	
	if(confirm('¿Desea ingresar los datos del paso?'))	
		{
			document.frm_tematicos.submit();		
		}
	
	}

}

function js_editar_paso_subtema(pk_id_entidad,pk_id_tematico,pk_id_tematico_desc,pk_id_paso)
{
 document.location.href='par_form_pasos.php?pk_id_tematico_desc=' + pk_id_tematico_desc + '&pk_id_tematico=' + pk_id_tematico + '&pk_id_entidad=' + pk_id_entidad + '&txt_id_paso=' + pk_id_paso + '&ch_tipo_accion=M'
}

function js_elimina_paso_subtema(pk_id_entidad,pk_id_tematico,pk_id_tematico_desc,pk_id_paso)
{

	if(confirm('¿Desea eliminar los datos del paso?'))	
	{
	 document.location.href='../mantenimiento/par_modi_pasos.php?txt_id_subtematico=' + pk_id_tematico_desc + '&txt_id_tematico=' + pk_id_tematico + '&txt_id_entidad=' + pk_id_entidad + '&txt_id_paso=' + pk_id_paso + '&txt_tipo_accion=E'	
	}

}

function js_validar_imagen()
{

if (document.frm_imagen.txt_imagen_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_imagen.txt_imagen_orden.focus()
 return;
}

if (document.frm_imagen.txt_imagen_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_imagen_nombre.focus()
 return;
}

if (document.frm_imagen.txt_imagen_archivo.value==""){
 alert('La ruta de la imágen no puede estar en blanco')
 document.frm_imagen.txt_imagen_archivo.focus()
 return;
}

if (document.frm_imagen.dlb_posicion.value==""){
 alert('La posición de la imágen no puede estar en blanco')
 document.frm_imagen.dlb_posicion.focus()
 return;
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	

	 if(confirm('¿Desea ' + Accion + ' los datos de la imágen?'))	
		{
			document.frm_imagen.submit()		
		}

	
}

function js_elimina_imagen_subtema(pk_id_entidad,pk_id_tematico,pk_id_tematico_desc,pk_id_imagen)
{

	if(confirm('¿Desea eliminar los datos de la imágen?'))	
	{
	 document.frm_imagen.action='../mantenimiento/par_modi_imagen.php?txt_id_subtema=' + pk_id_tematico_desc + '&txt_id_tema=' + pk_id_tematico + '&txt_id_entidad=' + pk_id_entidad + '&txt_id_imagenes=' + pk_id_imagen  + '&txt_tipo_accion2=E'	
	 document.frm_imagen.submit()
	}

}

function js_validar_banner()
{

if (document.frm_imagen.txt_banner_orden.value==""){
 alert('El orden no puede estar en blanco')
 document.frm_imagen.txt_banner_orden.focus()
 return;
}

if (document.frm_imagen.txt_banner_nombre.value==""){
 alert('El nombre no puede estar en blanco')
 document.frm_imagen.txt_banner_nombre.focus()
 return;
}

if (document.frm_imagen.txt_banner_ruta.value==""){
 alert('La ruta web no puede estar en blanco')
 document.frm_imagen.txt_banner_ruta.focus()
 return;
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{
if (document.frm_imagen.txt_banner_archivo.value==""){
 alert('La ruta de la imágen no puede estar en blanco')
 document.frm_imagen.txt_banner_archivo.focus()
 return;
}
}

if (document.frm_imagen.txt_tipo_accion.value=="I")
{ 
 Accion ="Ingresar"
}else{
 Accion ="Actualizar"
}	
	 if(confirm('¿Desea ' + Accion + ' los datos del banner?'))	
		{
			document.frm_imagen.submit()		
		}
	
}

function js_elimina_galeria(pk_id_galeria)
{

	if(confirm('¿Desea eliminar los datos de la imágen?'))	
	{
	 document.location.href='../mantenimiento/par_modi_galeria.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=E'	
	}

}

function js_elimina_evento(pk_id_galeria)
{

	if(confirm('¿Desea eliminar evento?'))	
	{
	 document.location.href='../mantenimiento/par_modi_evento.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=E'	
	}

}

function js_elimina_banner(pk_id_banner)
{

	if(confirm('¿Desea eliminar los datos del banner?'))	
	{
	 document.location.href='../mantenimiento/par_modi_banners.php?txt_id_banner=' + pk_id_banner + '&txt_tipo_accion2=E'	
	}

}


function js_aprueba(pk_id_galeria)
{

	if(confirm('¿Desea aprobar comentario?'))	
	{
	 document.location.href='../mantenimiento/par_modi_correo.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=A'	
	}

}


function js_elimina_correo(pk_id_galeria)
{

	if(confirm('¿Desea eliminar comentario?'))	
	{
	 document.location.href='../mantenimiento/par_modi_correo.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=E'	
	}

}


function js_aprueba2(pk_id_galeria)
{

	if(confirm('¿Desea aprobar comentario?'))	
	{
	 document.location.href='../mantenimiento/par_modi_correo2.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=A'	
	}

}


function js_elimina_correo2(pk_id_galeria)
{

	if(confirm('¿Desea eliminar comentario?'))	
	{
	 document.location.href='../mantenimiento/par_modi_correo2.php?txt_id_galeria=' + pk_id_galeria + '&txt_tipo_accion2=E'	
	}

}


// Flooble Dynamic  Calendar. 
	// Copyright (c) 2004 by Animus Pactum Consulting Inc.
	//---------------------------------------------------------------------
	// You may use this code freely on your site as long as you do not make
	// modifications to it other than editing the stylesheet settings to 
	// make it fit your design. You may not remove this notice or any links
	// to flooble.com.
	// More information about this script is available at
	//    http://www.flooble.com/scripts/calendar.php
	//--Global Stuff-------------------------------------------------------
	var fc_ie = false;
	if (document.all) { fc_ie = true; }
	
	var calendars = Array();
	var fc_months = Array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Setiembre', 'Octubre', 'Noviembre', 'Diciembre');
	var fc_openCal;

	var fc_calCount = 0;
	
	function getCalendar(fieldId) {
		return calendars[fieldId];
	}
	
	function displayCalendarFor(fieldId) {
		var formElement = fc_getObj(fieldId);
		displayCalendar(formElement);
	}
	
	function displayCalendar(formElement) {
		if (!formElement.id) {
			formElement.id = fc_calCount++;
		} 
		var cal = calendars[formElement.id];
		if (typeof(cal) == 'undefined') {
			cal = new floobleCalendar();
			cal.setElement(formElement);
			calendars[formElement.id] = cal;
		}
		if (cal.shown) {
			cal.hide();
		} else {
			cal.show();
		}
	}
	
	function display3FieldCalendar(me, de, ye) {
		if (!me.id) { me.id = fc_calCount++; }
		if (!de.id) { de.id = fc_calCount++; }
		if (!ye.id) { ye.id = fc_calCount++; }
		var id = de.id + '-' + me.id + '-' + ye.id;
		var cal = calendars[id];
		if (typeof(cal) == 'undefined') {
			cal = new floobleCalendar();
			cal.setElements(me, de, ye);
			calendars[id] = cal;
		}
		if (cal.shown) {
			cal.hide();
		} else {
			cal.show();
		}
	}

	//--Class Stuff--------------------------------------------------
	function floobleCalendar() {
		// Define Methods
		this.setElement = fc_setElement;
		this.setElements = fc_setElements;
		this.parseDate = fc_parseDate;
		this.generateHTML = fc_generateHTML;
		this.show = fc_show;
		this.hide = fc_hide;
		this.moveMonth = fc_moveMonth;
		this.setDate = fc_setDate;
		this.formatDate = fc_formatDate;
		this.setDateFields = fc_setDateFields;
		this.parseDateFields = fc_parseDateFields;
		
		this.shown = false;
	}
	
	function fc_setElement(formElement) {
		this.element = formElement;
		this.format = this.element.title;
		this.value = this.element.value;
		this.id = this.element.id;
		this.mode = 1;
	}
	
	function fc_setElements(monthElement, dayElement, yearElement) {
		this.mElement = monthElement;
		this.dElement = dayElement;
		this.yElement = yearElement;
		this.id = this.mElement.id + '-' + this.dElement.id + '-' + this.yElement.id;
		this.element = this.mElement;
		if (fc_absoluteOffsetLeft(this.dElement) < fc_absoluteOffsetLeft(this.element)) {
			this.element = this.dElement;
		}
		if (fc_absoluteOffsetLeft(this.yElement) < fc_absoluteOffsetLeft(this.element)) {
			this.element = this.yElement;
		}
		if (fc_absoluteOffsetTop(this.mElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.mElement;
		}
		if (fc_absoluteOffsetTop(this.dElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.dElement;
		}
		if (fc_absoluteOffsetTop(this.yElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.yElement;
		}

		this.mode = 2;
	}
	
	function fc_parseDate() {
		if (this.element.value) {
			this.date = new Date();
			var out = '';
			var token = '';
			var lastCh, ch;
			var start = 0;
			lastCh = this.format.substring(0, 1);
			for (i = 0; i < this.format.length; i++) {
				ch = this.format.substring(i, i+1);
				if (ch == lastCh) { 
					token += ch;
				} else {
					fc_parseToken(this.date, token, this.element.value, start);
					start += token.length;
					token = ch;
				}
				lastCh = ch;
			}
			fc_parseToken(this.date, token, this.element.value, start);

		} else {
			this.date = new Date();
		}
		if ('' + this.date.getMonth() == 'NaN') {
			this.date = new Date();
		}
	}	
	
	function fc_parseDateFields() {
		this.date = new Date();
		if (this.mElement.value) this.date.setMonth(fc_getFieldValue(this.mElement) - 1);
		if (this.dElement.value) this.date.setDate(fc_getFieldValue(this.dElement));
		if (this.yElement.value) this.date.setFullYear(fc_getFieldValue(this.yElement));
		if ('' + this.date.getMonth() == 'NaN') {
			this.date = new Date();
		}
	}
	
	function fc_setDate(d, m, y) {
		this.date.setYear(y);
		this.date.setMonth(m);
		this.date.setDate(d);
		if (this.mode == 1) {
			this.element.value = this.formatDate();
		} else {
			this.setDateFields();
		}
		this.hide();
	}
	
	function fc_setDateFields() {
		fc_setFieldValue(this.mElement, fc_zeroPad(this.date.getMonth() + 1));
		fc_setFieldValue(this.dElement, fc_zeroPad(this.date.getDate()));
		fc_setFieldValue(this.yElement, this.date.getFullYear());
	}
	
	function fc_formatDate() {
		var out = '';
		var token = '';
		var lastCh, ch;
		lastCh = this.format.substring(0, 1);
		for (i = 0; i < this.format.length; i++) {
			ch = this.format.substring(i, i+1);
			if (ch == lastCh) { 
				token += ch;
			} else {
				out += fc_formatToken(this.date, token);
				token = ch;
			}
			lastCh = ch;
		}
		out += fc_formatToken(this.date, token);
		return out;
	}
	
	function fc_show() {
		if (typeof(fc_openCal) != 'undefined') { fc_openCal.hide(); }
	
		if (this.mode == 1) {
			this.parseDate();
		} else {
			this.parseDateFields();
		}
		this.showDate = new Date(this.date.getTime());
		if (typeof(this.div) != 'undefined') {
			this.div.innerHTML = this.generateHTML();
		}
		
		if (typeof(this.div) == 'undefined') {
			this.div = document.createElement('DIV');
			this.div.style.position = 'absolute';
			this.div.style.display = 'none';
			this.div.className = 'fc_main';
			this.div.innerHTML = this.generateHTML();
			this.div.style.left = fc_absoluteOffsetLeft(this.element);
			this.div.style.top = fc_absoluteOffsetTop(this.element) + this.element.offsetHeight + 1;
			document.body.appendChild(this.div);
		}
		this.div.style.display = 'block';
		this.shown = true;
		fc_openCal = this;
	}
	
	function fc_generateHTML() {
		var html = '<TABLE><TR><TD CLASS="fc_head" COLSPAN="6"><DIV STYLE="float: right"></DIV>CALENDARIO:</TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').hide();"><B>X</B></TD></TR>';
		html += '<TR><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(-12);"><B><<</B></TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(-1);"><B><</B></TD><TD COLSPAN="3" CLASS="fc_wk">' + fc_months[this.showDate.getMonth()] + ' ' + fc_getYear(this.showDate) + '</TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(1);"><B>></B></TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(12);"><B>>></B></TD></TR>';
		html += '<TR><TD WIDTH="14%" CLASS="fc_wk">Lu</TD><TD WIDTH="14%" CLASS="fc_wk">Ma</TD><TD WIDTH="14%" CLASS="fc_wk">Mie</TD><TD WIDTH="14%" CLASS="fc_wk">Ju</TD><TD WIDTH="14%" CLASS="fc_wk">Vie</TD><TD class="fc_wknd" WIDTH="14%">Sa</TD><TD class="fc_wknd" WIDTH="14%">Do</TD></TR>';
		html += '<TR>';
		var dow = 0;
		var i, style;
		var totald = fc_monthLength(this.showDate);
		for (i = 0; i < fc_firstDOW(this.showDate); i++) {
			dow++;
			html += '<TD> </TD>';
		}
		for (i = 1; i <= totald; i++) {
			if (dow == 0) { html += '<TR>'; }
			if (this.showDate.getMonth() == this.date.getMonth() && this.showDate.getYear() == this.date.getYear() && this.date.getDate() == i) { 
				style = ' style="font-weight: bold;"';
			} else {
				style = '';
			}
			html += '<TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').setDate(' + i + ', ' + this.showDate.getMonth() + ', ' + this.showDate.getFullYear() + ');" ' + style + '>' + i + '</TD>';
			dow++;
			if (dow == 7) {
				html += '</TR>';
				dow = 0;
			}
		}
		if (dow != 0) {
			for (i = dow; i < 7; i++) {
				html += '<TD> </TD>';
			}
		}
		html +='</TR>';
		html += '</TABLE>';
		return html;
	}
	
	function fc_hide() {
		if (this.div != false) {
			this.div.style.display = 'none';
		}
		this.shown = false;
		fc_openCal = undefined;
	}
	
	function fc_moveMonth(amount) {
		var m = this.showDate.getMonth();
		var y = fc_getYear(this.showDate);
		if (amount == 1)  {
			if (m == 11)  {
				this.showDate.setMonth(0);
				this.showDate.setYear(y + 1);
			} else {
				this.showDate.setMonth(m + 1);
			}
		} else if (amount == -1)  {
			if (m == 0)  {
				this.showDate.setMonth(11);
				this.showDate.setYear(y - 1);
			} else {
				this.showDate.setMonth(m - 1);
			}
		} else if (amount == 12) {
			this.showDate.setYear(y + 1);
		} else if (amount == -12) {
			this.showDate.setYear(y - 1);
		}
		this.div.innerHTML = this.generateHTML();
	}
	
	//--Utils-------------------------------------------------------------
	function fc_absoluteOffsetTop(obj) {
     	var top = obj.offsetTop;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		top += parent.offsetTop;
     		parent = parent.offsetParent;
     	}
     	return top;
     }
     
     function fc_absoluteOffsetLeft(obj) {
     	var left = obj.offsetLeft;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		left += parent.offsetLeft;
     		parent = parent.offsetParent;
     	}
     	return left;
     }
     
     function fc_firstDOW(date) {
     	var dow = date.getDay();
     	var day = date.getDate();
 		if (day % 7 == 0) return dow;
     	return (7 + dow - (day % 7)) % 7; 
     }
     
     function fc_getYear(date) {
     	var y = date.getYear();
     	if (y > 1900) return y;
     	return 1900 + y;
     }
     
     function fc_monthLength(date) {
		var month = date.getMonth();
		var totald = 30;
		if (month == 0 
			|| month == 2
			|| month == 4
			|| month == 6
			|| month == 7
			|| month == 9
			|| month == 11) totald = 31;
		if (month == 1) {
			var year = date.getYear();
			if (year % 4 == 0 && (year % 400 == 0 || year % 100 != 0))
		 		totald = 29;
			else
				totald = 28;
		}
		return totald;
     }
     
     function fc_formatToken(date, token) {
		var command = token.substring(0, 1);
		if (command == 'y' || command == 'Y') {
			if (token.length == 2) { return fc_zeroPad(date.getFullYear() % 100); }
			if (token.length == 4) { return date.getFullYear(); } 
		}
		if (command == 'd' || command == 'D') {
			if (token.length == 2) { return fc_zeroPad(date.getDate()); }
		}
		if (command == 'm' || command == 'M') {
			if (token.length == 2) { return fc_zeroPad(date.getMonth() + 1); }
			if (token.length == 3) { return fc_months[date.getMonth()]; } 
		}
		return token;
     }
     
     function fc_parseToken(date, token, value, start) {
		var command = token.substring(0, 1);
		var v;
		if (command == 'y' || command == 'Y') {
			if (token.length == 2) { 
				v = value.substring(start, start + 2);
				if (v < 70) { date.setFullYear(2000 + parseInt(v)); } else { date.setFullYear(1900 + parseInt(v)); } 
			}
			if (token.length == 4) { v = value.substring(start, start + 4); date.setFullYear(v);} 
		}
		if (command == 'd' || command == 'D') {
			if (token.length == 2) { v = value.substring(start, start + 2); date.setDate(v); }
		}
		if (command == 'm' || command == 'M') {
			if (token.length == 2) { v = value.substring(start, start + 2); date.setMonth(v - 1); }
			if (token.length == 3) { 
				v = value.substring(start, start + 3);
				var i;
				for (i = 0; i < fc_months.length; i++) {
					if (fc_months[i].toUpperCase() == v.toUpperCase()) { date.setMonth(i); }
				}
			} 
		}
     }
     
     function fc_zeroPad(num) {
		if (num < 10) { return '0' + num; }
		return num;
     }

	function fc_getObj(id) {
		if (fc_ie) { return document.all[id]; } 
		else { return document.getElementById(id);	}
	}

      function fc_setFieldValue(field, value) {
                if (field.type.substring(0,6) == 'select') {
                        var i;
                        for (i = 0; i < field.options.length; i++) {
                                if (fc_equals(field.options[i].value, value)) {
                                        field.selectedIndex = i;
                                }
                        }
                } else {
                        field.value = value;
                }
      }

      function fc_getFieldValue(field) {
                if (field.type.substring(0,6) == 'select') {
                        return field.options[field.selectedIndex].value;
                } else {
                        return field.value;
                }
      }
      
      function fc_equals(val1, val2) {
      		if (val1 == val2) return true;      		
      		if (1 * val1 == 1 * val2) return true;
      		return false;
      }
     