/**
 * @file common.aloha.js
 * @note houses all functions and data sends for the aloha cms plugin
 */

/**
 * initialize_aloha
 * @author 	dhowe
 * @date		01.11.11
 * @note		silly little wrapper function to initialize aloha on a page.  should be called after all DOM is ready.
 */
function initialize_aloha()
{
	// Any page that includes common.aloha.js
	$('.aloha').aloha();
}

/**
 * save_cms
 * @author 	jbarber
 * @date		01.11.11
 * @note		saves any and all content with a class of "aloha" to the database.  KEYS must be UNIQUE! (ids)
 */
$.save_cms = function()
{
	$.each(GENTICS.Aloha.editables,function (index, editable) {
		$.ajax({
		 type: 'POST',
		 data: {cms:true,key:editable.getId(),val:editable.getContents(),auth:"_this_is_a_cms_post"},
		 success: function(x) {alert(x);}
		});
	});
}

