<form name="F2" method=post 
               action="./" 
               target="_self"> 
<input type=hidden name="id2" value="<?php echo NM_encode_input($this->nmgp_dados_form['id2']); ?>">
<input type=hidden name="nm_form_submit" value="1">
<input type=hidden name="nmgp_opcao" value="">
<input type=hidden name="master_nav" value="off">
<input type=hidden name="sc_ifr_height" value="">
<input type="hidden" name="nmgp_parms" value=""/>
<input type="hidden" name="nmgp_ordem" value=""/>
<input type="hidden" name="nmgp_clone" value=""/>
<input type=hidden name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
<input type=hidden name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
</form> 
<form name="F3" method="post" 
                  target="_self"> 
  <input type="hidden" name="nmgp_chave" value=""/>
  <input type="hidden" name="nmgp_opcao" value=""/>
  <input type="hidden" name="nmgp_ordem" value=""/>
  <input type="hidden" name="nmgp_chave_det" value=""/>
  <input type="hidden" name="nmgp_quant_linhas" value=""/>
  <input type="hidden" name="nmgp_url_saida" value=""/>
  <input type="hidden" name="nmgp_parms" value=""/>
  <input type="hidden" name="nmgp_outra_jan" value=""/>
  <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"/> 
  <input type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
</form> 
<form name="F5" method="post" 
                  action="./" 
                  target="_self"> 
  <input type="hidden" name="nmgp_opcao" value="<?php if ($this->nm_Start_new) {echo "ini";} elseif ($this->sc_insert_on) {echo "final";} else {echo "igual";}?>"/>
  <input type="hidden" name="nmgp_parms" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['greige_ngo_form']['parms']); ?>"/>
  <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"/> 
  <input type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
</form> 
<form name="F6" method="post" 
                  action="./" 
                  target="_self"> 
  <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"/> 
  <input type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
</form> 
<div id="id_div_process" style="display: none; margin: 10px; whitespace: nowrap" class="scFormProcessFixed"><span class="scFormProcess"><img border="0" src="<?php echo $this->Ini->path_icones; ?>/scriptcase__NM__ajax_load.gif" align="absmiddle" />&nbsp;<?php echo $this->Ini->Nm_lang['lang_othr_prcs']; ?>...</span></div>
<div id="id_div_process_block" style="display: none; margin: 10px; whitespace: nowrap"><span class="scFormProcess"><img border="0" src="<?php echo $this->Ini->path_icones; ?>/scriptcase__NM__ajax_load.gif" align="absmiddle" />&nbsp;<?php echo $this->Ini->Nm_lang['lang_othr_prcs']; ?>...</span></div>
<div id="id_fatal_error" class="scFormLabelOdd" style="display: none; position: absolute"></div>
<script type="text/javascript"> 
function sc_btn_sc_btn_0()
{
    document.F1.nmgp_parms.value = "nmgp_opcao?#?formphp?@?nm_call_php?#?sc_btn_0?@?";
    document.F1.action = "./";
    document.F1.target = "_self";
    document.F1.submit();
}
 NM_tp_critica(1);
function nm_gp_submit(apl_lig, apl_saida, parms, opc, target, modal_h, modal_w) 
{ 
   if (target == 'modal') 
   {
       par_modal = '?script_case_init=<?php echo $this->Ini->sc_page ?>&script_case_session=<?php echo session_id() ?>&nmgp_outra_jan=true&nmgp_url_saida=modal';
       if (opc != null && opc != '') 
       {
           par_modal += '&nmgp_opcao=grid';
       }
       if (parms != null && parms != '') 
       {
           par_modal += '&nmgp_parms=' + parms;
       }
       tb_show('', apl_lig + par_modal + '&TB_iframe=true&modal=true&height=' + modal_h + '&width=' + modal_w, '');
       return;
   }
   document.F3.target               = "_self"; 
   document.F3.action               = apl_lig  ;
   if (opc != null && opc != "") 
   {
       document.F3.nmgp_opcao.value = "grid" ;
   }
   else
   {
       document.F3.nmgp_opcao.value = "" ;
   }
   if (target != null && target == '_blank') 
   {
       document.F3.nmgp_outra_jan.value = "true" ;
       document.F3.target           = target; 
   }
   document.F3.nmgp_url_saida.value = apl_saida ;
   document.F3.nmgp_parms.value     = parms ;
   document.F3.submit() ;
} 

function scInlineFormSend()
{
  return false;
}

function NM_critica (form, campo, label, mask, tipo, intr, dec, min, max)
{
    this.form = form;
    this.campo = campo;
    this.label = label;
    this.mask = mask;
    this.tipo = tipo;
    this.intr = intr;
    this.dec = dec;
    this.min = min;
    this.max = max;
}
 NM_tab_crit = new NM_critica(13);
 NM_tab_crit[1] = new NM_critica('F1', 'id2', 'ID2', 'naomask', 'numeroedtvg', 11, -0, 99999999999, '<?php echo str_replace("'", "\'", $this->field_config['id2']['symbol_grp']); ?>');
 NM_tab_crit[2] = new NM_critica('F1', 'p_o_number', 'P O NUMBER', 'naomask', 'lista', 'cxab', 5, 'TUDO');
 NM_tab_crit[3] = new NM_critica('F1', 'date', 'DATE', 'naomask', 'data', '<?php echo $this->field_config['date']['date_format']; ?>'<?php echo ", '', ''"; ?>, '<?php echo $this->field_config['date']['date_sep']; ?>');
 NM_tab_crit[4] = new NM_critica('F1', 'mill', 'MILL', 'naomask', 'lista', 'cxab', 4, 'TUDO');
 NM_tab_crit[5] = new NM_critica('F1', 'location', 'LOCATION', 'naomask', 'lista', 'cxab', 4, 'TUDO');
 NM_tab_crit[6] = new NM_critica('F1', 'invoice', 'INVOICE', 'naomask', 'lista', 'cxab', 8, 'TUDO');
 NM_tab_crit[7] = new NM_critica('F1', 'style', 'STYLE', 'naomask', 'lista', 'cxab', 14, 'TUDO');
 NM_tab_crit[8] = new NM_critica('F1', 'cost_lb_k', 'COST PER LB', 'naomask', 'valorvg', 4, 2, -0, 999999, '<?php echo str_replace("'", "\'", $this->field_config['cost_lb_k']['symbol_grp']); ?>', '<?php echo str_replace("'", "\'", $this->field_config['cost_lb_k']['symbol_dec']); ?>');
 NM_tab_crit[9] = new NM_critica('F1', 'lbs', 'LBS RECEIVED', 'naomask', 'valorvg', 8, 2, -0, 9999999999, '<?php echo str_replace("'", "\'", $this->field_config['lbs']['symbol_grp']); ?>', '<?php echo str_replace("'", "\'", $this->field_config['lbs']['symbol_dec']); ?>');
 NM_tab_crit[10] = new NM_critica('F1', 'totalkc', 'INVOICE AMOUNT', 'naomask', 'valorvg', 8, 2, -0, 9999999999, '<?php echo str_replace("'", "\'", $this->field_config['totalkc']['symbol_grp']); ?>', '<?php echo str_replace("'", "\'", $this->field_config['totalkc']['symbol_dec']); ?>');
 NM_tab_crit[11] = new NM_critica('F1', 'adate', 'DATE ADDED', 'naomask', 'data', '<?php echo $this->field_config['adate']['date_format']; ?>'<?php echo ", '', ''"; ?>, '<?php echo $this->field_config['adate']['date_sep']; ?>');
 NM_tab_crit[12] = new NM_critica('F1', 'edate', 'DATE EDITED', 'naomask', 'data', '<?php echo $this->field_config['edate']['date_format']; ?>'<?php echo ", '', ''"; ?>, '<?php echo $this->field_config['edate']['date_sep']; ?>');
 NM_tab_crit[13] = new NM_critica('NM_final');
 NM_tab_crit_1 = new NM_critica(6);
 NM_tab_crit_1[1] = new NM_critica('F1', 'date', 'DATE', 'naomask', 'data', '<?php echo $this->field_config['date']['date_format']; ?>'<?php echo ", '', ''"; ?>, '<?php echo $this->field_config['date']['date_sep']; ?>');
 NM_tab_crit_1[2] = new NM_critica('F1', 'mill', 'MILL', 'naomask', 'lista', 'cxab', 4, 'TUDO');
 NM_tab_crit_1[3] = new NM_critica('F1', 'location', 'LOCATION', 'naomask', 'lista', 'cxab', 4, 'TUDO');
 NM_tab_crit_1[4] = new NM_critica('F1', 'invoice', 'INVOICE', 'naomask', 'lista', 'cxab', 8, 'TUDO');
 NM_tab_crit_1[5] = new NM_critica('F1', 'totalkc', 'INVOICE AMOUNT', 'naomask', 'valorvg', 8, 2, -0, 9999999999, '<?php echo str_replace("'", "\'", $this->field_config['totalkc']['symbol_grp']); ?>', '<?php echo str_replace("'", "\'", $this->field_config['totalkc']['symbol_dec']); ?>');
 NM_tab_crit_1[6] = new NM_critica('NM_final');

function nm_move(x, y, z) 
{ 
    if (Nm_Proc_Atualiz)
    {
        return;
    }
    if (("inicio" == x || "retorna" == x) && "S" != Nav_permite_ret)
    {
        return;
    }
    if (("avanca" == x || "final" == x) && "S" != Nav_permite_ava)
    {
        return;
    }
    document.F2.nmgp_opcao.value = x; 
    document.F2.nmgp_ordem.value = y; 
    document.F2.nmgp_clone.value = "";
    if ("apl_detalhe" == x)
    {
        document.F2.nmgp_opcao.value = 'igual'; 
        document.F2.master_nav.value = 'on'; 
        if (z)
        {
            document.F2.sc_ifr_height.value = z;
        }
        document.F2.submit();
        return;
    }
    if ("clone" == x)
    {
        x = "novo";
        document.F2.nmgp_clone.value = "S";
        document.F2.nmgp_opcao.value = x; 
    }
    if ("novo" == x || "edit_novo" == x)
    {
<?php
       $NM_parm_ifr = ($NM_run_iframe == 1) ? "NM_run_iframe?#?1?@?" : "";
?>
        document.F2.nmgp_parms.value = "<?php echo $NM_parm_ifr ?>";
        document.F2.submit();
    }
    else
    {
        do_ajax_greige_ngo_form_navigate_form();
    }
} 
var sc_mupload_ok = true;
function nm_atualiza(x, y) 
{ 
    if (!sc_mupload_ok)
    {
        if (!confirm("<?php echo $this->Ini->Nm_lang['lang_errm_muok'] ?>"))
        {
            return;
        }
        sc_mupload_ok = true;
    }
    var Nm_submit_ok = true; 
    if (Nm_Proc_Atualiz)
    {
        return;
    }
    if (!scAjaxDetailProc())
    {
        return;
    }
<?php
    $NM_parm_ifr = ($NM_run_iframe == 1) ? "NM_run_iframe?#?1?@?" : "";
?>
    document.F1.nmgp_parms.value = "<?php echo $NM_parm_ifr ?>";
    document.F1.target = "_self";
    if (x == "muda_form") 
    { 
       document.F1.nmgp_num_form.value = y; 
    } 
    if (x == "excluir") 
    { 
       if (confirm ("<?php echo html_entity_decode($this->Ini->Nm_lang['lang_errm_remv']); ?>"))  
       { 
           document.F1.nmgp_opcao.value = x; 
           document.F1.submit(); 
       } 
       else 
       { 
          return; 
       } 
    } 
    else 
    { 
       document.F1.nmgp_opcao.value = x; 
       if ("incluir" == x || "muda_form" == x)
       {
           Nm_Proc_Atualiz = true;
           document.F1.submit();
       }
       else
       {
           Nm_Proc_Atualiz = true;
           do_ajax_greige_ngo_form_submit_form();
       }
    } 
    if (Nm_submit_ok)
    { 
        Nm_Proc_Atualiz = true;
    } 
} 
function nm_mostra_img(imagem, altura, largura)
{
    tb_show('', imagem, '');
}
function nm_recarga_form(nm_ult_ancora, nm_ult_page) 
{ 
    document.F1.target = "_self";
    document.F1.nmgp_parms.value = "";
    document.F1.nmgp_ancora.value= nm_ult_page; 
    document.F1.nmgp_ancora.value= nm_ult_page; 
    document.F1.nmgp_opcao.value= "recarga"; 
    document.F1.action += "#" +  nm_ult_ancora;
    document.F1.submit(); 
} 
function nm_link_url(Sc_url)
{
    if (Sc_url.substr(0, 7) != 'http://' && Sc_url.substr(0, 8) != 'https://')
    {
        Sc_url = 'http://' + Sc_url;
    }
    return Sc_url;
}
function sc_trim(str, chars) {
        return sc_ltrim(sc_rtrim(str, chars), chars);
}
function sc_ltrim(str, chars) {
        chars = chars || "\\s";
        return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function sc_rtrim(str, chars) {
        chars = chars || "\\s";
        return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
var hasJsFormOnload = false;
function sc_exib_ocult_pag(N_pagina)
{
    document.getElementById('greige_ngo_form_form0').style.width='1px';
    document.getElementById('greige_ngo_form_form0').style.height='0px';
    document.getElementById('greige_ngo_form_form0').style.display='none';
    document.getElementById('greige_ngo_form_form0').style.overflow='scroll';
    document.getElementById('greige_ngo_form_form1').style.width='1px';
    document.getElementById('greige_ngo_form_form1').style.height='0px';
    document.getElementById('greige_ngo_form_form1').style.display='none';
    document.getElementById('greige_ngo_form_form1').style.overflow='scroll';
    document.getElementById(N_pagina).style.width='';
    document.getElementById(N_pagina).style.height='';
    document.getElementById(N_pagina).style.display='';
    document.getElementById(N_pagina).style.overflow='visible';
    sc_tab_pag(pag_ativa, 'scTabInactive');
    pag_ativa = N_pagina;
    sc_tab_pag(pag_ativa, 'scTabActive');
   if ("greige_ngo_form_form1" == N_pagina) {
     scAjaxDetailHeight("greige_grpcs_edit_grid", $($("#nmsc_iframe_liga_greige_grpcs_edit_grid")[0].contentWindow.document).innerHeight());
    }
}
function sc_tab_pag(N_pagina, C_class)
{
    document.getElementById('id_' + N_pagina + '_font').className = C_class + 'Font ' + C_class + 'FontCustom';
    document.getElementById('id_' + N_pagina + '_4').className = C_class;
    document.getElementById('id_' + N_pagina + '_5').className = C_class + ' ' + C_class + 'Bg';
    document.getElementById('id_' + N_pagina + '_6').className = C_class;
    if ('scTabActive' == C_class)
    {
        document.getElementById('id_' + N_pagina + '_tl').src = '<?php echo $this->Ini->path_img_global . '/' . $str_active_top_esq; ?>';
        document.getElementById('id_' + N_pagina + '_tr').src = '<?php echo $this->Ini->path_img_global . '/' . $str_active_top_dir; ?>';
        document.getElementById('id_' + N_pagina + '_t').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_active_lin_top; ?>)';
        document.getElementById('id_' + N_pagina + '_4').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_active_col_esq; ?>)';
        document.getElementById('id_' + N_pagina + '_6').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_active_col_dir; ?>)';
    }
    else
    {
        document.getElementById('id_' + N_pagina + '_tl').src = '<?php echo $this->Ini->path_img_global . '/' . $str_inactive_top_esq; ?>';
        document.getElementById('id_' + N_pagina + '_tr').src = '<?php echo $this->Ini->path_img_global . '/' . $str_inactive_top_dir; ?>';
        document.getElementById('id_' + N_pagina + '_t').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_inactive_lin_top; ?>)';
        document.getElementById('id_' + N_pagina + '_4').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_inactive_col_esq; ?>)';
        document.getElementById('id_' + N_pagina + '_6').style.backgroundImage = 'url(<?php echo $this->Ini->path_img_global . '/' . $str_inactive_col_dir; ?>)';
    }
}

function scCssFocus(oHtmlObj)
{
  if (navigator.userAgent && 0 < navigator.userAgent.indexOf("MSIE") && "select" == oHtmlObj.type.substr(0, 6))
    return;
  $(oHtmlObj).addClass('scFormObjectFocusOdd')
             .removeClass('scFormObjectOdd');
}

function scCssBlur(oHtmlObj)
{
  if (navigator.userAgent && 0 < navigator.userAgent.indexOf("MSIE") && "select" == oHtmlObj.type.substr(0, 6))
    return;
  $(oHtmlObj).addClass('scFormObjectOdd')
             .removeClass('scFormObjectFocusOdd');
}

</script> 
