function initializeFrontendMap(){
  //bind selection field
  if ($$('select.map-callout-trigger')[0]){
    selectionCallout = new SelectionCallout($$('select.map-callout-trigger')[0],'ajax-callout');
  }
  initializeMap();
}
  
function initializeMap(){
  
  //initialize listing array
  var i=0
  $("map_markers").select("ul li").each(function(s){
      listings[i] = {
        'id':s.id, 
        'latitude':s.readAttribute("latitude"), 
        'longitude': s.readAttribute("longitude"), 
        'address': s.readAttribute("address"), 
        'phone': s.readAttribute("phone"), 
        'type': s.readAttribute("type"),
        'thumb': s.readAttribute("thumb"),
        'url': s.readAttribute("url"),
        'name': s.readAttribute("name") }
      i++
  });
  
  //reset all check boxes
  cbPicks = document.getElementsByName('picks')
  for(i = 0; i < cbPicks.length; i++){
    cbPicks[i].checked = true;
  }

  toggleAllSelectBoxes();
  
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_div"));
    map.setCenter(new GLatLng(0,0), 1);
    var bounds = new GLatLngBounds();
    
    //add the markers of the nearby venues to the map but hide them
    for(i=0; i < listings.length; i++) {
      point = new GLatLng(listings[i].latitude,listings[i].longitude);
      markers[listings[i].id] = new GMarker(point, {icon : whichIcon(listings[i].type), title : listings[i].name});
      markers[listings[i].id].bindInfoWindow("<img src='" + listing[i].thumb + "' /><strong>" + listings[i].name + "</strong><br />" + listings[i].address + "<br />" + listings[i].phone + "<br /><a href='" + listings[i].url + "'>More ></a>");
      bounds.extend(point);
      map.addOverlay(markers[listings[i].id],listings[i].name);
      
    }
    map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
  }
}