var filters={required:function(el){return($(el).val()!=''&&$(el).val()!=-1);},email:function(el){return/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/.test($(el).val());},telefono:function(el){return/^[0-9]*$/.test($(el).val());},number:function(el){valor=$(el).val();return!isNaN(valor);},menor150: function(el) {return $(el).val().length<150},menor800: function(el) {return $(el).val().length<800},compPass:function(el){return $(el).val()==$('#REPETIR_PASS').val();},isChecked:function(el) {result=false;$("form").find("input").each(function(y,radio) {if (radio.name==el.name) {if (radio.checked) result=true;}});return result;},isVideo:function(el){valor=$(el).val();return(valor!=''&&valor.indexOf('flv')>0);},isImage:function(el){valor=$(el).val();valor=valor.toLowerCase();return(valor!=''&&(valor.indexOf('jpg')>0||valor.indexOf('jpeg')>0||valor.indexOf('gif')>0));}};$.extend({stop:function(e){if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();}});$(document).ready(function(){$("form").bind("submit",function(e){$(this).find(".error").removeClass("error");$(this).find(".errorSpan").removeClass("errorSpan");if(typeof filters=='undefined')return;$(this).find("input, textarea, select").each(function(x,el){if($(el).attr("class")!='undefined'){$.each(new String($(el).attr("class")).split(" "),function(x,klass){if($.isFunction(filters[klass]))if(!filters[klass](el)){$(el).addClass("error");$(el.parentNode).addClass("errorSpan");}});}});if($(this).find(".error").size()>0){$.stop(e||window.event);$(this).find(".error:first").focus();return false;}return true;});});var modifFormul=false;function activarComprobacionModif(){$("input, select, textarea").change(function(){modifFormul=true;});$(".menu_tabs a").click(function(){if(modifFormul){return confirm('Ha realizado cambios en el formulario sin grabarlos.\nSi cambia de pestaña ahora,se perderán dichos cambios.\n¿Estáseguro/a de que desea continuar?');}else return true;});$('input,textarea').caps(function(caps){if(jQuery.browser.safari)return;if(caps){alert('Tiene el bloqueo de mayúsculas activado');}});}jQuery.fn.caps=function(cb){return this.keypress(function(e){var w=e.which?e.which:(e.keyCode?e.keyCode:-1);var s=e.shiftKey?e.shiftKey:(e.modifiers?!!(e.modifiers&4):false);var c=((w>=65&&w<=90)&&!s)||((w>=97&&w<=122)&&s);cb.call(this,c);});};$(document).ready(function(){$("#nuevaBusqueda").click(function(){$(":input").attr('value','');$(":text:first").focus();});$("a.external").attr('target','_blank');$("a.volverAtras").click(function(){window.history.back();return false;});});
