
function scJQGeneralAdd() {
  $('input:text.sc-js-input').listen();
  $('input:password.sc-js-input').listen();
  $('input:checkbox.sc-js-input').listen();
  $('select.sc-js-input').listen();
  $('textarea.sc-js-input').listen();

} // scJQGeneralAdd

function scFocusField(sField) {
  var $oField = $('#id_sc_field_' + sField);

  if (0 == $oField.length) {
    $oField = $('input[name=' + sField + ']');
  }

  if (0 == $oField.length && document.F1.elements[sField]) {
    $oField = $(document.F1.elements[sField]);
  }

  if (false == scSetFocusOnField($oField) && 0 < $("#id_ac_" + sField).length) {
    scSetFocusOnField($("#id_ac_" + sField));
  }
} // scFocusField

function scSetFocusOnField($oField) {
  if (0 < $oField.length && 0 < $oField[0].offsetHeight && 0 < $oField[0].offsetWidth && !$oField[0].disabled) {
    $oField[0].focus();
    return true;
  }
  return false;
} // scSetFocusOnField

function scEventControl_init(iSeqRow) {
  scEventControl_data["intnumber" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtrequestdate" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtproducerbranchid" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtproducerewc" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtproducerperiferia" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtproduceracceptweigth" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtproducerqty" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wtprducerm3" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["wttransporterid" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["envregistrationno_transporter" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["envregistrationno_fdest" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["producerrequest" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
}

function scEventControl_active(iSeqRow) {
  if (scEventControl_data["intnumber" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["intnumber" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtrequestdate" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtrequestdate" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtproducerbranchid" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtproducerbranchid" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtproducerewc" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtproducerewc" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtproducerperiferia" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtproducerperiferia" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtproduceracceptweigth" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtproduceracceptweigth" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtproducerqty" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtproducerqty" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wtprducerm3" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wtprducerm3" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["wttransporterid" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["wttransporterid" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno_transporter" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno_transporter" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno_fdest" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno_fdest" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["producerrequest" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["producerrequest" + iSeqRow]["change"]) {
    return true;
  }
  return false;
} // scEventControl_active

function scEventControl_onFocus(oField, iSeq) {
  var fieldId, fieldName;
  fieldId = $(oField).attr("id");
  fieldName = fieldId.substr(12);
  scEventControl_data[fieldName]["blur"] = true;
  if ("wtproducerbranchid" + iSeq == fieldName) {
    scEventControl_data[fieldName]["change"]   = true;
    scEventControl_data[fieldName]["original"] = $(oField).val();
    return;
  }
  scEventControl_data[fieldName]["change"] = false;
} // scEventControl_onFocus

function scEventControl_onBlur(sFieldName) {
  scEventControl_data[sFieldName]["blur"] = false;
  if (scEventControl_data[sFieldName]["change"]) {
        if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val()) {
          scEventControl_data[sFieldName]["change"] = false;
        }
  }
} // scEventControl_onBlur

function scEventControl_onChange(sFieldName) {
  scEventControl_data[sFieldName]["change"] = false;
} // scEventControl_onChange

function scEventControl_onAutocomp(sFieldName) {
  scEventControl_data[sFieldName]["autocomp"] = false;
} // scEventControl_onChange

var scEventControl_data = {};

function scJQEventsAdd(iSeqRow) {
  $('#id_sc_field_intnumber' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_intnumber_onblur(this, iSeqRow) })
                                       .bind('focus', function() { sc_calendar_Transporter_wastetransactions_intnumber_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtrequestdate' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtrequestdate_onblur(this, iSeqRow) })
                                           .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtrequestdate_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtproducerbranchid' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onblur(this, iSeqRow) })
                                                .bind('change', function() { sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onchange(this, iSeqRow) })
                                                .bind('click', function() { sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onclick(this, iSeqRow) })
                                                .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtproducerperiferia' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtproducerperiferia_onblur(this, iSeqRow) })
                                                 .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtproducerperiferia_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtproducerewc' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtproducerewc_onblur(this, iSeqRow) })
                                           .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtproducerewc_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtproduceracceptweigth' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtproduceracceptweigth_onblur(this, iSeqRow) })
                                                    .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtproduceracceptweigth_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtproducerqty' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtproducerqty_onblur(this, iSeqRow) })
                                           .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtproducerqty_onfocus(this, iSeqRow) });
  $('#id_sc_field_wtprducerm3' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wtprducerm3_onblur(this, iSeqRow) })
                                         .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wtprducerm3_onfocus(this, iSeqRow) });
  $('#id_sc_field_wttransporterid' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_wttransporterid_onblur(this, iSeqRow) })
                                             .bind('focus', function() { sc_calendar_Transporter_wastetransactions_wttransporterid_onfocus(this, iSeqRow) });
  $('#id_sc_field_envregistrationno_transporter' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_envregistrationno_transporter_onblur(this, iSeqRow) })
                                                           .bind('focus', function() { sc_calendar_Transporter_wastetransactions_envregistrationno_transporter_onfocus(this, iSeqRow) });
  $('#id_sc_field_envregistrationno_fdest' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_envregistrationno_fdest_onblur(this, iSeqRow) })
                                                     .bind('focus', function() { sc_calendar_Transporter_wastetransactions_envregistrationno_fdest_onfocus(this, iSeqRow) });
  $('#id_sc_field_producerrequest' + iSeqRow).bind('blur', function() { sc_calendar_Transporter_wastetransactions_producerrequest_onblur(this, iSeqRow) })
                                             .bind('focus', function() { sc_calendar_Transporter_wastetransactions_producerrequest_onfocus(this, iSeqRow) });
} // scJQEventsAdd

function sc_calendar_Transporter_wastetransactions_intnumber_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_intnumber();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_intnumber_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtrequestdate_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtrequestdate();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtrequestdate_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtproducerbranchid();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onchange(oThis, iSeqRow) {
  nm_recarga_form('bloco_0', 0);
  do_ajax_calendar_Transporter_wastetransactions_mob_event_wtproducerbranchid_onchange();
}

function sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onclick(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_event_wtproducerbranchid_onclick();
}

function sc_calendar_Transporter_wastetransactions_wtproducerbranchid_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerperiferia_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtproducerperiferia();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerperiferia_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerewc_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtproducerewc();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerewc_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproduceracceptweigth_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtproduceracceptweigth();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproduceracceptweigth_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerqty_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtproducerqty();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtproducerqty_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtprducerm3_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wtprducerm3();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wtprducerm3_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_wttransporterid_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_wttransporterid();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_wttransporterid_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_envregistrationno_transporter_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_envregistrationno_transporter();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_envregistrationno_transporter_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_envregistrationno_fdest_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_envregistrationno_fdest();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_envregistrationno_fdest_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_calendar_Transporter_wastetransactions_producerrequest_onblur(oThis, iSeqRow) {
  do_ajax_calendar_Transporter_wastetransactions_mob_validate_producerrequest();
  scCssBlur(oThis);
}

function sc_calendar_Transporter_wastetransactions_producerrequest_onfocus(oThis, iSeqRow) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

var sc_jq_calendar_value = {};

function scJQCalendarAdd(iSeqRow) {
  $("#id_sc_field_wtrequestdate" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_wtrequestdate" + iSeqRow] = $oField.val();
    },
    onClose: function(dateText, inst) {
    },
    showWeek: true,
    numberOfMonths: 1,
    changeMonth: true,
    changeYear: true,
    yearRange: 'c-5:c+5',
    dayNames: ['<?php        echo html_entity_decode($this->Ini->Nm_lang['lang_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>'],
    dayNamesMin: ['<?php     echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    monthNamesShort: ['<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_janu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_febr'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_marc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_apri'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_mayy'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_june'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_july'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_augu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_sept'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_octo'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_nove'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_dece'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    weekHeader: "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_days_sem'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>",
    firstDay: <?php echo $this->jqueryCalendarWeekInit("" . $_SESSION['scriptcase']['reg_conf']['date_week_ini'] . ""); ?>,
    dateFormat: "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', $_SESSION['scriptcase']['reg_conf']['date_sep']), array('', 'yyyy', ''), $this->field_config['wtrequestdate']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
    buttonImage: "<?php echo $this->jqueryIconFile('calendar'); ?>",
    buttonImageOnly: true
  });

  $("#id_sc_field_wttransportdate" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_wttransportdate" + iSeqRow] = $oField.val();
    },
    onClose: function(dateText, inst) {
    },
    showWeek: true,
    numberOfMonths: 1,
    changeMonth: true,
    changeYear: true,
    yearRange: 'c-5:c+5',
    dayNames: ['<?php        echo html_entity_decode($this->Ini->Nm_lang['lang_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>'],
    dayNamesMin: ['<?php     echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    monthNamesShort: ['<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_janu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_febr'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_marc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_apri'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_mayy'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_june'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_july'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_augu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_sept'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_octo'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_nove'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_dece'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    weekHeader: "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_days_sem'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>",
    firstDay: <?php echo $this->jqueryCalendarWeekInit("" . $_SESSION['scriptcase']['reg_conf']['date_week_ini'] . ""); ?>,
    dateFormat: "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', $_SESSION['scriptcase']['reg_conf']['date_sep']), array('', 'yyyy', ''), $this->field_config['wttransportdate']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
    buttonImage: "<?php echo $this->jqueryIconFile('calendar'); ?>",
    buttonImageOnly: true
  });

  $("#id_sc_field_wtfdestdate" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_wtfdestdate" + iSeqRow] = $oField.val();
    },
    onClose: function(dateText, inst) {
    },
    showWeek: true,
    numberOfMonths: 1,
    changeMonth: true,
    changeYear: true,
    yearRange: 'c-5:c+5',
    dayNames: ['<?php        echo html_entity_decode($this->Ini->Nm_lang['lang_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>'],
    dayNamesMin: ['<?php     echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    monthNamesShort: ['<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_janu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_febr'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_marc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_apri'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_mayy'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_june'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_july'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_augu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_sept'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_octo'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_nove'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>','<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_dece'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>'],
    weekHeader: "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_days_sem'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>",
    firstDay: <?php echo $this->jqueryCalendarWeekInit("" . $_SESSION['scriptcase']['reg_conf']['date_week_ini'] . ""); ?>,
    dateFormat: "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', $_SESSION['scriptcase']['reg_conf']['date_sep']), array('', 'yyyy', ''), $this->field_config['wtfdestdate']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
    buttonImage: "<?php echo $this->jqueryIconFile('calendar'); ?>",
    buttonImageOnly: true
  });

} // scJQCalendarAdd

function scJQUploadAdd(iSeqRow) {
  $("#id_sc_field_wttransportersign" + iSeqRow).fileupload({
    datatype: "json",
    url: "calendar_Transporter_wastetransactions_mob_ul_save.php",
    dropZone: $("#hidden_field_data_wttransportersign" + iSeqRow),
    formData: function() {
      return [
        {name: 'app_dir', value: '<?php echo $this->Ini->path_aplicacao; ?>'},
        {name: 'app_name', value: 'calendar_Transporter_wastetransactions_mob'},
        {name: 'upload_dir', value: '<?php echo $this->Ini->root . $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_type', value: 'single'},
        {name: 'param_name', value: 'wttransportersign' + iSeqRow},
        {name: 'upload_file_height', value: '0'},
        {name: 'upload_file_width', value: '0'},
        {name: 'upload_file_aspect', value: 'S'},
        {name: 'upload_file_type', value: 'I'},
        {name: 'upload_file_row', value: iSeqRow}
      ];
    },
    progress: function(e, data) {
      var loader, progress;
      if (data.lengthComputable && window.FormData !== undefined) {
        loader = $("#id_img_loader_wttransportersign" + iSeqRow);
        progress = parseInt(data.loaded / data.total * 100, 10);
        loader.show().find("div").css("width", progress + "%");
      }
      else {
        loader = $("#id_ajax_loader_wttransportersign" + iSeqRow);
        loader.show();
      }
    },
    done: function(e, data) {
      var fileData, thumbDisplay, checkDisplay, var_ajax_img_thumb;
      if (data.result[0].body) {
        fileData = $.parseJSON(data.result[0].body.innerText);
      }
      else {
        fileData = eval(data.result);
      }
      $("#id_sc_field_wttransportersign" + iSeqRow).val("");
      $("#id_sc_field_wttransportersign_ul_name" + iSeqRow).val(fileData[0].sc_random_prot);
      $("#id_sc_field_wttransportersign_ul_type" + iSeqRow).val(fileData[0].type);
      var_ajax_img_wttransportersign = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_random_prot;
      var_ajax_img_thumb = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_thumb_prot;
      thumbDisplay = ("" == var_ajax_img_wttransportersign) ? "none" : "";
      $("#id_ajax_img_wttransportersign" + iSeqRow).attr("src", var_ajax_img_thumb);
      $("#id_ajax_img_wttransportersign" + iSeqRow).css("display", thumbDisplay);
      if (document.F1.temp_out1_wttransportersign) {
        document.F1.temp_out_wttransportersign.value = var_ajax_img_thumb;
        document.F1.temp_out1_wttransportersign.value = var_ajax_img_wttransportersign;
      }
      else if (document.F1.temp_out_wttransportersign) {
        document.F1.temp_out_wttransportersign.value = var_ajax_img_wttransportersign;
      }
      checkDisplay = ("" == fileData[0].sc_random_prot.substr(12)) ? "none" : "";
      $("#chk_ajax_img_wttransportersign" + iSeqRow).css("display", checkDisplay);
      $("#txt_ajax_img_wttransportersign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      $("#txt_ajax_img_wttransportersign" + iSeqRow).css("display", checkDisplay);
      $("#id_ajax_link_wttransportersign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      if (window.FormData !== undefined)
      {
        $("#id_img_loader_wttransportersign" + iSeqRow).hide();
      }
      else
      {
        $("#id_ajax_loader_wttransportersign" + iSeqRow).hide();
      }
    }
  });

  $("#id_sc_field_wtproducersign" + iSeqRow).fileupload({
    datatype: "json",
    url: "calendar_Transporter_wastetransactions_mob_ul_save.php",
    dropZone: $("#hidden_field_data_wtproducersign" + iSeqRow),
    formData: function() {
      return [
        {name: 'app_dir', value: '<?php echo $this->Ini->path_aplicacao; ?>'},
        {name: 'app_name', value: 'calendar_Transporter_wastetransactions_mob'},
        {name: 'upload_dir', value: '<?php echo $this->Ini->root . $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_type', value: 'single'},
        {name: 'param_name', value: 'wtproducersign' + iSeqRow},
        {name: 'upload_file_height', value: '0'},
        {name: 'upload_file_width', value: '0'},
        {name: 'upload_file_aspect', value: 'S'},
        {name: 'upload_file_type', value: 'I'},
        {name: 'upload_file_row', value: iSeqRow}
      ];
    },
    progress: function(e, data) {
      var loader, progress;
      if (data.lengthComputable && window.FormData !== undefined) {
        loader = $("#id_img_loader_wtproducersign" + iSeqRow);
        progress = parseInt(data.loaded / data.total * 100, 10);
        loader.show().find("div").css("width", progress + "%");
      }
      else {
        loader = $("#id_ajax_loader_wtproducersign" + iSeqRow);
        loader.show();
      }
    },
    done: function(e, data) {
      var fileData, thumbDisplay, checkDisplay, var_ajax_img_thumb;
      if (data.result[0].body) {
        fileData = $.parseJSON(data.result[0].body.innerText);
      }
      else {
        fileData = eval(data.result);
      }
      $("#id_sc_field_wtproducersign" + iSeqRow).val("");
      $("#id_sc_field_wtproducersign_ul_name" + iSeqRow).val(fileData[0].sc_random_prot);
      $("#id_sc_field_wtproducersign_ul_type" + iSeqRow).val(fileData[0].type);
      var_ajax_img_wtproducersign = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_random_prot;
      var_ajax_img_thumb = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_thumb_prot;
      thumbDisplay = ("" == var_ajax_img_wtproducersign) ? "none" : "";
      $("#id_ajax_img_wtproducersign" + iSeqRow).attr("src", var_ajax_img_thumb);
      $("#id_ajax_img_wtproducersign" + iSeqRow).css("display", thumbDisplay);
      if (document.F1.temp_out1_wtproducersign) {
        document.F1.temp_out_wtproducersign.value = var_ajax_img_thumb;
        document.F1.temp_out1_wtproducersign.value = var_ajax_img_wtproducersign;
      }
      else if (document.F1.temp_out_wtproducersign) {
        document.F1.temp_out_wtproducersign.value = var_ajax_img_wtproducersign;
      }
      checkDisplay = ("" == fileData[0].sc_random_prot.substr(12)) ? "none" : "";
      $("#chk_ajax_img_wtproducersign" + iSeqRow).css("display", checkDisplay);
      $("#txt_ajax_img_wtproducersign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      $("#txt_ajax_img_wtproducersign" + iSeqRow).css("display", checkDisplay);
      $("#id_ajax_link_wtproducersign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      if (window.FormData !== undefined)
      {
        $("#id_img_loader_wtproducersign" + iSeqRow).hide();
      }
      else
      {
        $("#id_ajax_loader_wtproducersign" + iSeqRow).hide();
      }
    }
  });

  $("#id_sc_field_wtfdestsign" + iSeqRow).fileupload({
    datatype: "json",
    url: "calendar_Transporter_wastetransactions_mob_ul_save.php",
    dropZone: $("#hidden_field_data_wtfdestsign" + iSeqRow),
    formData: function() {
      return [
        {name: 'app_dir', value: '<?php echo $this->Ini->path_aplicacao; ?>'},
        {name: 'app_name', value: 'calendar_Transporter_wastetransactions_mob'},
        {name: 'upload_dir', value: '<?php echo $this->Ini->root . $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_url', value: '<?php echo $this->Ini->path_imag_temp; ?>/'},
        {name: 'upload_type', value: 'single'},
        {name: 'param_name', value: 'wtfdestsign' + iSeqRow},
        {name: 'upload_file_height', value: '0'},
        {name: 'upload_file_width', value: '0'},
        {name: 'upload_file_aspect', value: 'S'},
        {name: 'upload_file_type', value: 'I'},
        {name: 'upload_file_row', value: iSeqRow}
      ];
    },
    progress: function(e, data) {
      var loader, progress;
      if (data.lengthComputable && window.FormData !== undefined) {
        loader = $("#id_img_loader_wtfdestsign" + iSeqRow);
        progress = parseInt(data.loaded / data.total * 100, 10);
        loader.show().find("div").css("width", progress + "%");
      }
      else {
        loader = $("#id_ajax_loader_wtfdestsign" + iSeqRow);
        loader.show();
      }
    },
    done: function(e, data) {
      var fileData, thumbDisplay, checkDisplay, var_ajax_img_thumb;
      if (data.result[0].body) {
        fileData = $.parseJSON(data.result[0].body.innerText);
      }
      else {
        fileData = eval(data.result);
      }
      $("#id_sc_field_wtfdestsign" + iSeqRow).val("");
      $("#id_sc_field_wtfdestsign_ul_name" + iSeqRow).val(fileData[0].sc_random_prot);
      $("#id_sc_field_wtfdestsign_ul_type" + iSeqRow).val(fileData[0].type);
      var_ajax_img_wtfdestsign = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_random_prot;
      var_ajax_img_thumb = '<?php echo $this->Ini->path_imag_temp; ?>/' + fileData[0].sc_thumb_prot;
      thumbDisplay = ("" == var_ajax_img_wtfdestsign) ? "none" : "";
      $("#id_ajax_img_wtfdestsign" + iSeqRow).attr("src", var_ajax_img_thumb);
      $("#id_ajax_img_wtfdestsign" + iSeqRow).css("display", thumbDisplay);
      if (document.F1.temp_out1_wtfdestsign) {
        document.F1.temp_out_wtfdestsign.value = var_ajax_img_thumb;
        document.F1.temp_out1_wtfdestsign.value = var_ajax_img_wtfdestsign;
      }
      else if (document.F1.temp_out_wtfdestsign) {
        document.F1.temp_out_wtfdestsign.value = var_ajax_img_wtfdestsign;
      }
      checkDisplay = ("" == fileData[0].sc_random_prot.substr(12)) ? "none" : "";
      $("#chk_ajax_img_wtfdestsign" + iSeqRow).css("display", checkDisplay);
      $("#txt_ajax_img_wtfdestsign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      $("#txt_ajax_img_wtfdestsign" + iSeqRow).css("display", checkDisplay);
      $("#id_ajax_link_wtfdestsign" + iSeqRow).html(fileData[0].sc_random_prot.substr(12));
      if (window.FormData !== undefined)
      {
        $("#id_img_loader_wtfdestsign" + iSeqRow).hide();
      }
      else
      {
        $("#id_ajax_loader_wtfdestsign" + iSeqRow).hide();
      }
    }
  });

} // scJQUploadAdd


function scJQElementsAdd(iLine) {
  scJQEventsAdd(iLine);
  scEventControl_init(iLine);
  scJQCalendarAdd(iLine);
  scJQUploadAdd(iLine);
} // scJQElementsAdd

