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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

function greige_ngo_nopieces_grid_getValue(field, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("p_o_number" == field) {
    return greige_ngo_nopieces_grid_p_o_number_getValue(seqRow);
  }
  if ("date" == field) {
    return greige_ngo_nopieces_grid_date_getValue(seqRow);
  }
  if ("mill" == field) {
    return greige_ngo_nopieces_grid_mill_getValue(seqRow);
  }
  if ("location" == field) {
    return greige_ngo_nopieces_grid_location_getValue(seqRow);
  }
  if ("invoice" == field) {
    return greige_ngo_nopieces_grid_invoice_getValue(seqRow);
  }
  if ("lbs" == field) {
    return greige_ngo_nopieces_grid_lbs_getValue(seqRow);
  }
  if ("cost_lb_k" == field) {
    return greige_ngo_nopieces_grid_cost_lb_k_getValue(seqRow);
  }
  if ("totalkc" == field) {
    return greige_ngo_nopieces_grid_totalkc_getValue(seqRow);
  }
}

function greige_ngo_nopieces_grid_setValue(field, newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("p_o_number" == field) {
    greige_ngo_nopieces_grid_p_o_number_setValue(newValue, seqRow);
  }
  if ("date" == field) {
    greige_ngo_nopieces_grid_date_setValue(newValue, seqRow);
  }
  if ("mill" == field) {
    greige_ngo_nopieces_grid_mill_setValue(newValue, seqRow);
  }
  if ("location" == field) {
    greige_ngo_nopieces_grid_location_setValue(newValue, seqRow);
  }
  if ("invoice" == field) {
    greige_ngo_nopieces_grid_invoice_setValue(newValue, seqRow);
  }
  if ("lbs" == field) {
    greige_ngo_nopieces_grid_lbs_setValue(newValue, seqRow);
  }
  if ("cost_lb_k" == field) {
    greige_ngo_nopieces_grid_cost_lb_k_setValue(newValue, seqRow);
  }
  if ("totalkc" == field) {
    greige_ngo_nopieces_grid_totalkc_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);
        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();
      }
    });
}
