  //Funcion para seleccionar abrir el cuadro de dialogo y seleccionar una fecha
  function calendary ( object ){
        dateField = object;
        calendar = window.open('../html/calendario.html','cal','toolbar=no,scrollbars=no,left=100,top=200,width=170,height=200,resizable=no');
  }

  function collapseDiv(nameDiv){
        var div;
        if(document.getElementById){
                div = document.getElementById(nameDiv);
        }else{
                div = document.layers[nameDiv];
        }
        if(div.style.display == ''){
                div.style.display = 'none';
        }else{
                div.style.display = '';
        }

  }

  function showDiv(nameDiv){
        var div;
        if(document.getElementById){
                div = document.getElementById(nameDiv);
        }else{
                div = document.layers[nameDiv];
        }
        div.style.display = '';
  }

  function hideDiv(nameDiv){
        var div;
        if(document.getElementById){
                div = document.getElementById(nameDiv);
        }else{
                div = document.layers[nameDiv];
        }
        div.style.display = 'none';
  }

  function getInput(nameInput,value){
  //Retorna nulo o el input con el nombre indicado y que su valor sea el ingresado
        var input = null;
        for(i=0;i<document.forma.elements.length;i++){
                if( document.forma.elements[i].name == nameInput ){
                        if( document.forma.elements[i].value == value ){
                                input = document.forma.elements[i];
                                return input;
                        }
                }
        }
        return input;
  }


  function showOtherOptionCheck(inputOptions,inputOther,valueOther,nameDivValueOther){
  //Funcion encargada de ocultar y mostrar el div para ingresar otra opcion en el caso de checkbox
        if( inputOptions.value == valueOther && inputOptions.checked ){
                showDiv('nameDivValueOther');
        }
        else if( inputOptions.value == valueOther && !inputOptions.checked ){
                hideDiv('nameDivValueOther');
                if( inputOther ){
                        inputOther.value = '';
                }
        }
  }

  function showOtherOptionSelect(inputOptions,inputOther,valueOther,nameDivValueOther){
  //Funcion encargada de ocultar y mostrar el div para ingresar otra ciudad de procedencia
        if( inputOptions.options[inputOptions.selectedIndex].value == valueOther ){
                showDiv('nameDivValueOther');
        }
        else{
                hideDiv('nameDivValueOther');
                if( inputOther ){
                        inputOther.value = '';
                }
        }
  }
  
  function deleteObject(url, id){
        if(!url.match(/\?/)){
                url += '?';
        }else{
                url += '&';
        }
        deleteWindow = window.open(url + 'id=' + id ,'deleteWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }
  
  function deleteObjectDoc(url, id){
        alert(id);
        if(!url.match(/\?/)){
                url += '?';
        }else{
                url += '&';
        }
        deleteWindow = window.open(url + 'id=' + id ,'deleteWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }

  function editObject(url, id){
        if(!url.match(/\?/)){
                url += '?';
        }else{
                url += '&';
        }
        editWindow = window.open(url + 'id=' + id ,'editWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }
  
  function addObject(url){
        editWindow = window.open(url,'editWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }

  function consultarComentarioForo(id){
        editWindow = window.open('consultarComentarioForo.php?id=' + id ,'comentarioCVWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }
  
  function adicionarComentarioForo(){
        editWindow = window.open('','comentarioCVWindow','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }

  function busquedaProyectosLey(input){
        dataField = input;
        searchWindow = window.open('formaBusquedasVentana.php?busqueda=CriterioProyectoLey','busqueda','toolbar=no,scrollbars=yes,left=100,top=100,width=550,height=600,resizable=yes');
  }

  function busquedaProyectosLeyPosAcum(input, proyectoLey, legislatura){
        dataField = input;
        searchWindow = window.open('formaBusquedasVentana.php?busqueda=CriterioProyectoLey&posibleAcumulado=true&proyectoLey=' + proyectoLey + '&legislatura=' + legislatura,'busqueda','toolbar=no,scrollbars=yes,left=100,top=100,width=550,height=600,resizable=yes');
  }

  function addOption(id, descripcion){
        var option = new Option(descripcion, id);
        option.selected = true;
        dataField.options.add(option);
  }
  function login(urlSelf, server){
        loginWindow = window.open('http://' + server + '/share/user/login.php?urlSelf=' + urlSelf ,'login','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }
  
  function logout(urlSelf, server){
        loginWindow = window.open('http://' + server + '/share/user/logout.php?urlSelf=' + urlSelf ,'logout','toolbar=no,scrollbars=yes,left=100,top=200,width=550,height=400,resizable=yes');
  }
  
  function crearPartidoPolitico(){
        loginWindow = window.open('formaAdicionarPartidoPoliticoCandidato.php','logout','toolbar=no,scrollbars=yes,left=100,top=100,width=550,height=600,resizable=yes');
  }
