$(function(){$("#perPage").bind("change",function(){$("#perPageForm").submit()});$.ajaxSetup({type:"GET"});validate=function(b){for(var a={},e=0,c=e=false,g="",d="",f=-1;d=b[++f];)if(d.name.match(/^zip$|^city$|^state$/)){a[d.name]={value:d.value===d.title?"":d.value,pos:f};e=true}if(e)try{if(a.zip.value)if(a.zip.value.match(/^[\d]{5,9}$/)){if(b[a.city.pos].value===b[a.city.pos].title){b[a.city.pos].value="";b[a.state.pos].value=""}c=true}else if(a.city.value&&a.state.value){if(b[a.zip.pos].value===
b[a.zip.pos].title)b[a.zip.pos].value="";c=true}else g+="Please enter a valid zip.\n";else if(a.city.value&&a.state.value){if(typeof a.zip!=="undefined")b[a.zip.pos].value="";c=true}else g+="Please enter a zip or a city and state."}catch(j){typeof console.log!==undefined&&console.log(j)}else{for(f=-1;d=b[++f];)if(d.value===d.title)d.value="";c=true}c||alert(g);return c};switchText=function(){if($(this).val()==$(this).attr("title"))$(this).val("").removeClass("blur");else $.trim($(this).val())==""&&
$(this).addClass("blur").val($(this).attr("title"))};validateForms=function(){$("form").filter(function(){return typeof $(this).data("bypassValidation")==="undefined"}).each(function(){var b=$(this),a=this.elements,e=$($.grep(this.elements,function(c){return c.nodeName==="INPUT"}));e.each(function(){$.trim($(this).val())==""&&$(this).val($(this).attr("title"));$(this).val()==$(this).attr("title")&&$(this).addClass("blur")}).focus(switchText).blur(switchText);b.submit(function(){return validate(a)})})};
setTimeout(validateForms,250);var h=$("#minPrice"),i=$("#maxPrice");$("#minPrice, #maxPrice").bind("change",function(){var b=this,a=parseInt(b.value.replace(/\D/g,""),10);b=b===h.get(0)?i:h;var e=b===i;b.children("option").show().filter(function(){var c=parseInt(this.value.replace(/\D/g,""),10);return e&&c<=a||!e&&c>=a}).hide()})});