/* 
 * Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

function Reiniciar() {
    // Eliminar opciones
    let Opciones = document.querySelectorAll('input[type="radio"]');

    for (let Posicion = 0; Posicion < Opciones.length; Posicion++) {
        Opciones[Posicion].removeAttribute('checked');
    }

    // Eliminar comprobaciones
    let Comprobaciones = document.querySelectorAll('[id^="comprobacion_"]');

    for (let Posicion = 0; Posicion < Comprobaciones.length; Posicion++) {
        Comprobaciones[Posicion].remove();
    }

    // Eliminar resultado
    let Resultado = document.getElementById('resultado');
    
    while (Resultado.childNodes.length > 0) {
        Resultado.removeChild(Resultado.firstChild);
    }

    // Crear resultado vacío
    let ContenidoResultado = document.createElement('span');
    ContenidoResultado.setAttribute('class', 'd-block text-center');

    let TextoContenidoResultado = document.createTextNode('--');
    ContenidoResultado.appendChild(TextoContenidoResultado);
    
    Resultado.appendChild(ContenidoResultado);
}
