
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["prbranchname" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["address" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["numberofemployee" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["responsename" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["phone" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["email" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["branchm2" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["eidosdrastiriotitas" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["perigrafidrastiriotitas" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["aepo" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["departmentgivelicense" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["periferia" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["envregistrationno" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["datestart" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["dateend" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["daysbeforedue" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["ewcdetail" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
  scEventControl_data["remarks" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""};
}

function scEventControl_active(iSeqRow) {
  if (scEventControl_data["prbranchname" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["prbranchname" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["address" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["address" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["numberofemployee" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["numberofemployee" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["responsename" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["responsename" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["phone" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["phone" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["email" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["email" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["branchm2" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["branchm2" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["eidosdrastiriotitas" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["eidosdrastiriotitas" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["perigrafidrastiriotitas" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["perigrafidrastiriotitas" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["aepo" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["aepo" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["departmentgivelicense" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["departmentgivelicense" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["periferia" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["periferia" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["envregistrationno" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["datestart" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["datestart" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["dateend" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["dateend" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["daysbeforedue" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["daysbeforedue" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["ewcdetail" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["ewcdetail" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["remarks" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["remarks" + 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;
  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_prbranchname' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_prbranchname_onblur(this, iSeqRow) })
                                          .bind('focus', function() { sc_form_fdestbranch_prbranchname_onfocus(this, iSeqRow) });
  $('#id_sc_field_datestart' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_datestart_onblur(this, iSeqRow) })
                                       .bind('focus', function() { sc_form_fdestbranch_datestart_onfocus(this, iSeqRow) });
  $('#id_sc_field_dateend' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_dateend_onblur(this, iSeqRow) })
                                     .bind('focus', function() { sc_form_fdestbranch_dateend_onfocus(this, iSeqRow) });
  $('#id_sc_field_daysbeforedue' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_daysbeforedue_onblur(this, iSeqRow) })
                                           .bind('focus', function() { sc_form_fdestbranch_daysbeforedue_onfocus(this, iSeqRow) });
  $('#id_sc_field_envregistrationno' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_envregistrationno_onblur(this, iSeqRow) })
                                               .bind('focus', function() { sc_form_fdestbranch_envregistrationno_onfocus(this, iSeqRow) });
  $('#id_sc_field_address' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_address_onblur(this, iSeqRow) })
                                     .bind('focus', function() { sc_form_fdestbranch_address_onfocus(this, iSeqRow) });
  $('#id_sc_field_aepo' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_aepo_onblur(this, iSeqRow) })
                                  .bind('focus', function() { sc_form_fdestbranch_aepo_onfocus(this, iSeqRow) });
  $('#id_sc_field_departmentgivelicense' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_departmentgivelicense_onblur(this, iSeqRow) })
                                                   .bind('focus', function() { sc_form_fdestbranch_departmentgivelicense_onfocus(this, iSeqRow) });
  $('#id_sc_field_periferia' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_periferia_onblur(this, iSeqRow) })
                                       .bind('focus', function() { sc_form_fdestbranch_periferia_onfocus(this, iSeqRow) });
  $('#id_sc_field_eidosdrastiriotitas' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_eidosdrastiriotitas_onblur(this, iSeqRow) })
                                                 .bind('focus', function() { sc_form_fdestbranch_eidosdrastiriotitas_onfocus(this, iSeqRow) });
  $('#id_sc_field_perigrafidrastiriotitas' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_perigrafidrastiriotitas_onblur(this, iSeqRow) })
                                                     .bind('focus', function() { sc_form_fdestbranch_perigrafidrastiriotitas_onfocus(this, iSeqRow) });
  $('#id_sc_field_numberofemployee' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_numberofemployee_onblur(this, iSeqRow) })
                                              .bind('focus', function() { sc_form_fdestbranch_numberofemployee_onfocus(this, iSeqRow) });
  $('#id_sc_field_responsename' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_responsename_onblur(this, iSeqRow) })
                                          .bind('focus', function() { sc_form_fdestbranch_responsename_onfocus(this, iSeqRow) });
  $('#id_sc_field_phone' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_phone_onblur(this, iSeqRow) })
                                   .bind('focus', function() { sc_form_fdestbranch_phone_onfocus(this, iSeqRow) });
  $('#id_sc_field_email' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_email_onblur(this, iSeqRow) })
                                   .bind('focus', function() { sc_form_fdestbranch_email_onfocus(this, iSeqRow) });
  $('#id_sc_field_branchm2' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_branchm2_onblur(this, iSeqRow) })
                                      .bind('focus', function() { sc_form_fdestbranch_branchm2_onfocus(this, iSeqRow) });
  $('#id_sc_field_remarks' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_remarks_onblur(this, iSeqRow) })
                                     .bind('focus', function() { sc_form_fdestbranch_remarks_onfocus(this, iSeqRow) });
  $('#id_sc_field_ewcdetail' + iSeqRow).bind('blur', function() { sc_form_fdestbranch_ewcdetail_onblur(this, iSeqRow) })
                                       .bind('focus', function() { sc_form_fdestbranch_ewcdetail_onfocus(this, iSeqRow) });
} // scJQEventsAdd

function sc_form_fdestbranch_prbranchname_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_prbranchname();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_datestart_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_datestart();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_dateend_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_dateend();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_daysbeforedue_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_daysbeforedue();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_envregistrationno_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_envregistrationno();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_address_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_address();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_aepo_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_aepo();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_departmentgivelicense_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_departmentgivelicense();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_periferia_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_periferia();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_eidosdrastiriotitas_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_eidosdrastiriotitas();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_perigrafidrastiriotitas_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_perigrafidrastiriotitas();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_numberofemployee_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_numberofemployee();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_responsename_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_responsename();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_phone_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_phone();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_email_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_email();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_branchm2_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_branchm2();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_remarks_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_remarks();
  scCssBlur(oThis);
}

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

function sc_form_fdestbranch_ewcdetail_onblur(oThis, iSeqRow) {
  do_ajax_form_fdestbranch_mob_validate_ewcdetail();
  scCssBlur(oThis);
}

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

var sc_jq_calendar_value = {};

function scJQCalendarAdd(iSeqRow) {
  $("#id_sc_field_datestart" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_datestart" + 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['datestart']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
    buttonImage: "<?php echo $this->jqueryIconFile('calendar'); ?>",
    buttonImageOnly: true
  });

  $("#id_sc_field_dateend" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_dateend" + 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['dateend']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
    buttonImage: "<?php echo $this->jqueryIconFile('calendar'); ?>",
    buttonImageOnly: true
  });

} // scJQCalendarAdd

function scJQUploadAdd(iSeqRow) {
} // scJQUploadAdd


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

var scBtnGrpStatus = {};
function scBtnGrpShow(sGroup) {
  var btnPos = $('#sc_btgp_btn_' + sGroup).offset();
  scBtnGrpStatus[sGroup] = 'open';
  $('#sc_btgp_btn_' + sGroup).mouseout(function() {
    setTimeout(function() {
      scBtnGrpHide(sGroup);
    }, 1000);
  });
  $('#sc_btgp_div_' + sGroup + ' span a').click(function() {
    scBtnGrpStatus[sGroup] = 'out';
    scBtnGrpHide(sGroup);
  });
  $('#sc_btgp_div_' + sGroup).css({
    'left': btnPos.left
  })
  .mouseover(function() {
    scBtnGrpStatus[sGroup] = 'over';
  })
  .mouseleave(function() {
    scBtnGrpStatus[sGroup] = 'out';
    setTimeout(function() {
      scBtnGrpHide(sGroup);
    }, 1000);
  })
  .show('fast');
}
function scBtnGrpHide(sGroup) {
  if ('over' != scBtnGrpStatus[sGroup]) {
    $('#sc_btgp_div_' + sGroup).hide('fast');
  }
}
