var notOver=true;var addBookmarkObj={exec:function(title,url){var ua=navigator.userAgent.toLowerCase();var isKonq=(ua.indexOf('konqueror')!=-1);var isSafari=(ua.indexOf('webkit')!=-1);var isMac=(ua.indexOf('mac')!=-1);var buttonStr=isMac?'Command/Cmd':'CTRL';if(window.external&&(!document.createTextNode||(typeof(window.external.AddFavorite)=='unknown'))){window.external.AddFavorite(url,title)}else if(isKonq){alert('You need to press CTRL + B to bookmark our site.')}else if(window.opera){void(0)}else if(window.home||isSafari){alert('Unfortunately your browser does not support bookmaking within a web page. After clicking \"OK\" below please use '+buttonStr+' + D to bookmark this listing')}else if(!window.print||isMac){alert('You need to press Command/Cmd + D to bookmark our site.')}else{alert('In order to bookmark this site you need to do so manually '+'through your browser.')}}};var MapingID=null;var map=null;var WhereAmI=0;var VToken="<%=GetVECustomerToken() %>";var pinInfo=new Array();var points=null;var tempPoints=null;var num=0;var tempShape=null;var startPin=null;var shape=null;var polyLayer=null;var polyLayer2=null;var startPointSet=null;var selecting=null;var startX=null;var startY=null;var StartLatLon=null;var currentX=null;var currentY=null;var EndLatLon=null;var selectBox=null;var polyline=null;var polylineMask=null;var moving=false;var currentDragHandle=null;var pinLayer=null;var pointIndex=null;var Mapping={AddListPushPin:function(lat,lon,count,label){var pointHolder=new VELatLong(parseFloat(lat),parseFloat(lon));var imageSTR="/images/pushpin.png";pinInfo[count]=new VEShape(VEShapeType.Pushpin,pointHolder);pinInfo[count].SetCustomIcon(imageSTR);pinInfo[count].SetTitle("");pinInfo[count].SetDescription(label);pinInfo[count].PinID=count;map.AddShape(pinInfo[count])},ClearMap:function(){if(tempShape){map.DeleteShape(tempShape)}if(startPin){map.DeleteShape(startPin)}if(selectBox){map.DeleteShape(selectBox)}if(polylineMask){map.DeleteShape(polylineMask)}if(pinLayer){map.DeleteShapeLayer(pinLayer)}map.DetachEvent("onmousemove",EditRecMoveHandler);map.DetachEvent("onmousedown",EditRecDownHandler);map.DetachEvent("onmouseup",EditRecUpHandler);map.DetachEvent("onmousemove",EditPolyMoveHandler);map.DetachEvent("onmousedown",EditPolyDownHandler);map.DetachEvent("onmouseup",EditPolyUpHandler);$("#propCount").hide();$(MapingID).val("")},CloseInfoBoxes:function(pinID){if(map){if(pinInfo[pinID]){var currentShape=map.GetShapeByID(pinInfo[pinID].GetID());var currentIcon=currentShape.GetCustomIcon();var imageSTR="/images/pushpin.png";currentShape.SetCustomIcon(imageSTR);currentShape.SetZIndex(1000,null);map.HideInfoBox();document.getElementById("listinElement_"+pinID).className="color5"}}},EndDrawing:function(){map.AttachEvent("onmousemove",EditPolyMoveHandler);map.AttachEvent("onmousedown",EditPolyDownHandler);map.AttachEvent("onmouseup",EditPolyUpHandler);polyline=tempShape;polylineMask=new VEShape(VEShapeType.Polygon,points);polylineMask.HideIcon();polylineMask.Hide();polylineMask.SetLineColor(new VEColor(0,0,0,0.5));polylineMask.SetFillColor(new VEColor(0,0,0,0.0));polylineMask.Primitives[0].symbol.stroke_dashstyle="Dash";map.AddShape(polylineMask);pinLayer=new VEShapeLayer();map.AddShapeLayer(pinLayer);for(i=0;i<=(points.length-1);i++){var dragHandle=new VEShape(VEShapeType.Pushpin,points[i]);dragHandle.SetCustomIcon('/images/DragHandle.gif');pinLayer.AddShape(dragHandle)}$(MapingID).val(points);idxAjax.runSearch(points);DetachDrawingEvents();map.DeleteShape(startPin)},GetDefaultMap:function(){map=new VEMap('myMap');map.LoadMap()},GetMap:function(lat,lon){map=null;map=new VEMap('myMap');map.SetClientToken(VToken);map.LoadMap(null,null,VEMapStyle.Aerial);var latlon=new VELatLong(lat,lon);DoCenterZoom(latlon)},GetMapElement:function(){var pos=$(".mapControl").offset();var width=$(".mapControl").width();$("#drawControlsContainer").css({"left":(pos.left+width)-135+"px","top":(pos.top)+"px"});$("#poly").css({"left":(pos.left+width)-130+"px","top":(pos.top+5)+"px"});$("#poly").hover(function(){$("#drawControls").fadeTo("fast",0.80)},function(){$("#drawControls").fadeTo("fast",0.60)});$("#propCount").css({"left":(pos.left+65)+"px","top":(pos.top+30)+"px"});MapingID="#"+controlID;map=new VEMap('mapControlNew');var mapView=$("#mapView").val();var mapMinX=$("#mapMinX").val();var mapMinY=$("#mapMinY").val();var mapMaxX=$("#mapMaxX").val();var mapMaxY=$("#mapMaxY").val();var mapZoom=$("#mapZoom").val();var mapTraffic=$("#mapTraffic").val();var mapStyle=null;var mapLocations=new Array();switch(mapView){case"1":mapStyle=VEMapStyle.Road;break;case"2":mapStyle=VEMapStyle.Aerial;break;case"3":mapStyle=VEMapStyle.Hybrid;break}if(mapMaxX!=0){mapLocations.push(new VELatLong(mapMinX,mapMinY));mapLocations.push(new VELatLong(mapMaxX,mapMaxY));map.LoadMap();this.SetMap(mapLocations)}else{map.LoadMap(new VELatLong(mapMinX,mapMinY),mapZoom,mapStyle)}if(mapTraffic=="True"){map.LoadTraffic(true)}var ElementTxtBox=$(MapingID);if(ElementTxtBox.val()!=""){var corrdsArray=new Array();corrdsArray=ElementTxtBox.val().split(",");points=new Array();for(i=0;i<=(corrdsArray.length/2)-1;i++){var x=corrdsArray[i*2];var y=corrdsArray[(i*2)+1];points.push(new VELatLong(x,y))}if(points.length==4&&points[0].Latitude==points[1].Latitude){selectBox=new VEShape(VEShapeType.Polygon,points);selectBox.HideIcon();selectBox.SetLineWidth(2);selectBox.SetFillColor(new VEColor(153,153,153,0.4));selectBox.SetLineColor(new VEColor(153,153,153,1.0));selectBox.ShowDetailOnMouseOver=false;selectBox.SetLineWidth(2);map.AddShape(selectBox);map.AttachEvent("onmousemove",EditRecMoveHandler);map.AttachEvent("onmousedown",EditRecDownHandler);map.AttachEvent("onmouseup",EditRecUpHandler);polyline=selectBox;polylineMask=new VEShape(VEShapeType.Polygon,points);polylineMask.HideIcon();polylineMask.Hide();polylineMask.SetLineColor(new VEColor(0,0,0,0.5));polylineMask.SetFillColor(new VEColor(0,0,0,0.0));polylineMask.Primitives[0].symbol.stroke_dashstyle="Dash";map.AddShape(polylineMask);pinLayer=new VEShapeLayer();map.AddShapeLayer(pinLayer);for(i=0;i<=(points.length-1);i++){var dragHandle=new VEShape(VEShapeType.Pushpin,points[i]);dragHandle.SetCustomIcon('/images/DragHandle.gif');pinLayer.AddShape(dragHandle)}}else{polyLayer=new VEShapeLayer();tempShape=new VEShape(VEShapeType.Polygon,points);tempShape.SetFillColor(new VEColor(153,153,153,0.4));tempShape.SetLineColor(new VEColor(153,153,153,1.0));tempShape.SetLineWidth(2);tempShape.HideIcon();polyLayer.AddShape(tempShape);map.AddShapeLayer(polyLayer);map.AttachEvent("onmousemove",EditPolyMoveHandler);map.AttachEvent("onmousedown",EditPolyDownHandler);map.AttachEvent("onmouseup",EditPolyUpHandler);polyline=tempShape;polylineMask=new VEShape(VEShapeType.Polygon,points);polylineMask.HideIcon();polylineMask.Hide();polylineMask.SetLineColor(new VEColor(0,0,0,0.5));polylineMask.SetFillColor(new VEColor(0,0,0,0.0));polylineMask.Primitives[0].symbol.stroke_dashstyle="Dash";map.AddShape(polylineMask);pinLayer=new VEShapeLayer();map.AddShapeLayer(pinLayer);for(i=0;i<=(points.length-1);i++){var dragHandle=new VEShape(VEShapeType.Pushpin,points[i]);dragHandle.SetCustomIcon('/images/DragHandle.gif');pinLayer.AddShape(dragHandle)}}}DetachDrawingEvents()},SetMap:function(mapView){if(map){map.SetMapView(mapView)}},ShowPropInfo:function(pinID){if(map){if(pinInfo[pinID]){var points=pinInfo[pinID].GetPoints();var currentShape=map.GetShapeByID(pinInfo[pinID].GetID());var currentIcon=currentShape.GetCustomIcon();var imageSTR="/images/pushpinHover.png";currentShape.SetCustomIcon(imageSTR);currentShape.SetZIndex(1050,null);map.SetCenter(points[0]);map.ShowInfoBox(pinInfo[pinID]);document.getElementById("listinElement_"+pinID).className="ListingElementHover"}}},StartDrawing:function(){this.ClearMap();initalize();if(polyLayer==null){polyLayer=new VEShapeLayer();map.AddShapeLayer(polyLayer)}if(polyLayer2){polyLayer2.DeleteAllShapes()}document.getElementById('mapControlNew').style.cursor='crosshair';map.AttachEvent('onclick',mapDrawingClick);map.AttachEvent('onmousemove',mapDrawingMouseMove);map.vemapcontrol.EnableGeoCommunity(true)},StartDrawingRectangle:function(){this.ClearMap();initalize();if(polyLayer==null){polyLayer=new VEShapeLayer();map.AddShapeLayer(polyLayer)}if(polyLayer2){polyLayer2.DeleteAllShapes()}document.getElementById('mapControlNew').style.cursor='crosshair';map.AttachEvent("onclick",recMouseDownHandler);map.vemapcontrol.EnableGeoCommunity(true)}};function initalize(){points=new Array();tempPoints=new Array();startPointSet=0}function mapDrawingClick(e){points.push(GetClickLatLong(e))}function mapDrawingMouseOver(e){map.EndContinuousPan()}function mapDrawingMouseOut(e){var x=0;var y=0;var isPanning=false;var br=map.LatLongToPixel(map.GetMapView().BottomRightLatLong);if(e.mapX<15||e.mapX>br.x-15){if(e.mapX<15){x=-2}else{x=2}}if(e.mapY<15||e.mapY>br.y-15){if(e.mapY<15){y=-2}else{y=2}}if((x!=0||y!=0)){map.StartContinuousPan(x,y);isPanning=true;return}else{if(isPanning){map.EndContinuousPan();isPanning=false}}}function mapDrawingMouseMove(e){tempPoints=points.slice(0,points.length);tempPoints.push(GetClickLatLong(e));try{polyLayer.DeleteShape(tempShape)}catch(err){}try{if(tempPoints.length<3){tempShape=new VEShape(VEShapeType.Polyline,tempPoints)}else{tempShape=new VEShape(VEShapeType.Polygon,tempPoints)}tempShape.SetFillColor(new VEColor(153,153,153,0.4));tempShape.SetLineColor(new VEColor(153,153,153,1.0));tempShape.SetLineWidth(2);tempShape.HideIcon();polyLayer.AddShape(tempShape);if(points.length>=1){map.AttachEvent('onmouseout',mapDrawingMouseOut);map.AttachEvent('onmouseover',mapDrawingMouseOver)}if(points.length==3&&startPointSet!=1){startPointSet=1;startPin=new VEShape(VEShapeType.Pushpin,points[0]);startPin.SetCustomIcon("<img src='/images/endDraw.png' onclick='Mapping.EndDrawing()' />");startPin.ShowDetailOnMouseOver=false;map.AddShape(startPin)}}catch(err){}}function GetClickLatLong(e){var x=e.mapX;var y=e.mapY;var pixel=new VEPixel(x,y);var latLong=map.PixelToLatLong(pixel);latLong.Latitude*=1000000;latLong.Latitude=Math.floor(latLong.Latitude)/1000000;latLong.Longitude*=1000000;latLong.Longitude=Math.floor(latLong.Longitude)/1000000;return latLong}function DetachDrawingEvents(){map.DetachEvent('onclick',mapDrawingClick);map.DetachEvent('onmousemove',mapDrawingMouseMove);map.DetachEvent('onmouseout',mapDrawingMouseOut);map.DetachEvent('onmouseover',mapDrawingMouseOver);map.DetachEvent("onclick",recMouseEndHandler);map.DetachEvent("onmousemove",recMouseMoveHandler);map.vemapcontrol.EnableGeoCommunity(false);map.EndContinuousPan()}function DoCenterZoom(location){map.SetCenterAndZoom(location,17);AddPushpin(location)}function AddPushpin(latlon){var icon="<div style='position:absolute;  left: 0px; top: -20px;'><img src='/images/push.png' /></div>";var shape=new VEShape(VEShapeType.Pushpin,latlon);shape.SetCustomIcon(icon);map.ClearInfoBoxStyles();map.AddShape(shape)}function mouseOverHandler(e){if(e.elementID&&notOver){mouseOverSidebarItem(e.elementID);notOver=false}}function mouseOutHandler(e){if(e.elementID&&!notOver){mouseOutSidebarItem(e.elementID);notOver=true}}function mouseOverSidebarItem(markerId){currentShape=map.GetShapeByID(markerId);currentIcon=currentShape.GetCustomIcon();var imageSTR="/images/pushpinHover.png";currentShape.SetCustomIcon(imageSTR);map.ShowInfoBox(currentShape)}function mouseOutSidebarItem(markerId){currentShape=map.GetShapeByID(markerId);currentIcon=currentShape.GetCustomIcon();var imageSTR="/images/pushpin.png";currentShape.SetCustomIcon(imageSTR);map.HideInfoBox(currentShape)}function recMouseDownHandler(e){selecting=true;StartLatLon=GetClickLatLong(e);map.AttachEvent("onmousemove",recMouseMoveHandler);return true}function recMouseMoveHandler(e){if(!selecting){return false}else{if(selectBox){map.DeleteShape(selectBox)}currentX=e.mapX;currentY=e.mapY;EndLatLon=GetClickLatLong(e);selectBox=new VEShape(VEShapeType.Polygon,[StartLatLon,new VELatLong(StartLatLon.Latitude,EndLatLon.Longitude),EndLatLon,new VELatLong(EndLatLon.Latitude,StartLatLon.Longitude)]);selectBox.HideIcon();selectBox.SetLineWidth(2);selectBox.SetFillColor(new VEColor(153,153,153,0.4));selectBox.SetLineColor(new VEColor(153,153,153,1.0));selectBox.ShowDetailOnMouseOver=false;selectBox.SetLineWidth(2);map.AddShape(selectBox);map.DetachEvent("onclick",recMouseDownHandler);map.AttachEvent("onclick",recMouseEndHandler)}}function recMouseEndHandler(e){if(selecting){selecting=false;points.push(StartLatLon,new VELatLong(StartLatLon.Latitude,EndLatLon.Longitude),EndLatLon,new VELatLong(EndLatLon.Latitude,StartLatLon.Longitude));$(MapingID).val(points);map.AttachEvent("onmousemove",EditRecMoveHandler);map.AttachEvent("onmousedown",EditRecDownHandler);map.AttachEvent("onmouseup",EditRecUpHandler);polyline=selectBox;polylineMask=new VEShape(VEShapeType.Polygon,points);polylineMask.HideIcon();polylineMask.Hide();polylineMask.SetLineColor(new VEColor(0,0,0,0.5));polylineMask.SetFillColor(new VEColor(0,0,0,0.0));polylineMask.Primitives[0].symbol.stroke_dashstyle="Dash";map.AddShape(polylineMask);pinLayer=new VEShapeLayer();map.AddShapeLayer(pinLayer);for(i=0;i<=(points.length-1);i++){var dragHandle=new VEShape(VEShapeType.Pushpin,points[i]);dragHandle.SetCustomIcon('/images/DragHandle.gif');pinLayer.AddShape(dragHandle)}idxAjax.runSearch(points);DetachDrawingEvents()}}function PanMap(map,points){map.PanToLatLong(points);return}function GoToListing(link){window.location=link}function EditPolyDownHandler(e){if(e.elementID){currentDragHandle=map.GetShapeByID(e.elementID);if(currentDragHandle.GetType()==VEShapeType.Pushpin){moving=true;polylineMask.Show();map.vemapcontrol.EnableGeoCommunity(true);document.getElementById("mapControlNew").style.cursor='crosshair';var handleLocation=currentDragHandle.GetPoints();for(i=0;i<=(points.length-1);i++){var pointLocation=points[i].toString();if(handleLocation==pointLocation){pointIndex=i;break}}}}}function EditPolyMoveHandler(e){if(moving){var loc=GetClickLatLong(e);currentDragHandle.SetPoints(loc);points[pointIndex]=loc;polylineMask.SetPoints(points)}}function EditPolyUpHandler(e){if(moving){moving=false;polylineMask.Hide();map.vemapcontrol.EnableGeoCommunity(false);document.getElementById("mapControlNew").style.cursor='';polyline.SetPoints(points);$(MapingID).val(points);idxAjax.runSearch(points)}}function EditRecDownHandler(e){if(e.elementID){currentDragHandle=map.GetShapeByID(e.elementID);if(currentDragHandle.GetType()==VEShapeType.Pushpin){moving=true;polylineMask.Show();map.vemapcontrol.EnableGeoCommunity(true);document.getElementById("mapControlNew").style.cursor='crosshair';var handleLocation=currentDragHandle.GetPoints();for(i=0;i<=(points.length-1);i++){var pointLocation=points[i].toString();if(handleLocation==pointLocation){pointIndex=i;break}}}}}function EditRecMoveHandler(e){if(moving){var loc=GetClickLatLong(e);currentDragHandle.SetPoints(loc);if(pointIndex==0){points[pointIndex]=loc;points[1]=new VELatLong(loc.Latitude,points[1].Longitude);points[3]=new VELatLong(points[3].Latitude,loc.Longitude)}else if(pointIndex==1){points[pointIndex]=loc;points[0]=new VELatLong(loc.Latitude,points[0].Longitude);points[2]=new VELatLong(points[2].Latitude,loc.Longitude)}else if(pointIndex==2){points[pointIndex]=loc;points[1]=new VELatLong(points[1].Latitude,loc.Longitude);points[3]=new VELatLong(loc.Latitude,points[3].Longitude)}else if(pointIndex==3){points[pointIndex]=loc;points[0]=new VELatLong(points[0].Latitude,loc.Longitude);points[2]=new VELatLong(loc.Latitude,points[2].Longitude)}polylineMask.SetPoints(points)}}function EditRecUpHandler(e){if(moving){moving=false;polylineMask.Hide();map.vemapcontrol.EnableGeoCommunity(false);document.getElementById("mapControlNew").style.cursor='';polyline.SetPoints(points);$(MapingID).val(points);map.DeleteShapeLayer(pinLayer);pinLayer=new VEShapeLayer();map.AddShapeLayer(pinLayer);for(i=0;i<=(points.length-1);i++){var dragHandle=new VEShape(VEShapeType.Pushpin,points[i]);dragHandle.SetCustomIcon('/images/DragHandle.gif');pinLayer.AddShape(dragHandle)}idxAjax.runSearch(points)}}var PopUp={Open:function(divID){var Browser=document.body;window.onscroll=function(){document.getElementById(divID).style.top=document.body.scrollTop};document.getElementById(divID).style.display="block";document.getElementById(divID).style.top=document.body.scrollTop;document.getElementById(divID).style.height=Browser.clientHeight;document.getElementById(divID).style.width=Browser.clientWidth;WindowResize();if(window.attachEvent){window.attachEvent('onresize',WindowResize)}else if(window.addEventListener){window.addEventListener('resize',WindowResize,false)}else{window.onresize=WindowResize}if(document.all){document.documentElement.onscroll=WindowResize}},Close:function(divID){document.getElementById(divID).style.display="none"}};function WindowResize(){var left=window.XMLHttpRequest==null?document.documentElement.scrollLeft:0;var top=window.XMLHttpRequest==null?document.documentElement.scrollTop:0;var div=document.getElementById('modal');div.style.left=Math.max((left+(GetWindowWidth()-div.offsetWidth)/2),0)+'px';div.style.top=Math.max((top+(GetWindowHeight()-div.offsetHeight)/2),0)+'px'}function GetWindowWidth(){var width=document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||document.body&&document.body.parentNode&&document.body.parentNode.clientWidth||0;return width}function GetWindowHeight(){var height=document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||document.body&&document.body.parentNode&&document.body.parentNode.clientHeight||0;return height}