//= 5.5) && (document.body.filters))
{
var img = document.images['mcontrol']
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = ""
img.outerHTML = strNewHTML
}
}
}
}
function updateMap(){
if (loading){return;}
loading=true;
map.clearOverlays();
batch = [];
markerinfo= [];
//mgr = new GMarkerManager(map);
map.disableDragging();
lookurl +='&minimum_latitude='+ map.getBounds().getSouthWest().lat();
lookurl +='&minimum_longitude='+ map.getBounds().getSouthWest().lng();
lookurl +='&maximum_latitude='+ map.getBounds().getNorthEast().lat();
lookurl +='&maximum_longitude='+ map.getBounds().getNorthEast().lng();
//var lookurl='minimum_latitude=35.535578864073656&maximum_latitude=35.68267720876588&minimum_longitude=-82.68379211425781'
//return;
loading=true;
document.getElementById("busyoverlay").style.visibility = 'visible';
document.getElementById("searching").style.visibility = 'visible';
GDownloadUrl("/mapsearch/searchresults?"+lookurl, function(data, responseCode) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var markerinfoin = [];
markerinfoin['lat'] = markers[i].getAttribute("lat");
markerinfoin['lng'] = markers[i].getAttribute("lng");
markerinfoin['upd'] = markers[i].getAttribute("upd");
markerinfoin['name'] = markers[i].getAttribute("name");
markerinfoin['city'] = markers[i].getAttribute("city");
markerinfoin['price'] = markers[i].getAttribute("price");
markerinfoin['img'] = markers[i].getAttribute("img");
markerinfoin['beds'] = markers[i].getAttribute("beds");
markerinfoin['baths'] = markers[i].getAttribute("baths");
markerinfoin['sqft'] = markers[i].getAttribute("sqft");
markerinfoin['acre'] = markers[i].getAttribute("acre");
markerinfoin['bhlisting'] = markers[i].getAttribute("bhlisting");
markerinfo.push(markerinfoin);
//markerinfo[batch.length]['batchnum'] = batch.length;
//var upd = markers[i].getAttribute("upd");
//var nam = markers[i].getAttribute("name");
//var typ = markers[i].getAttribute("type");
//var desc = markers[i].getAttribute("desc");
//var link = markers[i].getAttribute("link");
//var logo = markers[i].getAttribute("logo");
var marker = creatMarker(point,batch.length);
map.addOverlay(marker);
batch.push(marker);
}
createListHTML();
loading=false;
map.enableDragging();
document.getElementById("searching").style.visibility = 'hidden';
document.getElementById("busyoverlay").style.visibility = 'hidden';
});//end gdownload markers
}
function showInfoWin(id){
var winhtml="
";
winhtml+="
"+markerinfo[id]['name']+", "+markerinfo[id]['city']+"
";
winhtml+="
List Price:
$"+markerinfo[id]['price']+"
";
winhtml+="
";
winhtml+="| Bedrooms: | "+markerinfo[id]['beds']+" |
";
winhtml+="| Bathrooms: | "+markerinfo[id]['baths']+" |
";
winhtml+="| Sq. Ft.: | "+markerinfo[id]['sqft']+" |
";
winhtml+="| Acreage: | "+markerinfo[id]['acre']+" |
";
winhtml+="";
document.getElementById("menu_bar_infowin").innerHTML = winhtml;
document.getElementById("menu_bar_infowin").style.display = 'inline'; }
function hideInfoWin(){document.getElementById("menu_bar_infowin").style.display = 'none';}
function showSrchWin(){document.getElementById("busyoverlay").style.visibility = 'visible';
document.getElementById("map_overlay").style.visibility = 'visible';
}
function hideSrchWin(){document.getElementById("map_overlay").style.visibility = 'hidden';}
function showDetailWin(id){window.open('/search/detail/'+markerinfo[id]['upd']); }
function switchOptions(n){
switch(n)
{
case 'homes':
document.getElementById("mhomes").style.display = 'none';
document.getElementById("lands").style.display = 'none';
document.getElementById("homes").style.display = 'block';
break;
case 'mhomes':
document.getElementById("homes").style.display = 'none';
document.getElementById("lands").style.display = 'none';
document.getElementById("mhomes").style.display = 'block';
break;
case 'lands':
document.getElementById("homes").style.display = 'none';
document.getElementById("mhomes").style.display = 'none';
document.getElementById("lands").style.display = 'block';
}
}
function creatMarker(point,id) {
if (markerinfo[id]['bhlisting']=='true'){var marker = new GMarker(point,bhicon);}else{var marker = new GMarker(point,gicon);}
GEvent.addListener(marker, "mouseover", function() {showInfoWin(id);});
GEvent.addListener(marker, "mouseout", function() {hideInfoWin();});
GEvent.addListener(marker, "click", function() {showDetailWin(id);});
return marker;
}
function listrowOn(lr,id){
//map.removeOverlay(polyline);map.removeOverlay(polyline2);
lr.style.backgroundColor='#ffff99';
document.getElementById('timage').src='/images/mapsearch/spinner_on_black.gif';
intY = lr.offsetTop;
intX = lr.offsetLeft;
intY=intY+60;intX=intX+30;
thmb=document.getElementById('thumbnail');
thmb.style.left=intX+"px";
thmb.style.top=intY+"px";
thmb.style.visibility = 'visible';
document.getElementById('timage').src=markerinfo[id]['img'];
var bounds = map.getBounds();
var mleft = bounds.getSouthWest().lng();
var mright = bounds.getNorthEast().lng();
var mbot = bounds.getSouthWest().lat();
var mtop = bounds.getNorthEast().lat();
//alert(markerinfo[id]['lng']);
//alert(mleft);
//alert(mright);
polyline = new GPolyline([
new GLatLng(markerinfo[id]['lat'], mleft),
new GLatLng(markerinfo[id]['lat'], mright)
], "#245580", 4);
polyline2 = new GPolyline([
new GLatLng(mtop, markerinfo[id]['lng']),
new GLatLng(mbot, markerinfo[id]['lng'])
], "#245580", 4);
map.addOverlay(polyline);map.addOverlay(polyline2);
}
function listrowOut(lr){lr.style.backgroundColor='#ffffff';document.getElementById('thumbnail').style.visibility = 'hidden';map.removeOverlay(polyline);map.removeOverlay(polyline2);}
function createListHTML(){
var lhtml = '';
var openlink='';
//var openlink='';
if (markerinfo.length==100){
lhtml += "";
}else{
lhtml += "";
}
lhtml += "
";
lhtml += "| Address: | List Price: | Beds: | Baths: | Sq. Ft: | Acreage: | MLS #: |
";
//for (var xx in markerinfo){
for (var xx = 0; xx < markerinfo.length; xx++) {oldclick=xx;
lhtml += "";
lhtml += " | " + markerinfo[xx]['name'] +" | ";
lhtml += " $" + markerinfo[xx]['price'] +" | ";
lhtml += " " + markerinfo[xx]['beds'] +" | ";
lhtml += " " + markerinfo[xx]['baths'] +" | ";
lhtml += " " + markerinfo[xx]['sqft'] +" | ";
lhtml += " " + markerinfo[xx]['acre'] +" | ";
lhtml += " " + markerinfo[xx]['upd'] +" | ";
lhtml += "
";
}
lhtml += "
";
document.getElementById("menu_bar").innerHTML = lhtml;
}
function createMarker(point,updid,name,type,desc,link,logo) {
var marker = new GMarker(point,icon);
//var old = iold;
GEvent.addListener(marker, "click", function() {
//reseticon();
//oldclick=old;
//map.panTo(point);
//document.getElementById("map_logo").src = "communities/logos/"+logo;
//document.getElementById("overlay_title").innerHTML = ""+name+"";
//document.getElementById("overlay_desc").innerHTML = desc;
//document.getElementById("overlay_url").innerHTML = "Visit Website";
//marker.setImage("communities/marker_selected.png");
//marker.openInfoWindowHtml(""+name+"");
//GDownloadUrl("communities/markers.php?id="+updid, function(data, responseCode) {marker.openInfoWindowHtml(data);});
});
//GEvent.addListener(marker, "infowindowclose", function() {
//marker.setImage(path);
//});
// save the info we need to use later for the side_bar
gmarkers[iold] = marker;
// add a line to the side_bar html
if (type==1){house_html += '';}
if (type==2){condo_html += '';}
iold++;
return marker;
}
function sortDist(a, b)
{
return a[0] - b[0];
}
// This function picks up the click and opens the corresponding info window
function myclick(i) {
GEvent.trigger(gmarkers[i], "click");
}
function reseticon() {
if (oldclick!=null){
var oimg=gmarkers[oldclick].getIcon().image;
gmarkers[oldclick].setImage(oimg);}
}
function formsubmit(ptype) {
lookurl = $(ptype).serialize();
lookurl += '&property_type[]='+ptype;
lookurl += '&minimum_price='+$('mapsearchform').minimum_price.value;
lookurl += '&maximum_price='+$('mapsearchform').maximum_price.value;
hideSrchWin();
updateMap();
}
function openTable(){
var delay=50;
var delm = document.getElementById("menu_bar");
var width = parseInt(delm.style.width);
if (width==898 && !opening){toWidth=230;}else if (!opening){toWidth=898;}
var change = toWidth-width;
var total=width+Math.ceil((change/2));
if (change==-1){total=width-1;}
delm.style.width=total+'px';
function c() {
openTable();
}
if(change==0) {
clearTimeout(timer);opening=false;
return;
}
timer=setTimeout(c,delay);
opening=true;
}
function toggleGroup(type) {
if (type=='house'){var otype='condo';}else{var otype='house';}
map.closeInfoWindow();
for (var i = 0; i < markerGroups[otype].length; i++) {
var marker = markerGroups[otype][i];
if (!marker.isHidden()) {marker.hide();}
}
for (var i = 0; i < markerGroups[type].length; i++) {
var marker = markerGroups[type][i];
if (marker.isHidden()) {marker.show();}
}
document.getElementById("show"+otype).style.display = "inline";
document.getElementById("show"+type).style.display = "none";
document.getElementById("map_current_title").innerHTML = eval(type+"_title");
document.getElementById("menu_bar").innerHTML = eval(type+"_html");
}
function MyCustomControl()
{
}
//Default constructor for GControl
MyCustomControl.prototype = new GControl(false,false);
// Default location for the control
MyCustomControl.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(5,5));
};
MyCustomControl.prototype.initialize = function(gmapref)
{
var container=gmapref.getContainer();
var c = document.createElement("div");
c.innerHTML="
";
c.innerHTML+="";
c.innerHTML+="";
c.innerHTML+="";
c.innerHTML+="";
c.innerHTML+="";
c.innerHTML+="";
c.innerHTML+="";
container.appendChild(c);
GEvent.addDomListener($('zout'), "click", function() {map.zoomOut();});
GEvent.addDomListener($('zin'), "click", function() {map.zoomIn();});
GEvent.addDomListener($('panl'), "click", function() {map.panDirection('1', '0');});
GEvent.addDomListener($('panr'), "click", function() {map.panDirection(-1, 0);});
GEvent.addDomListener($('panu'), "click", function() {map.panDirection(0, 1);});
GEvent.addDomListener($('pand'), "click", function() {map.panDirection(0, -1);});
GEvent.addDomListener($('srch'), "click", function() {showSrchWin();});
return c;
}
//]]>