/*
* MapIconMaker v1.0
* Copyright (c) 2008 Pamela Fox
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. 
*
*
*  Author: Pamela Fox
*
*  This gives you static function(s) for creating dynamically sized and
*  colored marker icons using the Charts API marker output.
*/
$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.MapIconMaker=function(){function d(){function e(p){var g=p.width||32;var k=p.height||32;var o=p.primaryColor||"#ff0000";var j=p.strokeColor||"#000000";var l=p.cornerColor||"#ffffff";var n="http://chart.apis.google.com/chart?cht=mm";var h=n+"&chs="+g+"x"+k+"&chco="+l.replace("#","")+","+o.replace("#","")+","+j.replace("#","")+"&ext=.png";var f=new GIcon(G_DEFAULT_ICON);f.image=h;f.iconSize=new GSize(g,k);f.shadowSize=new GSize(Math.floor(g*1.6),k);f.iconAnchor=new GPoint(g/2,k);f.infoWindowAnchor=new GPoint(g/2,Math.floor(k/12));f.printImage=h+"&chof=gif";f.mozPrintImage=h+"&chf=bg,s,ECECD8&chof=gif";var h=n+"&chs="+g+"x"+k+"&chco="+l.replace("#","")+","+o.replace("#","")+","+j.replace("#","");f.transparent=h+"&chf=a,s,ffffff11&ext=.png";f.shadow="";f.imageMap=[g/2,k,(7/16)*g,(5/8)*k,(5/16)*g,(7/16)*k,(7/32)*g,(5/16)*k,(5/16)*g,(1/8)*k,(1/2)*g,0,(11/16)*g,(1/8)*k,(25/32)*g,(5/16)*k,(11/16)*g,(7/16)*k,(9/16)*g,(5/8)*k];for(var m=0;m<f.imageMap.length;m++){f.imageMap[m]=parseInt(f.imageMap[m])}return f}return e}var b=null;function c(e){return new b(e)}function a(){if(b==null){b=d()}}return{createIconMaker:c,init:a}};
/* 
* MarkerManager, v1.0
* Copyright (c) 2007 Google Inc.*/
$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.Marker=function(){function c(){function e(h,f){var j=this;j.map_=h;j.mapZoom_=h.getZoom();j.projection_=h.getCurrentMapType().getProjection();f=f||{};j.tileSize_=e.DEFAULT_TILE_SIZE_;var i=e.DEFAULT_MAX_ZOOM_;if(f.maxZoom!=undefined){i=f.maxZoom}j.maxZoom_=i;j.trackMarkers_=f.trackMarkers;var g;if(typeof f.borderPadding=="number"){g=f.borderPadding}else{g=e.DEFAULT_BORDER_PADDING_}j.swPadding_=new GSize(-g,g);j.nePadding_=new GSize(g,-g);j.borderPadding_=g;j.gridWidth_=[];j.grid_=[];j.grid_[i]=[];j.numMarkers_=[];j.numMarkers_[i]=0;GEvent.bind(h,"moveend",j,j.onMapMoveEnd_);j.removeOverlay_=function(k){h.removeOverlay(k);j.shownMarkers_--};j.addOverlay_=function(k){h.addOverlay(k);j.shownMarkers_++};j.resetManager_();j.shownMarkers_=0;j.shownBounds_=j.getMapGridBounds_()}e.DEFAULT_TILE_SIZE_=1024;e.DEFAULT_MAX_ZOOM_=17;e.DEFAULT_BORDER_PADDING_=100;e.MERCATOR_ZOOM_LEVEL_ZERO_RANGE=256;e.prototype.resetManager_=function(){var h=this;var g=e.MERCATOR_ZOOM_LEVEL_ZERO_RANGE;for(var f=0;f<=h.maxZoom_;++f){h.grid_[f]=[];h.numMarkers_[f]=0;h.gridWidth_[f]=Math.ceil(g/h.tileSize_);g<<=1}};e.prototype.clearMarkers=function(){var f=this;f.processAll_(f.shownBounds_,f.removeOverlay_);f.resetManager_()};e.prototype.getTilePoint_=function(f,h,g){var i=this.projection_.fromLatLngToPixel(f,h);return new GPoint(Math.floor((i.x+g.width)/this.tileSize_),Math.floor((i.y+g.height)/this.tileSize_))};e.prototype.addMarkerBatch_=function(f,i,k){var l=f.getPoint();if(this.trackMarkers_){GEvent.bind(f,"changed",this,this.onMarkerMoved_)}var g=this.getTilePoint_(l,k,GSize.ZERO);for(var h=k;h>=i;h--){var j=this.getGridCellCreate_(g.x,g.y,h);j.push(f);g.x=g.x>>1;g.y=g.y>>1}};e.prototype.isGridPointVisible_=function(k){var f=this;var h=f.shownBounds_.minY<=k.y&&k.y<=f.shownBounds_.maxY;var j=f.shownBounds_.minX;var i=j<=k.x&&k.x<=f.shownBounds_.maxX;if(!i&&j<0){var g=f.gridWidth_[f.shownBounds_.z];i=j+g<=k.x&&k.x<=g-1}return h&&i};e.prototype.onMarkerMoved_=function(k,m,l){var n=this;var h=n.maxZoom_;var i=false;var g=n.getTilePoint_(m,h,GSize.ZERO);var f=n.getTilePoint_(l,h,GSize.ZERO);while(h>=0&&(g.x!=f.x||g.y!=f.y)){var j=n.getGridCellNoCreate_(g.x,g.y,h);if(j){if(n.removeFromArray(j,k)){n.getGridCellCreate_(f.x,f.y,h).push(k)}}if(h==n.mapZoom_){if(n.isGridPointVisible_(g)){if(!n.isGridPointVisible_(f)){n.removeOverlay_(k);i=true}}else{if(n.isGridPointVisible_(f)){n.addOverlay_(k);i=true}}}g.x=g.x>>1;g.y=g.y>>1;f.x=f.x>>1;f.y=f.y>>1;--h}if(i){n.notifyListeners_()}};e.prototype.removeMarker=function(f){var l=this;var h=l.maxZoom_;var j=false;var g=f.getPoint();var i=l.getTilePoint_(g,h,GSize.ZERO);while(h>=0){var k=l.getGridCellNoCreate_(i.x,i.y,h);if(k){l.removeFromArray(k,f)}if(h==l.mapZoom_){if(l.isGridPointVisible_(i)){l.removeOverlay_(f);j=true}}i.x=i.x>>1;i.y=i.y>>1;--h}if(j){l.notifyListeners_()}};e.prototype.addMarkers=function(h,g,k){var j=this.getOptMaxZoom_(k);for(var f=h.length-1;f>=0;f--){this.addMarkerBatch_(h[f],g,j)}this.numMarkers_[g]+=h.length};e.prototype.getOptMaxZoom_=function(f){return f!=undefined?f:this.maxZoom_};e.prototype.getMarkerCount=function(g){var f=0;for(var h=0;h<=g;h++){f+=this.numMarkers_[h]}return f};e.prototype.addMarker=function(f,h,i){var k=this;var j=this.getOptMaxZoom_(i);k.addMarkerBatch_(f,h,j);var g=k.getTilePoint_(f.getPoint(),k.mapZoom_,GSize.ZERO);if(k.isGridPointVisible_(g)&&h<=k.shownBounds_.z&&k.shownBounds_.z<=j){k.addOverlay_(f);k.notifyListeners_()}this.numMarkers_[h]++};GBounds.prototype.containsPoint=function(g){var f=this;return(f.minX<=g.x&&f.maxX>=g.x&&f.minY<=g.y&&f.maxY>=g.y)};e.prototype.getGridCellCreate_=function(g,h,i){var k=this.grid_[i];if(g<0){g+=this.gridWidth_[i]}var j=k[g];if(!j){j=k[g]=[];return j[h]=[]}var f=j[h];if(!f){return j[h]=[]}return f};e.prototype.getGridCellNoCreate_=function(f,g,h){var j=this.grid_[h];if(f<0){f+=this.gridWidth_[h]}var i=j[f];return i?i[g]:undefined};e.prototype.getGridBounds_=function(j,i,l,f){i=Math.min(i,this.maxZoom_);var h=j.getSouthWest();var o=j.getNorthEast();var n=this.getTilePoint_(h,i,l);var m=this.getTilePoint_(o,i,f);var k=this.gridWidth_[i];if(o.lng()<h.lng()||m.x<n.x){n.x-=k}if(m.x-n.x+1>=k){n.x=0;m.x=k-1}var g=new GBounds([n,m]);g.z=i;return g};e.prototype.getMapGridBounds_=function(){var f=this;return f.getGridBounds_(f.map_.getBounds(),f.mapZoom_,f.swPadding_,f.nePadding_)};e.prototype.onMapMoveEnd_=function(){var f=this;f.objectSetTimeout_(this,this.updateMarkers_,0)};e.prototype.objectSetTimeout_=function(h,f,g){return window.setTimeout(function(){f.call(h)},g)};e.prototype.refresh=function(){var f=this;if(f.shownMarkers_>0){f.processAll_(f.shownBounds_,f.removeOverlay_)}f.processAll_(f.shownBounds_,f.addOverlay_);f.notifyListeners_()};e.prototype.updateMarkers_=function(){var g=this;g.mapZoom_=this.map_.getZoom();var f=g.getMapGridBounds_();if(f.equals(g.shownBounds_)&&f.z==g.shownBounds_.z){return}if(f.z!=g.shownBounds_.z){g.processAll_(g.shownBounds_,g.removeOverlay_);g.processAll_(f,g.addOverlay_)}else{g.rectangleDiff_(g.shownBounds_,f,g.removeCellMarkers_);g.rectangleDiff_(f,g.shownBounds_,g.addCellMarkers_)}g.shownBounds_=f;g.notifyListeners_()};e.prototype.notifyListeners_=function(){GEvent.trigger(this,"changed",this.shownBounds_,this.shownMarkers_)};e.prototype.processAll_=function(f,i){for(var h=f.minX;h<=f.maxX;h++){for(var g=f.minY;g<=f.maxY;g++){this.processCellMarkers_(h,g,f.z,i)}}};e.prototype.processCellMarkers_=function(f,g,h,l){var j=this.getGridCellNoCreate_(f,g,h);if(j){for(var k=j.length-1;k>=0;k--){l(j[k])}}};e.prototype.removeCellMarkers_=function(f,g,h){this.processCellMarkers_(f,g,h,this.removeOverlay_)};e.prototype.addCellMarkers_=function(f,g,h){this.processCellMarkers_(f,g,h,this.addOverlay_)};e.prototype.rectangleDiff_=function(i,h,g){var f=this;f.rectangleDiffCoords(i,h,function(j,k){g.apply(f,[j,k,i.z])})};e.prototype.rectangleDiffCoords=function(p,f,j){var r=p.minX;var l=p.minY;var o=p.maxX;var n=p.maxY;var q=f.minX;var k=f.minY;var h=f.maxX;var m=f.maxY;for(var i=r;i<=o;i++){for(var g=l;g<=n&&g<k;g++){j(i,g)}for(var g=Math.max(m+1,l);g<=n;g++){j(i,g)}}for(var g=Math.max(l,k);g<=Math.min(n,m);g++){for(var i=Math.min(o+1,q)-1;i>=r;i--){j(i,g)}for(var i=Math.max(r,h+1);i<=o;i++){j(i,g)}}};e.prototype.removeFromArray=function(j,f,g){var k=0;for(var h=0;h<j.length;++h){if(j[h]===f||(g&&j[h]==f)){j.splice(h--,1);k++}}return k};return e}var b=null;function a(f,e){return new b(f,e)}function d(){if(b==null){b=c()}}return{createMarkerManager:a,init:d}};
/*
* DragZoomControl Class v1.1 
*  Copyright (c) 2005-2007, Andre Lewis, andre@earthcode.com
*
* Back Button functionality
*  Copyright (c)  2007, Richard Garland, papabear.newyork@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* 
*       http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This class lets you add a control to the map which will let the user
*  zoom by dragging a rectangle.
*  More info on original GZoom at http://earthcode.com
*
* Back Button functionality provides the user with a one click means to return the map state 
*  to its state prior to the DragZoom.  Sequential DragZooms are backed out in reverse order.
*/
/*
* Constructor for DragZoomControl, which takes 3 option hashes and
*  uses them to customize the control.
* @param {opts_boxStyle} Named optional arguments:
*   opts_boxStyle.opacity {Number} Opacity from 0-1
*   opts_boxStyle.fillColor {String} Hex value of fill color
*   opts_boxStyle.border {String} CSS-style declaration of border
* @param {opts_other} Named optional arguments:
*   opts_other.buttonHTML {String} The zoom button HTML in non-activated state
*   opts_other.buttonStartingStyle {Object} A hash of css styles for the 
*     zoom button which are common to both un-activated and activated state
*   opts_other.buttonStyle {Object} A hash of css styles for the zoom button 
*     which will be applied when the button is in un-activated state.
*   opts_other.buttonZoomingHTML {String} HTML which is placed in the 
*     zoom button when the button is activated. 
*   opts_other.buttonZoomingStyle {Object} A hash of css styles for the 
*    zoom button which will be applied when the button is activated.
*   opts_other.overlayRemoveTime {Number} The number of milliseconds to wait before
*     removing the rectangle indicating the zoomed-in area after the zoom has happened.
*   opts_other.stickyZoomEnabled {Boolean} Whether or not the control stays in 
*     "zoom mode" until turned off. When true, the user can zoom repeatedly, 
*     until clicking on the zoom button again to turn zoom mode off.
*   opts_other.backButtonEnabled {Boolean} enables Back Button functionality
*   opts_other.backButtonHTML {String} The back button HTML
*   opts_other.backButtonStyle {Object} A hash of css styles for the back button
*     which will be applied when the button is created.	
* @param {opts_callbacks} Named optional arguments:
*   opts_callbacks.buttonclick {Function} Called when the DragZoom is activated 
*     by clicking on the "zoom" button. 
*   opts_callbacks.dragstart {Function} Called when user starts to drag a rectangle.
*     Callback args are x,y -- the PIXEL values, relative to the upper-left-hand 
*     corner of the map, where the user began dragging.
*   opts_callbacks.dragging {Function} Called repeatedly while the user is dragging.
*     Callback args are startX,startY, currentX,currentY -- the PIXEL values of the 
*     start of the drag, and the current drag point, respectively.
*   opts_callbacks.dragend {Function} Called when the user releases the mouse button 
*     after dragging the rectangle. Callback args are: NW {GLatLng}, NE {GLatLng}, 
*     SE {GLatLng}, SW {GLatLng}, NW {GPoint}, NE {GPoint}, SE {GPoint}, SW {GPoint}.
*     The first 4 are the latitudes/longitudes; the last 4 are the pixel coords on the map.
*   opts_callbacks.backbuttonclick {Function} Called when the back button is activated 
*     after the map context is restored. Callback args: methodCall (boolean) set true if
*     this backbuttonclick was to restore context set by the mathod call, else false.
* Method
*    this.saveMapContext(text) Call to push map context onto the backStack and set the button text 
*/
$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.Dragzoom=function(){function d(){function e(j,k,i){this.globals={draggingOn:false,cornerTopDiv:null,cornerRightDiv:null,cornerBottomDiv:null,cornerLeftDiv:null,mapPosition:null,outlineDiv:null,mapWidth:0,mapHeight:0,mapRatio:0,startX:0,startY:0,borderCorrection:0};this.globals.style={opacity:0.2,fillColor:"#000",border:"2px solid blue"};var l=this.globals.style;for(var h in j){l[h]=j[h]}var g=l.border.split(" ");l.outlineWidth=parseInt(g[0].replace(/\D/g,""));l.outlineColor=g[2];l.alphaIE="alpha(opacity="+(l.opacity*100)+")";this.globals.backStack=[];this.globals.options={buttonHTML:"zoom ...",buttonStartingStyle:{width:"52px",border:"1px solid black",padding:"2px"},buttonStyle:{background:"#FFF"},backButtonHTML:"zoom back",backButtonStyle:{background:"#FFF",display:"none"},buttonZoomingHTML:"Drag a region on the map",buttonZoomingStyle:{background:"#FF0"},overlayRemoveTime:6000,backButtonEnabled:false,stickyZoomEnabled:false};for(var h in k){this.globals.options[h]=k[h]}if(i==null){i={}}this.globals.callbacks=i}e.prototype=new GControl();e.prototype.saveMapContext=function(g){if(this.globals.options.backButtonEnabled){this.saveBackContext_(g,true);this.globals.backButtonDiv.style.display="block"}};e.prototype.initButton_=function(i){var g=this.globals;var h=document.createElement("div");h.innerHTML=g.options.buttonHTML;h.id="gzoom-control";f.style([h],{cursor:"pointer",zIndex:200});f.style([h],g.options.buttonStartingStyle);f.style([h],g.options.buttonStyle);i.appendChild(h);return h};e.prototype.initBackButton_=function(i){var g=this.globals;var h=document.createElement("div");h.innerHTML=g.options.backButtonHTML;h.id="gzoom-back";f.style([h],{cursor:"pointer",zIndex:200});f.style([h],g.options.buttonStartingStyle);f.style([h],g.options.backButtonStyle);i.appendChild(h);return h};e.prototype.setButtonMode_=function(h){var g=this.globals;if(h=="zooming"){g.buttonDiv.innerHTML=g.options.buttonZoomingHTML;f.style([g.buttonDiv],g.options.buttonStartingStyle);f.style([g.buttonDiv],g.options.buttonZoomingStyle)}else{g.buttonDiv.innerHTML=g.options.buttonHTML;f.style([g.buttonDiv],g.options.buttonStartingStyle);f.style([g.buttonDiv],g.options.buttonStyle)}};e.prototype.initialize=function(i){var h=this.globals;var l=this;var k=i.getContainer();var n=document.createElement("div");f.style([n],{cursor:"pointer",zIndex:150});var j=this.initButton_(n);var m=this.initBackButton_(n);k.appendChild(n);var g=document.createElement("div");g.id="gzoom-map-cover";g.innerHTML='<div id="gzoom-outline" style="position:absolute;display:none;"></div><div id="gzoom-cornerTopDiv" style="position:absolute;display:none;"></div><div id="gzoom-cornerLeftDiv" style="position:absolute;display:none;"></div><div id="gzoom-cornerRightDiv" style="position:absolute;display:none;"></div><div id="gzoom-cornerBottomDiv" style="position:absolute;display:none;"></div>';f.style([g],{position:"absolute",display:"none",overflow:"hidden",cursor:"crosshair",zIndex:101});k.appendChild(g);GEvent.addDomListener(j,"click",function(o){l.buttonclick_(o)});GEvent.addDomListener(m,"click",function(o){l.backButtonclick_(o)});GEvent.addDomListener(g,"mousedown",function(o){l.coverMousedown_(o)});GEvent.addDomListener(document,"mousemove",function(o){l.drag_(o)});GEvent.addDomListener(document,"mouseup",function(o){l.mouseup_(o)});h.mapPosition=f.getElementPosition(k);h.outlineDiv=f.gE("gzoom-outline");h.buttonDiv=f.gE("gzoom-control");h.backButtonDiv=f.gE("gzoom-back");h.mapCover=f.gE("gzoom-map-cover");h.cornerTopDiv=f.gE("gzoom-cornerTopDiv");h.cornerRightDiv=f.gE("gzoom-cornerRightDiv");h.cornerBottomDiv=f.gE("gzoom-cornerBottomDiv");h.cornerLeftDiv=f.gE("gzoom-cornerLeftDiv");h.map=i;h.borderCorrection=h.style.outlineWidth*2;this.setDimensions_();this.initStyles_();return n};e.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(3,120))};e.prototype.coverMousedown_=function(i){var g=this.globals;var h=this.getRelPos_(i);g.startX=h.left;g.startY=h.top;f.style([g.mapCover],{background:"transparent",opacity:1,filter:"alpha(opacity=100)"});f.style([g.outlineDiv],{left:g.startX+"px",top:g.startY+"px",display:"block",width:"1px",height:"1px"});g.draggingOn=true;g.cornerTopDiv.style.top=(g.startY-g.mapHeight)+"px";g.cornerTopDiv.style.display="block";g.cornerLeftDiv.style.left=(g.startX-g.mapWidth)+"px";g.cornerLeftDiv.style.top=g.startY+"px";g.cornerLeftDiv.style.display="block";g.cornerRightDiv.style.left=g.startX+"px";g.cornerRightDiv.style.top=g.startY+"px";g.cornerRightDiv.style.display="block";g.cornerBottomDiv.style.left=g.startX+"px";g.cornerBottomDiv.style.top=g.startY+"px";g.cornerBottomDiv.style.width="0px";g.cornerBottomDiv.style.display="block";if(g.callbacks.dragstart!=null){g.callbacks.dragstart(g.startX,g.startY)}return false};e.prototype.drag_=function(i){var g=this.globals;document.onselectstart=function(){return false};if(g.draggingOn){var h=this.getRelPos_(i);rect=this.getRectangle_(g.startX,g.startY,h,g.mapRatio);if(rect.left){addX=-rect.width}else{addX=0}if(rect.top){addY=-rect.height}else{addY=0}f.style([g.outlineDiv],{left:g.startX+addX+"px",top:g.startY+addY+"px",display:"block",width:"1px",height:"1px"});g.outlineDiv.style.width=rect.width+"px";g.outlineDiv.style.height=rect.height+"px";g.cornerTopDiv.style.height=((g.startY+addY)-(g.startY-g.mapHeight))+"px";g.cornerLeftDiv.style.top=(g.startY+addY)+"px";g.cornerLeftDiv.style.width=((g.startX+addX)-(g.startX-g.mapWidth))+"px";g.cornerRightDiv.style.top=g.cornerLeftDiv.style.top;g.cornerRightDiv.style.left=(g.startX+addX+rect.width+g.borderCorrection)+"px";g.cornerBottomDiv.style.top=(g.startY+addY+rect.height+g.borderCorrection)+"px";g.cornerBottomDiv.style.left=(g.startX-g.mapWidth+((g.startX+addX)-(g.startX-g.mapWidth)))+"px";g.cornerBottomDiv.style.width=(rect.width+g.borderCorrection)+"px";if(g.callbacks.dragging!=null){g.callbacks.dragging(g.startX,g.startY,rect.endX,rect.endY)}return false}};e.prototype.mouseup_=function(n){var i=this.globals;if(i.draggingOn){var o=this.getRelPos_(n);i.draggingOn=false;var g=this.getRectangle_(i.startX,i.startY,o,i.mapRatio);if(g.left){g.endX=g.startX-g.width}if(g.top){g.endY=g.startY-g.height}this.resetDragZoom_();var l=new GPoint(g.startX,g.startY);var r=new GPoint(g.endX,g.startY);var j=new GPoint(g.endX,g.endY);var s=new GPoint(g.startX,g.endY);var h=i.map.fromContainerPixelToLatLng(l);var p=i.map.fromContainerPixelToLatLng(r);var m=i.map.fromContainerPixelToLatLng(j);var q=i.map.fromContainerPixelToLatLng(s);var k=new GPolyline([h,p,m,q,h],i.style.outlineColor,i.style.outlineWidth+1,0.4);try{i.map.addOverlay(k);setTimeout(function(){i.map.removeOverlay(k)},i.options.overlayRemoveTime)}catch(n){}polyBounds=k.getBounds();var p=polyBounds.getNorthEast();var q=polyBounds.getSouthWest();var m=new GLatLng(q.lat(),p.lng());var h=new GLatLng(p.lat(),q.lng());zoomLevel=i.map.getBoundsZoomLevel(polyBounds);center=polyBounds.getCenter();i.map.setCenter(center,zoomLevel);if(i.callbacks.dragend!=null){i.callbacks.dragend(h,p,m,q,l,r,j,s)}if(i.options.stickyZoomEnabled){this.initCover_();if(i.options.backButtonEnabled){this.saveBackContext_(i.options.backButtonHTML,false)}i.backButtonDiv.style.display="none"}}};e.prototype.setDimensions_=function(){var g=this.globals;var h=g.map.getSize();g.mapWidth=h.width;g.mapHeight=h.height;g.mapRatio=g.mapHeight/g.mapWidth;f.style([g.mapCover,g.cornerTopDiv,g.cornerRightDiv,g.cornerBottomDiv,g.cornerLeftDiv],{width:g.mapWidth+"px",height:g.mapHeight+"px"})};e.prototype.initStyles_=function(){var g=this.globals;f.style([g.mapCover,g.cornerTopDiv,g.cornerRightDiv,g.cornerBottomDiv,g.cornerLeftDiv],{filter:g.style.alphaIE,opacity:g.style.opacity,background:g.style.fillColor});g.outlineDiv.style.border=g.style.border};e.prototype.buttonclick_=function(){var g=this.globals;g.backButtonDiv.style.display="none";if(g.mapCover.style.display=="block"){this.resetDragZoom_();if(g.options.backButtonEnabled){this.restoreBackContext_();if(g.backStack.length==0){g.backButtonDiv.style.display="none"}}}else{this.initCover_();if(g.options.backButtonEnabled){this.saveBackContext_(g.options.backButtonHTML,false)}}};e.prototype.backButtonclick_=function(){var g=this.globals;if(g.options.backButtonEnabled){this.restoreBackContext_();if(g.callbacks.backbuttonclick!=null){g.callbacks.backbuttonclick(g.methodCall)}}};e.prototype.saveBackContext_=function(j,h){var g=this.globals;var i={};i.center=g.map.getCenter();i.zoom=g.map.getZoom();i.maptype=g.map.getCurrentMapType();i.text=g.backButtonDiv.innerHTML;i.methodCall=h;g.backStack.push(i);g.backButtonDiv.innerHTML=j};e.prototype.restoreBackContext_=function(){var g=this.globals;var h=g.backStack.pop();g.map.setCenter(h.center,h.zoom,h.maptype);g.backButtonDiv.innerHTML=h.text;g.methodCall=h.methodCall;if(g.backStack.length==0){g.backButtonDiv.style.display="none"}};e.prototype.initCover_=function(){var g=this.globals;g.mapPosition=f.getElementPosition(g.map.getContainer());this.setDimensions_();this.setButtonMode_("zooming");f.style([g.mapCover],{display:"block",background:g.style.fillColor});f.style([g.outlineDiv],{width:"0px",height:"0px"});if(g.callbacks.buttonclick!=null){g.callbacks.buttonclick()}};e.prototype.getRelPos_=function(i){var h=f.getMousePosition(i);var g=this.globals;return{top:(h.top-g.mapPosition.top),left:(h.left-g.mapPosition.left)}};e.prototype.getRectangle_=function(m,j,l,n){var i=false;var h=false;var g=l.left-m;var k=l.top-j;if(g<0){g=g*-1;i=true}if(k<0){k=k*-1;h=true}delta=g>k?g:k;return{startX:m,startY:j,endX:m+delta,endY:j+parseInt(delta*n),width:delta,height:parseInt(delta*n),left:i,top:h}};e.prototype.resetDragZoom_=function(){var g=this.globals;f.style([g.mapCover,g.cornerTopDiv,g.cornerRightDiv,g.cornerBottomDiv,g.cornerLeftDiv],{display:"none",opacity:g.style.opacity,filter:g.style.alphaIE});g.outlineDiv.style.display="none";this.setButtonMode_("normal");if(g.options.backButtonEnabled&&(g.backStack.length>0)){g.backButtonDiv.style.display="block"}};var f={};f.gE=function(g){return document.getElementById(g)};f.getMousePosition=function(h){var i=0;var g=0;if(!h){var h=window.event}if(h.pageX||h.pageY){i=h.pageX;g=h.pageY}else{if(h.clientX||h.clientY){i=h.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);g=h.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}}return{left:i,top:g}};f.getElementPosition=function(j){var g=j.offsetLeft;var h=j.offsetTop;var i=j.offsetParent;while(i!=null){g+=i.offsetLeft;h+=i.offsetTop;i=i.offsetParent}return{left:g,top:h}};f.style=function(j,h){if(typeof(j)=="string"){j=f.getManyElements(j)}for(var k=0;k<j.length;k++){for(var g in h){j[k].style[g]=h[g]}}};f.getManyElements=function(j){var g=j.split(",");var h=[];for(var k=0;k<g.length;k++){h[h.length]=f.gE(g[k])}return h};return e}var a=null;function c(f,g,e){return new a(f,g,e)}function b(){if(a==null){a=d()}}return{createDragZoom:c,init:b}};
/*
* ExtInfoWindow Class, v1.0 
*  Copyright (c) 2007, Joe Monahan (http://www.seejoecode.com)
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* 
*       http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This class lets you add an info window to the map which mimics GInfoWindow
* and allows for users to skin it via CSS.  Additionally it has options to
* pull in HTML content from an ajax request, triggered when a user clicks on
* the associated marker.
*/
$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.ExtInfoWindow=function(){function createClassDefinition(){function ExtInfoWindow(marker,windowId,html,opt_opts){this.html_=html;this.marker_=marker;this.infoWindowId_=windowId;this.options_=opt_opts==null?{}:opt_opts;this.ajaxUrl_=this.options_.ajaxUrl==null?null:this.options_.ajaxUrl;this.callback_=this.options_.ajaxCallback==null?null:this.options_.ajaxCallback;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(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(e){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else{e.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(force){if(!force||this.container_==null){return}var contentHeight=this.contentDiv_.offsetHeight;this.contentDiv_.style.height=contentHeight+"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=contentHeight;this.wrapperParts.r.l=this.contentWidth+this.wrapperParts.l.w;this.wrapperParts.r.t=this.wrapperParts.tr.h;this.wrapperParts.r.h=contentHeight;this.wrapperParts.bl.t=contentHeight+this.wrapperParts.tl.h;this.wrapperParts.b.l=this.wrapperParts.bl.w;this.wrapperParts.b.t=contentHeight+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=contentHeight+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.borderSize_;for(var i in this.wrapperParts){if(i=="close"){this.wrapperDiv_.insertBefore(this.contentDiv_,this.wrapperParts[i].domElement)}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}var currentMarker=this.marker_;var thisMap=this.map_;GEvent.addDomListener(this.wrapperParts.close.domElement,"click",function(){thisMap.closeExtInfoWindow()});var pixelLocation=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());this.container_.style.position="absolute";var markerIcon=this.marker_.getIcon();this.container_.style.left=(pixelLocation.x-(this.contentWidth/2)-markerIcon.iconAnchor.x+markerIcon.infoWindowAnchor.x)+"px";this.container_.style.top=(pixelLocation.y-this.wrapperParts.bl.h-contentHeight-this.wrapperParts.tl.h-this.wrapperParts.beak.h-markerIcon.iconAnchor.y+markerIcon.infoWindowAnchor.y+this.borderSize_)+"px";this.container_.style.display="block";if(this.map_.getExtInfoWindow()!=null){this.repositionMap_()}};ExtInfoWindow.prototype.resize=function(){var tempElement=this.contentDiv_.cloneNode(true);tempElement.id=this.infoWindowId_+"_tempContents";tempElement.style.visibility="hidden";tempElement.style.height="auto";document.body.appendChild(tempElement);tempElement=document.getElementById(this.infoWindowId_+"_tempContents");var contentHeight=tempElement.offsetHeight;document.body.removeChild(tempElement);this.contentDiv_.style.height=contentHeight+"px";var contentWidth=this.contentDiv_.offsetWidth;var pixelLocation=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var oldWindowHeight=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;var oldWindowPosTop=this.wrapperParts.t.domElement.offsetTop;this.wrapperParts.l.domElement.style.height=contentHeight+"px";this.wrapperParts.r.domElement.style.height=contentHeight+"px";var newPosTop=this.wrapperParts.b.domElement.offsetTop-contentHeight;this.wrapperParts.l.domElement.style.top=newPosTop+"px";this.wrapperParts.r.domElement.style.top=newPosTop+"px";this.contentDiv_.style.top=newPosTop+"px";windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height);newPosTop-=windowTHeight;this.wrapperParts.close.domElement.style.top=newPosTop+this.borderSize_+"px";this.wrapperParts.tl.domElement.style.top=newPosTop+"px";this.wrapperParts.t.domElement.style.top=newPosTop+"px";this.wrapperParts.tr.domElement.style.top=newPosTop+"px";this.repositionMap_()};ExtInfoWindow.prototype.repositionMap_=function(){var mapNE=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());var mapSW=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());var markerPosition=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var panX=0;var panY=0;var paddingX=this.paddingX_;var paddingY=this.paddingY_;var infoWindowAnchor=this.marker_.getIcon().infoWindowAnchor;var iconAnchor=this.marker_.getIcon().iconAnchor;var windowT=this.wrapperParts.t.domElement;var windowL=this.wrapperParts.l.domElement;var windowB=this.wrapperParts.b.domElement;var windowR=this.wrapperParts.r.domElement;var windowBeak=this.wrapperParts.beak.domElement;var offsetTop=markerPosition.y-(-infoWindowAnchor.y+iconAnchor.y+this.getDimensions_(windowBeak).height+this.getDimensions_(windowB).height+this.getDimensions_(windowL).height+this.getDimensions_(windowT).height+this.paddingY_);if(offsetTop<mapNE.y){panY=mapNE.y-offsetTop}else{var offsetBottom=markerPosition.y+this.paddingY_;if(offsetBottom>=mapSW.y){panY=-(offsetBottom-mapSW.y)}}var offsetRight=Math.round(markerPosition.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(windowR).width+this.paddingX_+infoWindowAnchor.x-iconAnchor.x);if(offsetRight>mapNE.x){panX=-(offsetRight-mapNE.x)}else{var offsetLeft=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(windowL).width+this.borderSize_+this.paddingX_)-markerPosition.x-infoWindowAnchor.x+iconAnchor.x);if(offsetLeft<mapSW.x){panX=mapSW.x-offsetLeft}}if(panX!=0||panY!=0&&this.map_.getExtInfoWindow()!=null){this.map_.panBy(new GSize(panX,panY))}};ExtInfoWindow.prototype.ajaxRequest_=function(url){var thisMap=this.map_;var thisCallback=this.callback_;GDownloadUrl(url,function(response,status){var infoWindow=document.getElementById(thisMap.getExtInfoWindow().infoWindowId_+"_contents");if(response==null||status==-1){infoWindow.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+url+'"</span>'}else{infoWindow.innerHTML=response}if(thisCallback!=null){thisCallback()}thisMap.getExtInfoWindow().resize();GEvent.trigger(thisMap,"extinfowindowupdate")})};ExtInfoWindow.prototype.getDimensions_=function(element){var display=this.getStyle_(element,"display");if(display!="none"&&display!=null){return{width:element.offsetWidth,height:element.offsetHeight}}var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility="hidden";els.position="absolute";els.display="block";var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight}};ExtInfoWindow.prototype.getStyle_=function(element,style){var found=false;style=this.camelize_(style);var value=element.style[style];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null}else{if(element.currentStyle){value=element.currentStyle[style]}}}if((value=="auto")&&(style=="width"||style=="height")&&(this.getStyle_(element,"display")!="none")){if(style=="width"){value=element.offsetWidth}else{value=element.offsetHeight}}return(value=="auto")?null:value};ExtInfoWindow.prototype.camelize_=function(element){var parts=element.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=element.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized};GMap.prototype.ExtInfoWindowInstance_=null;GMap.prototype.ClickListener_=null;GMap.prototype.InfoWindowListener_=null;GMarker.prototype.openExtInfoWindow=function(map,cssId,html,opt_opts){if(map==null){throw"Error in GMarker.openExtInfoWindow: map cannot be null";return false}if(cssId==null||cssId==""){throw"Error in GMarker.openExtInfoWindow: must specify a cssId";return false}map.closeInfoWindow();if(map.getExtInfoWindow()!=null){map.closeExtInfoWindow()}if(map.getExtInfoWindow()==null){map.setExtInfoWindow_(new ExtInfoWindow(this,cssId,html,opt_opts));if(map.ClickListener_==null){map.ClickListener_=GEvent.addListener(map,"click",function(event){if(!event&&map.getExtInfoWindow()!=null){map.closeExtInfoWindow()}})}if(map.InfoWindowListener_==null){map.InfoWindowListener_=GEvent.addListener(map,"infowindowopen",function(event){if(map.getExtInfoWindow()!=null){map.closeExtInfoWindow()}})}map.addOverlay(map.getExtInfoWindow())}};GMarker.prototype.closeExtInfoWindow=function(map){if(map.getExtInfWindow()!=null){map.closeExtInfoWindow()}};GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_};GMap2.prototype.setExtInfoWindow_=function(extInfoWindow){this.ExtInfoWindowInstance_=extInfoWindow};GMap2.prototype.closeExtInfoWindow=function(){if(this.getExtInfoWindow()!=null){this.ExtInfoWindowInstance_.remove()}};return ExtInfoWindow}var _extInfoWindowClass=null;function extInfoWindow_createExtInfoWindow(marker,windowId,html,opt_opts){return new _extInfoWindowClass(marker,windowId,html,opt_opts)}function extInfoWindow_init(){if(_extInfoWindowClass==null){_extInfoWindowClass=createClassDefinition()}}return{createExtInfoWindow:extInfoWindow_createExtInfoWindow,init:extInfoWindow_init}};$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.Map=function(){var i="1";var u;var M="";var D="";var h=[];var n=[];var c=[];var l=[];var I=[];var J=new Array();var P;var L,y;var s,d,v;var G=false;var r="";var C=OW8.Mod.Geographical.MapIconMaker(),b=OW8.Mod.Geographical.Marker(),F=OW8.Mod.Geographical.Dragzoom(),a=OW8.Mod.Geographical.ExtInfoWindow();function N(){GMap2.prototype.hoverControls=function(R){var Q=this;Q.hideControls();GEvent.addListener(Q,"mouseover",function(){Q.showControls()});GEvent.addListener(Q,"mouseout",function(){Q.hideControls()});Q.libraryCard=19162};GMap.prototype.hoverControls=GMap2.prototype.hoverControls}function B(V,U,S,W,Q,R){if(GBrowserIsCompatible()){var T=$(V);if(T==null){OW8.Logger.log("Map canvas must be specified.")}r=R;P=new GMap2(T);if(U){s=e(U.CountryPrimaryColor,U.CountryCornerColor,U.CountryStrokeColor);d=e(U.ResortPrimaryColor,U.ResortCornerColor,U.ResortStrokeColor);v=e(U.HotelPrimaryColor,U.HotelCornerColor,U.HotelStrokeColor)}P.addControl(new GLargeMapControl());if(S){P.setCenter(new GLatLng(S.Latitude,S.Longitude),parseInt(S.ZoomLevel));switch(S.MapType){case"1":P.setMapType(G_NORMAL_MAP);break;case"2":P.setMapType(G_SATELLITE_MAP);break;case"3":P.setMapType(G_HYBRID_MAP);break;case"4":P.setMapType(G_PHYSICAL_MAP);break}}P.addControl(new GMapTypeControl());P.addMapType(G_PHYSICAL_MAP);P.addControl(new GScaleControl());P.addControl(new GOverviewMapControl());P.enableContinuousZoom();new GKeyboardHandler(P);P.hoverControls();u=b.createMarkerManager(P);L={opacity:0.2,border:"1px solid white"};y={buttonStartingStyle:{width:"0",height:"0",cursor:"pointer"},buttonHTML:'<img title="'+Q.ZoomText+'" src="'+OW.Urls.ensureImageUrl(Q.ZoomIconNotSelected)+'" width="48" height="38" />',buttonZoomingHTML:'<img src="'+OW.Urls.ensureImageUrl(Q.ZoomIcon)+'" />',overlayRemoveTime:500,restrictedRectangleMap:0};P.addControl(F.createDragZoom(L,y,{}),new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(73,18)));P.enableScrollWheelZoom();z();A(i);GEvent.addListener(P,"zoomend",function(Y,X){E(Y,X)});if(W.itemType!=="undefined"){switch(W.itemType){case"Region":case"Country":case"Area":case"Resort":j(W.minX,W.minY,W.maxX,W.maxY,false);break;case"Hotel":case"HotelComplex":m(W.latitude,W.longitude,W.name,false);break;default:break}}GEvent.addListener(P,"moveend",function(){o()})}}function q(U,S,R,V,T){w(T,function Q(){N();B(U,S,R,V,{ZoomText:"googleZoomText".t(),ZoomIcon:"googleZoomIcon".t(),ZoomIconNotSelected:"googleZoomIconNotSelected".t()},{txtGuestRating:"googleGuestRatingText".t(),txtSlider:"googleSliderText".t(),txtMovie:"googleMovieText".t(),txtZoomCountry:"googleZoomTextCountry".t(),txtZoomResort:"googleZoomTextResort".t(),txtZoomHotel:"googleZoomTextHotel".t(),defaultNoImage:"googleNoimage".t(),txtButtonText:"googleButtonText".t(),buttonImage:"googleButtonImage".t(),txtTravelStories:"googleTravelStoriesText".t(),travelStoriesImage:"googleTravelStoriesImage".t()})})}function g(Q){if(Q!=i){i=Q;u.clearMarkers();z();A(Q);if(P.getZoom()>12){x(i)}}}function j(X,T,V,W,S){P.closeExtInfoWindow();P.setCenter(new GLatLng(0,0),0);var U=new GLatLngBounds();var Q=new GLatLng(T,X);var R=new GLatLng(W,V);U.extend(Q);U.extend(R);P.setCenter(U.getCenter());if(P.getBoundsZoomLevel(U)<=10){P.setZoom(P.getBoundsZoomLevel(U))}else{P.setZoom(13)}if(S==true){switch(MapType){case"1":P.setMapType(G_NORMAL_MAP);break;case"2":P.setMapType(G_SATELLITE_MAP);break;case"3":P.setMapType(G_HYBRID_MAP);break;case"4":P.setMapType(G_PHYSICAL_MAP);break}}}function m(S,R,T,Q){P.closeExtInfoWindow();P.setCenter(new GLatLng(S,R),15);if(Q==true){switch(MapType){case"1":P.setMapType(G_NORMAL_MAP);break;case"2":P.setMapType(G_SATELLITE_MAP);break;case"3":P.setMapType(G_HYBRID_MAP);break;case"4":P.setMapType(G_PHYSICAL_MAP);break}}M=T}function z(){h=[];n=[];c=[];l=[];I=[]}function f(U,T,S,R){var Q=new GMarker(U,{icon:T,title:S,draggable:false});GEvent.addListener(Q,"click",function(){Q.openExtInfoWindow(P,"custom_info_window_white",R,{beakOffset:3})});return Q}function A(R){var T=P.getBounds().getSouthWest().lat();var S=P.getBounds().getSouthWest().lng();var Q=P.getBounds().getNorthEast().lat();var U=P.getBounds().getNorthEast().lng();MTNE.Web.OneWeb.Modules.GeographicalApp.Services.Geographical.GisService.GetCountryData(R,T,S,Q,U,r,p,t,"");MTNE.Web.OneWeb.Modules.GeographicalApp.Services.Geographical.GisService.GetResortData(R,T,S,Q,U,r,H,t,"")}function e(S,R,U){var T={};T.width=12;T.height=20;T.primaryColor=S;T.cornerColor=R;T.strokeColor=U;var Q=C.createIconMaker(T);Q.iconAnchor=new GPoint(6,20);Q.infoWindowAnchor=new GPoint(25,1);return Q}function p(Q){if(Q!=""){var R=GXml.parse(Q);K(R,h,s,"country",1,4)}}function H(Q){if(Q!=""){var R=GXml.parse(Q);K(R,l,d,"resort",5,13)}}function O(Q){if(Q!=""){var R=GXml.parse(Q);K(R,I,v,"hotel",13,17)}}function K(ab,af,U,R,X,V){var am=new GLatLng(1,1);var S=new GMarker(am,{icon:U,draggable:false});var ae="";var ag=[];var an=[];var W=false;var ao=ab.documentElement.getElementsByTagName("GISItemWGS84");for(var Y=0;Y<ao.length;Y++){var al=GXml.value(ao[Y].getElementsByTagName("Latitude")[0]);var ak=GXml.value(ao[Y].getElementsByTagName("Longitude")[0]);var aj=GXml.value(ao[Y].getElementsByTagName("MinX")[0]);var ai=GXml.value(ao[Y].getElementsByTagName("MaxX")[0]);var Q=GXml.value(ao[Y].getElementsByTagName("MinY")[0]);var T=GXml.value(ao[Y].getElementsByTagName("MaxY")[0]);var ac=GXml.value(ao[Y].getElementsByTagName("Name")[0]);var aa=GXml.value(ao[Y].getElementsByTagName("HTMLIngress")[0]);var Z=GXml.value(ao[Y].getElementsByTagName("InformationAndBookingURL")[0]);var ah=GXml.value(ao[Y].getElementsByTagName("ExtentLink")[0]);am=new GLatLng(al,ak);S=f(am,U,ac,aa);if(R=="hotel"){W=false;for(var ad=0;ad<af.length;ad++){if(S.getTitle()==af[ad].getTitle()){W=true;break}}if(W==false){if(R="hotel"){if(S.getTitle()==M){an.push(S);M=""}}ag.push(S);af.push(S)}}else{af.push(S)}}if(R=="hotel"){u.addMarkers(ag,X,V)}else{u.addMarkers(af,X,V)}if(an.length>0){GEvent.trigger(an[0],"click")}u.refresh()}function E(R,Q){if(Q>12&&R<=12){x(i)}}function o(){if(P.getZoom()>12){x(i)}}function x(U){var S=P.getBounds().getSouthWest().lat();var R=P.getBounds().getSouthWest().lng();var Q=P.getBounds().getNorthEast().lat();var T=P.getBounds().getNorthEast().lng();MTNE.Web.OneWeb.Modules.GeographicalApp.Services.Geographical.GisService.GetHotelData(U,S,R,Q,T,r,O,t,"")}function t(Q){alert(Q._message)}function w(T,R){var S=k();if(!S){if(!T){OW.Logger.logError("No GMap API URL provided, cannot load map.");return}var V=new Date().getTime(),Q="__map"+V,U=T+"&async=2&callback="+Q;window[Q]=function(){C.init();b.init();F.init();a.init();R()};OW.ScriptsLoader.appendNewScriptToDOM(U)}else{R()}}function k(){return typeof(GLoadMapsScript)!=="undefined"}return{initialize:q,ChangeCategory:g,zoomToExtent:j,zoomToAndCenterOnHotel:m}}();