var j2w=j2w||{}; j2w.Agent=function(){var e={},f=!1,g=function(a){a=a.replace(/(\r\n|\n|\r)/gm," ");a.trim();return a},h=function(){this.location=this.keywords=this.label=this.type="";this.frequency=7;this.filterString=this.latitude=this.longitude=this.units=this.radius=this.geolocation="";this.facets={};this.getFilterString=function(){return this.filterString};this.setFilterString=function(a){this.filterString=a};this.getKeywords=function(){return this.keywords};this.setKeywords=function(a){this.keywords=a};this.getFacets= function(){return this.facets};this.setFacets=function(a){this.facets=a};this.getLocation=function(){return this.location};this.setLocation=function(a){this.location=a};this.getFrequency=function(){return this.frequency};this.setFrequency=function(a){this.frequency=parseInt(a,10)};this.getType=function(){return this.type};this.setType=function(a){this.type=a};this.getLabel=function(){return this.label};this.setLabel=function(a){this.label=a};this.getGeolocation=function(){return this.geolocation}; this.setGeolocation=function(a){this.geolocation=a};this.getRadius=function(){return this.radius};this.setRadius=function(a){this.radius=Number(a)};this.getUnits=function(){return this.units};this.setUnits=function(a){this.units=a};this.getLongitude=function(){return this.longitude};this.setLongitude=function(a){this.longitude=Number(a)};this.getLatitude=function(){return this.latitude};this.setLatitude=function(a){this.latitude=Number(a)};return!0};return{init:function(a){f?a=!1:(e=a,a=f=!0);return a}, Args:{get:function(a){return j2w.Args.get(a,e)}},buildAgentFromSearchForm:function(a){function b(a){var b=$.grep(d,function(b){return b.name==a});return 0==b.length?"":b[0].value}var d=a.serializeArray(),c=new h;c.setType(b("searchby")||"location");switch(c.getType()){case "distance":c.setGeolocation(b("geolocation"));c.setRadius(b("d"));c.setUnits(a.find("[name=d]").find(":selected").text().split(" ").pop());c.setLongitude(b("lon"));c.setLatitude(b("lat"));break;default:c.setLocation(b("locationsearch"))}c.setKeywords(b("q")); c.setFrequency(b("frequency"));c.setLabel(b("label"));return c},getValidationErrors:function(a,b){var d=[],c;for(c in a)if(a.hasOwnProperty(c)&&!a[c])switch(c){case "keywordOrLocation":d.push(b.tcmustprovidekeywordorloc);break;case "frequencyNumeric":d.push(b.tcfreqmustbenumeric);break;case "frequencyWithinRange":d.push(b.tcfreqmustbegtone);break;case "uniqueAgent":d.push(b.tcagentalreadyexists)}return d},setValidFrequency:function(a){var b=a.value;j2w.Validation.isInteger(b)&&99a||99a.getFrequency()||99