
   function eliminarElementosLista( objetoForma, objetoSeleccionado, nombreEvento, objetoEliminados, expresionAnexa){
    var dml   = objetoForma;
    var elementosPorEliminar = "";
    
    
    if (typeof(objetoSeleccionado) == "undefined" ){
      alert("No hay registros. Verifique e intente de nuevo");
      return;
    }
  
    if( typeof(objetoSeleccionado.length) == "undefined"){
      if (objetoSeleccionado.checked)
        elementosPorEliminar = objetoSeleccionado.value + "|";
    }
  
    for (i=0;i<objetoSeleccionado.length; i++){
      if (objetoSeleccionado[i].checked){
       elementosPorEliminar += objetoSeleccionado[i].value + "|";
      }
    }
    
    if (elementosPorEliminar == ""){
      alert("No hay elementos a eliminar. Verifique e intente de nuevo");
      return;
    }else{
    
      if (confirm("Está seguro que desea borrar el(los) elemento(es) seleccionado(s)?")){
        objetoEliminados.value = elementosPorEliminar;
        dml.event.value = nombreEvento;
        if (expresionAnexa != "")
          eval(expresionAnexa);
        dml.submit();
      }else{
        if( typeof(objetoSeleccionado.length) == "undefined"){
          if (objetoSeleccionado.checked)
            objetoSeleccionado.checked = false;
        }
        for (i=0;i< objetoSeleccionado.length; i++){
          if (objetoSeleccionado[i].checked){
           objetoSeleccionado[i].checked = false;
          }
        }
      }
    }
  }

  /**
   * Método que devuelve el valor seleccionado de un objeto
   * de tipo <SELECT...> y de un objeto de tirpo <INPUT type='RADIO'...>
   */
  function obtenerValorDeSelectRadio(objeto){
  
    var valorSeleccion = "";
    
    if (objeto.type == 'radio'){
        return objeto.value;
    }else{
      //Si es un select
      if (objeto.type == 'select-one'){
        return objeto.options[objeto.selectedIndex].value;
      }
    }
    
    return valorSeleccion;
  }

 
  /**
  * Método que permite obtener un objeto fecha a partir de una cadena que
  * represente la fecha en el formato dd/mm/yyyy
  */
  function obtenerDateFromString(cadenaFecha){
        
    //Cambio realizado el 11/09/2003. Solucion obtenida en: http://www.merlyn.demon.co.uk/js-date4.htm
    S = cadenaFecha;
    S = S.replace(/(\d+).(\d+).(\d+)/, '$3/$2/$1');
    S = S.replace(/^(\d\d)\//, '20$1/');
    fecha = new Date(S);
    
    return fecha;
  }
  

  /**
  * Método que permite cargar los Consultores RRHH asociados al DPTO
  */
  function buscarConsultoresRRHH(campoCedula, campoNombre){
    mostrarVentanaBase("consultores", 'Controlador?event=BUSCAR_CONSULTOR_RRHH&campoNombre='+ campoNombre
        + '&campoCedula='+campoCedula);
  }

  /**
  * Método que permite cargar los Cargos de acuerdo a un patron de busquedas
  */
  function buscarCargos(campoCodigo, campoDescripcion, patron){
    mostrarVentanaBase("cargos", 'Controlador?event=BUSCAR_CARGOS&campoDescripcion='+ campoDescripcion
        + '&campoCodigo='+campoCodigo + '&patron='+patron);
  }

  /**
  * Método que permite cargar los supervisados del usuario obtenidos del LDAP  
  */
  function buscarSupervisados(campoNombre, campoCargo){
    mostrarVentanaBase("supervisados", 'Controlador?event=BUSCAR_SUSTITUIDO&campoNombre='+ campoNombre
        + '&campoCargo='+campoCargo);
  }
  
  /**
  * Método que permite cargar los Supervisores del usuario obtenidos del LDAP  
  */
  function buscarSupervisores(campoNombre, campoCargo){
    mostrarVentanaBase("supervisores", 'Controlador?event=BUSCAR_SUPERVISOR&campoNombre='+ campoNombre
        + '&campoCargo='+campoCargo);
  }
  
  /**
  * Método que permite dibujar una ventana flotante para mostrar la solicitud
  */
  function mostrarSolicitud(destinoVentana){
     var nuAlto  = 500;
     var nuAncho = 700;
     var leftPosition = 0;
     var topPosition  = 0;  

     abrirVentanaBase('solicitud', destinoVentana, nuAlto, nuAncho, leftPosition, topPosition);
  }
  
  /**
  * Método que permite cargar los Supervisores del usuario obtenidos del LDAP  
  */
  function buscarFlujosSolicitud(ticket){
     var nuAlto  = 200;
     var nuAncho = 500;
     var leftPosition = 100;
     var topPosition  = 100;  

     abrirVentanaBase('flujos', 'Controlador?event=LISTAR_FLUJOS_SOLICITUD&ticket='+ticket, nuAlto, nuAncho, leftPosition, topPosition);
  }
  
  function buscarDatosDelCandidato(elemento, detalle, ticket, tarea){
     var nuAlto  = 350;
     var nuAncho = 600;
     var leftPosition = 100;
     var topPosition  = 100;  

     abrirVentanaBase('candidato', 'Controlador?event=BUSCAR_DATOS_CANDIDATO&ticket='+ticket+"&elemento="+elemento+"&detalle="+detalle+"&tarea="+tarea, nuAlto, nuAncho, leftPosition, topPosition);
    
    }


  function buscarDatosDeTicketTarea(ticket, tarea){
     var nuAlto  = 350;
     var nuAncho = 600;
     var leftPosition = 100;
     var topPosition  = 100;  

     abrirVentanaBase('ticketTarea', 'Controlador?event=BUSCAR_DATOS_SOLICITUD_TAREA&ticket='+ticket+"&elemento="+elemento+"&detalle="+detalle+"&tarea="+tarea, nuAlto, nuAncho, leftPosition, topPosition);
    
    }


  
  /**
  * Método que permite dibujar una ventana flotante para mostrar datos
  */
  function mostrarVentanaBase(nombreVentana, destinoVentana){
     var nuAlto  = 300;
     var nuAncho = 400;
     var leftPosition = (screen.width) ? (screen.width-nuAncho)/2 : 0;
     var topPosition  = (screen.height) ? (screen.height-nuAlto)/2 : 0;  
     
     abrirVentanaBase(nombreVentana, destinoVentana, nuAlto, nuAncho, leftPosition, topPosition);
  }


  /**
  * Método que ejecuta un evento a traves de JS
  */
  function ejecutarEvento(evento){
    document.location.href = evento;
  }

  /**
  * Método que ejecuta un evento a traves de JS
  */
  function ejecutarEventoConCapa(evento){
    document.location.href = evento;
    //habilitarSeccion("CapaEspera");
  }

  /**
  * Método que permite dibujar una ventana flotante para mostrar datos
  */
  function abrirVentanaBase(nombreVentana, destinoVentana, nuAlto, nuAncho, leftPosition, topPosition){
     
     ventana = window.open(destinoVentana, nombreVentana,
        'titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height='+nuAlto+',width='+nuAncho+',left='+leftPosition+',top='+topPosition); 
     ventana.focus();
  }


  /**
  * Metodo encargado de mostrar un calendario
  * @param: t_name
  * @param: month
  * @param: year
  */
  function showCalendar(t_name, month, year) {
    window.open('/hex/jsp/util/calendar.jsp?p_name=' + t_name + '&p_month=' + month + '&p_year=' + year, 'Calendar', 'width=225, height=215, top=200, left=200, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, titlebar=no, toolbar=no');
  }


  /**
  * Metodo encargado de mostrar un fragmento de cofigo html de manera dinamica
  * @param: spanNombre
  * @param: spanValor
  */
	function ponSpan(spanNombre, spanValor){
		if( document.all ) {
			if( document.all['' +spanNombre +''] ) {
				document.all['' +spanNombre +''].innerHTML = '' +spanValor +'';
			}
		}
	}

  /**
  * Metodo encargado de ejecutar la accion de guardar/enviar la solicitud
  * @param: tipoEnvio
  */
  function enviarSolicitud(tipoEnvio){
    if ( enviarSolicitudForma("document.f_forma", tipoEnvio)){
      anularBotonesSolicitud();
      //habilitarSeccion("CapaEspera");
    }
  }
  
  /**
  * Metodo encargado anular los botones existentes en la pantalla de solicitud
  */
  function anularBotonesSolicitud(){
      //Desactiar los botones de la parte inferior de la solicitud
      //y asi evitar que se pulse el botón varias veces
      if (typeof(eval("document.f_forma.bt_guardar")) != "undefined" )
        eval("document.f_forma.bt_guardar.disabled = true;")

      if (typeof(eval("document.f_forma.bt_enviar")) != "undefined" )
        eval("document.f_forma.bt_enviar.disabled = true;")
      
      if (typeof(eval("document.f_forma.bt_copiar")) != "undefined" )
        eval("document.f_forma.bt_copiar.disabled = true;")
      
      if (typeof(eval("document.f_forma.bt_anular")) != "undefined" )
        eval("document.f_forma.bt_anular.disabled = true;")
      
  }
  
  /**
  * Metodo encargado de dar foco a un objeto.
  * @param: objeto
  */
  function darFoco(objeto){
    //objeto.select();
    objeto.focus();
  }
  
 
  /**
  * Metodo encargado de ejecutar la accion de guardar/enviar la solicitud
  * @param: forma
  * @param: tipoEnvio
  */
  function enviarSolicitudForma(forma, tipoEnvio){
    if(tipoEnvio == "E"){
      if (confirm("Está seguro que desea GUARDAR y ENVIAR la Solicitud?")){
        actualizarObjetoHtml( forma, "envioSolicitud", "E", true );
        return true;
      }
    }
    if(tipoEnvio == "G"){
      if (confirm("Está seguro que desea GUARDAR la Solicitud?")){
        actualizarObjetoHtml( forma, "envioSolicitud", "G", true );
        return true;
      }
    }
  }
  
  
  /**
  * Metodo encargado de ejecutar la accion de anular la solicitud
  * @param: ticket
  */
  function anularSolicitud(ticket){
    if (confirm("Está seguro que desea Anular la Solicitud No.: " + ticket +  "?")){
        //Cambia el evento para hacer el submit
        //actualizarObjetoHtml( "document.f_forma", "enctype", "application/x-www-form-urlencoded", true );
        //eval("document.f_forma.enctype = 'application/x-www-form-urlencoded'");
        
        //Se cambia el Controlador para anular la solicitud
        //actualizarObjetoHtml( "document.f_forma", "action", "Controlador", true );        
        //eval("document.f_forma.action = 'Controlador'");
        
        anularBotonesSolicitud();
        actualizarObjetoHtml( "document.f_forma", "event", "ANULAR_SOLICITUD", true );
        return true;
    }
  }

  /**
  * Metodo encargado de ejecutar la accion de COPIAR o CLONAR la solicitud
  * @param: ticket
  */
  function copiarSolicitud(){
    if (confirm("Está seguro que desea Copiar la Solicitud actual?")){
        //Cambia el evento para hacer el submit
        //actualizarObjetoHtml( "document.f_forma", "enctype", "application/x-www-form-urlencoded", true );
        //eval("document.f_forma.enctype = 'application/x-www-form-urlencoded'");
        
        //Se cambia el Controlador para anular la solicitud
        //actualizarObjetoHtml( "document.f_forma", "action", "Controlador", true );        
        //eval("document.f_forma.action = 'Controlador'");
        
        anularBotonesSolicitud();
        actualizarObjetoHtml( "document.f_forma", "event", "CLONAR_SOLICITUD", true );
        return true;
    }
  }
 // 
  function copiarBorrador(ticket){

        //  myAddress=java.net.InetAddress.getLocalHost(); 
        //  myAddress2=java.net.InetAddress.getLocalHost(); 
        //  host=myAddress.getHostName(); 
        //  ip=myAddress2.getHostAddress();  
     //alert(" there ");
       var evento="";
    if (confirm("Está seguro que desea Guardar como Borrador?13")){
        //Cambia el evento para hacer el submit
        //actualizarObjetoHtml( "document.f_forma", "enctype", "application/x-www-form-urlencoded", true );
        //eval("document.f_forma.enctype = 'application/x-www-form-urlencoded'");
        
        //Se cambia el Controlador para anular la solicitud
        //actualizarObjetoHtml( "document.f_forma", "action", "Controlador", true );        
        //eval("document.f_forma.action = 'Controlador'");
        //forma = document.forms[0].; 
         
          //window.onerror=null; 
          //myAddress=java.net.InetAddress.getLocalHost(); 
          //myAddress2=java.net.InetAddress.getLocalHost(); 
          //host=myAddress.getHostName(); 
          //ip=myAddress2.getHostAddress();
        evento=document.forms[0].event.value;
        alert(" evento "+evento);        
        document.forms[0].nombreAnexo.value = document.forms[0].curriculo.value;                        
        //document.forms[0].ipAddress.value = ("ip" + " \\ " + "nombre_maquina");
        //anularBotonesSolicitud();
       if (ticket =="")
       {
        alert(" voy a clonar ");
        //obtenerNombreComputador();
        actualizarObjetoHtml( "document.f_forma", "event", "CLONAR_SOLICITUD", true );       
       }
       else
       {
        alert(" voy actualizar ");       
        actualizarObjetoHtml( "document.f_forma", "event", evento, true );              
       }
        return true;
    }
  }

  
  /**
  * Metodo encargado de actualizar un objeto html con un valor, 
  * ademas hacer submit a la forma
  * @param: forma
  * @param: objeto
  * @param: valor
  * @param: hacerSubmit
  */
  function actualizarObjetoHtml( forma, objeto, valor, hacerSubmit ){
        eval( forma +"." + objeto + ".value=\"" + valor + "\";" );
        
        if (hacerSubmit){
          ejecutarSubmit( forma );
        }
  }

  /**
  * Metodo encargado de ejecutar el submit a una forma
  * @param: forma
  */
  function ejecutarSubmit( forma ){
    eval( forma + ".submit();");
    return;
  }

  /**
  * Funcion para validar que se haya seleccionado un elemento en la lista (SELECT)
  * @param: select, mensaje, forma
  */
  function validarSelect( campoSelect, mensaje ){

    if (existeCampoEnForma(campoSelect)){
    
      select = campoSelect.name;

      if ( campoSelect.options.length == 0 || 
            campoSelect.options[campoSelect.selectedIndex].value == "" )  {
          alert("Debe seleccionar: [" + mensaje + "]");
          campoSelect.focus();
          return false;
      }
    }

    return true;
  }


  /**
  * Funcion para validar que un campo de texto (input) no este vacio
  * @param: formulario
  * @param: campoTexto
  * @param: mensaje
  */
  function validarCampoString( campoTexto, mensaje ){
  
    if (existeCampoEnForma(campoTexto)){
    
      forma = campoTexto.form.name;
      campo = campoTexto.name;
      var valorAjustado = trim(campoTexto.value);
       
      if ( valorAjustado == "" || valorAjustado.length == 0 ) {
        alert(mensaje);
        campoTexto.value = '';
        campoTexto.select();
        campoTexto.focus();
        return false;
      }    
    
    }
    return true;
  }
  
  /**
  * Funcion para verificar si existe un objeto en un formulario
  * @param: objeto
  */
  function existeCampoEnForma(objeto){
    if (typeof(objeto) != "undefined" ){
      return true;
    }
    return false;
  }

  /**
  * Funcion para devolver el valor indice de un Select
  * @param: select, valor
  */
  function obtenerIndiceSelect( select, valor ){
    indice = 0;
    for (i = 0; (i < eval(select + ".length") ); i++) {
      item  = eval(select + ".options[li_i].value");
      if ( item.toUpperCase() == valor.toUpperCase() ){
        indice = i;
        break;
      }
    }      
    return indice;
  }
  
  /**
  * Funcion para borrar los elementos de un SELECT
  * @param: combo, long_combo
  */
  function borrarCombo(combo, long_combo){
    for(i=0;i < long_combo; i++){
      eval(combo);
    }
  }
  
  /**
  * Metodo encargado de sustituir los caracteres especiales presentes en los objetos
  * que existan en una forma.
  * @param: forma
  */
  function reemplazaEnSubmit(forma){
    // Esto es para traducir los acentos en CV
    // http://www.flws.com.au/showusyourcode/codeLib/code/js_StringsReplace.asp?catID=2
    // http://www.programacion.com/html/tutorial.js.16.html
    for (var i = 0; i < forma.length; i++){
      // Nos paramos en el elemento actual de la forma
      var eleact = forma.elements[i];
      
      eleact.value = reemplazoCaracter(eleact.value);
    }
    form.submit();
  }
  
  /**
  * Metodo encargado de sustituir los caracteres especiales presentes en los objetos
  * que existan en una forma.
  * @param: value
  */
  function reemplazoCaracter(value){

    // Cambiamos cada uno de los string que van a dar problemas.
    
/*   
    var re = new RegExp ('Á', 'g') ;
    value = value.replace(re, '&Aacute;') ;
    re = new RegExp ('É', 'g') ;
    value = value.replace(re, '&Eacute;') ;
    re = new RegExp ('Í', 'g') ;
    value = value.replace(re, '&Iacute;') ;
    re = new RegExp ('Ó', 'g') ;
    value = value.replace(re, '&Oacute;') ;
    re = new RegExp ('Ú', 'g') ;
    value = value.replace(re, '&Uacute;') ;
    
    re = new RegExp ('á', 'g') ;
    value = value.replace(re, '&aacute;') ;
    re = new RegExp ('é', 'g') ;
    value = value.replace(re, '&eacute;') ;
    re = new RegExp ('í', 'g') ;
    value = value.replace(re, '&iacute;') ;
    re = new RegExp ('ó', 'g') ;
    value = value.replace(re, '&oacute;') ;
    re = new RegExp ('ú', 'g') ;
    value = value.replace(re, '&uacute;') ;
    
    re = new RegExp ('Ń', 'g') ;
    value = value.replace(re, '&Ntilde;') ;
    re = new RegExp ('ń', 'g') ;
    value = value.replace(re, '&ntilde;') ;

    re = new RegExp ('"', 'g') ;
    value = value.replace(re, '&#34;') ;

    var re;
    re = new RegExp ('\'', 'g') ;
    value = value.replace(re, '´') ;
    re = new RegExp ('|', 'g') ;
    value = value.replace(re, '!') ;
*/
    return value;
  }


  /**
  * Metodo que permite limitar la entrada de datos en un objeto textarea
  * @param: field, countfield, maxlimit
  */
  function contadorTexto(field, countfield, maxlimit) {
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
		else 
			countfield.value = maxlimit - field.value.length;
	}
  
  
  /**
  * Metodo que permite quitar espacios en blanco al inicio de la cadena
  * @param: control
  */
  function ltrim(control) {
    for (i=0 ; i<control.value.length ; i++) {
      if (''+control.value.charAt(0)==' ')
      control.value=control.value.substring(1,control.value.length);
    }
    if (''+control.value.charAt(0)==' ') {
      ltrim(control);
    }
    return(true);
  } 

  /**
  * Metodo que permite crear un string para pasarlo en un url
  * @param: cadena
  */
  function crearParametro(cadena)   {    
    // Se declara una variable local para almacenar la longitud de la cadena
    var lsi_lon_nom = cadena.length;
    
    // Se ejecuta un ciclo desde cero hasta la longitud de la cadena
    for (li_i = 0; (li_i < lsi_lon_nom); li_i++) {
        // Si se consigue un espacio en blanco se transforma en un símbolo +
        if (cadena.substring(li_i, li_i + 1) == " ") {
          if ((li_i + 1) == lsi_lon_nom)
            cadena = cadena.substring(0, li_i) + "+";
          else
            cadena = cadena.substring(0, li_i) + "+" + cadena.substring(li_i + 1, lsi_lon_nom);
          }
    }
    
    // Retorna la cadena ya transformada
    return cadena;
  }
  
  /**
  * Metodo que permite quitar espacios en blanco al a una cadena
  * @param: str
  */
 function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
  }  

  /**
  * Metodo que valida que el string sean solo numeros
  * @param: inputString
  */
  function esNumerico(inputString){
    //var searchForNumbers = /^\d+\,?\d*$/;//   /\D+/;
    //return (searchForNumbers.test(inputString)) ? false : true;
    
    return !isNaN(inputString.replace(",","."));
  } 

  /**
  * Metodo que restringe la entrada hasta "limite" caracteres en el 
  * elemento "elem" (text ó textarea) asociado al campo "campo".
  * @param: elem
  * @param: limite
  * @param: campo
  */
  function cuentaCaracteres(elem, limite, campo) {
    var cadena = elem.value;
    if(cadena.length > limite) {
      elem.value = cadena.substring(0,limite);
      alert("Disculpe, en el campo " + campo + " sólo puede introducir hasta " + 
          limite + " caracteres.");
      elem.focus();
      return false;
    }
  }
  
  /**
  * Metodo que devuelve codigo html para ser pintado en la pagina
  */
  function obtenerHtmlCurriculos(maximo){
    var codigoHtml = "";
    if (maximo == 0) maximo = 1;
    
    codigoHtml += "";
    codigoHtml += "  <table width=\"100%\" border=\"1\" cellspacing=\"0\"> \n";
    codigoHtml += "      <tr> \n";
    codigoHtml += "        <td class=\"tituloTabla\">RESUMEN CURRICULAR</td> \n";
    codigoHtml += "      </tr> \n";
    codigoHtml += "      <tr>  \n";
    codigoHtml += "        <td><table width=\"100%\" border=\"0\"> \n";
    
    for (i = 1; (i <= maximo); i++) {
      codigoHtml += "            <tr>  \n";
      codigoHtml += "              <td height=\"24\"> <input name=\"tf_curriculo_" + i + "\" type=\"file\" size=\"70\"></td> \n";
      codigoHtml += "            </tr> \n";
    }
    
    codigoHtml += "          </table></td> \n";
    codigoHtml += "      </tr> \n";
    codigoHtml += "  </table> \n";
    return codigoHtml;
  }
  
  
  /**
  * Metodo que valida la seleccion de los datos del Solicitante de la Solicitud
  */
  function validarSolicitante(dml){
  
    //Vice Presidente Ejecutivo
    if ( ! validarSelect( dml.lm_vpe, "el Vicepresidente Ejecutivo ") )
      return false;

    //V.P. de &Aacute;rea
    if ( ! validarSelect( dml.lm_vpa, "el Vicepresidente de Área ") )
      return false;

    //Responsable del Area
    if ( ! validarSelect( dml.lm_responsable_directo, "el Responsable de Área ") )
      return false;

    //Unidad
    if ( ! validarSelect( dml.lm_unidad, "la Unidad Solciitante ") )
      return false;
  
    return true;
  }


  /**
  * Método que abre una ventana flotante con el formato impreso
  */
  function imprimir(){
    var heightspeed = 9;
    var widthspeed = 9;
    var leftdist = 00;
    var topdist = 00;
    var winwidth = 800;
    var winheight = 500;

    hndWndPrn = window.open("", "windowPrn", "left=" + leftdist + ",top=" + topdist + ",width=1,height=1,menubar=yes,scrollbars=yes");
    for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed) {
      hndWndPrn.resizeTo("1", sizeheight);
    }
    for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed) {
      hndWndPrn.resizeTo(sizewidth, sizeheight);
    }
    //

    //var hndWndPrn = window.open("", "windowPrn", "width=800,height=600,menubar=yes,scrollbars=yes");
    //
    hndWndPrn.document.writeln("<HTML>");
    hndWndPrn.document.writeln("<HEAD>");
    hndWndPrn.document.writeln("<TITLE>MDP</TITLE>");
    hndWndPrn.document.writeln("<style type='text/css'>BODY { margin-left: 1%; }</style>");
    hndWndPrn.document.writeln("<LINK href='/lcm/stylesheet/pdm.css' type='text/css' rel='stylesheet'>");
    hndWndPrn.document.writeln("</HEAD><BODY leftMargin='0' topMargin='0'>");
    hndWndPrn.document.writeln("<table width='700' border='0' cellspacing='5'>");
    hndWndPrn.document.writeln("  <tr> ");
    hndWndPrn.document.writeln("    <td><img src='/lcm/images/logonegro.gif'> </td>");
    hndWndPrn.document.writeln("    <td><strong>SOLICITUD DE RECURSOS</strong></td>");
    hndWndPrn.document.writeln("  </tr>");
    hndWndPrn.document.writeln("</table>");
    hndWndPrn.document.writeln(document.all['spanPrn'].innerHTML);
    hndWndPrn.document.writeln("</BODY></HTML>");
    hndWndPrn.document.focus();
    hndWndPrn.document.close();
    hndWndPrn.print();  
  }

  /**
  * Método permite la impresión de una Solicitud
  */
  function imprimirSolicitud(){
    document.getElementById("noprintable").style.display = 'none';
    document.getElementById("printable").style.display = 'inline';
    print();  
  }

  /**
  * Método que permite habilitar/Deshabilitar una sección <DIV ...></DIV>
  */
	function habilitarSeccionPaginaPadre(seccion) {
		if (opener.document.getElementById(seccion).style.display == 'inline') {
			opener.document.getElementById(seccion).style.display = 'none';
		} else {
			//opener.document.getElementById(seccion).style.display = 'inline';
		}
	}
  
  
	function habilitarSeccion(seccion) {
		if (document.getElementById(seccion).style.display == 'inline') {
			document.getElementById(seccion).style.display = 'none';
		} else {
			document.getElementById(seccion).style.display = 'inline';
		}
	}
	function habilitarSeccionValor(seccion,valor) {
		document.getElementById(seccion).style.display =valor;
	}

  function validarNumeroMonto() {
		if ((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 44)
			event.returnValue = false;
	}
  
  function formatCurrency(num) {    
    num = num.toString().replace(/\./g,'');
    num = num.toString().replace(/\,/g,'.');
    if(isNaN(num)) num = "0";
       
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();

    if(cents<10)
      cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+'.'+ num.substring(num.length-(4*i+3));
    return (((sign)?'':'-') + num + ',' + cents);

  }

  function entrar(src,new_class) {
    //src.bgColor=color_entrada;
    //src.style.cursor="hand";
    src.attributes["class"].value=new_class;
  }
  
  function sortir(src,old_class) {
    //src.bgColor=color_default;
    //src.style.cursor="default";
    
    src.attributes["class"].value=old_class;
    src.style.cursor="default"    
  }
  
// Agregadas por Henry Monsalve Carmona 

// This method opens a window centered in the screen
// pane - the windows variable that contains the page
// widthSize - the width size of the window to open
// heightSize - the heigh size of the window to open
// url - the url with the page to be loaded
// title - the title of the window to open
// paneOpener - the parent window
// returns window's variable
function openGenericPopUp(pane, widthSize, heightSize, url, title, paneOpener) 
{
	var xPosition = getXPosition(widthSize);
	var yPosition = getYPosition(heightSize);

	var windowProperty = 'width = ' + widthSize + ', height = ' + heightSize + ', directories = no, location = no, menubar = no, ';
		windowProperty += 'scrollbars = yes, status = no, toolbar = no, resizable = yes, left = ' + xPosition + ', top = ' + yPosition + ', ';
		windowProperty += 'screenX = ' + xPosition + ', screenY = ' + yPosition;

	pane = window.open(url, title, windowProperty);

	if (!pane.opener)
	{
		pane.opener = window;
	}
	//pane.focus();

    return pane;
}

// Returns the horizontal pixel position centered
// respect the windows screen
// for a "widthSize" given
// return 0 if the "widthSize" is greater or equal than the windows screen's width
function getXPosition(widthSize)
{
	var xPosition = 0;
	if (window.screen.width > 640 && widthSize < window.screen.width)
	{
		//half the screen width minus half the new window width (plus 5 pixel each lateral border).
		xPosition = (window.screen.width/2) - (Math.round(widthSize/2) + 2*5);
	}
	
	return xPosition;
}

// Returns the vertical pixel position centered
// respect the windows screen
// for a "heightSize" given
// return 0 if the "heightSize" is greater or equal than the windows screen's height
function getYPosition(heightSize)
{
	var yPosition = 0;
	if (window.screen.height > 480 && heightSize < window.screen.height)
	{
		//half the screen height minus half the new window height (plus title bars).
		yPosition = (window.screen.height/2) - (Math.round(heightSize/2) + 2);   
	}
	return yPosition;
}

/****************************************************************************************
	Función para hacer Submit del Form de la Página
****************************************************************************************/
function submitAction(act)
{
	document.forms[0].action = act;
	document.forms[0].submit();
}
  
/****************************************************************************************
	Función para confirmar Eliminar un Candidato
****************************************************************************************/
function EliminarCandidato(act)
{ 
  if(confirm('Está seguro que desea Eliminar el Candidato'))
  {
  	submitAction(act);
  }
  else
  {
  	return false;
  } 
}


/****************************************************************************************
	Función que abre un PopUp para buscar Profesiones
****************************************************************************************/

function buscador(campo1,campo2,actionAbrir,actionBuscar,windowTitle)
 {
   var newWindow1;
   var widthSize =605;
   var heightSize = 300;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   //var url = 'SearchRepresentative.do?method=open'+'&field='+ field + '&actionExecute=' + actionExecute + '&methodExecute=' + methodExecute;

   var url = actionAbrir+'?campo1='+ campo1 + '&campo2='+ campo2 +'&actionBuscar=' + actionBuscar;
   //var url = 'AbrirBuscarProfesiones.do?campo1=1';
   
//   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 }

/****************************************************************************************
	Función setea los valores del Pop Up a la Ventana con el Objeto Form
****************************************************************************************/
 function itemSeleccionado(campo1,valor1,campo2,valor2,submit,accion)
{ 
if(campo1.length>0)	
  window.opener.document.forms[0].elements[campo1].value=valor1;
if(campo2.length>0)  
  window.opener.document.forms[0].elements[campo2].value=valor2;
 
  if (submit==1)
  {
  window.opener.document.forms[0].action=accion;
  window.opener.document.forms[0].submit();
  
  }
  self.close();  
}  
/****************************************************************************************
	Función para hacer Submit del Form de la Página
****************************************************************************************/
function submitIngresar(act)
{
	document.forms[0].action = act;
	document.forms[0].encoding = "multipart/form-data";
	document.forms[0].nombreAnexo.value = document.forms[0].curriculo.value;	
	document.forms[0].submit();
}
     

function buscadorEmpleado(campo1,campo2,campo3,campo4,campo5,campo6,campo7,campo8,campo9,campo10,campo11,campo12,campo13,campo14,campo15,actionAbrir)
 {
   var newWindow1;
   var widthSize =600; 
   var heightSize = 500;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);

   var url = actionAbrir+'?campo1='+ campo1 + '&campo2='+ campo2 + '&campo3='+ campo3+ '&campo4='+ campo4+ '&campo5='+ campo5+ '&campo6='+ campo6+ '&campo7='+ campo7+ '&campo8='+ campo8+ '&campo9='+ campo9+ '&campo10='+ campo10+ '&campo11='+ campo11+ '&campo12='+ campo12+ '&campo13='+ campo13+ '&campo14='+ campo14+ '&campo15='+ campo15;

   	
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 

function buscadorEmpleado1(campo1,campo2,campo3,campo4,campo5,campo6,campo7,campo8,campo9,campo10,campo11,campo12,campo13,campo14,campo15,actionAbrir)
 {
   var newWindow1;
   var widthSize =600; 
   var heightSize = 500;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);

   var url = actionAbrir+'?numform=1&campo1='+ campo1 + '&campo2='+ campo2 + '&campo3='+ campo3+ '&campo4='+ campo4+ '&campo5='+ campo5+ '&campo6='+ campo6+ '&campo7='+ campo7+ '&campo8='+ campo8+ '&campo9='+ campo9+ '&campo10='+ campo10+ '&campo11='+ campo11+ '&campo12='+ campo12+ '&campo13='+ campo13+ '&campo14='+ campo14+ '&campo15='+ campo15;

   	
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 

function buscadorCategoria(campo1,campo2,campo3,actionAbrir,submit,accion)
 {
   var newWindow1;
   var widthSize =500; 
   var heightSize = 400;
   var url =''
   if(actionAbrir.indexOf('?')!=-1)
    	url =actionAbrir+'&campo1='+ campo1 + '&campo2='+ campo2+'&campo3='+ campo3 +'&submit='+ submit ;
   	else
   	    url =actionAbrir+'?campo1='+ campo1 + '&campo2='+ campo2+'&campo3='+ campo3 +'&submit='+ submit ;
   	    
   var windowTitle = 'Categorias';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 



function bandejaFlujo(actionAbrir,codTciket)
 {
   var newWindow1;
   var widthSize =600; 
   var heightSize = 400;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   var url = actionAbrir+'?codTicket='+codTciket;

   	
   var windowTitle = 'Flujos';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 


function solicitud(codTciket)
 {
   var newWindow1;
   var widthSize =100; 
   var heightSize = 100;
  // var xPosition = getXPosition(widthSize);
   //var yPosition = getYPosition(heightSize);
   var url = 'obtenerSolicitud.do?P_codTicket='+codTciket;

   	
   var windowTitle = 'Solicitud';
//   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
   abrirVentanaMenu( url, widthSize, heightSize);
 } 
 
function solicitudEditar(codTciket)
 {
   var newWindow1;
   var widthSize =500; 
   var heightSize = 500;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   var url = 'editarSolicitudAprobador.do?P_codTicket='+codTciket;

   	
   var windowTitle = 'Editar';
//   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
   abrirVentanaMenu( url, widthSize, heightSize);
 } 
 


function buscadorCargo(campo1,campo2,actionAbrir,submit,accion,actualizar)
 {
   var newWindow1;
   var widthSize =500; 
   var heightSize = 400;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);

   var url = actionAbrir+'?campo1='+ campo1 + '&campo2='+ campo2 +'&submit='+ submit + '&accion='+ accion+'&actualizar='+actualizar;

   	
   var windowTitle = 'Cargos';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 


function buscadorEmpleado22(campo1,campo2,actionAbrir,submit,accion)
 {
   var newWindow1;
   var widthSize =600; 
   var heightSize = 500;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);

   var url = actionAbrir+'?campo1='+ campo1 + '&campo2='+ campo2 +'&submit='+ submit + '&accion='+ accion;

   	
   var windowTitle = 'Empleados';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);
 } 

/****************************************************************************************
	Función para asignar los valores del Pop Up a la Ventana con el Objeto Form
****************************************************************************************/
 function empleadoSeleccionado(campo1,valor1,campo2,valor2,campo3,valor3,campo4,valor4,campo5,valor5,campo6,valor6,campo7,valor7,campo8,valor8,campo9,valor9,campo10,valor10)
{ 
  
  window.opener.document.forms[0].elements[campo1].value=valor1;
  window.opener.document.forms[0].elements[campo2].value=valor2;
  window.opener.document.forms[0].elements[campo3].value=valor3;  
  window.opener.document.forms[0].elements[campo4].value=valor4; 
  window.opener.document.forms[0].elements[campo5].value=valor5;      
  window.opener.document.forms[0].elements[campo6].value=valor6;  
  window.opener.document.forms[0].elements[campo7].value=valor7;  
  window.opener.document.forms[0].elements[campo8].value=valor8;  
  window.opener.document.forms[0].elements[campo9].value=valor9;  
  window.opener.document.forms[0].elements[campo10].value=valor10;  

  opener.window.agregarDatosEmpleado(1);
  //window.opener.document.forms[0].action=action+'.do?method='+method;
  //window.opener.document.forms[0].submit();
  self.close();  
}  



function abrirCurriculum(actionAbrir,valor)
{
   var newWindow1;
   var widthSize =700; 
   var heightSize =550 ;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   //var url = 'SearchRepresentative.do?method=open'+'&field='+ field + '&actionExecute=' + actionExecute + '&methodExecute=' + methodExecute;
   var url = actionAbrir+'?id='+ valor;
   //var url = 'AbrirBuscarProfesiones.do?campo1=1';
   
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);

} 


function abrirImprimirCarta(actionAbrir,valor)
{
   var newWindow1;
   var widthSize =680; 
   var heightSize =500 ;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   //var url = 'SearchRepresentative.do?method=open'+'&field='+ field + '&actionExecute=' + actionExecute + '&methodExecute=' + methodExecute;
   var url = actionAbrir+'?ticket='+ valor;
   //var url = 'AbrirBuscarProfesiones.do?campo1=1';
   
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);

} 


function abrirVentana(actionAbrir,campo,valor,ancho,alto)
{
   var newWindow1;
   var widthSize =ancho; 
   var heightSize =alto ;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   //var url = 'SearchRepresentative.do?method=open'+'&field='+ field + '&actionExecute=' + actionExecute + '&methodExecute=' + methodExecute;
   var url = actionAbrir+'?'+campo+'='+ valor;
   //var url = 'AbrirBuscarProfesiones.do?campo1=1';
   
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);

} 


function abrirVentana(actionAbrir,ancho,alto)
{
   var newWindow1;
   var widthSize =ancho; 
   var heightSize =alto ;
   var xPosition = getXPosition(widthSize);
   var yPosition = getYPosition(heightSize);
   //var url = 'SearchRepresentative.do?method=open'+'&field='+ field + '&actionExecute=' + actionExecute + '&methodExecute=' + methodExecute;
   var url = actionAbrir;
   //var url = 'AbrirBuscarProfesiones.do?campo1=1';
   
   var windowTitle = 'Buscador';
   newWindow1 = openGenericPopUp(newWindow1, widthSize, heightSize, url, windowTitle, window);

}

function abrirVentanaMenu( url, w, h )
{
	popupwin = window.open( "", "", "toolbar=no,location=no,directories=no,status=no,menubar=yes,width="+ w +",height=" + h + ",resizable=yes,scrollbars=1" );
	popupwin.location = url;
}

function abrirVentanaMenu( url)
{
   var wOpen;
   var sOptions;
	
   sOptions = 'toolbar=no,location=no,directories=no,status=no,menubar=yes,resizable=yes,scrollbars=1';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', '', sOptions );
   wOpen.location = url;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   //return wOpen;


	
}

function habilitarSeccion(seccion) {
		if (document.getElementById(seccion).style.display == 'inline') {
			document.getElementById(seccion).style.display = 'none';
		} else {
			document.getElementById(seccion).style.display = 'inline';
		}
	}



/*
* (inicio) Manipulacion de los estilos de los elementes del div 
*/
var DHTML = (document.getElementById || document.all || document.layers);

function changeCol(col,idDelDiv)
{
	if (!DHTML) return;
	var x = new getObj(idDelDiv);
	x.style.color = col;
}

function changeStyle(style,idDelDiv)
{
	if (!DHTML) return;
	var x = new getObj(idDelDiv);
	x.style.fontStyle = style;
}

function changeFamily(family,idDelDiv)
{
	if (!DHTML) return;
	var x = new getObj(idDelDiv);
	x.style.fontFamily = family;
}


function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

/*
* (FIN) Manipulacion de los estilos de los elementes del div 
*/


	function milesFormato(valor){
		var temp=valor;
		if(temp.indexOf(',')!=-1){
		//temp.length 
			if(temp.indexOf(',')>3)
				temp=insertBDV(temp.indexOf(',')-3, '.',temp);

			for (i=1;i<10;i++) {
				if(temp.indexOf('.')-3>0)
					temp=insertBDV(temp.indexOf('.')-3, '.',temp);
			}
		}else{
			if(temp.length>3)
				temp=insertBDV(temp.length-3, '.',temp);

			for (i=1;i<10;i++) {
				if(temp.indexOf('.')-3>0)
					temp=insertBDV(temp.indexOf('.')-3, '.',temp);
			}
		}

		return temp;
	}
	
	
	function insertBDV(indice,valor,texto){
		if(indice<=texto.length)
			texto=texto.substr(0,indice)+valor+texto.substr(indice,texto.length );
		return texto;
		
	}

	/* Validador de fecha */
	function IsValidDate(ddmmyy)
	{
	
	if(ddmmyy.length!=10){
	    alert('El formato de fecha no es valido');
        return(false);
    
	}
	
	
	Day=ddmmyy.substr(0,2);
	Mn=ddmmyy.substr(3,2);
	Yr=ddmmyy.substr(6,4);
	
	//alert('day: '+Day+' Mn: '+Mn+'Yr: '+Yr);
	
    var DateVal = Mn + "/" + Day + "/" + Yr;
    var dt = new Date(DateVal);

    if(dt.getDate()!=Day){
        alert('El formato de fecha no es valido');
        return(false);
        }
    else if(dt.getMonth()!=Mn-1){
    //this is for the purpose JavaScript starts the month from 0

        alert('El formato de fecha no es valido');
        return(false);
        }
    else if(dt.getFullYear()!=Yr){
        alert('El formato de fecha no es valido');
        return(false);
        }
        
    return(true);
 }
	