function validarNIF(idInput, idi){
	// DEFINIM CAPES
	var divMssg		= jQuery("#txtMssgDni");
	var inputDni	= jQuery("#"+idInput);
	//
	jQuery.ajax({
	    type: "POST",
	    url: "includes/valida_nif_cif_nie.lib.php",
	    data: "d="+inputDni.val(),
	    beforeSend: function(){		
		// inputDni.css("background", "url('rcs_gen/inteficie/loadings/connecting_blue.gif')");
		},
	    success: function(dades)
	    {
			// Returns: 1 = NIF ok, 2 = CIF ok, 3 = NIE ok, -1 = NIF bad, -2 = CIF bad, -3 = NIE bad, 0 = ??? bad
			switch (dades) {
			    case "-1":
			    case "-2":
			    case "-3":
			    case "0":
			        // alert("DNI KO")
			    	// divMssg.html("El DNI indicat no sembla correcte.")
			    	// mostrarError("mssgDni", "dni", 0, 18 );
			    	jQuery("#errorDNI").val(1);
			        break;
			
			    case "1":
			    case "2":
			    case "3":
			    	 // alert("DNI OK")
			    	 // divMssg.html("Has de indicar el teu DNI.")
			    	 // ocultarError("mssgDni", "dni", 0);
			    	 jQuery("#errorDNI").val(0);
			    	 // ENVIEM FORMULARI
						
			    	 break;
			}
	 	}
	})
}
