/*! DataTables jQuery UI integration
 * ©2011-2014 SpryMedia Ltd - datatables.net/license
 */

/**
 * DataTables integration for jQuery UI. This requires jQuery UI and
 * DataTables 1.10 or newer.
 *
 * This file sets the defaults and adds options to DataTables to style its
 * controls using jQuery UI. See http://datatables.net/manual/styling/jqueryui
 * for further information.
 */
(function (factory) {
  if (typeof define === "function" && define.amd) {
    // AMD
    define(["jquery", "datatables.net"], function ($) {
      return factory($, window, document);
    });
  } else if (typeof exports === "object") {
    // CommonJS
    module.exports = function (root, $) {
      if (!root) {
        root = window;
      }

      if (!$ || !$.fn.dataTable) {
        $ = require_once("datatables.net")(root, $).$;
      }

      return factory($, root, root.document);
    };
  } else {
    // Browser
    factory(jQuery, window, document);
  }
})(function ($, window, document, undefined) {
  "use strict";
  var DataTable = $.fn.dataTable;

  var toolbar_prefix = "fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-";

  /* Set the defaults for DataTables initialisation */
  $.extend(true, DataTable.defaults, {
    dom: '<"' + toolbar_prefix + 'tl ui-corner-tr"lfr>' + "t" + '<"' + toolbar_prefix + 'bl ui-corner-br"ip>',
  });

  $.extend(DataTable.ext.classes, {
    sWrapper: "dataTables_wrapper dt-jqueryui",

    /* Full numbers paging buttons */
    sPageButton: "fg-button ui-button ui-state-default",
    sPageButtonActive: "ui-state-disabled",
    sPageButtonDisabled: "ui-state-disabled",

    /* Features */
    sPaging: "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi " + "ui-buttonset-multi paging_" /* Note that the type is postfixed */,

    /* Scrolling */
    sScrollHead: "dataTables_scrollHead " + "ui-state-default",
    sScrollFoot: "dataTables_scrollFoot " + "ui-state-default",

    /* Misc */
    sHeaderTH: "ui-state-default",
    sFooterTH: "ui-state-default",
  });

  return DataTable;
});
