﻿var ElongMapEvent=Elong.Control.ElongMapEvent;ElongMapEvent=Class.create();ElongMapEvent.CLICK="click";ElongMapEvent.MOUSEDOWN="mousedown";ElongMapEvent.MOUSEMOVE="mousemove";ElongMapEvent.MOUSEUP="mouseup";ElongMapEvent.INFOWINDOWCLOSE="infowindowclose";ElongMapEvent.INFOWINDOWOPEN="infowindowopen";var ElongOverlayType=Elong.Control.ElongOverlayType;ElongOverlayType=Class.create();ElongOverlayType.MARKER="marker";ElongOverlayType.LABELMARKER="labelmarker";ElongOverlayType.LABEL="label";ElongOverlayType.RECTANGLE="rectangle";ControlStyle=function(){this.textDecoration="none";this.color="#ffffff";this.backgroundColor="#006b02";this.font="small Arial";this.border="1px solid #003b03";this.padding="0px";this.marginBottom="1px";this.textAlign="center";this.width="1em";this.cursor="pointer";this.nowrap="nowrap";this.defaultStyle=true;};var LatLng=Elong.Control.LatLng;LatLng=Class.create();Object.extend(LatLng.prototype,{name:"LatLng",latlng:null,isInherit:true,address:"",options:{lng:0,lat:0,option:null},initialize:function(A){Object.extend(Object.extend(this,this.options),A);this.latlng=new GLatLng(this.lat,this.lng,this.option);},getLat:function(){return this.latlng.latY;},getLng:function(){return this.latlng.lngX;},distanceFrom:function(B,A){return latlng.distanceFrom(B.toLatLng(),A);},toLatLng:function(){return this.latlng;},dispose:function(){this.latlng=null;this.options=null;}});var LatLngBounds=Elong.Control.LatLngBounds;LatLngBounds=Class.create();Object.extend(LatLngBounds.prototype,{name:"LatLngBounds",lbounds:null,isInherit:true,options:{sw:0,ne:0},initialize:function(A){Object.extend(Object.extend(this,this.options),A);this.lbounds=new GLatLngBounds(this.sw.isInherit?this.sw.toLatLng():this.sw,this.ne.isInherit?this.ne.toLatLng():this.ne);},getSouthWest:function(){return this.sw;},getNorthEast:function(){return this.ne;},contains:function(A){return this.lbounds.contains(A.toLatLngBounds());},getCenter:function(){return this.lbounds.getCenter();},equals:function(A){return this.lbounds.equals(A.toLatLngBounds());},getRectLatlngBounds:function(B){if(B){var D=B.sw.isInherit?B.sw.toLatLng():B.sw;var A=B.ne.isInherit?B.ne.toLatLng():B.ne;var C=new LatLng({lat:Math.min(D.lat(),A.lat()),lng:Math.min(D.lng(),A.lng())});var E=new LatLng({lat:Math.max(D.lat(),A.lat()),lng:Math.max(D.lng(),A.lng())});return new LatLngBounds({sw:C,ne:E});}return null;},toLatLngBounds:function(){return this.lbounds;},dispose:function(){this.lbounds=null;this.options=null;}});var Point=Elong.Control.Point;Point=Class.create();Object.extend(Point.prototype,{name:"Point",point:null,isInherit:true,options:{x:0,y:0},initialize:function(A){Object.extend(Object.extend(this,this.options),A);this.point=new GPoint(this.x,this.y);},x:this.x,y:this.y,equals:function(A){return this.point.equals(A.toPoint());},toString:function(){return this.point.toString();},toPoint:function(){return this.point;},dispose:function(){this.point=null;this.options=null;}});var Size=Elong.Control.Size;Size=Class.create();Object.extend(Size.prototype,{name:"Size",size:null,isInherit:true,options:{width:0,height:0},initialize:function(A){Object.extend(Object.extend(this,this.options),A);this.size=new GSize(this.width,this.height);},width:this.width,height:this.height,equals:function(A){return this.size.equals(A.toSize());},toString:function(){return this.size.toString();},toSize:function(){return this.size;},dispose:function(){this.size=null;this.options=null;}});var Marker=Elong.Control.Marker;Marker=Class.create();Object.extend(Marker.prototype,{name:"Marker",isInherit:true,marker:null,options:{id:0,latlng:null,imageUrl:"http://www.elongstatic.com/hotels/pic/hotel_map.gif",imageSize:null,title:"",content:"tip",isShowTip:false,isShadow:false,isDraggable:false,picAgent:false,callback:null,inert:null},initialize:function(A){Object.extend(Object.extend(this,this.options),A);this.marker=new GMarker(this.latlng.isInherit?this.latlng.toLatLng():this.latlng,this.createIcon(),this.inert);},createIcon:function(){var A=new GIcon();if(this.isShadow){A.shadow="http://www.google.com/mapfiles/shadow50.png";A.shadowSize=new GSize(22,20);}A.iconSize=new GSize(0,0);A.iconAnchor=new GPoint(0,0);A.infoWindowAnchor=new GPoint(9,2);A.infoShadowAnchor=new GPoint(18,25);A.image=this.imageUrl;if(this.imageSize&&this.imageSize.width&&this.imageSize.height){A.iconSize=new GSize(this.imageSize.width,this.imageSize.height);A.iconAnchor=new GPoint(15,25);}return A;},openInfoWindowHtml:function(B,A){this.marker.openInfoWindowHtml(B,A);},bindInfoWindowHtml:function(B,A){this.marker.bindInfoWindowHtml(B,A);},closeInfoWindow:function(){this.marker.closeInfoWindow();},showMapBlowup:function(A){this.marker.showMapBlowup(A);},getIcon:function(){return this.marker.getIcon();},getTitle:function(){return this.marker.getTitle();},getPoint:function(){var A=this.marker.getPoint();return(new LatLng(A.lat(),A.lng()));},getLatLng:function(){var A=this.marker.getLatLng();return(new LatLng(A.lat(),A.lng()));},setPoint:function(A){this.marker.setPoint(A.toGLatLng());},setLatLng:function(A){this.marker.setLatLng(A.toGLatLng());},enableDragging:function(){this.marker.enableDragging();},disableDragging:function(){this.marker.disableDragging();},draggable:function(){return this.marker.draggable();},draggingEnabled:function(){return this.marker.draggingEnabled();},setImage:function(A){this.marker.setImage(A);},hide:function(){this.marker.hide();},show:function(){this.marker.show();},isHidden:function(){return this.marker.isHidden();},toOverlay:function(){return this.marker;},addListener:function(B,A){GEvent.addListener(this.marker,B,A);},clearListeners:function(A){GEvent.clearListeners(this.marker,A);},dispose:function(){this.marker=null;this.options=null;}});var LabeledMarker=Elong.Control.LabeledMarker;LabeledMarker=Class.create();LabeledMarker.prototype=new GMarker(new GLatLng(0,0));Object.extend(LabeledMarker.prototype,{name:"LabeledMarker",paremsIsLoaded:false,hasRedraw:false,options:{id:"divLabeled",latlng:null,imageUrl:"http://www.elongstatic.com/hotels/pic/hotel_map.gif",imageSize:null,labelText:"label",labelSize:null,labelPosition:null,isShadow:false,labelOffset:null,labelClass:null},initialize:function(A){if(!this.paremsIsLoaded){this.initDefault(A);this.paremsIsLoaded=true;Object.extend(Object.extend(this,this.options),A);this.latlng=this.latlng.isInherit?this.latlng.toLatLng():this.latlng;this.labelWidth=this.labelSize.width||(this.labelText.replace(/[^\x00-\xff]/g,"xx").length/2);this.labelClass=(this.labelClass?this.labelClass:new ControlStyle());this.labelOffset=(this.labelOffset.isInherit?this.labelOffset.toSize():this.labelOffset)||new GSize(0,0);A.icon=A.icon?A.icon:this.createIcon();var B=new Array();B.push(this.latlng);B.push(A);GMarker.apply(this,B);}else{this.initializeDOM(A);}},initDefault:function(A){if(!A.imageSize){this.options.imageSize=new Size({width:21,height:21});}if(!A.labelSize){this.options.labelSize=new Size({width:0,height:0});}if(!A.labelPosition){this.options.labelPosition=new Point({x:0,y:0});}if(!A.labelOffset){this.options.labelOffset=new Size({width:0,height:0});}},createIcon:function(){var A=new GIcon();if(this.isShadow){A.shadow="http://www.google.com/mapfiles/shadow50.png";A.shadowSize=new GSize(22,20);}A.iconSize=new GSize(0,0);A.iconAnchor=new GPoint(-7,4);A.image=this.imageUrl;if(this.imageSize&&this.imageSize.width&&this.imageSize.height){A.iconSize=new GSize(this.imageSize.width,this.imageSize.height);A.iconAnchor=new GPoint(15,25);A.infoWindowAnchor=new GPoint(9,2);A.infoShadowAnchor=new GPoint(18,25);}return A;},initializeDOM:function(B){GMarker.prototype.initialize.call(this,B);var A=document.createElement("div");if(this.labelClass.defaultStyle){this.setContainerStyle(A);}else{A.className=this.labelClass;}A.style.position="absolute";A.innerHTML=this.labelText;B.getPane(G_MAP_MARKER_PANE).appendChild(A);this.map=B;this.label=A;},redraw:function(B){GMarker.prototype.redraw.call(this,this.map);if(!B){return;}var C=this.map.fromLatLngToDivPixel(this.latlng);var A=GOverlay.getZIndex(this.latlng.lat());this.label.style.left=(C.x+this.labelOffset.width)+"px";this.label.style.top=(C.y+this.labelOffset.height)+"px";this.label.style.zIndex=A+1;},remove:function(){this.label.parentNode.removeChild(this.label);this.label=null;GMarker.prototype.remove.call(this);},setContainerStyle:function(A){A.style.textDecoration=this.labelClass.textDecoration;A.style.color=this.labelClass.color;A.style.backgroundColor=this.labelClass.backgroundColor;A.style.font=this.labelClass.font;A.style.border=this.labelClass.border;A.style.padding=this.labelClass.padding;A.style.marginBottom=this.labelClass.marginBottom;A.style.textAlign=this.labelClass.textAlign;A.style.width=this.labelWidth+"em";A.style.cursor=this.labelClass.cursor;A.style.whiteSpace=this.labelClass.nowrap;},dispose:function(){this.map=null;this.options=null;this.label=null;}});var ElongMapLabel=Elong.Control.ElongMapLabel;ElongMapLabel=Class.create();ElongMapLabel.prototype=new GMarker(new GLatLng(0,0));Object.extend(ElongMapLabel.prototype,{name:"ElongMapLabel",paremsIsLoaded:false,hasRedraw:false,options:{id:"elongMapLabel",latlng:null,labelText:"label",labelSize:null,labelClass:null},initialize:function(A){if(!this.paremsIsLoaded){this.initDefault(A);this.paremsIsLoaded=true;Object.extend(Object.extend(this,this.options),A);this.latlng=this.latlng.isInherit?this.latlng.toLatLng():this.latlng;this.labelWidth=this.labelSize.width||(this.labelText.replace(/[^\x00-\xff]/g,"xx").length/2);this.labelClass=(this.labelClass?this.labelClass:new ControlStyle());this.labelOffset=new GSize(0,0);A.icon=this.createIcon();var B=new Array();B.push(this.latlng);B.push(A);GMarker.apply(this,B);}else{this.initializeDOM(A);}},initDefault:function(A){if(!A.labelSize){this.options.labelSize=new Size({width:0,height:0});}},createIcon:function(){var A=new GIcon();A.iconSize=new GSize(0,0);A.iconAnchor=new GPoint(0,0);return A;},initializeDOM:function(C){GMarker.prototype.initialize.call(this,C);var A=document.createElement("div");if(this.labelClass.defaultStyle){}else{A.className=this.labelClass;}A.style.position="absolute";var B=(this.id&&this.id!="")?'id="'+this.id+'"':"";A.innerHTML="<span "+B+">"+this.labelText+"</span>";C.getPane(G_MAP_MARKER_PANE).appendChild(A);this.map=C;this.label=A;},redraw:function(B){GMarker.prototype.redraw.call(this,this.map);if(!B){return;}var C=this.map.fromLatLngToDivPixel(this.latlng);var A=GOverlay.getZIndex(this.latlng.lat());this.label.style.left=(C.x+this.labelOffset.width)+"px";this.label.style.top=(C.y+this.labelOffset.height)+"px";},remove:function(){this.label.parentNode.removeChild(this.label);this.label=null;GMarker.prototype.remove.call(this);},setContainerStyle:function(A){A.style.textDecoration=this.labelClass.textDecoration;A.style.color=this.labelClass.color;A.style.backgroundColor=this.labelClass.backgroundColor;A.style.font=this.labelClass.font;A.style.border=this.labelClass.border;A.style.padding=this.labelClass.padding;A.style.marginBottom=this.labelClass.marginBottom;A.style.textAlign=this.labelClass.textAlign;A.style.width=this.labelWidth+"em";A.style.cursor=this.labelClass.cursor;A.style.whiteSpace=this.labelClass.nowrap;},dispose:function(){this.map=null;this.options=null;this.label=null;}});var OverlayList=Elong.Control.OverlayList;OverlayList=Class.create();Object.extend(OverlayList.prototype,{name:"OverlayList",overlays:null,isInherit:true,initialize:function(A){this.overlays=new Array();},count:function(){return this.overlays.length;},addOverlay:function(A){this.overlays.push(A);},removeOverlay:function(A){if(A&&A.id!="undefined"){var B=this.getOverlayIndex(A.id);if(B>=0){this.overlays.splice(B,1);}}},removeOverlayById:function(A){var B=this.getOverlayIndex(A);if(B>=0){this.overlays.splice(B,1);}},removeAllOverlays:function(){this.overlays.length=0;},getOverlayIndex:function(B){for(var A=0;A<this.overlays.length;A++){if(this.overlays[A].id==B){return A;break;}}return null;},getOverlayByIndex:function(A){if(A>=0&&A<this.overlays.length){return this.overlays[A];}return null;},getOverlayById:function(A){var B=this.getOverlayIndex(A);return this.getOverlayByIndex(B);},toOverlayList:function(){var A=new Array();if(this.overlays.length>0){for(var B=0;B<this.overlays.length;B++){A.push((this.overlays[B].isInherit?this.overlays[B].toOverlay():this.overlays[B]));}}return A;},dispose:function(){if(this.overlays){this.overlays.length=0;}}});var Rectangle=Elong.Control.Rectangle;Rectangle=Class.create();Object.extend(Object.extend(Rectangle.prototype,GOverlay),{name:"Rectangle",paremsIsLoaded:false,options:{bounds:null,weight:2,color:"#888888"},initialize:function(A){if(!this.paremsIsLoaded){this.paremsIsLoaded=true;Object.extend(Object.extend(this,this.options),A);}else{this.initializeDOM(A);}},initializeDOM:function(B){var A=document.createElement("divRect");A.style.border=this.weight+"px solid "+this.color;A.style.position="absolute";B.getPane(G_MAP_MAP_PANE).appendChild(A);this.map=B;this.div=A;},setBounds:function(A){this.bounds=A;this.redraw(true);},remove:function(){if(this.div&&this.div.parentNode){this.div.parentNode.removeChild(this.div);}},copy:function(){return new Rectangle(this.bounds,this.weight,this.color);},redraw:function(C){if(!C){return;}var B=this.map.fromLatLngToDivPixel(this.bounds.getSouthWest());var A=this.map.fromLatLngToDivPixel(this.bounds.getNorthEast());this.div.style.width=Math.abs(A.x-B.x)+"px";this.div.style.height=Math.abs(A.y-B.y)+"px";this.div.style.left=(Math.min(A.x,B.x)-this.weight)+"px";this.div.style.top=(Math.min(A.y,B.y)-this.weight)+"px";},destroyDOM:function(){this.options=null;this.div=null;this.map=null;},dispose:function(){this.destroyDOM();}});var MapControl=Elong.Control.MapControl;MapControl=Class.create();Object.extend(MapControl.prototype,{name:"MapControl",mapSource:null,geocoder:null,cache:null,overlayList:new OverlayList(),baseIcon:null,textControl:null,OnReceive:null,isLoadCompleted:false,isDrawRectangle:false,rectangleOverlay:null,curRectBox:null,drawingRectangle:null,startLatLng:null,options:{containId:null,cityCode:"北京",searchType:"酒店",recordsPerPage:10,pageNum:1,keyword:null,showTools:true,zoom:13,listenEvents:null},initialize:function(A){Object.extend(Object.extend(this,this.options),A);if(Object.isNull(this.containId)){return;}this.initializeMapSource();this.initializeEvent();},initializeMapSource:function(){if(this.browserIsCompatible()){this.cache=new CapitalCitiesCache();this.geocoder=new GClientGeocoder();this.geocoder.setCache(this.cache);if(this.containId!=null){this.mapSource=new GMap2(document.getElementById(this.containId));if(this.showTools){$(document).ready(function(){this.showToolbar();this.showScale();}.bind(this));}this.addListener(ElongMapEvent.CLICK,this.map_onMouseClick.bindAsEventListener(this));this.addListener(ElongMapEvent.MOUSEMOVE,this.map_onMouseMove.bindAsEventListener(this));this.mapSource.enableScrollWheelZoom();}}},browserIsCompatible:function(){return GBrowserIsCompatible();},initializeEvent:function(){if(this.listenEvents==null){return;}for(var A=0;A<this.listenEvents.length;A++){this.addListener(this.listenEvents[A].eventName,this.listenEvents[A].eventCallBack);}},showToolbar:function(){this.mapSource.addControl(new GSmallMapControl());},showScale:function(){this.mapSource.addControl(new GScaleControl());},setCenter:function(B,A){this.setZoomAndCenter(B,A,this.zoom);},setZoomAndCenter:function(C,B,A){return this.mapSource.setCenter(new LatLng({lng:B,lat:C}).toLatLng(),A);},getOverlayById:function(B){var A=this.overlayList.getOverlayById(B);return A;},getZoomLevel:function(){return this.mapSource.getZoom();},getLatLngBounds:function(){return this.mapSource.getBounds();},openOverlayTip:function(B){var A=this.getOverlayById(B);if(A){A.openInfoWindowHtml(A.content);}},addListener:function(B,A){GEvent.addListener(this.mapSource,B,A);},removeListener:function(A){GEvent.removeListener(A);},addOverlay:function(B,A){var C=this.overlayList.getOverlayById(B.id);if(C!=null){this.overlayList.removeOverlayById(B.id);}this.overlayList.addOverlay(B);this.mapSource.addOverlay(B.isInherit?B.toOverlay():B);},removeOverlayById:function(B){var A=this.overlayList.getOverlayById(B);if(A!=null){this.overlayList.removeOverlayById(B);this.mapSource.removeOverlay(A.isInherit?A.toOverlay():A);}},removeOverlay:function(A){var B=this.overlayList.getOverlayById(A.id);if(B!=null){this.overlayList.removeOverlayById(A.id);}this.mapSource.removeOverlay(A.isInherit?A.toOverlay():A);},removeAllOverlays:function(){this.overlayList.removeAllOverlays();this.mapSource.clearOverlays();},enableDragging:function(){this.mapSource.enableDragging();},disableDragging:function(){this.mapSource.disableDragging();},enableInfoWindow:function(){this.mapSource.enableInfoWindow();},disableInfoWindow:function(){this.mapSource.disableInfoWindow();},searchByKeywords:function(C,A,B){if(C==null){return;}this.geocoder.getLatLng(C,function(E){var D=new LatLng({lat:0,lng:0});if(E){D=new LatLng({lat:E.lat(),lng:E.lng()});}B(D);}.bind(this));},getLatLng:function(A,B){this.OnReceive=B;},isLoaded:function(){return this.mapSource.isLoaded();},createMarker:function(B,A,I,D,F,J,E,C,K){if(A&&A!=0&&I&&I!=0){var H=new LatLng({lat:A,lng:I});if(D==null){D={url:"http://maps.gstatic.cn/intl/zh-CN_cn/mapfiles/transparent.png",width:0,height:0};C=false;}var G=new Marker({id:""+B+"",latlng:H,imageUrl:D.url?D.url:D,imageSize:new Size({width:D.width,height:D.height}),title:F,content:J,isShowTip:E,isShadow:C,callback:K});if(G&&E&&J){G.bindInfoWindowHtml(J);}if(K&&G){G.addListener(ElongMapEvent.CLICK,function(){K(B);});}return G;}return null;},addMarker:function(B,A,H,D,F,I,E,C,J){var G=this.createMarker(B,A,H,D,F,I,E,C,J);if(G){this.setCenter(A,H);this.addOverlay(G,true);}},createLabeledMarker:function(B,A,E,G,F,H){if(A&&A!=0&&E&&E!=0){var C=new LatLng({lat:A,lng:E});if(!F){F={url:"http://www.elongstatic.com/hotels/pic/hotel_map.gif",width:21,height:21};}var D=new LabeledMarker({id:"labelMarker_"+B,latlng:C,imageUrl:F.url,imageSize:new Size({width:F.width||21,height:F.height||21}),labelText:G,labelOffset:new Size({width:5,height:-23}),labelPosition:new Point({x:110,y:-10}),isShadow:false,labelClass:H});return D;}return null;},addLabeledMarker:function(F,D,C,G,E,A){var B=this.createLabeledMarker(F,D,C,G,E,A);if(B){this.setCenter(D,C);this.addOverlay(B,true);}},createLabel:function(F,D,C,G,A){if(D&&D!=0&&C&&C!=0){var B=new LatLng({lat:D,lng:C});var E=new ElongMapLabel({id:String(F),latlng:B,labelText:G,labelClass:A});return E;}return null;},addLabel:function(E,D,C,F,A){var B=this.createLabel(E,D,C,F,A);if(B){this.setCenter(D,C);this.addOverlay(B,true);}},doRectangleSearch:function(D){this.rectangleSearchCallback=D;this.disableInfoWindow();this.disableDragging();if(this.rectangleOverlay){this.clearRectangleOverlay();}this.rectangleOverlay=new RectangleOverlay({id:"rectangleOvelayId",weight:6,color:"blue",backgroundColor:"#ffffff",opacity:0.5,cursor:"crosshair"});RectangleOverlay.offsetLeft=100;RectangleOverlay.offsetTop=100;var B;if(document.documentElement&&document.documentElement.scrollTop){B=document.documentElement.scrollTop;}else{if(document.body){B=document.body.scrollTop;}}try{var C=jQuery("#map").offset();RectangleOverlay.offsetLeft=C.left;RectangleOverlay.offsetTop=C.top-B;}catch(A){}this.rectangleOverlay.addListener("mousedown",this.rectangleOvelay_mouseDown.bindAsEventListener(this));this.rectangleOverlay.addListener("mouseup",this.rectangleOvelay_mouseUp.bindAsEventListener(this));this.addOverlay(this.rectangleOverlay,true);},clearRectangleOverlay:function(){if(this.rectangleOverlay){this.removeOverlay(this.rectangleOverlay);}if(this.curRectBox){this.removeOverlay(this.curRectBox);}this.isDrawRectangle=false;this.rectangleOverlay=null;this.curRectBox=null;},rectangleOvelay_mouseDown:function(B){var A=this.mapSource.fromContainerPixelToLatLng(B.toPoint());this.drawingRectangle=new LatLngBounds({sw:A,ne:A});this.isDrawRectangle=true;},rectangleOvelay_mouseUp:function(B){if(this.isDrawRectangle&&this.curRectBox){var A=this.drawingRectangle.getRectLatlngBounds(this.curRectBox.bounds);if(A){if(this.rectangleSearchCallback){this.rectangleSearchCallback(A.sw,A.ne);}}this.clearRectangleOverlay();}},drawRectangleBox:function(E,A){var C=new LatLng({lat:E.lat(),lng:A.lng()});var D=new LatLng({lat:A.lat(),lng:E.lng()});var B=new LatLngBounds({sw:D.toLatLng(),ne:C.toLatLng()});if(this.curRectBox){this.curRectBox.setBounds(B);}else{this.curRectBox=new Rectangle({bounds:B});this.addOverlay(this.curRectBox,true);}},map_onMouseClick:function(A,B){if(this.isDrawRectangle){this.rectangleOvelay_mouseUp(B);}},map_onMouseDown:function(A){},map_onMouseUp:function(A){},map_onMouseMove:function(A){if(this.isDrawRectangle){var B=this.drawingRectangle.sw.Inherit?this.drawingRectangle.sw.toLatLng():this.drawingRectangle.sw;this.drawingRectangle=new LatLngBounds({sw:this.drawingRectangle.sw,ne:A});this.drawRectangleBox(B,A);}},dispose:function(){if(this.cache){this.cache.reset();}GUnload();this.mapSource=null;this.geocoder=null;this.cache=null;this.listenEvents=null;this.textControl=null;this.options=null;},unload:function(){if(this.cache){this.cache.reset();}GUnload();}});CapitalCitiesCache=function(){GGeocodeCache.apply(this);};CapitalCitiesCache.prototype=new GGeocodeCache();CapitalCitiesCache.prototype.reset=function(){GGeocodeCache.prototype.reset.call(this);};Overlay=function(){GOverlay.apply(this);};Overlay.prototype=new GOverlay();var RectangleOverlay=Elong.Control.RectangleOverlay;RectangleOverlay=Class.create();RectangleOverlay._hash={};RectangleOverlay.offsetLeft=0;RectangleOverlay.offsetTop=0;Object.extend(Object.extend(RectangleOverlay.prototype,GOverlay),{name:"RectangleOverlay",paremsIsLoaded:false,options:{id:"rectangleOverlay",weight:2,color:"#888888",backgroundColor:"#888888",opacity:null,cursor:null},initialize:function(A){if(!this.paremsIsLoaded){this.paremsIsLoaded=true;Object.extend(Object.extend(this,this.options),A);}else{this.initializeDOM(A);}},initializeDOM:function(B){var A=document.createElement("divRectOverlay");A.style.border=this.weight+"px solid "+this.color;A.style.position="absolute";A.style.background=this.backgroundColor;var C=this.opacity*100;A.style.filter="alpha(opacity="+C+")";A.style.MozOpacity=this.opacity;A.style.opacity=this.opacity;A.style.cursor=this.cursor;B.getPane(G_MAP_MAP_PANE).appendChild(A);if(window.addEventListener){A.addEventListener("mousedown",this.onmousedown,false);A.addEventListener("mouseup",this.onmouseup,false);}else{A.attachEvent("onmousedown",this.onmousedown);A.attachEvent("onmouseup",this.onmouseup);}this.map=B;this.div=A;},remove:function(){if(this.div&&this.div.parentNode){this.div.parentNode.removeChild(this.div);}},copy:function(){return new RectangleOverlay(this.weight,this.color,this.backgroundColor,this.opacity,this.cursor);},redraw:function(C){if(!C){return;}var B=this.map.fromLatLngToDivPixel(this.map.getBounds().getSouthWest());var A=this.map.fromLatLngToDivPixel(this.map.getBounds().getNorthEast());this.div.style.width=Math.abs(A.x-B.x)+"px";this.div.style.height=Math.abs(A.y-B.y)+"px";this.div.style.left=(Math.min(A.x,B.x)-this.weight)+"px";this.div.style.top=(Math.min(A.y,B.y)-this.weight)+"px";},onmousedown:function(){if(RectangleOverlay._hash){var A=(arguments[0]||window.event);var C=new Point({x:A.clientX-RectangleOverlay.offsetLeft,y:A.clientY-RectangleOverlay.offsetTop});var B=RectangleOverlay._hash["mousedown"];if(typeof(B)!="undefined"){B(C);}}},onmouseup:function(){if(RectangleOverlay._hash){var A=(arguments[0]||window.event);var C=new Point({x:A.clientX-RectangleOverlay.offsetLeft,y:A.clientY-RectangleOverlay.offsetTop});var B=RectangleOverlay._hash["mouseup"];if(typeof(B)!="undefined"){B(C);}}},addListener:function(B,A){RectangleOverlay._hash[B]=A;},clearListeners:function(){if(RectangleOverlay._hash){RectangleOverlay._hash={};}},destroyDOM:function(){this.options=null;this.map=null;this.div=null;},dispose:function(){this.destroyDOM();}});var TextControl=Elong.Control.TextControl;TextControl=Class.create();Object.extend(Object.extend(TextControl.prototype,GControl),{name:"TextControl",paremsIsLoaded:false,options:{point:null,content:null,style:null},initialize:function(A){if(!this.paremsIsLoaded){this.paremsIsLoaded=true;Object.extend(Object.extend(this,this.options),A);}else{this.initializeDOM(A);}},initializeDOM:function(A){var B=document.createElement("divCtr");this.setContainerStyle(B);B.appendChild(document.createTextNode(this.content));A.getContainer().appendChild(B);return B;},getDefaultPosition:function(){return(new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(this.point.x+12,this.point.y-4)));},setContainerStyle:function(A){A.style.textDecoration=this.style.textDecoration;A.style.color=this.style.color;A.style.backgroundColor=this.style.backgroundColor;A.style.font=this.style.font;A.style.border=this.style.border;A.style.padding=this.style.padding;A.style.marginBottom=this.style.marginBottom;A.style.textAlign=this.style.textAlign;A.style.width=this.style.width;A.style.cursor=this.style.cursor;A.style.whiteSpace=this.style.nowrap;},dispose:function(){this.options=null;}});