$(document).ready(function(){
	$(".boton_envio").click(function() {
		
		var nombre = $(".nombre").val();
		    poblacion = $(".poblacion").val();
			email = $(".email").val();
			validacion_email = /^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
			telefono = $(".telefono").val();
			mensaje = $(".mensaje").val();
		
		if (nombre == "") {
		    $(".nombre").focus();
		    return false;
			
			}else if(poblacion == ""){
		    $(".poblacion").focus();
		    return false;
			
		
			
		}else if(telefono == ""){
		    $(".telefono").focus();
		    return false;
			
		
			
		}else{
			$('.ajaxgif').removeClass('hide');
			var datos = 'nombre='+ nombre +
			            '&poblacion=' + poblacion +  
						'&email=' + email + 
						'&telefono=' + telefono + 
						'&mensaje=' + mensaje;
			$.ajax({
	    		type: "POST",
	    		url: "http://www.centrodelaccidentado.com/form/proceso.php",
				
	    		data: datos,
	    		success: function() {
					$('.ajaxgif').hide();
	      			$('.msg').text('Gracias. En breve atenderemos su solicitud.').addClass('msg_ok').animate({ 'right' : '130px' }, 300);	
	    		},
				error: function() {
					$('.ajaxgif').hide();
	      			$('.msg').text('Hubo un error!').addClass('msg_error').animate({ 'right' : '130px' }, 300);					
				}
	   		});
	 		return false;	
		}
	});
});


