
var BOUNDS_BOX_VERSION="1.1b";function BoundsBox(map,bounds,opt_options){this.bounds_=bounds;this.setMap(map);this.opts=opt_options||{};if(this.opts.fit)map.fitBounds(bounds);this.map=map;};BoundsBox.prototype=new google.maps.OverlayView();BoundsBox.prototype.draw=function(){var me=this;var div=this.div_;var image=this.image_;if(!div){div=this.div_=document.createElement('div');div.style.position="absolute";div.style.overflow="hidden";this.zIndex=this.opts.zIndex||0;div.style.zIndex=this.zIndex;div.className=this.opts.cssClass||this.opts.className||'bounds-box';div.innerHTML=this.opts.html||"";google.maps.event.addDomListener(div,"click",function(event){google.maps.event.trigger(me,"click",event);});var panes=this.getPanes();var paneId=this.opts.pane||"overlayLayer";panes[paneId].appendChild(div);if(this.opts.imageSrc){image=this.image_=new Image();image.src=this.opts.imageSrc;image.alt="";image.onload=function(){google.maps.event.trigger(me,"imageloaded");}
image.onerror=function(){google.maps.event.trigger(me,"imageloaderror");}
div.appendChild(image);}
this.opacity=this.opts.opacity*1||1;this.div_.style.filter='alpha(opacity:'+this.opacity*100+')';this.div_.style.opacity=this.opacity;}
var pixSW=this.getProjection().fromLatLngToDivPixel(this.bounds_.getSouthWest());var pixNE=this.getProjection().fromLatLngToDivPixel(this.bounds_.getNorthEast());this.divSize=new google.maps.Size((pixNE.x-pixSW.x),(pixSW.y-pixNE.y));div.style.left=pixSW.x+'px';div.style.top=pixNE.y+'px';div.style.width=this.divSize.width+"px";div.style.height=this.divSize.height+"px";div.style.zIndex=this.zIndex;if(!!image){image.width=this.divSize.width;image.height=this.divSize.height;}
this.image_=image;};BoundsBox.prototype.remove=function(){if(!this.div_)return false;this.div_.parentNode.removeChild(this.div_);this.div_=null;return true;};BoundsBox.prototype.setClassName=function(cssClass){if(!this.div_)return false;this.div_.className=cssClass;return true;};BoundsBox.prototype.setContent=function(html){if(!this.div_)return false;this.div_.innerHTML=html;return true;};BoundsBox.prototype.setImageSrc=function(src){if(!this.image_)return false;this.image_.src=src;return true;};BoundsBox.prototype.setOpacity=function(opacity){if(!this.div_)return false;this.div_.style.filter='alpha(opacity:'+opacity*100+')';this.div_.style.opacity=opacity*1;this.opacity=opacity*1;return true;};BoundsBox.prototype.setZIndex=function(zIndex){if(!this.div_)return false;this.div_.style.zIndex=zIndex;this.zIndex=zIndex;return true;};BoundsBox.prototype.getPosition=function(){if(!this.div_)return null;return this.bounds_.getCenter();};BoundsBox.prototype.get_position=function(){if(!this.div_)return null;return this.bounds_.getCenter();};BoundsBox.prototype.getContent=function(){if(!this.div_)return null;return this.div_.innerHTML;};BoundsBox.prototype.getDiv=function(){if(!this.div_)return null;return this.div_;};BoundsBox.prototype.getSize=function(){if(!this.div_)return null;return this.divSize;};BoundsBox.prototype.getImage=function(){if(!this.image_)return null;return this.image_;};BoundsBox.prototype.getClassName=function(){if(!this.div_)return null;return this.div_.className;};BoundsBox.prototype.getZIndex=function(){if(!this.div_)return null;return this.zIndex;};BoundsBox.prototype.getBounds=function(){return this.bounds_;};google.maps.LatLng.prototype.destinationLatLng=function(bearing,dist){var R=6371;var toRad=Math.PI/180;var lat1=this.lat()*toRad;var lng1=this.lng()*toRad;bearing=bearing*toRad;var lat2=Math.asin(Math.sin(lat1)*Math.cos(dist/R)+
Math.cos(lat1)*Math.sin(dist/R)*Math.cos(bearing));var lng2=lng1+Math.atan2(Math.sin(bearing)*Math.sin(dist/R)*Math.cos(lat1),Math.cos(dist/R)-Math.sin(lat1)*Math.sin(lat2));lng2=(lng2+Math.PI)%(2*Math.PI)-Math.PI;var pint=new google.maps.LatLng(lat2/toRad,lng2/toRad);return pint;}
function KmBox(map,point,opt_options){this.opts=opt_options||{};var kmX=this.opts.kmX||this.opts.miX*1.609344||1;var kmY=this.opts.kmY||this.opts.miY*1.609344||kmX;var west=point.destinationLatLng(270,kmX/2).lng();var east=point.destinationLatLng(90,kmX/2).lng();var north=point.destinationLatLng(0,kmY/2).lat();var south=point.destinationLatLng(180,kmY/2).lat();this.bounds_=new google.maps.LatLngBounds();this.bounds_.extend(new google.maps.LatLng(south,west));this.bounds_.extend(new google.maps.LatLng(north,east));this.setMap(map);if(this.opts.fit)map.fitBounds(this.bounds_);this.map=map;};KmBox.prototype=BoundsBox.prototype;
