//Create the colored icons for the schools.
var icnMen = new GIcon();
var icnWomen = new GIcon();
var icnBoth = new GIcon();
var icnNone = new GIcon();
icnMen.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
icnMen.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icnMen.iconSize = new GSize(12, 20);
icnMen.shadowSize = new GSize(22, 20);
icnMen.iconAnchor = new GPoint(6, 20);
icnMen.infoWindowAnchor = new GPoint(5, 1);
icnWomen.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icnWomen.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icnWomen.iconSize = new GSize(12, 20);
icnWomen.shadowSize = new GSize(22, 20);
icnWomen.iconAnchor = new GPoint(6, 20);
icnWomen.infoWindowAnchor = new GPoint(5, 1);
icnBoth.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
icnBoth.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icnBoth.iconSize = new GSize(12, 20);
icnBoth.shadowSize = new GSize(22, 20);
icnBoth.iconAnchor = new GPoint(6, 20);
icnBoth.infoWindowAnchor = new GPoint(5, 1);
icnNone.image = "http://labs.google.com/ridefinder/images/mm_20_yellow.png";
icnNone.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icnNone.iconSize = new GSize(12, 20);
icnNone.shadowSize = new GSize(22, 20);
icnNone.iconAnchor = new GPoint(6, 20);
icnNone.infoWindowAnchor = new GPoint(5, 1);

//Create a marker of the right type given the point and the men/women info.
function createMarker(point, SchoolName, HasMenWomen, City, State) {
    var icon;

    switch(HasMenWomen)
    {
        case 0:
            icon = icnNone;
            break;
        case 2:
            icon = icnWomen;
            break;
        case 1:
            icon = icnMen;
			break
        case 3:
            icon = icnBoth;
            break;
    }

    //Create the overlay.
    var infoTabs = [
        new GInfoWindowTab("Club", "<div width='300' height='108'>" + SchoolName + "</div>"),
        new GInfoWindowTab("Weather", "<a  target='blank' href='http://www.wunderground.com/US/" + State + "/" + City + ".html?bannertypeclick=infobox'><img src='http://banners.wunderground.com/weathersticker/infobox_both/language/www/US/" + State + "/" + City + ".gif' border='0' alt='Click for forecast.' height='108'></a>")
    ];

    //Show overlay when clicked.
    var marker = new GMarker(point, icon);
    GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowTabsHtml(infoTabs);
    });

    return marker;
}

function setupMap() {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());
    map.addControl(new GOverviewMapControl());
    map.setCenter(new GLatLng(38.1346, -95.8887), 4);
    map.enableDoubleClickZoom();
    map.enableContinuousZoom();

    return map;
}

