if(!Destinia.maps){Destinia.maps={}}Destinia.maps.Coordinates=function(a){Destinia.maps.Component.apply(this,arguments);this.lat=null;this.lng=null;this.address=null;this.geoCoded=false;Destinia.extend(this,a);if(this.address){this.address=decodeURIComponent(this.address)}};Destinia.maps.Coordinates.prototype=new Destinia.maps.Component();Destinia.maps.Coordinates.prototype.constructor=Destinia.maps.Coordinates;Destinia.maps.Coordinates.prototype.getLat=function(){return this.lat};Destinia.maps.Coordinates.prototype.getLng=function(){return this.lng};Destinia.maps.Coordinates.prototype.setLat=function(a){if(Destinia.maps.Coordinates.checkCoordinate(a)){this.lat=a}else{throw {type:"InvalidLat"}}return this};Destinia.maps.Coordinates.prototype.setLng=function(a){if(Destinia.maps.Coordinates.checkCoordinate(a)){this.lng=a}else{throw {type:"InvalidLng"}}return this};Destinia.maps.Coordinates.prototype.sameCoordinates=function(a){return this.getLat()==a.getLat()&&this.getLng()==a.getLng()};Destinia.maps.Coordinates.prototype.setGeoCoded=function(a){this.geoCoded=a;return this};Destinia.maps.Coordinates.prototype.geoCodeAddress=function(b,a){if("undefined"===typeof a){a=this}if(this.lat&&this.lng){if(b){b.apply(a)}}else{if(!this.address){throw {type:"NoCoordinatesOrAddress"}}else{this.adapter.geoCodeAddress(this.address,function(d,c){this.setLat(d).setLng(c).setGeoCoded(true);if(b){b.apply(a)}},this)}}return this};Destinia.maps.Coordinates.prototype.geoCodeAddressQueue=function(a){return this.geoCodeAddress(a.next,a)};Destinia.maps.Coordinates.checkCoordinate=function(a){return"number"===typeof a&&180>a&&-180<a};
