function ExtInfoWindow(a,b,c,d){this.html_=c;this.marker_=a;this.infoWindowId_=b;this.options_=(typeof d=="undefined"||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.noCloseOnClick_=this.options_.noCloseOnClick==null?false:this.options_.noCloseOnClick;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");this.isRepositioning=false;this.triggerWindowOpenEvent=false}ExtInfoWindow.prototype=new GOverlay();ExtInfoWindow.prototype.initialize=function(g){this.map_=g;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 d in this.wrapperParts){var a=document.createElement("div");a.id=this.infoWindowId_+"_"+d;a.style.visibility="hidden";document.body.appendChild(a);a=document.getElementById(this.infoWindowId_+"_"+d);var c=this.wrapperParts[d];c.w=parseInt(this.getStyle_(a,"width"),10);c.h=parseInt(this.getStyle_(a,"height"),10);document.body.removeChild(a)}for(var d in this.wrapperParts){if(d=="close"){this.wrapperDiv_.appendChild(this.contentDiv_)}var b=null;if(this.wrapperParts[d].domElement==null){b=document.createElement("div");this.wrapperDiv_.appendChild(b)}else{b=this.wrapperParts[d].domElement}b.id=this.infoWindowId_+"_"+d;b.style.position="absolute";b.style.width=this.wrapperParts[d].w+"px";b.style.height=this.wrapperParts[d].h+"px";b.style.top=this.wrapperParts[d].t+"px";b.style.left=this.wrapperParts[d].l+"px";this.wrapperParts[d].domElement=b}this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);this.container_.id=this.infoWindowId_;var e=this.getStyle_(document.getElementById(this.infoWindowId_),"width");this.container_.style.width=(e==null?this.defaultStyles.containerWidth:e);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}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","onmousewheel"];for(d=0;d<f.length;d++){GEvent.bindDom(this.container_,f[d],this,this.onClick_)}if((navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all)||navigator.userAgent.indexOf("Opera")>-1){this.container_.attachEvent("onmousewheel",this.onClick_)}if(navigator.userAgent.indexOf("AppleWebKit/")>-1){this.container_.onmousewheel=this.onClick_}this.triggerWindowOpenEvent=true;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&&this.container_!=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);if(this.options_.removeMarkerOnClose_){this.map_.removeOverlay(this.marker_)}}};ExtInfoWindow.prototype.copy=function(){return new ExtInfoWindow(this.marker_,this.infoWindowId_,this.html_,this.options_)};ExtInfoWindow.prototype.redraw=function(f){if(!f||this.container_==null){return}if(typeof this.clientHeight!="undefined"){var e=this.contentDiv_.clientHeight}else{var e=this.contentDiv_.offsetHeight}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.wrapperParts.l.w+this.wrapperParts.r.w+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 c=null;if(this.wrapperParts[d].domElement==null){c=document.createElement("div");this.wrapperDiv_.appendChild(c)}else{c=this.wrapperParts[d].domElement}c.id=this.infoWindowId_+"_"+d;c.style.position="absolute";c.style.width=this.wrapperParts[d].w+"px";c.style.height=this.wrapperParts[d].h+"px";c.style.top=this.wrapperParts[d].t+"px";c.style.left=this.wrapperParts[d].l+"px";this.wrapperParts[d].domElement=c}var h=this.marker_;var g=this.map_;GEvent.addDomListener(this.wrapperParts.close.domElement,"click",function(){g.closeExtInfoWindow()});var b=this.map_.fromLatLngToDivPixel(this.marker_.getLatLng());this.container_.style.position="absolute";var a=this.marker_.getIcon();this.container_.style.left=(b.x-(this.contentWidth/2)-this.wrapperParts.l.w-a.iconAnchor.x+a.infoWindowAnchor.x)+"px";this.container_.style.top=(b.y-this.wrapperParts.bl.h-e-this.wrapperParts.tl.h-this.wrapperParts.beak.h-a.iconAnchor.y+a.infoWindowAnchor.y+this.borderSize_)+"px";this.container_.style.display="block";if(this.triggerWindowOpenEvent){GEvent.trigger(this.map_,"extinfowindowopen");this.triggerWindowOpenEvent=false}if(this.map_.getExtInfoWindow()!=null&&!this.isRepositioning){this.isRepositioning=true;this.repositionMap_();this.isRepositioning=false}};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 a=this.contentDiv_.cloneNode(true);a.id=this.infoWindowId_+"_tempContents";a.style.visibility="hidden";a.style.height="auto";document.body.appendChild(a);a=document.getElementById(this.infoWindowId_+"_tempContents");var e=a.offsetHeight;document.body.removeChild(a);this.contentDiv_.style.height=e+"px";var b=this.container_.offsetWidth;var d=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var c=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;var g=this.wrapperParts.t.domElement.offsetTop;this.wrapperParts.l.domElement.style.height=e+"px";this.wrapperParts.r.domElement.style.height=e+"px";var f=this.wrapperParts.b.domElement.offsetTop-e;this.wrapperParts.l.domElement.style.top=f+"px";this.wrapperParts.r.domElement.style.top=f+"px";this.contentDiv_.style.top=f+"px";windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height,10);f-=windowTHeight;this.wrapperParts.close.domElement.style.top=f+this.borderSize_+"px";this.wrapperParts.tl.domElement.style.top=f+"px";this.wrapperParts.t.domElement.style.top=f+"px";this.wrapperParts.tr.domElement.style.top=f+"px";this.repositionMap_()};ExtInfoWindow.prototype.getOptions=function(){return this.options_};ExtInfoWindow.prototype.repositionMap_=function(){var p=this.map_.fromLatLngToContainerPixel(this.map_.getCenter());var b=this.map_.fromLatLngToDivPixel(this.map_.getCenter());var v=new GPoint(b.x-p.x,b.y-p.y);var e=this.map_.getSize();var a=new GPoint(v.x,v.y+e.height);var l=new GPoint(v.x+e.width,v.y);var j=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var s=0;var r=0;var n=this.paddingX_;var m=this.paddingY_;var f=this.marker_.getIcon().infoWindowAnchor;var d=this.marker_.getIcon().iconAnchor;var h=this.wrapperParts.t.domElement;var k=this.wrapperParts.l.domElement;var u=this.wrapperParts.b.domElement;var i=this.wrapperParts.r.domElement;var c=this.wrapperParts.beak.domElement;var o=j.y-(-f.y+d.y+this.getDimensions_(c).height+this.getDimensions_(u).height+this.getDimensions_(k).height+this.getDimensions_(h).height+this.paddingY_);if(o<l.y){r=l.y-o}else{var t=j.y+this.paddingY_;if(t>=a.y){r=Math.max(-(t-a.y),l.y-o)}}var q=Math.round(j.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(i).width+this.paddingX_+f.x-d.x);if(q>l.x){s=-(q-l.x)}else{var g=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(k).width+this.borderSize_+this.paddingX_)-j.x-f.x+d.x);if(g<a.x){s=a.x-g}}if((s!=0||r!=0)&&this.map_.getExtInfoWindow()!=null){if((r<0-this.maxPanning_||r>this.maxPanning_)&&(s<0-this.maxPanning_||s>this.maxPanning_)){this.map_.setCenter(this.marker_.getPoint())}else{this.map_.panBy(new GSize(s,r))}}};ExtInfoWindow.prototype.ajaxRequest_=function(a){var c=this.map_;var b=this.callback_;GDownloadUrl(a,function(e,d){if(c.getExtInfoWindow()!==null){var f=document.getElementById(c.getExtInfoWindow().infoWindowId_+"_contents");if(e==null||d==-1){f.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+a+'"</span>'}else{f.innerHTML=e}if(b!=null){b()}c.getExtInfoWindow().resize()}GEvent.trigger(c,"extinfowindowupdate")})};ExtInfoWindow.prototype.getDimensions_=function(c){var g=this.getStyle_(c,"display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var h=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e}};ExtInfoWindow.prototype.getStyle_=function(b,c){var e=false;c=this.camelize_(c);if(b.id==this.infoWindowId_&&c=="width"&&b.style.display=="none"){b.style.visibility="hidden";b.style.display=""}var d=b.style[c];if(!d){if(document.defaultView&&document.defaultView.getComputedStyle){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}else{if(b.currentStyle){d=b.currentStyle[c]}}}if((d=="auto")&&(c=="width"||c=="height")&&(this.getStyle_(b,"display")!="none")){if(c=="width"){d=b.offsetWidth}else{d=b.offsetHeight}}if(b.id==this.infoWindowId_&&c=="width"&&b.style.display!="none"){b.style.display="none";b.style.visibility="visible"}return(d=="auto")?null:d};ExtInfoWindow.prototype.camelize_=function(c){var e=c.split("-"),a=e.length;if(a==1){return e[0]}var d=c.charAt(0)=="-"?e[0].charAt(0).toUpperCase()+e[0].substring(1):e[0];for(var b=1;b<a;b++){d+=e[b].charAt(0).toUpperCase()+e[b].substring(1)}return d};GMap.prototype.ExtInfoWindowInstance_=null;GMap.prototype.ClickListener_=null;GMap.prototype.InfoWindowListener_=null;GMarker.prototype.openExtInfoWindow=function(b,d,a,c){if(b==null){throw"Error in GMarker.openExtInfoWindow: map cannot be null";return false}if(d==null||d==""){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,d,a,c));if(b.ClickListener_==null){b.ClickListener_=GEvent.addListener(b,"click",function(e){if(!e&&b.getExtInfoWindow()!=null&&!b.getExtInfoWindow().getOptions().noCloseOnClick){b.closeExtInfoWindow()}})}if(b.InfoWindowListener_==null){b.InfoWindowListener_=GEvent.addListener(b,"infowindowopen",function(e){if(b.getExtInfoWindow()!=null){b.closeExtInfoWindow()}})}b.addOverlay(b.getExtInfoWindow())}};GMap2.prototype.openExtInfoWindow=function(a,f,c,e){if(a==null){throw"Error in GMap2.openExtInfoWindow: point cannot be null";return false}if(f==null||f==""){throw"Error in GMap2.openExtInfoWindow: must specify a cssId";return false}this.closeInfoWindow();if(this.getExtInfoWindow()!=null){this.closeExtInfoWindow()}if(this.getExtInfoWindow()==null){var d=new GIcon(G_DEFAULT_ICON);d.iconSize=new GSize(0,0);d.shadowSize=new GSize(0,0);d.iconAnchor=new GPoint(0,0);d.infoWindowAnchor=new GPoint(0,0);var b=new GMarker(a,{hide:true,icon:d,clickable:false});if(typeof e=="undefined"){e={}}e.removeMarkerOnClose_=true;this.addOverlay(b);this.setExtInfoWindow_(new ExtInfoWindow(b,f,c,e));if(this.ClickListener_==null){this.ClickListener_=GEvent.addListener(this,"click",function(g){if(!g&&this.getExtInfoWindow()!=null&&!map.getExtInfoWindow().getOptions().noCloseOnClick){this.closeExtInfoWindow()}})}if(this.InfoWindowListener_==null){this.InfoWindowListener_=GEvent.addListener(this,"infowindowopen",function(g){if(this.getExtInfoWindow()!=null){this.closeExtInfoWindow()}})}this.addOverlay(this.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()}};