var _bSaving = false; function Init() { window.focus(); window.attachEvent("onbeforeunload", Close) } function __doPostBack2(g, e) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = g; theForm.__EVENTARGUMENT.value = e; theForm.submit(); theForm.__EVENTTARGET.value = ""; theForm.__EVENTARGUMENT.value = "" } } function Exportar(h, g) { var j = document.createElement("input"); j.type = "hidden"; j.id = "__EVENTTARGET"; j.name = "__EVENTTARGET"; j.value = "exportar"; var e = document.createElement("input"); e.type = "hidden"; e.id = "__EVENTARGUMENT"; e.name = "__EVENTARGUMENT"; e.value = g; var k = document.createElement("form"); k.appendChild(j); k.appendChild(e); k.action = h; k.target = "_blank"; k.id = "frmPTAExportar"; k.name = "frmPTAExportar"; k.method = "post"; document.appendChild(k); k.submit() } function Reset() { _bSaving = false } function Close(e) { if (!_bSaving && carregarXml(false, true, e) != 3) { if (SimNao("Aviso", "Para salvar as alterações, clique em Cancelar e, em seguida, clique em Salvar ou em Salvar e Fechar.\n\nPara fechar este registro sem salvar as alterações, clique em OK.")) { event.returnValue = true } else { event.returnValue = false } } } function detachCloseAlert() { window.detachEvent("onbeforeunload", Close) } function carregarXml(h, g, e) { if (e) { return carregarXmlNovoFormato(h, g) } else { return carregarXmlVelhoFormado(h, g) } } function carregarXmlNovoFormato(h, g) { var e = ObterXML(); if (e.length > 0) { document.aspnetForm.aspnetFormSubmitXml.value = e; return 1 } return 3 } function ObterXML() { var g, m; var j = ""; var k = document.aspnetForm.bInsert.value == "1"; for (g = 0; g < document.aspnetForm.elements.length; g++) { m = document.aspnetForm.elements[g]; var h = m.name; if (h.indexOf("$") > -1) { aNomeObj = h.split("$"); if (m.type == "checkbox") { if (aNomeObj.length > 2) { h = aNomeObj[aNomeObj.length - 2] + "$" + aNomeObj[aNomeObj.length - 1] } else { if (aNomeObj.length == 2) { h = aNomeObj[0] } } } else { h = aNomeObj[aNomeObj.length - 1] } } if (h.substr(0, 2) == "_c") { if (m.type == "text" || m.type == "textarea") { m.value = Trim(m.value) } if (!m.disabled) { j += buildElemNovo(m, k) } } } if (j.length > 0) { var l = document.aspnetForm.aspnetFormRootElem.value; j = "<" + l + "s><" + l + ">" + j + "</" + l + "></" + l + "s>" } return j } function buildElemNovo(g, h) { var v = retornaValor(g); var j = ""; if ((h && v.length == 0) || (v.length == 0 && (g.type != "text" && g.type != "textarea" && g.getAttribute("tipointerface") != "pesquisa" && g.type != "checkbox") || g.getAttribute("format") == "time") && (g.type != "select-one")) { return "" } else { var p = /_x_/g; var l = g.name; var m = ""; if (l.indexOf("$") > -1) { aNomeObj = l.split("$"); if (g.type == "checkbox") { if (aNomeObj.length > 2) { l = aNomeObj[aNomeObj.length - 2] + "$" + aNomeObj[aNomeObj.length - 1] } else { if (aNomeObj.length == 2) { l = aNomeObj[0] } } } else { l = aNomeObj[aNomeObj.length - 1] } for (var r = 0; r < aNomeObj.length - 1; r++) { m += aNomeObj[r] + "_" } } var n = l.replace(p, "."); n = n.replace("_c", ""); var q = ""; var u = ""; if (g.getAttribute("field") == "key" || g.getAttribute("field") == "reftable") { if (g.getAttribute("field") == "key") { u = " field='key'" } else { if (v == "ref") { u = " refTable='" + g.getAttribute("reftable") + "'" } else { u = " field='key'" } } } if (g.type == "checkbox") { q = " list='true'"; n = n.substring(0, n.indexOf("$")) } if (g.getAttribute("list") == "true") { q = " list='true'" } if (g.getAttribute("tb")) { n = g.getAttribute("tb") + "." + n } q += " type='" + g.getAttribute("tipo") + "'"; if (document.getElementById(m + "tdLbl" + l) != null) { q += " description='" + document.getElementById(m + "tdLbl" + l).innerText + "'" } if (g.type == "select-multiple") { var k = v.split("*"); for (i = 0; i < k.length; i++) { if (k[i].length > 0) { j += "<" + n.toLowerCase() + q + u + ">" + UnicodeToUTF8(k[i]) + "</" + n.toLowerCase() + ">" } } } else { j = "<" + n.toLowerCase() + q + u + ">" + UnicodeToUTF8(v) + "</" + n.toLowerCase() + ">" } return j } } function carregarXmlVelhoFormado(n, p) { var k, q, g; var j = document.aspnetForm.elements.length; var l = ""; var h = document.aspnetForm.bInsert.value == "1"; for (k = 0; k < j; k++) { g = document.aspnetForm.elements[k]; if (g.name.substr(0, 2) == "_c") { if (g.type == "text" || g.type == "textarea") { g.value = Trim(g.value) } if (!g.disabled) { l += buildElemVelho(g, h) } } } if (l.length > 0) { var m = document.aspnetForm.aspnetFormRootElem.value; l = "<" + m + "s><" + m + ">" + l + "</" + m + "></" + m + "s>"; document.aspnetForm.aspnetFormSubmitXml.value = l; return 1 } else { return 3 } } function buildElemVelho(g, h) { var q = retornaValor(g); var j = ""; if ((h && q.length == 0) || (q.length == 0 && (g.type != "text" && g.type != "textarea" && g.getAttribute("tipointerface") != "pesquisa" && g.type != "checkbox") || g.getAttribute("format") == "time") && (g.type != "select-one")) { return "" } else { var m = /_x_/g; var l = g.name.replace(m, "."); l = l.replace("_c", ""); var n = ""; var p = ""; if (g.getAttribute("field") == "key" || g.getAttribute("field") == "reftable") { if (g.getAttribute("field") == "key") { p = " field='key'" } else { if (q == "ref") { p = " refTable='" + g.getAttribute("reftable") + "'" } else { p = " field='key'" } } } if (g.type == "checkbox") { n = " list='true'"; l = l.substring(0, l.indexOf("$")) } if (g.getAttribute("list") == "true") { n = " list='true'" } if (g.getAttribute("tb")) { l = g.getAttribute("tb") + "." + l } n += " type='" + g.getAttribute("tipo") + "'"; if (document.aspnetForm.getElementsByTagName("*")["tdLbl" + g.id] != null) { n += " description='" + document.aspnetForm.getElementsByTagName("*")["tdLbl" + g.id].innerText + "'" } if (g.type == "select-multiple") { var k = q.split("*"); for (i = 0; i < k.length; i++) { if (k[i].length > 0) { j += "<" + l.toLowerCase() + n + p + ">" + UnicodeToUTF8(k[i]) + "</" + l.toLowerCase() + ">" } } } else { j = "<" + l.toLowerCase() + n + p + ">" + UnicodeToUTF8(q) + "</" + l.toLowerCase() + ">" } return j } } function displayMissingValue(e) { alert("Você deve fornecer um valor para " + e + ".") } function salvarPagina(s, m, p) { if (typeof antesSalvar2 == "function") { if (!antesSalvar2()) { return false } } if (typeof antesSalvar == "function") { antesSalvar() } var l = carregarXml(true, (document.aspnetForm.aspnetFormSubmitId.value != ""), p); if (l == 1) { var k = document.getElementById("btnSalvar"); var j = document.getElementById("btnCancelar"); var r = document.getElementById("btnSalvarFechar"); try { document.body.style.cursor = "wait"; var h = document.getElementById("layAviso"); var q = new TamanhoDocumento(); if (h) { h.style.left = Math.abs((q.width - parseInt(h.style.width)) / 2) + "px"; h.style.top = Math.abs((q.height - parseInt(h.style.height)) / 2) + "px"; h.style.display = "block"; h.style.zIndex = 1000; h.style.textAlign = "left" } if (r) { r.disabled = true } if (k) { k.disabled = true } if (j) { j.disabled = true } var g = new Object(); g.bFechar = s; g.bLimpar = m; SalvarAjax(g) } catch (n) { document.body.style.cursor = "default"; if (r) { r.disabled = false } if (k) { k.disabled = false } if (j) { j.disabled = false } } } else { _bSaving = false; return false } } function retornarSalvar(p) { document.body.style.cursor = "default"; var j = document.getElementById("layAviso"); var m = document.getElementById("btnSalvar"); var l = document.getElementById("btnCancelar"); var q = document.getElementById("btnSalvarFechar"); var h = document.aspnetForm.bInsert.value == "1"; if (j) { j.style.display = "none" } if (q) { q.disabled = false } if (m) { m.disabled = false } if (l) { l.disabled = false } if (p.error != null) { Erro(p.error.Message, "") } else { _bSaving = true; OK("Aviso", cadastro_efetuado_com_sucesso); if (document.aspnetForm.bReload.value == "1" && h) { var r = ((p.context) && (p.context.bFechar)); if (r) { window.close() } else { var k = ""; try { k = preencheListaChave(p.value) } catch (n) { k = preencheListaChave2(p.value) } var g = MontarUrlAjax(k); window.location.href = g.value } } else { try { preencheChave(p.value) } catch (n) { preencheChave2(p.value) } if (p.context) { if (p.context.bFechar) { window.close() } else { if (p.context.bLimpar) { Reset() } } } document.aspnetForm.bInsert.value = "0" } recarregarGrid(); if (typeof aposSalvar == "function") { aposSalvar(h, p.value) } } } function preencheListaChave2(l) { var n = ""; var k = EncontrarObjetoID("key", "INPUT"); var e = ""; var m = Trim(k.value).split(","); var h = new Array(); if (k.name.indexOf("$") > -1) { e = k.name.substring(0, k.name.lastIndexOf("$") + 1).replace(/\$+/gi, "_") } for (i = 0; i < m.length; i++) { h[i] = document.getElementById(e + "_c" + m[i]); if (h[i] == null) { h[i] = EncontrarObjetoID(m[i], "input") } if (h[i] == null) { h[i] = EncontrarObjetoID(m[i], "select") } } var g = null; var j = ""; for (i = 0; i < h.length; i++) { g = l.getValue(h[i].getAttribute("tb").toLowerCase()); if (g != null) { j = h[i].name; n += j.substring(j.indexOf("_x_") + 3, j.length) + "=" + g + "&" } } if (n.length > 0) { n = n.substring(0, n.length - 1) } return n } function preencheChave(j) { if (document.forms[0].key.value.length > 0) { var k = Trim(document.forms[0].key.value).split(","); var h = new Array(); for (i = 0; i < k.length; i++) { h[i] = document.getElementById("_c" + k[i]) } var g = null; for (i = 0; i < h.length; i++) { if (h[i] != null) { g = j.getValue(h[i].getAttribute("tb").toLowerCase()); if (g != null) { h[i].value = g } } } if (document.forms[0].reftable && document.forms[0].reftable.length > 0) { var e = Trim(document.forms[0].reftable.value).split(","); if (e.length > 0) { h = new Array(); for (i = 0; i < e.length; i++) { h[i] = document.getElementById("_c" + e[i]) } var g = null; for (i = 0; i < h.length; i++) { if (h[i] != null) { g = j.getValue(h[i].getAttribute("reftable").toLowerCase()); if (g != null) { h[i].value = g } } } } } } } function preencheChave2(m) { var l = EncontrarObjetoID("key", "INPUT"); if (l.value.length > 0) { var n = Trim(l.value).split(","); var j = new Array(); var e = ""; if (l.name.indexOf("$") > -1) { e = l.name.substring(0, l.name.lastIndexOf("$") + 1).replace(/\$+/gi, "_") } for (i = 0; i < n.length; i++) { j[i] = document.getElementById(e + "_c" + n[i]) } var h = null; for (i = 0; i < j.length; i++) { if (j[i] != null) { h = m.getValue(j[i].getAttribute("tb").toLowerCase()); if (h != null) { j[i].value = h } } } var k = EncontrarObjetoID("reftable", "INPUT"); e = ""; if (k && k.value.length > 0) { if (k.name.indexOf("$") > -1) { e = k.name.substring(0, k.name.lastIndexOf("$") + 1).replace(/\$+/gi, "_") } var g = Trim(k.value).split(","); if (g.length > 0) { j = new Array(); for (i = 0; i < g.length; i++) { j[i] = document.getElementById(e + "_c" + g[i]) } var h = null; for (i = 0; i < j.length; i++) { if (j[i] != null) { h = m.getValue(j[i].getAttribute("reftable").toLowerCase()); if (h != null) { j[i].value = h } } } } } } } function preencheListaChave(l) { var n = ""; var k = EncontrarObjetoID("key", "INPUT"); var e = ""; var m = Trim(k.value).split(","); var h = new Array(); if (k.name.indexOf("$") > -1) { e = k.name.substring(0, k.name.lastIndexOf("$") + 1).replace(/\$+/gi, "_") } for (i = 0; i < m.length; i++) { h[i] = document.getElementById(e + "_c" + m[i]); if (h[i] == null) { h[i] = EncontrarObjetoID(m[i], "input") } if (h[i] == null) { h[i] = EncontrarObjetoID(m[i], "select") } } var g = null; var j = ""; for (i = 0; i < h.length; i++) { g = l.getValue(h[i].getAttribute("tb").toLowerCase()); if (g != null) { j = h[i].name; n += j.substring(j.indexOf("_x_") + 3, j.length) + "=" + g + "&" } } if (n.length > 0) { n = n.substring(0, n.length - 1) } return n } function $d(h) { var e = AtributoControl().value; e.a = h.getAttribute("a"); e.fontedado = h.getAttribute("fontedado"); if (h.getAttribute("dependencia")) { var g = Trim(h.getAttribute("dependencia")).split(","); for (i = 0; i < g.length; i++) { e.hsdependencia.add(Trim(g[i]), rv(g[i])) } } return e } function carregarLista_callback(e) { if (e.error != null) { Erro(e.error.Message, "") } else { PopulaCombo(e.value.toString(), e.context) } } function pesquisarValor(g) { var e; e = document.getElementById(g); if (typeof (e.value) == "string") { return e.value } return pesquisarValorRecursivo(e) } function pesquisarValorRecursivo(g) { if (typeof (g.value) == "string" && (g.type != "radio" || g.checked == true)) { return g.value } var e, h; for (e = 0; e < g.childNodes.length; e++) { h = pesquisarValorRecursivo(g.childNodes[e]); if (h != "") { return h } } return "" } function AbaReset(e, g, h) { var k = document.getElementsByTagName("TD"); for (x = 0; x < k.length; x++) { if (k[x].className == "abaOn" && k[x].id.indexOf(h) > -1) { AplicarEstilo(k[x], "aba") } } k = document.getElementsByTagName("IMG"); var j = 0; for (x = 0; x < k.length; x++) { if (k[x].name.indexOf(e) > -1) { if (j == 0) { k[x].src = PTA_sProjeto + "core/images/aba_01.gif"; j++ } else { k[x].src = PTA_sProjeto + "core/images/aba_03.gif"; j-- } } } } function ResetAbaCorpo(e) { if (e) { arrElements = document.getElementsByTagName("DIV"); for (x = 0; x < arrElements.length; x++) { if (arrElements[x].id.indexOf(e) > -1) { arrElements[x].style.display = "none" } } } } function AbaClick(j, e, g, h) { AbaClickOverride(j, e, g, h) } function AbaClick2(h, e, g) { AbaClickOverride(h, e, g) } function AbaClickOverride(o, sImgName, oDiv, arrObjDivEsconder) { try { oTd = ProcurarPai(o, "TD"); ResetAbaCorpo("abaCorpo"); if (oTd.className != "abaOn") { AbaReset("imgAba", "abaCorpo", "tabAba"); oImg = eval("document." + sImgName + "_01"); oImg.src = PTA_sProjeto + "core/images/aba_ativa_01.gif"; oImg = eval("document." + sImgName + "_02"); oImg.src = PTA_sProjeto + "core/images/aba_ativa_03.gif"; AplicarEstilo(oTd, "abaOn") } if (arrObjDivEsconder) { var arrDivs = arrObjDivEsconder.split(","); var x; for (x = 0; x < arrDivs.length; x++) { MostrarEsconderObjeto(document.getElementById(arrDivs[x]), false) } } var msg = document.getElementById("Msg" + oDiv); if (msg) { if (msg.innerHTML.length > 0) { MostrarEsconderObjeto(document.getElementById("layTabMsgAviso"), true); document.getElementById("MsgAvisoAba").innerHTML = msg.innerHTML } else { MostrarEsconderObjeto(document.getElementById("layTabMsgAviso"), false) } } if (oDiv) { MostrarEsconderObjeto(document.getElementById(oDiv), true) } } catch (e) { } } function AbaClickLink(k, g, h) { try { window.location.href = h } catch (j) { } } function AbaOut(o, sImgName) { try { oTd = ProcurarPai(o, "TD"); if (oTd.className != "abaOn") { oImg = eval("document." + sImgName + "_01"); oImg.src = PTA_sProjeto + "core/images/aba_01.gif"; oImg = eval("document." + sImgName + "_02"); oImg.src = PTA_sProjeto + "core/images/aba_03.gif"; AplicarEstilo(oTd, "aba") } } catch (e) { } } function AbaOver(o, sImgName) { try { oTd = ProcurarPai(o, "TD"); if (oTd.className != "abaOn") { oImg = eval("document." + sImgName + "_01"); oImg.src = PTA_sProjeto + "core/images/aba_over_01.gif"; oImg = eval("document." + sImgName + "_02"); oImg.src = PTA_sProjeto + "core/images/aba_over_03.gif"; AplicarEstilo(oTd, "abaOvr") } } catch (e) { } } function SelecionaLinhasRender(oFrmName, oCkbName) { var o = eval(oFrmName + "." + oCkbName); for (i = 0; i < o.length; i++) { if (o[i].checked) { SelecionaLinhaChk(o[i]) } } } function DestacaTituloGrid(e) { o = ProcurarPai(e, "TH"); if (o) { AplicarEstilo(o, "tdTituloListaOn") } } function RestoraTituloGrid(e) { o = ProcurarPai(e, "TH"); if (o) { AplicarEstilo(o, "tdTituloLista") } } function SelecionaTodasLinhasChk(g, e) { if (e) { if (e.length != null) { for (i = 0; i < e.length; i++) { if (!e[i].disabled) { e[i].checked = (g.checked); SelecionaLinhaChk(e[i]) } } } else { if (!e.disabled) { e.checked = (g.checked); SelecionaLinhaChk(e) } } } } function SelecionaLinhaRadio(obj) { var id = obj.id; var tam = eval("document.forms[0]." + id + ".length"); var o = eval("document.forms[0]." + id); if (obj.type == "radio") { if (tam > 0) { for (var x = 0; x < tam; x++) { DeselecionaLinha(o[x]) } } if (!obj.checked) { DeselecionaLinha(obj) } else { SelecionaLinha(obj) } } } function SelecionaLinhaChk(g, e) { if (g.type == "checkbox") { if (!g.checked) { DeselecionaLinha(g, e) } else { SelecionaLinha(g) } } } function SelecionaLinha(g) { o = ProcurarPai(g, "TR"); if (o) { var e = 0; while (e < o.cells.length) { AplicarEstilo(o.cells[e], "tdItemListaOn"); e++ } } } function DeselecionaLinha(h, g) { o = ProcurarPai(h, "TR"); if (o) { var e = 0; while (e < o.cells.length - 1) { if (g == null) { AplicarEstilo(o.cells[e], "tdItemLista") } else { AplicarEstilo(o.cells[e], "tdItemListaSemBorda") } e++ } AplicarEstilo(o.cells[e], "tdItemListaFim") } } function MostrarEsconderObjeto(g, e) { var h = new PTADetectorBrowser(); if (g) { if (!e) { g.style.display = "none" } else { if (!h.ie) { switch (g.tagName) { case "CAPTION": g.style.display = "table-caption"; break; case "TD": case "TH": g.style.display = "table-cell"; break; case "TR": g.style.display = "table-row"; break; case "COL": g.style.display = "table-column"; break; case "TFOOT": g.style.display = "table-footer-group"; break; case "THEAD": g.style.display = "table-header-group"; break; case "TBODY": g.style.display = "table-row-group"; break; case "TABLE": g.style.display = "table"; break; case "LI": g.style.display = "list-item"; break; default: g.style.display = ""; break } } else { g.style.display = "" } } } } function setarTamanhoJanela(g, e) { if (window.outerWidth) { window.outerWidth = g; window.outerHeight = e } else { if (window.resizeTo) { window.resizeTo(g, e) } } nPosLeft = (screen.width) ? (screen.width - g) / 2 : 100; nPosTop = (screen.height) ? (screen.height - e) / 2 - 50 : 100; window.moveTo(nPosLeft, nPosTop) } function AtivarActiveXControls() { objects = document.getElementsByTagName("object"); for (var e = 0; e < objects.length; e++) { objects[e].outerHTML = objects[e].outerHTML } } function extraiScript(g) { var h = 0; while (h != -1) { h = g.indexOf("<script", h); if (h >= 0) { h = g.indexOf(">", h) + 1; var e = g.indexOf("<\/script>", h); codigo = g.substring(h, e); novo = document.createElement("script"); novo.text = codigo; document.body.appendChild(novo) } } } function EncontrarObjetoID(h, j) { var l = document.getElementsByTagName(j); for (var g = 0; g < l.length; g++) { if (l[g].id.indexOf(h) != -1) { var e = l[g].id.indexOf(h); var k = l[g].id.toString().length; if (l[g].id.substring(e, k) == h) { return l[g] } } } } function EncontrarTodosObjetoID(g, h) { var k = document.getElementsByTagName(h); var j = new Array(); for (var e = 0; e < k.length; e++) { if (k[e].id.indexOf(g) != -1) { j.push(k[e]) } } return j } function PTAEncontraObj(h, k) { var j, g, e; if (!k) { k = document } if ((j = h.indexOf("?")) > 0 && parent.frames.length) { k = parent.frames[h.substring(j + 1)].document; h = h.substring(0, j) } if (!(e = k[h]) && k.all) { e = k.all[h] } for (g = 0; !e && g < k.forms.length; g++) { e = k.forms[g][h] } for (g = 0; !e && k.layers && g < k.layers.length; g++) { e = PTAEncontraObj(h, k.layers[g].document) } if (!e && document.getElementById) { e = document.getElementById(h) } return e } function PTAEncontraObjPorAtributo(g, j) { var e = document.getElementsByTagName("*"); for (var h = 0; h < e.length; h++) { if (e[h].getAttribute(g) == j) { return e[h] } } return null } function FindControl(h, j) { var g; for (var e = 0; e < h.childNodes.length; e++) { if (h.childNodes[e].name) { if (h.childNodes[e].name.indexOf(j) >= 0) { return h.childNodes[e] } } g = FindControl(h.childNodes[e], j); if (g) { break } } return g } function FindControlByID(h, j) { var g; for (var e = 0; e < h.childNodes.length; e++) { if (h.childNodes[e].id) { if (h.childNodes[e].id.indexOf(j) >= 0) { return h.childNodes[e] } } g = FindControlByID(h.childNodes[e], j); if (g) { break } } return g } function SetarTituloPagina(e) { if (e != "" && top.frames.main) { top.frames.main.document.getElementById("lblTituloPagina").innerHTML = unescape(e) } } function SetarNomeUsuario(e) { if (e != "" && top.frames.main) { top.frames.main.document.getElementById("layUser").innerHTML = unescape(e) } } function AbrirJanela(g, h, n, m, e, r, k, q) { var p = new PTADetectorBrowser(); if (!p.ie7) { n = Number(n) + 20; h = Number(h) + 10 } var l = ""; l += "location=no,directories=no,status=no,menubar=no,toolbar=no,"; if (h == true) { k = true; q = true; e = true } if (q) { l += "resizable=yes," } else { l += "resizable=no," } if (k) { l += "width=" + (screen.availWidth - 10) + ", height=" + (screen.availHeight - 20) + ", top=0, left=0" } else { l += "width=" + h + ", height=" + n; if (m) { nPosLeft = (screen.width) ? (screen.width - h) / 2 : 100; nPosTop = (screen.height) ? (screen.height - n) / 2 - 50 : 100; l += ", top=" + nPosTop + ", left=" + nPosLeft } } if (e) { l += ", scrollbars=1" } else { l += ", scrollbars=0" } if (r == "" || r == null) { r = "WBCPOPUP" } var j = window.open(g, r, l); j.focus(); return j } function AbrirJanela2(g, h, n, m, e, r, k, q) { var p = new PTADetectorBrowser(); if (!p.ie7) { n = Number(n) + 20; h = Number(h) + 10 } var l = ""; l += "location=no,directories=no,status=no,menubar=no,toolbar=no,"; if (q) { l += "resizable=yes," } else { l += "resizable=no," } if (k) { l += "width=" + (screen.availWidth - 10) + ", height=" + (screen.availHeight - 20) + ", top=0, left=0" } else { l += "width=" + h + ", height=" + n; if (m) { nPosLeft = (screen.width) ? (screen.width - h) / 2 : 100; nPosTop = (screen.height) ? (screen.height - n) / 2 - 50 : 100; nPosLeft = -10; nPosTop = -10; l += ", top=" + nPosTop + ", left=" + nPosLeft } } if (e) { l += ", scrollbars=1" } else { l += ", scrollbars=0" } if (r == "" || r == null) { r = "WBCPOPUP" } var j = window.open(g, r, l); j.focus(); return j } function AbrirJanelaDialogo(j, l, h, g, k, e) { AbrirJanelaDlg(j, l, h, g, k, e) } function AbrirJanelaDlg(j, l, m, p, k, h, e, g) { var q = ""; var n = new PTADetectorBrowser(); if (!n.ie7) { p = parseInt(p) + 20; m = parseInt(m) + 10 } if (window.showModalDialog) { q = "help:0; status:0;unadorned:1;"; if (p) { q += "dialogHeight:" + p + "px;" } else { q += "dialogHeight:350px;" } if (m) { q += "dialogWidth:" + m + "px;" } else { q += "dialogWidth:500px;" } if (k) { q += "center:1;" } else { q += "center:0;" } if (e) { q += "dialogLeft:" + e + ";" } if (g) { q += "dialogTop:" + g + ";" } if (h) { q += "scroll:1" } else { q += "scroll:0;" } return window.showModalDialog(j, l, q) } else { q = "toolbar=no, directories=no, status=no, menubar=no, resizable=no, modal=yes, dependent=yes, dialog=yes"; if (p) { q += ",height=" + p } else { q += ",height=350" } if (m) { q += ",width=" + m } else { q += ",width=500" } if (h) { q += ",scrollbars=yes" } else { q += ",scrollbars=no" } if (k) { q += "screenY=" + ((screen.availHeight - p) / 2) + ","; q += "screenX=" + ((screen.availWidth - m) / 2) } if (e) { q += ",screenX=" + e } if (g) { q += ",screenY=" + g } return window.open(j, "PTADialog", q) } } function RetornarParentDocument() { if (window.opener) { return window.opener } else { return window.dialogArguments } } function AbrirMenu(g, h, k, l, j, r) { try { nWidth = (l != "") ? l : 600; nHeight = (j != "") ? j : 550; var n = top.frames.main.document.getElementById("frmConteudo"); switch (h) { case "novajanela": AbrirJanela(g, nWidth, nHeight, true, false, r); break; case "novajanelamaximizada": AbrirJanela(g, nWidth, nHeight, true, false, r, true, true); break; case "minhaempresa": AbrirJanela(g, nWidth, nHeight, true, false, "EmpresaManutencao"); break; case "sobre": AbrirJanelaDialogo(g, "", nWidth, nHeight, true, false); break; case "imprimir": var q = new PTADetectorBrowser(); x = top.frames.main; if (q.ie) { x.frmConteudo.focus(); x.frmConteudo.print() } else { x = top.frames.main; var p = x.document.getElementsByTagName("IFRAME"); for (x = 0; x < p.length; x++) { if (p[x].id == "frmConteudo") { p[x].focus(); print(); break } } } break; case "ajuda": AbrirJanela(g, nWidth, nHeight, true, false, "Ajuda", false, true); break; case "configurador_de_ajuda": AbrirJanela(g, nWidth, nHeight, true, false, "Ajuda", true, true); break; case "desconectar": window.open(PTA_sProjeto + "default.aspx?q=UeCWORgSscUGVpt0Uvz09Q==", "", "width=780, height=560,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1"); top.close(); break; case "sair": top.close(); break; default: n.src = g; SetarTituloPagina(k); break } } catch (m) { alert(m.message); return false } } function ProcurarPai(g, e) { var h = g; while (h.tagName != e) { h = h.parentNode; if (h == null) { return } } return h } function AplicarEstilo(g, e) { g.className = e } function TamanhoDocumento() { var e = new PTADetectorBrowser(); if (e.ie) { this.width = document.body.offsetWidth; this.height = document.body.offsetHeight } else { this.width = innerWidth; this.height = innerHeight } return this } function PTADetectorBrowser() { this.ver = navigator.appVersion; this.agent = navigator.userAgent; this.dom = document.getElementById ? 1 : 0; this.opera5 = this.agent.indexOf("Opera 5") > -1; this.ie4 = (document.all && !this.dom && !this.opera5) ? 1 : 0; this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom && !this.opera5) ? 1 : 0; this.ie6 = (this.ver.indexOf("MSIE 6") > -1 && this.dom && !this.opera5) ? 1 : 0; this.ie7 = (this.ver.indexOf("MSIE 7") > -1 && this.dom && !this.opera5) ? 1 : 0; this.ie8 = (this.ver.indexOf("MSIE 8") > -1 && this.dom && !this.opera5) ? 1 : 0; this.ie = (this.ie4 || this.ie5 || this.ie6 || this.ie7 || this.ie8); this.mac = this.agent.indexOf("Mac") > -1; this.ns4 = (document.layers && !this.dom) ? 1 : 0; this.ns6 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; this.bw = (this.ie8 || this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5); return this } function ReturnComboValue(e) { if (e.selectedIndex > -1) { return e.options[e.selectedIndex].value } else { return ("") } } function ReturnRadioValue(h) { var g = ""; if (h.length) { for (var e = 0; e < h.length; e++) { if (h[e].checked) { g = h[e].value; break } } } else { if (h.checked) { g = h.value } } return (g) } function ReturnCheckValue(e, g) { if (!g) { g = "," } var j = ""; if (e.length) { for (var h = 0; h < e.length; h++) { if (e[h].checked) { j += g + e[h].value } } if (j.length > 0) { j = j.substr(g.length) } } else { if (e.checked) { j = e.value } } return (j) } function ReturnListaChecked(j, g) { var h = false; for (var e = 0; e < j.length; e++) { if (g.length > 1) { if (g[0].name.indexOf(j.elements[e].name) != -1) { if (j.elements[e].checked) { h = true } } } else { if (g.name.indexOf(j.elements[e].name) != -1) { if (j.elements[e].checked) { h = true } } } } return h } function ReturnComboText(e) { if (e.selectedIndex > -1) { return e.options[e.selectedIndex].text } else { return ("") } } function SetComboOption(e, g) { for (i = 0; i < e.length; i++) { if (e.options[i].value == g) { e.selectedIndex = i; break } } } function SetRadioListOption(g, e) { for (i = 0; i < g.length; i++) { if (g[i].value == e) { g[i].checked = true; break } } } function setValidatorState(h, e) { var g = PTAEncontraObj(h); if (g) { g.enabled = e; g.IsValid = true } } function Trim(e) { return e.replace(/^\s+|\s+$/g, "") } function decodeXml(s) { try { s = eval('"' + s.replace(/&#x(\w\w\w\w);/g, "\\u$1").replace(/"/g, '\\"') + '"') } catch (e) { } s = s.replace(/&lt;/g, "<"); s = s.replace(/&gt;/g, ">"); s = s.replace(/&apos;/g, "'"); s = s.replace(/&quot;/g, '"'); s = s.replace(/&amp;/g, "&"); return s } function UnicodeToUTF8(e) { if (!e) { return "" } e = escape(e); e = e.replace(/%20/g, " "); e = e.replace(/%u(\w{4})/g, "&#x$1;"); e = e.replace(/%(\w{2})/g, "&#x$1;"); return e } function Legenda(l, g) { try { AplicarEstilo(l, g); var h = document.getElementById("imgIcoLegenda"); var j = document.getElementById("layLegendaBody"); if (g == "tdLegendaOver") { if (j.style.display != "block") { MudaImagem(h, h.src.substr(0, h.src.lastIndexOf("/")) + "/ic_b_legenda2.gif") } else { MudaImagem(h, h.src.substr(0, h.src.lastIndexOf("/")) + "/ic_c_legenda2.gif") } } else { if (j.style.display != "block") { MudaImagem(h, h.src.substr(0, h.src.lastIndexOf("/")) + "/ic_b_legenda_off2.gif") } else { MudaImagem(h, h.src.substr(0, h.src.lastIndexOf("/")) + "/ic_c_legenda_off2.gif") } } } catch (k) { } } function LegendaClick(k) { try { var j = document.getElementById(k); var g = document.getElementById("imgIcoLegenda"); if (j) { if (j.style.display != "block") { j.style.display = "block"; MudaImagem(g, g.src.substr(0, g.src.lastIndexOf("/")) + "/ic_c_legenda_off2.gif") } else { j.style.display = "none"; MudaImagem(g, g.src.substr(0, g.src.lastIndexOf("/")) + "/ic_b_legenda_off2.gif") } } if (window.Ajuste_Resize) { window.Ajuste_Resize() } } catch (h) { } } function MudaImagem(g, e) { if (g) { g.src = e } } function excluirSelecionados(l, g, k, m) { if (l == null || l == "" || l == "undefined") { OK("Aviso", k); return false } if (g == null || g == "" || g == "undefined") { OK("Aviso", k); return false } var j = false; var h = 0; for (var e = 0; e < l.length; e++) { if (g.length > 1) { if (g[0].name.indexOf(l.elements[e].name) != -1) { if (l.elements[e].checked) { j = true; h++ } } } else { if (g.name.indexOf(l.elements[e].name) != -1) { if (l.elements[e].checked) { j = true; h++ } } } } if (j) { if (m != "") { if (SimNao("Aviso", m)) { return true } else { return false } } } else { OK("Aviso", k) } return (j) } function excluirSelecionados2(l, g, m, k) { if (l == null || l == "" || l == "undefined") { m.show(); return false } if (g == null || g == "" || g == "undefined") { m.show(); return false } var j = false; var h = 0; for (var e = 0; e < l.length; e++) { if (g.length > 1) { if (g[0].name.indexOf(l.elements[e].name) != -1) { if (l.elements[e].checked) { j = true; h++ } } } else { if (g.name.indexOf(l.elements[e].name) != -1) { if (l.elements[e].checked) { j = true; h++ } } } } if (j) { if (k) { return k.show() } } else { m.show() } return (j) } function confirmarExclusao(e) { return SimNao("Aviso", e) } function CopiarValorCombo(e, g) { for (i = e.length; i >= 0; i--) { e.options[i] = null } for (i = 0; i < g.length; i++) { AdicionarCombo(g.options[i].value, g.options[i].text, e) } e.selectedIndex = 0 } function LimparCombo(e) { var h = e.firstChild; while (h != null) { var g = h; h = h.nextSibling; if (g.tagName == "OPTION" || g.tagName == "OPTGROUP") { e.removeChild(g) } } } function PopulaCombo2(p, k) { LimparCombo(k); var n = new PTADetectorBrowser(); var e = new Array(); for (var m = 0; m < p.length; m++) { if (p[m].sGrupo != "" && p[m].sGrupo != null && e[p[m].sGrupo] == null) { var g = document.createElement("OPTGROUP"); g.label = p[m].sGrupo; k.appendChild(g); e[p[m].sGrupo] = g } var l = document.createElement("OPTION"); if (n.ns6) { k.add(l, null) } else { k.add(l) } l.value = p[m].sValor; l.text = p[m].sTexto; if (p[m].lstAtributos != null) { for (var h = 0; h < p[m].lstAtributos.length; h++) { l.setAttribute(p[m].lstAtributos[h].sNome, p[m].lstAtributos[h].sValor) } } } } function PopulaCombo(l, k) { oBrowser = new PTADetectorBrowser(); var h; var g = new Array(); var j = l.split(":-:"); for (i = 0; i < j.length; i++) { h = j[i].split("-:-"); g[i] = new Array(h[0], h[1]) } if (oBrowser.ns4 || oBrowser.ns6) { for (i = k.length; i >= 0; i--) { k.options[i] = null } for (i = 0; i < g.length; i++) { var e = new Option(); e.text = g[i][1]; e.value = g[i][0]; if (i == 0) { e.defaultSelected = true; e.Selected = true } k.options[i] = e } k.selectedIndex = 0 } else { for (i = k.length - 1; i >= 0; i--) { k.remove(i) } for (i = 0; i < g.length; i++) { var e = document.createElement("OPTION"); e.text = g[i][1]; e.value = g[i][0]; k.add(e) } } } function AdicionarCombo(j, g, h) { oBrowser = new PTADetectorBrowser(); if (oBrowser.ns4 || oBrowser.ns6) { var e = new Option(); e.text = g; e.value = j; h.options[i] = e } else { var e = document.createElement("OPTION"); e.text = g; e.value = j; h.add(e) } } function retornaValor(j) { var h = ""; switch (j.type) { case "text": if (j.getAttribute("format") == "time") { h = "" } else { if (j.getAttribute("format") == "datetime") { var e = document.getElementById(j.id + "_Hora"); var g = ""; if (e) { if (e.value.length > 0) { g = " " + e.value + ":00" } } h = j.value + g } else { h = j.value } } break; case "radio": h = ReturnRadioValue(j); break; case "hidden": if (j.getAttribute("tipointerface") == "formula") { h = xmlFormulaAtributoDinamico(j) } else { h = j.value } break; case "select-one": h = ReturnComboValue(j); break; case "select-multiple": h = saveItens(j); break; case "checkbox": if (j.checked) { h = j.value } break; case "password": h = j.value; break; default: h = j.value; break } return h } function carregaData(sIdControle, sData) { var objControle = document.getElementById(sIdControle); objControle.value = sData; var sRegExInput = new RegExp(objControle.attributes.PTA_SeparadorData.value, "g"); eval("PTA" + sIdControle).Valor = sData.replace(sRegExInput, ""); eval("PTA" + sIdControle).Exibe() } function xmlFormulaAtributoDinamico(g) { var e = g.id.replace("_formula", ""); return xmlFormula(e) } function xmlFormula(j) { var h = document.getElementById(j); var g = j + "_formula"; var m = document.getElementById(g).value; var k = h.getAttribute("parametro"); var e = h.getAttribute("assemblyid"); var n = ""; if (k.length > 0) { var p = k.split(String.fromCharCode(19)); for (var l = 0; l < p.length; l++) { p[l] = p[l].split(String.fromCharCode(18)); n += '<parametro id="' + p[l][0] + '" valor="' + p[l][1] + '" />' } } return '<formula assemblyid="' + e + '" metaobjeto="' + h.getAttribute("metaobjeto") + '" chavemetaobjeto="' + h.getAttribute("chavemetaobjeto") + '" descricaoformula="' + h.getAttribute("descricaoformula") + '" conteudoformula="' + UnicodeToUTF8(m) + '">' + n + "</formula>" } function varFormula(k) { var h = ""; if (k.toString().length > 0) { var e = k.split(String.fromCharCode(19)); for (var g = 0; g < e.length; g++) { var j = e[g].split(String.fromCharCode(18)); h += j[0].toString() + " = " + (j[1].toString().length == 0 ? '" "' : j[1].toString()) + "<br>" } } return h } function ValidarPreenchimentoVariaveis(g, e) { var h = document.getElementById(g.controltovalidate); e.IsValid = (ValidarPreenchimentoVariaveis_2(h)) } function ValidarPreenchimentoVariaveis_2(k) { var j = k.getAttribute("parametro"); var g = true; if (j.toString().length > 0) { var e = j.split(String.fromCharCode(19)); for (var h = 0; h < e.length; h++) { arrValores = e[h].split(String.fromCharCode(18)); if (arrValores[1].toString().length == 0) { g = false; AplicarEstilo(document.getElementById("div" + k.id), "tex texAviso"); break } } } return g } function EncontrarObjeto(g, h) { if (!h) { h = document.forms[0] } for (var e = 0; e < h.elements.length; e++) { if (h.elements[e].id.indexOf(g) != -1) { return h.elements[e] } } } function rv(g, h) { var j = ""; if (!h) { h = document.forms[0] } for (var e = 0; e < h.elements.length; e++) { if (h.elements[e].id.indexOf("_x_") != -1) { j = h.elements[e].id; if (j.substring(j.lastIndexOf("_x_") + 3, j.length) == g) { return retornaValor(h.elements[e]) } } } } function recarregarGrid() { if (window.opener) { try { f = window.opener.document.forms[0]; for (x = 0; x < f.length; x++) { if (f[x].id.indexOf("btnPesquisar") > -1) { f[x].click(); break } } } catch (g) { } } } function recarregarGridForm() { if (document.forms[0]) { try { f = document.forms[0]; for (x = 0; x < f.length; x++) { if (f[x].id.indexOf("btnPesquisar") > -1) { f[x].click(); break } } } catch (g) { } } } function recarregarGridDialogo() { if (RetornarParentDocument()) { try { f = RetornarParentDocument().document.forms[0]; for (x = 0; x < f.length; x++) { if (f[x].id.indexOf("btnPesquisar") > -1) { f[x].click(); break } } } catch (g) { } } } function recarregarRelatorio() { if (RetornarParentDocument()) { try { f = RetornarParentDocument().document.forms[0]; if (f) { f.target = "_self"; f.__EVENTTARGET.value = ""; f.__EVENTARGUMENT.value = ""; f.submit() } } catch (g) { } } } function ChecaCNPJ(e, j) { var k = j; var h = ""; var l = ""; var m; var p = 0; var n = 0; var g; if ((k.Value.length != 14) || (isNaN(k.Value))) { j.IsValid = false; return false } m = k.Value.substring(0, 12); for (i = 1; i <= 4; i++) { p = p + (parseInt(m.charAt(i - 1)) * (6 - i)) } for (i = 5; i <= 12; i++) { p = p + (parseInt(m.charAt(i - 1)) * (14 - i)) } r1 = p % 11; if (r1 < 2) { dv1 = 0 } else { dv1 = 11 - r1 } n = dv1 * 2; for (i = 1; i <= 5; i++) { n = n + (parseInt(m.charAt(i - 1)) * (7 - i)) } for (i = 6; i <= 12; i++) { n = n + (parseInt(m.charAt(i - 1)) * (15 - i)) } r2 = n % 11; if (r2 < 2) { dv2 = 0 } else { dv2 = 11 - r2 } l = l + dv1 + dv2; g = k.Value.substring(12, 14); if (g == l) { j.IsValid = true; return true } else { j.IsValid = false; return false } } function ChecaCNPJ2(m) { var l = m.replace(".", "").replace(".", "").replace(".", "").replace("-", "").replace("/", "").replace(/_/g, ""); var e = ""; var k = ""; var n; var j = 0; var h = 0; var g; if ((l.length != 14) || (isNaN(l))) { m.IsValid = false; return false } n = l.substring(0, 12); for (i = 1; i <= 4; i++) { j = j + (parseInt(n.charAt(i - 1)) * (6 - i)) } for (i = 5; i <= 12; i++) { j = j + (parseInt(n.charAt(i - 1)) * (14 - i)) } r1 = j % 11; if (r1 < 2) { dv1 = 0 } else { dv1 = 11 - r1 } h = dv1 * 2; for (i = 1; i <= 5; i++) { h = h + (parseInt(n.charAt(i - 1)) * (7 - i)) } for (i = 6; i <= 12; i++) { h = h + (parseInt(n.charAt(i - 1)) * (15 - i)) } r2 = h % 11; if (r2 < 2) { dv2 = 0 } else { dv2 = 11 - r2 } k = k + dv1 + dv2; g = l.substring(12, 14); if (g == k) { m.IsValid = true; return true } else { m.IsValid = false; return false } } function ChecaCPF(e, j) { var l = j; var n = ""; if (l.Value.length != 11) { j.IsValid = false; return false } var h = l.Value.substring(0, 9); var p = 0; for (i = 1; i <= 9; i++) { p = p + (parseInt(h.charAt(i - 1)) * (11 - i)) } r1 = p % 11; if (r1 < 2) { dv1 = 0 } else { dv1 = 11 - r1 } var m = dv1 * 2; for (i = 1; i <= 9; i++) { m = m + (parseInt(h.charAt(i - 1)) * (12 - i)) } r2 = m % 11; if (r2 < 2) { dv2 = 0 } else { dv2 = 11 - r2 } var k = ""; k = k + dv1 + dv2; var g = l.Value.substring(9, 11); if (g == k) { j.IsValid = true; return true } else { j.IsValid = false; return false } } function VerificaEspacoTrim(g, e) { e.IsValid = (e.Value.indexOf(" ") == -1) } function $MLCustom(g, e) { g.IsValid = ($ML(document.getElementById(g.controltovalidate))) } function $ML(g) { var e = g.getAttribute("TAMaxLength"); var h = g.value; if (h.length > e) { OK("Aviso", "Sua caixa de texto atingiu o m&aacute;ximo de " + e + " caracteres."); g.value = h.substring(0, e); return false } return true } function checkMaxLength(h, g) { switch (h.keyCode) { case 37: return true; case 38: return true; case 40: return true; case 8: return true; case 27: g.value = ""; return true } return (g.value.length < g.getAttribute("TAMaxLength")) } function disableCtrlKeyCombination(k) { var h = new Array("86", "78", "67"); var g; var j; if (window.event) { g = window.event.keyCode; if (window.event.ctrlKey) { j = true } else { j = false } } else { g = k.which; if (k.ctrlKey) { j = true } else { j = false } } if (j) { for (i = 0; i < h.length; i++) { if (h[i].toLowerCase() == g) { window.event.returnValue = false } } } return true } function formataValorSoma(e) { while (e.indexOf(".") != -1) { e = e.replace(".", "") } e = parseFloat(e.replace(",", ".")); return e } function TrimJava(g) { var e = new String(g); while (e.substr(0, 1) == " ") { e = e.substr(1, e.length - 1) } while (e.substr(e.length - 1, 1) == " ") { e = e.substr(0, e.length - 2) } return e } function Arredonda(g, h) { if ((h < 0) || isNaN(h)) { return (g) } var e = Math.pow(10, h); g = g * e; g = (Math.round(g) / e); return (g) } function FormataFloat(n, q, p, h) { var m = h; var l = ""; var v = ""; var r = ""; var g = String(Arredonda(n, m)); var k = 0; var j = 0; var u = 0; var s = 0; var e = ""; var t = ""; k = g.indexOf("."); if (k >= 0) { l = g.substring(0, k); v = g.substr(k + 1, g.length - 1) } else { l = g } while (v.length < m) { v = v + "0" } j = l.length; while ((j % 3) != 0) { l = " " + l; j = l.length } for (u = 1; u <= (j / 3); u++) { if (r != "") { r = r + q } r = r + l.substr(s, 3); s = s + 3 } if (v.length > 0) { r = r + p + v } return (TrimJava(r)) } function SetValidatorsAllEnable(e) { for (i = 0; i < Page_Validators.length; i++) { Page_Validators[i].enabled = e; Page_Validators[i].IsValid = !e } } function AbrirCalendario(k, g, n) { var p = PTADetectorBrowser(); var m = 0; var j = 0; if (p.ie) { m = event.clientX + document.body.scrollLeft; j = event.clientY + document.body.scrollTop + window.screenTop + k.offsetHeight + k.offsetTop } else { m = n.pageX; j = n.pageY } var h = PTAEncontraObj(g); var l = ""; if (h) { l = h.value } AbrirJanelaDlg(PTA_sProjeto + "core/include/calendario.aspx?tDtSelecionada=" + l + "&sIdRetorno=" + g, window, 250, 170, false, false, m, j) } function SelecionaSelect(l, h) { var e = true; var k = ""; var g = 0; if (l.length > 0) { for (g = 0; g < l.length; g++) { k = l.options[g].value; if (k == h) { l.options[g].selected = true; break } } } } function ProcessarInformacao(g) { if (g) { document.body.style.cursor = "wait"; for (var l = 1; l < ProcessarInformacao.arguments.length; l++) { ProcessarInformacao.arguments[l].disabled = true } var k = document.getElementsByTagName("SELECT"); for (var e = 0; e < k.length; e++) { k[e].style.visibility = "hidden" } var h = document.getElementById("layAviso"); var j = new TamanhoDocumento(); if (h) { h.style.left = Math.abs((j.width - parseInt(h.style.width)) / 2) + "px"; h.style.top = Math.abs((j.height - parseInt(h.style.height)) / 2) + "px"; h.style.display = "block"; h.style.zIndex = 1000; h.style.textAlign = "left" } } else { document.body.style.cursor = "default"; for (var l = 1; l < ProcessarInformacao.arguments.length; l++) { ProcessarInformacao.arguments[l].disabled = false } var k = document.getElementsByTagName("SELECT"); for (var e = 0; e < k.length; e++) { k[e].style.visibility = "visible" } var h = document.getElementById("layAviso"); if (h) { h.style.display = "none" } } } var OP = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; var IE = (navigator.userAgent.indexOf("MSIE") != -1 && !OP) ? true : false; var GK = (navigator.userAgent.indexOf("Gecko") != -1) ? true : false; var NN4 = document.layers; var DOM = document.getElementById; function TOOLTIP() { this.width = 200; this.bgColor = "#FFFFE1"; this.textColor = "#000000"; this.borderColor = "#CCCCCC"; this.opacity = 100; this.cursorDistance = 10; this.text = ""; this.title = ""; this.height = 0; this.obj = 0; this.sobj = 0; this.active = false; this.create = function() { if (!this.sobj) { this.init() } var e = "<table border=0 cellspacing=0 cellpadding=3 width=" + this.width + " bgcolor=" + this.bgColor + "><tr><td class=titToolTip>" + this.title + "</td></tr><tr><td><font color=" + this.textColor + ">" + this.text + "</font></td></tr></table>"; if (NN4) { e = "<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=" + this.borderColor + ">" + e + "</td></tr></table>"; this.sobj.document.write(e); this.sobj.document.close() } else { this.sobj.border = "1px solid " + this.borderColor; this.setOpacity(); if (document.getElementById) { document.getElementById("ToolTip").innerHTML = e } else { document.all.ToolTip.innerHTML = e } } if (DOM) { this.height = this.obj.offsetHeight } else { if (IE) { this.height = this.sobj.pixelHeight } else { if (NN4) { this.height = this.obj.clip.bottom } } } this.show() }; this.init = function() { if (DOM) { this.obj = document.getElementById("ToolTip"); this.sobj = this.obj.style } else { if (IE) { this.obj = document.all.ToolTip; this.sobj = this.obj.style } else { if (NN4) { this.obj = document.ToolTip; this.sobj = this.obj } } } }; this.show = function() { var e = (document.layers ? "" : "px"); var h = mouseX; var g = mouseY; if (h + this.width + this.cursorDistance > winX) { h -= this.width + this.cursorDistance } else { h += this.cursorDistance } if (g + this.height + this.cursorDistance - scrTop > winY) { g -= this.height } else { g += this.cursorDistance } this.sobj.left = h + e; this.sobj.top = g + e; if (!this.active) { this.sobj.visibility = "visible"; this.active = true } }; this.hide = function() { if (this.sobj) { this.sobj.visibility = "hidden" } this.active = false }; this.esconderCombos = function() { for (var e = 0; e < document.forms[0].elements.length; e++) { if (document.forms[0].elements[e].type.indexOf("select") > -1) { document.forms[0].elements[e].style.visibility = "hidden" } } }; this.mostrarCombos = function() { for (var e = 0; e < document.forms[0].elements.length; e++) { if (document.forms[0].elements[e].type.indexOf("select") > -1) { document.forms[0].elements[e].style.visibility = "visible" } } }; this.setOpacity = function() { this.sobj.filter = "alpha(opacity=" + this.opacity + ")"; this.sobj.mozOpacity = ".1"; if (this.obj.filters) { this.obj.filters.alpha.opacity = this.opacity } if (!document.all && this.sobj.setProperty) { this.sobj.setProperty("-moz-opacity", this.opacity / 100, "") } } } var tooltip = mouseX = mouseY = winX = winY = scrTop = 0; if (document.layers) { document.write('<layer id="ToolTip"></layer>'); document.captureEvents(Event.MOUSEMOVE) } else { document.write('<div id="ToolTip" style="position:absolute; z-index:69"></div>') } document.onmousemove = getMouseXY; function getMouseXY(g) { if (document.body && document.body.scrollTop >= 0) { scrTop = document.body.scrollTop } else { if (window.pageYOffset >= 0) { scrTop = window.pageYOffset } } if (IE) { mouseX = event.clientX + document.body.scrollLeft; mouseY = event.clientY + document.body.scrollTop } else { mouseX = g.pageX; mouseY = g.pageY } if (mouseX < 0) { mouseX = 0 } if (mouseY < 0) { mouseY = 0 } if (GK || NN4) { winX = window.innerWidth - 25; winY = window.innerHeight } else { if (DOM) { winX = document.body.offsetWidth - 25; winY = document.body.offsetHeight } else { winX = screen.width - 25; winY = screen.height } } if (tooltip && tooltip.active) { tooltip.show() } } function toolTip(j, h, g, e) { if (h) { tooltip = new TOOLTIP(); tooltip.text = h; if (j) { tooltip.title = j } if (g) { tooltip.width = g } if (e) { tooltip.opacity = e } tooltip.create() } else { if (tooltip) { tooltip.hide() } } } function TOOLTIPPRK() { this.width = 400; this.bgColor = "#FFFFE1"; this.textColor = "#000000"; this.borderColor = "#CCCCCC"; this.moreHeight = 10; this.text = ""; this.height = 100; this.obj = 0; this.sobj = 0; this.active = false; this.init = function() { if (DOM) { this.obj = document.getElementById("ToolTipPRK"); this.sobj = this.obj.style } else { if (IE) { this.obj = document.all.ToolTip; this.sobj = this.obj.style } else { if (NN4) { this.obj = document.ToolTip; this.sobj = this.obj } } } }; this.create = function() { if (!this.sobj) { this.init() } var e = '<table onmouseout="toolTipPRKtimeDown();" border=0 cellspacing=0 cellpadding=3 width=' + this.width + " bgcolor=" + this.bgColor + '><tr><td><div style="overflow: auto; width: ' + this.width + 'px;"><font color=' + this.textColor + ">" + this.text + "</font></div></td></tr></table>"; if (NN4) { e = "<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=" + this.borderColor + ">" + e + "</td></tr></table>"; this.sobj.document.write(e); this.sobj.document.close() } else { this.sobj.border = "1px solid " + this.borderColor; if (document.getElementById) { document.getElementById("ToolTipPRK").innerHTML = e } else { document.all.ToolTip.innerHTML = e } } if (DOM) { this.height = this.obj.offsetHeight + this.moreHeight } else { if (IE) { this.height = this.sobj.pixelHeight + this.moreHeight } else { if (NN4) { this.height = this.obj.clip.bottom + this.moreHeight } } } var e = '<table onmouseout="toolTipPRKtimeDown();" border=0 cellspacing=0 cellpadding=3 width=' + this.width + " bgcolor=" + this.bgColor + '><tr><td><div style="overflow: auto; width: ' + this.width + "px; height: " + this.height + 'px;"><font color=' + this.textColor + ">" + this.text + "</font></div></td></tr></table>"; if (NN4) { e = "<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=" + this.borderColor + ">" + e + "</td></tr></table>"; this.sobj.document.write(e); this.sobj.document.close() } else { this.sobj.border = "1px solid " + this.borderColor; if (document.getElementById) { document.getElementById("ToolTipPRK").innerHTML = e } else { document.all.ToolTip.innerHTML = e } } this.show() }; this.show = function() { var e = (document.layers ? "" : "px"); var h = mouseX; var g = mouseY; if (h + this.width > winX) { h -= this.width } if (g + this.height - scrTop > winY) { g -= this.height } this.sobj.left = (h - 20) + e; this.sobj.top = (g - 20) + e; if (!this.active) { this.sobj.visibility = "visible"; this.active = true } }; this.hide = function() { if (this.sobj) { this.sobj.visibility = "hidden" } this.active = false } } var mousePrkX = mousePrkY = winPrkX = winPrkY = scrTopPrk = 0; var prkToolTip = 0; var mouseXant = mouseYant = 0; var textMen = ""; var prkInter = 0; var prkInter2 = 0; var prkActive = false; var prkActiveDown = false; var prkToolTipShowActive = false; if (document.layers) { document.write('<layer id="ToolTipPRK"></layer>') } else { document.write('<div id="ToolTipPRK" style="position:absolute; z-index:69"></div>') } function toolTipPublic(j, h, g, e) { if (h && prkActive != true) { mouseXant = mouseX; mouseYant = mouseY; textMen = h; prkInter = setInterval("toolTipPRKtime()", 1000); prkActive = true } else { if (prkToolTipShowActive == false) { prkActive = false; clearInterval(prkInter); clearInterval(prkInter2) } } } function toolTipPRKtime() { if (prkActive == true) { prkToolTip = new TOOLTIPPRK(); prkToolTip.text = textMen; prkToolTip.create(); clearInterval(prkInter); prkToolTipShowActive = true } prkActive = false } function toolTipPRKtimeDown() { if (prkActiveDown != true) { prkInter2 = setInterval("toolTipPRKtimeDownOut()", 1000); prkActiveDown = true } } function toolTipPRKtimeDownOut() { clearInterval(prkInter2); prkActiveDown = false; a = prkToolTip.sobj.left; b = prkToolTip.sobj.top; a = parseInt(a.replace("px", "")); b = parseInt(b.replace("px", "")); c = a + prkToolTip.width; d = b + +prkToolTip.height; mx = mouseX; my = mouseY; if ((mx > a && mx < c) && (my > b && my < d)) { return } if (prkToolTip) { prkToolTip.hide(); prkToolTipShowActive = false } } function createCookie(h, j, k) { var e = ""; if (k) { var g = new Date(); g.setTime(g.getTime() + (k * 24 * 60 * 60 * 1000)); e = "; expires=" + g.toGMTString() } else { } document.cookie = h + "=" + j + e + "; path=/" } function readCookie(g) { var j = g + "="; var e = document.cookie.split(";"); for (var h = 0; h < e.length; h++) { var k = e[h]; while (k.charAt(0) == " ") { k = k.substring(1, k.length) } if (k.indexOf(j) == 0) { return k.substring(j.length, k.length) } } return null } function eraseCookie(e) { createCookie(e, "", -1) } function AtacharEvento(h, e, g) { var j = new PTADetectorBrowser(); if (j.ie) { h.attachEvent("on" + e, g) } else { h.AttachEvent(e, g, false) } } String.prototype.Format = function(h) { if (arguments.length <= 1) { return h } var g = arguments.length - 2; for (var e = 0; e <= g; e++) { h = h.replace(new RegExp("\\{" + e + "\\}", "gi"), arguments[e + 1]) } return h };
