jQuery(function($) {
				
	$("a.delete").click(function() {					 
		var id = $(this).attr('id');
		var dataString = 'action=del&id=' + id;
		var rowdelete = 'tr#'+id;
		$.ajax({
			type: "POST",
			url: '/admin/process.php',
			data: dataString,
			beforeSend: function() {
				$('<div class="alert confirm"><em>De inschrijving is succesvol verwijderd.</em></div>').insertAfter( $("table") ).animate({opacity: 1}, 3000).slideUp(300, function() { 
					$(this).remove();
				});				
			},
			success: function() {
				$(rowdelete).fadeOut(300,function() {
					$(rowdelete).remove();
				});
			}
		});
		return false;
	});

	$('a.status').click(function(event) {
								 
		$(this).toggleClass("off");
		$(this).toggleClass("on");
		
		var id = event.target.id;
		var status = $(this).attr('class').replace('iconx status ','');
		
		if (status == 'off') {
			$('a.'+id+'.delete').hide();
		} else {
			$('a.'+id+'.delete').show();
		}
			
		
		var dataString = 'action=bStatus&id=' + id + '&status=' + status;
		$.ajax({
			type: "POST",
			url: '/admin/process.php',
			data: dataString,
			beforeSend: function() {
				$('<div class="alert confirm"><em>De aanmelding is succesvol van status gewijzigd.</em></div>').insertAfter( $("table") )
				.animate({opacity: 1}, 3000).slideUp(300, function() { 
					$(this).remove();
				});
			},
			success: function() {
			}
		});
		return false; 
	});

});

