(function(){"use strict";var e={script:"//cdn.leafletjs.com/leaflet-0.6/leaflet.js",css:"//cdn.leafletjs.com/leaflet-0.6/leaflet.css",tiles:"//{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png",geocode:"http://nominatim.openstreetmap.org/search"};u8.Base.Geolocation.OpenStreetMapsProvider=function(t){$.extend(this,u8.Base.Geolocation.OpenStreetMapsProvider.defaults,t);this.elWindow=this.elWindow||$w("top");this._scripts=[e.script,e.css];this._copyrightNotice='Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, '+'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, '+'Imagery &copy; <a href="http://cloudmade.com">CloudMade</a>'};u8.Base.Geolocation.OpenStreetMapsProvider.defaults={mapType:"OpenStreetMap"};$.extend(u8.Base.Geolocation.OpenStreetMapsProvider.prototype,{load:function(t){var a=this.elWindow;var r=this;if(!a.L){var o=$p(a);if(o["OpenStreeMaps.onLoad"]){o["OpenStreeMaps.onLoad"].bind(s)}else{o["OpenStreeMaps.onLoad"]=new u8.Base.Event(s);$p(a).factory.scripts.load(this._scripts,function(){o["OpenStreeMaps.onLoad"].raise();delete o["OpenStreeMaps.onLoad"]})}}else{s()}function s(){var o=a.L;if(!o){return d.reject(r,{error:{message:"Failed to load open street map API."}})}r.tileLayer=o.tileLayer(e.tiles,{maxZoom:18,attribution:r._copyrightNotice});r.api=o;t(r,{provider:r})}},geocode:function(a,r){var o=a&&a.address;var s=o&&this._addressToQuery(o);if(!s){return r(this,{error:{message:"Failed to create queryString."}})}var i=new u8.Base.Uri(e.geocode);i.params.q=s;i.params.addressdetails=1;i.params.format="json";$.get(i.toString_()).done(function(e){var o=e&&e[0];if(o){r(this,{location:t(Number(o.lat),Number(o.lon)),address:a.address})}else{r(this,{address:a.address})}})},_addressToQuery:function(e){var t=e&&e.fieldValues;if(!t){return""}var a="";if(t["Street"]){a+=t["Street"]}if(t["City"]){if(a){a+=", "}a+=" "+t["City"]}if(t.country){if(a){a+=", "}a+=" "+t["Country"]}return a}});function t(e,t){return new u8.Base.Geolocation.Location({lat:e,lng:t})}u8.Base.Geolocation.OpenStreetMapsProvider.makeClass({name:"OpenStreetMapsProvider"})})();