jQuery(function() {
	
	$('.paginare a').click(function () {
	
		var clasa = $(this).parent().attr('className').replace('paginare ', '');
		var link = this.href;
		
		jQuery.ajax({
		type: "GET", 
		url: link + '&tip=' + clasa,		
		success: function(mesaj) {
			if(mesaj) {
				$('#' + clasa).html(mesaj);
//				console.log(mesaj);
			}
			else {
//				console.log('eroare');
			}
		}
		});
		
		return false;
		
	});
	
	
});

function trimite(buton, model, id) {
	
	try {
	
		jQuery.ajax({
		type: "POST", 
		url: "/admin/echipamente/categorii/",
		data:'data[' + model + '][nume]=' + $(buton).prev().val() + '&data[' + model + '][id]=' + id,
		success: function(mesaj) {
			if(mesaj) {
				$('#' + model + '_' + id + '').html(mesaj);
			}
			$('#' + model + '_' + id + '').show();
		}
		});
		
	}
	catch(eroare) {
		return false;
	}
	
	$(buton).prev().remove();
	$(buton).next().remove();
	$(buton).remove();
	
}


