// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
 	function confirm_delete_entity(name, url) {
	 	var content = ['<p>Are you sure you want to delete ' + name + '?</p>',
	 	'<div style="text-align: right;">',
	 	'<input class="right" type="button" value="Cancel" onclick="Simple.Modal.close(); return false;">',
	 	'<input onclick="delete_entity(\'' + url + '\');" type="button" value="OK" />'].join('\n');
	 	Simple.Modal.open(content);
 	}
 	function delete_entity(url) {
	 	new Ajax.Request(url, {
		 	method: 'delete',
		 	parameters: 'authenticity_token=' + RAILS.authenticity_token
	 	});
	}
	
	function ajax_form_update(url, form_method, el){
    new Ajax.Request(url, {
        asynchronous: true,
        evalScripts: true,
        method: form_method,
        parameters: el.form.serialize() + '&authenticity_token=' + RAILS.authenticity_token
    });
    return false;
}

