
 <form name="form_ajax_redir_1" method="post" style="display: none">
  <input type="hidden" name="nmgp_parms">
  <input type="hidden" name="nmgp_outra_jan">
  <input type="hidden" name="script_case_session" value="<?php echo session_id() ?>">
 </form>
 <form name="form_ajax_redir_2" method="post" style="display: none">
  <input type="hidden" name="nmgp_parms">
  <input type="hidden" name="nmgp_url_saida">
  <input type="hidden" name="script_case_init">
  <input type="hidden" name="script_case_session" value="<?php echo session_id() ?>">
 </form>

 <SCRIPT>
<?php
sajax_show_javascript();
?>

  function scCenterElement(oElem)
  {
    var $oElem    = $(oElem),
        $oWindow  = $(this),
        iElemTop  = Math.round(($oWindow.height() - $oElem.height()) / 2),
        iElemLeft = Math.round(($oWindow.width()  - $oElem.width())  / 2);

    $oElem.offset({top: iElemTop, left: iElemLeft});
  } // scCenterElement

  function scAjaxHideAutocomp(sFrameId)
  {
    if (document.getElementById("id_ac_frame_" + sFrameId))
    {
      document.getElementById("id_ac_frame_" + sFrameId).style.display = "none";
    }
  } // scAjaxHideAutocomp

  function scAjaxShowAutocomp(sFrameId)
  {
    if (document.getElementById("id_ac_frame_" + sFrameId))
    {
      document.getElementById("id_ac_frame_" + sFrameId).style.display = "";
      document.getElementById("id_ac_" + sFrameId).focus();
    }
  } // scAjaxShowAutocomp

  function scAjaxHideDebug()
  {
    if (document.getElementById("id_debug_window"))
    {
      document.getElementById("id_debug_window").style.display = "none";
      document.getElementById("id_debug_text").innerHTML = "";
    }
  } // scAjaxHideDebug

  function scAjaxShowDebug(oTemp)
  {
    if (!document.getElementById("id_debug_window"))
    {
      return;
    }
    if (oTemp && oTemp != null)
    {
        oResp = oTemp;
    }
    if (oResp["htmOutput"] && "" != oResp["htmOutput"])
    {
      document.getElementById("id_debug_window").style.display = "";
      document.getElementById("id_debug_text").innerHTML = scAjaxFormatDebug(oResp["htmOutput"]) + document.getElementById("id_debug_text").innerHTML;
      scCenterElement(document.getElementById("id_debug_window"));
    }
  } // scAjaxShowDebug

  function scAjaxFormatDebug(sDebugMsg)
  {
    return "<table class=\"scFormMessageTable\" style=\"margin: 1px; width: 100%\"><tr><td class=\"scFormMessageMessage\">" + scAjaxSpecCharParser(sDebugMsg) + "</td></tr></table>";
  } // scAjaxFormatDebug

  function scAjaxHideErrorDisplay(sErrorId, bForce)
  {
    if (document.getElementById("id_error_display_" + sErrorId + "_frame"))
    {
      document.getElementById("id_error_display_" + sErrorId + "_frame").style.display = "none";
      document.getElementById("id_error_display_" + sErrorId + "_text").innerHTML = "";
      if (null == bForce)
      {
          bForce = true;
      }
      if (bForce)
      {
          var $oField = $('#id_sc_field_' + sErrorId);
          if (0 < $oField.length)
          {
              $oField.removeClass(sc_css_status);
          }
      }
    }
    if (document.getElementById("id_error_display_fixed"))
    {
      document.getElementById("id_error_display_fixed").style.display = "none";
    }
  } // scAjaxHideErrorDisplay

  function scAjaxShowErrorDisplay(sErrorId, sErrorMsg)
  {
    if (oResp && oResp['redirExitInfo'])
    {
      sErrorMsg += "<br /><input type=\"button\" onClick=\"window.location='" + oResp['redirExitInfo']['action'] + "'\" value=\"Ok\">";
    }
    sErrorMsg = scAjaxErrorSql(sErrorMsg);
    if (document.getElementById("id_error_display_" + sErrorId + "_frame"))
    {
      document.getElementById("id_error_display_" + sErrorId + "_frame").style.display = "";
      document.getElementById("id_error_display_" + sErrorId + "_text").innerHTML = sErrorMsg;
      if ("table" == sErrorId)
      {
        scCenterElement(document.getElementById("id_error_display_" + sErrorId + "_frame"));
      }
      var $oField = $('#id_sc_field_' + sErrorId);
      if (0 < $oField.length)
      {
        $oField.addClass(sc_css_status);
      }
    }
    if (ajax_error_list && ajax_error_list[sErrorId] && ajax_error_list[sErrorId]["timeout"] && 0 < ajax_error_list[sErrorId]["timeout"])
    {
      setTimeout("scAjaxHideErrorDisplay('" + sErrorId + "', false)", ajax_error_list[sErrorId]["timeout"] * 1000);
    }
    /*else if ("table" == sErrorId)
    {
      document.getElementById("id_error_display_" + sErrorId + "_frame").style.left = posDispLeft + "px";
      document.getElementById("id_error_display_" + sErrorId + "_frame").style.top = posDispTop + "px";
    }*/
  } // scAjaxShowErrorDisplay

  var iErrorSqlId = 1;

  function scAjaxErrorSql(sErrorMsg)
  {
    var iTmpPos = sErrorMsg.indexOf("{SC_DB_ERROR_INI}"),
        sTmpId;
    while (-1 < iTmpPos)
    {
      sTmpId    = "sc_id_error_sql_" + iErrorSqlId;
      sErrorMsg = sErrorMsg.substr(0, iTmpPos) + "<br /><span style=\"text-decoration: underline\" onClick=\"$('#" + sTmpId + "').show(); scCenterElement(document.getElementById('" + sTmpId + "'))\">" + sErrorMsg.substr(iTmpPos + 17);
      iTmpPos   = sErrorMsg.indexOf("{SC_DB_ERROR_MID}");
      sErrorMsg = sErrorMsg.substr(0, iTmpPos) + "</span><table class=\"scFormErrorTable\" id=\"" + sTmpId + "\" style=\"display: none; position: absolute\"><tr><td>" + sErrorMsg.substr(iTmpPos + 17);
      iTmpPos   = sErrorMsg.indexOf("{SC_DB_ERROR_CLS}");
      sErrorMsg = sErrorMsg.substr(0, iTmpPos) + "<br /><br /><span onClick=\"$('#" + sTmpId + "').hide()\">" + sErrorMsg.substr(iTmpPos + 17);
      iTmpPos   = sErrorMsg.indexOf("{SC_DB_ERROR_END}");
      sErrorMsg = sErrorMsg.substr(0, iTmpPos) + "</span></td></tr></table>" + sErrorMsg.substr(iTmpPos + 17);
      iTmpPos   = sErrorMsg.indexOf("{SC_DB_ERROR_INI}");
      iErrorSqlId++;
    }
    return sErrorMsg;
  } // scAjaxErrorSql

  function scAjaxHideMessage()
  {
    if (document.getElementById("id_message_display_frame"))
    {
      document.getElementById("id_message_display_frame").style.display = "none";
      document.getElementById("id_message_display_text").innerHTML = "";
    }
  } // scAjaxHideMessage

  function scAjaxShowMessage()
  {
    if (!oResp["msgDisplay"] || !oResp["msgDisplay"]["msgText"])
    {
      return;
    }
    _scAjaxShowMessage(scMsgDefTitle, oResp["msgDisplay"]["msgText"], false, sc_ajaxMsgTime, false, "Ok", 0, 0, 0, 0, "", "", "", false, true);
  } // scAjaxShowMessage

  var scMsgDefClose = "";

  function _scAjaxShowMessage(sTitle, sMessage, bModal, iTimeout, bButton, sButton, iTop, iLeft, iWidth, iHeight, sRedir, sTarget, sParam, bClose, bBodyIcon) {
    if ("" == sMessage) {
      if (bModal) {
        scMsgDefClick = "close_modal";
      }
      else {
        scMsgDefClick = "close";
      }
      _scAjaxMessageBtnClick();
      document.getElementById("id_message_display_title").innerHTML = scMsgDefTitle;
      document.getElementById("id_message_display_text").innerHTML = "";
      document.getElementById("id_message_display_buttone").value = scMsgDefButton;
      document.getElementById("id_message_display_buttond").style.display = "none";
    }
    else {
      document.getElementById("id_message_display_title").innerHTML = scAjaxSpecCharParser(sTitle);
      document.getElementById("id_message_display_text").innerHTML = scAjaxSpecCharParser(sMessage);
      document.getElementById("id_message_display_buttone").value = sButton;
      document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
      document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
      document.getElementById("id_message_display_title_line").style.display = (bClose || "" != sTitle) ? "" : "none";
      document.getElementById("id_message_display_close_icon").style.display = bClose ? "" : "none";
      if (document.getElementById("id_message_display_body_icon")) {
        document.getElementById("id_message_display_body_icon").style.display = bBodyIcon ? "" : "none";
      }
      $("#id_message_display_content").css('width', (0 < iWidth ? iWidth + 'px' : ''));
      $("#id_message_display_content").css('height', (0 < iHeight ? iHeight + 'px' : ''));
      if (bModal) {
        iWidth = iWidth || 250;
        iHeight = iHeight || 200;
        scMsgDefClose = "close_modal";
        tb_show('', '#TB_inline?height=' + (iHeight + 6) + '&width=' + (iWidth + 4) + '&inlineId=id_message_display_frame&modal=true', '');
        if (bButton) {
          if ("" != sRedir && "" != sTarget) {
            scMsgDefClick = "redir2_modal";
            document.form_ajax_redir_2.action = sRedir;
            document.form_ajax_redir_2.target = sTarget;
            document.form_ajax_redir_2.nmgp_parms.value = sParam;
            document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
          }
          else if ("" != sRedir && "" == sTarget) {
            scMsgDefClick = "redir1";
            document.form_ajax_redir_1.action = sRedir;
            document.form_ajax_redir_1.nmgp_parms.value = sParam;
          }
          else {
            scMsgDefClick = "close_modal";
          }
        }
        else if (null != iTimeout && 0 < iTimeout) {
          scMsgDefClick = "close_modal";
          setTimeout("_scAjaxMessageBtnClick()", iTimeout * 1000);
        }
      }
      else
      {
        scMsgDefClose = "close";
        $("#id_message_display_frame").css('top', (0 < iTop ? iTop + 'px' : ''));
        $("#id_message_display_frame").css('left', (0 < iLeft ? iLeft + 'px' : ''));
        document.getElementById("id_message_display_frame").style.display = "";
        if (0 == iTop && 0 == iLeft) {
          scCenterElement(document.getElementById("id_message_display_frame"));
        }
        if (bButton) {
          if ("" != sRedir && "" != sTarget) {
            scMsgDefClick = "redir2";
            document.form_ajax_redir_2.action = sRedir;
            document.form_ajax_redir_2.target = sTarget;
            document.form_ajax_redir_2.nmgp_parms.value = sParam;
            document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
          }
          else if ("" != sRedir && "" == sTarget) {
            scMsgDefClick = "redir1";
            document.form_ajax_redir_1.action = sRedir;
            document.form_ajax_redir_1.nmgp_parms.value = sParam;
          }
          else {
            scMsgDefClick = "close";
          }
        }
        else if (null != iTimeout && 0 < iTimeout) {
          scMsgDefClick = "close";
          setTimeout("_scAjaxMessageBtnClick()", iTimeout * 1000);
        }
      }
    }
  } // _scAjaxShowMessage

  function _scAjaxMessageBtnClose() {
    switch (scMsgDefClose) {
      case "close":
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "close_modal":
        tb_remove();
        break;
    }
  } // _scAjaxMessageBtnClick

  function _scAjaxMessageBtnClick() {
    switch (scMsgDefClick) {
      case "close":
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "close_modal":
        tb_remove();
        break;
      case "redir1":
        document.form_ajax_redir_1.submit();
        break;
      case "redir2":
        document.form_ajax_redir_2.submit();
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "redir2_modal":
        document.form_ajax_redir_2.submit();
        tb_remove();
        break;
    }
  } // _scAjaxMessageBtnClick

  function scAjaxHasError()
  {
    if (!oResp["result"])
    {
      return false;
    }
    return "ERROR" == oResp["result"];
  } // scAjaxHasError

  function scAjaxIsOk()
  {
    if (!oResp["result"])
    {
      return false;
    }
    return "OK" == oResp["result"] || "SET" == oResp["result"];
  } // scAjaxIsOk

  function scAjaxIsSet()
  {
    if (!oResp["result"])
    {
      return false;
    }
    return "SET" == oResp["result"];
  } // scAjaxIsSet

  function scAjaxCalendarReload()
  {
    if (oResp["calendarReload"] && "OK" == oResp["calendarReload"])
    {
      self.parent.calendar_reload();
      self.parent.tb_remove();
    }
  } // scCalendarReload

  function scAjaxUpdateErrors(sType)
  {
    ajax_error_geral = "";
    oFieldErrors     = {};
    if (oResp["errList"])
    {
      for (iFieldErrors = 0; iFieldErrors < oResp["errList"].length; iFieldErrors++)
      {
        sTestField = oResp["errList"][iFieldErrors]["fldName"];
        if ("geral_greige_grstyle2_form" == sTestField)
        {
          if (ajax_error_geral != '') { ajax_error_geral += '<br>';}
          ajax_error_geral += scAjaxSpecCharParser(oResp["errList"][iFieldErrors]["msgText"]);
        }
        else
        {
          if (scFocusFirstErrorField && '' == scFocusFirstErrorName)
          {
            scFocusFirstErrorName = sTestField;
          }
          if (oResp["errList"][iFieldErrors]["numLinha"])
          {
            sTestField += oResp["errList"][iFieldErrors]["numLinha"];
          }
          if (!oFieldErrors[sTestField])
          {
            oFieldErrors[sTestField] = new Array();
          }
          oFieldErrors[sTestField][oFieldErrors[sTestField].length] = scAjaxSpecCharParser(oResp["errList"][iFieldErrors]["msgText"]);
        }
      }
    }
    for (iUpdateErrors = 0; iUpdateErrors < ajax_field_list.length; iUpdateErrors++)
    {
      sTestField = ajax_field_list[iUpdateErrors];
      if (oFieldErrors[sTestField])
      {
        ajax_error_list[sTestField][sType] = oFieldErrors[sTestField];
      }
    }
  } // scAjaxUpdateErrors

  function scAjaxUpdateFieldErrors(sField, sType)
  {
    aFieldErrors = new Array();
    if (oResp["errList"])
    {
      iErrorPos  = 0;
      for (iFieldErrors = 0; iFieldErrors < oResp["errList"].length; iFieldErrors++)
      {
        sTestField = oResp["errList"][iFieldErrors]["fldName"];
        if (oResp["errList"][iFieldErrors]["numLinha"])
        {
          sTestField += oResp["errList"][iFieldErrors]["numLinha"];
        }
        if (sField == sTestField)
        {
          aFieldErrors[iErrorPos] = scAjaxSpecCharParser(oResp["errList"][iFieldErrors]["msgText"]);
          iErrorPos++;
        }
      }
    }
    ajax_error_list[sField][sType] = aFieldErrors;
  } // scAjaxUpdateFieldErrors

  function scAjaxListErrors(bLabel)
  {
    bFirst        = false;
    sAppErrorText = "";
    if ("" != ajax_error_geral)
    {
      bFirst         = true;
      sAppErrorText += ajax_error_geral;
    }
    for (iFieldList = 0; iFieldList < ajax_field_list.length; iFieldList++)
    {
      sFieldError = scAjaxListFieldErrors(ajax_field_list[iFieldList], bLabel);
      if ("" != sFieldError)
      {
        if (bFirst)
        {
          bFirst         = false
          sAppErrorText += "<hr size=\"1\" width=\"80%\" />";
        }
        sAppErrorText += sFieldError;
      }
    }
    return sAppErrorText;
  } // scAjaxListErrors

  function scAjaxListFieldErrors(sField, bLabel)
  {
    sErrorText = "";
    for (iErrorType = 0; iErrorType < ajax_error_type.length; iErrorType++)
    {
      if (ajax_error_list[sField])
      {
        for (iListErrors = 0; iListErrors < ajax_error_list[sField][ajax_error_type[iErrorType]].length; iListErrors++)
        {
          if (bLabel)
          {
            sErrorText += ajax_error_list[sField]["label"] + ": ";
          }
          sErrorText += ajax_error_list[sField][ajax_error_type[iErrorType]][iListErrors] + "<br />";
        }
      }
    }
    return sErrorText;
  } // scAjaxListFieldErrors

  function scAjaxSetFields()
  {
    if (!oResp["fldList"])
    {
      return true;
    }
    for (iSetFields = 0; iSetFields < oResp["fldList"].length; iSetFields++)
    {
      var sFieldName = oResp["fldList"][iSetFields]["fldName"];
      var sFieldType = oResp["fldList"][iSetFields]["fldType"];
      if ("selectdd" == sFieldType)
      {
        var bSelectDD = true;
        sFieldType = "select";
      }
      else
      {
        var bSelectDD = false;
      }
      if (oResp["fldList"][iSetFields]["valList"])
      {
        var oFieldValues = oResp["fldList"][iSetFields]["valList"];
        if (0 == oFieldValues.length)
        {
          oFieldValues = null;
        }
      }
      else
      {
        var oFieldValues = null;
      }
      if (oResp["fldList"][iSetFields]["optList"])
      {
        var oFieldOptions = oResp["fldList"][iSetFields]["optList"];
      }
      else
      {
        var oFieldOptions = null;
      }
/*
      if ("_autocomp" == sFieldName.substr(sFieldName.length - 9) &&
          iSetFields > 0 &&
          sFieldName.substr(0, sFieldName.length - 9) == oResp["fldList"][iSetFields - 1]["fldName"] &&
          document.getElementById("div_ac_lab_" + sFieldName.substr(0, sFieldName.length - 9)) &&
          oFieldValues[0]['value'])
      {
          document.getElementById("div_ac_lab_" + sFieldName.substr(0, sFieldName.length - 9)).innerHTML = oFieldValues[0]['value'];
      }
*/
      if ("_autocomp" == sFieldName.substr(sFieldName.length - 9) &&
          iSetFields > 0 &&
          sFieldName.substr(0, sFieldName.length - 9) == oResp["fldList"][iSetFields - 1]["fldName"] &&
          document.getElementById("div_ac_lab_" + sFieldName.substr(0, sFieldName.length - 9)))
      {
          sLabel_auto_Comp = (oFieldValues[0]['value']) ? oFieldValues[0]['value'] : "";
          document.getElementById("div_ac_lab_" + sFieldName.substr(0, sFieldName.length - 9)).innerHTML = sLabel_auto_Comp;
      }


      if (oResp["fldList"][iSetFields]["colNum"])
      {
        var iColNum = oResp["fldList"][iSetFields]["colNum"];
      }
      else
      {
        var iColNum = 1;
      }
      if (oResp["fldList"][iSetFields]["row"])
      {
        var iRow = oResp["fldList"][iSetFields]["row"];
      }
      else
      {
        var iRow = 1;
      }
      if (oResp["fldList"][iSetFields]["htmComp"])
      {
        var sHtmComp = oResp["fldList"][iSetFields]["htmComp"];
        sHtmComp     = sHtmComp.replace(/__AD__/gi, '"');
        sHtmComp     = sHtmComp.replace(/__AS__/gi, "'");
      }
      else
      {
        var sHtmComp = null;
      }
      if (oResp["fldList"][iSetFields]["imgFile"])
      {
        var sImgFile = oResp["fldList"][iSetFields]["imgFile"];
      }
      else
      {
        var sImgFile = "";
      }
      if (oResp["fldList"][iSetFields]["imgOrig"])
      {
        var sImgOrig = oResp["fldList"][iSetFields]["imgOrig"];
      }
      else
      {
        var sImgOrig = "";
      }
      if (oResp["fldList"][iSetFields]["keepImg"])
      {
        var sKeepImg = oResp["fldList"][iSetFields]["keepImg"];
      }
      else
      {
        var sKeepImg = "N";
      }
      if (oResp["fldList"][iSetFields]["imgLink"])
      {
        var sImgLink = oResp["fldList"][iSetFields]["imgLink"];
      }
      else
      {
        var sImgLink = null;
      }
      if (oResp["fldList"][iSetFields]["docLink"])
      {
        var sDocLink = oResp["fldList"][iSetFields]["docLink"];
      }
      else
      {
        var sDocLink = "";
      }
      if (oResp["fldList"][iSetFields]["docIcon"])
      {
        var sDocIcon = oResp["fldList"][iSetFields]["docIcon"];
      }
      else
      {
        var sDocIcon = "";
      }
      if (oResp["fldList"][iSetFields]["optComp"])
      {
        var sOptComp = oResp["fldList"][iSetFields]["optComp"];
      }
      else
      {
        var sOptComp = "";
      }
      if (oResp["fldList"][iSetFields]["optClass"])
      {
        var sOptClass = oResp["fldList"][iSetFields]["optClass"];
      }
      else
      {
        var sOptClass = "";
      }
      if (oResp["fldList"][iSetFields]["optMulti"])
      {
        var sOptMulti = oResp["fldList"][iSetFields]["optMulti"];
      }
      else
      {
        var sOptMulti = "";
      }
      if (oResp["fldList"][iSetFields]["imgHtml"])
      {
        var sImgHtml = oResp["fldList"][iSetFields]["imgHtml"];
      }
      else
      {
        var sImgHtml = "";
      }
      if (oResp["fldList"][iSetFields]["mulHtml"])
      {
        var sMULHtml = oResp["fldList"][iSetFields]["mulHtml"];
      }
      else
      {
        var sMULHtml = "";
      }
      if (oResp["fldList"][iSetFields]["updInnerHtml"])
      {
        var sInnerHtml = scAjaxSpecCharParser(oResp["fldList"][iSetFields]["updInnerHtml"]);
      }
      else
      {
        var sInnerHtml = null;
      }
      if (oResp["fldList"][iSetFields]["lookupCons"])
      {
        var sLookupCons = scAjaxSpecCharParser(oResp["fldList"][iSetFields]["lookupCons"]);
      }
      else
      {
        var sLookupCons = "";
      }
      if (oResp["clearUpload"])
      {
        var sClearUpload = scAjaxSpecCharParser(oResp["clearUpload"]);
      }
      else
      {
        var sClearUpload = "N";
      }
      if ("checkbox" == sFieldType)
      {
        scAjaxSetFieldCheckbox(sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sInnerHtml, sOptComp, sOptClass, sOptMulti);
      }
      else if ("duplosel" == sFieldType)
      {
        scAjaxSetFieldDuplosel(sFieldName, oFieldValues, oFieldOptions);
      }
      else if ("imagem" == sFieldType)
      {
        scAjaxSetFieldImage(sFieldName, oFieldValues, sImgFile, sImgOrig, sImgLink, sKeepImg);
      }
      else if ("documento" == sFieldType)
      {
        scAjaxSetFieldDocument(sFieldName, oFieldValues, sDocLink, sDocIcon, sClearUpload);
      }
      else if ("label" == sFieldType)
      {
        scAjaxSetFieldLabel(sFieldName, oFieldValues, oFieldOptions, sLookupCons);
      }
      else if ("radio" == sFieldType)
      {
        scAjaxSetFieldRadio(sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sOptComp);
      }
      else if ("select" == sFieldType)
      {
        scAjaxSetFieldSelect(sFieldName, oFieldValues, oFieldOptions, bSelectDD, iRow);
      }
      else if ("text" == sFieldType)
      {
        scAjaxSetFieldText(sFieldName, oFieldValues, sLookupCons);
      }
      else if ("editor_html" == sFieldType)
      {
        scAjaxSetFieldEditorHtml(sFieldName, oFieldValues);
      }
      else if ("imagehtml" == sFieldType)
      {
        scAjaxSetFieldImageHtml(sFieldName, oFieldValues, sImgHtml);
      }
      else if ("innerhtml" == sFieldType)
      {
        scAjaxSetFieldInnerHtml(sFieldName, oFieldValues);
      }
      else if ("multi_upload" == sFieldType)
      {
        scAjaxSetFieldMultiUpload(sFieldName, sMULHtml);
      }
      scAjaxUpdateHeaderFooter(sFieldName, oFieldValues);
    }
  } // scAjaxSetFields

  function scAjaxUpdateHeaderFooter(sFieldName, oFieldValues)
  {
    if (self.updateHeaderFooter)
    {
      if (null == oFieldValues)
      {
        sNewValue = '';
      }
      else if (oFieldValues[0]["label"])
      {
        sNewValue = oFieldValues[0]["label"];
      }
      else
      {
        sNewValue = oFieldValues[0]["value"];
      }
      updateHeaderFooter(sFieldName, scAjaxSpecCharParser(sNewValue));
    }
  } // scAjaxUpdateHeaderFooter

  function scAjaxSetFieldText(sFieldName, oFieldValues, sLookupCons)
  {
    if (document.F1.elements[sFieldName])
    {
//      document.F1.elements[sFieldName].value = scAjaxSpecCharParser(oFieldValues[0]['value']);
        Temp_text = scAjaxProtectBreakLine(oFieldValues[0]['value']);
        Temp_text = scAjaxSpecCharParser(Temp_text);
        document.F1.elements[sFieldName].value = scAjaxReturnBreakLine(Temp_text);
    }
    if (document.getElementById("id_lookup_" + sFieldName))
    {
      document.getElementById("id_lookup_" + sFieldName).innerHTML = sLookupCons;
    }
    if (oFieldValues[0]['label'])
    {
      scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues);
    }
    else
    {
      oFieldValues[0]['value'] = scAjaxBreakLine(oFieldValues[0]['value']);
      scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(oFieldValues[0]['value']));
    }
  } // scAjaxSetFieldText

  function scAjaxSetFieldSelect(sFieldName, oFieldValues, oFieldOptions, bSelectDD, iRow)
  {
    sFieldNameHtml = sFieldName;
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"])
    {
      return;
    }
    if (bSelectDD)
    {
        $("#id_sc_field_" + sFieldName).dropdownchecklist("destroy");
    }
    if (!document.F1.elements[sFieldName] && document.F1.elements[sFieldName + "[]"])
    {
      sFieldNameHtml += "[]";
    }
    if ("hidden" == document.F1.elements[sFieldNameHtml].type)
    {
      scAjaxSetFieldText(sFieldNameHtml, oFieldValues);
      return;
    }
    if (null != oFieldOptions)
    {
      if ("<select" != oFieldOptions.substr(0, 7))
      {
        var $oField = $("#id_sc_field_" + sFieldName);
        if (0 < $oField.length)
        {
          $oField.html(oFieldOptions);
        }
        else
        {
          document.getElementById("idAjaxSelect_" + sFieldName).innerHTML = oFieldOptions;
        }
      }
      else
      {
        document.getElementById("idAjaxSelect_" + sFieldName).innerHTML = oFieldOptions;
      }
    }
    var aValues = new Array();
    if (null != oFieldValues)
    {
      for (iFieldSelect = 0; iFieldSelect < oFieldValues.length; iFieldSelect++)
      {
        aValues[iFieldSelect] = scAjaxSpecCharParser(oFieldValues[iFieldSelect]["value"]);
      }
    }
    var oFormField = document.F1.elements[sFieldNameHtml];
    for (iFieldSelect = 0; iFieldSelect < oFormField.length; iFieldSelect++)
    {
      if (scAjaxInArray(oFormField.options[iFieldSelect].value, aValues))
      {
        oFormField.options[iFieldSelect].selected = true;
      }
      else
      {
        oFormField.options[iFieldSelect].selected = false;
      }
    }
    scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues, "<br />");
    if (bSelectDD)
    {
        scJQDDCheckBoxAdd(iRow);
    }
  } // scAjaxSetFieldSelect

  function scAjaxSetFieldDuplosel(sFieldName, oFieldValues, oFieldOptions)
  {
    var sFieldNameOrig = sFieldName + "_orig";
    var sFieldNameDest = sFieldName + "_dest";
    var oFormFieldOrig = document.F1.elements[sFieldNameOrig];
    var oFormFieldDest = document.F1.elements[sFieldNameDest];
    if (null != oFieldOptions)
    {
      scAjaxClearSelect(sFieldNameOrig);
      for (iFieldSelect = 0; iFieldSelect < oFieldOptions.length; iFieldSelect++)
      {
        oFormFieldOrig.options[iFieldSelect] = new Option(scAjaxSpecCharParser(oFieldOptions[iFieldSelect]["label"]), scAjaxSpecCharParser(oFieldOptions[iFieldSelect]["value"]));
      }
    }
    while (oFormFieldDest.length > 0)
    {
      oFormFieldDest.options[0] = null;
    }
    var aValues = new Array();
    if (null != oFieldValues)
    {
      for (iFieldSelect = 0; iFieldSelect < oFieldValues.length; iFieldSelect++)
      {
        sNewOptionLabel = oFieldValues[iFieldSelect]["label"] ? scAjaxSpecCharParser(oFieldValues[iFieldSelect]["label"]) : scAjaxSpecCharParser(oFieldValues[iFieldSelect]["value"]);
        sNewOptionValue = scAjaxSpecCharParser(oFieldValues[iFieldSelect]["value"]);
        if (sNewOptionValue.substr(0, 8) == "@NMorder")
        {
           sNewOptionValue                      = sNewOptionValue.substr(8);
           oFormFieldDest.options[iFieldSelect] = new Option(scAjaxSpecCharParser(sNewOptionLabel), sNewOptionValue);
           sNewOptionValue                      = sNewOptionValue.substr(1);
           aValues[iFieldSelect]                = sNewOptionValue;
        }
        else
        {
           aValues[iFieldSelect]                = sNewOptionValue;
           oFormFieldDest.options[iFieldSelect] = new Option(scAjaxSpecCharParser(sNewOptionLabel), sNewOptionValue);
        }
      }
    }
    for (iFieldSelect = 0; iFieldSelect < oFormFieldOrig.length; iFieldSelect++)
    {
      oFormFieldOrig.options[iFieldSelect].selected = false;
      if (scAjaxInArray(oFormFieldOrig.options[iFieldSelect].value, aValues))
      {
        oFormFieldOrig.options[iFieldSelect].disabled    = true;
        oFormFieldOrig.options[iFieldSelect].style.color = "#A0A0A0";
      }
      else
      {
        oFormFieldOrig.options[iFieldSelect].disabled = false;
      }
    }
    scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues, "<br />");
  } // scAjaxSetFieldDuplosel

  function scAjaxSetFieldCheckbox(sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sInnerHtml, sOptComp, sOptClass, sOptMulti)
  {
    if (document.getElementById("idAjaxCheckbox_" + sFieldName) && null != sInnerHtml)
    {
      document.getElementById("idAjaxCheckbox_" + sFieldName).innerHTML = sInnerHtml;
      return;
    }
    if (document.F1.elements[sFieldName] && "hidden" == document.F1.elements[sFieldName].type)
    {
      scAjaxSetFieldText(sFieldName, oFieldValues);
      return;
    }
    if (null != oFieldOptions && "" != oFieldOptions)
    {
      scAjaxClearCheckbox(sFieldName);
      scAjaxRecreateOptions("Checkbox", "checkbox", sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sOptComp, sOptClass, sOptMulti);
    }
    else
    {
      scAjaxSetCheckboxOptions(sFieldName, oFieldValues);
    }
    scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues, "<br />");
  } // scAjaxSetFieldCheckbox

  function scAjaxSetFieldRadio(sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sOptComp)
  {
    if (document.F1.elements[sFieldName] && "hidden" == document.F1.elements[sFieldName].type)
    {
      scAjaxSetFieldText(sFieldName, oFieldValues);
      return;
    }
    if (null != oFieldOptions && "" != oFieldOptions)
    {
      scAjaxClearRadio(sFieldName);
      scAjaxRecreateOptions("Radio", "radio", sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sOptComp, "", "");
    }
    else
    {
      scAjaxSetRadioOptions(sFieldName, oFieldValues);
    }
    scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues, "<br />");
  } // scAjaxSetFieldRadio

  function scAjaxSetFieldLabel(sFieldName, oFieldValues, oFieldOptions, sLookupCons)
  {
    sFieldValue = oFieldValues[0]["value"];
    sFieldLabel = oFieldValues[0]["value"];
    sFieldLabel = scAjaxBreakLine(sFieldLabel);
    if (null != oFieldOptions)
    {
      for (iRecreate = 0; iRecreate < oFieldOptions.length; iRecreate++)
      {
        sOptText  = scAjaxSpecCharParser(oFieldOptions[iRecreate]["value"]);
        sOptValue = scAjaxSpecCharParser(oFieldOptions[iRecreate]["label"]);
        if (sFieldValue == sOptText)
        {
          sFieldLabel = sOptValue;
        }
      }
    }
    if (document.getElementById("id_ajax_label_" + sFieldName))
    {
      document.getElementById("id_ajax_label_" + sFieldName).innerHTML = scAjaxSpecCharParser(sFieldLabel);
    }
    if (document.F1.elements[sFieldName])
    {
//      document.F1.elements[sFieldName].value = scAjaxSpecCharParser(sFieldValue);
        Temp_text = scAjaxProtectBreakLine(sFieldValue);
        Temp_text = scAjaxSpecCharParser(Temp_text);
        document.F1.elements[sFieldName].value = scAjaxReturnBreakLine(Temp_text);

    }
    if (document.getElementById("id_lookup_" + sFieldName))
    {
      document.getElementById("id_lookup_" + sFieldName).innerHTML = sLookupCons;
    }
    scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(sFieldLabel));
  } // scAjaxSetFieldLabel

  function scAjaxSetFieldImage(sFieldName, oFieldValues, sImgFile, sImgOrig, sImgLink, sKeepImg)
  {
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"])
    {
      return;
    }
    if ("N" == sKeepImg && document.getElementById("id_ajax_img_"  + sFieldName))
    {
      document.getElementById("id_ajax_img_"  + sFieldName).src           = scAjaxSpecCharParser(sImgFile);
      document.getElementById("id_ajax_img_"  + sFieldName).style.display = ("" == sImgFile) ? "none" : "";
    }
    if (document.getElementById("id_ajax_link_" + sFieldName) && null != sImgLink)
    {
      document.getElementById("id_ajax_link_" + sFieldName).innerHTML = oFieldValues[0]["value"];
      document.getElementById("id_ajax_link_" + sFieldName).href      = scAjaxSpecCharParser(sImgLink);
    }
    if (document.getElementById("chk_ajax_img_" + sFieldName))
    {
      document.getElementById("chk_ajax_img_" + sFieldName).style.display = ("" == oFieldValues[0]["value"]) ? "none" : "";
    }
    if ("" == oFieldValues[0]["value"] && document.F1.elements[sFieldName + "_limpa"])
    {
      document.F1.elements[sFieldName + "_limpa"].checked = false;
    }
    if ("N" == sKeepImg && document.getElementById("txt_ajax_img_" + sFieldName))
    {
      document.getElementById("txt_ajax_img_" + sFieldName).innerHTML     = oFieldValues[0]["value"];
      document.getElementById("txt_ajax_img_" + sFieldName).style.display = ("" == oFieldValues[0]["value"]) ? "none" : "";
    }
    if ("" != sImgOrig)
    {
      eval("if (var_ajax_img_" + sFieldName + ") var_ajax_img_" + sFieldName + " = '" + sImgOrig + "';");
      if (document.F1.elements["temp_out1_" + sFieldName])
      {
        document.F1.elements["temp_out_" + sFieldName].value = sImgFile;
        document.F1.elements["temp_out1_" + sFieldName].value = sImgOrig;
      }
      else if (document.F1.elements["temp_out_" + sFieldName])
      {
        document.F1.elements["temp_out_" + sFieldName].value = sImgOrig;
      }
    }
    if ("" != oFieldValues[0]["value"])
    {
      if (document.F1.elements[sFieldName + "_salva"]) document.F1.elements[sFieldName + "_salva"].value = oFieldValues[0]["value"];
    }
    else if (oResp && oResp["ajaxRequest"] && "navigate_form" == oResp["ajaxRequest"])
    {
      if (document.F1.elements[sFieldName + "_salva"]) document.F1.elements[sFieldName + "_salva"].value = "";
    }
    scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(oFieldValues[0]["value"]));
  } // scAjaxSetFieldImage

  function scAjaxSetFieldDocument(sFieldName, oFieldValues, sDocLink, sDocIcon, sClearUpload)
  {
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"])
    {
      return;
    }
    document.getElementById("id_ajax_doc_"  + sFieldName).innerHTML = scAjaxSpecCharParser(sDocLink);
    if (document.getElementById("id_ajax_doc_icon_"  + sFieldName))
    {
      document.getElementById("id_ajax_doc_icon_"  + sFieldName).src = scAjaxSpecCharParser(sDocIcon);
    }
    if ("" == oFieldValues[0]["value"])
    {
      document.getElementById("chk_ajax_img_" + sFieldName).style.display = "none";
      document.getElementById("id_ajax_doc_" + sFieldName).style.display = "none";
    }
    else
    {
      document.getElementById("chk_ajax_img_" + sFieldName).style.display = "";
      document.getElementById("id_ajax_doc_" + sFieldName).style.display = "";
    }
    if ("" == oFieldValues[0]["value"] && document.F1.elements[sFieldName + "_limpa"])
    {
      document.F1.elements[sFieldName + "_limpa"].checked = false;
    }
    if ("S" == sClearUpload && document.F1.elements[sFieldName + "_ul_name"])
    {
      document.F1.elements[sFieldName + "_ul_name"].value = "";
    }
    scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(oFieldValues[0]["value"]));
  } // scAjaxSetFieldDocument

  function scAjaxSetFieldInnerHtml(sFieldName, oFieldValues)
  {
    if (document.getElementById(sFieldName))
    {
      document.getElementById(sFieldName).innerHTML = scAjaxSpecCharParser(oFieldValues[0]["value"]);
    }
  } // scAjaxSetFieldInnerHtml

  function scAjaxSetFieldMultiUpload(sFieldName, sMULHtml)
  {
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"])
    {
      return;
    }
    $("#id_sc_loaded_" + sFieldName).html(scAjaxSpecCharParser(sMULHtml));
  } // scAjaxSetFieldMultiUpload

  function scAjaxSetFieldEditorHtml(sFieldName, oFieldValues)
  {
    if (!document.F1.elements[sFieldName])
    {
      return;
    }
    var oFormField = tinyMCE.getInstanceById(sFieldName);
    oFormField.setContent(scAjaxSpecCharParser(oFieldValues[0]["value"]));
    scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(oFieldValues[0]["value"]));
  } // scAjaxSetFieldEditorHtml

  function scAjaxSetFieldImageHtml(sFieldName, oFieldValues, sImgHtml)
  {
    if (document.getElementById("id_imghtml_" + sFieldName))
    {
      document.getElementById("id_imghtml_" + sFieldName).innerHTML = scAjaxSpecCharParser(sImgHtml);
    }
  } // scAjaxSetFieldEditorHtml

  function scAjaxSetCheckboxOptions(sFieldName, oFieldValues)
  {
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"] && !document.F1.elements[sFieldName + "[0]"])
    {
      return;
    }
    var aValues    = new Array();
    if (null != oFieldValues)
    {
      for (iFieldSelect = 0; iFieldSelect < oFieldValues.length; iFieldSelect++)
      {
        aValues[iFieldSelect] = scAjaxSpecCharParser(oFieldValues[iFieldSelect]["value"]);
      }
    }
    if (document.F1.elements[sFieldName + "[]"])
    {
      var oFormField = document.F1.elements[sFieldName + "[]"];
      if (oFormField.length)
      {
        for (iFieldCheckbox = 0; iFieldCheckbox < oFormField.length; iFieldCheckbox++)
        {
          if (scAjaxInArray(oFormField[iFieldCheckbox].value, aValues))
          {
            oFormField[iFieldCheckbox].checked = true;
          }
          else
          {
            oFormField[iFieldCheckbox].checked = false;
          }
        }
      }
      else
      {
        if (scAjaxInArray(oFormField.value, aValues))
        {
          oFormField.checked = true;
        }
        else
        {
          oFormField.checked = false;
        }
      }
    }
    else if (document.F1.elements[sFieldName + "[0]"])
    {
      for (iFieldCheckbox = 0; iFieldCheckbox < document.F1.elements.length; iFieldCheckbox++)
      {
        oFormElement = document.F1.elements[iFieldCheckbox];
        if (sFieldName + "[" == oFormElement.name.substr(0, sFieldName.length + 1) && scAjaxInArray(oFormElement.value, aValues))
        {
          oFormElement.checked = true;
        }
        else if (sFieldName + "[" == oFormElement.name.substr(0, sFieldName.length + 1))
        {
          oFormElement.checked = false;
        }
      }
    }
    else
    {
      oFormElement = document.F1.elements[sFieldName];
      if (scAjaxInArray(oFormElement.value, aValues))
      {
        oFormElement.checked = true;
      }
      else
      {
        oFormElement.checked = false;
      }
    }
  } // scAjaxSetCheckboxOptions

  function scAjaxSetRadioOptions(sFieldName, oFieldValues)
  {
    if (!document.F1.elements[sFieldName])
    {
      return;
    }
    var oFormField = document.F1.elements[sFieldName];
    var aValues    = new Array();
    if (null != oFieldValues)
    {
      for (iFieldSelect = 0; iFieldSelect < oFieldValues.length; iFieldSelect++)
      {
        aValues[iFieldSelect] = scAjaxSpecCharParser(oFieldValues[iFieldSelect]["value"]);
      }
    }
    for (iFieldRadio = 0; iFieldRadio < oFormField.length; iFieldRadio++)
    {
      if (scAjaxInArray(oFormField[iFieldRadio].value, aValues))
      {
        oFormField[iFieldRadio].checked = true;
      }
    }
  } // scAjaxSetRadioOptions

  function scAjaxSetReadonlyValue(sFieldName, sFieldValue)
  {
    if (document.getElementById("id_read_on_" + sFieldName))
    {
      document.getElementById("id_read_on_" + sFieldName).innerHTML = sFieldValue;
    }
  } // scAjaxSetReadonlyValue

  function scAjaxSetReadonlyArrayValue(sFieldName, oFieldValues, sDelim)
  {
    if (null == oFieldValues)
    {
      return;
    }
    if (null == sDelim)
    {
      sDelim = " ";
    }
    sReadLabel = "";
    for (iReadArray = 0; iReadArray < oFieldValues.length; iReadArray++)
    {
      if (oFieldValues[iReadArray]["label"])
      {
        if ("" != sReadLabel)
        {
          sReadLabel += sDelim;
        }
        sReadLabel += oFieldValues[iReadArray]["label"];
      }
      else if (oFieldValues[iReadArray]["value"])
      {
        if ("" != sReadLabel)
        {
          sReadLabel += sDelim;
        }
        sReadLabel += oFieldValues[iReadArray]["value"];
      }
    }
    scAjaxSetReadonlyValue(sFieldName, scAjaxSpecCharParser(sReadLabel));
  } // scAjaxSetReadonlyArrayValue

  function scAjaxGetFieldValue(sFieldGet)
  {
    sValue = "";
    if (!oResp["fldList"])
    {
      return sValue;
    }
    for (iFieldValue = 0; iFieldValue < oResp["fldList"].length; iFieldValue++)
    {
      var sFieldName  = oResp["fldList"][iFieldValue]["fldName"];
      if (oResp["fldList"][iFieldValue]["valList"])
      {
        var oFieldValues = oResp["fldList"][iFieldValue]["valList"];
        if (0 == oFieldValues.length)
        {
          oFieldValues = null;
        }
      }
      else
      {
        var oFieldValues = null;
      }
      if (sFieldGet == sFieldName && null != oFieldValues)
      {
        if (1 == oFieldValues.length)
        {
          sValue = scAjaxSpecCharParser(oFieldValues[0]["value"]);
        }
        else
        {
          sValue = new Array();
          for (jFieldValue = 0; jFieldValue < oFieldValues.length; jFieldValue++)
          {
            sValue[jFieldValue] = scAjaxSpecCharParser(oFieldValues[jFieldValue]["value"]);
          }
        }
      }
    }
    return sValue;
  } // scAjaxGetFieldValue

  function scAjaxGetKeyValue(sFieldGet)
  {
    sValue = "";
    if (!oResp["fldList"])
    {
      return sValue;
    }
    for (iKeyValue = 0; iKeyValue < oResp["fldList"].length; iKeyValue++)
    {
      var sFieldName = oResp["fldList"][iKeyValue]["fldName"];
      if (sFieldGet == sFieldName)
      {
        if (oResp["fldList"][iKeyValue]["keyVal"])
        {
          return scAjaxSpecCharParser(oResp["fldList"][iKeyValue]["keyVal"]);
        }
        else
        {
          return scAjaxGetFieldValue(sFieldGet);
        }
      }
    }
    return sValue;
  } // scAjaxGetKeyValue

  function scAjaxGetLineNumber()
  {
    sLineNumber = "";
    if (oResp["errList"])
    {
      for (iLineNumber = 0; iLineNumber < oResp["errList"].length; iLineNumber++)
      {
        if (oResp["errList"][iLineNumber]["numLinha"])
        {
          sLineNumber = oResp["errList"][iLineNumber]["numLinha"];
        }
      }
      return sLineNumber;
    }
    if (oResp["fldList"])
    {
      return oResp["fldList"][0]["numLinha"];
    }
    if (oResp["msgDisplay"])
    {
      return oResp["msgDisplay"]["numLinha"];
    }
    return sLineNumber;
  } // scAjaxGetLineNumber

  function scAjaxFieldExists(sFieldGet)
  {
    bExists = false;
    if (!oResp["fldList"])
    {
      return bExists;
    }
    for (iFieldValue = 0; iFieldValue < oResp["fldList"].length; iFieldValue++)
    {
      var sFieldName  = oResp["fldList"][iFieldValue]["fldName"];
      if (oResp["fldList"][iFieldValue]["valList"])
      {
        var oFieldValues = oResp["fldList"][iFieldValue]["valList"];
        if (0 == oFieldValues.length)
        {
          oFieldValues = null;
        }
      }
      else
      {
        var oFieldValues = null;
      }
      if (sFieldGet == sFieldName && null != oFieldValues)
      {
        bExists = true;
      }
    }
    return bExists;
  } // scAjaxFieldExists

  function scAjaxGetFieldText(sFieldName)
  {
    $oHidden = $("input[name=" + sFieldName + "]");
    if ($oHidden.length)
    {
      for (var i = 0; i < $oHidden.length; i++)
      {
        if ("hidden" == $oHidden[i].type && $oHidden[i].form && $oHidden[i].form.name && "F1" == $oHidden[i].form.name)
        {
          return $oHidden[i].value.replace(/[+]/g, "__NM_PLUS__");
        }
      }
    }
    $oField = $("#id_sc_field_" + sFieldName);
    if ($oField.length && "select" != $oField[0].type.substr(0, 6))
    {
      return $oField.val().replace(/[+]/g, "__NM_PLUS__");
    }
    else if (document.F1.elements[sFieldName])
    {
      return document.F1.elements[sFieldName].value.replace(/[+]/g, "__NM_PLUS__");
    }
    else
    {
      return '';
    }
  } // scAjaxGetFieldText

  function scAjaxGetFieldHidden(sFieldName)
  {
    for( i= 0; i < document.F1.elements.length; i++)
    {
       if (document.F1.elements[i].name == sFieldName)
       {
          return document.F1.elements[i].value.replace(/[+]/g, "__NM_PLUS__");
       }
    }
//    return document.F1.elements[sFieldName].value.replace(/[+]/g, "__NM_PLUS__");
  } // scAjaxGetFieldHidden

  function scAjaxGetFieldSelect(sFieldName)
  {
    sFieldNameHtml = sFieldName;
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"])
    {
      return "";
    }
    if (!document.F1.elements[sFieldName] && document.F1.elements[sFieldName + "[]"])
    {
      sFieldNameHtml += "[]";
    }
    if ("hidden" == document.F1.elements[sFieldNameHtml].type)
    {
      return scAjaxGetFieldHidden(sFieldNameHtml);
    }
    var oFormField = document.F1.elements[sFieldNameHtml];
    var iSelected  = oFormField.selectedIndex;
    if (-1 < iSelected)
    {
      return oFormField.options[iSelected].value.replace(/[+]/g, "__NM_PLUS__");
    }
    else
    {
      return "";
    }
  } // scAjaxGetFieldSelect

  function scAjaxGetFieldSelectMult(sFieldName, sFieldDelim)
  {
    sFieldNameHtml = sFieldName;
    if (!document.F1.elements[sFieldName] && document.F1.elements[sFieldName + "[]"])
    {
      sFieldNameHtml += "[]";
    }
    if ("hidden" == document.F1.elements[sFieldNameHtml].type)
    {
      return scAjaxGetFieldHidden(sFieldNameHtml);
    }
    var oFormField = document.F1.elements[sFieldNameHtml];
    var sFieldVals = "";
    for (iFieldSelect = 0; iFieldSelect < oFormField.length; iFieldSelect++)
    {
      if (oFormField[iFieldSelect].selected)
      {
        if ("" != sFieldVals)
        {
          sFieldVals += sFieldDelim;
        }
        sFieldVals += oFormField[iFieldSelect].value.replace(/[+]/g, "__NM_PLUS__");
      }
    }
    return sFieldVals;
  } // scAjaxGetFieldSelectMult

  function scAjaxGetFieldCheckbox(sFieldName, sDelim)
  {
    var aValues = new Array();
    var sValue  = "";
    if (!document.F1.elements[sFieldName] && !document.F1.elements[sFieldName + "[]"] && !document.F1.elements[sFieldName + "[0]"])
    {
      return sValue;
    }
    if (document.F1.elements[sFieldName + "[]"] && "hidden" == document.F1.elements[sFieldName + "[]"].type)
    {
      return scAjaxGetFieldHidden(sFieldName + "[]");
    }
    if (document.F1.elements[sFieldName] && "hidden" == document.F1.elements[sFieldName].type)
    {
      return scAjaxGetFieldHidden(sFieldName);
    }
    if (document.F1.elements[sFieldName + "[]"])
    {
      var oFormField = document.F1.elements[sFieldName + "[]"];
      if (oFormField.length)
      {
        for (iFieldCheck = 0; iFieldCheck < oFormField.length; iFieldCheck++)
        {
          if (oFormField[iFieldCheck].checked)
          {
            aValues[aValues.length] = oFormField[iFieldCheck].value;
          }
        }
      }
      else
      {
        if (oFormField.checked)
        {
          aValues[aValues.length] = oFormField.value;
        }
      }
    }
    else
    {
      for (iFieldCheck = 0; iFieldCheck < document.F1.elements.length; iFieldCheck++)
      {
        oFormElement = document.F1.elements[iFieldCheck];
        if (sFieldName + "[" == oFormElement.name.substr(0, sFieldName.length + 1) && oFormElement.checked)
        {
          aValues[aValues.length] = oFormElement.value;
        }
        else if (sFieldName == oFormElement.name && oFormElement.checked)
        {
          aValues[aValues.length] = oFormElement.value;
        }
      }
    }
    for (iFieldCheck = 0; iFieldCheck < aValues.length; iFieldCheck++)
    {
      sValue += aValues[iFieldCheck].replace(/[+]/g, "__NM_PLUS__");
      if (iFieldCheck + 1 != aValues.length)
      {
        sValue += sDelim;
      }
    }
    return sValue;
  } // scAjaxGetFieldCheckbox

  function scAjaxGetFieldRadio(sFieldName)
  {
    if ("hidden" == document.F1.elements[sFieldName].type)
    {
      return scAjaxGetFieldHidden(sFieldName);
    }
    var sValue = "";
    if (!document.F1.elements[sFieldName])
    {
      return sValue;
    }
    var oFormField = document.F1.elements[sFieldName];
    if (!oFormField.length)
    {
        var sc_cmp_radio = eval("document.F1." + sFieldName);
        if (sc_cmp_radio.checked)
        {
           sValue = sc_cmp_radio.value.replace(/[+]/g, "__NM_PLUS__");
        }
    }
    else
    {
      for (iFieldRadio = 0; iFieldRadio < oFormField.length; iFieldRadio++)
      {
        if (oFormField[iFieldRadio].checked)
        {
          sValue = oFormField[iFieldRadio].value.replace(/[+]/g, "__NM_PLUS__");
        }
      }
    }
    return sValue;
  } // scAjaxGetFieldRadio

  function scAjaxGetFieldEditorHtml(sFieldName)
  {
    if ("hidden" == document.F1.elements[sFieldName].type)
    {
      return scAjaxGetFieldHidden(sFieldName);
    }
    var sValue = "";
    if (!document.F1.elements[sFieldName])
    {
      return sValue;
    }
    var oFormField = tinyMCE.getInstanceById(sFieldName);
    return scAjaxSpecCharParser(oFormField.getContent().replace(/[+]/g, "__NM_PLUS__"));
  } // scAjaxGetFieldEditorHtml

  function scAjaxDoNothing(e)
  {
  } // scAjaxDoNothing

  function scAjaxInArray(mVal, aList)
  {
    for (iInArray = 0; iInArray < aList.length; iInArray++)
    {
      if (aList[iInArray] == mVal)
      {
        return true;
      }
    }
    return false;
  } // scAjaxInArray

  function scAjaxSpecCharParser(sParseString)
  {
    var ta = document.createElement("textarea");
    ta.innerHTML = sParseString.replace(/</g, "&lt;").replace(/>/g, "&gt;");
    return ta.value;
    var div = document.createElement('div');
    div.innerHTML = sParseString;
    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
  } // scAjaxSpecCharParser

  function scAjaxRecreateOptions(sFieldType, sHtmlType, sFieldName, oFieldValues, oFieldOptions, iColNum, sHtmComp, sOptComp, sOptClass, sOptMulti)
  {
    var sSuffix  = ("checkbox" == sHtmlType) ? "[]" : "";
    var sDivName = "idAjax" + sFieldType + "_" + sFieldName;
    var sDivText = "";
    var iCntLine = 0;
    var aValues  = new Array();
    var sClass;
    if (null != oFieldValues)
    {
      for (iRecreate = 0; iRecreate < oFieldValues.length; iRecreate++)
      {
        aValues[iRecreate] = scAjaxSpecCharParser(oFieldValues[iRecreate]["value"]);
      }
    }
    sDivText += "<table border=0>";
    for (iRecreate = 0; iRecreate < oFieldOptions.length; iRecreate++)
    {
        sOptText  = scAjaxSpecCharParser(oFieldOptions[iRecreate]["label"]);
        sOptValue = scAjaxSpecCharParser(oFieldOptions[iRecreate]["value"]);
        if (0 == iCntLine)
        {
            sDivText += "<tr>";
        }
        iCntLine++;
        if ("" != sOptClass)
        {
            sClass = " class=\"" + sOptClass;
            if ("" != sOptMulti)
            {
                sClass += " " + sOptClass + sOptMulti;
            }
            sClass += "\"";
        }
        if (sHtmComp == null)
        {
            sHtmComp = "";
        }
        sChecked  = (scAjaxInArray(sOptValue, aValues)) ? " checked" : "";
        sDivText += "<td class=\"scFormDataFontOdd\">";
        sDivText += "<input type=\"" + sHtmlType + "\" name=\"" + sFieldName + sSuffix + "\" value=\"" + sOptValue + "\"" + sChecked + " " + sHtmComp + " " + sOptComp + sClass + ">";
        sDivText += sOptText;
        sDivText += "</td>";
        if (iColNum == iCntLine)
        {
            sDivText += "</tr>";
            iCntLine  = 0;
        }
    }
    sDivText += "</table>";
    document.getElementById(sDivName).innerHTML = sDivText;
  } // scAjaxRecreateOptions

  function scAjaxProcOn(bForce)
  {
    if (null == bForce)
    {
      bForce = false;
    }
    if (document.getElementById("id_div_process"))
    {
      if ($ && $.blockUI && !bForce)
      {
        $.blockUI({
          message: $("#id_div_process_block"),
          overlayCSS: { backgroundColor: sc_ajaxBg },
          css: {
            borderColor: sc_ajaxBordC,
            borderStyle: sc_ajaxBordS,
            borderWidth: sc_ajaxBordW
          }
        });
      }
      else
      {
        document.getElementById("id_div_process").style.display = "";
        document.getElementById("id_fatal_error").style.display = "none";
      }
    }
  } // scAjaxProcOn

  function scAjaxProcOff(bForce)
  {
    if (null == bForce)
    {
      bForce = false;
    }
    if (document.getElementById("id_div_process"))
    {
      if ($ && $.unblockUI && !bForce)
      {
        $.unblockUI();
      }
      else
      {
        document.getElementById("id_div_process").style.display = "none";
      }
    }
  } // scAjaxProcOff

  function scAjaxSetMaster()
  {
    if (!oResp["masterValue"])
    {
      return;
    }
    if (!parent || !parent.scAjaxDetailValue)
    {
      return;
    }
    for (iMaster = 0; iMaster < oResp["masterValue"].length; iMaster++)
    {
      parent.scAjaxDetailValue(oResp["masterValue"][iMaster]["index"], oResp["masterValue"][iMaster]["value"]);
    }
  } // scAjaxSetMaster

  function scAjaxSetFocus()
  {
    if (!oResp["setFocus"] && '' == scFocusFirstErrorName)
    {
      return;
    }
    sFieldName = oResp["setFocus"];
    if (document.F1.elements[sFieldName])
    {
        scFocusField(sFieldName);
    }
    scAjaxFocusError();
  } // scAjaxSetFocus

  function scAjaxFocusError()
  {
    if ('' != scFocusFirstErrorName)
    {
      scFocusField(scFocusFirstErrorName);
      scFocusFirstErrorName = '';
    }
  } // scAjaxFocusError

  function scAjaxSetNavStatus(sBarPos)
  {
    if (!oResp["navStatus"])
    {
      return;
    }
    sNavRet = "S";
    sNavAva = "S";
    if (oResp["navStatus"]["ret"])
    {
      sNavRet = oResp["navStatus"]["ret"];
    }
    if (oResp["navStatus"]["ava"])
    {
      sNavAva = oResp["navStatus"]["ava"];
    }
    if ("S" != sNavRet && "N" != sNavRet)
    {
      sNavRet = "S";
    }
    if ("S" != sNavAva && "N" != sNavAva)
    {
      sNavAva = "S";
    }
    Nav_permite_ret = sNavRet;
    Nav_permite_ava = sNavAva;
    nav_atualiza(Nav_permite_ret, Nav_permite_ava, sBarPos);
  } // scAjaxSetNavStatus

  function scAjaxSetSummary()
  {
    if (!oResp["navSummary"])
    {
      return;
    }
    sreg_ini = oResp["navSummary"].reg_ini;
    sreg_qtd = oResp["navSummary"].reg_qtd;
    sreg_tot = oResp["navSummary"].reg_tot;
    summary_atualiza(sreg_ini, sreg_qtd, sreg_tot);
  } // scAjaxSetSummary

  function scAjaxSetNavpage()
  {
    navpage_atualiza(oResp["navPage"]);
  } // scAjaxSetNavpage


  function scAjaxRedir(oTemp)
  {
    if (oTemp && oTemp != null)
    {
        oResp = oTemp;
    }
    if (!oResp["redirInfo"])
    {
      return;
    }
    sMetodo = oResp["redirInfo"]["metodo"];
    sAction = oResp["redirInfo"]["action"];
    if ("location" == sMetodo)
    {
      if ("parent.parent" == oResp["redirInfo"]["target"])
      {
        parent.parent.location = sAction;
      }
      else if ("parent" == oResp["redirInfo"]["target"])
      {
        parent.location = sAction;
      }
      else if ("_blank" == oResp["redirInfo"]["target"])
      {
        window.open(sAction, "_blank");
      }
      else
      {
        document.location = sAction;
      }
    }
    else if ("html" == sMetodo)
    {
        document.write(scAjaxSpecCharParser(oResp["redirInfo"]["action"]));
    }
    else
    {
      if (oResp["redirInfo"]["target"] == "modal")
      {
          tb_show('', sAction + '?script_case_init=' +  oResp["redirInfo"]["script_case_init"] + '&script_case_session=<?php echo session_id() ?>&nmgp_parms=' + oResp["redirInfo"]["nmgp_parms"] + '&nmgp_outra_jan=true&nmgp_url_saida=modal&NMSC_modal=ok&TB_iframe=true&modal=true&height=' +  oResp["redirInfo"]["h_modal"] + '&width=' + oResp["redirInfo"]["w_modal"], '');
          return;
      }
      sFormRedir = (oResp["redirInfo"]["nmgp_outra_jan"]) ? "form_ajax_redir_1" : "form_ajax_redir_2";
      document.forms[sFormRedir].action           = sAction;
      document.forms[sFormRedir].target           = oResp["redirInfo"]["target"];
      document.forms[sFormRedir].nmgp_parms.value = oResp["redirInfo"]["nmgp_parms"];
      if ("form_ajax_redir_1" == sFormRedir)
      {
        document.forms[sFormRedir].nmgp_outra_jan.value = oResp["redirInfo"]["nmgp_outra_jan"];
      }
      else
      {
        document.forms[sFormRedir].nmgp_url_saida.value   = oResp["redirInfo"]["nmgp_url_saida"];
        document.forms[sFormRedir].script_case_init.value = oResp["redirInfo"]["script_case_init"];
      }
      document.forms[sFormRedir].submit();
    }
  } // scAjaxRedir

  function scAjaxSetDisplay(bReset)
  {
    if (null == bReset)
    {
      bReset = false;
    }
    var aDispData = new Array();
    var aDispCont = {};
    if (bReset)
    {
      for (iDisplay = 0; iDisplay < ajax_block_list.length; iDisplay++)
      {
        aDispCont[ajax_block_list[iDisplay]] = aDispData.length;
        aDispData[aDispData.length] = new Array(ajax_block_id[ajax_block_list[iDisplay]], "on");
      }
      for (iDisplay = 0; iDisplay < ajax_field_list.length; iDisplay++)
      {
        if (ajax_field_id[ajax_field_list[iDisplay]])
        {
          aFieldIds = ajax_field_id[ajax_field_list[iDisplay]];
          for (iDisplay2 = 0; iDisplay2 < aFieldIds.length; iDisplay2++)
          {
            aDispCont[aFieldIds[iDisplay2]] = aDispData.length;
            aDispData[aDispData.length] = new Array(aFieldIds[iDisplay2], "on");
          }
        }
      }
    }
    if (oResp["blockDisplay"])
    {
      for (iDisplay = 0; iDisplay < oResp["blockDisplay"].length; iDisplay++)
      {
        if (bReset)
        {
          aDispData[ aDispCont[ oResp["blockDisplay"][iDisplay][0] ] ][1] = oResp["blockDisplay"][iDisplay][1];
        }
        else
        {
          aDispData[aDispData.length] = new Array(ajax_block_id[ oResp["blockDisplay"][iDisplay][0] ], oResp["blockDisplay"][iDisplay][1]);
        }
      }
    }
    if (oResp["fieldDisplay"])
    {
      for (iDisplay = 0; iDisplay < oResp["fieldDisplay"].length; iDisplay++)
      {
        for (iDisplay2 = 1; iDisplay2 < ajax_field_mult[ oResp["fieldDisplay"][iDisplay][0] ].length; iDisplay2++)
        {
          aFieldIds = ajax_field_id[ ajax_field_mult[ oResp["fieldDisplay"][iDisplay][0] ][iDisplay2] ];
          for (iDisplay3 = 0; iDisplay3 < aFieldIds.length; iDisplay3++)
          {
            if (bReset)
            {
              aDispData[ aDispCont[ aFieldIds[iDisplay3] ] ][1] = oResp["fieldDisplay"][iDisplay][1];
            }
            else
            {
              aDispData[aDispData.length] = new Array(aFieldIds[iDisplay3], oResp["fieldDisplay"][iDisplay][1]);
            }
          }
        }
      }
    }
    if (oResp["buttonDisplay"])
    {
      for (iDisplay = 0; iDisplay < oResp["buttonDisplay"].length; iDisplay++)
      {
        var sBtnName2 = "";
        switch (oResp["buttonDisplay"][iDisplay][0])
        {
          case "first": var sBtnName = "sc_b_ini"; break;
          case "back": var sBtnName = "sc_b_ret"; break;
          case "forward": var sBtnName = "sc_b_avc"; break;
          case "last": var sBtnName = "sc_b_fim"; break;
          case "insert": var sBtnName = "sc_b_ins"; break;
          case "update": var sBtnName = "sc_b_upd"; break;
          case "delete": var sBtnName = "sc_b_del"; break;
          default: var sBtnName = "sc_b_" + oResp["buttonDisplay"][iDisplay][0]; sBtnName2 = "sc_" + oResp["buttonDisplay"][iDisplay][0]; break;
        }
        aDispData[aDispData.length] = new Array(sBtnName, oResp["buttonDisplay"][iDisplay][1]);
        aDispData[aDispData.length] = new Array(sBtnName + "_t", oResp["buttonDisplay"][iDisplay][1]);
        aDispData[aDispData.length] = new Array(sBtnName + "_b", oResp["buttonDisplay"][iDisplay][1]);
        if ("" != sBtnName2)
        {
          aDispData[aDispData.length] = new Array(sBtnName2, oResp["buttonDisplay"][iDisplay][1]);
          aDispData[aDispData.length] = new Array(sBtnName2 + "_top", oResp["buttonDisplay"][iDisplay][1]);
          aDispData[aDispData.length] = new Array(sBtnName2 + "_bot", oResp["buttonDisplay"][iDisplay][1]);
        }
      }
    }
    for (iDisplay = 0; iDisplay < aDispData.length; iDisplay++)
    {
      scAjaxElementDisplay(aDispData[iDisplay][0], aDispData[iDisplay][1]);
    }
  } // scAjaxSetDisplay

  function scAjaxElementDisplay(sElement, sAction)
  {
    sStyle = ("off" == sAction) ? "none" : "";
    if (ajax_block_tab && ajax_block_tab[sElement] && "" != ajax_block_tab[sElement])
    {
      scAjaxElementDisplay(ajax_block_tab[sElement], sAction);
    }
    if (document.getElementById(sElement))
    {
      document.getElementById(sElement).style.display = sStyle;
      if (document.getElementById(sElement + "_dumb"))
      {
        document.getElementById(sElement + "_dumb").style.display = ("off" == sAction) ? "" : "none";
      }
    }
  } // scAjaxElementDisplay

  function scAjaxSetLabel(bReset)
  {
    if (null == bReset)
    {
      bReset = false;
    }
    if (bReset)
    {
      for (iLabel = 0; iLabel < ajax_field_list.length; iLabel++)
      {
        if (ajax_field_list[iLabel] && ajax_error_list[ajax_field_list[iLabel]])
        {
          scAjaxFieldLabel(ajax_field_list[iLabel], ajax_error_list[ajax_field_list[iLabel]]["label"]);
        }
      }
    }
    if (oResp["fieldLabel"])
    {
      for (iLabel = 0; iLabel < oResp["fieldLabel"].length; iLabel++)
      {
        scAjaxFieldLabel(oResp["fieldLabel"][iLabel][0], scAjaxSpecCharParser(oResp["fieldLabel"][iLabel][1]));
      }
    }
  } // scAjaxSetLabel

  function scAjaxFieldLabel(sField, sLabel)
  {
    if (document.getElementById("id_label_" + sField) && document.getElementById("id_label_" + sField).innerHTML != sLabel)
    {
      document.getElementById("id_label_" + sField).innerHTML = sLabel;
    }
  } // scAjaxFieldLabel

  function scAjaxSetReadonly(bReset)
  {
    if (null == bReset)
    {
      bReset = false;
    }
    if (bReset)
    {
      for (iRead = 0; iRead < ajax_field_list.length; iRead++)
      {
        scAjaxFieldRead(ajax_field_list[iRead], ajax_read_only[ajax_field_list[iRead]]);
      }
      for (iRead = 0; iRead < ajax_field_Dt_Hr.length; iRead++)
      {
        scAjaxFieldRead(ajax_field_Dt_Hr[iRead], ajax_read_only[ajax_field_Dt_Hr[iRead]]);
      }
    }
    if (oResp["readOnly"])
    {
      for (iRead = 0; iRead < oResp["readOnly"].length; iRead++)
      {
        if (ajax_read_only[ oResp["readOnly"][iRead][0] ])
        {
          scAjaxFieldRead(oResp["readOnly"][iRead][0], oResp["readOnly"][iRead][1]);
        }
        else if (oResp["rsSize"])
        {
          for (var i = 0; i <= oResp["rsSize"]; i++)
          {
            if (ajax_read_only[ oResp["readOnly"][iRead][0] + i ])
            {
              scAjaxFieldRead(oResp["readOnly"][iRead][0] + i, oResp["readOnly"][iRead][1]);
            }
          }
        }
      }
    }
  } // scAjaxSetReadonly

  function scAjaxFieldRead(sField, sStatus)
  {
    if ("on" == sStatus)
    {
      var sDisplayOff = "none";
      var sDisplayOn  = "";
    }
    else
    {
      var sDisplayOff = "";
      var sDisplayOn  = "none";
    }
    if (document.getElementById("id_read_off_" + sField))
    {
      document.getElementById("id_read_off_" + sField).style.display = sDisplayOff;
    }
    if (document.getElementById("id_read_on_" + sField))
    {
      document.getElementById("id_read_on_" + sField).style.display = sDisplayOn;
    }
  } // scAjaxFieldRead

  function scAjaxSetBtnVars()
  {
    if (oResp["btnVars"])
    {
      for (iBtn = 0; iBtn < oResp["btnVars"].length; iBtn++)
      {
        eval(oResp["btnVars"][iBtn][0] + " = '" + oResp["btnVars"][iBtn][1] + "';");
      }
    }
  } // scAjaxSetBtnVars

  function scAjaxClearText(sFormField)
  {
    document.F1.elements[sFormField].value = "";
  } // scAjaxClearText

  function scAjaxClearLabel(sFormField)
  {
    document.getElementById("id_ajax_label_" + sFormField).innerHTML = "";
  } // scAjaxClearLabel

  function scAjaxClearSelect(sFormField)
  {
    document.F1.elements[sFormField].length = 0;
  } // scAjaxClearSelect

  function scAjaxClearCheckbox(sFormField)
  {
    document.getElementById("idAjaxCheckbox_" + sFormField).innerHTML = "";
  } // scAjaxClearCheckbox

  function scAjaxClearRadio(sFormField)
  {
    document.getElementById("idAjaxRadio_" + sFormField).innerHTML = "";
  } // scAjaxClearRadio

  function scAjaxClearEditorHtml(sFormField)
  {
    var oFormField = tinyMCE.getInstanceById(sFormField);
    oFormField.setContent("");
  } // scAjaxClearEditorHtml

  function scAjaxJavascript()
  {
    if (oResp["ajaxJavascript"])
    {
      var sJsFunc = "";
      for (var i = 0; i < oResp["ajaxJavascript"].length; i++)
      {
        sJsFunc = scAjaxSpecCharParser(oResp["ajaxJavascript"][i][0]);
        if ("" != sJsFunc)
        {
          var aParam = new Array();
          if (oResp["ajaxJavascript"][i][1] && 0 < oResp["ajaxJavascript"][i][1].length)
          {
            for (var j = 0; j < oResp["ajaxJavascript"][i][1].length; j++)
            {
              aParam.push("'" + oResp["ajaxJavascript"][i][1][j] + "'");
            }
          }
          eval("if (" + sJsFunc + ") { " + sJsFunc + "(" + aParam.join(", ") + ") }");
        }
      }
    }
  } // scAjaxJavascript

  function scAjaxAlert()
  {
    if (oResp["ajaxAlert"] && oResp["ajaxAlert"]["message"] && "" != oResp["ajaxAlert"]["message"])
    {
      alert(oResp["ajaxAlert"]["message"]);
    }
  } // scAjaxAlert

  function scAjaxMessage(oTemp)
  {
    if (oTemp && oTemp != null)
    {
        oResp = oTemp;
    }
    if (oResp["ajaxMessage"] && oResp["ajaxMessage"]["message"] && "" != oResp["ajaxMessage"]["message"])
    {
      var sTitle    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["title"])        ? oResp["ajaxMessage"]["title"]               : scMsgDefTitle,
          bModal    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["modal"])        ? ("Y" == oResp["ajaxMessage"]["modal"])      : false,
          iTimeout  = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["timeout"])      ? parseInt(oResp["ajaxMessage"]["timeout"])   : 0,
          bButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button"])       ? ("Y" == oResp["ajaxMessage"]["button"])     : false,
          sButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button_label"]) ? oResp["ajaxMessage"]["button_label"]        : "Ok",
          iTop      = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["top"])          ? parseInt(oResp["ajaxMessage"]["top"])       : 0,
          iLeft     = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["left"])         ? parseInt(oResp["ajaxMessage"]["left"])      : 0,
          iWidth    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["width"])        ? parseInt(oResp["ajaxMessage"]["width"])     : 0,
          iHeight   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["height"])       ? parseInt(oResp["ajaxMessage"]["height"])    : 0,
          bClose    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["show_close"])   ? ("Y" == oResp["ajaxMessage"]["show_close"]) : true,
          bBodyIcon = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["body_icon"])    ? ("Y" == oResp["ajaxMessage"]["body_icon"])  : true,
          sRedir    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir"])        ? oResp["ajaxMessage"]["redir"]               : "",
          sTarget   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_target"]) ? oResp["ajaxMessage"]["redir_target"]        : "",
          sParam    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_par"])    ? oResp["ajaxMessage"]["redir_par"]           : "";
      _scAjaxShowMessage(sTitle, oResp["ajaxMessage"]["message"], bModal, iTimeout, bButton, sButton, iTop, iLeft, iWidth, iHeight, sRedir, sTarget, sParam, bClose, bBodyIcon);
    }
  } // scAjaxAlert

  function scAjaxResponse(sResp)
  {
    eval("var oResp = " + sResp);
    return oResp;
  } // scAjaxResponse

  function scAjaxBreakLine(input)
  {
      if (null == input)
      {
          return "";
      }
      input += "";
      while (input.lastIndexOf(String.fromCharCode(10)) > -1)
      {
         input = input.replace(String.fromCharCode(10), '<br>');
      }
      return input;
  } // scAjaxBreakLine

  function scAjaxProtectBreakLine(input)
  {
      if (null == input)
      {
          return "";
      }
      var input1 = input + "";
      while (input1.lastIndexOf(String.fromCharCode(10)) > -1)
      {
         input1 = input1.replace(String.fromCharCode(10), '#@NM#@');
      }
      return input1;
  } // scAjaxProtectBreakLine

  function scAjaxReturnBreakLine(input)
  {
      if (null == input)
      {
          return "";
      }
      while (input.lastIndexOf('#@NM#@') > -1)
      {
         input = input.replace('#@NM#@', String.fromCharCode(10));
      }
      return input;
  } // scAjaxReturnBreakLine


  // ---------- Validate gr_style
  function do_ajax_greige_grstyle2_form_validate_gr_style()
  {
    var nomeCampo_gr_style = "gr_style";
    var var_gr_style = scAjaxGetFieldText(nomeCampo_gr_style);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_gr_style(var_gr_style, var_script_case_init, do_ajax_greige_grstyle2_form_validate_gr_style_cb);
  } // do_ajax_greige_grstyle2_form_validate_gr_style

  function do_ajax_greige_grstyle2_form_validate_gr_style_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "gr_style";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_gr_style_cb

  // ---------- Validate date
  function do_ajax_greige_grstyle2_form_validate_date()
  {
    var nomeCampo_date = "date";
    var var_date = scAjaxGetFieldText(nomeCampo_date);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_date(var_date, var_script_case_init, do_ajax_greige_grstyle2_form_validate_date_cb);
  } // do_ajax_greige_grstyle2_form_validate_date

  function do_ajax_greige_grstyle2_form_validate_date_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "date";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_date_cb

  // ---------- Validate type
  function do_ajax_greige_grstyle2_form_validate_type()
  {
    var nomeCampo_type = "type";
    var var_type = scAjaxGetFieldText(nomeCampo_type);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_type(var_type, var_script_case_init, do_ajax_greige_grstyle2_form_validate_type_cb);
  } // do_ajax_greige_grstyle2_form_validate_type

  function do_ajax_greige_grstyle2_form_validate_type_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "type";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_type_cb

  // ---------- Validate width
  function do_ajax_greige_grstyle2_form_validate_width()
  {
    var nomeCampo_width = "width";
    var var_width = scAjaxGetFieldText(nomeCampo_width);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_width(var_width, var_script_case_init, do_ajax_greige_grstyle2_form_validate_width_cb);
  } // do_ajax_greige_grstyle2_form_validate_width

  function do_ajax_greige_grstyle2_form_validate_width_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "width";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_width_cb

  // ---------- Validate gauge
  function do_ajax_greige_grstyle2_form_validate_gauge()
  {
    var nomeCampo_gauge = "gauge";
    var var_gauge = scAjaxGetFieldText(nomeCampo_gauge);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_gauge(var_gauge, var_script_case_init, do_ajax_greige_grstyle2_form_validate_gauge_cb);
  } // do_ajax_greige_grstyle2_form_validate_gauge

  function do_ajax_greige_grstyle2_form_validate_gauge_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "gauge";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_gauge_cb

  // ---------- Validate lbs_rack
  function do_ajax_greige_grstyle2_form_validate_lbs_rack()
  {
    var nomeCampo_lbs_rack = "lbs_rack";
    var var_lbs_rack = scAjaxGetFieldText(nomeCampo_lbs_rack);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_lbs_rack(var_lbs_rack, var_script_case_init, do_ajax_greige_grstyle2_form_validate_lbs_rack_cb);
  } // do_ajax_greige_grstyle2_form_validate_lbs_rack

  function do_ajax_greige_grstyle2_form_validate_lbs_rack_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "lbs_rack";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_lbs_rack_cb

  // ---------- Validate racks_lb
  function do_ajax_greige_grstyle2_form_validate_racks_lb()
  {
    var nomeCampo_racks_lb = "racks_lb";
    var var_racks_lb = scAjaxGetFieldText(nomeCampo_racks_lb);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_racks_lb(var_racks_lb, var_script_case_init, do_ajax_greige_grstyle2_form_validate_racks_lb_cb);
  } // do_ajax_greige_grstyle2_form_validate_racks_lb

  function do_ajax_greige_grstyle2_form_validate_racks_lb_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "racks_lb";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_racks_lb_cb

  // ---------- Validate old_style
  function do_ajax_greige_grstyle2_form_validate_old_style()
  {
    var nomeCampo_old_style = "old_style";
    var var_old_style = scAjaxGetFieldText(nomeCampo_old_style);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_old_style(var_old_style, var_script_case_init, do_ajax_greige_grstyle2_form_validate_old_style_cb);
  } // do_ajax_greige_grstyle2_form_validate_old_style

  function do_ajax_greige_grstyle2_form_validate_old_style_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "old_style";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_old_style_cb

  // ---------- Validate new_style
  function do_ajax_greige_grstyle2_form_validate_new_style()
  {
    var nomeCampo_new_style = "new_style";
    var var_new_style = scAjaxGetFieldText(nomeCampo_new_style);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_new_style(var_new_style, var_script_case_init, do_ajax_greige_grstyle2_form_validate_new_style_cb);
  } // do_ajax_greige_grstyle2_form_validate_new_style

  function do_ajax_greige_grstyle2_form_validate_new_style_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "new_style";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_new_style_cb

  // ---------- Validate bd
  function do_ajax_greige_grstyle2_form_validate_bd()
  {
    var nomeCampo_bd = "bd";
    var var_bd = scAjaxGetFieldText(nomeCampo_bd);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bd(var_bd, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bd_cb);
  } // do_ajax_greige_grstyle2_form_validate_bd

  function do_ajax_greige_grstyle2_form_validate_bd_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bd";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bd_cb

  // ---------- Validate bot_yarn
  function do_ajax_greige_grstyle2_form_validate_bot_yarn()
  {
    var nomeCampo_bot_yarn = "bot_yarn";
    var var_bot_yarn = scAjaxGetFieldText(nomeCampo_bot_yarn);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_yarn(var_bot_yarn, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_yarn_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_yarn

  function do_ajax_greige_grstyle2_form_validate_bot_yarn_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_yarn";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_yarn_cb

  // ---------- Validate bot_ends
  function do_ajax_greige_grstyle2_form_validate_bot_ends()
  {
    var nomeCampo_bot_ends = "bot_ends";
    var var_bot_ends = scAjaxGetFieldText(nomeCampo_bot_ends);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_ends(var_bot_ends, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_ends_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_ends

  function do_ajax_greige_grstyle2_form_validate_bot_ends_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_ends";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_ends_cb

  // ---------- Validate bot_patter
  function do_ajax_greige_grstyle2_form_validate_bot_patter()
  {
    var nomeCampo_bot_patter = "bot_patter";
    var var_bot_patter = scAjaxGetFieldText(nomeCampo_bot_patter);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_patter(var_bot_patter, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_patter_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_patter

  function do_ajax_greige_grstyle2_form_validate_bot_patter_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_patter";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_patter_cb

  // ---------- Validate bot_thread
  function do_ajax_greige_grstyle2_form_validate_bot_thread()
  {
    var nomeCampo_bot_thread = "bot_thread";
    var var_bot_thread = scAjaxGetFieldText(nomeCampo_bot_thread);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_thread(var_bot_thread, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_thread_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_thread

  function do_ajax_greige_grstyle2_form_validate_bot_thread_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_thread";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_thread_cb

  // ---------- Validate bot_runnrs
  function do_ajax_greige_grstyle2_form_validate_bot_runnrs()
  {
    var nomeCampo_bot_runnrs = "bot_runnrs";
    var var_bot_runnrs = scAjaxGetFieldText(nomeCampo_bot_runnrs);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_runnrs(var_bot_runnrs, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_runnrs_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_runnrs

  function do_ajax_greige_grstyle2_form_validate_bot_runnrs_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_runnrs";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_runnrs_cb

  // ---------- Validate bot_weight
  function do_ajax_greige_grstyle2_form_validate_bot_weight()
  {
    var nomeCampo_bot_weight = "bot_weight";
    var var_bot_weight = scAjaxGetFieldText(nomeCampo_bot_weight);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_weight(var_bot_weight, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_weight_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_weight

  function do_ajax_greige_grstyle2_form_validate_bot_weight_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_weight";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_weight_cb

  // ---------- Validate bot_percen
  function do_ajax_greige_grstyle2_form_validate_bot_percen()
  {
    var nomeCampo_bot_percen = "bot_percen";
    var var_bot_percen = scAjaxGetFieldText(nomeCampo_bot_percen);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_bot_percen(var_bot_percen, var_script_case_init, do_ajax_greige_grstyle2_form_validate_bot_percen_cb);
  } // do_ajax_greige_grstyle2_form_validate_bot_percen

  function do_ajax_greige_grstyle2_form_validate_bot_percen_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "bot_percen";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_bot_percen_cb

  // ---------- Validate td
  function do_ajax_greige_grstyle2_form_validate_td()
  {
    var nomeCampo_td = "td";
    var var_td = scAjaxGetFieldText(nomeCampo_td);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_td(var_td, var_script_case_init, do_ajax_greige_grstyle2_form_validate_td_cb);
  } // do_ajax_greige_grstyle2_form_validate_td

  function do_ajax_greige_grstyle2_form_validate_td_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "td";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_td_cb

  // ---------- Validate top_yarn
  function do_ajax_greige_grstyle2_form_validate_top_yarn()
  {
    var nomeCampo_top_yarn = "top_yarn";
    var var_top_yarn = scAjaxGetFieldText(nomeCampo_top_yarn);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_yarn(var_top_yarn, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_yarn_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_yarn

  function do_ajax_greige_grstyle2_form_validate_top_yarn_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_yarn";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_yarn_cb

  // ---------- Validate top_ends
  function do_ajax_greige_grstyle2_form_validate_top_ends()
  {
    var nomeCampo_top_ends = "top_ends";
    var var_top_ends = scAjaxGetFieldText(nomeCampo_top_ends);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_ends(var_top_ends, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_ends_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_ends

  function do_ajax_greige_grstyle2_form_validate_top_ends_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_ends";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_ends_cb

  // ---------- Validate top_patter
  function do_ajax_greige_grstyle2_form_validate_top_patter()
  {
    var nomeCampo_top_patter = "top_patter";
    var var_top_patter = scAjaxGetFieldText(nomeCampo_top_patter);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_patter(var_top_patter, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_patter_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_patter

  function do_ajax_greige_grstyle2_form_validate_top_patter_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_patter";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_patter_cb

  // ---------- Validate top_thread
  function do_ajax_greige_grstyle2_form_validate_top_thread()
  {
    var nomeCampo_top_thread = "top_thread";
    var var_top_thread = scAjaxGetFieldText(nomeCampo_top_thread);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_thread(var_top_thread, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_thread_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_thread

  function do_ajax_greige_grstyle2_form_validate_top_thread_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_thread";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_thread_cb

  // ---------- Validate top_runnrs
  function do_ajax_greige_grstyle2_form_validate_top_runnrs()
  {
    var nomeCampo_top_runnrs = "top_runnrs";
    var var_top_runnrs = scAjaxGetFieldText(nomeCampo_top_runnrs);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_runnrs(var_top_runnrs, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_runnrs_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_runnrs

  function do_ajax_greige_grstyle2_form_validate_top_runnrs_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_runnrs";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_runnrs_cb

  // ---------- Validate top_weight
  function do_ajax_greige_grstyle2_form_validate_top_weight()
  {
    var nomeCampo_top_weight = "top_weight";
    var var_top_weight = scAjaxGetFieldText(nomeCampo_top_weight);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_weight(var_top_weight, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_weight_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_weight

  function do_ajax_greige_grstyle2_form_validate_top_weight_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_weight";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_weight_cb

  // ---------- Validate top_percen
  function do_ajax_greige_grstyle2_form_validate_top_percen()
  {
    var nomeCampo_top_percen = "top_percen";
    var var_top_percen = scAjaxGetFieldText(nomeCampo_top_percen);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_top_percen(var_top_percen, var_script_case_init, do_ajax_greige_grstyle2_form_validate_top_percen_cb);
  } // do_ajax_greige_grstyle2_form_validate_top_percen

  function do_ajax_greige_grstyle2_form_validate_top_percen_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "top_percen";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_top_percen_cb

  // ---------- Validate l3d
  function do_ajax_greige_grstyle2_form_validate_l3d()
  {
    var nomeCampo_l3d = "l3d";
    var var_l3d = scAjaxGetFieldText(nomeCampo_l3d);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3d(var_l3d, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3d_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3d

  function do_ajax_greige_grstyle2_form_validate_l3d_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3d";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3d_cb

  // ---------- Validate l3_yarn
  function do_ajax_greige_grstyle2_form_validate_l3_yarn()
  {
    var nomeCampo_l3_yarn = "l3_yarn";
    var var_l3_yarn = scAjaxGetFieldText(nomeCampo_l3_yarn);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_yarn(var_l3_yarn, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_yarn_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_yarn

  function do_ajax_greige_grstyle2_form_validate_l3_yarn_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_yarn";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_yarn_cb

  // ---------- Validate l3_patter
  function do_ajax_greige_grstyle2_form_validate_l3_patter()
  {
    var nomeCampo_l3_patter = "l3_patter";
    var var_l3_patter = scAjaxGetFieldText(nomeCampo_l3_patter);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_patter(var_l3_patter, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_patter_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_patter

  function do_ajax_greige_grstyle2_form_validate_l3_patter_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_patter";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_patter_cb

  // ---------- Validate l3_thread
  function do_ajax_greige_grstyle2_form_validate_l3_thread()
  {
    var nomeCampo_l3_thread = "l3_thread";
    var var_l3_thread = scAjaxGetFieldText(nomeCampo_l3_thread);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_thread(var_l3_thread, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_thread_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_thread

  function do_ajax_greige_grstyle2_form_validate_l3_thread_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_thread";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_thread_cb

  // ---------- Validate l3_runnrs
  function do_ajax_greige_grstyle2_form_validate_l3_runnrs()
  {
    var nomeCampo_l3_runnrs = "l3_runnrs";
    var var_l3_runnrs = scAjaxGetFieldText(nomeCampo_l3_runnrs);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_runnrs(var_l3_runnrs, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_runnrs_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_runnrs

  function do_ajax_greige_grstyle2_form_validate_l3_runnrs_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_runnrs";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_runnrs_cb

  // ---------- Validate l3_weight
  function do_ajax_greige_grstyle2_form_validate_l3_weight()
  {
    var nomeCampo_l3_weight = "l3_weight";
    var var_l3_weight = scAjaxGetFieldText(nomeCampo_l3_weight);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_weight(var_l3_weight, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_weight_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_weight

  function do_ajax_greige_grstyle2_form_validate_l3_weight_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_weight";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_weight_cb

  // ---------- Validate l3_percen
  function do_ajax_greige_grstyle2_form_validate_l3_percen()
  {
    var nomeCampo_l3_percen = "l3_percen";
    var var_l3_percen = scAjaxGetFieldText(nomeCampo_l3_percen);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_percen(var_l3_percen, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_percen_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_percen

  function do_ajax_greige_grstyle2_form_validate_l3_percen_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_percen";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_percen_cb

  // ---------- Validate l3_ends
  function do_ajax_greige_grstyle2_form_validate_l3_ends()
  {
    var nomeCampo_l3_ends = "l3_ends";
    var var_l3_ends = scAjaxGetFieldText(nomeCampo_l3_ends);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l3_ends(var_l3_ends, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l3_ends_cb);
  } // do_ajax_greige_grstyle2_form_validate_l3_ends

  function do_ajax_greige_grstyle2_form_validate_l3_ends_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l3_ends";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l3_ends_cb

  // ---------- Validate l4d
  function do_ajax_greige_grstyle2_form_validate_l4d()
  {
    var nomeCampo_l4d = "l4d";
    var var_l4d = scAjaxGetFieldText(nomeCampo_l4d);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4d(var_l4d, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4d_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4d

  function do_ajax_greige_grstyle2_form_validate_l4d_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4d";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4d_cb

  // ---------- Validate l4_yarn
  function do_ajax_greige_grstyle2_form_validate_l4_yarn()
  {
    var nomeCampo_l4_yarn = "l4_yarn";
    var var_l4_yarn = scAjaxGetFieldText(nomeCampo_l4_yarn);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_yarn(var_l4_yarn, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_yarn_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_yarn

  function do_ajax_greige_grstyle2_form_validate_l4_yarn_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_yarn";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_yarn_cb

  // ---------- Validate l4_patter
  function do_ajax_greige_grstyle2_form_validate_l4_patter()
  {
    var nomeCampo_l4_patter = "l4_patter";
    var var_l4_patter = scAjaxGetFieldText(nomeCampo_l4_patter);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_patter(var_l4_patter, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_patter_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_patter

  function do_ajax_greige_grstyle2_form_validate_l4_patter_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_patter";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_patter_cb

  // ---------- Validate l4_thread
  function do_ajax_greige_grstyle2_form_validate_l4_thread()
  {
    var nomeCampo_l4_thread = "l4_thread";
    var var_l4_thread = scAjaxGetFieldText(nomeCampo_l4_thread);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_thread(var_l4_thread, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_thread_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_thread

  function do_ajax_greige_grstyle2_form_validate_l4_thread_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_thread";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_thread_cb

  // ---------- Validate l4_runnrs
  function do_ajax_greige_grstyle2_form_validate_l4_runnrs()
  {
    var nomeCampo_l4_runnrs = "l4_runnrs";
    var var_l4_runnrs = scAjaxGetFieldText(nomeCampo_l4_runnrs);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_runnrs(var_l4_runnrs, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_runnrs_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_runnrs

  function do_ajax_greige_grstyle2_form_validate_l4_runnrs_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_runnrs";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_runnrs_cb

  // ---------- Validate l4_weight
  function do_ajax_greige_grstyle2_form_validate_l4_weight()
  {
    var nomeCampo_l4_weight = "l4_weight";
    var var_l4_weight = scAjaxGetFieldText(nomeCampo_l4_weight);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_weight(var_l4_weight, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_weight_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_weight

  function do_ajax_greige_grstyle2_form_validate_l4_weight_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_weight";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_weight_cb

  // ---------- Validate l4_percen
  function do_ajax_greige_grstyle2_form_validate_l4_percen()
  {
    var nomeCampo_l4_percen = "l4_percen";
    var var_l4_percen = scAjaxGetFieldText(nomeCampo_l4_percen);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_percen(var_l4_percen, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_percen_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_percen

  function do_ajax_greige_grstyle2_form_validate_l4_percen_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_percen";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_percen_cb

  // ---------- Validate l4_ends
  function do_ajax_greige_grstyle2_form_validate_l4_ends()
  {
    var nomeCampo_l4_ends = "l4_ends";
    var var_l4_ends = scAjaxGetFieldText(nomeCampo_l4_ends);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_greige_grstyle2_form_validate_l4_ends(var_l4_ends, var_script_case_init, do_ajax_greige_grstyle2_form_validate_l4_ends_cb);
  } // do_ajax_greige_grstyle2_form_validate_l4_ends

  function do_ajax_greige_grstyle2_form_validate_l4_ends_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "l4_ends";
    scAjaxUpdateFieldErrors(sFieldValid, "valid");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      var sImgStatus = sc_img_status_ok;
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      var sImgStatus = sc_img_status_err;
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    var $oImg = $('#id_sc_status_' + sFieldValid);
    if (0 < $oImg.length)
    {
      $oImg.attr('src', sImgStatus).css('display', '');
    }
    scAjaxShowDebug();
    scAjaxSetMaster();
    scAjaxSetFocus();
  } // do_ajax_greige_grstyle2_form_validate_l4_ends_cb
  // ---------- Form
  function do_ajax_greige_grstyle2_form_submit_form()
  {
    scAjaxHideMessage();
    var var_gr_style = scAjaxGetFieldText("gr_style");
    var var_date = scAjaxGetFieldText("date");
    var var_type = scAjaxGetFieldText("type");
    var var_width = scAjaxGetFieldText("width");
    var var_gauge = scAjaxGetFieldText("gauge");
    var var_lbs_rack = scAjaxGetFieldText("lbs_rack");
    var var_racks_lb = scAjaxGetFieldText("racks_lb");
    var var_old_style = scAjaxGetFieldText("old_style");
    var var_new_style = scAjaxGetFieldText("new_style");
    var var_bd = scAjaxGetFieldText("bd");
    var var_bot_yarn = scAjaxGetFieldText("bot_yarn");
    var var_bot_ends = scAjaxGetFieldText("bot_ends");
    var var_bot_patter = scAjaxGetFieldText("bot_patter");
    var var_bot_thread = scAjaxGetFieldText("bot_thread");
    var var_bot_runnrs = scAjaxGetFieldText("bot_runnrs");
    var var_bot_weight = scAjaxGetFieldText("bot_weight");
    var var_bot_percen = scAjaxGetFieldText("bot_percen");
    var var_td = scAjaxGetFieldText("td");
    var var_top_yarn = scAjaxGetFieldText("top_yarn");
    var var_top_ends = scAjaxGetFieldText("top_ends");
    var var_top_patter = scAjaxGetFieldText("top_patter");
    var var_top_thread = scAjaxGetFieldText("top_thread");
    var var_top_runnrs = scAjaxGetFieldText("top_runnrs");
    var var_top_weight = scAjaxGetFieldText("top_weight");
    var var_top_percen = scAjaxGetFieldText("top_percen");
    var var_l3d = scAjaxGetFieldText("l3d");
    var var_l3_yarn = scAjaxGetFieldText("l3_yarn");
    var var_l3_patter = scAjaxGetFieldText("l3_patter");
    var var_l3_thread = scAjaxGetFieldText("l3_thread");
    var var_l3_runnrs = scAjaxGetFieldText("l3_runnrs");
    var var_l3_weight = scAjaxGetFieldText("l3_weight");
    var var_l3_percen = scAjaxGetFieldText("l3_percen");
    var var_l3_ends = scAjaxGetFieldText("l3_ends");
    var var_l4d = scAjaxGetFieldText("l4d");
    var var_l4_yarn = scAjaxGetFieldText("l4_yarn");
    var var_l4_patter = scAjaxGetFieldText("l4_patter");
    var var_l4_thread = scAjaxGetFieldText("l4_thread");
    var var_l4_runnrs = scAjaxGetFieldText("l4_runnrs");
    var var_l4_weight = scAjaxGetFieldText("l4_weight");
    var var_l4_percen = scAjaxGetFieldText("l4_percen");
    var var_l4_ends = scAjaxGetFieldText("l4_ends");
    var var_nm_form_submit = document.F1.nm_form_submit.value;
    var var_nmgp_url_saida = document.F1.nmgp_url_saida.value;
    var var_nmgp_opcao = document.F1.nmgp_opcao.value;
    var var_nmgp_ancora = document.F1.nmgp_ancora.value;
    var var_nmgp_num_form = document.F1.nmgp_num_form.value;
    var var_nmgp_parms = document.F1.nmgp_parms.value;
    var var_script_case_init = document.F1.script_case_init.value;
    scAjaxProcOn();
    x_ajax_greige_grstyle2_form_submit_form(var_gr_style, var_date, var_type, var_width, var_gauge, var_lbs_rack, var_racks_lb, var_old_style, var_new_style, var_bd, var_bot_yarn, var_bot_ends, var_bot_patter, var_bot_thread, var_bot_runnrs, var_bot_weight, var_bot_percen, var_td, var_top_yarn, var_top_ends, var_top_patter, var_top_thread, var_top_runnrs, var_top_weight, var_top_percen, var_l3d, var_l3_yarn, var_l3_patter, var_l3_thread, var_l3_runnrs, var_l3_weight, var_l3_percen, var_l3_ends, var_l4d, var_l4_yarn, var_l4_patter, var_l4_thread, var_l4_runnrs, var_l4_weight, var_l4_percen, var_l4_ends, var_nm_form_submit, var_nmgp_url_saida, var_nmgp_opcao, var_nmgp_ancora, var_nmgp_num_form, var_nmgp_parms, var_script_case_init, do_ajax_greige_grstyle2_form_submit_form_cb);
  } // do_ajax_greige_grstyle2_form_submit_form

  function do_ajax_greige_grstyle2_form_submit_form_cb(sResp)
  {
    scAjaxProcOff();
    oResp = scAjaxResponse(sResp);
    scAjaxCalendarReload();
    scAjaxUpdateErrors("valid");
    sAppErrors = scAjaxListErrors(true);
    if ("" == sAppErrors)
    {
      $('.sc-js-ui-statusimg').css('display', 'none');
      scAjaxHideErrorDisplay("table");
    }
    else
    {
      scAjaxShowErrorDisplay("table", sAppErrors);
    }
    if (scAjaxIsOk())
    {
      scAjaxShowMessage();
      scAjaxHideErrorDisplay("table");
      scAjaxHideErrorDisplay("gr_style");
      scAjaxHideErrorDisplay("date");
      scAjaxHideErrorDisplay("type");
      scAjaxHideErrorDisplay("width");
      scAjaxHideErrorDisplay("gauge");
      scAjaxHideErrorDisplay("lbs_rack");
      scAjaxHideErrorDisplay("racks_lb");
      scAjaxHideErrorDisplay("old_style");
      scAjaxHideErrorDisplay("new_style");
      scAjaxHideErrorDisplay("bd");
      scAjaxHideErrorDisplay("bot_yarn");
      scAjaxHideErrorDisplay("bot_ends");
      scAjaxHideErrorDisplay("bot_patter");
      scAjaxHideErrorDisplay("bot_thread");
      scAjaxHideErrorDisplay("bot_runnrs");
      scAjaxHideErrorDisplay("bot_weight");
      scAjaxHideErrorDisplay("bot_percen");
      scAjaxHideErrorDisplay("td");
      scAjaxHideErrorDisplay("top_yarn");
      scAjaxHideErrorDisplay("top_ends");
      scAjaxHideErrorDisplay("top_patter");
      scAjaxHideErrorDisplay("top_thread");
      scAjaxHideErrorDisplay("top_runnrs");
      scAjaxHideErrorDisplay("top_weight");
      scAjaxHideErrorDisplay("top_percen");
      scAjaxHideErrorDisplay("l3d");
      scAjaxHideErrorDisplay("l3_yarn");
      scAjaxHideErrorDisplay("l3_patter");
      scAjaxHideErrorDisplay("l3_thread");
      scAjaxHideErrorDisplay("l3_runnrs");
      scAjaxHideErrorDisplay("l3_weight");
      scAjaxHideErrorDisplay("l3_percen");
      scAjaxHideErrorDisplay("l3_ends");
      scAjaxHideErrorDisplay("l4d");
      scAjaxHideErrorDisplay("l4_yarn");
      scAjaxHideErrorDisplay("l4_patter");
      scAjaxHideErrorDisplay("l4_thread");
      scAjaxHideErrorDisplay("l4_runnrs");
      scAjaxHideErrorDisplay("l4_weight");
      scAjaxHideErrorDisplay("l4_percen");
      scAjaxHideErrorDisplay("l4_ends");
      scLigEditLookupCall();
    }
    Nm_Proc_Atualiz = false;
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
      if (scInlineFormSend())
      {
        self.parent.tb_remove();
        return;
      }
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
    if (hasJsFormOnload)
    {
      sc_form_onload();
    }
  } // do_ajax_greige_grstyle2_form_submit_form_cb

  var scStatusDetail = {};

  function do_ajax_greige_grstyle2_form_navigate_form()
  {
    if (scRefreshTable())
    {
      return;
    }
    scAjaxHideMessage();
    scAjaxHideErrorDisplay("table");
    scAjaxHideErrorDisplay("gr_style");
    scAjaxHideErrorDisplay("date");
    scAjaxHideErrorDisplay("type");
    scAjaxHideErrorDisplay("width");
    scAjaxHideErrorDisplay("gauge");
    scAjaxHideErrorDisplay("lbs_rack");
    scAjaxHideErrorDisplay("racks_lb");
    scAjaxHideErrorDisplay("old_style");
    scAjaxHideErrorDisplay("new_style");
    scAjaxHideErrorDisplay("bd");
    scAjaxHideErrorDisplay("bot_yarn");
    scAjaxHideErrorDisplay("bot_ends");
    scAjaxHideErrorDisplay("bot_patter");
    scAjaxHideErrorDisplay("bot_thread");
    scAjaxHideErrorDisplay("bot_runnrs");
    scAjaxHideErrorDisplay("bot_weight");
    scAjaxHideErrorDisplay("bot_percen");
    scAjaxHideErrorDisplay("td");
    scAjaxHideErrorDisplay("top_yarn");
    scAjaxHideErrorDisplay("top_ends");
    scAjaxHideErrorDisplay("top_patter");
    scAjaxHideErrorDisplay("top_thread");
    scAjaxHideErrorDisplay("top_runnrs");
    scAjaxHideErrorDisplay("top_weight");
    scAjaxHideErrorDisplay("top_percen");
    scAjaxHideErrorDisplay("l3d");
    scAjaxHideErrorDisplay("l3_yarn");
    scAjaxHideErrorDisplay("l3_patter");
    scAjaxHideErrorDisplay("l3_thread");
    scAjaxHideErrorDisplay("l3_runnrs");
    scAjaxHideErrorDisplay("l3_weight");
    scAjaxHideErrorDisplay("l3_percen");
    scAjaxHideErrorDisplay("l3_ends");
    scAjaxHideErrorDisplay("l4d");
    scAjaxHideErrorDisplay("l4_yarn");
    scAjaxHideErrorDisplay("l4_patter");
    scAjaxHideErrorDisplay("l4_thread");
    scAjaxHideErrorDisplay("l4_runnrs");
    scAjaxHideErrorDisplay("l4_weight");
    scAjaxHideErrorDisplay("l4_percen");
    scAjaxHideErrorDisplay("l4_ends");
    var var_id2 = document.F2.id2.value;
    var var_nm_form_submit = document.F2.nm_form_submit.value;
    var var_nmgp_opcao = document.F2.nmgp_opcao.value;
    var var_nmgp_ordem = document.F2.nmgp_ordem.value;
    var var_nmgp_fast_search = document.F2.nmgp_fast_search.value;
    var var_nmgp_cond_fast_search = document.F2.nmgp_cond_fast_search.value;
    var var_nmgp_arg_fast_search = document.F2.nmgp_arg_fast_search.value;
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn();
    x_ajax_greige_grstyle2_form_navigate_form(var_id2, var_nm_form_submit, var_nmgp_opcao, var_nmgp_ordem, var_nmgp_fast_search,  var_nmgp_cond_fast_search,  var_nmgp_arg_fast_search, var_script_case_init, do_ajax_greige_grstyle2_form_navigate_form_cb);
  } // do_ajax_greige_grstyle2_form_navigate_form

  function do_ajax_greige_grstyle2_form_navigate_form_cb(sResp)
  {
    scAjaxProcOff();
    oResp = scAjaxResponse(sResp);
    if ("ERROR" == oResp.result)
    {
        scAjaxShowErrorDisplay("table", oResp.errList[0].msgText);
        scAjaxProcOff();
        return;
    }
    else if (oResp["navSummary"].reg_tot == 0)
    {
        _scAjaxShowMessage("", "<?php echo $this->Ini->Nm_lang['lang_errm_empt'] ?>", false, 0, true, "Ok", 0, 0, 0, 0, "", "", "", false, true);
    }
    sc_mupload_ok = true;
    scAjaxSetFields();
    document.F2.id2.value = scAjaxGetKeyValue("id2");
    scAjaxSetSummary();
    scAjaxSetNavpage();
    scAjaxShowDebug();
    scAjaxSetDisplay(true);
    scAjaxSetLabel(true);
    scAjaxSetReadonly(true);
    scAjaxSetMaster();
    scAjaxSetNavStatus("t");
    scAjaxSetNavStatus("b");
    scAjaxSetBtnVars();
    $('.sc-js-ui-statusimg').css('display', 'none');
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scQSInit = true;
    scQSInitVal = $("#SC_fast_search_t").val();
    scQuickSearchKeyUp('t', null);
    $('#SC_fast_search_t').blur();
    scQuickSearchInit(true, '');
    scQSInit = false;
    scAjaxSetFocus();
<?php
if ($this->Embutida_form)
{
?>
    do_ajax_greige_grstyle2_form_restore_buttons();
<?php
}
?>
    if (hasJsFormOnload)
    {
      sc_form_onload();
    }
  } // do_ajax_greige_grstyle2_form_navigate_form_cb

  function scAjaxDetailProc()
  {
    return true;
  } // scAjaxDetailProc


  var ajax_error_geral = "";

  var ajax_error_type = new Array("valid", "onblur", "onchange", "onclick", "onfocus");

  var ajax_field_list = new Array();
  var ajax_field_Dt_Hr = new Array();
  ajax_field_list[0] = "gr_style";
  ajax_field_list[1] = "date";
  ajax_field_list[2] = "type";
  ajax_field_list[3] = "width";
  ajax_field_list[4] = "gauge";
  ajax_field_list[5] = "lbs_rack";
  ajax_field_list[6] = "racks_lb";
  ajax_field_list[7] = "old_style";
  ajax_field_list[8] = "new_style";
  ajax_field_list[9] = "bd";
  ajax_field_list[10] = "bot_yarn";
  ajax_field_list[11] = "bot_ends";
  ajax_field_list[12] = "bot_patter";
  ajax_field_list[13] = "bot_thread";
  ajax_field_list[14] = "bot_runnrs";
  ajax_field_list[15] = "bot_weight";
  ajax_field_list[16] = "bot_percen";
  ajax_field_list[17] = "td";
  ajax_field_list[18] = "top_yarn";
  ajax_field_list[19] = "top_ends";
  ajax_field_list[20] = "top_patter";
  ajax_field_list[21] = "top_thread";
  ajax_field_list[22] = "top_runnrs";
  ajax_field_list[23] = "top_weight";
  ajax_field_list[24] = "top_percen";
  ajax_field_list[25] = "l3d";
  ajax_field_list[26] = "l3_yarn";
  ajax_field_list[27] = "l3_patter";
  ajax_field_list[28] = "l3_thread";
  ajax_field_list[29] = "l3_runnrs";
  ajax_field_list[30] = "l3_weight";
  ajax_field_list[31] = "l3_percen";
  ajax_field_list[32] = "l3_ends";
  ajax_field_list[33] = "l4d";
  ajax_field_list[34] = "l4_yarn";
  ajax_field_list[35] = "l4_patter";
  ajax_field_list[36] = "l4_thread";
  ajax_field_list[37] = "l4_runnrs";
  ajax_field_list[38] = "l4_weight";
  ajax_field_list[39] = "l4_percen";
  ajax_field_list[40] = "l4_ends";

  var ajax_block_list = new Array();
  ajax_block_list[0] = "0";
  ajax_block_list[1] = "1";
  ajax_block_list[2] = "2";
  ajax_block_list[3] = "3";
  ajax_block_list[4] = "4";

  var ajax_error_list = {
    "gr_style": {"label": "GR STYLE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "date": {"label": "DATE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "type": {"label": "TYPE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "width": {"label": "WIDTH", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "gauge": {"label": "GAUGE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "lbs_rack": {"label": "LBS RACK", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "racks_lb": {"label": "RACKS LB", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "old_style": {"label": "OLD STYLE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "new_style": {"label": "NEW STYLE", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bd": {"label": "BD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_yarn": {"label": "BOT YARN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_ends": {"label": "BOT ENDS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_patter": {"label": "BOT PATTER", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_thread": {"label": "BOT THREAD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_runnrs": {"label": "BOT RUNNRS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_weight": {"label": "BOT WEIGHT", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "bot_percen": {"label": "BOT PERCEN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "td": {"label": "TD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_yarn": {"label": "TOP YARN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_ends": {"label": "TOP ENDS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_patter": {"label": "TOP PATTER", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_thread": {"label": "TOP THREAD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_runnrs": {"label": "TOP RUNNRS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_weight": {"label": "TOP WEIGHT", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "top_percen": {"label": "TOP PERCEN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3d": {"label": "L3D", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_yarn": {"label": "L3 YARN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_patter": {"label": "L3 PATTER", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_thread": {"label": "L3 THREAD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_runnrs": {"label": "L3 RUNNRS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_weight": {"label": "L3 WEIGHT", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_percen": {"label": "L3 PERCEN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l3_ends": {"label": "L3 ENDS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4d": {"label": "L4D", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_yarn": {"label": "L4 YARN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_patter": {"label": "L4 PATTER", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_thread": {"label": "L4 THREAD", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_runnrs": {"label": "L4 RUNNRS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_weight": {"label": "L4 WEIGHT", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_percen": {"label": "L4 PERCEN", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "l4_ends": {"label": "L4 ENDS", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5}
  };
  var ajax_error_timeout = 5;

  var ajax_block_id = {
    "0": "hidden_bloco_0",
    "1": "hidden_bloco_1",
    "2": "hidden_bloco_2",
    "3": "hidden_bloco_3",
    "4": "hidden_bloco_4"
  };

  var ajax_block_tab = {
    "hidden_bloco_0": "",
    "hidden_bloco_1": "",
    "hidden_bloco_2": "",
    "hidden_bloco_3": "",
    "hidden_bloco_4": ""
  };

  var ajax_field_mult = {
    "gr_style": new Array(),
    "date": new Array(),
    "type": new Array(),
    "width": new Array(),
    "gauge": new Array(),
    "lbs_rack": new Array(),
    "racks_lb": new Array(),
    "old_style": new Array(),
    "new_style": new Array(),
    "bd": new Array(),
    "bot_yarn": new Array(),
    "bot_ends": new Array(),
    "bot_patter": new Array(),
    "bot_thread": new Array(),
    "bot_runnrs": new Array(),
    "bot_weight": new Array(),
    "bot_percen": new Array(),
    "td": new Array(),
    "top_yarn": new Array(),
    "top_ends": new Array(),
    "top_patter": new Array(),
    "top_thread": new Array(),
    "top_runnrs": new Array(),
    "top_weight": new Array(),
    "top_percen": new Array(),
    "l3d": new Array(),
    "l3_yarn": new Array(),
    "l3_patter": new Array(),
    "l3_thread": new Array(),
    "l3_runnrs": new Array(),
    "l3_weight": new Array(),
    "l3_percen": new Array(),
    "l3_ends": new Array(),
    "l4d": new Array(),
    "l4_yarn": new Array(),
    "l4_patter": new Array(),
    "l4_thread": new Array(),
    "l4_runnrs": new Array(),
    "l4_weight": new Array(),
    "l4_percen": new Array(),
    "l4_ends": new Array()
  };
  ajax_field_mult["gr_style"][1] = "gr_style";
  ajax_field_mult["date"][1] = "date";
  ajax_field_mult["type"][1] = "type";
  ajax_field_mult["width"][1] = "width";
  ajax_field_mult["gauge"][1] = "gauge";
  ajax_field_mult["lbs_rack"][1] = "lbs_rack";
  ajax_field_mult["racks_lb"][1] = "racks_lb";
  ajax_field_mult["old_style"][1] = "old_style";
  ajax_field_mult["new_style"][1] = "new_style";
  ajax_field_mult["bd"][1] = "bd";
  ajax_field_mult["bot_yarn"][1] = "bot_yarn";
  ajax_field_mult["bot_ends"][1] = "bot_ends";
  ajax_field_mult["bot_patter"][1] = "bot_patter";
  ajax_field_mult["bot_thread"][1] = "bot_thread";
  ajax_field_mult["bot_runnrs"][1] = "bot_runnrs";
  ajax_field_mult["bot_weight"][1] = "bot_weight";
  ajax_field_mult["bot_percen"][1] = "bot_percen";
  ajax_field_mult["td"][1] = "td";
  ajax_field_mult["top_yarn"][1] = "top_yarn";
  ajax_field_mult["top_ends"][1] = "top_ends";
  ajax_field_mult["top_patter"][1] = "top_patter";
  ajax_field_mult["top_thread"][1] = "top_thread";
  ajax_field_mult["top_runnrs"][1] = "top_runnrs";
  ajax_field_mult["top_weight"][1] = "top_weight";
  ajax_field_mult["top_percen"][1] = "top_percen";
  ajax_field_mult["l3d"][1] = "l3d";
  ajax_field_mult["l3_yarn"][1] = "l3_yarn";
  ajax_field_mult["l3_patter"][1] = "l3_patter";
  ajax_field_mult["l3_thread"][1] = "l3_thread";
  ajax_field_mult["l3_runnrs"][1] = "l3_runnrs";
  ajax_field_mult["l3_weight"][1] = "l3_weight";
  ajax_field_mult["l3_percen"][1] = "l3_percen";
  ajax_field_mult["l3_ends"][1] = "l3_ends";
  ajax_field_mult["l4d"][1] = "l4d";
  ajax_field_mult["l4_yarn"][1] = "l4_yarn";
  ajax_field_mult["l4_patter"][1] = "l4_patter";
  ajax_field_mult["l4_thread"][1] = "l4_thread";
  ajax_field_mult["l4_runnrs"][1] = "l4_runnrs";
  ajax_field_mult["l4_weight"][1] = "l4_weight";
  ajax_field_mult["l4_percen"][1] = "l4_percen";
  ajax_field_mult["l4_ends"][1] = "l4_ends";

  var ajax_field_id = {
    "gr_style": new Array("hidden_field_label_gr_style", "hidden_field_data_gr_style"),
    "date": new Array("hidden_field_label_date", "hidden_field_data_date"),
    "type": new Array("hidden_field_label_type", "hidden_field_data_type"),
    "width": new Array("hidden_field_label_width", "hidden_field_data_width"),
    "gauge": new Array("hidden_field_label_gauge", "hidden_field_data_gauge"),
    "lbs_rack": new Array("hidden_field_label_lbs_rack", "hidden_field_data_lbs_rack"),
    "racks_lb": new Array("hidden_field_label_racks_lb", "hidden_field_data_racks_lb"),
    "old_style": new Array("hidden_field_label_old_style", "hidden_field_data_old_style"),
    "new_style": new Array("hidden_field_label_new_style", "hidden_field_data_new_style"),
    "bd": new Array("hidden_field_label_bd", "hidden_field_data_bd"),
    "bot_yarn": new Array("hidden_field_label_bot_yarn", "hidden_field_data_bot_yarn"),
    "bot_ends": new Array("hidden_field_label_bot_ends", "hidden_field_data_bot_ends"),
    "bot_patter": new Array("hidden_field_label_bot_patter", "hidden_field_data_bot_patter"),
    "bot_thread": new Array("hidden_field_label_bot_thread", "hidden_field_data_bot_thread"),
    "bot_runnrs": new Array("hidden_field_label_bot_runnrs", "hidden_field_data_bot_runnrs"),
    "bot_weight": new Array("hidden_field_label_bot_weight", "hidden_field_data_bot_weight"),
    "bot_percen": new Array("hidden_field_label_bot_percen", "hidden_field_data_bot_percen"),
    "td": new Array("hidden_field_label_td", "hidden_field_data_td"),
    "top_yarn": new Array("hidden_field_label_top_yarn", "hidden_field_data_top_yarn"),
    "top_ends": new Array("hidden_field_label_top_ends", "hidden_field_data_top_ends"),
    "top_patter": new Array("hidden_field_label_top_patter", "hidden_field_data_top_patter"),
    "top_thread": new Array("hidden_field_label_top_thread", "hidden_field_data_top_thread"),
    "top_runnrs": new Array("hidden_field_label_top_runnrs", "hidden_field_data_top_runnrs"),
    "top_weight": new Array("hidden_field_label_top_weight", "hidden_field_data_top_weight"),
    "top_percen": new Array("hidden_field_label_top_percen", "hidden_field_data_top_percen"),
    "l3d": new Array("hidden_field_label_l3d", "hidden_field_data_l3d"),
    "l3_yarn": new Array("hidden_field_label_l3_yarn", "hidden_field_data_l3_yarn"),
    "l3_patter": new Array("hidden_field_label_l3_patter", "hidden_field_data_l3_patter"),
    "l3_thread": new Array("hidden_field_label_l3_thread", "hidden_field_data_l3_thread"),
    "l3_runnrs": new Array("hidden_field_label_l3_runnrs", "hidden_field_data_l3_runnrs"),
    "l3_weight": new Array("hidden_field_label_l3_weight", "hidden_field_data_l3_weight"),
    "l3_percen": new Array("hidden_field_label_l3_percen", "hidden_field_data_l3_percen"),
    "l3_ends": new Array("hidden_field_label_l3_ends", "hidden_field_data_l3_ends"),
    "l4d": new Array("hidden_field_label_l4d", "hidden_field_data_l4d"),
    "l4_yarn": new Array("hidden_field_label_l4_yarn", "hidden_field_data_l4_yarn"),
    "l4_patter": new Array("hidden_field_label_l4_patter", "hidden_field_data_l4_patter"),
    "l4_thread": new Array("hidden_field_label_l4_thread", "hidden_field_data_l4_thread"),
    "l4_runnrs": new Array("hidden_field_label_l4_runnrs", "hidden_field_data_l4_runnrs"),
    "l4_weight": new Array("hidden_field_label_l4_weight", "hidden_field_data_l4_weight"),
    "l4_percen": new Array("hidden_field_label_l4_percen", "hidden_field_data_l4_percen"),
    "l4_ends": new Array("hidden_field_label_l4_ends", "hidden_field_data_l4_ends")
  };

  var ajax_read_only = {
    "gr_style": "off",
    "date": "on",
    "type": "off",
    "width": "off",
    "gauge": "off",
    "lbs_rack": "on",
    "racks_lb": "on",
    "old_style": "off",
    "new_style": "off",
    "bd": "off",
    "bot_yarn": "off",
    "bot_ends": "off",
    "bot_patter": "off",
    "bot_thread": "off",
    "bot_runnrs": "off",
    "bot_weight": "on",
    "bot_percen": "on",
    "td": "off",
    "top_yarn": "off",
    "top_ends": "off",
    "top_patter": "off",
    "top_thread": "off",
    "top_runnrs": "off",
    "top_weight": "on",
    "top_percen": "on",
    "l3d": "off",
    "l3_yarn": "off",
    "l3_patter": "off",
    "l3_thread": "off",
    "l3_runnrs": "off",
    "l3_weight": "on",
    "l3_percen": "on",
    "l3_ends": "off",
    "l4d": "on",
    "l4_yarn": "on",
    "l4_patter": "on",
    "l4_thread": "on",
    "l4_runnrs": "on",
    "l4_weight": "on",
    "l4_percen": "on",
    "l4_ends": "off"
  };
  var bRefreshTable = false;
  function scRefreshTable()
  {
    return false;
  }

  function scAjaxDetailValue(sIndex, sValue)
  {
    var aValue = new Array();
    aValue[0] = {"value" : sValue};
    if ("gr_style" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("date" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("type" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("width" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("gauge" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("lbs_rack" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("racks_lb" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("old_style" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("new_style" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bd" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_yarn" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_ends" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_patter" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_thread" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_runnrs" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_weight" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("bot_percen" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("td" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_yarn" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_ends" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_patter" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_thread" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_runnrs" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_weight" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("top_percen" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3d" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_yarn" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_patter" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_thread" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_runnrs" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_weight" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_percen" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l3_ends" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4d" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_yarn" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_patter" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_thread" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_runnrs" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_weight" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_percen" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("l4_ends" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    scAjaxSetFieldInnerHtml(sIndex, aValue);
  }
 </SCRIPT>
