/*
*/

$(document).ready(function(){
});

/**
 * Gotta work out what a delete does.
 * a) archive or actual row deletion?
 * b) delete events + events_* rows
 * c) What about user registrations for that event? orphaned?
 * d) could also write a cleanup function
 */
function event_delete(eid) {
  if(!confirmAction('delete event '+eid)) { return false; }
  //growl_fail("todo: delete event " + eid);
  
  growl_pass("Archiving event " + eid + ", please wait...");
  
  $.post('ajax', { 
		ajax_action: 'archive_event', 
		eid: eid
	}, function(data) {
		if('1' != data) { 
			growl_fail(data);
		} else {
			location.href = location.href;
		}
	});
	return true;
}

/**
 * SM 07Jul11: Updating to actually do something :)
 */
function accom_archive(elem, id) {
  //growl('testing:'+window['functionName']);
  
  jConfirm('Archive venue #'+id+'?', 'Confirm Archive', function(r) { if(r) {
    
    growl_info('Sending request to server, please wait...');
    
    $.post('ajax', { 
  		ajax_action: 'accom_archive', 
  		id: id
  	}, function(data) {
  		if('1' != data) { 
  			growl_fail(data);
  		} else {
  			//location.href = location.href;
        growl_pass('Venue archived successfully.');
        $(elem).parents('tr:first').fadeOut('slow').remove();
  		}
  	});
  	
  }});
}
