//<![CDATA[

_mSvgEnabled = true ;
_mSvgForced  = true ;

var center ;
var centerLat;
var centerLng;
var marker = [] ;
var line ;
var geocoder ;
var icon ;
var map ;
var visi = 'visible';
var visi2 = 'visible';
var visic ='visible';
var visic2 ='visible';
var marcadores;
var list;
var point;


function load()
{

 map = new GMap2(document.getElementById("map"));
 var start = new GLatLng(35.127771,-89.967041);
 map.setCenter(start, 1);
 centerLat = start.y;
 centerLng = start.x;
 map.addControl(new GLargeMapControl());
 map.addControl(new GMapTypeControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
 icon.iconSize = new GSize(20, 34);
 icon.shadowSize = new GSize(37, 34);
 icon.iconAnchor = new GPoint(9, 34);
 icon.infoWindowAnchor = new GPoint(9, 2);
 icon.infoShadowAnchor = new GPoint(18, 25);
 geocoder = new GClientGeocoder() ;
}


function loadSmall()
{
 map = new GMap2(document.getElementById("map"));
 var start = new GLatLng(35.127771,-89.967041);
 map.setCenter(start, 1);
 centerLat = start.y;
 centerLng = start.x;
 map.addControl(new GSmallMapControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.image = "mm_20_red.png";
 icon.shadow = "mm_20_shadow.png";
 icon.iconSize = new GSize(18, 19);
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11);
 geocoder = new GClientGeocoder() ;
}

function loadSearchGeocode(addr,city,state,country,zoom)
{
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GScaleControl()) ;
	icon = new GIcon();
	icon.image = "mm_20_red.png";
	icon.shadow = "mm_20_shadow.png";
	icon.iconSize = new GSize(18, 19);
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(11, 11);
	geocoder = new GClientGeocoder() ;
	var address;
	if(state!='')
		address = addr + ',' + city + ',' + state + ',' + country;
	else
		address = addr + ',' + city + ',' + country;

	geocoder.getLatLng( address, function(pointer)
	{
		if (!pointer){

		}
		else{
			centerLat = pointer.y;
			centerLng = pointer.x;
			map.setCenter(pointer,zoom);
			var marker = new GMarker(pointer, icon);
			map.addOverlay(marker);
		}
	});
}


function loadMap(address,zoom)
{
 map = new GMap2(document.getElementById("map"));
 geocoder = new GClientGeocoder() ;
 centerMap(address,zoom);
 map.addControl(new GLargeMapControl());
 map.addControl(new GMapTypeControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.image = "mm_20_red.png";
 icon.shadow = "mm_20_shadow.png";
 icon.iconSize = new GSize(18, 19);
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11);
 marcadores = new Array();
 list = document.getElementById("aptbody");
}

function loadMapLL(lat, lng,zoom)
{
 map = new GMap2(document.getElementById("map"));
 centerMapLL(lat,lng,zoom);
 map.addControl(new GLargeMapControl());
 map.addControl(new GMapTypeControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.iconSize = new GSize(25, 25);
 icon.shadowSize = new GSize(25, 25);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11);
 geocoder = new GClientGeocoder() ;
 marcadores = new Array();
 list = document.getElementById("aptbody");
}

function loadMapLL2(lat,lng,zoom)
{
 map = new GMap2(document.getElementById("map"));
 centerMapLL(lat,lng,zoom);
 map.addControl(new GSmallMapControl());
 map.addControl(new GMapTypeControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.image = "http://www.forleasebyowner.com/icons/orange1.png";
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11);
 var point = new GLatLng(lat,lng);
 var marker = new GMarker(point, icon);
 map.addOverlay(marker);
}

function centerMap(address,zoom){
	geocoder.getLatLng( address, function(pointer)
	{
		if (!pointer){
			alert( address + " unable to be mapped by Google.\n\nPlease confirm information is correct and proceed.");
		}
		else{
 			centerLat = pointer.y;
 			centerLng = pointer.x;
			map.setCenter(pointer,zoom);
		}
	}) ;
}

function mapLocation(address,zoom){
    geocoder = new GClientGeocoder();
    geocoder.getLatLng(address, function(pointer)
	{
		if (!pointer){
			alert( address + " unable to be mapped by Google.\n\nPlease confirm information is correct and proceed.");
		}
		else{
            centerLat = pointer.y;
 			centerLng = pointer.x;
 			newLat = pointer.y;
 			newLng = pointer.x;
            map.setCenter(pointer,zoom);



		}
	}) ;
}

function centerMapWMarker(addr,city,state,country,zoom){
	var address;
	if(state!='')
		address = addr + ',' + city + ',' + state + ',' + country;
	else
		address = addr + ',' + city + ',' + country;

	geocoder.getLatLng( address, function(pointer)
	{
		if (!pointer){
			locationLabel(false);
		}
		else{
 			centerLat = pointer.y;
 			centerLng = pointer.x;
			map.setCenter(pointer,zoom);
			var marker = new GMarker(pointer, icon);
			var html = '<b>Property located:</b><br>' + addr + '<br>' + city +', ' + country;
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(html);
			});
			map.addOverlay(marker);
			marker.openInfoWindowHtml(html);
			locationLabel(true);
		}
	});
}

function centerMapLL(lat, lng, zoom){
	var pointer = new GLatLng(lat,lng)
	map.setCenter(pointer,zoom);
 	centerLat = pointer.y;
 	centerLng = pointer.x;
}


function showState(f){
	var unvisi;
	var UKvisi='hidden';
	if(f){visi="visible"; unvisi="hidden";}
	else{visi="hidden"; unvisi="visible";}
	if(document.layers){
		if(f){
			document.statecity.height = '100%';
			document.statecity.style.display = 'block';
			document.international.height = '0%';
			document.international.style.display = 'none';
		}
		else{
			document.statecity.height = '0%';
			document.statecity.style.display = 'none';
			document.international.height = '100%';
			document.international.style.display = 'block';
		}
		document.statecity.overflow=visi;
		document.statecity.visibility=visi;
		document.international.overflow=unvisi;
		document.international.visibility=unvisi;
	}
	if(document.all){
		if(f){
			document.all.statecity.height = '100%';
			document.all.international.height = '0%';
		}
		else{
			document.all.statecity.height = '0%';
			document.all.international.height = '100%';
		}
		document.all.statecity.overflow=visi;
		document.all.statecity.style.visibility=visi;
		document.all.international.overflow=unvisi;
		document.all.international.style.visibility=unvisi;
	}
	if(document.getElementById){
		if(f){
			document.getElementById("statecity").style.height = '100%';
			document.getElementById("statecity").style.display = 'block';
			document.getElementById("international").style.height = '0%';
			document.getElementById("international").style.display = 'none';
		}
		else{
			document.getElementById("statecity").style.height = '0%';
			document.getElementById("statecity").style.display = 'none';
			document.getElementById("international").style.height = '100%';
			document.getElementById("international").style.display = 'block';
		}
		document.getElementById("statecity").style.overflow=visi;
		document.getElementById("statecity").style.visibility=visi;
		document.getElementById("international").style.overflow=unvisi;
		document.getElementById("international").style.visibility=unvisi;
	}
}

function showState2(f){
	var unvisi;
	var UKvisi='hidden';
	if(f){visi2="visible"; unvisi="hidden";}
	else{visi2="hidden"; unvisi="visible";}
	if(document.layers){
		if(f){
			document.statecity2.height = '100%';
			document.statecity2.style.display = 'block';
			document.international2.height = '0%';
			document.international2.style.display = 'none';
		}
		else{
			document.statecity2.height = '0%';
			document.statecity2.style.display = 'none';
			document.international2.height = '100%';
			document.international2.style.display = 'block';
		}
		document.statecity2.overflow=visi2;
		document.statecity2.visibility=visi2;
		document.international2.overflow=unvisi;
		document.international2.visibility=unvisi;
	}
	if(document.all){
		if(f){
			document.all.statecity2.height = '100%';
			document.all.international2.height = '0%';
		}
		else{
			document.all.statecity2.height = '0%';
			document.all.international2.height = '100%';
		}
		document.all.statecity2.overflow=visi2;
		document.all.statecity2.style.visibility=visi2;
		document.all.international2.overflow=unvisi;
		document.all.international2.style.visibility=unvisi;
	}
	if(document.getElementById){
		if(f){
			document.getElementById("statecity2").style.height = '100%';
			document.getElementById("statecity2").style.display = 'block';
			document.getElementById("international2").style.height = '0%';
			document.getElementById("international2").style.display = 'none';
		}
		else{
			document.getElementById("statecity2").style.height = '0%';
			document.getElementById("statecity2").style.display = 'none';
			document.getElementById("international2").style.height = '100%';
			document.getElementById("international2").style.display = 'block';
		}
		document.getElementById("statecity2").style.overflow=visi2;
		document.getElementById("statecity2").style.visibility=visi2;
		document.getElementById("international2").style.overflow=unvisi;
		document.getElementById("international2").style.visibility=unvisi;
	}
}

function showCity(f){
	var unvisi;
	if(f){visic="visible"; unvisi="hidden";}
	else{visic="hidden"; unvisi="visible";}
	if(document.layers){
		if(f){
			document.inlist.height = '100%';
			document.inlist.style.display = 'block';
			document.nolist.height = '0%';
			document.nolist.style.display = 'none';
		}
		else {
			document.inlist.height = '0%';
			document.inlist.style.display = 'none';
			document.nolist.height = '100%';
			document.nolist.style.display = 'block';
		}
		document.inlist.overflow=visic;
		document.inlist.visibility=visic;
		document.nolist.overflow=unvisi;
		document.nolist.visibility=unvisi;
	}
	if(document.all){
		if(f){
			document.all.inlist.height = '100%';
			document.all.nolist.height = '0%';
		}
		else {
			document.all.inlist.height = '0%';
			document.all.nolist.height = '100%';
		}
		document.all.inlist.overflow=visic;
		document.all.inlist.style.visibility=visic;
		document.all.nolist.overflow=unvisi;
		document.all.nolist.style.visibility=unvisi;
	}
	if(document.getElementById){
		if(f){
			document.getElementById("inlist").style.height = '100%';
			document.getElementById("inlist").style.display = 'block';
			document.getElementById("nolist").style.height = '0%';
			document.getElementById("nolist").style.display = 'none';
		}
		else {
			document.getElementById("inlist").style.height = '0%';
			document.getElementById("inlist").style.display = 'none';
			document.getElementById("nolist").style.height = '100%';
			document.getElementById("nolist").style.display = 'block';
		}
		document.getElementById("inlist").style.overflow=visic;
		document.getElementById("inlist").style.visibility=visic;
		document.getElementById("nolist").style.overflow=unvisi;
		document.getElementById("nolist").style.visibility=unvisi;
	}
}

function showCity2(f){
	var unvisi;
	if(f){visic2="visible"; unvisi="hidden";}
	else{visic2="hidden"; unvisi="visible";}
	if(document.layers){
		if(f){
			document.inlist2.height = '100%';
			document.inlist2.style.display = 'block';
			document.nolist2.height = '0%';
			document.nolist2.style.display = 'none';
		}
		else {
			document.inlist2.height = '0%';
			document.inlist2.style.display = 'none';
			document.nolist2.height = '100%';
			document.nolist2.style.display = 'block';
		}
		document.inlist2.overflow=visic2;
		document.inlist2.visibility=visic2;
		document.nolist2.overflow=unvisi;
		document.nolist2.visibility=unvisi;
	}
	if(document.all){
		if(f){
			document.all.inlist2.height = '100%';
			document.all.nolist2.height = '0%';
		}
		else {
			document.all.inlist2.height = '0%';
			document.all.nolist2.height = '100%';
		}
		document.all.inlist2.overflow=visic2;
		document.all.inlist2.style.visibility=visic2;
		document.all.nolist2.overflow=unvisi;
		document.all.nolist2.style.visibility=unvisi;
	}
	if(document.getElementById){
		if(f){
			document.getElementById("inlist2").style.height = '100%';
			document.getElementById("inlist2").style.display = 'block';
			document.getElementById("nolist2").style.height = '0%';
			document.getElementById("nolist2").style.display = 'none';
		}
		else {
			document.getElementById("inlist2").style.height = '0%';
			document.getElementById("inlist2").style.display = 'none';
			document.getElementById("nolist2").style.height = '100%';
			document.getElementById("nolist2").style.display = 'block';
		}
		document.getElementById("inlist2").style.overflow=visic2;
		document.getElementById("inlist2").style.visibility=visic2;
		document.getElementById("nolist2").style.overflow=unvisi;
		document.getElementById("nolist2").style.visibility=unvisi;
	}
}

function getCenterLat() {
	return centerLat;
}

function getCenterLng() {
	return centerLng;
}

function addProperty(address, city, state,country, lat, lon, id, img, rent, bed, bath, avday, avmonth, avyear, dist) {
	var mark = new Array();
	mark.marker = null;
	mark.address = address;
	mark.city = city;
	mark.state = state;
	mark.country = country;
	mark.lat = lat;
	mark.lng = lon;
	mark.id = id;
	mark.img = img;
	mark.rent = rent;
	mark.beds = bed;
	mark.baths = bath;
	mark.avDay = avday;
	mark.avMonth = avmonth;
	mark.avYear = avyear;
    mark.dist = dist;
	marcadores.push(mark);
}

function showProperties() {
	//remove all rows
	if(list.rows!=null){
		var rowCount = list.rows.length;
		for(var j = rowCount; j > 0; j--) {
			list.removeChild(list.rows.item(j-1));
		}
	}
	map.clearOverlays();
	for(var i=0;i<marcadores.length;i++)
		showProperty(marcadores[i], i);
}

function showProperty(data, i) {

	var minRent = document.mapsearch.minRent.options[document.mapsearch.minRent.selectedIndex].value;
	var maxRent = document.mapsearch.maxRent.options[document.mapsearch.maxRent.selectedIndex].value;
	var beds = document.mapsearch.beds.options[document.mapsearch.beds.selectedIndex].value;
	var baths = document.mapsearch.baths.options[document.mapsearch.baths.selectedIndex].value;
	var beforeMonth = document.mapsearch.beforeMonth.options[document.mapsearch.beforeMonth.selectedIndex].value;
	var beforeDay = document.mapsearch.beforeDay.options[document.mapsearch.beforeDay.selectedIndex].text;
	var beforeYear = document.mapsearch.beforeYear.options[document.mapsearch.beforeYear.selectedIndex].text;
	var afterMonth = document.mapsearch.afterMonth.options[document.mapsearch.afterMonth.selectedIndex].value;
	var afterDay = document.mapsearch.afterDay.options[document.mapsearch.afterDay.selectedIndex].text;
	var afterYear = document.mapsearch.afterYear.options[document.mapsearch.afterYear.selectedIndex].text;
	var before = new Date(beforeYear,beforeMonth-1,beforeDay);
	var after = new Date(afterYear,afterMonth-1,afterDay);
	if(data.rent >= minRent && data.rent <= maxRent) {
		if(data.beds >= beds) {
			if(data.baths >= baths) {
				var pdate = new Date(data.avYear,data.avMonth-1,data.avDay);
				if(pdate < before) {
					if(pdate > after) {
						if(data.lat == 0 && data.lng == 0) {
							var country = data.country.replace(/_/g," ");
							if(country == 'United States') {
								var Caddr = data.address +','+data.city+','+data.state;
								geocoder.getLatLng( Caddr, function(pointer)
								{
									if (!pointer){
										alert(Caddr + " not found");
									}
									else{
										var mark = createMarker(pointer, data.address, data.id, data.img, data.rent, data.beds, data.baths, data.city, data.state, data.country, i);
										marcadores[i].marker = mark;
                                        var letter = i + 1 ;
                                        var trElem;
                                        trElem = list.insertRow(list.rows.length);
										trElem.className = "tr0";
										addOnList(trElem,data.id,data.address,data.rent,data.city,"col1","http://www.forleasebyowner.com/icons/orange" +letter+".png",data.rent, data.beds, data.baths, data.dist);
										map.addOverlay(marcadores[i].marker);
									}
								});
							} //end if united states
						} // end if lat and lng == 0
						else {
							var pointer = new GLatLng(data.lat,data.lng);
							var mark = createMarker(pointer, data.address, data.id, data.img, data.rent, data.beds, data.baths, data.city, data.state, data.country, i);
							marcadores[i].marker = mark;
                            var letter = i + 1;
							var trElem;
                            trElem = list.insertRow(list.rows.length);
							trElem.className = "tr0";
							addOnList(trElem,data.id,data.address,data.rent,data.city,"col1","http://www.forleasebyowner.com/icons/orange" +letter+".png",data.rent, data.beds, data.baths, data.dist);
							map.addOverlay(marcadores[i].marker);
						}
					} // end if after
				} // end if before
			} // end if baths
		} // end if beds
	} // end if rent
}


function createMarker(pointer, address, id, img, rent, bed, bath, city, state, country, i){
  var aref2;
  var lettermap = i + 1;
  var letteredIcon = new GIcon(icon);
  letteredIcon.image = "http://www.forleasebyowner.com/icons/orange" +lettermap+".png";

  // Set up our GMarkerOptions object
    markerOptions = { icon:letteredIcon };
    var marker = new GMarker(pointer, markerOptions);

	//alert(img);
    if(id >= 8051000000) {
				var aref2 = "Property3.asp"};
    if(id<8051000000) {var aref2 = "Property2.asp"};
    var img1 = img.replace(/"296"/,'"80"');
	var img2 = img1.replace(/"240"/,'"65"');
	GEvent.addListener(marker, "click", function() {
		var html = '<div style="width:240px; "><table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td valign="top" width="80px" class="labels7">';
		html = html + img2 + '</td>';
		html = html + '<td valign="top" class="labels7">';
		html = html + '<a href="#" onclick="openWindow(\'Search_'+aref2+'?ID='+id+'\')" class="lnk3">Click here<br>';
        html = html + 'ID: '+ id +'<br>';
        html = html + ''+ address +'<br>';
        html = html + ''+ city +', '+ state +'<br>';
		html = html + '$'+ rent +'/month<br>';
		html = html + 'Beds/Baths: '+ bed +'/' + bath +'<br></a>';
		html = html + '</td></tr></table></div>';
		marker.openInfoWindowHtml(html);
	});
	return marker;
}

function openWindow(link1) {
	var jal = window.open(link1,"Listing_Details", "menubar=yes,width=980,height=600,scrollbars=yes,toolbar=yes,");
}

function addOnList(trElem, id, address, rent, city, classe, icon, price, beds, baths, dist) {
    var aref;
	var tdElem;
    if(id >= 8051000000) {
				var aref = "Property3.asp"};
    if(id<8051000000) {var aref = "Property2.asp"};
	tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = "col3";
	tdElem.valign = "middle";
	tdElem.innerHTML = '&nbsp;<img src="'+icon+'" border="0" height="25" width="25">&nbsp;';
	tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = classe;
	tdElem.innerHTML = '<a href="Search_'+aref+'?id='+id+'">'+address+'</a><input type="hidden" value="'+id+'" >';
	tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = "col5";
	tdElem.innerHTML = city;
	tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = "col3";
	tdElem.innerHTML = '$'+price;
    tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = "col3";
	tdElem.innerHTML = +beds+'/'+baths;
     tdElem = trElem.insertCell(trElem.cells.length);
    tdElem.className = "col3";
	tdElem.innerHTML = dist;
}

function changeStyle(evt) {
	var e = (window.event) ? window.event : evt;
	var src = (e.srcElement)? e.srcElement : e.target;
	if(src.parentNode.className=='col3')
		src = src.parentNode;
	if (src.parentNode.className=='col0')
		src = src.parentNode;
	if (src.parentNode.className=='col1')
		src = src.parentNode;
	src.parentNode.className = '';
	src.parentNode.className = 'tr1';
	src.parentNode.bgColor = '#000000';
	var src2 = src.parentNode.childNodes[1];
	for(var i=0;i<marcadores.length;i++){
		var obj = marcadores[i];
    if(src2.innerHTML.indexOf('value="'+obj.id+'"')!=-1 ||
    src2.innerHTML.indexOf('value='+obj.id+'>')!=-1 ||
    src2.innerHTML.indexOf('value='+obj.id+' ')!=-1){
			GEvent.trigger(obj.marker,'click');
			break;
		}
	}
}



function removeStyle() {
	var rowCount = list.rows.length;
	for(var j = 0; j< rowCount; j++) {
		list.rows[j].className='';
	}
	for(var i=0;i< rowCount; i++) {
		list.rows[i].className='tr0';
		list.rows[i].bgColor='#FFFFFF';
	}
}
function centerMapWMarker_orig(addr,city,state,country,zoom){


    geocoder = new GClientGeocoder();
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    var address;

		address = addr + ', ' + city + ', ' + state + ', ' + country;


	if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            }
		else{
            centerLat = point.y;
 			centerLng = point.x;
            map.setCenter(point,zoom);
			var marker = new GMarker(point, {draggable: true});
		   	var html = '<b>Property located:</b><br>' + addr + '<br>' + city +', ' + country;
			map.addOverlay(marker);
            toOrigLatLon(addr,city,state,country,address);
            GEvent.addListener(marker, "dragend", function() {
                var point = marker.getPoint();
        	    map.panTo(point);
                 centerLat = point.y.toFixed(6);
 			     centerLng = point.x.toFixed(6);
                 addr1 = centerLat;
                 toOrigLatLon(addr,city,state,country,address);

                });
               GEvent.addListener(map, "moveend", function() {
        		map.clearOverlays();
                var center = map.getCenter();
        		var marker = new GMarker(center, {draggable: true});
        		map.addOverlay(marker);


        	    GEvent.addListener(marker, "dragend", function() {
                var point =marker.getPoint();
        	    map.panTo(point);
                centerLat = point.y.toFixed(6);
 			    centerLng = point.x.toFixed(6);
                toOrigLatLon(addr,city,state,country,address);


        });
        });

        }
	});
}
}




function toOrigLatLon(addr,city,state,country,address) {
    var div = document.getElementById('review');
	var text =  '<table><tr><td valign="top" width="160">';
        text +=  addr+'<br>';
        text +=  city+', ';
        text +=  state+'<br>';
        text +=  country+'<br><br>';
        text += 'Latitude:     '+centerLat+'<br>';
        text += 'Longitude: '+centerLng+'</td><td valign="top" style="padding-left: 20px; color:#FF0000"><br><br>';
        text += 'To get a precise location of your property, move the Red icon on the map to the exact location. ';
        text += '<input type="hidden" name="Lat" value="'+centerLat+'">';
        text += '<input type="hidden" name="Lon" value="'+centerLng+'">';
        text +=   '</td></tr></table>';
	div.innerHTML = text;


}

function toOrigLatLon_edit(lat3, lon3, addr,city,state,country) {
    var div = document.getElementById('review');
	var text =  '<table><tr><td valign="top" width="160">';
        text +=  addr+'<br>';
        text +=  city+', ' +state+'<br>';
        text +=  country+'<br><br>';
        text += 'Latitude:     '+lat3+'<br>';
        text += 'Longitude: '+lon3+'</td><td valign="top" style="padding-left: 20px; color:#FF0000"><br><br>';
        text += 'To get a precise location of your property, move the Red icon on the map to the exact location. ';
        text += '<input type="hidden" name="Lat2"  value="'+lat3+'">';
        text += '<input type="hidden" name="Lon2" value="'+lon3+'">';
        text +=   '</td></tr></table>';
	div.innerHTML = text;
    document.mapsearch.Lat.value = lat3;
        document.mapsearch.Lon.value = lon3;

}

function loaddev(latlook,lonlook,addr,city,state,country) {
    var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        var center = new GLatLng(latlook,lonlook);
        geocoder = new GClientGeocoder();
        map.setCenter(center, 14);
        var marker = new GMarker(center, {draggable: true});
        map.addOverlay(marker);
        var newLat =  center.lat().toFixed(6);
        var newLon =  center.lng().toFixed(6);
        toOrigLatLon_edit(newLat,newLon,addr,city,state,country);

	    GEvent.addListener(marker, "dragend", function() {
        var point = marker.getPoint();
	    map.panTo(point);
        var newLat =  center.lat().toFixed(6);
        var newLon =  center.lng().toFixed(6);
        toOrigLatLon_edit(newLat,newLon,addr,city,state,country);

        });


	    GEvent.addListener(map, "moveend", function() {
		map.clearOverlays();
        var center = map.getCenter();
		var marker = new GMarker(center, {draggable: true});
		map.addOverlay(marker);
        var newLat =  center.lat().toFixed(6);
        var newLon =  center.lng().toFixed(6);
        toOrigLatLon_edit(newLat,newLon,addr,city,state,country);

	    GEvent.addListener(marker, "dragend", function() {
        var point =marker.getPoint();
	    map.panTo(point);
        var newLat =  center.lat().toFixed(6);
        var newLon =  center.lng().toFixed(6);
        toOrigLatLon_edit(newLat,newLon,addr,city,state,country);

        });
        });
    }

function centerMapWMarker_mod(addr,city,state,country,zoom){


    geocoder = new GClientGeocoder();
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    var address;

		address = addr + ', ' + city + ', ' + state + ', ' + country;


	if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            }
		else{
            centerLat = point.y;
 			centerLng = point.x;
            map.setCenter(point,zoom);
			var marker = new GMarker(point, {draggable: true});
		   	var html = '<b>Property located:</b><br>' + addr + '<br>' + city +', ' + country;
			map.addOverlay(marker);
            toOrigLatLon_mod(addr,city,state,country,address);
            GEvent.addListener(marker, "dragend", function() {
                var point = marker.getPoint();
        	    map.panTo(point);
                 centerLat = point.y.toFixed(6);
 			     centerLng = point.x.toFixed(6);
                 addr1 = centerLat;
                 toOrigLatLon_mod(addr,city,state,country,address);

                });
               GEvent.addListener(map, "moveend", function() {
        		map.clearOverlays();
                var center = map.getCenter();
        		var marker = new GMarker(center, {draggable: true});
        		map.addOverlay(marker);


        	    GEvent.addListener(marker, "dragend", function() {
                var point =marker.getPoint();
        	    map.panTo(point);
                centerLat = point.y.toFixed(6);
 			    centerLng = point.x.toFixed(6);
                toOrigLatLon_mod(addr,city,state,country,address);


        });
        });

        }
	});
}
}




function toOrigLatLon_mod(addr,city,state,country,address) {
    var div = document.getElementById('review');
	var text =  '<table><tr><td valign="top" width="160">';
        text +=  addr+'<br>';
        text +=  city+', ';
        text +=  state+'<br>';
        text +=  country+'<br><br>';
        text += 'Latitude:     '+centerLat+'<br>';
        text += 'Longitude: '+centerLng+'</td><td valign="top" style="padding-left: 20px; color:#FF0000"><br><br>';
        text += 'To get a precise location of your property, move the Red icon on the map to the exact location. ';
        text += '<input type="hidden" name="Lat2" value="'+centerLat+'">';
        text += '<input type="hidden" name="Lon2" value="'+centerLng+'">';
        text +=   '</td></tr></table>';
	div.innerHTML = text;
    document.mapsearch.Lat.value = centerLat;
        document.mapsearch.Lon.value = centerLng;


}

function loadPropDetail(addr,city,state,country,Lat,Lon, rent, zoom)
{
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GScaleControl()) ;
	icon = new GIcon();
	icon.image = "http://www.forleasebyowner.com/icons/orange1.png";
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(11, 11);
	geocoder = new GClientGeocoder() ;
	var address;
	if(state!='')
		address = addr + ',' + city + ',' + state + ',' + country;
	else
		address = addr + ',' + city + ',' + country;
    if (rent!= '-')
       loadMapLL2(Lat,Lon,15);
    else
    geocoder.getLatLng( address, function(pointer)
	{
		if (!pointer){
            centerMapLL2(Lat,Lon,15);
            var marker = new GMarker(Lat,Lon, icon);
			map.addOverlay(marker);


		}
		else{
			centerLat = pointer.y;
			centerLng = pointer.x;
			map.setCenter(pointer,zoom);
			var marker = new GMarker(pointer, icon);
			map.addOverlay(marker);
		}
	});
}

function centerMapLL2(lat, lng, zoom){
	var pointer = new GLatLng(lat,lng)
	map.setCenter(pointer,zoom);
 	centerLat = pointer.y;
 	centerLng = pointer.x;
    var marker = new GMarker(pointer, icon);
	map.addOverlay(marker);
}