function ExtInfoWindow(b,c,a,d){this.html_=a;this.marker_=b;this.infoWindowId_=c;this.options_=d===null?{}:d;this.ajaxUrl_=this.options_.ajaxUrl==null?null:this.options_.ajaxUrl;this.callback_=this.options_.ajaxCallback==null?null:this.options_.ajaxCallback;this.maxContent_=this.options_.maxContent==null?null:this.options_.maxContent;this.maximizeEnabled_=this.maxContent_==null?false:true;this.isMaximized_=false;this.borderSize_=this.options_.beakOffset==null?0:this.options_.beakOffset;this.paddingX_=this.options_.paddingX==null?0+this.borderSize_:this.options_.paddingX+this.borderSize_;this.paddingY_=this.options_.paddingY==null?0+this.borderSize_:this.options_.paddingY+this.borderSize_;this.maxPanning_=this.options_.maxPanning==null?500:this.options_.maxPanning;this.map_=null;this.container_=document.createElement("div");this.container_.style.position="relative";this.container_.style.display="none";this.contentDiv_=document.createElement("div");this.contentDiv_.id=this.infoWindowId_+"_contents";this.contentDiv_.innerHTML=this.html_;this.contentDiv_.style.display="block";this.contentDiv_.style.visibility="hidden";this.wrapperDiv_=document.createElement("div")}ExtInfoWindow.prototype=new GOverlay();ExtInfoWindow.prototype.initialize=function(c){this.map_=c;if(this.maximizeEnabled_){this.maxWidth_=this.map_.getSize().width*0.9;this.maxHeight_=this.map_.getSize().height*0.9}this.defaultStyles={containerWidth:this.map_.getSize().width/2,borderSize:1};this.wrapperParts={tl:{t:0,l:0,w:0,h:0,domElement:null},t:{t:0,l:0,w:0,h:0,domElement:null},tr:{t:0,l:0,w:0,h:0,domElement:null},l:{t:0,l:0,w:0,h:0,domElement:null},r:{t:0,l:0,w:0,h:0,domElement:null},bl:{t:0,l:0,w:0,h:0,domElement:null},b:{t:0,l:0,w:0,h:0,domElement:null},br:{t:0,l:0,w:0,h:0,domElement:null},beak:{t:0,l:0,w:0,h:0,domElement:null},close:{t:0,l:0,w:0,h:0,domElement:null}};if(this.maximizeEnabled_){this.wrapperParts.max={t:0,l:0,w:0,h:0,domElement:null};this.wrapperParts.min={t:0,l:0,w:0,h:0,domElement:null}}for(var b in this.wrapperParts){var e=document.createElement("div");e.id=this.infoWindowId_+"_"+b;e.style.visibility="hidden";document.body.appendChild(e);e=document.getElementById(this.infoWindowId_+"_"+b);var a=this.wrapperParts[b];a.w=parseInt(this.getStyle_(e,"width"),10);a.h=parseInt(this.getStyle_(e,"height"),10);document.body.removeChild(e)}for(var b in this.wrapperParts){if(b=="close"){this.wrapperDiv_.appendChild(this.contentDiv_)}var g=null;if(this.wrapperParts[b].domElement==null){g=document.createElement("div");this.wrapperDiv_.appendChild(g)}else{g=this.wrapperParts[b].domElement}g.id=this.infoWindowId_+"_"+b;g.style.position="absolute";g.style.width=this.wrapperParts[b].w+"px";g.style.height=this.wrapperParts[b].h+"px";g.style.top=this.wrapperParts[b].t+"px";g.style.left=this.wrapperParts[b].l+"px";this.wrapperParts[b].domElement=g}this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);this.container_.id=this.infoWindowId_;var d=this.getStyle_(document.getElementById(this.infoWindowId_),"width");this.container_.style.width=(d==null?this.defaultStyles.containerWidth:d);this.map_.getContainer().appendChild(this.contentDiv_);this.contentWidth=this.getDimensions_(this.container_).width;this.contentDiv_.style.width=this.contentWidth+"px";this.contentDiv_.style.position="absolute";this.container_.appendChild(this.wrapperDiv_);if(this.maximizeEnabled_){this.minWidth_=this.getDimensions_(this.container_).width;console.log(this.minWidth_)}if(this.maximizeEnabled_){thisMap=this.map_;thisMaxWidth=this.maxWidth_;thisMaxHeight=this.maxHeight_;thisContainer=this.container_;thisMaxContent=this.maxContent_;if(this.marker_){GEvent.trigger(this.marker_,"extinfowindowbeforeclose")}thisMinWidth=this.container_.style.width;thisMinHeight=this.container_.style.height;GEvent.addDomListener(this.wrapperParts.max.domElement,"click",function(){var h=thisMap.getExtInfoWindow();h.container_.style.width=thisMaxWidth+"px";h.ajaxRequest_(thisMaxContent);if(this.marker_){GEvent.trigger(this.marker_,"extinfowindowclose")}h.isMaximized_=true;h.redraw(true);h.toggleMaxMin_()});GEvent.addDomListener(this.wrapperParts.min.domElement,"click",function(){var h=thisMap.getExtInfoWindow();h.container_.style.width=thisMinWidth;h.container_.style.height=thisMinHeight;if(h.ajaxUrl_!=null){h.ajaxRequest_(this.ajaxUrl_)}else{h.contentDiv_.innerHTML=h.html_}h.isMaximized_=false;h.redraw(true);h.resize();h.toggleMaxMin_()});this.toggleMaxMin_()}var f=["mousedown","dblclick","DOMMouseScroll"];for(b=0;b<f.length;b++){GEvent.bindDom(this.container_,f[b],this,this.onClick_)}GEvent.trigger(this.map_,"extinfowindowopen");if(this.ajaxUrl_!=null){this.ajaxRequest_(this.ajaxUrl_)}};ExtInfoWindow.prototype.onClick_=function(a){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else{a.stopPropagation()}};ExtInfoWindow.prototype.remove=function(){if(this.map_.getExtInfoWindow()!=null){GEvent.trigger(this.map_,"extinfowindowbeforeclose");GEvent.clearInstanceListeners(this.container_);if(this.container_.outerHTML){this.container_.outerHTML=""}if(this.container_.parentNode){this.container_.parentNode.removeChild(this.container_)}this.container_=null;GEvent.trigger(this.map_,"extinfowindowclose");this.map_.setExtInfoWindow_(null)}};ExtInfoWindow.prototype.copy=function(){return new ExtInfoWindow(this.marker_,this.infoWindowId_,this.html_,this.options_)};ExtInfoWindow.prototype.redraw=function(b){if(!b||this.container_==null){return}var e=this.contentDiv_.offsetHeight;this.contentDiv_.style.height=e+"px";this.contentWidth=this.getDimensions_(this.container_).width;this.contentDiv_.style.width=this.container_.style.width;this.contentDiv_.style.left=this.wrapperParts.l.w+"px";this.contentDiv_.style.top=this.wrapperParts.tl.h+"px";this.contentDiv_.style.visibility="visible";this.wrapperParts.tl.t=0;this.wrapperParts.tl.l=0;this.wrapperParts.t.l=this.wrapperParts.tl.w;this.wrapperParts.t.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.tl.w-this.wrapperParts.tr.w;this.wrapperParts.t.h=this.wrapperParts.tl.h;this.wrapperParts.tr.l=this.wrapperParts.t.w+this.wrapperParts.tl.w;this.wrapperParts.l.t=this.wrapperParts.tl.h;this.wrapperParts.l.h=e;this.wrapperParts.r.l=this.contentWidth+this.wrapperParts.l.w;this.wrapperParts.r.t=this.wrapperParts.tr.h;this.wrapperParts.r.h=e;this.wrapperParts.bl.t=e+this.wrapperParts.tl.h;this.wrapperParts.b.l=this.wrapperParts.bl.w;this.wrapperParts.b.t=e+this.wrapperParts.tl.h;this.wrapperParts.b.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.bl.w-this.wrapperParts.br.w;this.wrapperParts.b.h=this.wrapperParts.bl.h;this.wrapperParts.br.l=this.wrapperParts.b.w+this.wrapperParts.bl.w;this.wrapperParts.br.t=e+this.wrapperParts.tr.h;this.wrapperParts.beak.l=this.borderSize_+(this.contentWidth/2)-(this.wrapperParts.beak.w/2);this.wrapperParts.beak.t=this.wrapperParts.bl.t+this.wrapperParts.bl.h-this.borderSize_;this.wrapperParts.close.l=this.wrapperParts.tr.l+this.wrapperParts.tr.w-this.wrapperParts.close.w-this.borderSize_;this.wrapperParts.close.t=this.borderSize_;if(this.maximizeEnabled_){this.wrapperParts.max.l=this.wrapperParts.close.l-this.wrapperParts.max.w-5;this.wrapperParts.max.t=this.wrapperParts.close.t;this.wrapperParts.min.l=this.wrapperParts.max.l;this.wrapperParts.min.t=this.wrapperParts.max.t}for(var d in this.wrapperParts){if(d=="close"){this.wrapperDiv_.insertBefore(this.contentDiv_,this.wrapperParts[d].domElement)}var h=null;if(this.wrapperParts[d].domElement==null){h=document.createElement("div");this.wrapperDiv_.appendChild(h)}else{h=this.wrapperParts[d].domElement}h.id=this.infoWindowId_+"_"+d;h.style.position="absolute";h.style.width=this.wrapperParts[d].w+"px";h.style.height=this.wrapperParts[d].h+"px";h.style.top=this.wrapperParts[d].t+"px";h.style.left=this.wrapperParts[d].l+"px";this.wrapperParts[d].domElement=h}var c=this.marker_;var a=this.map_;GEvent.addDomListener(this.wrapperParts.close.domElement,"click",function(){a.closeExtInfoWindow()});var g=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());this.container_.style.position="absolute";var f=this.marker_.getIcon();this.container_.style.left=(g.x-(this.contentWidth/2)-f.iconAnchor.x+f.infoWindowAnchor.x)+"px";this.container_.style.top=(g.y-this.wrapperParts.bl.h-e-this.wrapperParts.tl.h-this.wrapperParts.beak.h-f.iconAnchor.y+f.infoWindowAnchor.y+this.borderSize_)+"px";this.container_.style.display="block";if(this.map_.getExtInfoWindow()!=null){this.repositionMap_()}};ExtInfoWindow.prototype.toggleMaxMin_=function(){if(this.wrapperParts.max.domElement!=null&&this.wrapperParts.min.domElement!=null){if(this.isMaximized_){this.wrapperParts.max.domElement.style.display="none";this.wrapperParts.min.domElement.style.display="block"}else{this.wrapperParts.max.domElement.style.display="block";this.wrapperParts.min.domElement.style.display="none"}}};ExtInfoWindow.prototype.resize=function(){var c=this.contentDiv_.cloneNode(true);c.id=this.infoWindowId_+"_tempContents";c.style.visibility="hidden";c.style.height="auto";document.body.appendChild(c);c=document.getElementById(this.infoWindowId_+"_tempContents");var e=c.offsetHeight;if(e>89){e=e+12}document.body.removeChild(c);this.contentDiv_.style.height=e+"px";var g=this.container_.offsetWidth;var f=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var b=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;var a=this.wrapperParts.t.domElement.offsetTop;this.wrapperParts.l.domElement.style.height=e+"px";this.wrapperParts.r.domElement.style.height=e+"px";var d=this.wrapperParts.b.domElement.offsetTop-e;this.wrapperParts.l.domElement.style.top=d+"px";this.wrapperParts.r.domElement.style.top=d+"px";this.contentDiv_.style.top=d+"px";windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height,10);d-=windowTHeight;this.wrapperParts.close.domElement.style.top=d+this.borderSize_+"px";this.wrapperParts.tl.domElement.style.top=d+"px";this.wrapperParts.t.domElement.style.top=d+"px";this.wrapperParts.tr.domElement.style.top=d+"px";this.repositionMap_()};ExtInfoWindow.prototype.repositionMap_=function(){var d=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());var l=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());var b=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var e=0;var m=0;var p=this.paddingX_;var r=this.paddingY_;var a=this.marker_.getIcon().infoWindowAnchor;var g=this.marker_.getIcon().iconAnchor;var i=this.wrapperParts.t.domElement;var q=this.wrapperParts.l.domElement;var f=this.wrapperParts.b.domElement;var k=this.wrapperParts.r.domElement;var j=this.wrapperParts.beak.domElement;var o=b.y-(-a.y+g.y+this.getDimensions_(j).height+this.getDimensions_(f).height+this.getDimensions_(q).height+this.getDimensions_(i).height+this.paddingY_);if(o<d.y){m=d.y-o}else{var n=b.y+this.paddingY_;if(n>=l.y){m=-(n-l.y)}}var h=Math.round(b.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(k).width+this.paddingX_+a.x-g.x);if(h>d.x){e=-(h-d.x)}else{var c=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(q).width+this.borderSize_+this.paddingX_)-b.x-a.x+g.x);if(c<l.x){e=l.x-c}}if(e!=0||m!=0&&this.map_.getExtInfoWindow()!=null){if((m<0-this.maxPanning_||m>this.maxPanning_)&&(e<0-this.maxPanning_||e>this.maxPanning_)){this.map_.setCenter(this.marker_.getPoint())}else{this.map_.panBy(new GSize(e,m))}}};ExtInfoWindow.prototype.ajaxRequest_=function(a){var b=this.map_;var c=this.callback_;GDownloadUrl(a,function(f,d){if(b.getExtInfoWindow()!==null){var e=document.getElementById(b.getExtInfoWindow().infoWindowId_+"_contents");if(f==null||d==-1){e.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+a+'"</span>'}else{e.innerHTML=f}if(c!=null){c()}}GEvent.trigger(b,"extinfowindowupdate");b.getExtInfoWindow().resize()})};ExtInfoWindow.prototype.getDimensions_=function(b){var h=this.getStyle_(b,"display");if(h!="none"&&h!=null){return{width:b.offsetWidth,height:b.offsetHeight}}var f=b.style;var c=f.visibility;var d=f.position;var a=f.display;f.visibility="hidden";f.position="absolute";f.display="block";var e=b.clientWidth;var g=b.clientHeight;f.display=a;f.position=d;f.visibility=c;return{width:e,height:g}};ExtInfoWindow.prototype.getStyle_=function(d,b){var e=false;b=this.camelize_(b);if(d.id==this.infoWindowId_&&b=="width"&&d.style.display=="none"){d.style.visibility="hidden";d.style.display=""}var c=d.style[b];if(!c){if(document.defaultView&&document.defaultView.getComputedStyle){var a=document.defaultView.getComputedStyle(d,null);c=a?a[b]:null}else{if(d.currentStyle){c=d.currentStyle[b]}}}if((c=="auto")&&(b=="width"||b=="height")&&(this.getStyle_(d,"display")!="none")){if(b=="width"){c=d.offsetWidth}else{c=d.offsetHeight}}if(d.id==this.infoWindowId_&&b=="width"&&d.style.display!="none"){d.style.display="none";d.style.visibility="visible"}return(c=="auto")?null:c};ExtInfoWindow.prototype.camelize_=function(e){var a=e.split("-"),d=a.length;if(d==1){return a[0]}var c=e.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0];for(var b=1;b<d;b++){c+=a[b].charAt(0).toUpperCase()+a[b].substring(1)}return c};GMap.prototype.ExtInfoWindowInstance_=null;GMap.prototype.ClickListener_=null;GMap.prototype.InfoWindowListener_=null;GMarker.prototype.openExtInfoWindow=function(b,c,a,d){if(b==null){throw"Error in GMarker.openExtInfoWindow: map cannot be null";return false}if(c==null||c==""){throw"Error in GMarker.openExtInfoWindow: must specify a cssId";return false}b.closeInfoWindow();if(b.getExtInfoWindow()!=null){b.closeExtInfoWindow()}if(b.getExtInfoWindow()==null){b.setExtInfoWindow_(new ExtInfoWindow(this,c,a,d));if(b.ClickListener_==null){b.ClickListener_=GEvent.addListener(b,"click",function(e){if(!e&&b.getExtInfoWindow()!=null){b.closeExtInfoWindow()}})}if(b.InfoWindowListener_==null){b.InfoWindowListener_=GEvent.addListener(b,"infowindowopen",function(e){if(b.getExtInfoWindow()!=null){b.closeExtInfoWindow()}})}b.addOverlay(b.getExtInfoWindow())}};GMarker.prototype.closeExtInfoWindow=function(a){if(a.getExtInfoWindow()!=null){a.closeExtInfoWindow()}};GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_};GMap2.prototype.setExtInfoWindow_=function(a){this.ExtInfoWindowInstance_=a};GMap2.prototype.closeExtInfoWindow=function(){if(this.getExtInfoWindow()!=null){this.ExtInfoWindowInstance_.remove()}};