/*
	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 = $('.accordion:not(.__done)');

	if (elements.length) {

		elements.each(function() {
			$(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);
