function inscricion_evento (id) {
	$.post(base+'ajax/inscricion_evento.php', {
		id_evento: id,
		id_categoria: $('#id_categoria_'+id).val(),
		cedo: $('#cedo_'+id+':checked').length
	}, function (txt) {
		if (txt.length) {
			$('#inscrito_evento_'+id).html(txt).fadeIn();

			if (txt.match('Non')) {
				alert('A tua inscricion foi anulada');
			} else {
				alert('Foches inscrito correctamente');
			}
		}
	}, 'html');

	return false;
}

function inscricion_adestramento (id ,accion) {
	$.post(base+'ajax/inscricion_adestramento.php', {
		id_adestramento: id,
		accion: accion
	}, function (txt) {
		if (txt.length) {
			$('#inscrito_adestramento_'+id).html(txt).fadeIn();

			if (txt.match('Non')) {
				alert('A tua inscricion foi anulada');

				$('#boton_adestramento_'+id).attr('name', 'Inscribirme');
				$('#boton_adestramento_'+id).attr('value', 'Inscribirme');
				$('#boton_adestramento_'+id).attr('class', 'submit');
				$('#boton_adestramento_'+id).attr('onclick', '');

				$('#boton_adestramento_'+id).unbind('click').click(function () {
					return inscricion_adestramento(id, 1);
				});
			} else {
				alert('Foches inscrito correctamente');

				$('#boton_adestramento_'+id).attr('name', 'Desinscribirme');
				$('#boton_adestramento_'+id).attr('value', 'Desinscribirme');
				$('#boton_adestramento_'+id).attr('class', 'delete');
				$('#boton_adestramento_'+id).attr('onclick', '');

				$('#boton_adestramento_'+id).unbind('click').click(function () {
					return inscricion_adestramento(id, 0);
				});
			}
		}
	}, 'html');

	return false;
}

