function setMarkers(map, locations) {
  var image = new google.maps.MarkerImage('images/platformflag.png',
      new google.maps.Size(13, 29),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 29));
	  imageicon = image;
  var imagemo = new google.maps.MarkerImage('images/platformflag_w.png',
      new google.maps.Size(13, 29),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 29));	
	  imageiconmo = imagemo;  
  var shadow = new google.maps.MarkerImage('images/platformflag_shadow.png',
      new google.maps.Size(26, 15),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 15));
  var shape = {
      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
      type: 'poly'
  };
  for (var i = 0; i < locations.length; i++) {
   	var linkid = "link"+(gmarkers.length);
	var linknum = gmarkers.length;
	var office = locations[i];
    var myLatLng = new google.maps.LatLng(office[1], office[2]);
    	marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        shadow: shadow,
        icon: image,
        shape: shape,
        title: office[0],
        zIndex: office[3]		
    });
	var infowindow = new google.maps.InfoWindow(
      { content: office[4],
	  	pixelOffset: new google.maps.Size(0,33),
        size: new google.maps.Size(50,50)
      });
	  
	google.maps.event.addListener(marker, 'click', (function(marker,infowindow,linkid,linknum) {return function() {
		if(curr_infw) {curr_infw.close();} 
		curr_infw = infowindow;	
		map.setCenter(marker.position);
		map.setZoom(zlevel);
		infowindow.open(map,marker);
		curr_marker = linknum;
		document.getElementById('over_map').style.visibility = 'visible';
		if (lastlinkid) {document.getElementById(lastlinkid).style.fontWeight="normal";}
		document.getElementById(linkid).style.fontWeight="bold";
        lastlinkid=linkid;
		zbarselect(zlevel);
		lastzmid='zm'+zlevel;
			}
		})(marker,infowindow,linkid,linknum));
    gmarkers.push(marker);
	side_bar_html += '<div class="barline" id="'+linkid+'"><a href="javascript:myclick(' + i + ',5)" onmouseover="gmarkers['+i+'].setIcon(imageiconmo);gmarkers['+i+'].setZIndex(20);" onmouseout="gmarkers['+i+'].setIcon(imageicon);gmarkers['+i+'].setZIndex(10);">' + office[0] + '<\/a><\/div>';
  }
 }

   function myclick(i, zlev) {
	zlevel=zlev;
	google.maps.event.trigger (gmarkers[i], 'click');
}	

   function zoomdef(zlev) {
		map.setCenter(deflatlng);
		map.setZoom(zlev);
		zbarselect(zlev);
		lastzmid='zm'+zlev;
}

function mapini() {
	var myOptions = {
      zoom: 1,
      center: deflatlng,
	  scaleControl: false,
	  mapTypeControl: false,
	  navigationControl: true,
	  navigationControlOptions: google.maps.NavigationControlStyle.SMALL,
      mapTypeId: google.maps.MapTypeId.ROADMAP  
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	setMarkers(map, offices);
    document.getElementById("map_side_bar").innerHTML = side_bar_html;
}  
