
 <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_calendar_wastetransactions" == 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++;
        }
      }
    }
        if (ajax_error_list[sField])
        {
        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])
    {
        var Temp_text = scAjaxReturnBreakLine(scAjaxSpecCharParser(scAjaxProtectBreakLine(oFieldValues[0]['value'])));
        eval ("document.F1." + sFieldName + ".value = 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)
    {
      $("#id_sc_field_" + sFieldName).children().remove()
      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 = $("#id_sc_field_" + sFieldName);
    for (iFieldSelect = 0; iFieldSelect < oFormField[0].length; iFieldSelect++)
    {
      if (scAjaxInArray(oFormField[0].options[iFieldSelect].value, aValues))
      {
        oFormField[0].options[iFieldSelect].selected = true;
      }
      else
      {
        oFormField[0].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 (null != oFieldOptions)
    {
        scAjaxClearCheckbox(sFieldName);
    }
    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)
    {
        scAjaxClearRadio(sFieldName);
    }
    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;
    }
	if(tinymce.majorVersion > 3)
	{
		var oFormField = tinyMCE.get(sFieldName);
	}
	else
	{
		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 scAjaxSpecCharProtect($oHidden[i].value);//.replace(/[+]/g, "__NM_PLUS__");
        }
      }
    }
    $oField = $("#id_sc_field_" + sFieldName);
    if ($oField.length && "select" != $oField[0].type.substr(0, 6))
    {
      return scAjaxSpecCharProtect($oField.val());//.replace(/[+]/g, "__NM_PLUS__");
    }
    else if (document.F1.elements[sFieldName])
    {
      return scAjaxSpecCharProtect(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 scAjaxSpecCharProtect(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 scAjaxSpecCharProtect(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 += scAjaxSpecCharProtect(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 += scAjaxSpecCharProtect(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 = scAjaxSpecCharProtect(sc_cmp_radio.value);//.replace(/[+]/g, "__NM_PLUS__");
        }
    }
    else
    {
      for (iFieldRadio = 0; iFieldRadio < oFormField.length; iFieldRadio++)
      {
        if (oFormField[iFieldRadio].checked)
        {
          sValue = scAjaxSpecCharProtect(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;
    }
    
	if(tinymce.majorVersion > 3)
	{
		var oFormField = tinyMCE.get(sFieldName);
	}
	else
	{
		var oFormField = tinyMCE.getInstanceById(sFieldName);
	}
    return scAjaxSpecCharParser(scAjaxSpecCharProtect(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 scAjaxSpecCharProtect(sOriginal)
  {
	var sProtected;
	sProtected = sOriginal.replace(/[+]/g, "__NM_PLUS__");
	sProtected = sProtected.replace(/[%]/g, "__NM_PERC__");
	return sProtected;
  } // scAjaxSpecCharProtect

  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";
        if (null != scCenterElement)
        {
          scCenterElement(document.getElementById("id_div_process"));
        }
      }
    }
  } // 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;
        }
        if ("sc_b_ini" == sBtnName || "sc_b_ret" == sBtnName || "sc_b_avc" == sBtnName || "sc_b_fim" == sBtnName)
        {
          scAjaxNavigateButtonDisplay(sBtnName, oResp["buttonDisplay"][iDisplay][1]);
        }
        else
        {
          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 scAjaxNavigateButtonDisplay(sButton, sStatus)
  {
    sButton2 = sButton + "_off";

    if ("off" == sStatus)
    {
      sStatus2 = "off";
    }
    else
    {
      if ("sc_b_ini" == sButton || "sc_b_ret" == sButton)
      {
        if ("S" == Nav_permite_ret)
        {
          sStatus  = "on";
          sStatus2 = "off";
        }
        else
        {
          sStatus  = "off";
          sStatus2 = "on";
        }
      }
      else
      {
        if ("S" == Nav_permite_ava)
        {
          sStatus  = "on";
          sStatus2 = "off";
        }
        else
        {
          sStatus  = "off";
          sStatus2 = "on";
        }
      }
    }

    scAjaxElementDisplay(sButton        , sStatus);
    scAjaxElementDisplay(sButton + "_t" , sStatus);
    scAjaxElementDisplay(sButton + "_b" , sStatus);
    scAjaxElementDisplay(sButton2       , sStatus2);
    scAjaxElementDisplay(sButton2 + "_t", sStatus2);
    scAjaxElementDisplay(sButton2 + "_b", sStatus2);
  } // scAjaxNavigateButtonDisplay

  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)
  {
    if(tinymce.majorVersion > 3)
	{
		var oFormField = tinyMCE.get(sFieldName);
	}
	else
	{
		var oFormField = tinyMCE.getInstanceById(sFieldName);
	}
    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 intnumber
  function do_ajax_calendar_wastetransactions_validate_intnumber()
  {
    var nomeCampo_intnumber = "intnumber";
    var var_intnumber = scAjaxGetFieldText(nomeCampo_intnumber);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_intnumber(var_intnumber, var_script_case_init, do_ajax_calendar_wastetransactions_validate_intnumber_cb);
  } // do_ajax_calendar_wastetransactions_validate_intnumber

  function do_ajax_calendar_wastetransactions_validate_intnumber_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "intnumber";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_intnumber_cb

  // ---------- Validate wtrequestdate
  function do_ajax_calendar_wastetransactions_validate_wtrequestdate()
  {
    var nomeCampo_wtrequestdate = "wtrequestdate";
    var var_wtrequestdate = scAjaxGetFieldText(nomeCampo_wtrequestdate);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtrequestdate(var_wtrequestdate, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtrequestdate_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtrequestdate

  function do_ajax_calendar_wastetransactions_validate_wtrequestdate_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtrequestdate";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtrequestdate_cb

  // ---------- Validate wtproducerbranchid
  function do_ajax_calendar_wastetransactions_validate_wtproducerbranchid()
  {
    var nomeCampo_wtproducerbranchid = "wtproducerbranchid";
    var var_wtproducerbranchid = scAjaxGetFieldSelect(nomeCampo_wtproducerbranchid);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproducerbranchid(var_wtproducerbranchid, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproducerbranchid_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproducerbranchid

  function do_ajax_calendar_wastetransactions_validate_wtproducerbranchid_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerbranchid";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproducerbranchid_cb

  // ---------- Validate wtproducerperiferia
  function do_ajax_calendar_wastetransactions_validate_wtproducerperiferia()
  {
    var nomeCampo_wtproducerperiferia = "wtproducerperiferia";
    var var_wtproducerperiferia = scAjaxGetFieldSelect(nomeCampo_wtproducerperiferia);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproducerperiferia(var_wtproducerperiferia, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproducerperiferia_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproducerperiferia

  function do_ajax_calendar_wastetransactions_validate_wtproducerperiferia_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerperiferia";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproducerperiferia_cb

  // ---------- Validate producerb_address
  function do_ajax_calendar_wastetransactions_validate_producerb_address()
  {
    var nomeCampo_producerb_address = "producerb_address";
    var var_producerb_address = scAjaxGetFieldText(nomeCampo_producerb_address);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_producerb_address(var_producerb_address, var_script_case_init, do_ajax_calendar_wastetransactions_validate_producerb_address_cb);
  } // do_ajax_calendar_wastetransactions_validate_producerb_address

  function do_ajax_calendar_wastetransactions_validate_producerb_address_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "producerb_address";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_producerb_address_cb

  // ---------- Validate prbrresponse
  function do_ajax_calendar_wastetransactions_validate_prbrresponse()
  {
    var nomeCampo_prbrresponse = "prbrresponse";
    var var_prbrresponse = scAjaxGetFieldText(nomeCampo_prbrresponse);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_prbrresponse(var_prbrresponse, var_script_case_init, do_ajax_calendar_wastetransactions_validate_prbrresponse_cb);
  } // do_ajax_calendar_wastetransactions_validate_prbrresponse

  function do_ajax_calendar_wastetransactions_validate_prbrresponse_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "prbrresponse";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_prbrresponse_cb

  // ---------- Validate pphone
  function do_ajax_calendar_wastetransactions_validate_pphone()
  {
    var nomeCampo_pphone = "pphone";
    var var_pphone = scAjaxGetFieldText(nomeCampo_pphone);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_pphone(var_pphone, var_script_case_init, do_ajax_calendar_wastetransactions_validate_pphone_cb);
  } // do_ajax_calendar_wastetransactions_validate_pphone

  function do_ajax_calendar_wastetransactions_validate_pphone_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "pphone";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_pphone_cb

  // ---------- Validate premail
  function do_ajax_calendar_wastetransactions_validate_premail()
  {
    var nomeCampo_premail = "premail";
    var var_premail = scAjaxGetFieldText(nomeCampo_premail);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_premail(var_premail, var_script_case_init, do_ajax_calendar_wastetransactions_validate_premail_cb);
  } // do_ajax_calendar_wastetransactions_validate_premail

  function do_ajax_calendar_wastetransactions_validate_premail_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "premail";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_premail_cb

  // ---------- Validate wtproducerewc
  function do_ajax_calendar_wastetransactions_validate_wtproducerewc()
  {
    var nomeCampo_wtproducerewc = "wtproducerewc";
    var var_wtproducerewc = scAjaxGetFieldSelect(nomeCampo_wtproducerewc);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproducerewc(var_wtproducerewc, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproducerewc_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproducerewc

  function do_ajax_calendar_wastetransactions_validate_wtproducerewc_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerewc";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproducerewc_cb

  // ---------- Validate ewctitle
  function do_ajax_calendar_wastetransactions_validate_ewctitle()
  {
    var nomeCampo_ewctitle = "ewctitle";
    var var_ewctitle = scAjaxGetFieldText(nomeCampo_ewctitle);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_ewctitle(var_ewctitle, var_script_case_init, do_ajax_calendar_wastetransactions_validate_ewctitle_cb);
  } // do_ajax_calendar_wastetransactions_validate_ewctitle

  function do_ajax_calendar_wastetransactions_validate_ewctitle_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "ewctitle";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_ewctitle_cb

  // ---------- Validate wtproduceracceptweigth
  function do_ajax_calendar_wastetransactions_validate_wtproduceracceptweigth()
  {
    var nomeCampo_wtproduceracceptweigth = "wtproduceracceptweigth";
    var var_wtproduceracceptweigth = scAjaxGetFieldCheckbox(nomeCampo_wtproduceracceptweigth, ";");
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproduceracceptweigth(var_wtproduceracceptweigth, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproduceracceptweigth_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproduceracceptweigth

  function do_ajax_calendar_wastetransactions_validate_wtproduceracceptweigth_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproduceracceptweigth";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproduceracceptweigth_cb

  // ---------- Validate wtproducerqty
  function do_ajax_calendar_wastetransactions_validate_wtproducerqty()
  {
    var nomeCampo_wtproducerqty = "wtproducerqty";
    var var_wtproducerqty = scAjaxGetFieldText(nomeCampo_wtproducerqty);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproducerqty(var_wtproducerqty, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproducerqty_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproducerqty

  function do_ajax_calendar_wastetransactions_validate_wtproducerqty_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerqty";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproducerqty_cb

  // ---------- Validate wtprducerm3
  function do_ajax_calendar_wastetransactions_validate_wtprducerm3()
  {
    var nomeCampo_wtprducerm3 = "wtprducerm3";
    var var_wtprducerm3 = scAjaxGetFieldText(nomeCampo_wtprducerm3);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtprducerm3(var_wtprducerm3, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtprducerm3_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtprducerm3

  function do_ajax_calendar_wastetransactions_validate_wtprducerm3_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtprducerm3";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtprducerm3_cb

  // ---------- Validate wttransporterid
  function do_ajax_calendar_wastetransactions_validate_wttransporterid()
  {
    var nomeCampo_wttransporterid = "wttransporterid";
    var var_wttransporterid = scAjaxGetFieldSelect(nomeCampo_wttransporterid);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wttransporterid(var_wttransporterid, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wttransporterid_cb);
  } // do_ajax_calendar_wastetransactions_validate_wttransporterid

  function do_ajax_calendar_wastetransactions_validate_wttransporterid_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wttransporterid";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wttransporterid_cb

  // ---------- Validate wttransportdate
  function do_ajax_calendar_wastetransactions_validate_wttransportdate()
  {
    var nomeCampo_wttransportdate = "wttransportdate";
    var var_wttransportdate = scAjaxGetFieldText(nomeCampo_wttransportdate);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wttransportdate(var_wttransportdate, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wttransportdate_cb);
  } // do_ajax_calendar_wastetransactions_validate_wttransportdate

  function do_ajax_calendar_wastetransactions_validate_wttransportdate_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wttransportdate";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wttransportdate_cb

  // ---------- Validate wttransporternumberid
  function do_ajax_calendar_wastetransactions_validate_wttransporternumberid()
  {
    var nomeCampo_wttransporternumberid = "wttransporternumberid";
    var var_wttransporternumberid = scAjaxGetFieldText(nomeCampo_wttransporternumberid);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wttransporternumberid(var_wttransporternumberid, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wttransporternumberid_cb);
  } // do_ajax_calendar_wastetransactions_validate_wttransporternumberid

  function do_ajax_calendar_wastetransactions_validate_wttransporternumberid_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wttransporternumberid";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wttransporternumberid_cb

  // ---------- Validate wttransportervechicle
  function do_ajax_calendar_wastetransactions_validate_wttransportervechicle()
  {
    var nomeCampo_wttransportervechicle = "wttransportervechicle";
    var var_wttransportervechicle = scAjaxGetFieldText(nomeCampo_wttransportervechicle);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wttransportervechicle(var_wttransportervechicle, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wttransportervechicle_cb);
  } // do_ajax_calendar_wastetransactions_validate_wttransportervechicle

  function do_ajax_calendar_wastetransactions_validate_wttransportervechicle_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wttransportervechicle";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wttransportervechicle_cb

  // ---------- Validate envregistrationno_transporter
  function do_ajax_calendar_wastetransactions_validate_envregistrationno_transporter()
  {
    var nomeCampo_envregistrationno_transporter = "envregistrationno_transporter";
    var var_envregistrationno_transporter = scAjaxGetFieldHidden(nomeCampo_envregistrationno_transporter);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_envregistrationno_transporter(var_envregistrationno_transporter, var_script_case_init, do_ajax_calendar_wastetransactions_validate_envregistrationno_transporter_cb);
  } // do_ajax_calendar_wastetransactions_validate_envregistrationno_transporter

  function do_ajax_calendar_wastetransactions_validate_envregistrationno_transporter_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "envregistrationno_transporter";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_envregistrationno_transporter_cb

  // ---------- Validate transporterresponse
  function do_ajax_calendar_wastetransactions_validate_transporterresponse()
  {
    var nomeCampo_transporterresponse = "transporterresponse";
    var var_transporterresponse = scAjaxGetFieldHidden(nomeCampo_transporterresponse);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_transporterresponse(var_transporterresponse, var_script_case_init, do_ajax_calendar_wastetransactions_validate_transporterresponse_cb);
  } // do_ajax_calendar_wastetransactions_validate_transporterresponse

  function do_ajax_calendar_wastetransactions_validate_transporterresponse_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "transporterresponse";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_transporterresponse_cb

  // ---------- Validate transporteremail
  function do_ajax_calendar_wastetransactions_validate_transporteremail()
  {
    var nomeCampo_transporteremail = "transporteremail";
    var var_transporteremail = scAjaxGetFieldHidden(nomeCampo_transporteremail);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_transporteremail(var_transporteremail, var_script_case_init, do_ajax_calendar_wastetransactions_validate_transporteremail_cb);
  } // do_ajax_calendar_wastetransactions_validate_transporteremail

  function do_ajax_calendar_wastetransactions_validate_transporteremail_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "transporteremail";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_transporteremail_cb

  // ---------- Validate transporterphone
  function do_ajax_calendar_wastetransactions_validate_transporterphone()
  {
    var nomeCampo_transporterphone = "transporterphone";
    var var_transporterphone = scAjaxGetFieldHidden(nomeCampo_transporterphone);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_transporterphone(var_transporterphone, var_script_case_init, do_ajax_calendar_wastetransactions_validate_transporterphone_cb);
  } // do_ajax_calendar_wastetransactions_validate_transporterphone

  function do_ajax_calendar_wastetransactions_validate_transporterphone_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "transporterphone";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_transporterphone_cb

  // ---------- Validate checktransvsproducer
  function do_ajax_calendar_wastetransactions_validate_checktransvsproducer()
  {
    var nomeCampo_checktransvsproducer = "checktransvsproducer";
    var var_checktransvsproducer = scAjaxGetFieldHidden(nomeCampo_checktransvsproducer);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_checktransvsproducer(var_checktransvsproducer, var_script_case_init, do_ajax_calendar_wastetransactions_validate_checktransvsproducer_cb);
  } // do_ajax_calendar_wastetransactions_validate_checktransvsproducer

  function do_ajax_calendar_wastetransactions_validate_checktransvsproducer_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "checktransvsproducer";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_checktransvsproducer_cb

  // ---------- Validate checktransportervsfdest
  function do_ajax_calendar_wastetransactions_validate_checktransportervsfdest()
  {
    var nomeCampo_checktransportervsfdest = "checktransportervsfdest";
    var var_checktransportervsfdest = scAjaxGetFieldHidden(nomeCampo_checktransportervsfdest);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_checktransportervsfdest(var_checktransportervsfdest, var_script_case_init, do_ajax_calendar_wastetransactions_validate_checktransportervsfdest_cb);
  } // do_ajax_calendar_wastetransactions_validate_checktransportervsfdest

  function do_ajax_calendar_wastetransactions_validate_checktransportervsfdest_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "checktransportervsfdest";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_checktransportervsfdest_cb

  // ---------- Validate wtwasteid
  function do_ajax_calendar_wastetransactions_validate_wtwasteid()
  {
    var nomeCampo_wtwasteid = "wtwasteid";
    var var_wtwasteid = scAjaxGetFieldSelect(nomeCampo_wtwasteid);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtwasteid(var_wtwasteid, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtwasteid_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtwasteid

  function do_ajax_calendar_wastetransactions_validate_wtwasteid_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtwasteid";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtwasteid_cb

  // ---------- Validate wtequipment
  function do_ajax_calendar_wastetransactions_validate_wtequipment()
  {
    var nomeCampo_wtequipment = "wtequipment";
    var var_wtequipment = scAjaxGetFieldSelect(nomeCampo_wtequipment);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtequipment(var_wtequipment, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtequipment_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtequipment

  function do_ajax_calendar_wastetransactions_validate_wtequipment_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtequipment";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtequipment_cb

  // ---------- Validate wtfdestid
  function do_ajax_calendar_wastetransactions_validate_wtfdestid()
  {
    var nomeCampo_wtfdestid = "wtfdestid";
    var var_wtfdestid = scAjaxGetFieldSelect(nomeCampo_wtfdestid);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestid(var_wtfdestid, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestid_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestid

  function do_ajax_calendar_wastetransactions_validate_wtfdestid_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestid";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestid_cb

  // ---------- Validate wtfdestdate
  function do_ajax_calendar_wastetransactions_validate_wtfdestdate()
  {
    var nomeCampo_wtfdestdate = "wtfdestdate";
    var var_wtfdestdate = scAjaxGetFieldText(nomeCampo_wtfdestdate);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestdate(var_wtfdestdate, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestdate_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestdate

  function do_ajax_calendar_wastetransactions_validate_wtfdestdate_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestdate";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestdate_cb

  // ---------- Validate wtfdestperiferia
  function do_ajax_calendar_wastetransactions_validate_wtfdestperiferia()
  {
    var nomeCampo_wtfdestperiferia = "wtfdestperiferia";
    var var_wtfdestperiferia = scAjaxGetFieldSelect(nomeCampo_wtfdestperiferia);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestperiferia(var_wtfdestperiferia, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestperiferia_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestperiferia

  function do_ajax_calendar_wastetransactions_validate_wtfdestperiferia_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestperiferia";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestperiferia_cb

  // ---------- Validate envregistrationno_fdest
  function do_ajax_calendar_wastetransactions_validate_envregistrationno_fdest()
  {
    var nomeCampo_envregistrationno_fdest = "envregistrationno_fdest";
    var var_envregistrationno_fdest = scAjaxGetFieldHidden(nomeCampo_envregistrationno_fdest);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_envregistrationno_fdest(var_envregistrationno_fdest, var_script_case_init, do_ajax_calendar_wastetransactions_validate_envregistrationno_fdest_cb);
  } // do_ajax_calendar_wastetransactions_validate_envregistrationno_fdest

  function do_ajax_calendar_wastetransactions_validate_envregistrationno_fdest_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "envregistrationno_fdest";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_envregistrationno_fdest_cb

  // ---------- Validate fdestaddress
  function do_ajax_calendar_wastetransactions_validate_fdestaddress()
  {
    var nomeCampo_fdestaddress = "fdestaddress";
    var var_fdestaddress = scAjaxGetFieldHidden(nomeCampo_fdestaddress);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_fdestaddress(var_fdestaddress, var_script_case_init, do_ajax_calendar_wastetransactions_validate_fdestaddress_cb);
  } // do_ajax_calendar_wastetransactions_validate_fdestaddress

  function do_ajax_calendar_wastetransactions_validate_fdestaddress_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "fdestaddress";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_fdestaddress_cb

  // ---------- Validate fdestresponse
  function do_ajax_calendar_wastetransactions_validate_fdestresponse()
  {
    var nomeCampo_fdestresponse = "fdestresponse";
    var var_fdestresponse = scAjaxGetFieldHidden(nomeCampo_fdestresponse);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_fdestresponse(var_fdestresponse, var_script_case_init, do_ajax_calendar_wastetransactions_validate_fdestresponse_cb);
  } // do_ajax_calendar_wastetransactions_validate_fdestresponse

  function do_ajax_calendar_wastetransactions_validate_fdestresponse_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "fdestresponse";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_fdestresponse_cb

  // ---------- Validate fdestphone
  function do_ajax_calendar_wastetransactions_validate_fdestphone()
  {
    var nomeCampo_fdestphone = "fdestphone";
    var var_fdestphone = scAjaxGetFieldHidden(nomeCampo_fdestphone);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_fdestphone(var_fdestphone, var_script_case_init, do_ajax_calendar_wastetransactions_validate_fdestphone_cb);
  } // do_ajax_calendar_wastetransactions_validate_fdestphone

  function do_ajax_calendar_wastetransactions_validate_fdestphone_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "fdestphone";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_fdestphone_cb

  // ---------- Validate fdestresponseemail
  function do_ajax_calendar_wastetransactions_validate_fdestresponseemail()
  {
    var nomeCampo_fdestresponseemail = "fdestresponseemail";
    var var_fdestresponseemail = scAjaxGetFieldHidden(nomeCampo_fdestresponseemail);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_fdestresponseemail(var_fdestresponseemail, var_script_case_init, do_ajax_calendar_wastetransactions_validate_fdestresponseemail_cb);
  } // do_ajax_calendar_wastetransactions_validate_fdestresponseemail

  function do_ajax_calendar_wastetransactions_validate_fdestresponseemail_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "fdestresponseemail";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_fdestresponseemail_cb

  // ---------- Validate wtfdestewc
  function do_ajax_calendar_wastetransactions_validate_wtfdestewc()
  {
    var nomeCampo_wtfdestewc = "wtfdestewc";
    var var_wtfdestewc = scAjaxGetFieldHidden(nomeCampo_wtfdestewc);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestewc(var_wtfdestewc, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestewc_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestewc

  function do_ajax_calendar_wastetransactions_validate_wtfdestewc_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestewc";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestewc_cb

  // ---------- Validate fdestewctitle
  function do_ajax_calendar_wastetransactions_validate_fdestewctitle()
  {
    var nomeCampo_fdestewctitle = "fdestewctitle";
    var var_fdestewctitle = scAjaxGetFieldHidden(nomeCampo_fdestewctitle);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_fdestewctitle(var_fdestewctitle, var_script_case_init, do_ajax_calendar_wastetransactions_validate_fdestewctitle_cb);
  } // do_ajax_calendar_wastetransactions_validate_fdestewctitle

  function do_ajax_calendar_wastetransactions_validate_fdestewctitle_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "fdestewctitle";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_fdestewctitle_cb

  // ---------- Validate wtfdestrd
  function do_ajax_calendar_wastetransactions_validate_wtfdestrd()
  {
    var nomeCampo_wtfdestrd = "wtfdestrd";
    var var_wtfdestrd = scAjaxGetFieldSelect(nomeCampo_wtfdestrd);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestrd(var_wtfdestrd, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestrd_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestrd

  function do_ajax_calendar_wastetransactions_validate_wtfdestrd_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestrd";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestrd_cb

  // ---------- Validate wtfdestqty
  function do_ajax_calendar_wastetransactions_validate_wtfdestqty()
  {
    var nomeCampo_wtfdestqty = "wtfdestqty";
    var var_wtfdestqty = scAjaxGetFieldText(nomeCampo_wtfdestqty);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestqty(var_wtfdestqty, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestqty_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestqty

  function do_ajax_calendar_wastetransactions_validate_wtfdestqty_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestqty";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestqty_cb

  // ---------- Validate wtfdestm3
  function do_ajax_calendar_wastetransactions_validate_wtfdestm3()
  {
    var nomeCampo_wtfdestm3 = "wtfdestm3";
    var var_wtfdestm3 = scAjaxGetFieldText(nomeCampo_wtfdestm3);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtfdestm3(var_wtfdestm3, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtfdestm3_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtfdestm3

  function do_ajax_calendar_wastetransactions_validate_wtfdestm3_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestm3";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtfdestm3_cb

  // ---------- Validate wtproducerremarks
  function do_ajax_calendar_wastetransactions_validate_wtproducerremarks()
  {
    var nomeCampo_wtproducerremarks = "wtproducerremarks";
    var var_wtproducerremarks = scAjaxGetFieldText(nomeCampo_wtproducerremarks);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_wtproducerremarks(var_wtproducerremarks, var_script_case_init, do_ajax_calendar_wastetransactions_validate_wtproducerremarks_cb);
  } // do_ajax_calendar_wastetransactions_validate_wtproducerremarks

  function do_ajax_calendar_wastetransactions_validate_wtproducerremarks_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerremarks";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_wtproducerremarks_cb

  // ---------- Validate ewc_title
  function do_ajax_calendar_wastetransactions_validate_ewc_title()
  {
    var nomeCampo_ewc_title = "ewc_title";
    var var_ewc_title = scAjaxGetFieldHidden(nomeCampo_ewc_title);
    var var_script_case_init = document.F1.script_case_init.value;
    x_ajax_calendar_wastetransactions_validate_ewc_title(var_ewc_title, var_script_case_init, do_ajax_calendar_wastetransactions_validate_ewc_title_cb);
  } // do_ajax_calendar_wastetransactions_validate_ewc_title

  function do_ajax_calendar_wastetransactions_validate_ewc_title_cb(sResp)
  {
    oResp = scAjaxResponse(sResp);
    sFieldValid = "ewc_title";
    scEventControl_onBlur(sFieldValid);
    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_calendar_wastetransactions_validate_ewc_title_cb

  // ---------- Event onchange wtfdestid
  function do_ajax_calendar_wastetransactions_event_wtfdestid_onchange()
  {
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_wtfdestid = scAjaxGetFieldSelect("wtfdestid");
    var var_fdestaddress = scAjaxGetFieldHidden("fdestaddress");
    var var_fdestphone = scAjaxGetFieldHidden("fdestphone");
    var var_fdestresponseemail = scAjaxGetFieldHidden("fdestresponseemail");
    var var_envregistrationno_fdest = scAjaxGetFieldHidden("envregistrationno_fdest");
    var var_fdestewctitle = scAjaxGetFieldHidden("fdestewctitle");
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn(true);
    x_ajax_calendar_wastetransactions_event_wtfdestid_onchange(var_wttransporterid, var_wtfdestperiferia, var_wtfdestewc, var_checktransportervsfdest, var_wtfdestid, var_fdestaddress, var_fdestphone, var_fdestresponseemail, var_envregistrationno_fdest, var_fdestewctitle, var_script_case_init, do_ajax_calendar_wastetransactions_event_wtfdestid_onchange_cb);
  } // do_ajax_calendar_wastetransactions_event_wtfdestid_onchange

  function do_ajax_calendar_wastetransactions_event_wtfdestid_onchange_cb(sResp)
  {
    scAjaxProcOff(true);
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtfdestid";
    scEventControl_onChange(sFieldValid);
    scAjaxUpdateFieldErrors(sFieldValid, "onchange");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
  } // do_ajax_calendar_wastetransactions_event_wtfdestid_onchange_cb

  // ---------- Event onchange wtproduceracceptweigth
  function do_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange()
  {
    var var_wtproduceracceptweigth = scAjaxGetFieldCheckbox("wtproduceracceptweigth", ";");
    var var_wtproducerqty = scAjaxGetFieldText("wtproducerqty");
    var var_wtprducerm3 = scAjaxGetFieldText("wtprducerm3");
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn(true);
    x_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange(var_wtproduceracceptweigth, var_wtproducerqty, var_wtprducerm3, var_wttransporterid, var_wtfdestperiferia, var_wtfdestewc, var_checktransportervsfdest, var_script_case_init, do_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange_cb);
  } // do_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange

  function do_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange_cb(sResp)
  {
    scAjaxProcOff(true);
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproduceracceptweigth";
    scEventControl_onChange(sFieldValid);
    scAjaxUpdateFieldErrors(sFieldValid, "onchange");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
  } // do_ajax_calendar_wastetransactions_event_wtproduceracceptweigth_onchange_cb

  // ---------- Event onchange wtproducerbranchid
  function do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange()
  {
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_wtproducerbranchid = scAjaxGetFieldSelect("wtproducerbranchid");
    var var_producerb_address = scAjaxGetFieldText("producerb_address");
    var var_prbrresponse = scAjaxGetFieldText("prbrresponse");
    var var_pphone = scAjaxGetFieldText("pphone");
    var var_premail = scAjaxGetFieldText("premail");
    var var_wtproducerperiferia = scAjaxGetFieldSelect("wtproducerperiferia");
    var var_wtproducerewc = scAjaxGetFieldSelect("wtproducerewc");
    var var_ewctitle = scAjaxGetFieldText("ewctitle");
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn(true);
    x_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange(var_wttransporterid, var_wtfdestperiferia, var_wtfdestewc, var_checktransportervsfdest, var_wtproducerbranchid, var_producerb_address, var_prbrresponse, var_pphone, var_premail, var_wtproducerperiferia, var_wtproducerewc, var_ewctitle, var_script_case_init, do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange_cb);
  } // do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange

  function do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange_cb(sResp)
  {
    scAjaxProcOff(true);
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerbranchid";
    scEventControl_onChange(sFieldValid);
    scAjaxUpdateFieldErrors(sFieldValid, "onchange");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
  } // do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onchange_cb

  // ---------- Event onclick wtproducerbranchid
  function do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick()
  {
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_wtproducerbranchid = scAjaxGetFieldSelect("wtproducerbranchid");
    var var_producerb_address = scAjaxGetFieldText("producerb_address");
    var var_prbrresponse = scAjaxGetFieldText("prbrresponse");
    var var_pphone = scAjaxGetFieldText("pphone");
    var var_premail = scAjaxGetFieldText("premail");
    var var_wtproducerperiferia = scAjaxGetFieldSelect("wtproducerperiferia");
    var var_wtproducerewc = scAjaxGetFieldSelect("wtproducerewc");
    var var_ewctitle = scAjaxGetFieldText("ewctitle");
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn(true);
    x_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick(var_wttransporterid, var_wtfdestperiferia, var_wtfdestewc, var_checktransportervsfdest, var_wtproducerbranchid, var_producerb_address, var_prbrresponse, var_pphone, var_premail, var_wtproducerperiferia, var_wtproducerewc, var_ewctitle, var_script_case_init, do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick_cb);
  } // do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick

  function do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick_cb(sResp)
  {
    scAjaxProcOff(true);
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wtproducerbranchid";
    scAjaxUpdateFieldErrors(sFieldValid, "onclick");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
  } // do_ajax_calendar_wastetransactions_event_wtproducerbranchid_onclick_cb

  // ---------- Event onchange wttransporterid
  function do_ajax_calendar_wastetransactions_event_wttransporterid_onchange()
  {
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_wtproducerperiferia = scAjaxGetFieldSelect("wtproducerperiferia");
    var var_wtproducerewc = scAjaxGetFieldSelect("wtproducerewc");
    var var_checktransvsproducer = scAjaxGetFieldHidden("checktransvsproducer");
    var var_transporterresponse = scAjaxGetFieldHidden("transporterresponse");
    var var_transporterphone = scAjaxGetFieldHidden("transporterphone");
    var var_transporteremail = scAjaxGetFieldHidden("transporteremail");
    var var_envregistrationno_transporter = scAjaxGetFieldHidden("envregistrationno_transporter");
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn(true);
    x_ajax_calendar_wastetransactions_event_wttransporterid_onchange(var_wttransporterid, var_wtfdestperiferia, var_wtfdestewc, var_checktransportervsfdest, var_wtproducerperiferia, var_wtproducerewc, var_checktransvsproducer, var_transporterresponse, var_transporterphone, var_transporteremail, var_envregistrationno_transporter, var_script_case_init, do_ajax_calendar_wastetransactions_event_wttransporterid_onchange_cb);
  } // do_ajax_calendar_wastetransactions_event_wttransporterid_onchange

  function do_ajax_calendar_wastetransactions_event_wttransporterid_onchange_cb(sResp)
  {
    scAjaxProcOff(true);
    oResp = scAjaxResponse(sResp);
    sFieldValid = "wttransporterid";
    scEventControl_onChange(sFieldValid);
    scAjaxUpdateFieldErrors(sFieldValid, "onchange");
    sFieldErrors = scAjaxListFieldErrors(sFieldValid, false);
    if ("" == sFieldErrors)
    {
      scAjaxHideErrorDisplay(sFieldValid);
    }
    else
    {
      scAjaxShowErrorDisplay(sFieldValid, sFieldErrors);
    }
    if (!scAjaxHasError())
    {
      scAjaxSetFields();
    }
    scAjaxShowDebug();
    scAjaxSetDisplay();
    scAjaxSetLabel();
    scAjaxSetReadonly();
    scAjaxSetMaster();
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
    scAjaxRedir();
  } // do_ajax_calendar_wastetransactions_event_wttransporterid_onchange_cb
  // ---------- Form
  function do_ajax_calendar_wastetransactions_submit_form()
  {
    if (scEventControl_active("")) {
      setTimeout(function() { do_ajax_calendar_wastetransactions_submit_form(); }, 500);
      return;
    }
    scAjaxHideMessage();
    var var_intnumber = scAjaxGetFieldText("intnumber");
    var var_wtrequestdate = scAjaxGetFieldText("wtrequestdate");
    var var_wtproducerbranchid = scAjaxGetFieldSelect("wtproducerbranchid");
    var var_wtproducerperiferia = scAjaxGetFieldSelect("wtproducerperiferia");
    var var_producerb_address = scAjaxGetFieldText("producerb_address");
    var var_prbrresponse = scAjaxGetFieldText("prbrresponse");
    var var_pphone = scAjaxGetFieldText("pphone");
    var var_premail = scAjaxGetFieldText("premail");
    var var_wtproducerewc = scAjaxGetFieldSelect("wtproducerewc");
    var var_ewctitle = scAjaxGetFieldText("ewctitle");
    var var_wtproduceracceptweigth = scAjaxGetFieldCheckbox("wtproduceracceptweigth", ";");
    var var_wtproducerqty = scAjaxGetFieldText("wtproducerqty");
    var var_wtprducerm3 = scAjaxGetFieldText("wtprducerm3");
    var var_wttransporterid = scAjaxGetFieldSelect("wttransporterid");
    var var_wttransportdate = scAjaxGetFieldText("wttransportdate");
    var var_wttransporternumberid = scAjaxGetFieldText("wttransporternumberid");
    var var_wttransportervechicle = scAjaxGetFieldText("wttransportervechicle");
    var var_envregistrationno_transporter = scAjaxGetFieldHidden("envregistrationno_transporter");
    var var_transporterresponse = scAjaxGetFieldHidden("transporterresponse");
    var var_transporteremail = scAjaxGetFieldHidden("transporteremail");
    var var_transporterphone = scAjaxGetFieldHidden("transporterphone");
    var var_checktransvsproducer = scAjaxGetFieldHidden("checktransvsproducer");
    var var_checktransportervsfdest = scAjaxGetFieldHidden("checktransportervsfdest");
    var var_wtwasteid = scAjaxGetFieldSelect("wtwasteid");
    var var_wtequipment = scAjaxGetFieldSelect("wtequipment");
    var var_wtfdestid = scAjaxGetFieldSelect("wtfdestid");
    var var_wtfdestdate = scAjaxGetFieldText("wtfdestdate");
    var var_wtfdestperiferia = scAjaxGetFieldSelect("wtfdestperiferia");
    var var_envregistrationno_fdest = scAjaxGetFieldHidden("envregistrationno_fdest");
    var var_fdestaddress = scAjaxGetFieldHidden("fdestaddress");
    var var_fdestresponse = scAjaxGetFieldHidden("fdestresponse");
    var var_fdestphone = scAjaxGetFieldHidden("fdestphone");
    var var_fdestresponseemail = scAjaxGetFieldHidden("fdestresponseemail");
    var var_wtfdestewc = scAjaxGetFieldHidden("wtfdestewc");
    var var_fdestewctitle = scAjaxGetFieldHidden("fdestewctitle");
    var var_wtfdestrd = scAjaxGetFieldSelect("wtfdestrd");
    var var_wtfdestqty = scAjaxGetFieldText("wtfdestqty");
    var var_wtfdestm3 = scAjaxGetFieldText("wtfdestm3");
    var var_wtproducerremarks = scAjaxGetFieldText("wtproducerremarks");
    var var_ewc_title = scAjaxGetFieldHidden("ewc_title");
    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_calendar_wastetransactions_submit_form(var_intnumber, var_wtrequestdate, var_wtproducerbranchid, var_wtproducerperiferia, var_producerb_address, var_prbrresponse, var_pphone, var_premail, var_wtproducerewc, var_ewctitle, var_wtproduceracceptweigth, var_wtproducerqty, var_wtprducerm3, var_wttransporterid, var_wttransportdate, var_wttransporternumberid, var_wttransportervechicle, var_envregistrationno_transporter, var_transporterresponse, var_transporteremail, var_transporterphone, var_checktransvsproducer, var_checktransportervsfdest, var_wtwasteid, var_wtequipment, var_wtfdestid, var_wtfdestdate, var_wtfdestperiferia, var_envregistrationno_fdest, var_fdestaddress, var_fdestresponse, var_fdestphone, var_fdestresponseemail, var_wtfdestewc, var_fdestewctitle, var_wtfdestrd, var_wtfdestqty, var_wtfdestm3, var_wtproducerremarks, var_ewc_title, 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_calendar_wastetransactions_submit_form_cb);
  } // do_ajax_calendar_wastetransactions_submit_form

  function do_ajax_calendar_wastetransactions_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("intnumber");
      scAjaxHideErrorDisplay("wtrequestdate");
      scAjaxHideErrorDisplay("wtproducerbranchid");
      scAjaxHideErrorDisplay("wtproducerperiferia");
      scAjaxHideErrorDisplay("producerb_address");
      scAjaxHideErrorDisplay("prbrresponse");
      scAjaxHideErrorDisplay("pphone");
      scAjaxHideErrorDisplay("premail");
      scAjaxHideErrorDisplay("wtproducerewc");
      scAjaxHideErrorDisplay("ewctitle");
      scAjaxHideErrorDisplay("wtproduceracceptweigth");
      scAjaxHideErrorDisplay("wtproducerqty");
      scAjaxHideErrorDisplay("wtprducerm3");
      scAjaxHideErrorDisplay("wttransporterid");
      scAjaxHideErrorDisplay("wttransportdate");
      scAjaxHideErrorDisplay("wttransporternumberid");
      scAjaxHideErrorDisplay("wttransportervechicle");
      scAjaxHideErrorDisplay("envregistrationno_transporter");
      scAjaxHideErrorDisplay("transporterresponse");
      scAjaxHideErrorDisplay("transporteremail");
      scAjaxHideErrorDisplay("transporterphone");
      scAjaxHideErrorDisplay("checktransvsproducer");
      scAjaxHideErrorDisplay("checktransportervsfdest");
      scAjaxHideErrorDisplay("wtwasteid");
      scAjaxHideErrorDisplay("wtequipment");
      scAjaxHideErrorDisplay("wtfdestid");
      scAjaxHideErrorDisplay("wtfdestdate");
      scAjaxHideErrorDisplay("wtfdestperiferia");
      scAjaxHideErrorDisplay("envregistrationno_fdest");
      scAjaxHideErrorDisplay("fdestaddress");
      scAjaxHideErrorDisplay("fdestresponse");
      scAjaxHideErrorDisplay("fdestphone");
      scAjaxHideErrorDisplay("fdestresponseemail");
      scAjaxHideErrorDisplay("wtfdestewc");
      scAjaxHideErrorDisplay("fdestewctitle");
      scAjaxHideErrorDisplay("wtfdestrd");
      scAjaxHideErrorDisplay("wtfdestqty");
      scAjaxHideErrorDisplay("wtfdestm3");
      scAjaxHideErrorDisplay("wtproducerremarks");
      scAjaxHideErrorDisplay("ewc_title");
      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_calendar_wastetransactions_submit_form_cb

  var scStatusDetail = {};

  function do_ajax_calendar_wastetransactions_navigate_form()
  {
    if (scRefreshTable())
    {
      return;
    }
    scAjaxHideMessage();
    scAjaxHideErrorDisplay("table");
    scAjaxHideErrorDisplay("intnumber");
    scAjaxHideErrorDisplay("wtrequestdate");
    scAjaxHideErrorDisplay("wtproducerbranchid");
    scAjaxHideErrorDisplay("wtproducerperiferia");
    scAjaxHideErrorDisplay("producerb_address");
    scAjaxHideErrorDisplay("prbrresponse");
    scAjaxHideErrorDisplay("pphone");
    scAjaxHideErrorDisplay("premail");
    scAjaxHideErrorDisplay("wtproducerewc");
    scAjaxHideErrorDisplay("ewctitle");
    scAjaxHideErrorDisplay("wtproduceracceptweigth");
    scAjaxHideErrorDisplay("wtproducerqty");
    scAjaxHideErrorDisplay("wtprducerm3");
    scAjaxHideErrorDisplay("wttransporterid");
    scAjaxHideErrorDisplay("wttransportdate");
    scAjaxHideErrorDisplay("wttransporternumberid");
    scAjaxHideErrorDisplay("wttransportervechicle");
    scAjaxHideErrorDisplay("envregistrationno_transporter");
    scAjaxHideErrorDisplay("transporterresponse");
    scAjaxHideErrorDisplay("transporteremail");
    scAjaxHideErrorDisplay("transporterphone");
    scAjaxHideErrorDisplay("checktransvsproducer");
    scAjaxHideErrorDisplay("checktransportervsfdest");
    scAjaxHideErrorDisplay("wtwasteid");
    scAjaxHideErrorDisplay("wtequipment");
    scAjaxHideErrorDisplay("wtfdestid");
    scAjaxHideErrorDisplay("wtfdestdate");
    scAjaxHideErrorDisplay("wtfdestperiferia");
    scAjaxHideErrorDisplay("envregistrationno_fdest");
    scAjaxHideErrorDisplay("fdestaddress");
    scAjaxHideErrorDisplay("fdestresponse");
    scAjaxHideErrorDisplay("fdestphone");
    scAjaxHideErrorDisplay("fdestresponseemail");
    scAjaxHideErrorDisplay("wtfdestewc");
    scAjaxHideErrorDisplay("fdestewctitle");
    scAjaxHideErrorDisplay("wtfdestrd");
    scAjaxHideErrorDisplay("wtfdestqty");
    scAjaxHideErrorDisplay("wtfdestm3");
    scAjaxHideErrorDisplay("wtproducerremarks");
    scAjaxHideErrorDisplay("ewc_title");
    var var_wtid = document.F2.wtid.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_arg_dyn_search = document.F2.nmgp_arg_dyn_search.value;
    var var_script_case_init = document.F2.script_case_init.value;
    scAjaxProcOn();
    x_ajax_calendar_wastetransactions_navigate_form(var_wtid, var_nm_form_submit, var_nmgp_opcao, var_nmgp_ordem, var_nmgp_arg_dyn_search, var_script_case_init, do_ajax_calendar_wastetransactions_navigate_form_cb);
  } // do_ajax_calendar_wastetransactions_navigate_form

  function do_ajax_calendar_wastetransactions_navigate_form_cb(sResp)
  {
    scAjaxProcOff();
    oResp = scAjaxResponse(sResp);
    if (oResp['empty_filter'] && oResp['empty_filter'] == "ok")
    {
        document.F5.nmgp_opcao.value = "inicio";
        document.F5.nmgp_parms.value = "";
        document.F5.submit();
    }
    sc_mupload_ok = true;
    scAjaxSetFields();
    document.F2.wtid.value = scAjaxGetKeyValue("wtid");
    scAjaxShowDebug();
    scAjaxSetLabel(true);
    scAjaxSetReadonly(true);
    scAjaxSetMaster();
    scAjaxSetNavStatus("b");
    scAjaxSetDisplay(true);
    scAjaxSetBtnVars();
    sc_change_tabs(true, 'hidden_bloco_0', 'id_tabs_0_0');
    sc_change_tabs(false, 'hidden_bloco_1', 'id_tabs_0_1');
    sc_change_tabs(false, 'hidden_bloco_2', 'id_tabs_0_2');
    sc_change_tabs(false, 'hidden_bloco_3', 'id_tabs_0_3');
    $('.sc-js-ui-statusimg').css('display', 'none');
    scAjaxAlert();
    scAjaxMessage();
    scAjaxJavascript();
    scAjaxSetFocus();
<?php
if ($this->Embutida_form)
{
?>
    do_ajax_calendar_wastetransactions_restore_buttons();
<?php
}
?>
    if (hasJsFormOnload)
    {
      sc_form_onload();
    }
  } // do_ajax_calendar_wastetransactions_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] = "intnumber";
  ajax_field_list[1] = "wtrequestdate";
  ajax_field_list[2] = "wtproducerbranchid";
  ajax_field_list[3] = "wtproducerperiferia";
  ajax_field_list[4] = "producerb_address";
  ajax_field_list[5] = "prbrresponse";
  ajax_field_list[6] = "pphone";
  ajax_field_list[7] = "premail";
  ajax_field_list[8] = "wtproducerewc";
  ajax_field_list[9] = "ewctitle";
  ajax_field_list[10] = "wtproduceracceptweigth";
  ajax_field_list[11] = "wtproducerqty";
  ajax_field_list[12] = "wtprducerm3";
  ajax_field_list[13] = "wttransporterid";
  ajax_field_list[14] = "wttransportdate";
  ajax_field_list[15] = "wttransporternumberid";
  ajax_field_list[16] = "wttransportervechicle";
  ajax_field_list[17] = "envregistrationno_transporter";
  ajax_field_list[18] = "transporterresponse";
  ajax_field_list[19] = "transporteremail";
  ajax_field_list[20] = "transporterphone";
  ajax_field_list[21] = "checktransvsproducer";
  ajax_field_list[22] = "checktransportervsfdest";
  ajax_field_list[23] = "wtwasteid";
  ajax_field_list[24] = "wtequipment";
  ajax_field_list[25] = "wtfdestid";
  ajax_field_list[26] = "wtfdestdate";
  ajax_field_list[27] = "wtfdestperiferia";
  ajax_field_list[28] = "envregistrationno_fdest";
  ajax_field_list[29] = "fdestaddress";
  ajax_field_list[30] = "fdestresponse";
  ajax_field_list[31] = "fdestphone";
  ajax_field_list[32] = "fdestresponseemail";
  ajax_field_list[33] = "wtfdestewc";
  ajax_field_list[34] = "fdestewctitle";
  ajax_field_list[35] = "wtfdestrd";
  ajax_field_list[36] = "wtfdestqty";
  ajax_field_list[37] = "wtfdestm3";
  ajax_field_list[38] = "wtproducerremarks";
  ajax_field_list[39] = "ewc_title";

  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";

  var ajax_error_list = {
    "intnumber": {"label": "Αρ.Εντύπου αναγνώρισης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtrequestdate": {"label": "Ημερομηνία αιτήματος", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproducerbranchid": {"label": "Εγκατάσταση παραγωγου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproducerperiferia": {"label": "Περιφέρεια εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "producerb_address": {"label": "Διεύθυνση εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "prbrresponse": {"label": "Υπεύθυνος εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "pphone": {"label": "Τηλέφωνο", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "premail": {"label": "Email", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproducerewc": {"label": "Κωδικός  αποβλήτου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "ewctitle": {"label": "Περιγραφή αποβλήτου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproduceracceptweigth": {"label": "", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproducerqty": {"label": "Ποσότητα Παραγωγού", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtprducerm3": {"label": "Μ3", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wttransporterid": {"label": "Επωνυμία Μεταφορέα", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wttransportdate": {"label": "Ημερομηνία μεταφοράς", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wttransporternumberid": {"label": "Αριθμός εντολής", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wttransportervechicle": {"label": "Οχημα μεταφοράς", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "envregistrationno_transporter": {"label": "Αρ.Μητρώου ΥΠΕΚΑ", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "transporterresponse": {"label": "Υπεύθυνος μεταφορέα", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "transporteremail": {"label": "Email", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "transporterphone": {"label": "Τηλέφωνο", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "checktransvsproducer": {"label": "Ελενχος ΕΚΑ απο τον παραγωγό", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "checktransportervsfdest": {"label": "Ελενχος ΕΚΑ προς τελικό αποδέκτη", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtwasteid": {"label": "Κατάσταση φορτίου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtequipment": {"label": "Τύπος εξοπλισμού", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestid": {"label": "Επωνυμία αποδέκτη", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestdate": {"label": "Ημερομηνία παραλαβής", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestperiferia": {"label": "Περιφέρεια εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "envregistrationno_fdest": {"label": "Env Registration No F Dest", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "fdestaddress": {"label": "Διεύθυνση εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "fdestresponse": {"label": "Υπεύθυνος εγκατάστασης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "fdestphone": {"label": "Τηλέφωνο", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "fdestresponseemail": {"label": "Email", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestewc": {"label": "ΕΚΑ Αποβλήτου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "fdestewctitle": {"label": "Περιγραφή αποβλήτου", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestrd": {"label": "Κωδικός αξιοποίησης", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestqty": {"label": "Βάρος Αποδέκτη", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtfdestm3": {"label": "Κυβικά", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "wtproducerremarks": {"label": "Σχόλια", "valid": new Array(), "onblur": new Array(), "onchange": new Array(), "onclick": new Array(), "onfocus": new Array(), "timeout": 5},
    "ewc_title": {"label": "Απόβλητο", "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"
  };

  var ajax_block_tab = {
    "hidden_bloco_0": "id_tabs_0_0",
    "hidden_bloco_1": "id_tabs_0_1",
    "hidden_bloco_2": "id_tabs_0_2",
    "hidden_bloco_3": "id_tabs_0_3"
  };

  var ajax_field_mult = {
    "intnumber": new Array(),
    "wtrequestdate": new Array(),
    "wtproducerbranchid": new Array(),
    "wtproducerperiferia": new Array(),
    "producerb_address": new Array(),
    "prbrresponse": new Array(),
    "pphone": new Array(),
    "premail": new Array(),
    "wtproducerewc": new Array(),
    "ewctitle": new Array(),
    "wtproduceracceptweigth": new Array(),
    "wtproducerqty": new Array(),
    "wtprducerm3": new Array(),
    "wttransporterid": new Array(),
    "wttransportdate": new Array(),
    "wttransporternumberid": new Array(),
    "wttransportervechicle": new Array(),
    "envregistrationno_transporter": new Array(),
    "transporterresponse": new Array(),
    "transporteremail": new Array(),
    "transporterphone": new Array(),
    "checktransvsproducer": new Array(),
    "checktransportervsfdest": new Array(),
    "wtwasteid": new Array(),
    "wtequipment": new Array(),
    "wtfdestid": new Array(),
    "wtfdestdate": new Array(),
    "wtfdestperiferia": new Array(),
    "envregistrationno_fdest": new Array(),
    "fdestaddress": new Array(),
    "fdestresponse": new Array(),
    "fdestphone": new Array(),
    "fdestresponseemail": new Array(),
    "wtfdestewc": new Array(),
    "fdestewctitle": new Array(),
    "wtfdestrd": new Array(),
    "wtfdestqty": new Array(),
    "wtfdestm3": new Array(),
    "wtproducerremarks": new Array(),
    "ewc_title": new Array()
  };
  ajax_field_mult["intnumber"][1] = "intnumber";
  ajax_field_mult["wtrequestdate"][1] = "wtrequestdate";
  ajax_field_mult["wtproducerbranchid"][1] = "wtproducerbranchid";
  ajax_field_mult["wtproducerperiferia"][1] = "wtproducerperiferia";
  ajax_field_mult["producerb_address"][1] = "producerb_address";
  ajax_field_mult["prbrresponse"][1] = "prbrresponse";
  ajax_field_mult["pphone"][1] = "pphone";
  ajax_field_mult["premail"][1] = "premail";
  ajax_field_mult["wtproducerewc"][1] = "wtproducerewc";
  ajax_field_mult["ewctitle"][1] = "ewctitle";
  ajax_field_mult["wtproduceracceptweigth"][1] = "wtproduceracceptweigth";
  ajax_field_mult["wtproducerqty"][1] = "wtproducerqty";
  ajax_field_mult["wtprducerm3"][1] = "wtprducerm3";
  ajax_field_mult["wttransporterid"][1] = "wttransporterid";
  ajax_field_mult["wttransportdate"][1] = "wttransportdate";
  ajax_field_mult["wttransporternumberid"][1] = "wttransporternumberid";
  ajax_field_mult["wttransportervechicle"][1] = "wttransportervechicle";
  ajax_field_mult["envregistrationno_transporter"][1] = "envregistrationno_transporter";
  ajax_field_mult["transporterresponse"][1] = "transporterresponse";
  ajax_field_mult["transporteremail"][1] = "transporteremail";
  ajax_field_mult["transporterphone"][1] = "transporterphone";
  ajax_field_mult["checktransvsproducer"][1] = "checktransvsproducer";
  ajax_field_mult["checktransportervsfdest"][1] = "checktransportervsfdest";
  ajax_field_mult["wtwasteid"][1] = "wtwasteid";
  ajax_field_mult["wtequipment"][1] = "wtequipment";
  ajax_field_mult["wtfdestid"][1] = "wtfdestid";
  ajax_field_mult["wtfdestdate"][1] = "wtfdestdate";
  ajax_field_mult["wtfdestperiferia"][1] = "wtfdestperiferia";
  ajax_field_mult["envregistrationno_fdest"][1] = "envregistrationno_fdest";
  ajax_field_mult["fdestaddress"][1] = "fdestaddress";
  ajax_field_mult["fdestresponse"][1] = "fdestresponse";
  ajax_field_mult["fdestphone"][1] = "fdestphone";
  ajax_field_mult["fdestresponseemail"][1] = "fdestresponseemail";
  ajax_field_mult["wtfdestewc"][1] = "wtfdestewc";
  ajax_field_mult["fdestewctitle"][1] = "fdestewctitle";
  ajax_field_mult["wtfdestrd"][1] = "wtfdestrd";
  ajax_field_mult["wtfdestqty"][1] = "wtfdestqty";
  ajax_field_mult["wtfdestm3"][1] = "wtfdestm3";
  ajax_field_mult["wtproducerremarks"][1] = "wtproducerremarks";
  ajax_field_mult["ewc_title"][1] = "ewc_title";

  var ajax_field_id = {
    "intnumber": new Array("hidden_field_label_intnumber", "hidden_field_data_intnumber"),
    "wtrequestdate": new Array("hidden_field_label_wtrequestdate", "hidden_field_data_wtrequestdate"),
    "wtproducerbranchid": new Array("hidden_field_label_wtproducerbranchid", "hidden_field_data_wtproducerbranchid"),
    "wtproducerperiferia": new Array("hidden_field_label_wtproducerperiferia", "hidden_field_data_wtproducerperiferia"),
    "producerb_address": new Array("hidden_field_label_producerb_address", "hidden_field_data_producerb_address"),
    "prbrresponse": new Array("hidden_field_label_prbrresponse", "hidden_field_data_prbrresponse"),
    "pphone": new Array("hidden_field_label_pphone", "hidden_field_data_pphone"),
    "premail": new Array("hidden_field_label_premail", "hidden_field_data_premail"),
    "wtproducerewc": new Array("hidden_field_label_wtproducerewc", "hidden_field_data_wtproducerewc"),
    "ewctitle": new Array("hidden_field_label_ewctitle", "hidden_field_data_ewctitle"),
    "wtproduceracceptweigth": new Array("hidden_field_label_wtproduceracceptweigth", "hidden_field_data_wtproduceracceptweigth"),
    "wtproducerqty": new Array("hidden_field_label_wtproducerqty", "hidden_field_data_wtproducerqty"),
    "wtprducerm3": new Array("hidden_field_label_wtprducerm3", "hidden_field_data_wtprducerm3"),
    "wttransporterid": new Array("hidden_field_label_wttransporterid", "hidden_field_data_wttransporterid"),
    "wttransportdate": new Array("hidden_field_label_wttransportdate", "hidden_field_data_wttransportdate"),
    "wttransporternumberid": new Array("hidden_field_label_wttransporternumberid", "hidden_field_data_wttransporternumberid"),
    "wttransportervechicle": new Array("hidden_field_label_wttransportervechicle", "hidden_field_data_wttransportervechicle"),
    "envregistrationno_transporter": new Array("hidden_field_label_envregistrationno_transporter", "hidden_field_data_envregistrationno_transporter"),
    "transporterresponse": new Array("hidden_field_label_transporterresponse", "hidden_field_data_transporterresponse"),
    "transporteremail": new Array("hidden_field_label_transporteremail", "hidden_field_data_transporteremail"),
    "transporterphone": new Array("hidden_field_label_transporterphone", "hidden_field_data_transporterphone"),
    "checktransvsproducer": new Array("hidden_field_label_checktransvsproducer", "hidden_field_data_checktransvsproducer"),
    "checktransportervsfdest": new Array("hidden_field_label_checktransportervsfdest", "hidden_field_data_checktransportervsfdest"),
    "wtwasteid": new Array("hidden_field_label_wtwasteid", "hidden_field_data_wtwasteid"),
    "wtequipment": new Array("hidden_field_label_wtequipment", "hidden_field_data_wtequipment"),
    "wtfdestid": new Array("hidden_field_label_wtfdestid", "hidden_field_data_wtfdestid"),
    "wtfdestdate": new Array("hidden_field_label_wtfdestdate", "hidden_field_data_wtfdestdate"),
    "wtfdestperiferia": new Array("hidden_field_label_wtfdestperiferia", "hidden_field_data_wtfdestperiferia"),
    "envregistrationno_fdest": new Array("hidden_field_label_envregistrationno_fdest", "hidden_field_data_envregistrationno_fdest"),
    "fdestaddress": new Array("hidden_field_label_fdestaddress", "hidden_field_data_fdestaddress"),
    "fdestresponse": new Array("hidden_field_label_fdestresponse", "hidden_field_data_fdestresponse"),
    "fdestphone": new Array("hidden_field_label_fdestphone", "hidden_field_data_fdestphone"),
    "fdestresponseemail": new Array("hidden_field_label_fdestresponseemail", "hidden_field_data_fdestresponseemail"),
    "wtfdestewc": new Array("hidden_field_label_wtfdestewc", "hidden_field_data_wtfdestewc"),
    "fdestewctitle": new Array("hidden_field_label_fdestewctitle", "hidden_field_data_fdestewctitle"),
    "wtfdestrd": new Array("hidden_field_label_wtfdestrd", "hidden_field_data_wtfdestrd"),
    "wtfdestqty": new Array("hidden_field_label_wtfdestqty", "hidden_field_data_wtfdestqty"),
    "wtfdestm3": new Array("hidden_field_label_wtfdestm3", "hidden_field_data_wtfdestm3"),
    "wtproducerremarks": new Array("hidden_field_label_wtproducerremarks", "hidden_field_data_wtproducerremarks"),
    "ewc_title": new Array("hidden_field_label_ewc_title", "hidden_field_data_ewc_title")
  };

  var ajax_read_only = {
    "intnumber": "on",
    "wtrequestdate": "off",
    "wtproducerbranchid": "off",
    "wtproducerperiferia": "off",
    "producerb_address": "on",
    "prbrresponse": "on",
    "pphone": "on",
    "premail": "on",
    "wtproducerewc": "off",
    "ewctitle": "on",
    "wtproduceracceptweigth": "off",
    "wtproducerqty": "off",
    "wtprducerm3": "off",
    "wttransporterid": "off",
    "wttransportdate": "off",
    "wttransporternumberid": "off",
    "wttransportervechicle": "off",
    "envregistrationno_transporter": "off",
    "transporterresponse": "off",
    "transporteremail": "off",
    "transporterphone": "off",
    "checktransvsproducer": "off",
    "checktransportervsfdest": "off",
    "wtwasteid": "off",
    "wtequipment": "off",
    "wtfdestid": "off",
    "wtfdestdate": "off",
    "wtfdestperiferia": "off",
    "envregistrationno_fdest": "off",
    "fdestaddress": "off",
    "fdestresponse": "off",
    "fdestphone": "off",
    "fdestresponseemail": "off",
    "wtfdestewc": "off",
    "fdestewctitle": "off",
    "wtfdestrd": "off",
    "wtfdestqty": "off",
    "wtfdestm3": "off",
    "wtproducerremarks": "off",
    "ewc_title": "off"
  };
  var bRefreshTable = false;
  function scRefreshTable()
  {
    return false;
  }

  function scAjaxDetailValue(sIndex, sValue)
  {
    var aValue = new Array();
    aValue[0] = {"value" : sValue};
    if ("intnumber" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtrequestdate" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproducerbranchid" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproducerperiferia" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("producerb_address" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("prbrresponse" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("pphone" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("premail" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproducerewc" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("ewctitle" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproduceracceptweigth" == sIndex)
    {
      scAjaxSetFieldCheckbox(sIndex, aValue, null, 1, null, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproducerqty" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtprducerm3" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wttransporterid" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wttransportdate" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wttransporternumberid" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wttransportervechicle" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("envregistrationno_transporter" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("transporterresponse" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("transporteremail" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("transporterphone" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("checktransvsproducer" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("checktransportervsfdest" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtwasteid" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtequipment" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestid" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestdate" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestperiferia" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("envregistrationno_fdest" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("fdestaddress" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("fdestresponse" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("fdestphone" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("fdestresponseemail" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestewc" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("fdestewctitle" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestrd" == sIndex)
    {
      scAjaxSetFieldSelect(sIndex, aValue, null);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestqty" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtfdestm3" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("wtproducerremarks" == sIndex)
    {
      scAjaxSetFieldText(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    if ("ewc_title" == sIndex)
    {
      scAjaxSetFieldLabel(sIndex, aValue);
      updateHeaderFooter(sIndex, aValue);
      return;
    }
    scAjaxSetFieldInnerHtml(sIndex, aValue);
  }
 </SCRIPT>
