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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

function greige_grstyle_grid_getValue(field, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("date" == field) {
    return greige_grstyle_grid_date_getValue(seqRow);
  }
  if ("new_style" == field) {
    return greige_grstyle_grid_new_style_getValue(seqRow);
  }
  if ("type" == field) {
    return greige_grstyle_grid_type_getValue(seqRow);
  }
  if ("width" == field) {
    return greige_grstyle_grid_width_getValue(seqRow);
  }
  if ("gauge" == field) {
    return greige_grstyle_grid_gauge_getValue(seqRow);
  }
  if ("td" == field) {
    return greige_grstyle_grid_td_getValue(seqRow);
  }
  if ("top_yarn" == field) {
    return greige_grstyle_grid_top_yarn_getValue(seqRow);
  }
  if ("top_patter" == field) {
    return greige_grstyle_grid_top_patter_getValue(seqRow);
  }
  if ("bd" == field) {
    return greige_grstyle_grid_bd_getValue(seqRow);
  }
  if ("bot_yarn" == field) {
    return greige_grstyle_grid_bot_yarn_getValue(seqRow);
  }
  if ("bot_patter" == field) {
    return greige_grstyle_grid_bot_patter_getValue(seqRow);
  }
  if ("l4_yarn" == field) {
    return greige_grstyle_grid_l4_yarn_getValue(seqRow);
  }
  if ("l3_yarn" == field) {
    return greige_grstyle_grid_l3_yarn_getValue(seqRow);
  }
}

function greige_grstyle_grid_setValue(field, newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("date" == field) {
    greige_grstyle_grid_date_setValue(newValue, seqRow);
  }
  if ("new_style" == field) {
    greige_grstyle_grid_new_style_setValue(newValue, seqRow);
  }
  if ("type" == field) {
    greige_grstyle_grid_type_setValue(newValue, seqRow);
  }
  if ("width" == field) {
    greige_grstyle_grid_width_setValue(newValue, seqRow);
  }
  if ("gauge" == field) {
    greige_grstyle_grid_gauge_setValue(newValue, seqRow);
  }
  if ("td" == field) {
    greige_grstyle_grid_td_setValue(newValue, seqRow);
  }
  if ("top_yarn" == field) {
    greige_grstyle_grid_top_yarn_setValue(newValue, seqRow);
  }
  if ("top_patter" == field) {
    greige_grstyle_grid_top_patter_setValue(newValue, seqRow);
  }
  if ("bd" == field) {
    greige_grstyle_grid_bd_setValue(newValue, seqRow);
  }
  if ("bot_yarn" == field) {
    greige_grstyle_grid_bot_yarn_setValue(newValue, seqRow);
  }
  if ("bot_patter" == field) {
    greige_grstyle_grid_bot_patter_setValue(newValue, seqRow);
  }
  if ("l4_yarn" == field) {
    greige_grstyle_grid_l4_yarn_setValue(newValue, seqRow);
  }
  if ("l3_yarn" == field) {
    greige_grstyle_grid_l3_yarn_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();
      }
    });
}
