﻿//<![CDATA[

var map = null;
var geocoder = new GClientGeocoder();


function user_object(param1, param2) {
	this.property_id = param1;
	this.marker = param2;
}

function load() {
  if (GBrowserIsCompatible()) {
  
    map = new GMap2(document.getElementById("div_map"));
    var center = new GLatLng(33.762594540992644, -117.83754577636719);
    map.setCenter(center, 10);
    map.addControl(new GLargeMapControl());
    map.enableDoubleClickZoom();
  }
}
function showPoint() {
  if (geocoder) {
	var complete_address = '19762 MacArthur Blvd., Irvine, CA 92612';
	geocoder.getLatLng(
	  complete_address,
	  function(point) {
		if (point) {
			var marker = new GMarker(point, {draggable: false});
		  	map.addOverlay(marker);
		}
	  }
	);
  }
}
// ====== Geocoding ======
function getAddress(id, sad, sct, sst, szp, next) {
    if (geocoder && map) {
        var complete_address = sad + ', ' + sct + ', ' + sst + ' ' + szp;
        var html_address = '<font color=#000000>' + sad + '<br>' + sct + ', ' + sst + ' ' + szp + '</font';
        geocoder.getLatLng(
          complete_address,
          function(point) {
            if (point) {
                var marker = new GMarker (point, {draggable: false});
                GEvent.addListener(marker, "click", function() {
    			    document.location = "http://" + server_name + "/page.aspx?pgid=11&pid=" + id;
                });
                GEvent.addListener(marker, "mouseover", function() {
	                marker.openInfoWindowHtml(html_address);
                });
                map.addOverlay(marker);
            }
            next();
          }
        );
    } 
}

var nextID = 1;
// ======= Function to call the next Geocode operation after a delay of 1.725 sconds = 1725
function theNext() {
    if (nextID < ids.length) {
      setTimeout("getAddress('"+ids[nextID]+"', '"+ad[nextID]+"', '"+ct[nextID]+"', '"+st[nextID]+"', '"+zp[nextID]+"', theNext)", 0);
      nextID++;
    }
}

  

//]]>

