function save()
{
	var data = $('text_editor_form').serialize();
	
	new Ajax.Request(getBaseURL() + 'ajax.php',
	{
		method: 'post',
		parameters: data,
		onSuccess: function() {
			show_message('Your changes were saved successfully.', 'notice');
		},
		onFailure: function(transport) {
			show_message('Something went wrong when saving your changes. Nothing has been saved.', 'error');
		}
	});
}

function del(model, id)
{	
	var proceed = confirm('Are you sure you want to delete this item? This can not be undone.');
	
	if (proceed)
	{
		new Ajax.Request(getBaseURL() + 'ajax.php',
		{
			method: 'post',
			parameters: 'model=' + model + '&action=del' + '&id=' + id,
			onSuccess: function() {
				show_message('Entry deleted.', 'notice');
				$(model+'_'+id).remove();
			},
			onFailure: function(transport) {
				show_message('Something went wrong when. Nothing has been deleted.', 'error');
			}
		});
	}
}
