// All javascripts used only in magnolia pages.

/**
 * Ajax call to the content node passed, and also changes the class of all the siblings background.
 * @param clickedLink Current link clicked.
 * @param nodeId UUID of the content to load.
 * @return false
 */
function loadVideoContent(clickedLink, data) {
	if (data) {
		new Ajax(js_contextPath + '/ajax-update', {
			update: 'ajaxService',
			data: data,
			method: 'get',
			evalScripts: true
		}).request();
	}
	if ($(clickedLink)) {
		var selectedDiv = $(clickedLink).getParent()
		$each(selectedDiv.getParent().getElements('div.icon'), function(elem) {
			elem.removeClass('icon_selected');
			elem.removeClass('icon_normal');
			if (elem == selectedDiv) {
				elem.addClass('icon_selected');
			} else {
				elem.addClass('icon_normal');
			}
		});
	}
	return false;
}
