var R_MAPTYPE_CONTROL_BUTTON_WIDTH=85;var R_MAPTYPE_CONTROL_BUTTON_HEIGHT=31;var R_MAPTYPE_CONTROL_BUTTON_SPACE=0;var R_MAPTYPE_CONTROL_ACTIVE_COLOR="white";var R_MAPTYPE_CONTROL_DEACTIVE_COLOR="black";var R_MAPTYPE_CONTROL_ACTIVE_BGIMAGE=R_GMAP_STYLE_ROOT+"/img_btn_maptype_act.png";var R_MAPTYPE_CONTROL_DEACTIVE_BGIMAGE=R_GMAP_STYLE_ROOT+"/img_btn_maptype.png";function ReallyMapTypeControl(){}ReallyMapTypeControl.prototype=new GControl();ReallyMapTypeControl.prototype.buttonElements=[];ReallyMapTypeControl.prototype.initialize=function(C){var A=C.getMapTypes();this.container=document.createElement("div");this.container.style.height=R_MAPTYPE_CONTROL_BUTTON_HEIGHT+"px";for(var B=0;B<A.length;B++){this.addMapType_(A[B])}GEvent.addListener(C,"maptypechanged",GEvent.callback(this,function(){var E=C.getCurrentMapType();for(var D=0;D<this.buttonElements.length;D++){if(this.buttonElements[D].type==E){this.buttonElements[D].button.style.color=R_MAPTYPE_CONTROL_ACTIVE_COLOR;ReallyMapTypeControl.setBgImage_(this.buttonElements[D].button,R_MAPTYPE_CONTROL_ACTIVE_BGIMAGE)}else{this.buttonElements[D].button.style.color=R_MAPTYPE_CONTROL_DEACTIVE_COLOR;ReallyMapTypeControl.setBgImage_(this.buttonElements[D].button,R_MAPTYPE_CONTROL_DEACTIVE_BGIMAGE)}}}));GEvent.addListener(C,"addmaptype",GEvent.callback(this,this.addMapType_));GEvent.addListener(C,"removemaptype",GEvent.callback(this,this.removeMapType_));C.getContainer().appendChild(this.container);return(this.container)};ReallyMapTypeControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(8,0))};ReallyMapTypeControl.prototype.addMapType_=function(B){for(var A=0;A<this.buttonElements.length;A++){if(this.buttonElements[A].type==B){return }}var C=this.createButtonElement(B.getName());C.style.left=(this.buttonElements.length*(R_MAPTYPE_CONTROL_BUTTON_WIDTH+R_MAPTYPE_CONTROL_BUTTON_SPACE))+"px";this.buttonElements.push({type:B,button:C});this.container.style.width=(this.buttonElements.length*(R_MAPTYPE_CONTROL_BUTTON_WIDTH+R_MAPTYPE_CONTROL_BUTTON_SPACE))+"px";this.container.appendChild(C);GEvent.addDomListener(C,"click",GEvent.callbackArgs(this,function(D){map.setMapType(D)},B))};ReallyMapTypeControl.prototype.removeMapType_=function(B){for(var A=0;A<this.buttonElements.length;A++){if(this.buttonElements[A].type==B){GEvent.clearListeners(this.buttonElements[A].button,"click");this.container.removeChild(this.buttonElements[A].button);this.buttonElements.splice(A,1);this.container.style.width=(this.buttonElements.length*(R_MAPTYPE_CONTROL_BUTTON_WIDTH+R_MAPTYPE_CONTROL_BUTTON_SPACE))+"px";for(;A<this.buttonElements.length;A++){this.buttonElements[A].button.style.left=(A*(R_MAPTYPE_CONTROL_BUTTON_WIDTH+R_MAPTYPE_CONTROL_BUTTON_SPACE))+"px"}break}}};ReallyMapTypeControl.prototype.createButtonElement=function(C,B){var A=document.createElement("div");A.appendChild(document.createTextNode(C));A.style.width=R_MAPTYPE_CONTROL_BUTTON_WIDTH+"px";A.style.height=R_MAPTYPE_CONTROL_BUTTON_HEIGHT+"px";if(B){A.style.color=R_MAPTYPE_CONTROL_ACTIVE_COLOR;ReallyMapTypeControl.setBgImage_(A,R_MAPTYPE_CONTROL_ACTIVE_BGIMAGE)}else{A.style.color=R_MAPTYPE_CONTROL_DEACTIVE_COLOR;ReallyMapTypeControl.setBgImage_(A,R_MAPTYPE_CONTROL_DEACTIVE_BGIMAGE)}A.style.font="small Arial";A.style.margin="0px";A.style.lineHeight="25px";A.style.textAlign="center";A.style.verticalAlign="bottom";A.style.cursor="pointer";A.style.position="absolute";return(A)};ReallyMapTypeControl.setBgImage_=function(B,C){var A=navigator.appVersion;if(A.match("MSIE 6.0")||A.match("MSIE 5.")){B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"', sizingMethod='crop')"}else{B.style.background="url("+C+") no-repeat left top"}};var R_ZOOM_CONTROL_BUTTON_WIDTH=26;var R_ZOOM_CONTROL_BUTTON_HEIGHT=26;var R_ZOOM_CONTROL_BUTTON_SPACE=4;var R_ZOOM_CONTROL_SLIDER_SPACE=8;var R_ZOOM_CONTROL_SLIDER_WIDTH=26;var R_ZOOM_CONTROL_SLIDER_HEIGHT=120;var R_ZOOM_CONTROL_HANDLE_WIDTH=26;var R_ZOOM_CONTROL_HANDLE_HEIGHT=10;function ReallyZoomControl(){}ReallyZoomControl.prototype=new GControl();ReallyZoomControl.prototype.initialize=function(F){this.container=document.createElement("div");this.drag=null;var C=this.createButtonElement("img_btn_up.png",R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE,0);this.container.appendChild(C);GEvent.addDomListener(C,"click",function(){F.panDirection(0,1)});var G=this.createButtonElement("img_btn_left.png",0,R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE);this.container.appendChild(G);GEvent.addDomListener(G,"click",function(){F.panDirection(1,0)});var H=this.createButtonElement("img_btn_center.png",R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE,R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE);this.container.appendChild(H);GEvent.addDomListener(H,"click",function(){F.returnToSavedPosition()});var E=this.createButtonElement("img_btn_right.png",(R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE)*2,R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE);this.container.appendChild(E);GEvent.addDomListener(E,"click",function(){F.panDirection(-1,0)});var B=this.createButtonElement("img_btn_down.png",R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE,(R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE)*2);this.container.appendChild(B);GEvent.addDomListener(B,"click",function(){F.panDirection(0,-1)});var D=this.createButtonElement("img_btn_zoomin.png",R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE,((R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE)*3)+R_ZOOM_CONTROL_SLIDER_SPACE);this.container.appendChild(D);GEvent.addDomListener(D,"click",function(){F.zoomIn()});var A=this.createButtonElement("img_btn_zoomout.png",R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE,((R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE)*4)+R_ZOOM_CONTROL_SLIDER_SPACE);this.container.appendChild(A);GEvent.addDomListener(A,"click",function(){F.zoomOut()});F.getContainer().appendChild(this.container);return(this.container)};ReallyZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(15,15))};ReallyZoomControl.prototype.createZoomElement_=function(C){var B=document.createElement("div");B.style.width=R_ZOOM_CONTROL_SLIDER_WIDTH+"px";B.style.height=R_ZOOM_CONTROL_SLIDER_HEIGHT+"px";B.style.left=R_ZOOM_CONTROL_BUTTON_WIDTH+R_ZOOM_CONTROL_BUTTON_SPACE+"px";B.style.top=((R_ZOOM_CONTROL_BUTTON_HEIGHT+R_ZOOM_CONTROL_BUTTON_SPACE)*4)+R_ZOOM_CONTROL_SLIDER_SPACE+"px";B.style.backgroundColor="white";B.style.cursor="pointer";B.style.position="relative";B.style.zIndex=10;var A=R_ZOOM_CONTROL_SLIDER_HEIGHT-R_ZOOM_CONTROL_HANDLE_HEIGHT;var D=document.createElement("div");D.style.width=R_ZOOM_CONTROL_HANDLE_WIDTH+"px";D.style.height=R_ZOOM_CONTROL_HANDLE_HEIGHT+"px";D.style.position="absolute";D.style.backgroundColor="red";D.style.zIndex=1000;D.style.top=(A-((A*C.getZoom())/17))+"px";GEvent.addListener(C,"zoomend",GEvent.callback(D,function(F,E){this.style.top=(A-((A*E)/17))+"px"}));GEvent.addDomListener(D,"mousedown",GEvent.callback(this,function(E){this.drag={begin:ReallyZoomControl.getMousePosition(E),left:B.left,top:B.top}}));GEvent.addDomListener(D,"mouseup",GEvent.callback(this,function(E){this.drag=null}));GEvent.addDomListener(D,"mousemove",GEvent.callback(this,function(F){if(this.drag!=null){var G=ReallyZoomControl.getMousePosition(F);G.x-=this.drag.left;G.y-=this.drag.top;var E=(G.y*17)/A;C.setZoom(E)}}));GEvent.addDomListener(D,"dragend",GEvent.callback(D,function(){}));B.appendChild(D);return(B)};ReallyZoomControl.prototype.screenToSlider_=function(B,A){var C={x:B-zoomSliderElement,y:A};return(C)};ReallyZoomControl.prototype.createButtonElement=function(E,A,D){var C=document.createElement("div");C.style.color="black";C.style.width=R_ZOOM_CONTROL_BUTTON_WIDTH+"px";C.style.height=R_ZOOM_CONTROL_BUTTON_HEIGHT+"px";C.style.font="small Arial";C.style.textAlign="center";C.style.cursor="pointer";C.style.position="absolute";C.style.left=""+A+"px";C.style.top=""+D+"px";var B=navigator.appVersion;if(B.match("MSIE 6.0")||B.match("MSIE 5.")){C.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+R_GMAP_STYLE_ROOT+"/"+E+"', sizingMethod='crop')"}else{C.style.background="url("+R_GMAP_STYLE_ROOT+"/"+E+") no-repeat left top"}return(C)};ReallyZoomControl.getMousePosition=function(A){var C=0;var B=0;if(!A){var A=window.event}if(A.pageX||A.pageY){C=A.pageX;B=A.pageY}else{if(A.clientX||A.clientY){C=A.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);B=A.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}}return({x:C,y:B})};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.beakOffset_=this.options_.beakOffset==null?0:this.options_.beakOffset;this.borderSize_=this.options_.borderSize==null?this.beakOffset_:this.options_.borderSize;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";if(this.options_.width!=null){this.container_.style.width=this.options_.width+"px"}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(map){this.map_=map;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}};for(var i in this.wrapperParts){var tempElement=document.createElement("div");tempElement.id=this.infoWindowId_+"_"+i;tempElement.style.visibility="hidden";document.body.appendChild(tempElement);tempElement=document.getElementById(this.infoWindowId_+"_"+i);var tempWrapperPart=eval("this.wrapperParts."+i);tempWrapperPart.w=parseInt(this.getStyle_(tempElement,"width"));tempWrapperPart.h=parseInt(this.getStyle_(tempElement,"height"));document.body.removeChild(tempElement)}for(var i in this.wrapperParts){if(i=="close"){this.wrapperDiv_.appendChild(this.contentDiv_)}var wrapperPartsDiv=null;if(this.wrapperParts[i].domElement==null){wrapperPartsDiv=document.createElement("div");this.wrapperDiv_.appendChild(wrapperPartsDiv)}else{wrapperPartsDiv=this.wrapperParts[i].domElement}wrapperPartsDiv.id=this.infoWindowId_+"_"+i;wrapperPartsDiv.style.position="absolute";wrapperPartsDiv.style.width=this.wrapperParts[i].w+"px";wrapperPartsDiv.style.height=this.wrapperParts[i].h+"px";wrapperPartsDiv.style.top=this.wrapperParts[i].t+"px";wrapperPartsDiv.style.left=this.wrapperParts[i].l+"px";this.wrapperParts[i].domElement=wrapperPartsDiv}this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);this.container_.id=this.infoWindowId_;var containerWidth=this.getStyle_(document.getElementById(this.infoWindowId_),"width");this.container_.style.width=(containerWidth==null?this.defaultStyles.containerWidth:containerWidth);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_);GEvent.bindDom(this.container_,"mousedown",this,this.onClick_);GEvent.bindDom(this.container_,"dblclick",this,this.onClick_);GEvent.bindDom(this.container_,"DOMMouseScroll",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.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.close.l=this.wrapperParts.tr.l+this.wrapperParts.tr.w-this.wrapperParts.close.w-this.borderSize_;this.wrapperParts.close.t=this.borderSize_;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.beakOffset_;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.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.contentDiv_.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);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){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);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}}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.getExtInfWindow()!=null){A.closeExtInfoWindow()}};GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_};GMap2.prototype.setExtInfoWindow_=function(A){this.ExtInfoWindowInstance_=A};GMap2.prototype.closeExtInfoWindow=function(){if(this.ExtInfoWindowInstance_!=null){this.removeOverlay(this.ExtInfoWindowInstance_);if(this.ExtInfoWindowInstance_!=null){this.ExtInfoWindowInstance_.remove()}this.ExtInfoWindowInstance_=null}};function log(A){}function ReallyDirections(A){this.mapElement=A.mapElement;this.dirElement=A.dirElement;this.loadingElement=A.loadingElement;this.addressInput=(typeof A.addressInput!="undefined")?A.addressInput:null;this.language=A.language;this.destination=A.destination;this.geocoder=null;this.map=null;this.gdir=null;this.mgr=null;this.beginIcon;this.beginMarker=null;this.endIcon;this.endMarker=null;this._replaceMarker=function(E,D){var C=new GMarker(E.getLatLng(),D);this.map.addOverlay(C);this.map.removeOverlay(E);GEvent.addListener(C,"click",function(){GEvent.trigger(E,"click")});return(C)};if(!GBrowserIsCompatible()){this.mapElement.innerHTML="<center><h3>"+ReallyDirections.texts[this.language].BROWSER_SUPPORT+"</h3></center>"}else{log("Creating map...");mapOptions={};this.map=new GMap2(this.mapElement,mapOptions);this.map.addControl(new ReallyZoomControl());this.map.addControl(new ReallyMapTypeControl());this.map.enableDoubleClickZoom();this.gdir=new GDirections(this.map);GEvent.addListener(this.gdir,"addoverlay",GEvent.callback(this,function(){log("addoverlay()");if(this.beginMarker!=null){this.map.removeOverlay(this.beginMarker)}this.beginMarker=this._replaceMarker(this.gdir.getMarker(0),{icon:this.beginIcon});this.map.removeOverlay(this.gdir.getMarker(this.gdir.getNumRoutes()));log("addoverlay() exits")}));GEvent.addListener(this.gdir,"error",GEvent.callback(this,function(){var C=this.gdir.getStatus().code;switch(C){case G_GEO_UNKNOWN_ADDRESS:alert(ReallyDirections.texts[this.language].LOCATION_NOT_FOUND);break;case G_GEO_BAD_REQUEST:alert("A directions request could not be successfully parsed.");break;case G_GEO_SERVER_ERROR:alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.");break;case G_GEO_MISSING_QUERY:alert("The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.");break;case G_GEO_UNKNOWN_ADDRESS:alert("No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect.");break;case G_GEO_UNAVAILABLE_ADDRESS:alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.");break;case G_GEO_UNKNOWN_DIRECTIONS:alert(ReallyDirections.texts[this.language].ROUTE_NOT_FOUND);break;case G_GEO_BAD_KEY:alert("The given key is either invalid or does not match the domain for which it was given.");break;case G_GEO_TOO_MANY_QUERIES:alert("The given key has gone over the requests limit in the 24 hour period.");break;default:alert("An unknown error occurred.\nError code: "+C)}this._hideLoading()}));this.dirSummary=null;this.dirSteps=null;GEvent.addListener(this.gdir,"load",GEvent.callback(this,function(){while(this.dirElement.hasChildNodes()){this.dirElement.removeChild(this.dirElement.firstChild)}var E=document.createElement("div");E.innerHTML=this.gdir.getSummaryHtml();var L=document.createElement("table");L.cellSpacing=0;var C=document.createElement("tbody");var M=this.gdir.getNumRoutes();for(var J=0;J<M;J++){var O=this.gdir.getRoute(J);var H=O.getNumSteps();log("Number of steps on route #"+J+": "+H);for(var I=0;I<H;I++){var G=O.getStep(I);var D=document.createElement("tr");GEvent.addDomListener(D,"click",GEvent.callbackArgs(this,function(P){if(this.map.getExtInfoWindow()!=null){this.map.closeExtInfoWindow()}this.map.showMapBlowup(P.getLatLng())},G));var F=document.createElement("td");F.className="dirstepidx";F.innerHTML=(""+(I+1)+".");var N=document.createElement("td");N.className="dirstepdesc";N.innerHTML=(G.getDescriptionHtml());var K=document.createElement("td");K.className="dirstepdist";K.innerHTML=(G.getDistance().html);D.appendChild(F);D.appendChild(N);D.appendChild(K);C.appendChild(D)}}L.appendChild(C);this.dirElement.appendChild(E);this.dirElement.appendChild(L);this._hideLoading()}));var B=new GLatLng(this.destination.lat,this.destination.lon);this.map.setCenter(B,15);log("Creating geocoder...");this.geocoder=new GClientGeocoder();this.geocoder.setBaseCountryCode("fi");_mHL="fi";_mHost="http://maps.google.fi";this.beginIcon=new GIcon();this.beginIcon.image="http://www.juha-elektro.fi/user_data/css/images/gmap/img_gm_mark_startpoint.png";this.beginIcon.iconSize=new GSize(28,28);this.beginIcon.iconAnchor=new GPoint(14,14);this.beginIcon.infoWindowAnchor=new GPoint(14,14);this.endIcon=new GIcon();this.endIcon.image="http://www.juha-elektro.fi/user_data/css/images/gmap/img_gm_mark_endpoint.png";this.endIcon.iconSize=new GSize(28,28);this.endIcon.iconAnchor=new GPoint(14,14);this.endIcon.infoWindowAnchor=new GPoint(0,-24);this.endMarker=new GMarker(B,{icon:this.endIcon});GEvent.addListener(this.endMarker,"click",GEvent.callback(this,function(){this.endMarker.openExtInfoWindow(this.map,"reallyWindow",this.destination.dialog,{borderSize:12,beakOffset:-2,paddingX:5,paddingY:5,width:200})}));this.map.addOverlay(this.endMarker);GEvent.trigger(this.endMarker,"click")}}ReallyDirections.prototype={};ReallyDirections.prototype._showLoading=function(){if(this.loadingElement==null){return }this.loadingElement.style.visibility="visible"};ReallyDirections.prototype._hideLoading=function(){if(this.loadingElement==null){return }this.loadingElement.style.visibility="hidden"};ReallyDirections.prototype.setFromAddress=function(A){this._showLoading();if(!/^.*,.*,.*$/.test(A)){A+=", Suomi"}log("Looking for address: "+A);this.geocoder.getLocations(A,GEvent.callback(this,function(B){if(!B||B.Status.code!=200){log("geocoder.getLocations() failed")}else{switch(B.Placemark.length){case 0:this._hideLoading();alert(ReallyDirections.texts[this.language].LOCATION_NOT_FOUND);return ;case 1:this.gdir.load("from: "+A+" to: "+this.destination.address,{locale:this.language,getSteps:true});break;default:this._hideLoading();alert(ReallyDirections.texts[this.language].FOUND_MANY);break}}}))};ReallyDirections.texts={fi:{LANG_CUSTOMERSERVICE:"Asiakaspalvelu",BROWSER_SUPPORT:"Käyttämäsi selain ei ole yhteensopiva Google Mapsin kanssa.",LOCATION_NOT_FOUND:"Antamaasi lähtöosoitetta ei löytynyt. Osoite voi olla suhteellisen uusi tai virheellinen",ROUTE_NOT_FOUND:"Reittiä ei löytynyt.",FOUND_MANY:"Antamallasi merkkijonolla löytyi useita osoitteita. Tarkenna hakua nähdäksesi reitin."},en:{LANG_CUSTOMERSERVICE:"Customer service",BROWSER_SUPPORT:"Your browser does not support Google Maps.",LOCATION_NOT_FOUND:"No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.",ROUTE_NOT_FOUND:"The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region.",FOUND_MANY:"Search query you gave matches multiple addresses. Please refine your query."}};
