/**
 * ModalBootstrap
 * 
 * Lightbox library which uses bootstrap modal
 * 
 * @copyright Copyright (c) 2014 DMK E-BUSINESS GmbH <dev@dmk-ebusiness.de>
 * @license http://www.gnu.org/licenses/lgpl.html
 *          GNU Lesser General Public License, version 3 or later
 * @version 0.1.0
 * @requires jQuery, Base, Request
 * @author Michael Wagner <michael.wagner@dmk-ebusiness.de>
 */
!function(t,a){"use strict";var e,o;e=t.Request.extend(function(){}),o=function(t){this.setData(a.extend({template:'<div class="modal fade modal-ajax highlight-orange bg-weiss" id="{modal-id}" tabindex="-1" aria-label="Modal"><a class="close" data-dismiss="modal" href="javascript:void(0)" title="schlie\xdfen">x</a><div class="modal-dialog"><div class="modal-content"><div class="modal-body" id="{modal-id}-body"></div></div></div></div>',singlebox:!0,pageType:9266},t)),this.setData("version","0.1.0")},o=t.Base.extend(o),o.prototype.init=function(){this.initLinks(),this.initForms()},o.prototype.initLinks=function(){var t=this;a("body").off(".dmk.modal").on("click.dmk.modal","a.modal-ajax:not(.no-ajax)",function(e){var o=a(this);if(o.hasClass("no-ajax"))return!0;e.preventDefault(),t.open(o)})},o.prototype.initForms=function(t){var e=this;t=void 0===t?this.getBox():t,t.off(".dmk.modal").on("submit.dmk.modal","form:not(.no-ajax)",function(t){var o=a(this);if(o.hasClass("no-ajax"))return!0;t.preventDefault(),e.open(o)})},o.prototype.open=function(a){var e=this,o=t.Objects.getInstance("ModalBootstrapAjaxRequest"),i={type:this.getData("pageType")};o.onSuccess=function(t,a){e.updateContent(t,a)},o.doCall(a,i)},o.prototype.updateContent=function(t){var e=this.getBox(),o=e.find(".modal-body");o.html(t),(a(".contactpage").length||a(".modal-dialog iframe").length)&&(o.find(".box header").remove(),a(".modal-dialog iframe.wide").length&&o.parents(".modal-dialog").addClass("wide")),o.find(".accordion").each(function(){var t=jQuery(this).find("h3 a");t.removeClass("active").parent().next(".accordiontext").hide(),t.first().addClass("active").parent().next(".accordiontext").show()}),this.getData("singlebox")||a(".modal-ajax:visible").modal("hide"),e.modal("show")},o.prototype.close=function(t){t=this.isObjectJQuery(t)?t:this.getBox(),t.modal("hide")},o.prototype.getBox=function(){var t="modal-ajax",e=a("#"+t);if(e.length>0&&e.is(":visible")){if(this.getData("singlebox"))return e.first();t=t+"-"+Date.now(),e=a([])}return 0===e.length&&(e=a(this.getData("template").replace(/{modal-id}/g,t)),a("body").append(e),this.initForms(e)),e},t.Objects.add(e,"ModalBootstrapAjaxRequest"),t.Libraries.add(o)}(DMK,jQuery);