Meetup.DomDeco.FreeformLocation=function(){bindMethods(this)};Meetup.DomDeco.FreeformLocation.prototype={decorate:function(el){if(!el){LOG.error("no element passed in to Meetup.DomDeco.FreeformLocation.decorate()");return}this.testingId=Math.floor(Math.random()*1000);this.inputEl=el;this.formEl=this.inputEl.form;this.mcIdEl=this.formEl.mcId;this.mcNameEl=this.formEl.mcName;this.latEl=this.formEl.lat;this.lonEl=this.formEl.lon;this.geocodeAttemptedEl=this.formEl.geocodeAttempted;this.gcResultsEl=this.formEl.gcResults;try{this.geocoder=new GClientGeocoder()}catch(err){return false}connect(this.formEl,"onsubmit",this.submitHandler)},submitHandler:function(e){var addressStr=this.inputEl.value;var mcIdStr=this.mcIdEl.value;var latStr=this.latEl.value;var lonStr=this.lonEl.value;if(addressStr!=""&&mcIdStr==""&&latStr==""&&lonStr==""&&!this.geocodeAttempted){e.stop();var succeed=function(){clearTimeout(this.tooSlowTimeout);submitForm(this.formEl)};var fail=function(){submitForm(this.formEl)};this.geocodeAddress(addressStr,succeed,fail);this.geocodeAttempted=true;this.tooSlowTimeout=setTimeout(bind(fail,this),2000)}else{}},getElementByName:function(element,propertyToFind){for(var property in element){if(property==propertyToFind){return element[property]}else{if(typeof(element[property])=="object"){var node=this.getElementByName(element[property],propertyToFind);if(node!=null){return node}}}}return null},addAddressToSubmit:function(succeed,fail,response){var gcResults="";if(!response||response.Status.code!=200){fail.call(this)}else{for(var i=0;i<response.Placemark.length;i++){var place=response.Placemark[i];var address=place.address;var countryCode=this.getElementByName(place,"CountryNameCode");var region1=this.getElementByName(place,"AdministrativeAreaName");var region2=this.getElementByName(place,"SubAdministrativeAreaName");var city=this.getElementByName(place,"LocalityName");var city2=this.getElementByName(place,"DependentLocalityName");var zip=this.getElementByName(place,"PostalCodeNumber");var lat=place.Point.coordinates[1];var lon=place.Point.coordinates[0];if(i>0){gcResults+="|"}gcResults+=address+":"+countryCode+":"+region1+":"+region2+":"+city+":"+city2+":"+zip+":"+lat+":"+lon}succeed.call(this)}this.gcResultsEl.value=gcResults},geocodeAddress:function(addressStr,succeed,fail){this.mcIdEl.value="";this.gcResultsEl.value="";this.geocoder.getLocations(addressStr,bind(partial(this.addAddressToSubmit,succeed,fail),this))},geocodeAttempted:false,geocoder:null,inputEl:null,formEl:null,mcIdEl:null,gcResultsEl:null,tooSlowTimeout:null,testingId:null};