/*
	Stempora Web Framework
	Copyright (c) 2002-2018 Stempora. 
	All rights reserved.
		web:  www.stempora.com
		mail: support@stempora.com				
*/

var STBGlobalAccordion = Object.create(STBModule.prototype);

STBGlobalAccordion.name = "GlobalAccordion";

STBGlobalAccordion.initAccordion = function () {

	var elements = jQuery('.accordion:not(.__done)');

	if (elements.length) {

		elements.each(function() {

			jQuery(this).find("> p").remove();

			jQuery(this).find(".panel").first().find("a.collapsed").trigger("click");
		});

		elements.addClass("__done");
	}

}


STBGlobalAccordion.runOnReady = function() {
	STBGlobalAccordion.initAccordion();
}

STBGlobalAccordion.runOnContentUpdate = function() {
	STBGlobalAccordion.initAccordion();
}


site.registerModule(STBGlobalAccordion);
