/**
 * adds actions to container headers of collapsible containers
 */
$(document).ready(function() {
	/**
	 * Switches contents from no-js to js-enabled views.
	 * Applicable where No-JS-Users shall have an alternate view of features,
	 * that are not available to them. These no-js contents are to be displayed
	 * initially, and will be hidden and replaced hereby for js-users.
	 * usage example: product-filters
	 */
	initJavascriptUiFeatures(document);

	// replace the menu class for non javascript user with positive javascript users to maintain korrekt fading.
	$('.jh-s_MainLevel2NoJs').each(function (index, obj) {
		$(this).removeClass("jh-s_MainLevel2NoJs").addClass("jh-s_MainLevel2");
	});

	$('#jh-c_languageMenu').removeClass("hideNoJs").addClass("hide");

	$('#jh-c_navMainCartOverlayNoJs').attr("id","jh-c_navMainCartOverlay");
	$('#jh-c_navMainCartOverlay_HoverSwitchNoJs').attr("id","jh-c_navMainCartOverlay_HoverSwitch");

	$('a.jh-c_ajaxLink').css({'display':'block'});

});

/**
 * enables all user interface features that rely on Javascript (".jh-c_jsOn") and disables all ui elements that shall be off while Javascript is available (".jh-c_jsOff")
 * a context may be given to restrict initialization to a specific area. (e.g. ajax related contexts)
 *
 * @param context - a jquery selector context, defaults to "document"
 * @return void
 */
function initJavascriptUiFeatures(context) {
	if(!context) {
		context = document;
	}
	$('.jh-c_jsOff', context).hide();
	$('.jh-c_jsOn', context).not('.hide').show(); // 'hide' schliesst aus, was kontextbedingt trotz vorhandenem JS nicht erscheinen soll

}

