/* Funciones para el manejo de opciones generales a todas las paginas
 * @autor Ing John Carlos Cardenas
 * @since 25-02-2008
 */

document.onselectstart  = new Function("return false");//Desactivar seleccion de texto en IE

//Quitar a los enlaces los puntos alrededor - Solo IE
function QuitarPuntosEnlace() 
{
    anclas=document.getElementsByTagName("a").length;
    for (i=0;i<anclas;i++)
    	document.getElementsByTagName("a").item(i).onfocus=new Function("if(this.blur)this.blur()")
} 

//Desactivar boton derecho del mouse
/*if (self.location.host != 'localhost') 
	{
		document.oncontextmenu = new Function("return false");
	}*/

/*
 * Funciones para resaltado de formularios y demas
 */
var colorIlumina		= "#E3FFAA";//verde
var colorIluminaBoton 	= "#FFFFC1";
var colorBorde		    = "#FF0000";
var bordeFormato		= "solid 3px #CCCCCC";
var ns6					= document.getElementById&&!document.all;
var previous			= '';
var eventobj;
var colorFoco			= "Lavender";

var ns6					= document.getElementById&&!document.all;
var previous			= '';
var eventobj;
var colorFoco			= "Lavender";

//Elementos que hacen parte del resaltado de formularios
var intended=/INPUT|TEXTAREA|SELECT|OPTION/;

/******************************************************
DESCRIPCION	: Determina que elemento esta activo al pasar el mouse
SALIDA 		: elemento DOM activo
PARAMETROS				
	which   : elemento DOM
******************************************************/
function checkel(which)
{
	if (which.style&&intended.test(which.tagName))
		{
			if (ns6&&eventobj.nodeType==3)
				eventobj=eventobj.parentNode.parentNode
			return true
		}
	else
		return false
}

/******************************************************
DESCRIPCION	: Aplica un color de fondo al pasar el mouse por encima y lo quita al alejarlo (cualquier elemento)
SALIDA 		: elemento resaltado
PARAMETROS				
	e   : evento del mouse
******************************************************/
function Ilumina(e)
{
	eventobj=ns6? e.target : event.srcElement

	if (previous!='')	
		{
			if (checkel(previous))
				{	
					previous.style.backgroundColor=''
					previous.style.borderColor=''
				}

			previous=eventobj
			
			if (checkel(eventobj))
				{
						eventobj.style.backgroundColor=colorIlumina
						eventobj.style.borderColor = colorBorde

				}
		
		}
	else{
			if (checkel(eventobj))
				{
						eventobj.style.backgroundColor=colorIlumina
						eventobj.style.borderColor = colorBorde
				}
				
			previous=eventobj
			
		}

}

/******************************************************
DESCRIPCION	: Aplica un color de fondo al pasar el mouse por encima y lo quita al alejarlo (elementos de formulario)
SALIDA 		: elemento resaltado
PARAMETROS				
	e   : evento del mouse
	eventoMouse : onmouseover - onmouseout
******************************************************/
function ColorBoton(e, eventoMouse)
{
	var eventObj;
	colorFondo = '';
	bordeForma = "solid 1px #CCCCCC";
	eventObj = ns6? e.target : event.srcElement
	if(eventoMouse=="over")
		{	
			colorFondo = colorIluminaBoton;
			bordeForma = "solid 1px red";
		}
/*
	if(eventObj.tagName=="INPUT" || eventObj.tagName=="TEXT" || eventObj.tagName=="SELECT" || eventObj.tagName=="TEXTAREA")
		{
			if(eventObj.type=="submit" || eventObj.type=="button")
				{
					eventObj.style.backgroundColor	=	colorFondo;
					//eventObj.style.border = bordeForma ;
				}
			else 
				{
					if(eventObj.type!="checkbox")
						{
							eventObj.style.border = bordeForma ;
						}

					eventObj.style.backgroundColor=colorFondo;
				}
		}
		
		*/
}

/******************************************************
DESCRIPCION	: coloca el cursor en una casilla y la sombrea
SALIDA 		: casilla sombreada
PARAMETROS				
	forma   : formulario al que aplica
	nombrecampo : nombre del campo del formulario al que se aplica el color de fondo y el foco
******************************************************/
function ColocarCursorCasilla(forma, nombreCampo)
{
	colorFondo = forma + "." + nombreCampo + ".style.backgroundColor = \"" + colorFoco + "\"";
	campoFoco  = forma + "." + nombreCampo + ".focus()";
	
	
	//eval(colorFondo);
	//eval(campoFoco);
}


/*
Procesos generales de validaciones, expresiones regulares, apertura de ventanas, etc.
*/
var nav4 = window.Event ? true : false;
//Detectar el navegador
	if (navigator.appName.indexOf("Netscape") != -1) {var isNN = true;}
	else{var isNN = false;}

	if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1) {var isIE = true;}
	else{var isIE = false;}

//Capturar evento
document.onkeydown  = DesactivarTeclas;

/******************************************************
DESCRIPCION	: desactiva algunas teclas del navegador
SALIDA 		: Evento anulado en IE y FIREFOX
PARAMETROS				
	e   : objeto de tipo evento
******************************************************/
function DesactivarTeclas(e)
{
	  var tecla	=0 ;
	  if (isIE)
		tecla = event.keyCode
	  else
		tecla = e.which;	

	 /* Desactivar teclas
	  * 116 = F5 Actualizar
	  * 13 = ENTER
	  * 122 = F11 Pantalla completa
	  * 8   = Retroceder
	  * 114 = F3
	  * 18  = ALT
	  * 17  = CRTL
	  * 16  = SHIFT
	  * 27  = Esc
	  * 118 = f7
	  */

	if(tecla == 116  || tecla == 118  || tecla == 18 || tecla == 27 || tecla == 114 )
		{
			if (isIE)
				window.event.keyCode = 505; 
			return false;
		}
	//alert("A la tecla pulsada le corresponde el codigo " + tecla);
}

/******************************************************
DESCRIPCION	: Verifica y convierte las entidades segun sea netscape o IE
SALIDA 		: etiquetas del navegador
PARAMETROS				
	e   : objeto
	f   : capa
******************************************************/
function getElement(e,f){
    if(document.layers){
        f=(f)?f:self;
        if(f.document.layers[e]) {
            return f.document.layers[e];
        }

        for(W=0;i<f.document.layers.length;W++) {
            return(getElement(e,fdocument.layers[W]));
        }
    }
    if(document.all) {
        return document.all[e];
    }
    return document.getElementById(e);
}


/******************************************************
DESCRIPCION	: OCULTAR CAPAS
SALIDA 		: 
PARAMETROS				
	elemento: capa a ocultar
******************************************************/
function ocultarPorId(elemento){
	if(elemento){
		document.getElementById(elemento).style.visibility='hidden';
		document.getElementById(elemento).style.display = 'none';
	}
}

/******************************************************
DESCRIPCION	: MOSTRAR CAPAS
SALIDA 		: 
PARAMETROS				
	elemento: capa a mostrar
******************************************************/
function mostrarPorId(elemento){
	if(elemento){
		document.getElementById(elemento).style.visibility='visible';
		document.getElementById(elemento).style.display = '';
	}
}

/******************************************************
DESCRIPCION	: Dado un evento y una opcion aplica un determinado patron
SALIDA 		: Elimina caracteres no contenidos dentro del patron
PARAMETROS				
	e   : Evento de teclado
	opc : Opcion que indica que patron aplicar
******************************************************/
function Valida_Dato_Numerico(e,opc)
{	
   /*PATRONES
    patron = /[a-zA-ZÑñ]/; //letras
	patron = /[a-zA-ZÑñ1234567890@.-_áéíóú;:()+*!"·$%& ]/; //caracteres y numeros
	patron = /[1234567890]/; //solo numeros 
	patron = /\D/; // No acepta números
	patron =/[A-Za-z]/; // Solo acepta letras
	patron = /\d/; // Solo acepta números
	patron = /\w/; // Acepta números y letras
	*/

   //Segun la opcion se habilita o no el espacio
   tecla = (document.all) ? e.keyCode : e.which;
   if (tecla==8 || tecla==0) return true; //Tecla de retroceso (para poder borrar) 
   switch(opc)
   	{
			case 1://Para numeros enteros en general. Solicitudes, cedulas,nit, numeros de identificacion, etc
				patron = /[1234567890-]/; //solo numeros  y lineas
				break;

			case 2://Para texto largo general
				if (tecla==32) return true; //Tecla de espacio
					patron = /[a-zA-ZÑñÁÉÍÓÚáéíóú1234567890,.()-]/; //caracteres y numeros
				break;

			case 3://Para numeros telefonicos 
				if (tecla==32) return true; //Tecla de espacio
				patron = /[EXText1234567890.-]/; 
				break;

			case 4://para campos que necesitan valores numericos de precios	
				patron = /[1234567890.,]/; //solo numeros  puntos y comas
				break;

			case 5://Para validar campos de fecha
				patron = /[1234567890-]/; //solo numeros 
				break;

			case 6://Para validar campos de nombre
				if (tecla==32) return true; //Tecla de espacio
				patron = /[a-zA-ZÑñáéíóú]/; 
				break;

			case 7://Para validar email
				patron = /[a-zA-ZÑñ1234567890@.-_]/; 
				break;	

			case 8://Para números enteros positivos
				patron = /[1234567890]/; //solo numeros enteros positivos
				break; 	

			case 9://Direcciones
				if (tecla==32) return true; //Tecla de espacio
				patron = /[a-zA-ZÑñ1234567890.()$,-ÁÉÍÓÚáéíóú]/;
				break;	

			case 10://Caracteres y números
				if (tecla==32) return true;
				patron = /[a-zA-ZÑñ1234567890ÁÉÍÓÚáéíóú]/;
				break;	
			case 11://Para numeros de identificacion(nuevo Patron)
				patron = /[1234567890]/; //solo numeros  y lineas
				break;
			case 12://Para subir archivos al servidor
				if (tecla==32) return true;
				patron = /[a-zA-Z1234567890]/; 
				break; 
			case 13://Palabras Clave
				patron = /[a-zA-ZÑñÁÉÍÓÚáéíóú-]/;
				break;
	}
    te = String.fromCharCode(tecla);
    return patron.test(te); 
}

/******************************************************
DESCRIPCION	: Valida que no se escriban mas caracteres de los permitidos en un objeto textarea
SALIDA 		: No permite la escritura de caracteres mas alla del permitido
PARAMETROS				
		objTexto	 : Campo de texto(Objeto) del formulario
		maxlong : Longitud maxima del campo
******************************************************/
function maximaLongitudTextArea(objTexto, longitudMaxima) 
{
 var valorEntrada, valorSalida;
  if (objTexto.value.length > longitudMaxima)
  {

	valorEntrada 	= objTexto.value;
	valorSalida 	= valorEntrada.substring(0, longitudMaxima);
	objTexto.value	= valorSalida;
	
	return false;
  }
  return true;
} 

/******************************************************
DESCRIPCION	: Verifica si una direccion de correo es valida
SALIDA 		: false si no es correcta   o true si lo es
PARAMETROS				
	email   : Direccion de correo a verificar
******************************************************/
function Valida_Email(email)
{

    var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
	if(emailReg.test(email)==false)
	 	{
			alert("\nDirección de correo inválida.\nP.E. sucorreo@dominio.com");
			return false;
		}

	return true;

}

/******************************************************
DESCRIPCION	: Realiza validacion sobre los campos de un formulario
SALIDA 		: Un mensaje de alerta si queda algun campo vacio o tru en caso contrario
PARAMETROS				
	forma   : Objeto de formulario con todos sus elementos

******************************************************/
function Valida_Forma_Completa(forma,boton)
{
	var variables;
	variables 	= "";
	total 		= forma.elements.length;
	for(i=0;i<total;i++)
		{
				if( forma.elements[i].value=="" )
					{
						alert("\nEl campo  * " +  forma.elements[i].name + " *  no puede estar vacio. Digite la respectiva información o seleccionela según sea el caso.");
						forma.elements[i].style.backgroundColor = colorIlumina;
						forma.elements[i].style.borderColor = colorBorde;
						forma.elements[i].focus();
						return false;
					}

			 //Se verifica la direcion de correo
				if(forma.elements[i].name=="correo" || forma.elements[i].name=="correoResponsable")
					{
						temp =  Valida_Email(forma.elements[i].value);
						if(temp==false)
							{
								forma.elements[i].focus();
								return false;
							}
					}//fin if email
		}//fin for

	/*if(confirm(" ¿ Confirma realizar la operación?  "))				
		{
				//Implementar funcion para desactivar el boton sin que se pierda su valor
				return true;
		}
	else
		return false;
	*/
		return true;
}

/******************************************************
DESCRIPCION	: Parche para simular accion de click
SALIDA 		: vacio
PARAMETROS				

******************************************************/
function On_Click()
{
//No hace nada

}

/******************************************************
DESCRIPCION	: cierra la ventana actual y recarga la ventana padre
SALIDA 		: 
PARAMETROS				
******************************************************/
function salida()
{
	window.opener.location.reload();
	window.close();
}

/******************************************************
DESCRIPCION	: Despliega o esconde un elemento html
SALIDA 		: 
PARAMETROS
	elemento 		: identificador del elemento html
******************************************************/
function Despliega_Repliega(elemento) 
{
	 if(getElement(elemento).style.display == 'none')
		getElement(elemento).style.display = 'block';
	 else
		getElement(elemento).style.display = 'none';
}


/******************************************************
DESCRIPCION	: Abre una nueva ventana
SALIDA 		:  Ventana
PARAMETROS
		tipo 		: Opcion que selecciona la pagina a abrir
		reg			: Identificador principal para la pagina a cargar
		opc 1,2,3 	: Opciones adicionales					
******************************************************/
function Nueva_Ventana(tipo,reg,opc1,opc2,opc3,modal)
{	
	var ventana;
	valor = "";

	if(modal==null) modal="";

	anchoPag 	= screen.width;
	altoPag 	= screen.height;

	//alert(anchoPag +  " "+altoPag);
	if(screen.width<=800)
		{	ancho = anchoPag-2;
			alto  = altoPag-100;
			x=0;
			y=0;
		}
	else
		{	ancho = anchoPag-80;
			alto  = altoPag-150;
			x=20;
			y=20;
		}

	switch(tipo)
		{
			case 1:// aplicativo salus
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="http://190.144.135.210/sistema_pos/";
				vent="";				
				break;
			case 2:// Correo electronico
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="http://190.144.135.210:9080";
				vent="";				
				break;	
			case 3:// sistema de gestion
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="/sistema_gestion/sigi/administracion/";
				vent="";				
				break;		
			case 4:// Pagina web
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="/sistema_gestion/pagina_web/";
				vent="";				
				break;		
			case 5:// sistema de gestion
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../publico_documento/documentos.php";
				vent="";				
				break;
			case 6:// cambiar contraseña (menu principal)
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="../admin_funcionario/funcionario_cambiar_contrasena.php";
				vent="";				
				break;
				
				case 14:// Informacion general del afiliado
				caracteristicas = "top="+ y +", left="+ x +", width=800,height=450,status=yes, scrollbars=yes";
				url ="../afiliado/afiliado_ver_detalle_afiliado.php?codigoEncriptado=" + reg;
				vent="infoGeneralAfiliado";				
				break;
			case 18:// Muestra los datos completos del contacto
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="contactenos_cambiar_estado.php?codigoEncriptado=" + reg;
				vent="EstadoContactenos";
				break;
			case 19:// Muestra los datos completos del contacto
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="contactenos_ver_detalles.php?codigoEncriptado=" + reg;
				vent="DetallesContactenos";
				break;
			case 20:// Ingresar los documentos
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=520,status=yes, scrollbars=yes";
				url ="documento_ingresar.php";
				vent="IngresaDocumento";
				break;	
			case 21:// Muestra los datos completos del documento
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="documento_detalles.php?codigoEncriptado=" + reg;
				vent="DetallesDocumento";
				break;
			case 23:// editar documento
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=520,status=yes, scrollbars=yes";
				url ="documento_editar.php?codigoEncriptado=" + reg;
				vent="VerDocumento";
				break;
			case 24:// Edita los funcionarios
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=520,status=yes, scrollbars=yes";
				url ="funcionario_editar.php?codigoEncriptado=" + reg;
				vent="EditaFuncionario";
				break;	
			case 29:// Muestra los datos completos del funcionario
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="funcionario_detalles.php?codigoEncriptado=" + reg;
				vent="DetallesFuncionario";
				break;	
			case 32:// Edita el password de los funcionarios
				caracteristicas = "top="+ y +", left="+ x +", width=650,height=310,status=yes, scrollbars=yes";
				url ="funcionario_editar_contrasena.php?codigoEncriptado=" + reg;
				vent="EditaFuncionarioPassword";
				break;
			case 33:// Ingresa nuevos cargos
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=320,status=yes, scrollbars=yes";
				url ="funcionario_cargo_ingresar.php?identificacionCargoEncriptada=" + reg;
				vent="IngreaCargo";
				break;
			case 34:// Agrega Nuevos departamentos
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=280,status=yes, scrollbars=yes";
				url ="funcionario_departamentos_ingresar.php";
				vent="IngresaDepartamento";
				break;
			case 35:// Ingresar los funcionarios
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=520,status=yes, scrollbars=yes";
				url ="funcionario_ingresar.php";
				vent="IngresaFuncionario";
				break;	
			case 36://Modulos para asignar permisos a funcionarios por cargos
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=450,status=yes, scrollbars=yes";
				url ="funcionario_permisos.php?identificacionCargoEncriptada=" + reg;
				vent="ModulosPermisos";
				break;
			case 72://Cambio de estado de solicitudes
				caracteristicas = "top="+ y +", left="+ x +", width=700, height=420 ,status=yes, scrollbars=yes";
				url ="../admin_atencion_cliente/solicitud_cambio_estado.php?solicitudNumero="+reg;
				vent="solicitudCambioEstado";				
				break;	
			case 73://Detalle  solicitud
				caracteristicas = "top="+ y +", left="+ x +", width=700, height=400 ,status=yes, scrollbars=yes";
				url ="../admin_atencion_cliente/solicitud_detalle.php?solicitudNumero="+reg;
				vent="solicitudDetalle";				
				break;	
			case 74://Ingreso de solicitudes
				caracteristicas = "top="+ y +", left="+ x +", width=810, height=500 ,status=yes, scrollbars=yes";
				url ="../admin_atencion_cliente/solicitud_ingresar.php?cargarEmergente=true";
				vent="solicitudIngresar";				
				break;	
			case 80://Cambio de estado de solicitudes
				caracteristicas = "top="+ y +", left="+ x +", width=700, height=420 ,status=yes, scrollbars=yes";
				url ="../admin_atencion_cliente/solicitud_editar_respuesta.php?solicitudNumero="+reg;
				vent="solicitudCambioEstado";				
				break;
			case 107://Ingreso de asuntos internos
				caracteristicas = "top="+ y +", left="+ x +", width=810, height=500 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_ingresar.php?cargarEmergente=true";
				vent="AsuntoInternoIngresar";				
			break;	
			case 108://Ingreso del detalle asuntos internos
				caracteristicas = "top="+ y +", left="+ x +", width=810, height=500 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_ingresar_detalle.php?codigoAsunto="+reg+"&codigoAsuntoDetalle="+opc1;
				vent="AsuntoInternoIngresarDetalle";				
			break;
			case 109://Cerrar asunto interno
				caracteristicas = "top="+ y +", left="+ x +", width=810, height=500 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_cerrar.php?codigoAsunto="+reg+"&codigoAsuntoDetalle="+opc1;
				vent="AsuntoInternoCerrar";				
			break;
			case 110://adjuntar documento a asunto interno
				caracteristicas = "top="+ y +", left="+ x +", width=810, height=500 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_ingresar_documento.php?codigoAsunto="+reg;
				vent="AsuntoInternoIngresarDoc";				
			break;
			case 111://datos completos asunto
				caracteristicas = "top="+ y +", left="+ x +", width=800, height=600 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_informacion.php?codigoAsunto="+reg+"&codigoAsuntoDetalle="+opc1;
				vent="AsuntoInternoDatosCompletos";				
			break;
			case 112://Ver detalle de asunto
				caracteristicas = "top="+ y +", left="+ x +", width=600, height=400 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_detalle.php?codigoAsuntoDetalle="+reg;
				vent="AsuntoInternoVerDetalle";				
			break;
			case 113://Ver documento asunto
				caracteristicas = "top="+ y +", left="+ x +", width=500, height=400 ,status=yes, scrollbars=yes";
				url ="../admin_asuntos_internos/asunto_interno_ver_documento.php?nombre="+reg+"&extension="+opc1;
				vent="AsuntoInternoVerDetalle";				
			break;
			case 114://Empleador detalle de planilla
				caracteristicas = "top="+ y +", left="+ x +", width=800, height=400 ,status=yes, scrollbars=yes";
				url ="../empleador_privado/empleador_detalle_planilla.php?codigoEncriptado="+reg;
				vent="DetallePlantilla";				
			break;
			case 115://Empleador Listar aportes
				caracteristicas = "top="+ y +", left="+ x +", width=880, height=700 ,status=yes, scrollbars=yes";
				url ="../empleador_privado/empleador_listar_aportes.php?codigoEncriptado="+reg;
				vent="AportesPlanilla";				
			break;
			case 116://Afiliado ver detalle Aportes
				caracteristicas = "top="+ y +", left="+ x +", width=490, height=450 ,status=yes, scrollbars=yes";
				url ="../afiliado/afiliado_detalle_aporte.php?codigoEncriptado="+reg;
				vent="AfiliadoDetallePlantilla";
			break;
			case 117:// Buscar Actividad economica
				caracteristicas = "top="+ y +", left="+ x +", width=500,height=450,status=yes, scrollbars=yes";
				if(opc1!=null)
					campoAdicional = "&cualCampo2=" + opc1;
				else
					campoAdicional = "";
	
				if(opc2!=null)
					salud = "&mostrarSalud=" + opc2;	
				else
					salud = "";

				url ="../administracion/actividad_economica.php?cualCampo=" + reg + campoAdicional + salud;
				vent="BuscarActividad";				
			break;
			case 118://Ciudad ver listado
				caracteristicas = "top="+ y +", left="+ x +", width=500,height=450 ,status=yes, scrollbars=yes";
				url ="../administracion/ciudad_departamento_listado.php?cualCampo="+reg;
				vent="ListadoCiudadDepartamento";
			break;
			case 119://Afiliado ver listado de aportes
				caracteristicas = "top="+ y +", left="+ x +", width=600,height=450 ,status=yes, scrollbars=yes";
				url ="../afiliado/afiliado_aporte.php?codigoEncriptado="+reg;
				vent="ListadoAportes";
			break;
			case 120://pdfs 
				caracteristicas = "";
				url = reg;
				vent="paginaNueva";
			break;
			case 121:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="http://190.144.135.210/sistema_gestion/sigi";
				vent="";			
			break;
			case 122:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/cartilla-DocNewsNo18045DocumentNo9687.pdf";
				vent="";			
			break;
			case 123:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/afiche1-DocNewsNo18045DocumentNo9688.pdf";
				vent="";			
			break;
			case 124:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/afiche-2DocNewsNo18045DocumentNo9689.pdf";
				vent="";			
			break;
			case 125:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/volante-DocNewsNo18045DocumentNo9696.pdf";
				vent="";			
			break;
			case 126:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACTA 06 FINAL BOGOTA 26 AGOSTO.pdf";
				vent="";			
			break;
			case 127:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACTA 06 FINALMONTERIA AGOSTO 26.pdf";
				vent="";			
			break;
			case 128:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACTA 09 CARTAGENAFINAL AGOSTO 26.pdf";
				vent="";			
			break;
			case 129:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="http://190.144.135.210/sistema_pos_prueba/";
				vent="";				
			break;
			case 130:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACTA07-FINAL-BOGOTA-SEPTIEMBRE.pdf";
				vent="";			
			break;
			case 131:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/Acta-07-fina-MONTERIA-SEPTIEMBRE.pdf";
				vent="";			
			break;
			case 132:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACTA-10-SEPTIEMBREFINAL.pdf";
				vent="";			
			break;
			case 133:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/Convocatoria_20_OCTUBRETO.pdf";
				vent="";			
			break;
			case 134:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACT-08-FINAL-BOGOTA-OCTUBRE.pdf";
				vent="";			
			break;
			case 135:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACT-08-FINAL-MONTERIA-OCTUBRE.pdf";
				vent="";			
			break;
			case 136:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=no, scrollbars=yes, resizable=yes";
				url ="../archivos_usuario/ACT-11-FINAL-CARTAGENA-OCTUBRE.pdf";
				vent="";			
			break;			
			case 137:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../index/producto.php";
				vent="";				
			break;
			case 138:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-09-FINAL-BOGOTA-NOVIEMBRE.pdf";
				vent="";				
			break;
			case 139:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-12-CARTAGENA-NOVIEMBRE.pdf";
				vent="";				
			break;
			case 140:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../CajaHerramientas_ah1n1/cajaAh1n1.html";
				vent="";				
			break;
			case 141:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-11-FINAL-BOGOTA-ENERO-2010.pdf";
				vent="";				
			break;
			case 142:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-15-CARTAGENA-FEBRERO-2010.pdf";
				vent="";				
			break;
			case 143:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-12-BOGOTA-FEBRERO-2010.pdf";
				vent="";				
			break;
			case 144:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-13-BOGOTA-MARZO-2010.pdf";
				vent="";				
			break;
			case 145:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-16-CARTAGENA-MARZO-2010.pdf";
				vent="";				
			break;
			case 146:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-13-FINAL-MONTERIA-MARZO.pdf";
				vent="";				
			break;
			case 147:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-11-FINAL-BARRANQUILLA-MARZO.pdf";
				vent="";				
			break;
			case 148:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/SAR/AnexN5SARparaIPS.ppt";
				vent="";				
			break;
			case 149:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/SAR/CapacitaciongeneralSAR.ppt";
				vent="";				
			break;
			case 150:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/SAR/CapacitacionLideresSAR.ppt";
				vent="";				
			break;
			case 151:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/SAR/CapacitacionRiesgosenSalud.ppt";
				vent="";				
			break;
			case 152:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/SAR/DocNewsNo17473DocumentNo11795.pdf";
				vent="";				
			break;
			case 153:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-14-BOGOTA-ABRIL-2010.pdf";
				vent="";				
			break;
			case 154:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-17-CARTAGENA-ABRIL-2010.pdf";
				vent="";				
			break;
			case 155:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-12-BARRANQUILLA-ABRIL-2010.pdf";
				vent="";				
			break;
			case 156:// Informacion general del afiliado
				caracteristicas = "top="+ y +", left="+ x +", width=800,height=450,status=yes, scrollbars=yes";
				url ="../empleador_privado/empleador_ver_beneficiarios_empleador.php?codigoEncriptado=" + reg;
				vent="infoBeneficiarioEmpleador";				
				break;
			case 157:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-13-BARRANQUILLA-MAYO-2010.pdf";
				vent="";				
			break;
			case 158:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-15-BOGOTA-MAYO-2010.pdf";
				vent="";				
			break;
			case 159:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/PLANIFICACIONFAMILIAR.pdf";
				vent="";				
			break;
			case 160:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-16-BOGOTA-JUNIO-2010.pdf";
				vent="";				
			break;
			case 161:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-14-BARRANQUILLA-JUNIO-2010.pdf";
				vent="";				
			break;
			case 162:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-16-MONTERIA-JUNIO-2010.pdf";
				vent="";				
			break;
			case 163:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/DENGUE.pdf";
				vent="";				
			break;
			case 164:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-17-MONTERIA-JULIO-2010.pdf";
				vent="";				
			break;
			case 165:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-17-BOGOTA-JULIO-2010.pdf";
				vent="";				
			break;
			case 166:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-15-BARRANQUILLA-JULIO-2010.pdf";
				vent="";				
			break;
			case 167:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-18-BOGOTA-AGOSTO-2010.pdf";
				vent="";				
			break;
			case 168:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-16-BARRANQUILLA-AGOSTO-2010.pdf";
				vent="";				
			break;
			case 169:
				caracteristicas = "top="+ y +", left="+ x +", width=" + anchoPag + ",height=" + altoPag + ",status=yes, scrollbars=yes, resizable = yes";
				url ="../archivos_usuario/ACTA-18-MONTERIA-AGOSTO-2010.pdf";
				vent="";				
			break;
   		}
	if(url!="")
	{	
		ventana = window.open(url,vent,caracteristicas);
		ventana.focus();
	}
	else
		alert("Dirección destino desconocida.");

}

/******************************************************
DESCRIPCION	: Carga una pagina en el navegador sin ningun tipo de aviso
SALIDA 		: Pagina cargada en el navegador web
PARAMETROS				
	url     : direccion url a cargar en el navegador
******************************************************/
function Actualizar_Pagina(url, msg)
{
	if(url!=null && url!="")
		{
			if(msg!=null && msg!="")
				{
					if(confirm(msg))
						document.location.href = url;
				}
			else	
				document.location.href = url;
		}
	else
		alert("La operación no es posible.");
}

/******************************************************
DESCRIPCION	: Dada una url y un mensaje, visualiza una ventana de confirma para cargar una pagina nueva
SALIDA 		: Pagina nueva cargada en el navegador
PARAMETROS				
	url   : Direccion a cargar en ele navegador
	msg   : Mensaje visualizado en el confirm
******************************************************/
function Cargar_Nueva_Pagina(url, msg)
{
	if(url!=null && url!="")
		{
				if(msg==null || msg=="")
					msg = " ¿ Esta seguro de finalizar el proceso actual ? ";
				if(confirm(msg))
					location.href = url;
		}
	else
		alert("La acción no se puede realizar.");
}
/******************************************************
DESCRIPCION	: Realiza validacion sobre los campos de un formulario
SALIDA 		: Un mensaje de alerta si queda algun campo vacio o tru en caso contrario
PARAMETROS				
	forma   : Objeto de formulario con todos sus elementos

******************************************************/
function Valida_Forma_Completa_Busqueda(forma,boton)
{
	var variables;
	variables 	= "";
	total 		= forma.elements.length;
	for(i=0;i<total;i++)
		{
				if( forma.elements[i].value=="" &&  forma.elements[i].name!="funcionario")
					{
						alert("\nEl campo  * " +  forma.elements[i].name + " *  no puede estar vacio. Digite la respectiva información o seleccionela según sea el caso.");
						forma.elements[i].style.backgroundColor = colorIlumina;
						forma.elements[i].style.borderColor = colorBorde;
						forma.elements[i].focus();
						return false;
					}

			 //Se verifica la direcion de correo
				if(forma.elements[i].name=="correo" || forma.elements[i].name=="correoResponsable")
					{
						temp =  Valida_Email(forma.elements[i].value);
						if(temp==false)
							{
								forma.elements[i].focus();
								return false;
							}
					}//fin if email
		}//fin for

	if(confirm(" ¿ Confirma realizar la operación?  "))				
		{
				//Implementar funcion para desactivar el boton sin que se pierda su valor
				return true;
		}
	else
		return false;
}


function Completa_Checks(forma, opc)
{
    var variables;
	variables 	= "";
	total 		= forma.elements.length;
	for(i=0;i<total-1;i++)
		{
			forma.elements[i].checked = opc;
			forma.elements[i].checked;
		}
}


//Validar  fechas
function esDigito(sChr){
    var sCod = sChr.charCodeAt(0);
    return ((sCod > 47) && (sCod < 58));
   }
function valSep(oTxt){
    var bOk = false;
    var sep1 = oTxt.value.charAt(2);
    var sep2 = oTxt.value.charAt(5);
    bOk = bOk || ((sep1 == "-") && (sep2 == "-"));
    bOk = bOk || ((sep1 == "/") && (sep2 == "/"));
    return bOk;
   }
function finMes(oTxt){
    var nMes = parseInt(oTxt.value.substr(3, 2), 10);
    var nAno = parseInt(oTxt.value.substr(6), 10);
    var nRes = 0;
    switch (nMes){
     case 1: nRes = 31; break;
     case 2: nRes = 28; break;
     case 3: nRes = 31; break;
     case 4: nRes = 30; break;
     case 5: nRes = 31; break;
     case 6: nRes = 30; break;
     case 7: nRes = 31; break;
     case 8: nRes = 31; break;
     case 9: nRes = 30; break;
     case 10: nRes = 31; break;
     case 11: nRes = 30; break;
     case 12: nRes = 31; break;
    }
    return nRes + (((nMes == 2) && (nAno % 4) == 0)? 1: 0);
   }
function valDia(oTxt){
    var bOk = false;
    var nDia = parseInt(oTxt.value.substr(0, 2), 10);
    bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt)));
    return bOk;
   }
function valMes(oTxt){
    var bOk = false;
    var nMes = parseInt(oTxt.value.substr(3, 2), 10);
    bOk = bOk || ((nMes >= 1) && (nMes <= 12));
    return bOk;
   }
function valAno(oTxt){
    var bOk = true;
    var nAno = oTxt.value.substr(6);
    bOk = bOk && ((nAno.length == 2) || (nAno.length == 4));
    if (bOk){
     for (var i = 0; i < nAno.length; i++){
      bOk = bOk && esDigito(nAno.charAt(i));
     }
    }
    return bOk;
   }
function valFecha(oTxt){
	//alert(oTxt); 
    var bOk = true;
    if (oTxt.value != ""){
     bOk = bOk && (valAno(oTxt));
     bOk = bOk && (valMes(oTxt));
     bOk = bOk && (valDia(oTxt));
     bOk = bOk && (valSep(oTxt));
     if (!bOk){
		  alert("Fecha inválida. Formato : dia-mes-año");
		  oTxt.value = "";
		  oTxt.focus();
     	}//fin bad
	//Comprobar que la fecha no sea mayor al dia de hoy
	hoy = new Date();
	var arrayFecha = oTxt.value.split("-");
	nuevaFecha = arrayFecha[1] + "-" +  arrayFecha[0] +  "-" +  arrayFecha[2];
	nuevaFecha = new Date(nuevaFecha);
	//si la diferencia de dias es menor a cero, la fecha es mayor a hoy
	//Ojo depende de la fecha del sistema en el pc local
	if( DifDate(nuevaFecha, hoy)<0 )
		{
				//alert("ERROR. La fecha no puede ser mayor al dia de hoy.");
				//oTxt.value = "";
		 		//oTxt.focus();
		}
	//else alert("Fecha correcta");
    }//fin if verifica
}//fin funcion 


//Retorna el numero de dias de diferencia entre dos fechas
function DifDate(f1, f2)
{
	var resta = f2.getTime() - f1.getTime() ;
	return (Math.floor(resta / (1000 * 60 * 60 * 24)));
}

//Retorna un indicado valor a un campo indicado en la ventana origen.
function Carga_Valor_Campo(campoTexto, codigo, texto)
{
		if(campoTexto!=null)
			{
					eval("window.opener.document.forms[0]." + campoTexto + ".value = codigo;");
					//Cerrar la ventana
					self.close();
			}
}

function RecargarMenuCiudades(forma)
{
	
	if (document.getElementById('menuEspecialidad')!= null)
	{
		document.getElementById('menuEspecialidad').value  = "";
	}
	forma.submit();
}

function Recargar(forma)
{
	forma.submit(); 
}