
function HtmlControl(html){this.html=html}
HtmlControl.prototype=new GControl();HtmlControl.prototype.initialize=function(map){var container=document.createElement("div");var extra=document.createElement("div");extra.innerHTML=this.html;extra.style.textDecoration="none";extra.style.color="#ffffff";extra.style.backgroundColor="#9cd73d";extra.style.border="1px solid #ffffff";extra.style.padding="2px";extra.style.marginBottom="3px";extra.style.textAlign="left";extra.style.cursor="pointer";container.appendChild(extra);map.getContainer().appendChild(container);return container;}
HtmlControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(7,7));}
function AddOverlayControl(html){this.html=html}
AddOverlayControl.prototype=new GControl();AddOverlayControl.prototype.initialize=function(map){var container=document.createElement("div");var extra=document.createElement("div");extra.innerHTML=this.html;extra.style.textDecoration="none";extra.style.color="#ffffff";extra.style.backgroundColor="#9cd73d";extra.style.border="1px solid #ffffff";extra.style.padding="2px";extra.style.marginBottom="3px";extra.style.textAlign="left";extra.style.cursor="pointer";container.appendChild(extra);map.getContainer().appendChild(container);return container;}
AddOverlayControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(7,7));}
function checkZoom(){if(map.getZoom()<13){turnOnControl();}
else{turnOffControl();}}
function TextualZoomControl(){}
TextualZoomControl.prototype=new GControl();TextualZoomControl.prototype.initialize=function(map){var container=document.createElement("div");var zoomInDiv=document.createElement("div");this.setButtonStyle_(zoomInDiv);container.appendChild(zoomInDiv);zoomInDiv.appendChild(document.createTextNode("You've zoomed out too far for us to add properties to the map! Move around, then zoom in closer."));GEvent.addDomListener(zoomInDiv,"click",function(){map.zoomIn();});map.getContainer().appendChild(container);return container;}
TextualZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(7,7));}
TextualZoomControl.prototype.setButtonStyle_=function(button){button.style.textDecoration="none";button.style.color="#ffffff";button.style.backgroundColor="#9cd73d";button.style.border="1px solid #ffffff";button.style.padding="2px";button.style.marginBottom="3px";button.style.textAlign="left";button.style.cursor="pointer";}
warningControl=new TextualZoomControl();function turnOnControl(){map.addControl(warningControl);}
function turnOffControl(){map.removeControl(warningControl);}
function createPropertyMarker(point,tpe,address,city,province,postal,propid,pricep,status,exturl,style,rooms,bathrooms,sqft,hoodid,hoodname,datelisted){var html="";var dUrl="";var caption="";if(status=="N"||status=="NS"){var marker=new GMarker(point,{icon:newicon});html=html.concat("$",pricep," - ",style,"<br/>",rooms," <img src='/images/bed.gif' alt='beds' title='beds'>, ",bathrooms," <img src='/images/bath.gif' alt='bathrooms' title='bathrooms'>");if(datelisted!="")
{html=html.concat("<br/>Added: <b>",datelisted,"</b>");}}else{var marker=new GMarker(point,{icon:icon});html=html.concat("$",pricep," - ",style,"<br/>",rooms," <img src='/images/bed.gif' alt='beds' title='beds'>, ",bathrooms," <img src='/images/bath.gif' alt='bathrooms' title='bathrooms'>");if(datelisted!="")
{html=html.concat("<br/>Added: ",datelisted);}}
dUrl=dUrl.concat("/",propid);html=html.concat("<br/>");html=html.concat("<br/>");marker.d=new Array(new Array(tpe,address,propid,pricep,dUrl,style,rooms,bathrooms,sqft,hoodid,hoodname,status,datelisted));GEvent.addListener(marker,"click",function(){Lightview.show({href:'/properties/lightview/'+propid,title:'Listing',caption:'http://www.escapenow.ca/'+propid,rel:'iframe',options:{width:875,height:500}});});GEvent.addListener(marker,"mouseover",function(){var tempcode="";tempcode=tempcode.concat("<b style='padding-left:5px;font-size: 125%;color:#000;'>",address,"</b><br/><table><tr><td width='112' height='85'><span id='flashcontent'><div id='photo'><div id='flashobj'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='100' height='75' id='slideshow' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/flash/slideshow.swf?file=/xml/thumbnailshow/",propid,"' /><param name='quality' value='high' /><param name='bgcolor' value='#FFFFFF' /><embed src='/flash/slideshow.swf?file=/xml/thumbnailshow/",propid,"' quality='high' bgcolor='#FFFFFF' width='100' height='75' name='slideshow' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></div></div></span></td><td width='5' height='100'><img src='/images/spacer.gif' height='1' width='5'></td><td width='200' height='100'><img src='/images/spacer.gif' height='1' width='200'><br/><span style='color:#000;'>",html,"</span></td></tr></table>");new Tip('map',tempcode,{width:'auto',hook:{tip:'topLeft',mouse:true},offset:{x:5,y:5}});});GEvent.addListener(marker,"mouseout",function(){Tips.remove('map');});nProperties=nProperties+1;return marker;}
function createMultiplePropertyMarker(point,aPData){var html="";var hood="";var bNew=false;var caption="";var address="Multiple Properties";caption=caption.concat("Multiple: ");for(var k=0;k<aPData.length;k++){html=html.concat("$",aPData[k][3]," - ",aPData[k][5]," - ",aPData[k][6]," <img src='/images/bed.gif' alt='beds' title='beds'>, ",aPData[k][7]," <img src='/images/bath.gif' alt='bathrooms' title='bathrooms'>");if(k>0)
{caption=caption.concat(", ");}
caption=caption.concat("$",aPData[k][3]);if(aPData[k][12]!="")
{if(aPData[k][11]=="N"||aPData[k][11]=="NS")
{bNew=true;}}
html=html.concat("<br/><br/>");}
if(bNew)
{var marker=new GMarker(point,{icon:newicon});}else{var marker=new GMarker(point,{icon:icon});}
marker.d=aPData;GEvent.addListener(marker,"click",function(){for(var k=0;k<aPData.length;k++){windowname="p"+k;windowaddy="/"+aPData[k][2];window.open(windowaddy,windowname);}});GEvent.addListener(marker,"mouseover",function(){var tempcode="";tempcode=tempcode.concat("<b style='padding-left:5px;font-size: 125%;color:#000;'>",address,"</b><br/><table><tr><td width='112' height='85'><span id='flashcontent'><div id='photo'><div id='flashobj'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='100' height='75' id='slideshow' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/flash/slideshow.swf?file=/xml/thumbnailshow/",aPData[0][2],"' /><param name='quality' value='high' /><param name='bgcolor' value='#FFFFFF' /><embed src='/flash/slideshow.swf?file=/xml/thumbnailshow/",aPData[0][2],"' quality='high' bgcolor='#FFFFFF' width='100' height='75' name='slideshow' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></div></div></span></td><td width='5' height='100'><img src='/images/spacer.gif' height='1' width='5'></td><td width='200' height='100'><img src='/images/spacer.gif' height='1' width='200'><br/><span style='color:#000;'>",html,"</span></td></tr></table>");new Tip('map',tempcode,{width:'auto',hook:{tip:'topLeft',mouse:true},offset:{x:5,y:5}});});GEvent.addListener(marker,"mouseout",function(){Tips.remove('map');});nProperties=nProperties+1;return marker;}
GMarker.prototype.showPropertyDetail=function(detailId,myobject,apoint,body,address){var tempcode="";var flashval="";tempcode=tempcode.concat("<b style='padding-left:5px;font-size: 125%;color:#000;'>",address,"</b><br/><table><tr><td width='112' height='85'><span id='flashcontent'><img src='/images/spacer.gif' height='75' width='112'></span></td><td width='5' height='100'><img src='/images/spacer.gif' height='1' width='5'></td><td width='200' height='100'><img src='/images/spacer.gif' height='1' width='200'><br/><span style='color:#000;'>",body,"</span></td></tr></table><span id='adcontent' style='overflow:visible;width:300px;font-size:95%;'><img src='/images/spacer.gif' height='60' width='300'></span>");flashval=flashval.concat("<div id='photo'><div id='flashobj'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='100' height='75' id='slideshow' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/flash/slideshow.swf?file=/xml/thumbnailshow/",detailId,"' /><param name='quality' value='high' /><param name='bgcolor' value='#FFFFFF' /><embed src='/flash/slideshow.swf?file=/xml/thumbnailshow/",detailId,"' quality='high' bgcolor='#FFFFFF' width='100' height='75' name='slideshow' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></div></div>");myobject.openInfoWindowHtml(tempcode);try
{GEvent.addListener(map,"infowindowopen",function(){document.getElementById("flashcontent").innerHTML=flashval;document.getElementById("adcontent").innerHTML=document.getElementById("adcontentsource").innerHTML;});}
catch(e){}}
function createOverlayMarker(point,title,desc,link,linktitle,nid,nicon,address,width,height){var html="";var caption="";strpathtoicon="/images/saucy/marker/"+nicon+".png";overlayicon.image=strpathtoicon;overlayicon.iconSize=new GSize(parseFloat(width),parseFloat(height));overlayicon.iconAnchor=new GPoint(parseFloat(width)/2,parseFloat(height)/2);overlayicon.infoWindowAnchor=new GPoint(parseFloat(width)/2,parseFloat(height)/2);html=html.concat("<table width='300'><tr><td valign='top' width='90%'><b>",title,"</b>"+"<br/>");caption=caption.concat(title);if(desc=="")
{html=html.concat(address);}
else html=html.concat(desc);html=html.concat("<br/><br/>")
var marker=new GMarker(point,{icon:overlayicon});html=html.concat("</td><td valign='top'><img src='/images/saucy/marker/",parseFloat(document.forms[0].seloverlay.value),".png'><br/></td></tr></table>");if(link==""){link="/page/comingsoon";}
GEvent.addListener(marker,"click",function(){captionwithlink=URLDecode(link)+" <a href='javascript:submitAbuse("+nid+");'>Report this as inaccurate.</a>";Lightview.show({href:URLDecode(link),title:'Overlay Link',caption:captionwithlink,rel:'iframe',options:{fullscreen:true}});});GEvent.addListener(marker,"mouseover",function(){new Tip('map',html,{width:'auto',hook:{tip:'topLeft',mouse:true},offset:{x:5,y:5}});});GEvent.addListener(marker,"mouseout",function(){Tips.remove('map');});return marker;}
var icon=new GIcon();icon.image="/images/house.png";icon.shadow="";icon.iconSize=new GSize(21,21);icon.shadowSize=new GSize(0,0);icon.iconAnchor=new GPoint(10,10);icon.infoWindowAnchor=new GPoint(10,10);var newicon=new GIcon();newicon.image="/images/newhouse.png";newicon.shadow="";newicon.iconSize=new GSize(21,21);newicon.shadowSize=new GSize(0,0);newicon.iconAnchor=new GPoint(8,8);newicon.infoWindowAnchor=new GPoint(10,10);var overlayicon=new GIcon();overlayicon.image="/images/overlayicons/0.png";overlayicon.shadow="";overlayicon.shadowSize=new GSize(0,0);overlayicon.iconSize=new GSize(30,14);overlayicon.iconAnchor=new GPoint(15,7);overlayicon.infoWindowAnchor=new GPoint(15,7);var bControlAdded=false;var bAddOverlayControlAdded=false;function plotPropertiesAndCenter(nClearLatLong){plotProperties(nClearLatLong);bCenter=true;}
function onPointAdded(){try{if(bCenter&&aAllProperties!=null){map.panTo(aAllProperties[aAllProperties.length-1].getPoint());}
bCenter=false;}
catch(e){}}
function infoWindowOpened(){binfoWindowOpen=true;}
function infoWindowClosed(){binfoWindowOpen=false;}
function onMapMoved(){if(!binfoWindowOpen){if(map.getZoom()>=13){plotProperties(1);}}}
var localoptions={searchFormHint:"Ice Cream",suppressInitialResultSelection:true,suppressZoomToBounds:true};var cLocal=null;function plotOverlayDataPoints(){if(document.forms[0].seloverlay.value==65){if(cLocal==null){cLocal=new google.maps.LocalSearch(localoptions);map.addControl(cLocal);}
if(bAddOverlayControlAdded)
{map.removeControl(cAddOverlay);stopAdditions();}
bAddOverlayControlAdded=false;}
else if(document.forms[0].seloverlay.value!=0)
{if(cLocal!=null){map.removeControl(cLocal);cLocal=null;}
var requestOverlay=GXmlHttp.create();var OverlayDataURL="";OverlayDataURL=OverlayDataURL.concat("/xml/overlaydata?city=",document.forms[0].selcity.value,"&province=",document.forms[0].selprovince.value,"&overlay=",document.forms[0].seloverlay.value,"&minX=",map.getBounds().getSouthWest().lng().toFixed(3),"&maxX=",map.getBounds().getNorthEast().lng().toFixed(3),"&minY=",map.getBounds().getSouthWest().lat().toFixed(3),"&maxY=",map.getBounds().getNorthEast().lat().toFixed(3));requestOverlay.open("GET",OverlayDataURL,true);requestOverlay.onreadystatechange=function(){if(requestOverlay.readyState==4){var xmlDoc=requestOverlay.responseXML;try{detectTooMany(aAllOverlayPoints);var markers=xmlDoc.documentElement.getElementsByTagName("marker");for(var i=0;i<markers.length;i++){var baddit=true;for(var j=0;j<aAllOverlayPoints.length;j++){if(parseFloat(markers[i].getAttribute("lng"))==aAllOverlayPoints[j].getPoint().lng()&&parseFloat(markers[i].getAttribute("lat"))==aAllOverlayPoints[j].getPoint().lat()){baddit=false;}}
if(baddit){var point=new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")));var marker=createOverlayMarker(new GPoint(parseFloat(markers[i].getAttribute("lng")),parseFloat(markers[i].getAttribute("lat"))),markers[i].getAttribute("title"),markers[i].getAttribute("desc"),markers[i].getAttribute("link"),markers[i].getAttribute("linktitle"),markers[i].getAttribute("id"),markers[i].getAttribute("icon"),markers[i].getAttribute("address"),markers[i].getAttribute("width"),markers[i].getAttribute("height"));aAllOverlayPoints.push(marker);map.addOverlay(marker);}}}
catch(e){}}}
requestOverlay.send(null);if(bAddOverlayControlAdded)
{map.removeControl(cAddOverlay);stopAdditions();}
if(parseFloat(document.forms[0].seloverlay.value)!=12&&parseFloat(document.forms[0].seloverlay.value)!=19)
{bAddOverlayControlAdded=true;cAddOverlay=new AddOverlayControl("See something missing? Add new points by clicking on the map.");captureAdditions();map.addControl(cAddOverlay);}}
else{if(bAddOverlayControlAdded)
{map.removeControl(cAddOverlay);stopAdditions();}
bAddOverlayControlAdded=false;}}
var additionHandler;var lastNewMarker;var currentOverlayid;var overlaylabels=new Array("","Subway","Liquor or Beer","Grocery","","Coffee Shops","Gyms","Schools","Hospitals","Churches","Police","Fire","Neighbourhoods","Bars","Restaurants","Laundry","Attractions","Safety or Crime","Bike Paths","Business Directory","Long Term Care","Hiking Trails","Parks","Boat Rentals","Cliffs","Swimming Areas","Beaches","Fishing Spots","","Golf","Markets","Kids","Adventure and Sports","Theatres","Marinas or Docks","Health and Wellness","Nightlife","Museums");function getOverlayLabelAndAdjustIcon(){strpathtoicon="/images/saucy/marker/"+parseFloat(document.forms[0].seloverlay.value)+".png";overlayicon.image=strpathtoicon;temppic=new Image();temppic.src="/images/saucy/marker/"+parseFloat(document.forms[0].seloverlay.value)+".png";overlayicon.iconSize=new GSize(temppic.width,temppic.height);overlayicon.iconAnchor=new GPoint(temppic.width/2,temppic.height/2);overlayicon.infoWindowAnchor=new GPoint(temppic.width/2,temppic.height/2);currentOverlayid=parseFloat(document.forms[0].seloverlay.value);return overlaylabels[parseFloat(document.forms[0].seloverlay.value)];}
function captureAdditions(){additionHandler=GEvent.addListener(map,"click",function(marker,point){if(!marker){if(lastNewMarker!=null)
{map.removeOverlay(lastNewMarker);}
currentOverlayLabel=getOverlayLabelAndAdjustIcon();var newMarker=new GMarker(point,{icon:overlayicon});nlat=point.lat();nlong=point.lng();lastNewMarker=newMarker;map.addOverlay(newMarker);if(nuserid>0)
{newMarker.openInfoWindowHtml("Want to add a new point to the '"+currentOverlayLabel+"' Points of Interest here?<br/><br/><form name='NewAddition'><label for='newpointlabel' class='tablelabel'>Name:</label><input class='textinput' id='newpointlabel' maxlength='125' name='newpointlabel' size='25' type='text' value='Name' /><br/><label for='newpointdesc' class='tablelabel'>Description:</label><input class='textinput' id='newpointdesc' maxlength='125' name='newpointdesc' size='25' type='text' value='' /><br/><label for='newpointlink' class='tablelabel'>Link:</label><input class='textinput' id='newpointlink' maxlength='125' name='newpointlink' size='25' type='text' value='http://' /><br/><label for='btn' class='tablelabel'>&nbsp;</label><input type='button' value='Submit' onclick='javascript:submitNewAddition("+nlat+", "+nlong+");'/><input type='button' value='Cancel' onclick='javascript:map.closeInfoWindow();map.removeOverlay(lastNewMarker);'/></form>");}
else{newMarker.openInfoWindowHtml("You must login to escapenow.ca in order to add a new point to the Points of Interest.");}
GEvent.addListener(map.getInfoWindow(),"closeclick",function(){map.removeOverlay(newMarker);});}});}
function submitNewAddition(nlat,nlong){var request=GXmlHttp.create();request.open("GET","/xml/addnewoverlaypoint?user="+nuserid+"&lat="+nlat+"&lon="+nlong+"&title="+document.NewAddition.newpointlabel.value+"&desc="+document.NewAddition.newpointdesc.value+"&overlay="+currentOverlayid+"&link="+document.NewAddition.newpointlink.value,true);request.onreadystatechange=function(){if(request.readyState==4){var xmlDoc=request.responseXML;try{map.closeInfoWindow();map.removeOverlay(lastNewMarker);reFreshMap(1);}
catch(e){}}}
request.send(null);}
function submitAbuse(nId){var request=GXmlHttp.create();request.open("GET","/xml/logabuse?point="+nId,true);request.onreadystatechange=function(){if(request.readyState==4){var xmlDoc=request.responseXML;try{map.closeInfoWindow();alert("Thank you. The system will take this into account.")}
catch(e){}}}
request.send(null);}
function stopAdditions(){GEvent.removeListener(additionHandler);}
function plotOverlayLines(){if(document.forms[0].seloverlay.value!=0)
{var requestOverlayLines=GXmlHttp.create();var OverlayLineDataURL="";OverlayLineDataURL=OverlayLineDataURL.concat("/xml/overlaylines?city=",document.forms[0].selcity.value,"&province=",document.forms[0].selprovince.value,"&overlay=",document.forms[0].seloverlay.value,"&minX=",map.getBounds().getSouthWest().lng().toFixed(3),"&maxX=",map.getBounds().getNorthEast().lng().toFixed(3),"&minY=",map.getBounds().getSouthWest().lat().toFixed(3),"&maxY=",map.getBounds().getNorthEast().lat().toFixed(3));requestOverlayLines.open("GET",OverlayLineDataURL,true);requestOverlayLines.onreadystatechange=function(){if(requestOverlayLines.readyState==4){var xmlDoc=requestOverlayLines.responseXML;try{var markers=xmlDoc.documentElement.getElementsByTagName("marker");for(var i=0;i<markers.length;i++){var baddit=true;for(var j=0;j<aAllOverlayLines.length;j++){if(parseFloat(markers[i].getAttribute("fromlng"))==aAllOverlayLines[j].x&&parseFloat(markers[i].getAttribute("fromlat"))==aAllOverlayLines[j].y){if(parseFloat(markers[i].getAttribute("tolng"))==aAllOverlayLinesB[j].x&&parseFloat(markers[i].getAttribute("tolat"))==aAllOverlayLinesB[j].y){baddit=false;}}}
if(baddit){var pointfrom=new GPoint(parseFloat(markers[i].getAttribute("fromlng")),parseFloat(markers[i].getAttribute("fromlat")));var pointto=new GPoint(parseFloat(markers[i].getAttribute("tolng")),parseFloat(markers[i].getAttribute("tolat")));var apoints=new Array(pointfrom,pointto);var ccolor="#"+markers[i].getAttribute("connectcolor");map.addOverlay(new GPolyline(apoints,ccolor,10));aAllOverlayLines.push(pointfrom);aAllOverlayLinesB.push(pointto);}}}
catch(e){}}}
requestOverlayLines.send(null);}}
function detectTooMany(aDatapoints){var nOffMap=0;for(var z=0;z<aDatapoints.length;z++){if(aDatapoints[z].getPoint().lat()<map.getBounds().getSouthWest().lat().toFixed(3)||aDatapoints[z].getPoint().lat()>map.getBounds().getNorthEast().lat().toFixed(3)||aDatapoints[z].getPoint().lng()<map.getBounds().getSouthWest().lng().toFixed(3)||aDatapoints[z].getPoint().lng()>map.getBounds().getNorthEast().lng().toFixed(3))
{nOffMap=nOffMap+1;}}
if(nOffMap>200)
{CleanUpMap();}}
function plotProperties(nClearLatLong){var request=GXmlHttp.create();var propertyDataURL="";var dUrl="";propertyDataURL=propertyDataURL.concat("/xml/simplesearch?city=",document.forms[0].selcity.value,"&province=",document.forms[0].selprovince.value,"&ptype=",document.forms[0].selptype.value,"&pricetype=",document.forms[0].selpricetype.value,"&style=",document.forms[0].selstyle.value,"&rooms=",document.forms[0].selrooms.value,"&sleeps=",document.forms[0].selsleeps.value,"&bathrooms=",document.forms[0].selbathrooms.value,"&min=",document.forms[0].selmin.value,"&max=",document.forms[0].selmax.value,"&minX=",map.getBounds().getSouthWest().lng().toFixed(3),"&maxX=",map.getBounds().getNorthEast().lng().toFixed(3),"&minY=",map.getBounds().getSouthWest().lat().toFixed(3),"&maxY=",map.getBounds().getNorthEast().lat().toFixed(3),"&limited=",nClearLatLong,"&userid=",document.forms[0].seluserid.value,"");request.open("GET",propertyDataURL,true);request.onreadystatechange=function(){if(request.readyState==4){var xmlDoc=request.responseXML;try{detectTooMany(aAllProperties);var markers=xmlDoc.documentElement.getElementsByTagName("marker");for(var i=0;i<markers.length;i++){var baddit=true;for(var j=0;j<aAllProperties.length;j++){if(parseFloat(markers[i].getAttribute("lng")).toFixed(3)==aAllProperties[j].getPoint().lng()&&parseFloat(markers[i].getAttribute("lat")).toFixed(3)==aAllProperties[j].getPoint().lat()){var bCapturedinMarker=false;for(var k=0;k<aAllProperties[j].d.length;k++){if(markers[i].getAttribute("id")==aAllProperties[j].d[k][2]){bCapturedinMarker=true;}}
if(!bCapturedinMarker){dUrl=dUrl.concat("http://www.escapenow.ca/",markers[i].getAttribute("id"));var aNext=new Array(markers[i].getAttribute("tpe"),markers[i].getAttribute("address"),markers[i].getAttribute("id"),markers[i].getAttribute("price"),dUrl,markers[i].getAttribute("style"),markers[i].getAttribute("rooms"),markers[i].getAttribute("bathrooms"),markers[i].getAttribute("sqft"),markers[i].getAttribute("hoodid"),markers[i].getAttribute("hoodname"),markers[i].getAttribute("status"),markers[i].getAttribute("datelisted"));aAllProperties[j].d.push(aNext);map.removeOverlay(aAllProperties[j]);var marker=createMultiplePropertyMarker(aAllProperties[j].getPoint(),aAllProperties[j].d);aAllProperties.splice(aAllProperties[j],1);aAllProperties.push(marker);map.addOverlay(marker);dUrl="";}
baddit=false;}}
if(baddit){var point=new GLatLng(parseFloat(markers[i].getAttribute("lat")).toFixed(3),parseFloat(markers[i].getAttribute("lng")).toFixed(3));var marker=createPropertyMarker(point,markers[i].getAttribute("tpe"),markers[i].getAttribute("address"),markers[i].getAttribute("city"),markers[i].getAttribute("province"),markers[i].getAttribute("postal"),markers[i].getAttribute("id"),markers[i].getAttribute("price"),markers[i].getAttribute("status"),markers[i].getAttribute("exturl"),markers[i].getAttribute("style"),markers[i].getAttribute("rooms"),markers[i].getAttribute("bathrooms"),markers[i].getAttribute("sqft"),markers[i].getAttribute("hoodid"),markers[i].getAttribute("hoodname"),markers[i].getAttribute("datelisted"));aAllProperties.push(marker);map.addOverlay(marker);}}
if(bControlAdded)
{map.removeControl(cListings);}
bControlAdded=true;if(nProperties>1)strjumpcontrol="<div id='listingshotspot'>"+nProperties+" listings. Click here to move between them.</div>";else strjumpcontrol="<div id='listingshotspot'>"+nProperties+" listings.";cListings=new HtmlControl(strjumpcontrol);map.addControl(cListings);if(nProperties>1){GEvent.addDomListener(document.getElementById('listingshotspot'),'click',function(){hitpropertyinsequence();});}}
catch(e){}}}
request.send(null);plotOverlayDataPoints();updatead();}
var currentpropertyticker=0;function hitpropertyinsequence(){if(currentpropertyticker>(aAllProperties.length-1))currentpropertyticker=aAllProperties.length-1;if(currentpropertyticker==-1)currentpropertyticker=aAllProperties.length-1;map.panTo(aAllProperties[currentpropertyticker].getPoint());currentpropertyticker=currentpropertyticker-1;}
function reFreshMap(nClearLatLong){updaterss();if(map.getZoom()<13){map.setZoom(13);}
aAllOverlayPoints=[];aAllProperties=[];nProperties=0;map.clearOverlays();if(bCenterMe){plotPropertiesAndCenter(0);bCenterMe=false;}
else plotProperties(nClearLatLong);updateURL();}
function CleanUpMap(){aAllOverlayPoints=[];aAllProperties=[];nProperties=0;map.clearOverlays();plotProperties(1);}
function updateURL(){var strcity=trimspaces(document.forms[0].selcity.options[document.forms[0].selcity.selectedIndex].text);var strprov=trimspaces(document.forms[0].selprovince.options[document.forms[0].selprovince.selectedIndex].text);var strptype='residential';var strpricetype='for-rent';var strstyle=trimspaces(document.forms[0].selstyle.options[document.forms[0].selstyle.selectedIndex].text);var strrooms=trimspaces(document.forms[0].selrooms.options[document.forms[0].selrooms.selectedIndex].text);var strsleeps=trimspaces(document.forms[0].selsleeps.options[document.forms[0].selsleeps.selectedIndex].text);var strbathrooms=trimspaces(document.forms[0].selbathrooms.options[document.forms[0].selbathrooms.selectedIndex].text);var strmin=document.forms[0].selmin.value;var strmax=document.forms[0].selmax.value;var strseluserid=document.forms[0].seluserid.value;var struseridextension="";if(parseFloat(strseluserid)>0)
{struseridextension="/"+strseluserid;}
var stroverlay=trimspaces(document.forms[0].seloverlay.options[document.forms[0].seloverlay.selectedIndex].text.replace(/ /g,"-"));var strfurl='/canada-vacation-rental-map/'+strprov+"/"+strcity+"/"+strptype+"/"+strpricetype+"/"+strstyle+"/"+strrooms+"/"+strsleeps+"/"+strbathrooms+"/"+strmin+"/"+strmax+"/"+stroverlay+struseridextension;var strlurl='/canada-vacation-rental-listings/'+strprov+"/"+strcity+"/"+strptype+"/"+strpricetype+"/"+strstyle+"/"+strrooms+"/"+strsleeps+"/"+strbathrooms+"/"+strmin+"/"+strmax;var strfurlintegration='http://www.escapenow.ca/my-canada-vacation-rental-map/'+strprov+"/"+strcity+"/"+strptype+"/"+strpricetype+"/"+strstyle+"/"+strrooms+"/"+strsleeps+"/"+strbathrooms+"/"+strmin+"/"+strmax+"/"+stroverlay+struseridextension;var strfurluser='/canada-vacation-rental-map/'+strprov+"/"+strcity+"/"+strptype+"/"+strpricetype+"/"+strstyle+"/"+strrooms+"/"+strsleeps+"/"+strbathrooms+"/"+strmin+"/"+strmax+"/"+stroverlay+"/"+nuserid;strPart1='&nbsp;<img src="/images/link.gif"> <a href="'+strfurl+'" class="footerlink">Link to this Query</a> | <a class="footerlink" href="#" onclick="togglediv(\'integrationkit\');">Embed this Map</a> ';if(parseFloat(nuserid)!=parseFloat(strseluserid))
{strPart1=strPart1.concat('| <a class="footerlink" href="'+strfurluser+'">Show only my Listings</a>');}
strPart2=""
strPart2=strPart2.concat('<div id="integrationkit" style="display:none;">Integrate the map for this query into your own site (<a href="javascript:popupintegrationexample(\'');strPart2=strPart2.concat(strfurlintegration);strPart2=strPart2.concat('\');"><u>example</u></a>) by copying and pasting the following code:<br/><textarea class="code" rows="4" readonly="readonly" cols="75">&lt;iframe src="');strPart2=strPart2.concat(strfurlintegration);strPart2=strPart2.concat('" width="95%" height="550" marginwidth="0" marginheight="0" frameborder="0" name="previewiframe" id="previewiframe"&gt;&lt;/iframe&gt;</textarea><br/></div>');$('friendlyurl').innerHTML=strPart2+strPart1;$('mapurl').innerHTML='<a href='+strfurl+' class="selectednav">Map</a>';$('listingsurl').innerHTML='<a href='+strlurl+'>Listings</a>';$('urlalert').innerHTML='<a href='+strlurl+'>browse by listing</a>';}
function popupintegrationexample(strurl){intwin=window.open("","intwindow","width=900,height=600,scrollbars=no");intwin.document.writeln('<html><body><h1>This is a test page.</h1><iframe src="'+strurl+'" width="95%" height="550" marginwidth="0" marginheight="0" frameborder="0" name="previewiframe" id="previewiframe"></iframe></body></html>');}
function updatead(){new Ajax.Updater('adspaceinner','/search/auto_complete_for_searchquery_adspace?province='+document.forms[0].selprovince.value+'&city='+document.forms[0].selcity.value+'&lat='+map.getCenter().lat()+'&lon='+map.getCenter().lng(),{asynchronous:true,evalScripts:true});}