function ExtInfoWindow(A,B,C,D){this.html_=C;this.marker_=A;this.infoWindowId_=B;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.maxH_=this.options_.maxHeight==null?null:this.options_.maxHeight;this.minH_=this.options_.minHeight==null?50:this.options_.maxHeight;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.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(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;console.log(this.minWidth_);}if(this.maximizeEnabled_){thisMap=this.map_;thisMaxWidth=this.maxWidth_;thisMaxHeight=this.maxHeight_;thisContainer=this.container_;thisMaxContent=this.maxContent_;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);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(D=0;D<F.length;D++){GEvent.bindDom(this.container_,F[D],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(F){if(!F||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 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_.getPoint());this.container_.style.position="absolute";var A=this.marker_.getIcon();this.container_.style.left=(B.x-(this.contentWidth/2)-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.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 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);if(E>this.maxH_){E=this.maxH_;}if(E<this.minH_){E=150;}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.repositionMap_=function(){var J=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());var A=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());var H=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var P=0;var N=0;var L=this.paddingX_;var K=this.paddingY_;var D=this.marker_.getIcon().infoWindowAnchor;var C=this.marker_.getIcon().iconAnchor;var F=this.wrapperParts.t.domElement;var I=this.wrapperParts.l.domElement;var Q=this.wrapperParts.b.domElement;var G=this.wrapperParts.r.domElement;var B=this.wrapperParts.beak.domElement;var M=H.y-(-D.y+C.y+this.getDimensions_(B).height+this.getDimensions_(Q).height+this.getDimensions_(I).height+this.getDimensions_(F).height+this.paddingY_);if(M<J.y){N=J.y-M;}else{var R=H.y+this.paddingY_;if(R>=A.y){N=-(R-A.y);}}var O=Math.round(H.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(G).width+this.paddingX_+D.x-C.x);if(O>J.x){P=-(O-J.x);}else{var E=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(I).width+this.borderSize_+this.paddingX_)-H.x-D.x+C.x);if(E<A.x){P=A.x-E;}}if(P!=0||N!=0&&this.map_.getExtInfoWindow()!=null){this.map_.panBy(new GSize(P,N));}};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.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();}};