
var EmMap;var EmMapControl=function(element,settings){this.element=EmUtil.getElementById(element);if(!GBrowserIsCompatible()){var browserError='<p style="padding: 10px;">Sorry but google maps is not compatable with your web browser, it is recommeded that you upgrade your browser to get the best experience from this website.</p>';if(this.element.innerHTML!=undefined){this.element.innerHTML=browserError;}
else{alert(browserError);}}
this.imageDir=null;this.contextRoot=null;this.markersDir=null;this.markersSize='small';this.siteRoot='/';this.xmlPageSize=1000;this.zoomPoint=null;if(typeof(settings)=='object'){this.imagedDir=(!settings.imagesDir?this.imagedDir:settings.imagesDir);this.contextRoot=(!settings.contextRoot?this.contextRoot:settings.contextRoot);this.siteRoot=(!settings.siteRoot?this.siteRoot:settings.siteRoot);this.markersDir=(!settings.markersDir?this.markersDir:settings.markersDir);this.markersSize=(!settings.markersSize?this.markersSize:settings.markersSize);if(settings.width&&settings.height)
this.mapSize=new GSize(settings.width,settings.height);}
this.savedLocations=[];this.savedLocations['uk']=[54.559323,-3.823242,5];this.getSiteRoot=function(){return this.siteRoot;}
this.getContextRoot=function(){if(this.contextRoot)
return this.contextRoot;return this.getSiteRoot();}
this.getImagesDir=function(){if(this.imageDir)
return this.imageDir;else
return this.getSiteRoot()+'/images/map';}
this.getMarkersDir=function(){if(this.markersDir)
return this.markersDir;else
return this.getImagesDir()+'/markers';}
this.removeMap=function(){if(!this.mapRemoved){this.element.parentNode.removeChild(this.element);this.mapRemoved=true;}
GUnload();EmMap=null;}
this.centerOnMarkers=function(){if(this.markers.length>0){var newBounds=new GLatLngBounds(this.markers[0].getPoint(),this.markers[0].getPoint());for(var i=0;i<this.markers.length;i++){newBounds.extend(this.markers[i].getPoint());}
this.googleMap.setCenter(newBounds.getCenter(),this.googleMap.getBoundsZoomLevel(newBounds));this.googleMap.savePosition();}}
this.gotoLocation=function(name)
{var location=this.savedLocations[name];if(location){this.googleMap.setCenter(new GLatLng(location[0],location[1]),location[2]);this.googleMap.savePosition();}}
this.ukView=function(){this.gotoLocation('uk');}
this.markers=[];this.search=null;this.removeMarkers=function(){this.infoWindowControl.hide();for(i=0;i<this.markers.length;i++)
this.googleMap.removeOverlay(this.markers[i]);this.markers=[];this.search=null;}
this.hideMarkers=function(){for(i=0;i<this.markers.length;i++)
this.googleMap.removeOverlay(this.markers[i]);}
this.showMarkers=function(){for(i=0;i<this.markers.length;i++)
this.googleMap.addOverlay(this.markers[i]);}
this.addMarker=function(lat,lng,label,id,count,icon){var marker=new GMarker(new GLatLng(lat,lng),(icon?icon:this.singleIcon));marker.label=label;marker.id=id;if(count==1){this.infoWindowControl.handleMarker(marker);}
this.markers[this.markers.length]=marker;this.tooltipControl.handleMarker(marker);this.googleMap.addOverlay(marker);return marker;}
this.loadAll=function(pt,st,q,center,zoom,circleRad){this.removeMarkers();var searchPath='residential/sale';if(EmSearch.getCurrentPath())
searchPath=EmSearch.getCurrentPath().substring(11);this.search="~/data/map/"+searchPath+'?q='+q+'&ts='+new Date().getTime();var request=GXmlHttp.create();request.open("GET",EmUtil.resolveUrl(this.search),true);request.onreadystatechange=EmUtil.createClosure(this,function(center,zoom,circleRad){if(request.readyState==4){var map=eval('('+request.responseText+')');if(center&&zoom){this.googleMap.setCenter(center,zoom);}
else if(map.n==0&&map.e==0&&map.w==0&&map.s==0){this.gotoLocation('uk');}
else{var bounds=new GLatLngBounds(new GLatLng(map.s,map.w),new GLatLng(map.n,map.e));this.centerMap(bounds);this.googleMap.savePosition();center=bounds.getCenter();}
if(circleRad&&!(map.n==0&&map.e==0&&map.w==0&&map.s==0)&&map.rc){this.drawCircle(new GLatLng(map.rc.lat,map.rc.lng),circleRad,'#0000ff',5,0.5,'#0000ff',0);}}},center,zoom,circleRad);request.send(null);}
this.centerMap=function(bounds){var bleed=Math.pow(2,17-this.googleMap.getZoom())/150000;var newBounds=new GLatLngBounds(new GLatLng(bounds.getSouthWest().lat()-bleed,bounds.getSouthWest().lng()-bleed),new GLatLng(bounds.getNorthEast().lat()+bleed,bounds.getNorthEast().lng()+bleed));this.googleMap.setCenter(newBounds.getCenter(),this.googleMap.getBoundsZoomLevel(newBounds));}
this.clusteringSuspended=false;this.loadVisRequestNum=0;this.loadVisible=function(pt,st,q){if(this.search&&!this.clusteringSuspended){this.loadingControl.show();var search=this.search;this.removeMarkers();this.search=search;var b=this.googleMap.getBounds();var ne=b.getNorthEast();var sw=b.getSouthWest();var url=EmUtil.resolveUrl(this.search+'&z='+this.googleMap.getZoom()+'&n='+ne.lat()+'&e='+ne.lng()+'&s='+sw.lat()+'&w='+sw.lng()+'&ts='+new Date().getTime()+'&ms='+this.markersSize);var request=GXmlHttp.create();request.open("GET",url,true);var reqNum=++this.loadVisRequestNum;request.onreadystatechange=EmUtil.createClosure(this,function(reqNum){if(request.readyState==4&&reqNum==this.loadVisRequestNum){var clusters=eval('('+request.responseText+')');if(clusters.length==0)
this.loadingControl.hide();for(var i=0;i<clusters.length;i++){var lat=parseFloat(clusters[i].lat);var lng=parseFloat(clusters[i].lng);var marker=this.addMarker(lat,lng,clusters[i].lbl,clusters[i].id,clusters[i].size,(clusters[i].size>1?this.multiIcon:this.singleIcon));if(clusters[i].size>1){GEvent.addListener(marker,'click',EmUtil.createClosure(this,function(n,s,e,w,marker){var bounds=new GLatLngBounds(new GLatLng(s,w),new GLatLng(n,e));var zoom=this.googleMap.getBoundsZoomLevel(bounds);if(zoom!=this.googleMap.getZoom())
this.centerMap(bounds);else
this.stackedPickerControl.onClick(marker);},clusters[i].n,clusters[i].s,clusters[i].e,clusters[i].w,marker));}}}},reqNum);request.send(null);}}
this.events=[];this.attachEvent=function(evt,fn){var funs=this.events[evt];if(!funs){funs=[];this.events[evt]=funs;}
for(var i=0;i<funs.length;i++){if(funs[i]==fn){return;}}
funs[funs.length]=fn;}
this.removeEvent=function(evt,fn){var funs=this.events[evt];if(!funs)
return;for(var i=0;i<funs.length;i++){if(funs[i]==fn){funs[i]=null;return;}}}
this.runEvent=function(evt){var rtn=true;var funs=this.events[evt];if(!funs)
return;for(var i=0;i<funs.length;i++){if(funs[i])
rtn=rtn&funs[i]();}
this.events[evt]=null;return rtn;}
this.drawCircle=function(center,radius,liColor,liWidth,liOpa,fillColor,fillOpa){var latConv=center.distanceFrom(new GLatLng(center.lat()+0.1,center.lng()))/100;var lngConv=center.distanceFrom(new GLatLng(center.lat(),center.lng()+0.1))/100;radius=radius*1.609344;var points=[];var step=parseInt(360/(Math.floor(radius)*10))||10;for(var i=0;i<=360;i+=step){var pint=new GLatLng(center.lat()+(radius/latConv*Math.cos(i*Math.PI/180)),center.lng()+
(radius/lngConv*Math.sin(i*Math.PI/180)));points.push(pint);}
fillColor=fillColor||liColor||"#0055ff";liWidth=liWidth||2;var poly=new GPolygon(points,liColor,liWidth,liOpa,fillColor,fillOpa);this.googleMap.addOverlay(poly);}
var opts=new Object();if(this.mapSize){opts.size=this.mapSize;}
this.googleMap=new GMap2(this.element,opts);var toolbar=document.createElement("div");this.googleMap.getContainer().appendChild(toolbar);toolbar.style.height='30px';toolbar.style.position='relative';toolbar.style.top='-30px';toolbar.className='tbar';var toolbarLeft=document.createElement("div");toolbarLeft.className='left';var toolbarRight=document.createElement("div");toolbarRight.className='right';toolbar.appendChild(toolbarLeft);toolbar.appendChild(toolbarRight);this.zoomControl=new EmZoomControl(this);this.googleMap.addControl(this.zoomControl);this.googleMap.addControl(new EmTypeControl());this.loadingControl=new EmLoadingControl(this);this.googleMap.addControl(this.loadingControl);this.tooltipControl=new EmTooltipControl(this);this.googleMap.addControl(this.tooltipControl);this.infoWindowControl=new EmInfoWindowControl(this);this.googleMap.addControl(this.infoWindowControl);this.stackedPickerControl=new EmStackedPickerControl(this);this.googleMap.addControl(this.stackedPickerControl);this.loadingControl.hide();this.gotoLocation('uk');this.singleIcon=new GIcon();this.singleIcon.image=EmUtil.resolveUrl(this.getMarkersDir()+'/Single.png');this.singleIcon.shadow=EmUtil.resolveUrl(this.getMarkersDir()+'/ShadowSingle.png');this.singleIcon.iconSize=(this.markersSize=='large'?new GSize(27,34):new GSize(27,34));this.singleIcon.shadowSize=(this.markersSize=='large'?new GSize(45,34):new GSize(45,34));this.singleIcon.iconAnchor=(this.markersSize=='large'?new GPoint(16,32):new GPoint(16,32));this.singleIcon.infoWindowAnchor=(this.markersSize=='large'?new GPoint(13,2):new GPoint(13,2));this.singleIcon.transparent=EmUtil.resolveUrl(this.markersDir+'/TransparentSingle.png');this.multiIcon=new GIcon();this.multiIcon.image=EmUtil.resolveUrl(this.getMarkersDir()+'/Multi.png');this.multiIcon.shadow=EmUtil.resolveUrl(this.getMarkersDir()+'/ShadowMulti.png');this.multiIcon.iconSize=(this.markersSize=='large'?new GSize(29,34):new GSize(29,34));this.multiIcon.shadowSize=(this.markersSize=='large'?new GSize(44,34):new GSize(44,34));this.multiIcon.iconAnchor=(this.markersSize=='large'?new GPoint(15,32):new GPoint(15,32));this.multiIcon.infoWindowAnchor=(this.markersSize=='large'?new GPoint(13,2):new GPoint(13,2));this.multiIcon.transparent=EmUtil.resolveUrl(this.getMarkersDir()+'/TransparentMulti.png');GEvent.addListener(this.googleMap,'moveend',EmUtil.createClosure(this,function(){this.loadVisible();},true));GEvent.addListener(this.googleMap,'addoverlay',EmUtil.createClosure(this,function(){this.loadingControl.hide();},true));GEvent.addDomListener(window,'unload',GUnload);this.runEvent('ready');}
function EmTypeControl(){this.btnNormal_click=function(){this.map.setMapType(G_NORMAL_MAP);EmUtil.removeClass(this.btnHybrid,'active');EmUtil.removeClass(this.btnSatellite,'active');EmUtil.addClass(this.btnNormal,'active');}
this.btnSatellite_click=function(){this.map.setMapType(G_SATELLITE_MAP);EmUtil.removeClass(this.btnHybrid,'active');EmUtil.removeClass(this.btnNormal,'active');EmUtil.addClass(this.btnSatellite,'active');}
this.btnHybrid_click=function(){this.map.setMapType(G_HYBRID_MAP);EmUtil.removeClass(this.btnSatellite,'active');EmUtil.removeClass(this.btnNormal,'active');EmUtil.addClass(this.btnHybrid,'active');}}
EmTypeControl.prototype=new GControl();EmTypeControl.prototype.initialize=function(map){this.map=map;var container=document.createElement("div");container.className='type';this.btnNormal=document.createElement("div");this.btnNormal.className='btn active';this.btnNormal.innerHTML='<span class="left"></span><span class="text">STREET</span><span class="right"></span>';container.appendChild(this.btnNormal);GEvent.addDomListener(this.btnNormal,'click',EmUtil.createClosure(this,this.btnNormal_click));this.btnSatellite=document.createElement("div");this.btnSatellite.className='btn';this.btnSatellite.innerHTML='<span class="left"></span><span class="text">SAT</span><span class="right"></span>';container.appendChild(this.btnSatellite);GEvent.addDomListener(this.btnSatellite,'click',EmUtil.createClosure(this,this.btnSatellite_click));this.btnHybrid=document.createElement("div");this.btnHybrid.className='btn';this.btnHybrid.innerHTML='<span class="left"></span><span class="text">HYBRID</span><span class="right"></span>';container.appendChild(this.btnHybrid);GEvent.addDomListener(this.btnHybrid,'click',EmUtil.createClosure(this,this.btnHybrid_click));map.getContainer().appendChild(container);return container;}
EmTypeControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(5,-29));}
function EmZoomControl(emMap){this.levBtns=[];this.emMap=emMap;this.enabled=true;this.setZoom=function(z){if(this.enabled)this.map.setZoom(z);}
this.btnPlus_click=function(){var zoom=this.map.getZoom();this.setZoom(zoom+1);}
this.btnMinus_click=function(){var zoom=this.map.getZoom();if(zoom>3){this.setZoom(zoom-1);}}
this.btnLevel_click=function(level){this.setZoom(level);}
this.btnLevel_over=function(level){EmUtil.addClass(this.levBtns[level],'hover');}
this.btnLevel_out=function(level){EmUtil.removeClass(this.levBtns[level],'hover');}
this.highlightZoomLevels=function(){var level=this.map.getZoom();var half=(level%2==0);if(half)level--;for(var i=1;i<=17;i+=2){EmUtil.removeClass(this.levBtns[i],'hover');EmUtil.removeClass(this.levBtns[i],'half');EmUtil.removeClass(this.levBtns[i],'full');if(i<=level)EmUtil.addClass(this.levBtns[i],'full');}
if(half){EmUtil.addClass(this.levBtns[level+2],'half');}}}
EmZoomControl.prototype=new GControl();EmZoomControl.prototype.initialize=function(map){this.map=map;var container=document.createElement("div");container.className='zoom';var btnMinus=document.createElement("div");btnMinus.className='minus';btnMinus.title='Zoom out';container.appendChild(btnMinus);var zLev5=document.createElement("div");zLev5.className='lev lev1';container.appendChild(zLev5);this.levBtns[5]=zLev5;GEvent.addDomListener(zLev5,'click',EmUtil.createClosure(this,this.btnLevel_click,5));GEvent.addDomListener(zLev5,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,5));GEvent.addDomListener(zLev5,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,5));var zLev7=document.createElement("div");zLev7.className='lev lev2';container.appendChild(zLev7);this.levBtns[7]=zLev7;GEvent.addDomListener(zLev7,'click',EmUtil.createClosure(this,this.btnLevel_click,7));GEvent.addDomListener(zLev7,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,7));GEvent.addDomListener(zLev7,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,7));var zLev9=document.createElement("div");zLev9.className='lev lev3';container.appendChild(zLev9);this.levBtns[9]=zLev9;GEvent.addDomListener(zLev9,'click',EmUtil.createClosure(this,this.btnLevel_click,9));GEvent.addDomListener(zLev9,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,9));GEvent.addDomListener(zLev9,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,9));var zLev11=document.createElement("div");zLev11.className='lev lev4';container.appendChild(zLev11);this.levBtns[11]=zLev11;GEvent.addDomListener(zLev11,'click',EmUtil.createClosure(this,this.btnLevel_click,11));GEvent.addDomListener(zLev11,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,11));GEvent.addDomListener(zLev11,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,11));var zLev13=document.createElement("div");zLev13.className='lev lev5';container.appendChild(zLev13);this.levBtns[13]=zLev13;GEvent.addDomListener(zLev13,'click',EmUtil.createClosure(this,this.btnLevel_click,13));GEvent.addDomListener(zLev13,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,13));GEvent.addDomListener(zLev13,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,13));var zLev15=document.createElement("div");zLev15.className='lev lev6';container.appendChild(zLev15);this.levBtns[15]=zLev15;GEvent.addDomListener(zLev15,'click',EmUtil.createClosure(this,this.btnLevel_click,15));GEvent.addDomListener(zLev15,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,15));GEvent.addDomListener(zLev15,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,15));var zLev17=document.createElement("div");zLev17.className='lev lev7';container.appendChild(zLev17);this.levBtns[17]=zLev17;GEvent.addDomListener(zLev17,'click',EmUtil.createClosure(this,this.btnLevel_click,17));GEvent.addDomListener(zLev17,'mouseover',EmUtil.createClosure(this,this.btnLevel_over,17));GEvent.addDomListener(zLev17,'mouseout',EmUtil.createClosure(this,this.btnLevel_out,17));var btnPlus=document.createElement("div");btnPlus.className='plus';btnPlus.title='Zoom in';container.appendChild(btnPlus);GEvent.addDomListener(btnMinus,'click',EmUtil.createClosure(this,this.btnMinus_click));GEvent.addDomListener(btnPlus,'click',EmUtil.createClosure(this,this.btnPlus_click));GEvent.addListener(map,'zoomend',EmUtil.createClosure(this,this.highlightZoomLevels));map.getContainer().appendChild(container);return container;}
EmZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(5,-29));}
function EmLoadingControl(emMap){this.emMap=emMap;this.show=function(){this.container.style.display='block';}
this.hide=function(){this.container.style.display='none';}}
EmLoadingControl.prototype=new GControl();EmLoadingControl.prototype.getDefaultPosition=function(){var mapSize=this.emMap.googleMap.getSize();return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));}
EmLoadingControl.prototype.initialize=function(map){this.map=map;var mapSize=map.getSize();this.container=document.createElement("div");this.container.className='loading';this.container.style.width=mapSize.width+'px';this.container.style.height=mapSize.height+'px';this.container.style.textAlign='center';var img=document.createElement("img");img.src=EmUtil.resolveUrl('/_resources/images/loader.gif');img.style.paddingTop=((mapSize.height/2)-12)+'px';this.container.appendChild(img);this.container.display='none';map.getContainer().appendChild(this.container);return this.container;}
function EmTooltipControl(emMap){this.emMap=emMap;this.show=function(marker){this.container.style.display='block';this.container.style.visibility='hidden';this.container.innerHTML=marker.label;this.container.style.width='';var width=EmUtil.getElementWidth(this.container);if(width>150)
this.container.style.width='150px';var point=this.emMap.googleMap.getCurrentMapType().getProjection().fromLatLngToPixel(this.emMap.googleMap.getBounds().getSouthWest(),this.emMap.googleMap.getZoom());var offset=this.emMap.googleMap.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),this.emMap.googleMap.getZoom());var anchor=marker.getIcon().iconAnchor;var width=marker.getIcon().iconSize.width;var pos=new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(offset.x-point.x-anchor.x+width-8,-offset.y+point.y+anchor.y-8));pos.apply(this.container);this.container.style.top='';this.container.style.visibility='visible';}
this.hide=function(){this.container.style.display='none';}
this.handleMarker=function(marker){GEvent.addListener(marker,'mouseover',EmUtil.createClosure(this,function(marker){this.show(marker);},marker));GEvent.addListener(marker,'mouseout',EmUtil.createClosure(this,function(){this.hide();}));GEvent.addListener(marker,'click',EmUtil.createClosure(this,function(){this.hide();}));}}
EmTooltipControl.prototype=new GControl();EmTooltipControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));}
EmTooltipControl.prototype.initialize=function(map){this.map=map;var mapSize=map.getSize();this.container=document.createElement("div");this.container.className='tooltip';this.container.style.position='absolute';this.container.style.display='none';map.getContainer().appendChild(this.container);return this.container;}
function EmInfoWindowControl(emMap){this.emMap=emMap;this.height=120;this.show=function(marker){this.container.style.display='block';this.container.style.top='0';this.container.style.left='0';this.container.style.width=this.emMap.googleMap.getSize().width+'px';this.container.style.height='120px';}
this.hide=function(){this.container.style.display='none';if(this.savedPosition){GEvent.removeListener(this.listener);this.emMap.googleMap.setCenter(this.savedPosition,this.savedZoom);this.savedPosition=null;this.savedZoom=null;this.emMap.googleMap.enableDragging();this.emMap.googleMap.clearOverlays();this.emMap.showMarkers();}
this.emMap.clusteringSuspended=false;}
this.centerZoom=function(marker){this.setMapCenter(marker,this.emMap.googleMap.getZoom());}
this.handleMarker=function(marker){GEvent.addListener(marker,'click',EmUtil.createClosure(this,this.onClick,marker));}
this.onClick=function(marker,id){this.content.innerHTML='';this.emMap.clusteringSuspended=true;this.savedPosition=this.emMap.googleMap.getCenter();this.savedZoom=this.emMap.googleMap.getZoom();var zoom=this.savedZoom;if(zoom<14)
zoom=14;this.setMapCenter(marker,zoom);this.emMap.hideMarkers();this.emMap.googleMap.addOverlay(new GMarker(marker.getPoint(),this.emMap.singleIcon));this.show(marker);this.emMap.googleMap.disableDragging();this.listener=GEvent.addListener(this.emMap.googleMap,'zoomend',EmUtil.createClosure(this,this.centerZoom,marker));EmAjax.loadElement(EmUtil.resolveUrl('~/mapinfowindow/'+(id?id:marker.id)),'windowContent',this.content);}
this.setMapCenter=function(marker,zoom){var markerPoint=this.emMap.googleMap.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),zoom);var pos=this.emMap.googleMap.getCurrentMapType().getProjection().fromPixelToLatLng(new GPoint(markerPoint.x,(markerPoint.y-(this.emMap.googleMap.getSize().height/2))+((this.emMap.googleMap.getSize().height-this.height)/2)),zoom);this.emMap.googleMap.setCenter(pos,zoom);}}
EmInfoWindowControl.prototype=new GControl();EmInfoWindowControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));}
EmInfoWindowControl.prototype.initialize=function(map){this.map=map;var mapSize=map.getSize();this.container=document.createElement("div");this.container.className='infoWindow';this.container.style.position='absolute';this.container.style.display='none';var close=document.createElement("a");close.className='close';close.href='javascript:;';close.style.position='absolute';close.style.right='0px';close.style.top='0px';close.innerHTML='X';EmUtil.attachEvent(close,'click',EmUtil.createClosure(this,this.hide));this.container.appendChild(close);this.content=document.createElement("div");this.content.className='content';this.container.appendChild(this.content);map.getContainer().appendChild(this.container);return this.container;}
function EmStackedPickerControl(emMap){this.emMap=emMap;this.height=120;this.show=function(marker){this.emMap.zoomControl.enabled=false;this.container.style.display='block';this.container.style.top='0';this.container.style.left='0';this.container.style.width=this.emMap.googleMap.getSize().width+'px';this.container.style.height=(this.emMap.googleMap.getSize().height)+'px';this.marker=marker;}
this.hide=function(){this.container.style.display='none';this.emMap.clusteringSuspended=false;this.emMap.zoomControl.enabled=true;}
this.centerZoom=function(marker){this.setMapCenter(marker,this.emMap.googleMap.getZoom());}
this.onClick=function(marker){this.content.innerHTML='';this.show(marker);this.emMap.clusteringSuspended=true;EmAjax.loadElement(EmUtil.resolveUrl('~/mapstackedinfowindow/'+(marker.id)),'windowContent',this.content);}
this.showInfoWindow=function(lpr){this.hide();this.emMap.infoWindowControl.onClick(this.marker,lpr);}
this.setMapCenter=function(marker,zoom){var markerPoint=this.emMap.googleMap.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),zoom);var pos=this.emMap.googleMap.getCurrentMapType().getProjection().fromPixelToLatLng(new GPoint(markerPoint.x,(markerPoint.y-(this.emMap.googleMap.getSize().height/2))+((this.emMap.googleMap.getSize().height-this.height)/2)),zoom);this.emMap.googleMap.setCenter(pos,zoom);}}
EmStackedPickerControl.prototype=new GControl();EmStackedPickerControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));}
EmStackedPickerControl.prototype.initialize=function(map){this.map=map;var mapSize=map.getSize();this.container=document.createElement("div");this.container.className='stackedPicker';this.container.style.position='absolute';this.container.style.display='none';var close=document.createElement("a");close.className='close';close.href='javascript:;';close.innerHTML='&lt; Return to the map';EmUtil.attachEvent(close,'click',EmUtil.createClosure(this,this.hide));this.container.appendChild(close);this.content=document.createElement("div");this.content.className='content';this.content.style.height=(this.map.getSize().height-25)+'px';this.container.appendChild(this.content);map.getContainer().appendChild(this.container);return this.container;}