/**
 * Encapsulates methods for the application in order to
 * avoid namespace pollution.
 *
 * @constructor
 */
var BISZUFIApplication = function () {

    this.initFormSubmit = function () {
        $(".form-submit").click(function (e) {
            $("form").attr('action', $(this).attr('data-action'));
            $("#" + $(this).attr('data-form-id')).submit();
        });
    };

    this.initAccordion = function () {
        $(".accordion > div").accordion({
            collapsible: true,
            heightStyle: "content",
            active: false
        });
    };

    this.initTooltips = function(document) {
        document.tooltip({
            items: "[data-tooltip]",
            track: true,
            content: function () {
                var element = $(this);
                var tooltip = $('#' + element.attr('data-tooltip'));
                return tooltip.html();
            }
        });
    };
};

/**
 * Make application functions available under the global
 * variable 'esfApp'.
 *
 * @type {BISZUFIApplication}
 */
var biszufiApp = new BISZUFIApplication();


$(document).ready(function ($) {
    biszufiApp.initFormSubmit();
});
