/* 
 Fluid Router Tool 2.0 ALPHA
 Copyright 2016 Christopher Allen 
 */

maintenance.prototype.main = function () {
  return false;
  var dfd_maintenance_main = jQuery.Deferred();
  start_progress();
  $.when(this.load_left(), this.load_right()).done(function () {
    stop_progress();
    debug_print('AJAX complete');
    dfd_maintenance_main.resolve("ajax_complete");
  });
  return dfd_maintenance_main.promise();
};

maintenance.prototype.load_left = function (callback) {
  var dfd_maintenanceLeft = jQuery.Deferred();
  $("#main-container-left-body").addClass("loading");
  $("main-container-left-footer").html('&nbsp;&nbsp;'); /* keep padding while loading */
  var atldhf = ajax_loader({id: this.id, filter: this.filter}, "app/maintenance/maintenance-left-header.php", "main-container-left-header");
  progress();
  var atldff = ajax_loader({id: this.id, filter: this.filter, selected: this.selected}, "app/maintenance/maintenance-left-footer.php", "main-container-left-footer");
  progress();
  var atldbf = ajax_loader({id: this.id, filter: this.filter, selected: this.selected}, "app/maintenance/maintenance-left-body.php", "main-container-left-body");
  progress();
  $.when(atldhf, atldff, atldbf).done(function () {
    progress();
    $("#main-container-left-body").removeClass("loading");
    debug_print('Left');
    if (typeof callback !== 'undefined' && cloneObject[callback]) {
      cloneObject[callback]();
    }
    dfd_maintenanceLeft.resolve("ajax_done_left");
  });
  return dfd_maintenanceLeft.promise();
};

maintenance.prototype.load_right = function (callback) {
  var dfd_maintenanceRight = jQuery.Deferred();
  $("#main-container-right-body").addClass("loading");
  var atrdhf = ajax_loader({id: this.id, filter: this.filter, tab: this.tab}, "app/maintenance/maintenance-right-header.php", "main-container-right-header");
  progress();
  var atrdff = ajax_loader({id: this.id, filter: this.filter, tab: this.tab}, "app/maintenance/maintenance-right-footer.php", "main-container-right-footer");
  progress();
  var atrdbf = ajax_loader({id: this.id, filter: this.filter, tab: this.tab}, "app/maintenance/maintenance-right-body.php", "main-container-right-body");
  $.when(atrdhf, atrdff, atrdbf).done(function () {
    progress();
    $("#main-container-right-body").removeClass("loading");
    debug_print('Right');
    if (typeof callback !== 'undefined' && cloneObject[callback]) {
      cloneObject[callback]();
    }
    dfd_maintenanceRight.resolve("ajax_done_right");
  });
  return dfd_maintenanceRight.promise();
};

maintenance.prototype.start_up = function () {
  var filter = this.filter; /* filter is used by HASH router navigate */
  var user_id = this.user_id; /* This user ID is used for AJAX save */

    debug_print('start_up');
    $('.dropdown').dropdown(drop_effect);

    done_loading();
    set_height();
    auto_right_menus();
};