
var icons = new Object();

var iconDefinitions = new Array(
    "sp_ball-playing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_canoeing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_climbing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_cycling", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_default", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_driving", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_fitness-training", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_geocaching", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_hiking", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_ice-skating", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_motorcycling", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_mountainbiking", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_nordic-walking", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_promenading", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_race-biking", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_resting", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_riding", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_rollerblading", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_rowing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_running", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_sailing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_sightseeing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_skating", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_skiing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_ski-touring", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_snowboarding", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_soaring", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_spinning", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_stretching", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_swimming", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_walking", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_weightlifting", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_windsurfing", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "rt_ball-playing", "rt_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "rt_canoeing", "rt_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "rt_climbing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_cycling", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_default", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_driving", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_default", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_fitness-training", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_hiking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_ice-skating", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_motorcycling", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_mountainbiking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_nordic-walking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_promenading", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_race-biking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_resting", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_riding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_rollerblading", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_rowing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_running", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_sailing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_sightseeing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_skating", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_skiing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_ski-touring", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_snowboarding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_soaring", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_spinning", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_stretching", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_swimming", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_walking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_weightlifting", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_windsurfing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "photo_small", "sp_shadow", 13, 13, 5, 5, 0, 13, 6, 4,
    "video", "sp_shadow", 16, 16, 5, 5, 0, 16, 8, 4,
    "audio", "sp_shadow", 19, 19, 5, 5, 0, 20, 9, 4,
    "athlete", "sp_shadow", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_none", "sp_shadow", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_low", "sp_shadow", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_medium", "sp_shadow", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_high", "sp_shadow", 24, 24, 22, 20, 0, 13, 6, 4,
    "signpost3", "sp_shadow", 18, 22, 22, 20, 0, 25, 6, 4
);


function createIcons()
{
    for( i = 0; i < iconDefinitions.length; i += 10 )
    {
        var icon = new GIcon();
        icon.image = "/images/icons/" + iconDefinitions[i] + ".png";
        icon.shadow = "/images/icons/" + iconDefinitions[i + 1] + ".png";
        icon.iconSize = new GSize(iconDefinitions[i + 2], iconDefinitions[i + 3]);
        icon.shadowSize = new GSize(iconDefinitions[i + 4], iconDefinitions[i + 5]);
        icon.iconAnchor = new GPoint(iconDefinitions[i + 6], iconDefinitions[i + 7]);
        icon.infoWindowAnchor = new GPoint(iconDefinitions[i + 8], iconDefinitions[i + 9]);
        icons[iconDefinitions[i]] = icon;
    }
}

function getSportIcon(sport)
{
    var icon = icons["sp_" + sport];
    if( icon == null ) icon = icons["sp_default"];
    return icon;
}

function getRouteIcon(sport)
{
    var icon = icons["rt_" + sport];
    if( icon == null ) icon = icons["rt_default"];
    return icon;
}

function getIcon(iconName)
{
    var icon = icons[iconName];
    return icon;
}

