google.maps.LatLng.prototype.distanceFrom=function(b){var a=this.lat(),d=this.lng(),e=b.lat(),c=b.lng(),b=(e-a)*Math.PI/180,d=(c-d)*Math.PI/180,a=Math.sin(b/2)*Math.sin(b/2)+Math.cos(a*Math.PI/180)*Math.cos(e*Math.PI/180)*Math.sin(d/2)*Math.sin(d/2);return 6378137*2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))};google.maps.LatLng.prototype.latRadians=function(){return this.lat()*Math.PI/180};google.maps.LatLng.prototype.lngRadians=function(){return this.lng()*Math.PI/180}; google.maps.Polygon.prototype.Contains=function(b){for(var a=0,d=!1,e=b.lng(),b=b.lat(),c=0;c<this.getPath().getLength();c++)if(a++,a==this.getPath().getLength()&&(a=0),this.getPath().getAt(c).lat()<b&&this.getPath().getAt(a).lat()>=b||this.getPath().getAt(a).lat()<b&&this.getPath().getAt(c).lat()>=b)this.getPath().getAt(c).lng()+(b-this.getPath().getAt(c).lat())/(this.getPath().getAt(a).lat()-this.getPath().getAt(c).lat())*(this.getPath().getAt(a).lng()-this.getPath().getAt(c).lng())<e&&(d=!d);return d}; google.maps.Polygon.prototype.Area=function(){for(var b=0,a=0,d=this.Bounds(),e=d.getSouthWest().lng(),d=d.getSouthWest().lat(),c=0;c<this.getPath().getLength();c++){a++;a==this.getPath().getLength()&&(a=0);var f=this.getPath().getAt(c).distanceFrom(new google.maps.LatLng(this.getPath().getAt(c).lat(),e)),g=this.getPath().getAt(a).distanceFrom(new google.maps.LatLng(this.getPath().getAt(a).lat(),e)),h=this.getPath().getAt(c).distanceFrom(new google.maps.LatLng(d,this.getPath().getAt(c).lng())),i= this.getPath().getAt(a).distanceFrom(new google.maps.LatLng(d,this.getPath().getAt(a).lng())),b=b+(f*i-g*h)}return Math.abs(0.5*b)};google.maps.Polygon.prototype.Distance=function(){for(var b=0,a=1;a<this.getPath().getLength();a++)b+=this.getPath().getAt(a).distanceFrom(this.getPath().getAt(a-1));return b};google.maps.Polygon.prototype.Bounds=function(){for(var b=new google.maps.LatLngBounds,a=0;a<this.getPath().getLength();a++)b.extend(this.getPath().getAt(a));return b}; google.maps.Polygon.prototype.GetPointAtDistance=function(b){if(0==b)return this.getPath().getAt(0);if(0>b||2>this.getPath().getLength())return null;for(var a=0,d=0,e=1;e<this.getPath().getLength()&&a<b;e++)d=a,a+=this.getPath().getAt(e).distanceFrom(this.getPath().getAt(e-1));if(a<b)return null;var c=this.getPath().getAt(e-2),e=this.getPath().getAt(e-1),b=(b-d)/(a-d);return new google.maps.LatLng(c.lat()+(e.lat()-c.lat())*b,c.lng()+(e.lng()-c.lng())*b)}; google.maps.Polygon.prototype.GetPointsAtDistance=function(b){var a=b,d=[];if(0>=b)return d;for(var e=0,c=0,f=1;f<this.getPath().getLength();f++){c=e;for(e+=this.getPath().getAt(f).distanceFrom(this.getPath().getAt(f-1));e>a;){var g=this.getPath().getAt(f-1),h=this.getPath().getAt(f),i=(a-c)/(e-c);d.push(new google.maps.LatLng(g.lat()+(h.lat()-g.lat())*i,g.lng()+(h.lng()-g.lng())*i));a+=b}}return d}; google.maps.Polygon.prototype.GetIndexAtDistance=function(b){if(0==b)return this.getPath().getAt(0);if(0>b)return null;for(var a=0,d=1;d<this.getPath().getLength()&&a<b;d++)a+=this.getPath().getAt(d).distanceFrom(this.getPath().getAt(d-1));return a<b?null:d}; google.maps.Polygon.prototype.Bearing=function(b,a){null==b?(b=0,a=this.getPath().getLength()-1):null==a&&(a=b+1);if(!(0>b||b>=this.getPath().getLength()||0>a||a>=this.getPath().getLength())){var d=this.getPath().getAt(b),e=this.getPath().getAt(a);if(d.equals(e))return 0;var c=d.latRadians(),d=d.lngRadians(),f=e.latRadians(),e=e.lngRadians(),c=-Math.atan2(Math.sin(d-e)*Math.cos(f),Math.cos(c)*Math.sin(f)-Math.sin(c)*Math.cos(f)*Math.cos(d-e));0>c&&(c+=2*Math.PI);c=180*c/Math.PI;return parseFloat(c.toFixed(1))}}; google.maps.Polyline.prototype.Contains=google.maps.Polygon.prototype.Contains;google.maps.Polyline.prototype.Area=google.maps.Polygon.prototype.Area;google.maps.Polyline.prototype.Distance=google.maps.Polygon.prototype.Distance;google.maps.Polyline.prototype.Bounds=google.maps.Polygon.prototype.Bounds;google.maps.Polyline.prototype.GetPointAtDistance=google.maps.Polygon.prototype.GetPointAtDistance;google.maps.Polyline.prototype.GetPointsAtDistance=google.maps.Polygon.prototype.GetPointsAtDistance; google.maps.Polyline.prototype.GetIndexAtDistance=google.maps.Polygon.prototype.GetIndexAtDistance;google.maps.Polyline.prototype.Bearing=google.maps.Polygon.prototype.Bearing;