function resetForm(id) {
	$('#'+id).each(function(){
	        this.reset();
	});
}
$(document).ready(function(){
	$("#enviar_email").submit(function(event){
		event.preventDefault();
		$("#box_msg_info").css('display', 'none');
		$("#box_msg_error").css('display', 'none');
		var str = $(this).serialize();
		   $.ajax({type: "POST",
			url: "sendmail.php",
			data: str,
			 success: function(msg){
				if(msg == 'OK') {
					$("#box_msg_error").css('display', 'none');
					$("#box_msg_info").fadeIn("slow");
					resetForm("enviar_email");
				}
				else $("#box_msg_error").fadeIn("slow");
			   }
		 });
	});
});
