﻿function RiverDetailMap(lat, lng)
{
    this.CenterPoint = new google.maps.LatLng(lat, lng);
    this.InitialZoomLevel = 10;
    this.map = new google.maps.Map2(document.getElementById("rivermap"));
    this.map.setCenter(this.CenterPoint, this.InitialZoomLevel);
    this.map.setMapType(G_PHYSICAL_MAP);
    
    var mapType = new GMapTypeControl();
    this.map.addMapType(G_PHYSICAL_MAP);
	this.map.addControl(new GLargeMapControl());
	this.map.addControl(mapType);
    var self = this;
    var icon = new GIcon();
        icon.image = '/whitewater/assets/images/section-marker.png';
        icon.shadow = '/whitewater/assets/images/section-marker-shadow.png';
        icon.iconSide = new GSize(20, 34);
        icon.iconAnchor = new GPoint(10.0, 17.0);
        icon.infoWindowAnchor = new GPoint(10.0, 17.0);	
    var centerMarker = new GMarker(this.CenterPoint, icon);    
    this.map.addOverlay(centerMarker);
}

$.extend(RiverDetailMap.prototype, {
    AddPOI: function(lat, lng, type, html)
    {
        var newPOI = new RunPOI();
        newPOI.latlng = new LatLng(lat, lng);
        newPOI.icon = new GIcon();
        newPOI.icon.image = '/whitewater/assets/images/section-marker.png';
        newPOI.icon.shadow = '/whitewater/assets/images/section-marker-shadow.png';
        newPOI.icon.iconSide = new GSize(20, 34);
        newPOI.icon.iconAnchor = new GPoint(10.0, 17.0);
        newPOI.icon.infoWindowAnchor = new GPoint(10.0, 17.0);	
        newPOI.marker = new GMarker(newPOI.latlng, newPOI.icon);
        newPOI.html = html;
        newPOI.type = type;
        this.map.addOverlay(newPOI.marker); 
        GEvent.bind(newPOI.marker, 'click', newPOI, this.POIClick);
    },
    POIClick: function()
    {
        this.marker.openInfoWindowHtml('<div class="runinfo">' +
            this.html + '</div>');   
    }
});

function RunPOI()
{
    
}