
var icon_green = new GIcon();
	icon_green.iconSize = new GSize(20, 17);
	icon_green.iconAnchor = new GPoint(10, 17);
	icon_green.infoWindowAnchor = new GPoint(13, 4);
	icon_green.infoShadowAnchor = new GPoint(18, 25);			
	icon_green.image = "/media/house_marker.png";
	icon_green = {icon: icon_green};

var icon_yellow = new GIcon();
	icon_yellow.iconSize = new GSize(20, 17);
	icon_yellow.iconAnchor = new GPoint(10, 17);
	icon_yellow.infoWindowAnchor = new GPoint(13, 4);
	icon_yellow.infoShadowAnchor = new GPoint(18, 25);			
	icon_yellow.image = "/media/house_marker_yellow.png";
	icon_yellow = {icon: icon_yellow};

var icon_business = new GIcon();
	icon_business.iconSize = new GSize(20, 17);
	icon_business.iconAnchor = new GPoint(10, 17);
	icon_business.infoWindowAnchor = new GPoint(13, 4);
	icon_business.infoShadowAnchor = new GPoint(18, 25);			
	icon_business.image = "/media/business_marker.png";
	icon_business = {icon: icon_business};

function put_marker(icon_code, lat, lon, verified, html) {
    switch(icon_code)
    {
        case 1:
            icon = icon_green;
            break;
        case 2:
            icon = icon_yellow;
            break;
        case 3:
            icon = icon_business;
            break;
        default:
            icon = icon_green;
    }
    var latlon = new GLatLng(lat, lon);
    var marker = new GMarker(latlon, icon);				
    map.addOverlay(marker);
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });
}

function display_all() {
    map.clearOverlays();
    $('#features li').removeClass('selected_feature');
    $('#feature_all').addClass('selected_feature');
    jQuery.each(
        places,
        function(i, place) {
            put_marker(place[0], place[1], place[2], place[3], place[4]);
        }
    );
}

function display_feature(feature_id, feature_name) {
    map.clearOverlays();
    $('#features li').removeClass('selected_feature');
    $('#feature' + feature_id).addClass('selected_feature');
    jQuery.each(
        features[feature_id],
        function (i, place_id) {
            var place = places[place_id];
            if (place) put_marker(place[0], place[1], place[2], place[3], place[4]);
        }
    );
}

$(function () {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        //map.setMapType(G_HYBRID_MAP);
        map.setMapType(G_NORMAL_MAP);
        latlon = new GLatLng(centre_lat, centre_lon);
        map.setCenter(latlon, 11);
        //map.enableScrollWheelZoom();
        map.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10)));
        map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,30)));
    }
    display_all();
});

