//hacer los forms reseteables
jQuery.fn.reset = function () {
  $(this).each (function() { this.reset(); });
}

function ajaxform(form)
{
	$(".formocultarcargando").hide();
	$(".formcargando").show();
		
	$.ajax({
		type: "POST",
		url: "capturar-formulario.php",
		dataType: "json",
		data: $(form).serialize(),
		success: 
			function(json) {
				
				$(".formcargando").hide();
				$(".formocultarcargando").show();
				
				if(json.res=="ok")
					$(form).reset();
				
				if(json.msg!="")
					alert(json.msg);
					
			}
		});
	
	return false;
}


function ajaxform2(form)
{
	$(".formocultarcargando").hide();
	$(".formcargando").show();
		
	$.ajax({
		type: "POST",
		url: "capturar-formulario.php",
		dataType: "json",
		data: $(form).serialize(),
		success: 
			function(json) {
				
				$(".formcargando").hide();
				$(".formocultarcargando").show();
				
				if(json.res=="ok")
					$(form).reset();
				
				if(json.msg!="")
					alert(json.msg);
					
			}
		});
	
	return false;
}
