
var icons = new Object();

var iconDefinitions = new Array(
    "pause", "sp_shadow", 20, 9, 22, 20, 0, 10, 10, 4,
    "lap", "sp_shadow", 16, 16, 22, 20, 10, 17, 8, 4,
    "photo", "sp_shadow", 14, 14, 22, 20, 0, 15, 7, 4,
    "start", "transparent", 14, 14, 22, 20, 7, 7, 7, 4,
    "middle", "transparent", 7, 7, 22, 20, 3, 3, 3, 2,
    "middle_selected", "transparent", 7, 7, 22, 20, 3, 3, 3, 2,
    "stop", "transparent", 14, 14, 22, 20, 7, 7, 7, 4,
    "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_cross-country-skiing", "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_drone-flying", "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_golfing", "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_sledding", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_snowboarding", "sp_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "sp_snowshoeing", "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", 32, 28, 22, 20, 12, 24, 12, 10,
    "rt_climbing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_cross-country-skiing", "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_drone-flying", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_fitness-training", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_geocaching", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_hiking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_golfing", "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_sledding", "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_sledding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_snowboarding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rt_snowshoeing", "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,
    "rtoa_ball-playing", "rtoa_shadow", 24, 30, 22, 20, 12, 24, 12, 10,
    "rtoa_canoeing", "rtoa_shadow", 32, 28, 22, 20, 12, 24, 12, 10,
    "rtoa_climbing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_cross-country-skiing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_cycling", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_default", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_driving", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_drone-flying", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_fitness-training", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_geocaching", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_golfing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_hiking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_ice-skating", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_motorcycling", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_mountainbiking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_nordic-walking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_promenading", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_race-biking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_resting", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_riding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_rollerblading", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_rowing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_running", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_sailing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_sightseeing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_skating", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_skiing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_ski-touring", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_sledding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_snowboarding", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_snowshoeing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_soaring", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_spinning", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_stretching", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_swimming", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_walking", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_weightlifting", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "rtoa_windsurfing", "sp_shadow", 32, 28,22, 20, 12, 24, 12, 10,
    "wp_GEN", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_STA", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_CHK", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_CRS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_TRN", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_HOS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_HUT", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_FOD", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_RST", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_DNG", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_NIC", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_SIG", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_PRK", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_CMP", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_PEK", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_GCH", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_ANI", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_PLA", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_HOT", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_CAS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_WAT", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_GAS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_MUS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_CHU", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_DRI", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_BIF", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_BUS", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_TRA", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_HAR", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_INF", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_TEL", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_SHO", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_PIC", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_TLE", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_TRI", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_RES", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_STO", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_AID", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_BRI", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_BRN", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "wp_PPL", "transparent", 22, 22, 22, 20, 7, 7, 7, 4,
    "photo_small", "transparent", 13, 13, 5, 5, 0, 13, 6, 4,
    "photo_route", "transparent", 18, 14, 5, 5, 0, 13, 6, 4,
    "video", "transparent", 16, 16, 5, 5, 0, 16, 8, 4,
    "audio", "transparent", 19, 19, 5, 5, 0, 20, 9, 4,
    "athlete", "transparent", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_none", "transparent", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_low", "transparent", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_medium", "transparent", 24, 24, 22, 20, 0, 13, 6, 4,
    "athlete_high", "transparent", 24, 24, 22, 20, 0, 13, 6, 4,
    "signpost3", "transparent", 18, 22, 22, 20, 0, 25, 6, 4,
    "gpsies-cow", "transparent", 24, 28, 22, 20, 0, 25, 6, 4,
    "webcam", "transparent", 24, 21, 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 getOutdooractiveRouteIcon(sport)
{
    var icon = icons["rtoa_" + sport];
    if( icon == null ) icon = icons["rt_default"];
    return icon;
}

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

