function mapGo() {      // http://www.google.com/apis/maps/documentation/
  if (document.getElementById && document.getElementById("map")) {
    map = new GMap(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.centerAndZoom(new GPoint(-122.680163,45.516993), 2); // typical PDX area
  }
}

var oldOnLoad = window.onload;
var map;
window.onload = function() {
	if (oldOnLoad) { oldOnLoad();	}
	mapGo();
}

function mapClose() {
  if (document.getElementById && document.getElementById("map")) {
    map.clearOverlays();
    document.getElementById("mapDiv").style.visibility = "hidden";
  }
}

function mapOverview() {
  if (document.getElementById && document.getElementById("map")) {
    document.getElementById("mapDiv").style.visibility = "visible";
    map.centerAndZoom(new GPoint(-122.668190,45.522947), 4);
  }
  var burnside = new GPolyline([new GPoint(-122.628053,45.522864), 
   new GPoint(-122.664703,45.523022), new GPoint(-122.675389,45.523089),
   new GPoint(-122.687244,45.522902), new GPoint(-122.697480,45.523368),
   new GPoint(-122.702576,45.524202), new GPoint(-122.708294,45.523766)],
   "#ff0000", 7, .7);
  var willamette = new GPolyline([new GPoint(-122.663126,45.490825),
   new GPoint(-122.664757,45.500933), new GPoint(-122.670937,45.511881),
   new GPoint(-122.667160,45.525352), new GPoint(-122.703209,45.553126)],
   "#ff0000", 7, .7);
  var williams = new GPolyline([new GPoint(-122.667160,45.525352), 
   new GPoint(-122.666774,45.556101)],
   "#ff0000", 7, .7);
  var quadNW = new GMarker(new GPoint(-122.683811,45.530764));
  var quadSW = new GMarker(new GPoint(-122.683811,45.513023));
  var quadSE = new GMarker(new GPoint(-122.649307,45.513023));
  var quadNE = new GMarker(new GPoint(-122.649307,45.530764));
  var quadN = new GMarker(new GPoint(-122.673597,45.548085));
  var htmlNW = '<h1 class="info">Northwest Portland</h1>';
  GEvent.addListener(quadNW, "click", function() { quadNW.openInfoWindowHtml(htmlNW); });
  var htmlSW = '<h1 class="info">Southwest Portland</h1>';
  GEvent.addListener(quadSW, "click", function() { quadSW.openInfoWindowHtml(htmlSW); });
  var htmlSE = '<h1 class="info">Southeast Portland</h1>';
  GEvent.addListener(quadSE, "click", function() { quadSE.openInfoWindowHtml(htmlSE); });
  var htmlNE = '<h1 class="info">Northeast Portland</h1>';
  GEvent.addListener(quadNE, "click", function() { quadNE.openInfoWindowHtml(htmlNE); });
  var htmlN = '<h1 class="info">North Portland</h1>';
  GEvent.addListener(quadN, "click", function() { quadN.openInfoWindowHtml(htmlN); });
  var htmlBu = '<h1 class="info">Burnside St.</h1>';
  GEvent.addListener(burnside, "click", function() { burnside.openInfoWindowHtml(htmlBu); });
  var htmlWi = '<h1 class="info">Willamette River</h1>';
  GEvent.addListener(willamette, "click", 
   function() { willamette.openInfoWindowHtml(htmlWi); });
  var htmlWl = '<h1 class="info">N Williams Ave.</h1>';
  GEvent.addListener(williams, "click", function() { williams.openInfoWindowHtml(htmlWl); });
  map.addOverlay(burnside); map.addOverlay(willamette); map.addOverlay(williams);
  map.addOverlay(quadNW); map.addOverlay(quadSW); map.addOverlay(quadSE);
  map.addOverlay(quadNE); map.addOverlay(quadN);
}
