function mostrar(error) {
				document.getElementById('errorvalid').innerHTML = error;
				document.getElementById('errorvalid').style.display = "";
			}

//Filtros  

// Expresiones reegulares email  /^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)$/    {return ($(el).val() == '' || /^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/.test($(el).val()));}
var filters = {
    requerido: function(el) {return ($(el).val() != '' && $(el).val() != -1);},
    email: function(el) {return /^([_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name)))*$/.test($(el).val());},
    telefono: function(el){return /^[0-9]*$/.test($(el).val());},
    socio: function(el) {return /(^([0-9]{3}\-[A|S])|^)$/.test($(el).val());},
    rider: function(el) {return /(^([0-9]{1,3})|^)$/.test($(el).val());},
    cpostal: function(el) {return /(^([0-9]{5})|^)$/.test($(el).val());},
    DNI: function(el) {return (/(^([A-Z]{1}[0-9]{7,8}\-[A-Z])|^)$/.test($(el).val()) || /(^([0-9]{8}\-[A-Z])|^)$/.test($(el).val()));},
    fecha: function(el) {return /(^([0-9]{4}\-[0-9]{2}\-[0-9]{2})|^)$/.test($(el).val());},
    matricula: function(el) {return (/(^([0-9]{4}\-[A-Z]{3})|^)$/.test($(el).val()) || /(^([A-Z]{1,2}\-[0-9]{4,4}\-[A-Z]{1,3})|^)$/.test($(el).val()));}
    
};

var error = '<ul><li>Los campos marcados no son correctos, por favor revísalos.</li><li>Puedes ver los formatos admitidos pinchando en el enlace del menú: "<strong>Formatos de campo aceptados</strong>".</li></ul>';

// Extensiones
$.extend({
	stop: function(e){
        if (e.preventDefault) e.preventDefault();
        if (e.stopPropagation) e.stopPropagation();
    }
});

// Código
$(document).ready(function(){
	$("form.validable").bind("submit", function(e){
		if (typeof filters == 'undefined') return;
	    $(this).find("input, textarea, select").each(function(x,el){ 
	        if ($(el).attr("className") != 'undefined') { 
		$(el).removeClass("errorform");
	        $.each(new String($(el).attr("className")).split(" "), function(x, klass){
	            if ($.isFunction(filters[klass]))
	                if (!filters[klass](el))  $(el).addClass("errorform");
	        });
	        }
	    });
		if ($(this).find(".errorform").size() > 0) {
			mostrar(error);
			$.stop(e || window.event);
			return false;
		}
	    return true;
	});
});