// JavaScript Document
//<![CDATA[

    var map;
    var geocoder;
	var directionsPanel;
	var directions;

//icon for rivershore
var icon_rivershore = new GIcon();
iconc_rivershore.image = "http://maps.google.com/mapfiles/ms/icons/green-dot.png";
iconc_rivershore.iconSize = new GSize(32, 32);
iconc_rivershore.iconAnchor = new GPoint(9, 32);
iconc_rivershore.infoWindowAnchor = new GPoint(9, 2);
iconc_rivershore.infoShadowAnchor = new GPoint(18, 25);

//icons
var iconc = new GIcon();
iconc.image = "http://maps.google.com/mapfiles/ms/icons/green-dot.png";
iconc.iconSize = new GSize(32, 32);
iconc.iconAnchor = new GPoint(9, 32);
iconc.infoWindowAnchor = new GPoint(9, 2);
iconc.infoShadowAnchor = new GPoint(18, 25);
	


var num=0; 
var dist='';



    function load() {	
	//var address=document.getElementById('zip').value;
	var address="413 - 1055 Dunsmuir Street, Vancouver, BC";
	geocoder = new GClientGeocoder();
    var placest=geocoder.getLocations(address, addAddressToLoad);
	//alert("test");
	//alert(placest);
	
	
	}


	
	function addAddressToLoad(response) {
      //map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
	  	placest = response.Placemark[0];	
		latx=placest.Point.coordinates[1];
	longx=placest.Point.coordinates[0];
	//alert("test1");

	  
	  map = new GMap2(document.getElementById("map")); 
	  map.addControl(new GLargeMapControl());
	  map.addControl(new GMapTypeControl());
	  map.enableScrollWheelZoom();
	  map.enableContinuousZoom();	
	  
      map.setCenter(new GLatLng(latx,longx), 13);	  
      geocoder = new GClientGeocoder();
		point = new GLatLng(latx,longx);		
        marker = new GMarker(point, iconc);	
        map.addOverlay(marker);
		}
		
    }
	

