function showTooltip(element, content) {
    $("tooltipInner").innerHTML = content;

    if (element) {
        Position.clone(element, "tooltip", {offsetTop: -1 * (Element.getHeight("tooltip") + 20), offsetLeft: 10});
        $("tooltip").style.width="300px";
		$("tooltip").style.height="auto";
    }

    Effect.Appear("tooltip", {delay: 0, duration: .1});
}

function hideTooltip() {
    Effect.Fade('tooltip', {delay: .1, duration: .4, afterFinish: function() {$("tooltipInner").innerHTML = "&nbsp;";} });
}

function showHelpTooltip(id, element) {
    if (element) {
        Position.clone(element, id, {offsetTop: -1 * (Element.getHeight(id) + 15), offsetLeft: 10});
        $(id).style.width="300px";
        $(id).style.height="auto";
    }

    Effect.Appear(id, {delay: 0, duration: .1});
}

function hideHelpTooltip(id) {
    Effect.Fade(id, {delay: .4, duration: .4 });
}

function checkRadio(strId) {
    var objRadio = $(strId);

    if (objRadio && objRadio.type == "radio") {
        objRadio.checked = true;
    }
}

function obrirFinestra(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function tancarFinestra() {
	document.write('<a href="javascript:window.close();" class"tancarFinestra">Cerrar Ventana</a>')
}

function checkExamen(sConfirm, iPreguntas, event) {
    var a, b, c, d;
    var count = 0;

    for (i = 0; i < iPreguntas; i++) {
        a = document.getElementById("respuesta" + (i + 1) + "a");
        b = document.getElementById("respuesta" + (i + 1) + "b");
        c = document.getElementById("respuesta" + (i + 1) + "c");
        d = document.getElementById("respuesta" + (i + 1) + "d");

        count += ((a.checked || b.checked || c.checked || d.checked) ? 1 : 0);
    }

    if (count < iPreguntas && !confirm(sConfirm)) {
        return cancelEvent(event);
    }
}
