/*









































































'?Copyright:                Terceiro Milênio Informática Ltda - www.tm3.com.br










*/

/*














*/
var e_erp_tip_brwr = "ff";
//Se não possuir a propriedade fica definido como ff e não ocorre erro no script
if (navigator.appName) {
  // É o único que possui esta string
  if (navigator.appName == "Microsoft Internet Explorer") {
    e_erp_tip_brwr = "ie";
  }
  // FF e Chrome retornam este mesmo string
  else if (navigator.appName == "Netscape") {
    //Se não possuir a propriedade fica definido como ff e não ocorre erro no script
    if (navigator.userAgent) {
      // Como já foi atribuído "ff" à variável, verificar se é Chrome
      if (navigator.userAgent.indexOf("Chrome") != -1) {
        e_erp_tip_brwr = "ch";
      }
    }
  }
}
/*
Fim da detecção de Browser simplificada
*/

e_erp_attachEvent(window, "onload", tooltip_title);

function e_erp_innerText(in_element, in_text) {
  /*



  */
  if (e_erp_tip_brwr == "ie") {
    if (typeof(in_text) == "undefined") {
      return in_element.innerText;
    }
    else {
      in_element.innerText = in_text;
      return;
    }
  }
  else {
    if (typeof(in_text) == "undefined") {
      return in_element.textContent;
    }
    else {
      in_element.textContent = in_text;
      return;
    }
  }
}

function e_erp_insertAdjacentElement(in_obj, in_pos, in_new_obj) {
  /*





  */
  
  if (e_erp_tip_brwr == "ie") {
    in_obj.insertAdjacentElement(in_pos, in_new_obj);
  }
  else {
    if (in_pos == "beforeBegin") {
      in_obj.parentNode.insertBefore(in_new_obj, in_obj);
    }
    else if (in_pos == "afterBegin") {
      in_obj.insertBefore(in_new_obj, in_obj.firstChild);
    }
    else if (in_pos == "beforeEnd") {
      in_obj.appendChild(in_new_obj);
    }
    else if (in_pos == "afterEnd") {
      in_obj.parentNode.insertBefore(in_new_obj, in_obj.nextSibling);
    }
  }
}

function e_erp_attachEvent(in_obj, in_evento, in_proc) {
  /*



























  */
  var evento_atachar = in_evento;
  var arr_evt_ie     = new Array("onchange", "onclick", "ondblclick", "onfocusout", "onkeypress", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onscroll", "onselectstart", "onsubmit");
  var arr_evt_ff     = new Array("change",   "click",   "dblclick",   "focusout",   "keypress",   "load",   "mousedown",   "mousemove",   "mouseout",   "mouseover",   "mouseup",   "scroll",   "select",        "submit");
  if (e_erp_tip_brwr == "ie") {
    in_obj.attachEvent(evento_atachar, in_proc);
  } else {
    /*


    */
    for (i=0; i<=arr_evt_ie.length; i++) {
      if (arr_evt_ie[i] == in_evento) {
        evento_atachar = arr_evt_ff[i];
      }
    }
    /*


    */
    in_obj.addEventListener(evento_atachar, in_proc, true);
  }
}

function mouseover_menu(in_obj, in_cr_mnu_sel) {
  /*




  */
  if (in_obj.estado != "Ligado") {
    in_obj.style.backgroundColor = "#" + in_cr_mnu_sel;
    in_obj.style.border = "gray 1px solid";
    in_obj.style.paddingLeft = "5px";
  }
}

function mouseout_menu(in_obj, in_fundo_do_menu, in_cr_mnu_lin) {
  /*




  */
  if (in_obj.estado != "Ligado") {
    in_obj.style.backgroundColor = "#" + in_fundo_do_menu;
    in_obj.style.borderTop = "1px solid #" + in_fundo_do_menu;
    in_obj.style.borderRight = "1px solid #" + in_fundo_do_menu;
    in_obj.style.borderBottom = "1px solid #" + in_cr_mnu_lin;
    in_obj.style.borderLeft = "1px solid #" + in_fundo_do_menu;
    in_obj.style.paddingLeft = "5px";
  }
}

function do_mouseover(e) {
  /*




  */
  var obj_gerador;

  if (e_erp_tip_brwr == "ie") {
    obj_gerador = event.srcElement;
  }
  else {
    obj_gerador = e.target;
  }
  /*

  */
  if (obj_gerador != null) {
    /*

    */
    if (obj_gerador.className.toUpperCase() == "BOTAO" && obj_gerador.disabled == false) {
      obj_gerador.style.color = "#000000";
      obj_gerador.style.backgroundColor = "#b5bdd6";
      obj_gerador.style.borderColor = "darkblue";
    }
  }
}

function do_mouseout(e) {
  /*




  */
  var obj_gerador;

  if (e_erp_tip_brwr == "ie") {
    obj_gerador = event.srcElement;
  }
  else {
    obj_gerador = e.target;
  }
  /*

  */
  if (obj_gerador != null) {

    /*

    */
    if (obj_gerador.className.toUpperCase() == "BOTAO" && obj_gerador.disabled == false) {
      obj_gerador.style.color = "#776600";
      obj_gerador.style.backgroundColor = "#dcdcdc";
      obj_gerador.style.borderColor = "gray";
    }
  }
}

function do_click(e) {
  /*




  */
  var obj_gerador;

  if (e_erp_tip_brwr == "ie") {
    obj_gerador = event.srcElement;
  }
  else {
    obj_gerador = e.target;
  }
  if (obj_gerador.evita_dbl_clk != null) {
    /*







    */
    if (obj_gerador.evita_dbl_clk.toUpperCase() == "LIGADO") {
      var input = document.createElement("INPUT");
      e_erp_insertAdjacentElement(obj_gerador, "afterEnd", input);
      input.value = obj_gerador.value;
      input.style.textAlign = "center";
      input.mergeAttributes(obj_gerador);
      /*


      */
      input.disabled = true;
      obj_gerador.style.display = "none";
    }
  }
}

function do_load() {
  /*




  */
  /*

  */
  var tag = document.getElementsByTagName("*");
  /*

  */
  if (tag != null) {
    for (i_contador = 0; i_contador < tag.length; i_contador++) {
      /*


      */
      if ((((tag[i_contador].className.toUpperCase() == "TEXTO") || (tag[i_contador].tagName == "TEXTAREA")) && (tag[i_contador].readOnly)) || (((tag[i_contador].tagName == "SELECT")) && (tag[i_contador].disabled))) {
        tag[i_contador].style.backgroundColor = "#f0f0f0";
        tag[i_contador].style.color = "#808080";
      }
      else {
        if ((((tag[i_contador].className.toUpperCase() == "TEXTO") || (tag[i_contador].tagName == "TEXTAREA")) && (~ tag[i_contador].readOnly)) || (((tag[i_contador].tagName == "SELECT")) && (~ tag[i_contador].disabled))) {
          tag[i_contador].style.backgroundColor = "#ffffff";
        }
      }
      /*
      "insere o resultado do ajax. A chamada deve ser feita através de:
      "  <div id="tag_cms" pagina="nome_pagina.asp" parametros="id=333&el=444"></div>
      */
      if ((tag[i_contador].tagName == "DIV") && (tag[i_contador].id.toUpperCase() == "TAG_CMS")) {
        tag[i_contador].innerHTML = e_erp_requisita_url("/Padroes/" + tag[i_contador].pagina, tag[i_contador].parametros);
      }

    }
  }
}

function ajax_call(in_url, in_parametros) {
  /*




  */
  var ac = '';
  ac = ac + '<script language="javascript" for="window" event="onload">';
  ac = ac + '  var tag = document.all.tags("div");';
  ac = ac + '  if (tag != null) {';
  ac = ac + '    for (i_contador = 0; i_contador < tag.length; i_contador++) {';
  ac = ac + '      if (tag[i_contador].id == "tag_cms") {';
  ac = ac + '        tag[i_contador].innerHTML = e_erp_requisita_url(' + '"/Padroes/" + ' + 'tag[i_contador].pagina, tag[i_contador].parametros);';
  ac = ac + '      }';
  ac = ac + '    }';
  ac = ac + '  }';
  ac = ac + '</script>';
  document.write(ac);
}

function dados_load() {
  /*




  */
  /*

  */
  var tag = document.getElementsByTagName("*");
  /*

  */
  if (tag != null) {
  
    for (i_contador = 0; i_contador < tag.length; i_contador++) {

      /*


      */
      if ((((tag[i_contador].className.toUpperCase() == "TEXTO") || (tag[i_contador].tagName == "TEXTAREA")) && (tag[i_contador].readOnly)) || (((tag[i_contador].tagName == "SELECT")) && (tag[i_contador].disabled))) {
        tag[i_contador].style.backgroundColor = "#f5f5f5";
        tag[i_contador].style.color = "#808080";
      }
      else {
        if ((((tag[i_contador].className.toUpperCase() == "TEXTO") || (tag[i_contador].tagName == "TEXTAREA")) && (~ tag[i_contador].readOnly)) || (((tag[i_contador].tagName == "SELECT")) && (~ tag[i_contador].disabled))) {
          tag[i_contador].style.backgroundColor = "#ffffff";
        }
      }

      /*





      */
      if (tag[i_contador].className.toUpperCase() == "DIV_DADOS") {
        tag[i_contador].style.height = screen.height - 235 + "px";
      }

      /*

      */
      if (tag[i_contador].className.toUpperCase() == "FORM_DADOS") {
        //tag[i_contador].style.width = screen.width - 12;
        tag[i_contador].style.width = screen.width - 12 + "px";
      }

    }
  }
}

function dados_mouseover(e) {
  /*




  */
  var obj_gerador;

  if (e_erp_tip_brwr == "ie") {
    obj_gerador = event.srcElement;
  }
  else {
    obj_gerador = e.target;
  }
  /*

  */
  if (obj_gerador != null) {
    if ((obj_gerador.className.toUpperCase() == "BOTAO") || (obj_gerador.className.toUpperCase() == "RODAPEBOTAO")) {
      obj_gerador.style.color = "#ff6666";
    }
  }
}

function dados_mouseover_linha(in_tr) {
  /*




  */
  if (in_tr.bgColor == '#ffffff') {
    in_tr.bgColor = '#4a5a9c';
  }
}

function dados_mouseout(e) {
  /*




  */
  var obj_gerador;

  if (e_erp_tip_brwr == "ie") {
    obj_gerador = event.srcElement;
  }
  else {
    obj_gerador = e.target;
  }
  /*

  */
  if (obj_gerador != null) {
    if ((obj_gerador.className.toUpperCase() == "BOTAO") || (obj_gerador.className.toUpperCase() == "RODAPEBOTAO")) {
      obj_gerador.style.color = "#4a5a9c";
    }
  }
}

function dados_mouseout_linha(in_tr) {
  /*




  */
  if (in_tr.bgColor == '#4a5a9c') {
    in_tr.bgColor = '#ffffff';
  }
}

function dados_click_linha(in_tr) {
  /*




  */
  var tag = document.all('Linha');
  /*

  */
  if (tag != null) {
    for (i_contador = 0; i_contador < tag.length; i_contador++) {
      tag(i_contador).bgColor = '#ffffff';
    }
  }
    /*

    */
    in_tr.bgColor = "#4a5a9b";
}

function posiciona_cria_jnl_alerta(id_objeto) {
  /*




  */
  var elemento = document.getElementById(id_objeto);
  elemento.style.top = parseInt(53) + parseInt(window.document.body.scrollTop) - parseInt(elemento.style.marginTop);
}

function cria_jnl_alerta(in_titulo, in_mensagem, in_detalhe, in_width, in_url, in_parametros, in_form) {
  /*




  */
  var div_shdw = document.createElement("DIV");
  e_erp_insertAdjacentElement(window.document.body, "afterBegin", div_shdw);
  div_shdw.id = "jnl_alerta_sombra_inativa";
  div_shdw.style.height = window.document.body.scrollHeight;
  div_shdw.style.zIndex = 40;

  var div = document.createElement("DIV");
  e_erp_insertAdjacentElement(window.document.body, "afterBegin", div);
  div.id = "jnl_alerta";
  div.style.backgroundColor = "#ffffff";
  div.style.borderRight = "#ceebff 3px inset";
  div.style.borderTop = "#22627e 1px solid";
  div.style.borderLeft = "#12526e 1px solid";
  div.style.borderBottom = "#589dd6 3px ridge";
  div.style.top = "0";
  div.style.marginTop = 53 + parseInt(window.document.body.scrollTop);
  div.style.left = "0";
  div.style.marginLeft = (screen.width - in_width) / 2;
  div.style.overflow = "visible";
  div.style.zIndex = 50;
  div.style.position = "absolute";

  ponteiro_cria_jnl_alerta = function() {posiciona_cria_jnl_alerta(div.id);};
  e_erp_attachEvent(window, "onscroll", ponteiro_cria_jnl_alerta);

  var out;
  out = "<table align='center' width='" + in_width + "' cellspacing='0'>";
  out = out + "  <tr bgcolor='#eaf7ff'>";
  out = out + "    <td style='border-bottom: gray 1px solid; font-family: Arial; font-size: 11px;'>";
  out = out + "      &nbsp;&nbsp;&nbsp;<b>" + in_titulo + "</b></td>";
  out = out + "    <td style='border-bottom: gray 1px solid;' align='right'>";
  out = out + "      <img title='Fechar' style='cursor: pointer;' src='/images/Fechar.gif'";
  out = out + "        onclick='remove_alerta(\"jnl_alerta\");'";
  out = out + "      >&nbsp;";
  out = out + "    </td>";
  out = out + "  </tr>";
  out = out + "  <tr>";
  out = out + "    <td colspan='2'>";
  out = out + "      <table cellspacing='8' width='100%'>";
  out = out + "        <tr>";
  out = out + "          <td><br>" + in_mensagem + "</td>";
  out = out + "        </tr>";
  out = out + "        <tr>";
  out = out + "          <td align='center'><br>" + decodeURIComponent(in_detalhe) + "</td>";
  out = out + "        </tr>";
  out = out + "        <tr>";
  out = out + "          <td align='center'><br>";
  out = out + "            <br>";
  out = out + "            <input type='button' class='botao' style='width:75px;'";
  out = out + "              onclick='retorno = e_erp_requisita_url(\"" + in_url + "\", \"" + in_parametros + "\");";
  out = out + "                       if (retorno.length != 0){";
  out = out + "                         try {document.getElementById(\"mensagem\").innerHTML = \"<center><font color=red>\" \+ retorno \+ \"</font></center>\"} catch (e) {};";
  out = out + "                         remove_alerta(\"jnl_alerta\");";
  out = out + "                       }";
  out = out + "                       else {";
  out = out + "                       " + in_form + ".submit();";
  out = out + "                       }'";
  out = out + "              evita_dbl_clk='ligado' value='CONFIRMAR'>";
  out = out + "            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  out = out + "            <input type='button' onclick='remove_alerta(\"jnl_alerta\");' class='botao' style='width:75px;' evita_dbl_clk='ligado' value='CANCELAR'>";
  out = out + "          </td>";
  out = out + "        </tr>";
  out = out + "      </table>";
  out = out + "      <br>";
  out = out + "    </td>";
  out = out + "  </tr>";
  out = out + "</table>";

  div.innerHTML = out;

}

function remove_alerta(in_id) {
  /*




  */
  e_erp_detachEvent(window, "onscroll", posiciona_cria_jnl_alerta);
  jnl_alerta_sombra_inativa.parentNode.removeChild(jnl_alerta_sombra_inativa);
  jnl_alerta.parentNode.removeChild(jnl_alerta);
}

function dimens_tela(in_fnd_mn) {
  /*





  */
  var w = 1024;

  try {id_menu.style.backgroundColor = "#" + in_fnd_mn;} catch (e) {}


  /*

  */
  var largura_scrollbar = 20;
  var ajuste_empirico = 4;
  if (e_erp_tip_brwr != "ie") {
    largura_scrollbar = 16;
    ajuste_empirico = 0;
  }


  /*





















  */

  /*



  */
  var alt_scrll_id_menu = 0;
  var alt_scrll_id_conteudo = 0;
  var alt_scrll_id_complemento = 0;
  var alt_id_rodape = 0;
  var alt_scrll_body = 0;
  var alt_clnt_body = 0;
  var matriz_do_maior = new Array();

  try {alt_scrll_id_menu = id_menu.scrollHeight;} catch (e) {}
  try {alt_scrll_id_conteudo = id_conteudo.scrollHeight;} catch (e) {}
  try {alt_scrll_id_complemento = id_complemento.scrollHeight;} catch (e) {}
  alt_scrll_body = window.document.body.scrollHeight;
  alt_clnt_body = window.document.body.clientHeight;

  matriz_do_maior = [alt_scrll_id_menu, alt_scrll_id_conteudo, alt_scrll_id_complemento, alt_scrll_body, alt_clnt_body - 90];
  /*

  */
  alt_id_rodape = matriz_do_maior.sort(function (a,b) {return b - a})[0];
  id_base.style.height = alt_id_rodape;
  id_rodape.style.top = alt_id_rodape + 70;


  /*

  */
  var largura_menu = 171;
  var largura_complemento = 161;

  if (typeof(id_complemento) != "object") {largura_complemento = 0;}
  if (typeof(id_menu) != "object") {
    largura_menu = 0;
    try {id_conteudo.style.left = 0;} catch (e) {}
  }
  try {id_conteudo.style.width = w - largura_scrollbar - largura_menu - largura_complemento;} catch (e) {}

}

function cria_option_novo(in_obj) {
  /*

























  */

  /*

  */
  var id_select = "select_" + in_obj.nome;
  var id_input  = "input_"  + in_obj.nome;
  var fn;

  window.document.all(in_obj.nome).id = id_select;

  obj_slct = document.getElementById(in_obj.nome);

  document.write("<input id='" + id_input + "' type='text' value='' maxlength='" + in_obj.mxln + "' class='" + in_obj.clss + "' title='Faça o clique duplo neste campo se desejar reexibir a lista de opções' style='text-align:center; display:\"none\";'>");

  /*

  */
  window.document.all(id_input).value = decodeURIComponent(in_obj.vlr);

  /*



  */
  try {
    if ( window.document.all(id_select)(0).value != "" ) {
      opt = document.createElement("option");
      window.document.all.item(obj_slct.name).insertBefore(opt, window.document.all.item(obj_slct.name)(0));
      opt.value       = "";
      opt.text        = "";
    }
  }
  catch (e) {
    /*

    */
    if ( window.document.all(id_select).length == 0 ) {
      opt = document.createElement("option");
      window.document.all.item(obj_slct.name).insertBefore(opt, window.document.all.item(obj_slct.name)(0));
      opt.value       = "";
      opt.text        = "";
    }
  }

  /*

  */
  opt = document.createElement("option");
  window.document.all.item(obj_slct.name).insertBefore(opt, window.document.all.item(obj_slct.name)(1));
  opt.value       = "";
  opt.text        = "novo registro";
  opt.style.color = "#ff6600";

  fn = function() {alterna_select_input(window.event.srcElement.tagName, in_obj.nome, id_input, id_select);};

  e_erp_attachEvent(window.document.all(id_select), "onchange", fn);
  e_erp_attachEvent(window.document.all(id_input), "ondblclick", fn);

  /*

  */
  alterna_select_input("", in_obj.nome, id_input, id_select);

  function alterna_select_input(in_nome_tag_evento, in_nome_obj, in_id_input, in_id_select) {
    /*

    */

    if (in_nome_tag_evento == "SELECT") {

      if (window.document.all(in_id_select).selectedIndex == 1 && window.document.all(in_id_select)[1].text == "novo registro") {

        window.document.all(in_id_select).selectedIndex = 0;
        window.document.all(in_id_select).style.display = "none";
        window.document.all(in_id_input).style.display = "block";
        window.document.all(in_id_input).value = "";
        window.document.all(in_id_input).focus();

        window.document.all(in_id_select).name = "";
        window.document.all(in_id_input).name = in_nome_obj;

      }
    }

    else if (in_nome_tag_evento == "INPUT") {

      window.document.all(in_id_input).value = "";
      window.document.all(in_id_input).style.display = "none";

      window.document.all(in_id_select).style.display = "block";
      window.document.all(in_id_select).selectedIndex = 0;

      window.document.all(in_id_select).name = in_nome_obj;
      window.document.all(in_id_input).name = "";

    }

    else {

      /*

      */
      if (window.document.all(in_id_select).selectedIndex > 1 && window.document.all(id_input).value == "") {
        window.document.all(in_id_select).selectedIndex = 0;
      }

      else if (window.document.all(in_id_input).value != window.document.all(in_id_select).value) {
        window.document.all(in_id_input).style.display = "block";
        window.document.all(in_id_select).style.display = "none";

        window.document.all(in_id_select).name = "";
        window.document.all(in_id_input).name = in_nome_obj;

      }
    }
  }
}

function fmtd_jv(in_dado, in_tipo, in_formato) {
  /*





















  */
  var tmp_in_dado   = "";
  var decimais      = "";
  var inteiro       = "";
  var saida         = "";
  var i             = 0;
  var j             = 0;
  var str_casas_dec = "";

	var tmp_data = new Date();
	var diaok;
	var mesok;
	var anook;
	var dia;
	var mes;
	var ano;
  
  if ( in_tipo == "num" ) {
    /*


    */
    tmp_in_dado = in_dado.replace(/\./g, "");
    tmp_in_dado = tmp_in_dado.replace(",", ".");
    /*

    */
    while (i < parseInt(in_formato)) {
      str_casas_dec = str_casas_dec + "0";
      i++;
    }
    /*

    */
    if ( !isNaN(tmp_in_dado) ) {
      /*

      */
      if ( tmp_in_dado.indexOf(".") == -1 ) {
        /*

        */
        inteiro  = eval(tmp_in_dado);
        decimais = str_casas_dec;
      }
      else if ( tmp_in_dado.indexOf(".") == ( tmp_in_dado.length - 1 ) ) {
        /*

        */
        inteiro  = eval(tmp_in_dado.replace(/\./g, ""));
        decimais = str_casas_dec;
      }
      else if ( tmp_in_dado.indexOf(".") == 0 ) {
        /*

        */
        inteiro  = "0";
        decimais = tmp_in_dado.replace(/\./g, "");
        decimais = decimais + str_casas_dec;
        decimais = decimais.substr(0, parseInt(in_formato));
      }
      else {
        /*

        */
        inteiro  = tmp_in_dado.substr(0, tmp_in_dado.indexOf("."));
        decimais = tmp_in_dado.substr(tmp_in_dado.indexOf(".") + 1);
        decimais = decimais + str_casas_dec;
        decimais = decimais.substr(0, parseInt(in_formato));
      }
      /*

      */
      inteiro = inteiro.toString();
      /*

      */
      for ( i=inteiro.length - 1; i>-1; i-- ) {
        j = j + 1;
        if ( j == 3 && i > 0 ) {
          saida = "." + inteiro.substr(i, 1) + saida;
          j = 0;
        }
        else if ( j == 3 ) {
          saida = inteiro.substr(i, 1) + saida;
          j = 0;
        }
        else {
          saida = inteiro.substr(i, 1) + saida;
        }
      }
      saida = saida + "," + decimais;
    }
  }



  else if ( in_tipo == "dat" ) {
    if ( in_dado == null || in_dado == "" ) {
      saida = "";
    } else if ( in_dado.length < 10 ) {
      saida = "";
    } else if ( in_dado.indexOf(" ") != -1 ) {
      saida = "";
    } else if ( in_formato != "dma" && in_formato != "mda" && in_formato != "amd" ) {
      saida = "";
    } else if ( ( in_formato != "amd" ) && ( in_dado.substr(2, 1) != "/" || in_dado.substr(5, 1) != "/" ) ) {
      /*

      */
      saida = "";
    } else if ( in_formato == "amd" && ( in_dado.substr(4, 1) != "/" || in_dado.substr(7, 1) != "/" ) ) {
      /*

      */
      saida = "";
    } else if ( in_formato != "amd" && ( isNaN(in_dado.substr(0, 2)) || isNaN(in_dado.substr(3, 2)) || isNaN(in_dado.substr(6, 4)) ) ) {
      /*

      */
      saida = "";
    } else if ( in_formato == "amd" && ( isNaN(in_dado.substr(0, 4)) || isNaN(in_dado.substr(5, 2)) || isNaN(in_dado.substr(8, 2)) ) ) {
      /*

      */
      saida = "";
    } else {
      /*







      */
      if ( in_formato == "dma" ) {
        dia = in_dado.substr(0, 2);
        mes = in_dado.substr(3, 2);
        ano = in_dado.substr(6, 4);
      } else if ( in_formato == "mda" ) {
        dia = in_dado.substr(3, 2);
        mes = in_dado.substr(0, 2);
        ano = in_dado.substr(6, 4);
      } else {
        dia = in_dado.substr(8, 2);
        mes = in_dado.substr(5, 2);
        ano = in_dado.substr(0, 4);
      }
	    tmp_data.setFullYear(ano, mes -1, dia);
	    diaok = (tmp_data.getDate()      == dia);
	    mesok = (tmp_data.getMonth()     == mes -1);
	    anook = (tmp_data.getFullYear()  == ano);

	    if (diaok && mesok && anook) {
        saida = in_dado;
      } else {
        saida = "";
      }
    }
  }



  else if ( in_tipo == "cvt" ) {
    saida = "";
    if ( in_dado != null && in_dado != "" ) {
      if ( in_formato == "hex" ) {
        for (i = 0; i < in_dado.length; i++) {
          tmp_in_dado = tmp_in_dado + in_dado.charCodeAt(i).toString(16);
        }
        saida = tmp_in_dado;
      }
      else if ( in_formato == "dex" ) {
        for (i = 0; i < in_dado.length; i++) {
          tmp_in_dado = tmp_in_dado + String.fromCharCode("0x" + in_dado.substring(i, i + 2));
          i++;
        }
        saida = tmp_in_dado;
      }
    }
  }
  return(saida);
}

function cria_slct_grp(in_lst_parmtrs_slct) {
  /*








































  */

  var aleat_number   = Math.round(Math.random() * 1000000000).toString();
  var aleat          = ("000000000" + aleat_number).substr(aleat_number.length, 9);
  /*

  */
  var lrg_tbl        = in_lst_parmtrs_slct.lrg;
  var slct_grp;
  var slct_txt       = decodeURIComponent(in_lst_parmtrs_slct.txt).split("¡");
  var slct_vlr       = decodeURIComponent(in_lst_parmtrs_slct.vlr).split("¡");
//é valor único não precisa split
//  var slct_dflt      = decodeURIComponent(in_lst_parmtrs_slct.dflt).split("¡");
  var slct_dflt      = decodeURIComponent(in_lst_parmtrs_slct.dflt);
  var slct_qtd       = in_lst_parmtrs_slct.qtd;
  var slct_nm        = in_lst_parmtrs_slct.name;
  var opt_brc        = in_lst_parmtrs_slct.brc;
  var slct_func_disp = in_lst_parmtrs_slct.func_disp;
  var qtd_txt        = slct_txt.length;
  var grp_atual;
  var i;
  var contador       = 0;

  if (typeof(in_lst_parmtrs_slct.grp) != "undefined") {
    slct_grp = decodeURIComponent(in_lst_parmtrs_slct.grp).split("¡");
  }

  /*


















  */

  /*

  */
  var tbl_grl;
  var input_hddn;
  var tbody_grl;
  var tr_grl;
  var td_grl;
  var tbl_txt_img;
  var tbody_txt_img;
  var tr_txt_img;
  var td_img;
  var obj_img;
  var td_txt;
  var tr_sub_grp;
  var td_sub_grp;
  var tbl_sub_grp;
  var tbody_tbl_sub_grp;
  var tr_txt_grp;
  var td_txt_grp;

  /*

  */
  var div_grl;
  var slct_ff;
  var optgrp_ff;
  var option_ff;
  var option_brc_ff;



  if (e_erp_tip_brwr == "ie") {

    /*

    */
    document.write("<table id='grl_" + aleat + "'></table>");
    tbl_grl                       = document.getElementById("grl_" + aleat);
    tbl_grl.border                = "0";
    tbl_grl.cellPadding           = "0";
    tbl_grl.cellSpacing           = "0";
    tbl_grl.width                 = lrg_tbl;
    tbl_grl.style.tableLayout     = "fixed";
    tbl_grl.style.marginTop       = tbl_grl.style.marginTop + 1;

    input_hddn      = document.createElement("INPUT");
    input_hddn.type = "hidden";
    e_erp_insertAdjacentElement(tbl_grl, "beforeBegin", input_hddn);
    input_hddn.id   = "input_hddn_" + aleat;
    input_hddn.name = slct_nm;

    /*

    */
    if (typeof(slct_func_disp) != "undefined") {
      input_hddn.attachEvent("onchange", function() {eval(slct_func_disp);});
    }

    tbody_grl    = document.createElement("TBODY");
    e_erp_insertAdjacentElement(tbl_grl, "afterBegin", tbody_grl);
    tbody_grl.id = "tbody_grl_" + aleat;

    /*

    */
    tr_grl    = document.createElement("TR");
    e_erp_insertAdjacentElement(tbody_grl, "afterBegin", tr_grl);
    tr_grl.id = "tr_grl_" + aleat;

    td_grl    = document.createElement("TD");
    e_erp_insertAdjacentElement(tr_grl, "afterBegin", td_grl);
    td_grl.id = "td_grl" + aleat;

    /*

    */
    tbl_txt_img                   = document.createElement("TABLE");
    e_erp_insertAdjacentElement(td_grl, "afterBegin", tbl_txt_img);
    tbl_txt_img.id                = "tbl_txt_img_" + aleat;
    tbl_txt_img.cellPadding       = "0";
    tbl_txt_img.cellSpacing       = "0";
    tbl_txt_img.width             = "100%";
    tbl_txt_img.style.border      = "1px solid #000000";
    tbl_txt_img.style.borderRight = "1px solid #d3d3d3";
    tbl_txt_img.style.tableLayout = "fixed";

    tbody_txt_img    = document.createElement("TBODY");
    e_erp_insertAdjacentElement(tbl_txt_img, "afterBegin", tbody_txt_img);
    tbody_txt_img.id = "tbody_txt_img_" + aleat;

    /*

    */
    tr_txt_img    = document.createElement("TR");
    e_erp_insertAdjacentElement(tbody_txt_img, "afterBegin", tr_txt_img);
    tr_txt_img.id = "tr_txt_img_" + aleat;
    tr_txt_img.attachEvent("onclick", function() {var dummy = eval("td_sub_grp_" + event.srcElement.id.slice(event.srcElement.id.length - 9)); if(dummy.style.display=='none') {dummy.style.display='block'; dummy.focus();} else {dummy.style.display='none';}});
    tr_txt_img.attachEvent("onselectstart", function() {return false;});

    td_img       = document.createElement("TD");
    e_erp_insertAdjacentElement(tr_txt_img, "afterBegin", td_img);
    td_img.id    = "td_img_" + aleat;
    td_img.align = "right";
    td_img.width = "18px";

    obj_img       = document.createElement("IMG");
    e_erp_insertAdjacentElement(td_img, "afterBegin", obj_img);
    obj_img.src   = "/images/clicar.gif";
    obj_img.id    = "obj_img_" + aleat;

    td_txt                    = document.createElement("TD");
    e_erp_insertAdjacentElement(tr_txt_img, "afterBegin", td_txt);
    td_txt.id                 = "td_txt_" + aleat;
    td_txt.style.paddingLeft  = "3px";
    td_txt.style.font         = "normal 11px Arial";
    td_txt.style.cursor       = "default";
    td_txt.style.whiteSpace   = "nowrap";
    td_txt.style.overflow     = "hidden";
    td_txt.style.textOverflow = "ellipsis";
    td_txt.style.width        = "93%";
    td_txt.width              = "100%";

    /*

    */
    tr_sub_grp    = document.createElement("TR");
    e_erp_insertAdjacentElement(tr_grl, "afterEnd", tr_sub_grp);
    tr_sub_grp.id = "tr_sub_grp_" + aleat;

    td_sub_grp    = document.createElement("TD");
    e_erp_insertAdjacentElement(tr_sub_grp, "afterBegin", td_sub_grp);
    td_sub_grp.id = "td_sub_grp_" + aleat;
    td_sub_grp.style.display = "none";
    td_sub_grp.attachEvent("onfocusout", function() {var dummy = document.activeElement.parentNode.id.slice(0, document.activeElement.parentNode.id.length - 9); if ((dummy != "tr_txt_img_") & (dummy != "td_sub_grp_")) {td_sub_grp.style.display = "none";}});

    /*

    */
    div_scroll                       = document.createElement("DIV");
    e_erp_insertAdjacentElement(td_sub_grp, "afterBegin", div_scroll);
    div_scroll.id = "div_scroll_" + aleat;
    div_scroll.style.border          = "1px solid black";
    div_scroll.style.borderTop       = "0px solid black";
    div_scroll.style.borderRight     = "1px solid #000000";
    div_scroll.style.width           = "100%";
    div_scroll.style.position        = "absolute";
    div_scroll.style.backgroundColor = "#ffffff";

    /*

    */
    tbl_sub_grp                   = document.createElement("TABLE");
    e_erp_insertAdjacentElement(div_scroll, "afterBegin", tbl_sub_grp);
    tbl_sub_grp.id                = "tbl_sub_grp_" + aleat;
    tbl_sub_grp.cellPadding       = "0";
    tbl_sub_grp.cellSpacing       = "0";
    tbl_sub_grp.width             = "100%";
    tbl_sub_grp.style.borderTop   = "0px solid #000000";
    tbl_sub_grp.style.tableLayout =  "fixed";

    tbody_tbl_sub_grp    = document.createElement("TBODY");
    e_erp_insertAdjacentElement(tbl_sub_grp, "afterBegin", tbody_tbl_sub_grp);
    tbody_tbl_sub_grp.id = "tbody_tbl_sub_grp_" + aleat;

    /*

    */
    if (typeof(opt_brc) != "undefined") {
      contador = 1;
      tr_txt_grp    = document.createElement("TR");
      e_erp_insertAdjacentElement(tbody_tbl_sub_grp, "beforeEnd", tr_txt_grp);
      tr_txt_grp.id = "tr_txt_grp_" + aleat;

      td_txt_grp            = document.createElement("TD");
      e_erp_insertAdjacentElement(tr_txt_grp, "beforeEnd", td_txt_grp);
      td_txt_grp.id         = "td_txt_grp_" + aleat;
      td_txt_grp.style.font = "normal 11px Arial";
      e_erp_innerText(td_txt_grp, " ");
      td_txt_grp.valor      = "";
      td_txt_grp.attachEvent("onselectstart", function() {return false;});
      td_txt_grp.attachEvent("onmouseover", function() {event.srcElement.bgColor = "#0A246A"; event.srcElement.style.color = "#ffffff";});
      td_txt_grp.attachEvent("onmouseout", function() {event.srcElement.bgColor = "#ffffff"; event.srcElement.style.color = "#000000";});
      /*

      */
      td_txt_grp.attachEvent("onfocusout", function() {e_erp_innerText(td_txt, e_erp_innerText(event.srcElement)); input_hddn.value = ""; window.document.all(input_hddn.id).fireEvent("onchange");});
    }

    /*

    */
    for (i = 0; i < qtd_txt; i++) {
      /*

      */
      if (typeof(in_lst_parmtrs_slct.grp) != "undefined") {
        if (grp_atual != slct_grp[i]) {
          tr_txt_grp    = document.createElement("TR");
          e_erp_insertAdjacentElement(tbody_tbl_sub_grp, "beforeEnd", tr_txt_grp);
          tr_txt_grp.id = "tr_txt_grp_" + aleat;

          td_txt_grp                    = document.createElement("TD");
          e_erp_insertAdjacentElement(tr_txt_grp, "afterBegin", td_txt_grp);
          td_txt_grp.style.paddingLeft  = "3";
          td_txt_grp.style.font         = "italic bold 11px Arial";
          td_txt_grp.style.cursor       = "default";
          td_txt_grp.style.whiteSpace   = "nowrap";
          td_txt_grp.style.overflow     = "hidden";
          td_txt_grp.style.textOverflow = "ellipsis";
          td_txt_grp.style.width        = "93%";
          td_txt_grp.attachEvent("onselectstart", function() {return false;});
          e_erp_innerText(td_txt_grp, slct_grp[i]);
          contador++;
        }
        grp_atual = slct_grp[i];
      }

      tr_txt_grp                  = document.createElement("TR");
      e_erp_insertAdjacentElement(tbody_tbl_sub_grp, "beforeEnd", tr_txt_grp);

      td_txt_grp                     = document.createElement("TD");
      e_erp_insertAdjacentElement(tr_txt_grp, "afterBegin", td_txt_grp);
      td_txt_grp.width               = "100%";

      if (typeof(in_lst_parmtrs_slct.grp) != "undefined") {
        td_txt_grp.style.paddingLeft = "9px";
      }
      else {
        td_txt_grp.style.paddingLeft = "3px";
      }
      /*

      */
      td_txt_grp.style.font          = "normal 11px Arial";
      td_txt_grp.style.cursor        = "default";
      td_txt_grp.style.whiteSpace    = "nowrap";
      td_txt_grp.style.overflow      = "hidden";
      td_txt_grp.style.textOverflow  = "ellipsis";
      td_txt_grp.style.width         = "93%";
      td_txt_grp.valor               = slct_vlr[i];
      td_txt_grp.attachEvent("onselectstart", function() {return false;});
      td_txt_grp.attachEvent("onmouseover", function() {event.srcElement.bgColor = "#0A246A"; event.srcElement.style.color = "#ffffff";});
      td_txt_grp.attachEvent("onmouseout", function() {event.srcElement.bgColor = "#ffffff"; event.srcElement.style.color = "#000000";});
      td_txt_grp.attachEvent("onfocusout", function() {e_erp_innerText(td_txt, e_erp_innerText(event.srcElement)); input_hddn.value = event.srcElement.valor; window.document.all(input_hddn.id).fireEvent("onchange");});


      if (slct_vlr[i] == slct_dflt) {
        e_erp_innerText(td_txt, slct_txt[i]);
        input_hddn.value = slct_vlr[i];
      }
      e_erp_innerText(td_txt_grp, slct_txt[i]);
    }

    if ((qtd_txt + contador) > slct_qtd) {
      div_scroll.style.overflowY   = "scroll";
      div_scroll.style.height      = slct_qtd * 15 + "px";
    }
  }

  else {
    document.write("<div id='div_slct_ff_" + aleat + "'></div>");
    div_grl              = document.getElementById("div_slct_ff_" + aleat);
    div_grl.border       = "0";
    slct_ff              = document.createElement("SELECT");
    e_erp_insertAdjacentElement(div_grl, "afterBegin", slct_ff);
    slct_ff.id           = "slct_ff_" + aleat;
    slct_ff.style.width  = lrg_tbl;
    slct_ff.name         = slct_nm;
    slct_ff.style.height = "18px";

    if (typeof(opt_brc) != "undefined") {
      option_brc_ff              = document.createElement("OPTION");
      e_erp_insertAdjacentElement(slct_ff, "afterBegin", option_brc_ff);
      option_brc_ff.style.height = "15px";
    }

    for (i = 0; i < qtd_txt; i++) {
      if (typeof(in_lst_parmtrs_slct.grp) != "undefined") {
        if (grp_atual != slct_grp[i]) {
          optgrp_ff       = document.createElement("OPTGROUP");
          e_erp_insertAdjacentElement(slct_ff, "beforeEnd", optgrp_ff);
          optgrp_ff.id    = "optgrp_ff_" + aleat;
          optgrp_ff.label = slct_grp[i];
        }
        grp_atual = slct_grp[i];
        option_ff              = document.createElement("OPTION");
        e_erp_insertAdjacentElement(optgrp_ff, "beforeEnd", option_ff);
        option_ff.id           = "option_ff_" + aleat;
        option_ff.textContent  = slct_txt[i];
        option_ff.value        = slct_vlr[i];
        option_ff.style.height = "15px";
      }
      else {
        option_ff              = document.createElement("OPTION");
        e_erp_insertAdjacentElement(slct_ff, "beforeEnd", option_ff);
        option_ff.id           = "option_ff_" + aleat;
        option_ff.textContent  = slct_txt[i];
        option_ff.value        = slct_vlr[i];
        option_ff.style.height = "15px";
      }
      if (slct_vlr[i] == slct_dflt) {
        option_ff.selected = true;
      }
    }
  }
}

function tooltip_title() {
  /*




  */
  var e_erp_tooltip_title_flh;
  var i_contador;
  var tag = document.all;
  var titulo_dica;
  var e_erp_tooltip_title_grl;
  var e_erp_tooltip_title_int;

  e_erp_tooltip_title_grl                 = document.createElement("DIV");
  e_erp_insertAdjacentElement(window.document.body, "afterBegin", e_erp_tooltip_title_grl);
  e_erp_tooltip_title_grl.style.width     = "278px";
  e_erp_tooltip_title_grl.style.position  = "absolute";
  e_erp_tooltip_title_grl.style.zIndex    = 100;

  e_erp_tooltip_title_int = document.createElement("DIV");
  e_erp_insertAdjacentElement(e_erp_tooltip_title_grl, "afterBegin", e_erp_tooltip_title_int);

  e_erp_tooltip_title_flh = document.createElement("DIV");
  e_erp_insertAdjacentElement(e_erp_tooltip_title_grl, "afterBegin", e_erp_tooltip_title_flh);

  if (tag != null) {
    for (i_contador = 0; i_contador < tag.length; i_contador++) {
      if (tag[i_contador].title) {
        tag[i_contador].setAttribute("titulo_dica", tag[i_contador].getAttribute("title"));
        tag[i_contador].removeAttribute("title");

        tag[i_contador].onmouseover =  function() {

          /*






          */
          e_erp_tooltip_title_flh.innerHTML = this.getAttribute("titulo_dica");
          
          e_erp_tooltip_title_flh.style.backgroundColor = "#FFFFE1";
          e_erp_tooltip_title_flh.style.display         = "block";
          e_erp_tooltip_title_flh.style.border          = "1 solid #000000";
          e_erp_tooltip_title_flh.style.paddingLeft     = "3";
          e_erp_tooltip_title_flh.style.paddingTop      = "3";
          e_erp_tooltip_title_flh.style.paddingRight    = "3";
          e_erp_tooltip_title_flh.style.paddingBottom   = "3";
          e_erp_tooltip_title_flh.style.position        = "absolute";
          e_erp_tooltip_title_flh.style.font            = "12px arial";
          e_erp_tooltip_title_flh.style.zIndex          = 100;
          e_erp_tooltip_title_grl.style.marginLeft      = "0px";

          e_erp_tooltip_title_grl.style.top             = window.event.clientY + 18 + window.document.body.scrollTop;
          e_erp_tooltip_title_grl.style.left            = window.event.clientX + window.document.body.scrollLeft;

          if ((parseInt(decodeURIComponent(event.clientX).split("px")) + 278) > window.document.body.clientWidth) {
            e_erp_tooltip_title_grl.style.textAlign       = "right";
            e_erp_tooltip_title_grl.style.marginLeft      = "-278px";

            e_erp_tooltip_title_int.style.border          = "1 solid #ff00ff";
            e_erp_tooltip_title_int.style.backgroundColor = "#ff00ff";
            e_erp_tooltip_title_int.style.visibility      = "hidden";
            e_erp_tooltip_title_int.style.display         = "inline";
            e_erp_innerText(e_erp_tooltip_title_int, this.getAttribute("titulo_dica"));
            e_erp_tooltip_title_flh.style.textAlign       = "left";
            e_erp_innerText(e_erp_tooltip_title_flh, this.getAttribute("titulo_dica"));
          }
          else {
            e_erp_tooltip_title_grl.style.textAlign  = "left";
          }
        };

        tag[i_contador].onmouseout =  function() {
          e_erp_innerText(e_erp_tooltip_title_flh, "");
          e_erp_tooltip_title_flh.style.display = "none";
        };

      }
    }
  }
}

function janela_sobre() {
  /*




  */
  window.open("/Padroes/Sobre.asp","_blank","fullscreen=no,channelmode=no,toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=115,left=200,width=370,height=170");
}

function drag_div_apres_cont_sobre(in_div_id) {
  /*




  */
  document.getElementById(in_div_id).style.left = window.event.x - 180 + document.body.scrollLeft;
  document.getElementById(in_div_id).style.top = window.event.y - 80 + document.body.scrollTop;
}

function change_div_apres_cont_sobre(in_div_id) {
  /*




  */
  document.getElementById(in_div_id).style.left = (window.document.body.clientWidth - 800) / 2 + window.document.body.scrollLeft;
  document.getElementById(in_div_id).style.top  = (window.document.body.clientHeight - 300) / 2 + window.document.body.scrollTop;
}

function close_window_div_apres_cont_sobre(in_div_id) {
  /*




  */
  if(document.getElementById(in_div_id).style.display == "block") {
    document.getElementById(in_div_id).style.display = "none";
  }
}

function e_erp_chkcomplexidadesenha(in_senha, in_str_fracas, in_largura_div) {
  /*





           <div id="barracomplexidadesenha" style="font-size:8px; float:right; width:80px; text-align:center; background-image:url(/images/bg_strength_gradient.jpg); background-repeat: no-repeat; background-position:0 0;">&nbsp;</div>
























  */
  var comprimento_senha  = in_senha.length;
  var cod_char_verificar = 0;
  var posbarracor        = 0;
  var pontos             = 0;
  var pontuacao          = 0;
  var mtz_in_str_fracas  = in_str_fracas.split(/¬/);
  var largurabarracor    = 500;

  /*

  */
  var usuais = new Array("01234","012345","0123456","01234567","012345678","12345","123456","1234567","12345678","123456789","102030","qualidade","10203","jesus","101010","142536","121212","123123","deusefiel","abc123","212121","112233","123mudar","202020","brasil","151515","252525","232323");
  /*

  */
  var especiais = new Array(" ","!","\"","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_","`","{","|","}","~");

  if (comprimento_senha > 0){
    
    document.getElementById("barracomplexidadesenha").style.display = "block";

    /*

    */
    if (in_senha.match(/\d+/)) pontos+=10;

    /*

    */
    if (in_senha.toLowerCase().match(/[a-z]/)) pontos+=26;

    /*

    */
    for (i=0;i<comprimento_senha;i++){
      for (j=0;j<especiais.length;j++){
        if (in_senha.toString().charAt(i) == especiais[j]){
          pontos+=33;
          break;
        }
      }
      if (in_senha.toString().charAt(i) == especiais[j]){
        break;
      }
    }

    /*

    */
    for (i=0;i<comprimento_senha;i++){
      cod_char_verificar = in_senha.toString().charCodeAt(i);
      if (cod_char_verificar >= 127){
        pontos+=128;
        break;
      }
    }

    /*

    */
    pontuacao = Math.log(Math.pow(pontos, comprimento_senha)) / Math.log(10);

    posbarracor = pontuacao >= 21 ? largurabarracor - in_largura_div : Math.ceil((largurabarracor - in_largura_div) / 21 * pontuacao);

    /*

    */
    for (i=0;i<usuais.length;i++){
      if (in_senha.toLowerCase().toString() == usuais[i].toString()){
        posbarracor = 0;
        pontuacao   = 0;
        break;
      }
    }

    /*

    */
    for (i=0;i<mtz_in_str_fracas.length;i++){
      if (mtz_in_str_fracas[i].toLowerCase().toString().indexOf(in_senha.toLowerCase().toString()) > -1){
        posbarracor = 0;
        pontuacao   = 0;
        break;
      }
    }

    /*

    */

    document.getElementById("barracomplexidadesenha").style.backgroundPosition = "-" + posbarracor + "px";
    document.getElementById("complexidade_senha").value = pontuacao;
    if (pontuacao >= 20){
      document.getElementById("barracomplexidadesenha").style.color = "#FFFFFF";
    }
    else {
      document.getElementById("barracomplexidadesenha").style.color = "#000000";
    }
  }
  else {
    document.getElementById("barracomplexidadesenha").style.display = "none";
  }  
}

function e_erp_ean13(in_cod) {
  /*




























  */
  var out_cod_pais     = "";
  var out_cod_emp_pais = "";
  var out_cod_prod     = "";
  var out_dc           = "";
  
  if (!isNaN(in_cod) && in_cod.length == 13) {
    var soma     = 0;
    var dig      = "";
    var mtz_dgts = "";
    var i;
    var resto;

    var dc = in_cod.substr(12, 1);

    mtz_dgts = in_cod.split("",13);

    /*

    */
    for (i = 0; i < mtz_dgts.length - 1; i++) {
      if (i % 2 == 0) {
        soma += eval(mtz_dgts[i]);
      }
      else {
        soma += eval(mtz_dgts[i]) * 3;
      }
    };
    resto = soma % 10;
    if (resto == 0) {
      dig = 0;
    }
    else {
      dig = ((Math.floor(soma / 10) + 1) * 10) - soma
    }

    if (dc == dig) {
      var out_cod_pais     = in_cod.substr(0, 3);
      var out_cod_emp_pais = in_cod.substr(3, 4);
      var out_cod_prod     = in_cod.substr(7, 5);
      var out_dc           = dig.toString();
      return(out_cod_pais + "¡" + out_cod_emp_pais + "¡" + out_cod_prod + "¡" + out_dc);
    }
    else {
      return("erro");
    }
  }
  else {
    return("erro");
  }
}

function e_erp_dun14(in_cod) {
  /*






























  */
  var out_cod_emb      = "";
  var out_cod_pais     = "";
  var out_cod_emp_pais = "";
  var out_cod_prod     = "";
  var out_dc           = "";
  
  if (!isNaN(in_cod) && in_cod.length == 14) {
    var soma     = 0;
    var dig      = "";
    var mtz_dgts = "";
    var i;
    var resto;

    var dc = in_cod.substr(13, 1);

    mtz_dgts = in_cod.split("",14);

    /*

    */
    for (i = 0; i < mtz_dgts.length - 1; i++) {
      if (i % 2 == 0) {
        soma += eval(mtz_dgts[i]) * 3;
      }
      else {
        soma += eval(mtz_dgts[i]);
      }
    };
    resto = soma % 10;
    if (resto == 0) {
      dig = 0;
    }
    else {
      dig = ((Math.floor(soma / 10) + 1) * 10) - soma
    }

    if (dc == dig) {
      var out_cod_emb      = in_cod.substr(0, 1);
      var out_cod_pais     = in_cod.substr(1, 3);
      var out_cod_emp_pais = in_cod.substr(4, 4);
      var out_cod_prod     = in_cod.substr(8, 5);
      var out_dc           = dig.toString();
      return(out_cod_emb + "¡" + out_cod_pais + "¡" + out_cod_emp_pais + "¡" + out_cod_prod + "¡" + out_dc);
    }
    else {
      return("erro");
    }
  }
  else {
    return("erro");
  }
}

function e_erp_ver_ead_slide(in_url) {
  /*

  */
  var larguratela   = window.screen.width;
  var alturatela    = window.screen.height
  var largurajanela = 990;
  var alturajanela  = 610;
  var posicao_h     = parseInt((larguratela - largurajanela) / 2) - 4;
  var posicao_v     = parseInt((alturatela - alturajanela) / 2) - 60;
  /*

  */
  window.open(in_url,"_blank","fullscreen=0,channelmode=0,toolbar=0,location=1,directories=0,status=1,menubar=1,resizable=1,top=" + posicao_v + ",left=" + posicao_h + ",width=" + largurajanela + ",height=" + alturajanela + "");
}

function e_erp_detachEvent(in_obj, in_evento, in_proc) {
  /*



























  */
  var evento_desatachar = in_evento;
  var arr_evt_ie     = new Array("onchange", "onclick", "ondblclick", "onfocusout", "onkeypress", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onscroll", "onselectstart", "onsubmit");
  var arr_evt_ff     = new Array("change",   "click",   "dblclick",   "focusout",   "keypress",   "load",   "mousedown",   "mousemove",   "mouseout",   "mouseover",   "mouseup",   "scroll",   "select",        "submit");
  if (e_erp_tip_brwr == "ie") {
    in_obj.detachEvent(evento_desatachar, in_proc);
  } else {
    /*


    */
    for (i=0; i<=arr_evt_ie.length; i++) {
      if (arr_evt_ie[i] == in_evento) {
        evento_desatachar = arr_evt_ff[i];
      }
    }
    /*


    */
    in_obj.removeEventListener(evento_desatachar, in_proc, true);
  }
}

