﻿function Formacoes(b) {
    this.ID = b; this.Geral = function () {
        var a = criarXMLObj(); a.open("GET", "/inc/Formacoes/Descricao.ashx?id=" + this.ID); a.send(null); a.onreadystatechange = function () {
            if (a.readyState <= 3) document.getElementById("divInfoFormacao").innerHTML = "<div style='text-align: center;'> <img src='/Imagens/Icons/Load.gif' alt='A carregar forma\u00e7\u00e3o...' title='A carregar forma\u00e7\u00e3o...'/> A carregar forma\u00e7\u00e3o...</div>"; if (a.readyState == 4) document.getElementById("divInfoFormacao").innerHTML =
a.responseText
        } 
    }; this.Inscricao = function () {
        ddlFormacao = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_ddlFormacao"); tbNome = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbNome"); ddlDataNascimentoDia = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_ddlDataNascimentoDia"); ddlDataNascimentoMes = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_ddlDataNascimentoMes");
        ddlDataNascimentoAno = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_ddlDataNascimentoAno"); tbNumIdentificacao = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbNumIdentificacao"); tbEmail = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbEmail"); tbTelefone = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbTelefone");
        tbOrganizacao = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbOrganizacao"); tbFuncao = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbFuncao"); tbMorada = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbMorada"); tbObservacoes = document.getElementById("ctl00_ctl00_cphCentro_cphSite_repeaterAccoesFormacao_ctl00_Formacoes1_tbObservacoes"); document.getElementById("divCampoOBFormacao").innerHTML =
"&nbsp;"; document.getElementById("divCampoOBNome").innerHTML = "&nbsp;"; document.getElementById("divCampoOBDataNascimento").innerHTML = "&nbsp;"; document.getElementById("divCampoOBNumIdentificacao").innerHTML = "&nbsp;"; document.getElementById("divCampoOBFuncao").innerHTML = "&nbsp;"; document.getElementById("divCampoOBEmail").innerHTML = "&nbsp;"; document.getElementById("divCampoOBEmailStatus").innerHTML = "&nbsp;"; document.getElementById("divCampoOBTelefone").innerHTML = "&nbsp;"; campos_por_preencher = !1; if (ddlFormacao.value ==
"") document.getElementById("divCampoOBFormacao").className = "Red A11B", document.getElementById("divCampoOBFormacao").innerHTML = "!", campos_por_preencher = !0; if (tbNome.value == "") document.getElementById("divCampoOBNome").className = "Red A11B", document.getElementById("divCampoOBNome").innerHTML = "!", campos_por_preencher = !0; if (ddlDataNascimentoDia.value == "" || ddlDataNascimentoMes.value == "" || ddlDataNascimentoAno.value == "") document.getElementById("divCampoOBDataNascimento").className = "Red A11B", document.getElementById("divCampoOBDataNascimento").innerHTML =
"!", campos_por_preencher = !0; if (tbNumIdentificacao.value == "") document.getElementById("divCampoOBNumIdentificacao").className = "Red A11B", document.getElementById("divCampoOBNumIdentificacao").innerHTML = "!", campos_por_preencher = !0; if (tbFuncao.value == "") document.getElementById("divCampoOBFuncao").className = "Red A11B", document.getElementById("divCampoOBFuncao").innerHTML = "!", campos_por_preencher = !0; if (tbEmail.value == "") document.getElementById("divCampoOBEmail").className = "Red A11B", document.getElementById("divCampoOBEmail").innerHTML =
"!", campos_por_preencher = !0; else if ((new Validar).Email(tbEmail.value) == !1) document.getElementById("divCampoOBEmail").className = "Red A11B", document.getElementById("divCampoOBEmail").innerHTML = "!", document.getElementById("divCampoOBEmailStatus").className = "Red A10N", document.getElementById("divCampoOBEmailStatus").innerHTML = "E-mail inv\u00e1lido", campos_por_preencher = !0; if (tbTelefone.value == "") document.getElementById("divCampoOBTelefone").className = "Red A11B", document.getElementById("divCampoOBTelefone").innerHTML =
"!", campos_por_preencher = !0; if (campos_por_preencher == !0) return !1; var a = criarXMLObj(); a.open("GET", "/inc/formacoes/inscricao.ashx?id=" + ddlFormacao[ddlFormacao.selectedIndex].value + "&f=" + encodeURIComponent(ddlFormacao[ddlFormacao.selectedIndex].text) + "&n=" + encodeURIComponent(tbNome.value) + "&dn=" + ddlDataNascimentoAno.value + "." + ddlDataNascimentoMes.value + "." + ddlDataNascimentoDia.value + "&ni=" + encodeURIComponent(tbNumIdentificacao.value) + "&i=" + encodeURIComponent(tbOrganizacao.value) + "&c=" + encodeURIComponent(tbFuncao.value) +
"&m=" + encodeURIComponent(tbMorada.value) + "&e=" + encodeURIComponent(tbEmail.value) + "&t=" + encodeURIComponent(tbTelefone.value) + "&o=" + encodeURIComponent(tbObservacoes.value)); a.send(null); document.getElementById("imgEnviarInscricao").src = "/Imagens/Icons/Load.gif"; document.getElementById("divFormacaoStatus").innerHTML = ""; a.onreadystatechange = function () {
    if (a.readyState == 4) document.getElementById("imgEnviarInscricao").src = "/Imagens/Icons/Next.png", a.responseText == "True" ? (document.getElementById("divFormacaoStatus").className =
"Blue A10B", document.getElementById("divFormacaoStatus").innerHTML = "Inscri\u00e7\u00e3o efectuada com sucesso", tbNome.value = "", ddlDataNascimentoDia.value = "", ddlDataNascimentoMes.value = "", ddlDataNascimentoAno.value = "", tbNumIdentificacao.value = "", tbEmail.value = "", tbTelefone.value = "", tbOrganizacao.value = "", tbMorada.value = "", tbObservacoes.value = "") : (document.getElementById("divFormacaoStatus").className = "Red A10B", document.getElementById("divFormacaoStatus").innerHTML = "Erro na inscri\u00e7\u00e3o de forma\u00e7\u00e3o")
} 
    } 
}
;
