function billing_invoice_grid_invoice_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_invoice" + seqRow).html();
}

function billing_invoice_grid_invoice_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_invoice" + seqRow).html(newValue);
}

function billing_invoice_grid_appno_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_appno" + seqRow).html();
}

function billing_invoice_grid_appno_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_appno" + seqRow).html(newValue);
}

function billing_invoice_grid_date_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_date" + seqRow).html();
}

function billing_invoice_grid_date_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_date" + seqRow).html(newValue);
}

function billing_invoice_grid_bcode_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_bcode" + seqRow).html();
}

function billing_invoice_grid_bcode_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_bcode" + seqRow).html(newValue);
}

function billing_invoice_grid_scode_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_scode" + seqRow).html();
}

function billing_invoice_grid_scode_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_scode" + seqRow).html(newValue);
}

function billing_invoice_grid_salesman_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_salesman" + seqRow).html();
}

function billing_invoice_grid_salesman_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_salesman" + seqRow).html(newValue);
}

function billing_invoice_grid_terms_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_terms" + seqRow).html();
}

function billing_invoice_grid_terms_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_terms" + seqRow).html(newValue);
}

function billing_invoice_grid_add_ons_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_add_ons" + seqRow).html();
}

function billing_invoice_grid_add_ons_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_add_ons" + seqRow).html(newValue);
}

function billing_invoice_grid_add_charge_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_add_charge" + seqRow).html();
}

function billing_invoice_grid_add_charge_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_add_charge" + seqRow).html(newValue);
}

function billing_invoice_grid_amount_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_amount" + seqRow).html();
}

function billing_invoice_grid_amount_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_amount" + seqRow).html(newValue);
}

function billing_invoice_grid_getValue(field, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("invoice" == field) {
    return billing_invoice_grid_invoice_getValue(seqRow);
  }
  if ("appno" == field) {
    return billing_invoice_grid_appno_getValue(seqRow);
  }
  if ("date" == field) {
    return billing_invoice_grid_date_getValue(seqRow);
  }
  if ("bcode" == field) {
    return billing_invoice_grid_bcode_getValue(seqRow);
  }
  if ("scode" == field) {
    return billing_invoice_grid_scode_getValue(seqRow);
  }
  if ("salesman" == field) {
    return billing_invoice_grid_salesman_getValue(seqRow);
  }
  if ("terms" == field) {
    return billing_invoice_grid_terms_getValue(seqRow);
  }
  if ("add_ons" == field) {
    return billing_invoice_grid_add_ons_getValue(seqRow);
  }
  if ("add_charge" == field) {
    return billing_invoice_grid_add_charge_getValue(seqRow);
  }
  if ("amount" == field) {
    return billing_invoice_grid_amount_getValue(seqRow);
  }
}

function billing_invoice_grid_setValue(field, newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("invoice" == field) {
    billing_invoice_grid_invoice_setValue(newValue, seqRow);
  }
  if ("appno" == field) {
    billing_invoice_grid_appno_setValue(newValue, seqRow);
  }
  if ("date" == field) {
    billing_invoice_grid_date_setValue(newValue, seqRow);
  }
  if ("bcode" == field) {
    billing_invoice_grid_bcode_setValue(newValue, seqRow);
  }
  if ("scode" == field) {
    billing_invoice_grid_scode_setValue(newValue, seqRow);
  }
  if ("salesman" == field) {
    billing_invoice_grid_salesman_setValue(newValue, seqRow);
  }
  if ("terms" == field) {
    billing_invoice_grid_terms_setValue(newValue, seqRow);
  }
  if ("add_ons" == field) {
    billing_invoice_grid_add_ons_setValue(newValue, seqRow);
  }
  if ("add_charge" == field) {
    billing_invoice_grid_add_charge_setValue(newValue, seqRow);
  }
  if ("amount" == field) {
    billing_invoice_grid_amount_setValue(newValue, seqRow);
  }
}

function scJQAddEvents(seqRow) {
  seqRow = scSeqNormalize(seqRow);
}

function scSeqNormalize(seqRow) {
  var newSeqRow = seqRow.toString();
  if ("" == newSeqRow) {
    return "";
  }
  if ("_" != newSeqRow.substr(0, 1)) {
    return "_" + newSeqRow;
  }
  return newSeqRow;
}
function ajax_navigate(opc, parm)
{
    scAjaxProcOn();
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_navigate&script_case_init=" + document.F4.script_case_init.value + "&script_case_session=" + document.F4.script_case_session.value + "&opc=" + opc  + "&parm=" + parm,
      success: function(jsonNavigate) {
        var i, oResp;
        eval("oResp = " + jsonNavigate);
        document.getElementById('nmsc_iframe_liga_A_billing_invoice_grid').src = 'NM_Blank_Page.htm';
        document.getElementById('nmsc_iframe_liga_E_billing_invoice_grid').src = 'NM_Blank_Page.htm';
        document.getElementById('nmsc_iframe_liga_D_billing_invoice_grid').src = 'NM_Blank_Page.htm';
        document.getElementById('nmsc_iframe_liga_B_billing_invoice_grid').src = 'NM_Blank_Page.htm';
        document.getElementById('nmsc_iframe_liga_A_billing_invoice_grid').style.height = '0px';
        document.getElementById('nmsc_iframe_liga_E_billing_invoice_grid').style.height = '0px';
        document.getElementById('nmsc_iframe_liga_D_billing_invoice_grid').style.height = '0px';
        document.getElementById('nmsc_iframe_liga_B_billing_invoice_grid').style.height = '0px';
        document.getElementById('nmsc_iframe_liga_A_billing_invoice_grid').style.width  = '0px';
        document.getElementById('nmsc_iframe_liga_E_billing_invoice_grid').style.width  = '0px';
        document.getElementById('nmsc_iframe_liga_D_billing_invoice_grid').style.width  = '0px';
        document.getElementById('nmsc_iframe_liga_B_billing_invoice_grid').style.width  = '0px';
        if (oResp["redirInfo"]) {
           scAjaxRedir(oResp);
        }
        if (oResp["setValue"]) {
          for (i = 0; i < oResp["setValue"].length; i++) {
               $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
          }
        }
        if (oResp["setVar"]) {
          for (i = 0; i < oResp["setVar"].length; i++) {
               eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
          }
        }
        if (oResp["setDisplay"]) {
          for (i = 0; i < oResp["setDisplay"].length; i++) {
               document.getElementById(oResp["setDisplay"][i]["field"]).style.display = oResp["setDisplay"][i]["value"];
          }
        }
        if (oResp["setDisabled"]) {
          for (i = 0; i < oResp["setDisabled"].length; i++) {
               document.getElementById(oResp["setDisabled"][i]["field"]).disabled = oResp["setDisabled"][i]["value"];
          }
        }
        if (oResp["setClass"]) {
          for (i = 0; i < oResp["setClass"].length; i++) {
               document.getElementById(oResp["setClass"][i]["field"]).className = oResp["setClass"][i]["value"];
          }
        }
        if (oResp["setSrc"]) {
          for (i = 0; i < oResp["setSrc"].length; i++) {
               document.getElementById(oResp["setSrc"][i]["field"]).src = oResp["setSrc"][i]["value"];
          }
        }
        if (oResp["redirInfo"]) {
           scAjaxRedir(oResp);
        }
        if (oResp["htmOutput"]) {
           scAjaxShowDebug(oResp);
        }
        if (!SC_Link_View)
        {
            if (Qsearch_ok)
            {
                scQSInitVal = $("#SC_fast_search_top").val();
                scQSInit = true;
                scQuickSearchInit(false, '');
                $('#SC_fast_search_top').listen();
                scQuickSearchKeyUp('top', null);
                scQSInit = false;
            }
            SC_init_jquery();
            tb_init('a.thickbox, area.thickbox, input.thickbox');
        }
        scAjaxProcOff();
      }
    });
}
