/**
 * author KMM Timing
 * version 3.1
 * date 2010-08-08
 */
var map = null; // The Google map object
var chart = null;
var elevationService = null;
var hmCoordinates = []; // Halvmaraton
var hmPath = null; // Halvmaraton
var mlCoordinates = []; // Millopp
var mlPath = null; // Millopp
var klCoordinates = []; // Kortlopp
var klPath = null; // Kortlopp
var allMarkers = []; // Stores all markers in an array
var mousemarker = null;
var elevations = null;
var SAMPLES = 200;

// Show an overlay and check the corresponding checkbox
function show(category){
	eval(category + "Path").setMap(map);
    //document.getElementById(category + "CheckBox").checked = true;
    
    var markers = [];
    for (var i = 0; i < allMarkers.length; i++) {
        if (allMarkers[i].category == category) {
            allMarkers[i].setMap(map);
        }
    }
    
    updateElevation(category);
    
    var center = null;
    var zoom = null;
    
    switch(category)
    {
    case 'ml':
    	center = new google.maps.LatLng(56.657494, 12.814386);
    	zoom = 13;
    	break;
    case 'kl':
    	center = new google.maps.LatLng(56.662749, 12.827740);
        zoom = 14;
        break;
    default:
    	center = new google.maps.LatLng(56.65758, 12.79535);
    	zoom = 12;
    }
    
    map.panTo(center);
    map.setZoom(zoom);
}

// Hide an overlay and uncheck the corresponding checkbox
function hide(category){
	eval(category + "Path").setMap(null);
    //document.getElementById(category + "CheckBox").checked = false;
    
    for (var i = 0; i < allMarkers.length; i++) {
        if (allMarkers[i].category == category) {
        	allMarkers[i].setMap(null);
        }
    }
    
}

// Toggle an overlay
function boxclick(box, category){
	hide('hm');
	hide('ml');
	hide('kl');
	
    show(category);
}

// Create the icon for a marker
function getIcon(iconId, category){
	var image = null;
	var size = null;
	var origin = null;
	var anchor = null;
	var scaledSize = null;
	
    if (category == "ovr") {
        //image = "/PM/assets/images/icons/maps/" + category + iconId + ".png";
        image = "/maps/markers/" + category + iconId + ".png";
        anchor = new google.maps.Point(4, 29);
    }
    else if (category == "vatska") {
        //image = "/PM/assets/images/icons/maps/vatska.png";
    	image = "/maps/markers/vatska.png";
    }
    else {
        //image = "/PM/assets/images/icons/maps/" + category + iconId + ".png";
    	image = "/maps/markers/" + category + iconId + ".png";
        //size = new google.maps.Size(27, 27);
	    //origin = new google.maps.Point(0,0);
	    //anchor = new google.maps.Point(9, 17);
        //scaledSize = new google.maps.Size(17, 17);
    }
    var icon = new google.maps.MarkerImage(image, size, origin, anchor, scaledSize);
    
    return icon;
}

//Create the shadow for a marker
function getShadow(category){
	var image = null;
	var size = null;
	var origin = null;
	var anchor = null;
	
    if (category == "ovr") {
    	//image = "/PM/assets/images/icons/maps/shadowf.png";
    	image = "/maps/markers/shadowf.png";
    	size = new google.maps.Size(44, 33);
	    origin = new google.maps.Point(0,0);
	    anchor = new google.maps.Point(7, 30);
    }
    else {
    	//image = "/PM/assets/images/icons/maps/shadow.png";
    	image = "/maps/markers/shadow.png";
    	size = new google.maps.Size(29, 26);
	    origin = new google.maps.Point(0,0);
	    anchor = new google.maps.Point(10, 25);
    }
    var shadow = new google.maps.MarkerImage(image, size, origin, anchor);
    
    return shadow;
}

// Create a marker
function createMarker(name, point, category, iconId){
    var marker = new google.maps.Marker({
        position: point,
        title: name,
        icon: getIcon(iconId, category),
        shadow: getShadow(category)
    });
    
    marker.category = category;
    
    return marker;
}

// Takes an array of ElevationResult objects, draws the path on the map
// and plots the elevation profile on a GViz ColumnChart
function plotElevation(results) {
  elevations = results;
  
  var data = new google.visualization.DataTable();
  data.addColumn('string', 'Sample');
  data.addColumn('number', 'Höjd');
  for (var i = 0; i < results.length; i++) {
    data.addRow(['', {v: elevations[i].elevation, f: Math.round(elevations[i].elevation)+''}]);
  }

  document.getElementById('chart_div').style.display = 'block';
  chart.draw(data, {
    width: 500,
    height: 200,
    colors: ['a300a3'],
    legend: 'none',
    vAxis: {title: 'Höjd över havet (m)', maxValue: 40, minValue: 0}
  });
}

// Trigger the elevation query for point to point
// or submit a directions request for the path between points
function updateElevation(category) {
	var path = eval(category + "Coordinates");
	
      elevationService.getElevationAlongPath({
        path: path,
        samples: SAMPLES
      }, plotElevation);
}

function initialize() {
    var center = new google.maps.LatLng(56.65758, 12.79535);
    var options = {
      zoom: 12,
      center: center,
      mapTypeId: google.maps.MapTypeId.TERRAIN
    };

    map = new google.maps.Map(document.getElementById("map_canvas"), options);
    chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
    elevationService = new google.maps.ElevationService();
    
    hmCoordinates = [new google.maps.LatLng(56.667010, 12.83328),
        new google.maps.LatLng(56.66669, 12.831930),
        new google.maps.LatLng(56.66597, 12.830140),
        new google.maps.LatLng(56.665130, 12.82886),
        new google.maps.LatLng(56.6648900, 12.828650),
        new google.maps.LatLng(56.66461, 12.82825),
        new google.maps.LatLng(56.664460, 12.827760),
        new google.maps.LatLng(56.664370, 12.826960),
        new google.maps.LatLng(56.6642400, 12.826260),
        new google.maps.LatLng(56.663880, 12.82488),
        new google.maps.LatLng(56.66259, 12.819540),
        new google.maps.LatLng(56.66192, 12.81797),
        new google.maps.LatLng(56.661500, 12.816450),
        new google.maps.LatLng(56.6606600, 12.81441),
        new google.maps.LatLng(56.6595, 12.811200),
        new google.maps.LatLng(56.6585100, 12.81183),
        new google.maps.LatLng(56.658390, 12.811700),
        new google.maps.LatLng(56.6583100, 12.81145),
        new google.maps.LatLng(56.658120, 12.811010),
        new google.maps.LatLng(56.657920, 12.810730),
        new google.maps.LatLng(56.65762, 12.80991),
        new google.maps.LatLng(56.6573700, 12.809520),
        new google.maps.LatLng(56.6570100, 12.808720),
        new google.maps.LatLng(56.65635, 12.808320),
        new google.maps.LatLng(56.656020, 12.80835),
        new google.maps.LatLng(56.65509, 12.809000),
        new google.maps.LatLng(56.6546, 12.80911),
        new google.maps.LatLng(56.6539700, 12.809220),
        new google.maps.LatLng(56.653650, 12.809370),
        new google.maps.LatLng(56.65328, 12.809510),
        new google.maps.LatLng(56.65256, 12.810200),
        new google.maps.LatLng(56.65227, 12.8106),
        new google.maps.LatLng(56.6513500, 12.81085),
        new google.maps.LatLng(56.651230, 12.810640),
        new google.maps.LatLng(56.651120, 12.8101),
        new google.maps.LatLng(56.65133, 12.809270),
        new google.maps.LatLng(56.651520, 12.809000),
        new google.maps.LatLng(56.65169, 12.808660),
        new google.maps.LatLng(56.6517500, 12.806610),
        new google.maps.LatLng(56.65169, 12.80569),
        new google.maps.LatLng(56.65158, 12.804850),
        new google.maps.LatLng(56.6513500, 12.80372),
        new google.maps.LatLng(56.6514, 12.8032),
        new google.maps.LatLng(56.651320, 12.802320),
        new google.maps.LatLng(56.651450, 12.801120),
        new google.maps.LatLng(56.6515700, 12.800960),
        new google.maps.LatLng(56.651590, 12.800410),
        new google.maps.LatLng(56.65149, 12.80005),
        new google.maps.LatLng(56.651410, 12.798420),
        new google.maps.LatLng(56.6512600, 12.79812),
        new google.maps.LatLng(56.651160, 12.79747),
        new google.maps.LatLng(56.65095, 12.79676),
        new google.maps.LatLng(56.6508100, 12.79643),
        new google.maps.LatLng(56.650740, 12.796220),
        new google.maps.LatLng(56.65059, 12.796050),
        new google.maps.LatLng(56.650180, 12.794740),
        new google.maps.LatLng(56.650240, 12.79428),
        new google.maps.LatLng(56.650110, 12.793930),
        new google.maps.LatLng(56.650020, 12.79282),
        new google.maps.LatLng(56.649820, 12.792140),
        new google.maps.LatLng(56.649570, 12.791480),
        new google.maps.LatLng(56.649190, 12.790560),
        new google.maps.LatLng(56.648810, 12.789980),
        new google.maps.LatLng(56.648390, 12.78972),
        new google.maps.LatLng(56.6479700, 12.789420),
        new google.maps.LatLng(56.6476300, 12.789330),
        new google.maps.LatLng(56.646950, 12.789270),
        new google.maps.LatLng(56.6465800, 12.789290),
        new google.maps.LatLng(56.64652, 12.78963),
        new google.maps.LatLng(56.64621, 12.790000),
        new google.maps.LatLng(56.645720, 12.790080),
        new google.maps.LatLng(56.645500, 12.790420),
        new google.maps.LatLng(56.645250, 12.79085),
        new google.maps.LatLng(56.64509, 12.79137),
        new google.maps.LatLng(56.64462, 12.792140),
        new google.maps.LatLng(56.64435, 12.792280),
        new google.maps.LatLng(56.64381, 12.79245),
        new google.maps.LatLng(56.6434700, 12.7926),
        new google.maps.LatLng(56.6432900, 12.7925),
        new google.maps.LatLng(56.643190, 12.792040),
        new google.maps.LatLng(56.64316, 12.79147),
        new google.maps.LatLng(56.6432200, 12.79091),
        new google.maps.LatLng(56.643260, 12.78982),
        new google.maps.LatLng(56.64325, 12.787440),
        new google.maps.LatLng(56.643080, 12.786850),
        new google.maps.LatLng(56.64269, 12.786620),
        new google.maps.LatLng(56.6422400, 12.78649),
        new google.maps.LatLng(56.64211, 12.7863),
        new google.maps.LatLng(56.641870, 12.78555),
        new google.maps.LatLng(56.64184, 12.78536),
        new google.maps.LatLng(56.641890, 12.784870),
        new google.maps.LatLng(56.64186, 12.784440),
        new google.maps.LatLng(56.64193, 12.784040),
        new google.maps.LatLng(56.641830, 12.783510),
        new google.maps.LatLng(56.64173, 12.783080),
        new google.maps.LatLng(56.64175, 12.78287),
        new google.maps.LatLng(56.64148, 12.782560),
        new google.maps.LatLng(56.64135, 12.782210),
        new google.maps.LatLng(56.641400, 12.78194),
        new google.maps.LatLng(56.64135, 12.78156),
        new google.maps.LatLng(56.641420, 12.781110),
        new google.maps.LatLng(56.6414300, 12.78081),
        new google.maps.LatLng(56.64175, 12.779420),
        new google.maps.LatLng(56.64186, 12.779150),
        new google.maps.LatLng(56.64193, 12.778780),
        new google.maps.LatLng(56.64218, 12.77837),
        new google.maps.LatLng(56.64242, 12.778110),
        new google.maps.LatLng(56.64406, 12.779520),
        new google.maps.LatLng(56.64490, 12.780120),
        new google.maps.LatLng(56.64652, 12.780850),
        new google.maps.LatLng(56.64672, 12.78082),
        new google.maps.LatLng(56.646750, 12.78029),
        new google.maps.LatLng(56.646750, 12.778900),
        new google.maps.LatLng(56.646820, 12.777000),
        new google.maps.LatLng(56.6469600, 12.77701),
        new google.maps.LatLng(56.64757, 12.77738),
        new google.maps.LatLng(56.648500, 12.778),
        new google.maps.LatLng(56.64961, 12.778910),
        new google.maps.LatLng(56.649860, 12.778860),
        new google.maps.LatLng(56.65021, 12.779100),
        new google.maps.LatLng(56.6506300, 12.77875),
        new google.maps.LatLng(56.651180, 12.778170),
        new google.maps.LatLng(56.65312, 12.776190),
        new google.maps.LatLng(56.65415, 12.775170),
        new google.maps.LatLng(56.6544600, 12.774980),
        new google.maps.LatLng(56.6549300, 12.77495),
        new google.maps.LatLng(56.65505, 12.77364),
        new google.maps.LatLng(56.655120, 12.7725),
        new google.maps.LatLng(56.65523, 12.77064),
        new google.maps.LatLng(56.655260, 12.76941),
        new google.maps.LatLng(56.65563, 12.76646),
        new google.maps.LatLng(56.65597, 12.763160),
        new google.maps.LatLng(56.6563600, 12.76008),
        new google.maps.LatLng(56.656470, 12.758980),
        new google.maps.LatLng(56.6565, 12.757840),
        new google.maps.LatLng(56.6564300, 12.757050),
        new google.maps.LatLng(56.6558700, 12.75528),
        new google.maps.LatLng(56.655640, 12.754900),
        new google.maps.LatLng(56.65507, 12.754000),
        new google.maps.LatLng(56.654360, 12.752970),
        new google.maps.LatLng(56.653580, 12.751790),
        new google.maps.LatLng(56.6516400, 12.749200),
        new google.maps.LatLng(56.650890, 12.7481),
        new google.maps.LatLng(56.64905, 12.745500),
        new google.maps.LatLng(56.64809, 12.744060),
        new google.maps.LatLng(56.647710, 12.743310),
        new google.maps.LatLng(56.64737, 12.74225),
        new google.maps.LatLng(56.64688, 12.74089),
        new google.maps.LatLng(56.64612, 12.7384),
        new google.maps.LatLng(56.6458400, 12.73759),
        new google.maps.LatLng(56.645520, 12.73689),
        new google.maps.LatLng(56.6450600, 12.736320),
        new google.maps.LatLng(56.6446100, 12.735840),
        new google.maps.LatLng(56.64361, 12.733350),
        new google.maps.LatLng(56.643440, 12.732700),
        new google.maps.LatLng(56.643510, 12.73202),
        new google.maps.LatLng(56.643600, 12.73188),
        new google.maps.LatLng(56.6434700, 12.73173),
        new google.maps.LatLng(56.64312, 12.731510),
        new google.maps.LatLng(56.64289, 12.731440),
        new google.maps.LatLng(56.6426, 12.731980),
        new google.maps.LatLng(56.642450, 12.732410),
        new google.maps.LatLng(56.6424600, 12.733070),
        new google.maps.LatLng(56.642500, 12.73362),
        new google.maps.LatLng(56.642500, 12.73412),
        new google.maps.LatLng(56.64278, 12.734520),
        new google.maps.LatLng(56.642810, 12.735170),
        new google.maps.LatLng(56.64269, 12.73595),
        new google.maps.LatLng(56.642880, 12.736720),
        new google.maps.LatLng(56.64276, 12.737060),
        new google.maps.LatLng(56.64265, 12.737150),
        new google.maps.LatLng(56.6423700, 12.736960),
        new google.maps.LatLng(56.642250, 12.73698),
        new google.maps.LatLng(56.642120, 12.737300),
        new google.maps.LatLng(56.642, 12.737300),
        new google.maps.LatLng(56.64175, 12.73745),
        new google.maps.LatLng(56.6416100, 12.73765),
        new google.maps.LatLng(56.64166, 12.73826),
        new google.maps.LatLng(56.641600, 12.7391),
        new google.maps.LatLng(56.64164, 12.73928),
        new google.maps.LatLng(56.641580, 12.73947),
        new google.maps.LatLng(56.641690, 12.739780),
        new google.maps.LatLng(56.642140, 12.74009),
        new google.maps.LatLng(56.642590, 12.74036),
        new google.maps.LatLng(56.6427300, 12.74065),
        new google.maps.LatLng(56.6430200, 12.74089),
        new google.maps.LatLng(56.643240, 12.74135),
        new google.maps.LatLng(56.64354, 12.74164),
        new google.maps.LatLng(56.643930, 12.74205),
        new google.maps.LatLng(56.64406, 12.742370),
        new google.maps.LatLng(56.6441600, 12.74305),
        new google.maps.LatLng(56.644180, 12.74365),
        new google.maps.LatLng(56.644310, 12.74394),
        new google.maps.LatLng(56.644560, 12.744150),
        new google.maps.LatLng(56.64484, 12.744510),
        new google.maps.LatLng(56.645050, 12.744510),
        new google.maps.LatLng(56.64522, 12.744570),
        new google.maps.LatLng(56.6454600, 12.744790),
        new google.maps.LatLng(56.64576, 12.745140),
        new google.maps.LatLng(56.646040, 12.74558),
        new google.maps.LatLng(56.64627, 12.746070),
        new google.maps.LatLng(56.646440, 12.746640),
        new google.maps.LatLng(56.64652, 12.74708),
        new google.maps.LatLng(56.646510, 12.74755),
        new google.maps.LatLng(56.64640, 12.748050),
        new google.maps.LatLng(56.6463800, 12.7489),
        new google.maps.LatLng(56.646390, 12.750430),
        new google.maps.LatLng(56.646550, 12.751030),
        new google.maps.LatLng(56.646620, 12.75191),
        new google.maps.LatLng(56.646570, 12.753190),
        new google.maps.LatLng(56.646750, 12.754340),
        new google.maps.LatLng(56.646950, 12.754940),
        new google.maps.LatLng(56.647180, 12.755300),
        new google.maps.LatLng(56.647450, 12.755630),
        new google.maps.LatLng(56.647580, 12.75595),
        new google.maps.LatLng(56.647580, 12.758080),
        new google.maps.LatLng(56.647760, 12.75886),
        new google.maps.LatLng(56.64810, 12.75998),
        new google.maps.LatLng(56.6480600, 12.760240),
        new google.maps.LatLng(56.6479700, 12.7605),
        new google.maps.LatLng(56.64795, 12.760720),
        new google.maps.LatLng(56.64784, 12.760990),
        new google.maps.LatLng(56.64775, 12.761080),
        new google.maps.LatLng(56.6471400, 12.762810),
        new google.maps.LatLng(56.64699, 12.76303),
        new google.maps.LatLng(56.646980, 12.76317),
        new google.maps.LatLng(56.6468500, 12.76327),
        new google.maps.LatLng(56.646620, 12.763610),
        new google.maps.LatLng(56.64660, 12.763910),
        new google.maps.LatLng(56.64641, 12.764380),
        new google.maps.LatLng(56.64632, 12.76454),
        new google.maps.LatLng(56.6461100, 12.764690),
        new google.maps.LatLng(56.64596, 12.764890),
        new google.maps.LatLng(56.6459100, 12.76557),
        new google.maps.LatLng(56.64596, 12.76632),
        new google.maps.LatLng(56.64594, 12.766810),
        new google.maps.LatLng(56.6458400, 12.767000),
        new google.maps.LatLng(56.645570, 12.767690),
        new google.maps.LatLng(56.64524, 12.7688),
        new google.maps.LatLng(56.64450, 12.770800),
        new google.maps.LatLng(56.64419, 12.771500),
        new google.maps.LatLng(56.64392, 12.77222),
        new google.maps.LatLng(56.6435, 12.772900),
        new google.maps.LatLng(56.6430900, 12.773480),
        new google.maps.LatLng(56.64265, 12.77392),
        new google.maps.LatLng(56.64233, 12.77447),
        new google.maps.LatLng(56.6419700, 12.77518),
        new google.maps.LatLng(56.64148, 12.776040),
        new google.maps.LatLng(56.64133, 12.776570),
        new google.maps.LatLng(56.64144, 12.77716),
        new google.maps.LatLng(56.6416100, 12.77758),
        new google.maps.LatLng(56.641890, 12.777790),
        new google.maps.LatLng(56.6421700, 12.7779),
        new google.maps.LatLng(56.64227, 12.778080),
        new google.maps.LatLng(56.642250, 12.778260),
        new google.maps.LatLng(56.64193, 12.778780),
        new google.maps.LatLng(56.64186, 12.779150),
        new google.maps.LatLng(56.64175, 12.779420),
        new google.maps.LatLng(56.6414300, 12.78081),
        new google.maps.LatLng(56.641420, 12.781120),
        new google.maps.LatLng(56.64135, 12.78156),
        new google.maps.LatLng(56.641400, 12.78194),
        new google.maps.LatLng(56.64135, 12.782210),
        new google.maps.LatLng(56.64148, 12.782560),
        new google.maps.LatLng(56.64175, 12.78287),
        new google.maps.LatLng(56.64173, 12.783080),
        new google.maps.LatLng(56.641830, 12.783510),
        new google.maps.LatLng(56.64193, 12.784040),
        new google.maps.LatLng(56.64186, 12.784440),
        new google.maps.LatLng(56.641890, 12.784870),
        new google.maps.LatLng(56.64184, 12.785350),
        new google.maps.LatLng(56.641870, 12.78555),
        new google.maps.LatLng(56.64211, 12.7863),
        new google.maps.LatLng(56.6422400, 12.78649),
        new google.maps.LatLng(56.64269, 12.786620),
        new google.maps.LatLng(56.643080, 12.786850),
        new google.maps.LatLng(56.64325, 12.787440),
        new google.maps.LatLng(56.643260, 12.78982),
        new google.maps.LatLng(56.6432200, 12.79091),
        new google.maps.LatLng(56.64316, 12.79147),
        new google.maps.LatLng(56.643190, 12.792040),
        new google.maps.LatLng(56.6432900, 12.7925),
        new google.maps.LatLng(56.6434700, 12.7926),
        new google.maps.LatLng(56.64381, 12.79245),
        new google.maps.LatLng(56.64435, 12.792280),
        new google.maps.LatLng(56.64462, 12.792140),
        new google.maps.LatLng(56.64509, 12.79137),
        new google.maps.LatLng(56.645250, 12.790840),
        new google.maps.LatLng(56.645720, 12.790080),
        new google.maps.LatLng(56.64621, 12.790000),
        new google.maps.LatLng(56.64652, 12.78963),
        new google.maps.LatLng(56.6465800, 12.789290),
        new google.maps.LatLng(56.6469600, 12.789270),
        new google.maps.LatLng(56.647650, 12.789330),
        new google.maps.LatLng(56.6479700, 12.789420),
        new google.maps.LatLng(56.648390, 12.78972),
        new google.maps.LatLng(56.648810, 12.789980),
        new google.maps.LatLng(56.649190, 12.790560),
        new google.maps.LatLng(56.649820, 12.792140),
        new google.maps.LatLng(56.650020, 12.79282),
        new google.maps.LatLng(56.650110, 12.793930),
        new google.maps.LatLng(56.650240, 12.79428),
        new google.maps.LatLng(56.650180, 12.79475),
        new google.maps.LatLng(56.65059, 12.796050),
        new google.maps.LatLng(56.65073, 12.796220),
        new google.maps.LatLng(56.650940, 12.79676),
        new google.maps.LatLng(56.651160, 12.79747),
        new google.maps.LatLng(56.6512600, 12.79813),
        new google.maps.LatLng(56.651410, 12.798420),
        new google.maps.LatLng(56.65149, 12.80005),
        new google.maps.LatLng(56.651590, 12.800410),
        new google.maps.LatLng(56.6515700, 12.800960),
        new google.maps.LatLng(56.651450, 12.80113),
        new google.maps.LatLng(56.651320, 12.80231),
        new google.maps.LatLng(56.6514, 12.80319),
        new google.maps.LatLng(56.6513500, 12.80372),
        new google.maps.LatLng(56.65158, 12.804860),
        new google.maps.LatLng(56.65169, 12.80569),
        new google.maps.LatLng(56.6517500, 12.806610),
        new google.maps.LatLng(56.65169, 12.808660),
        new google.maps.LatLng(56.651520, 12.809000),
        new google.maps.LatLng(56.65133, 12.809270),
        new google.maps.LatLng(56.651120, 12.8101),
        new google.maps.LatLng(56.651230, 12.810640),
        new google.maps.LatLng(56.6513500, 12.81085),
        new google.maps.LatLng(56.65227, 12.8106),
        new google.maps.LatLng(56.65256, 12.810200),
        new google.maps.LatLng(56.65328, 12.809510),
        new google.maps.LatLng(56.653650, 12.809370),
        new google.maps.LatLng(56.6539700, 12.809220),
        new google.maps.LatLng(56.654590, 12.80911),
        new google.maps.LatLng(56.65507, 12.809000),
        new google.maps.LatLng(56.656020, 12.80835),
        new google.maps.LatLng(56.65635, 12.808320),
        new google.maps.LatLng(56.6570100, 12.808720),
        new google.maps.LatLng(56.6573700, 12.809520),
        new google.maps.LatLng(56.65762, 12.80991),
        new google.maps.LatLng(56.657920, 12.810730),
        new google.maps.LatLng(56.658120, 12.811010),
        new google.maps.LatLng(56.6583100, 12.81145),
        new google.maps.LatLng(56.658440, 12.811850),
        new google.maps.LatLng(56.658710, 12.812510),
        new google.maps.LatLng(56.6588900, 12.812890),
        new google.maps.LatLng(56.65908, 12.813030),
        new google.maps.LatLng(56.659310, 12.813550),
        new google.maps.LatLng(56.65948, 12.814070),
        new google.maps.LatLng(56.65970, 12.814420),
        new google.maps.LatLng(56.6599900, 12.815840),
        new google.maps.LatLng(56.660210, 12.81722),
        new google.maps.LatLng(56.66013, 12.817620),
        new google.maps.LatLng(56.660160, 12.818040),
        new google.maps.LatLng(56.66015, 12.818620),
        new google.maps.LatLng(56.66024, 12.819270),
        new google.maps.LatLng(56.66033, 12.819550),
        new google.maps.LatLng(56.660450, 12.819650),
        new google.maps.LatLng(56.6610200, 12.819890),
        new google.maps.LatLng(56.661440, 12.820240),
        new google.maps.LatLng(56.6618900, 12.82056),
        new google.maps.LatLng(56.662020, 12.820910),
        new google.maps.LatLng(56.662040, 12.82107),
        new google.maps.LatLng(56.66185, 12.82196),
        new google.maps.LatLng(56.66179, 12.82243),
        new google.maps.LatLng(56.66183, 12.823060),
        new google.maps.LatLng(56.661970, 12.8236),
        new google.maps.LatLng(56.6622300, 12.824010),
        new google.maps.LatLng(56.662440, 12.824040),
        new google.maps.LatLng(56.663090, 12.82502),
        new google.maps.LatLng(56.663320, 12.825500),
        new google.maps.LatLng(56.66378, 12.826690),
        new google.maps.LatLng(56.66414, 12.827250),
        new google.maps.LatLng(56.664280, 12.82755),
        new google.maps.LatLng(56.664410, 12.82807),
        new google.maps.LatLng(56.664590, 12.828410),
        new google.maps.LatLng(56.66479, 12.828660),
        new google.maps.LatLng(56.6647800, 12.82881),
        new google.maps.LatLng(56.664660, 12.828880),
        new google.maps.LatLng(56.66460, 12.829080),
        new google.maps.LatLng(56.664680, 12.82937),
        new google.maps.LatLng(56.664840, 12.8297),
        new google.maps.LatLng(56.6649600, 12.830290),
        new google.maps.LatLng(56.66503, 12.830720),
        new google.maps.LatLng(56.665130, 12.831150),
        new google.maps.LatLng(56.66528, 12.831460),
        new google.maps.LatLng(56.6653600, 12.83178),
        new google.maps.LatLng(56.665400, 12.83242),
        new google.maps.LatLng(56.6653600, 12.832980),
        new google.maps.LatLng(56.66481, 12.836500),
        new google.maps.LatLng(56.664730, 12.83778),
        new google.maps.LatLng(56.66456, 12.83924),
        new google.maps.LatLng(56.664390, 12.840300),
        new google.maps.LatLng(56.664300, 12.84106),
        new google.maps.LatLng(56.66382, 12.843230),
        new google.maps.LatLng(56.66378, 12.84374),
        new google.maps.LatLng(56.664030, 12.844280)];
    
	mlCoordinates = [new google.maps.LatLng(56.667010, 12.833280),
        new google.maps.LatLng(56.666690, 12.831930),
        new google.maps.LatLng(56.665970, 12.830140),
        new google.maps.LatLng(56.665130, 12.828860),
        new google.maps.LatLng(56.664890, 12.828650),
        new google.maps.LatLng(56.664610, 12.828250),
        new google.maps.LatLng(56.664460, 12.827760),
        new google.maps.LatLng(56.664370, 12.826960),
        new google.maps.LatLng(56.664240, 12.826260),
        new google.maps.LatLng(56.663880, 12.824880),
        new google.maps.LatLng(56.662590, 12.819540),
        new google.maps.LatLng(56.661920, 12.817970),
        new google.maps.LatLng(56.661500, 12.816450),
        new google.maps.LatLng(56.660660, 12.814410),
        new google.maps.LatLng(56.659500, 12.811200),
        new google.maps.LatLng(56.658510, 12.811830),
        new google.maps.LatLng(56.658390, 12.811700),
        new google.maps.LatLng(56.658310, 12.811450),
        new google.maps.LatLng(56.658120, 12.811010),
        new google.maps.LatLng(56.657920, 12.810730),
        new google.maps.LatLng(56.657620, 12.809910),
        new google.maps.LatLng(56.657370, 12.809520),
        new google.maps.LatLng(56.657010, 12.808720),
        new google.maps.LatLng(56.656350, 12.808320),
        new google.maps.LatLng(56.656020, 12.808350),
        new google.maps.LatLng(56.655090, 12.809000),
        new google.maps.LatLng(56.654600, 12.809110),
        new google.maps.LatLng(56.653970, 12.809220),
        new google.maps.LatLng(56.653650, 12.809370),
        new google.maps.LatLng(56.653280, 12.809510),
        new google.maps.LatLng(56.652560, 12.810200),
        new google.maps.LatLng(56.652270, 12.810600),
        new google.maps.LatLng(56.651350, 12.810850),
        new google.maps.LatLng(56.651230, 12.810640),
        new google.maps.LatLng(56.651120, 12.810100),
        new google.maps.LatLng(56.651330, 12.809270),
        new google.maps.LatLng(56.651520, 12.809000),
        new google.maps.LatLng(56.651690, 12.808660),
        new google.maps.LatLng(56.651750, 12.806610),
        new google.maps.LatLng(56.651690, 12.805690),
        new google.maps.LatLng(56.651580, 12.804850),
        new google.maps.LatLng(56.651350, 12.803720),
        new google.maps.LatLng(56.651400, 12.803200),
        new google.maps.LatLng(56.651320, 12.802320),
        new google.maps.LatLng(56.651450, 12.801120),
        new google.maps.LatLng(56.651570, 12.800960),
        new google.maps.LatLng(56.651590, 12.800410),
        new google.maps.LatLng(56.651490, 12.800050),
        new google.maps.LatLng(56.651410, 12.798420),
        new google.maps.LatLng(56.651260, 12.798120),
        new google.maps.LatLng(56.651160, 12.797470),
        new google.maps.LatLng(56.651290, 12.797380),
        new google.maps.LatLng(56.651480, 12.797280),
        new google.maps.LatLng(56.651630, 12.797040),
        new google.maps.LatLng(56.651780, 12.796880),
        new google.maps.LatLng(56.652030, 12.796733),
        new google.maps.LatLng(56.652228, 12.796648),
        new google.maps.LatLng(56.652720, 12.796331),
        new google.maps.LatLng(56.653101, 12.796084),
        new google.maps.LatLng(56.653422, 12.795880),
        new google.maps.LatLng(56.653891, 12.795564),
        new google.maps.LatLng(56.654384, 12.795247),
        new google.maps.LatLng(56.654422, 12.795205),
        new google.maps.LatLng(56.654437, 12.795129),
        new google.maps.LatLng(56.654440, 12.795038),
        new google.maps.LatLng(56.654398, 12.794947),
        new google.maps.LatLng(56.654106, 12.794368),
        new google.maps.LatLng(56.653965, 12.794057),
        new google.maps.LatLng(56.653779, 12.793547),
        new google.maps.LatLng(56.653614, 12.793053),
        new google.maps.LatLng(56.653070, 12.791600),
        new google.maps.LatLng(56.652770, 12.790470),
        new google.maps.LatLng(56.652570, 12.789540),
        new google.maps.LatLng(56.652340, 12.788850),
        new google.maps.LatLng(56.652220, 12.788380),
        new google.maps.LatLng(56.652060, 12.787900),
        new google.maps.LatLng(56.651970, 12.787520),
        new google.maps.LatLng(56.651600, 12.786360),
        new google.maps.LatLng(56.651410, 12.785670),
        new google.maps.LatLng(56.651220, 12.785060),
        new google.maps.LatLng(56.651080, 12.784630),
        new google.maps.LatLng(56.650990, 12.784490),
        new google.maps.LatLng(56.650750, 12.784670),
        new google.maps.LatLng(56.650430, 12.784810),
        new google.maps.LatLng(56.650150, 12.784960),
        new google.maps.LatLng(56.649960, 12.785160),
        new google.maps.LatLng(56.649810, 12.785400),
        new google.maps.LatLng(56.649650, 12.785710),
        new google.maps.LatLng(56.648940, 12.787340),
        new google.maps.LatLng(56.648760, 12.787670),
        new google.maps.LatLng(56.648620, 12.788060),
        new google.maps.LatLng(56.648490, 12.788360),
        new google.maps.LatLng(56.647970, 12.789420),
        new google.maps.LatLng(56.648390, 12.789720),
        new google.maps.LatLng(56.648810, 12.789980),
        new google.maps.LatLng(56.649190, 12.790560),
        new google.maps.LatLng(56.649820, 12.792140),
        new google.maps.LatLng(56.650020, 12.792820),
        new google.maps.LatLng(56.650110, 12.793930),
        new google.maps.LatLng(56.650240, 12.794280),
        new google.maps.LatLng(56.650180, 12.794750),
        new google.maps.LatLng(56.650590, 12.796050),
        new google.maps.LatLng(56.650730, 12.796220),
        new google.maps.LatLng(56.650940, 12.796760),
        new google.maps.LatLng(56.651160, 12.797470),
        new google.maps.LatLng(56.651260, 12.798130),
        new google.maps.LatLng(56.651410, 12.798420),
        new google.maps.LatLng(56.651490, 12.800050),
        new google.maps.LatLng(56.651590, 12.800410),
        new google.maps.LatLng(56.651570, 12.800960),
        new google.maps.LatLng(56.651450, 12.801130),
        new google.maps.LatLng(56.651320, 12.802310),
        new google.maps.LatLng(56.651400, 12.803190),
        new google.maps.LatLng(56.651350, 12.803720),
        new google.maps.LatLng(56.651580, 12.804860),
        new google.maps.LatLng(56.651690, 12.805690),
        new google.maps.LatLng(56.651750, 12.806610),
        new google.maps.LatLng(56.651690, 12.808660),
        new google.maps.LatLng(56.651520, 12.809000),
        new google.maps.LatLng(56.651330, 12.809270),
        new google.maps.LatLng(56.651120, 12.810100),
        new google.maps.LatLng(56.651230, 12.810640),
        new google.maps.LatLng(56.651350, 12.810850),
        new google.maps.LatLng(56.652270, 12.810600),
        new google.maps.LatLng(56.652560, 12.810200),
        new google.maps.LatLng(56.653280, 12.809510),
        new google.maps.LatLng(56.653650, 12.809370),
        new google.maps.LatLng(56.653970, 12.809220),
        new google.maps.LatLng(56.654590, 12.809110),
        new google.maps.LatLng(56.655070, 12.809000),
        new google.maps.LatLng(56.656020, 12.808350),
        new google.maps.LatLng(56.656350, 12.808320),
        new google.maps.LatLng(56.657010, 12.808720),
        new google.maps.LatLng(56.657370, 12.809520),
        new google.maps.LatLng(56.657620, 12.809910),
        new google.maps.LatLng(56.657920, 12.810740),
        new google.maps.LatLng(56.658120, 12.811010),
        new google.maps.LatLng(56.658310, 12.811450),
        new google.maps.LatLng(56.658440, 12.811850),
        new google.maps.LatLng(56.658710, 12.812510),
        new google.maps.LatLng(56.658890, 12.812890),
        new google.maps.LatLng(56.659080, 12.813030),
        new google.maps.LatLng(56.659310, 12.813550),
        new google.maps.LatLng(56.659480, 12.814070),
        new google.maps.LatLng(56.659700, 12.814420),
        new google.maps.LatLng(56.659990, 12.815840),
        new google.maps.LatLng(56.660210, 12.817220),
        new google.maps.LatLng(56.660130, 12.817620),
        new google.maps.LatLng(56.660160, 12.818040),
        new google.maps.LatLng(56.660150, 12.818620),
        new google.maps.LatLng(56.660240, 12.819270),
        new google.maps.LatLng(56.660330, 12.819550),
        new google.maps.LatLng(56.660450, 12.819650),
        new google.maps.LatLng(56.661020, 12.819890),
        new google.maps.LatLng(56.661440, 12.820240),
        new google.maps.LatLng(56.661890, 12.820560),
        new google.maps.LatLng(56.662020, 12.820910),
        new google.maps.LatLng(56.662040, 12.821070),
        new google.maps.LatLng(56.661850, 12.821960),
        new google.maps.LatLng(56.661790, 12.822430),
        new google.maps.LatLng(56.661830, 12.823060),
        new google.maps.LatLng(56.661970, 12.823600),
        new google.maps.LatLng(56.662230, 12.824010),
        new google.maps.LatLng(56.662440, 12.824040),
        new google.maps.LatLng(56.663090, 12.825020),
        new google.maps.LatLng(56.663320, 12.825500),
        new google.maps.LatLng(56.663780, 12.826690),
        new google.maps.LatLng(56.664140, 12.827250),
        new google.maps.LatLng(56.664280, 12.827550),
        new google.maps.LatLng(56.664410, 12.828070),
        new google.maps.LatLng(56.664590, 12.828410),
        new google.maps.LatLng(56.664790, 12.828660),
        new google.maps.LatLng(56.664780, 12.828810),
        new google.maps.LatLng(56.664660, 12.828880),
        new google.maps.LatLng(56.664600, 12.829080),
        new google.maps.LatLng(56.664680, 12.829370),
        new google.maps.LatLng(56.664840, 12.829700),
        new google.maps.LatLng(56.664960, 12.830290),
        new google.maps.LatLng(56.665030, 12.830720),
        new google.maps.LatLng(56.665130, 12.831150),
        new google.maps.LatLng(56.665280, 12.831460),
        new google.maps.LatLng(56.665360, 12.831780),
        new google.maps.LatLng(56.665400, 12.832420),
        new google.maps.LatLng(56.665360, 12.832980),
        new google.maps.LatLng(56.664810, 12.836500),
        new google.maps.LatLng(56.664730, 12.837780),
        new google.maps.LatLng(56.664560, 12.839240),
        new google.maps.LatLng(56.664390, 12.840300),
        new google.maps.LatLng(56.664300, 12.841060),
        new google.maps.LatLng(56.663820, 12.843230),
        new google.maps.LatLng(56.663780, 12.843740),
        new google.maps.LatLng(56.664030, 12.844280)];
    
	klCoordinates = [new google.maps.LatLng(56.667010, 12.83328),
		new google.maps.LatLng(56.66669, 12.831930),
		new google.maps.LatLng(56.66597, 12.830140),
		new google.maps.LatLng(56.665130, 12.82886),
		new google.maps.LatLng(56.6648900, 12.828650),
		new google.maps.LatLng(56.66461, 12.82825),
		new google.maps.LatLng(56.664460, 12.827760),
		new google.maps.LatLng(56.664370, 12.826960),
		new google.maps.LatLng(56.6642400, 12.826260),
		new google.maps.LatLng(56.663880, 12.82488),
		new google.maps.LatLng(56.66259, 12.819540),
		new google.maps.LatLng(56.66192, 12.81797),
		new google.maps.LatLng(56.661500, 12.816450),
		new google.maps.LatLng(56.6606600, 12.81441),
		new google.maps.LatLng(56.6595, 12.811200),
		new google.maps.LatLng(56.6585100, 12.81183),
		new google.maps.LatLng(56.658480, 12.811950),
		new google.maps.LatLng(56.658710, 12.812510),
		new google.maps.LatLng(56.6588900, 12.812890),
		new google.maps.LatLng(56.65908, 12.813030),
		new google.maps.LatLng(56.659310, 12.813550),
		new google.maps.LatLng(56.65948, 12.814070),
		new google.maps.LatLng(56.65970, 12.814420),
		new google.maps.LatLng(56.6599900, 12.815840),
		new google.maps.LatLng(56.660210, 12.81722),
		new google.maps.LatLng(56.66013, 12.817620),
		new google.maps.LatLng(56.660160, 12.818040),
		new google.maps.LatLng(56.66015, 12.818620),
		new google.maps.LatLng(56.66024, 12.819270),
		new google.maps.LatLng(56.66033, 12.819550),
		new google.maps.LatLng(56.6604600, 12.819650),
		new google.maps.LatLng(56.6610200, 12.819890),
		new google.maps.LatLng(56.661440, 12.820240),
		new google.maps.LatLng(56.6618900, 12.82056),
		new google.maps.LatLng(56.662020, 12.820910),
		new google.maps.LatLng(56.662040, 12.82107),
		new google.maps.LatLng(56.661840, 12.82196),
		new google.maps.LatLng(56.66179, 12.82243),
		new google.maps.LatLng(56.66183, 12.823060),
		new google.maps.LatLng(56.661970, 12.8236),
		new google.maps.LatLng(56.6622300, 12.824010),
		new google.maps.LatLng(56.662440, 12.824040),
		new google.maps.LatLng(56.663090, 12.82502),
		new google.maps.LatLng(56.663320, 12.825500),
		new google.maps.LatLng(56.66378, 12.826690),
		new google.maps.LatLng(56.66414, 12.827250),
		new google.maps.LatLng(56.664280, 12.82755),
		new google.maps.LatLng(56.664410, 12.82807),
		new google.maps.LatLng(56.664590, 12.828410),
		new google.maps.LatLng(56.66479, 12.828660),
		new google.maps.LatLng(56.6647800, 12.82881),
		new google.maps.LatLng(56.664660, 12.828880),
		new google.maps.LatLng(56.66460, 12.829080),
		new google.maps.LatLng(56.664680, 12.82937),
		new google.maps.LatLng(56.664840, 12.8297),
		new google.maps.LatLng(56.6649600, 12.830290),
		new google.maps.LatLng(56.66503, 12.830720),
		new google.maps.LatLng(56.665130, 12.831150),
		new google.maps.LatLng(56.66528, 12.831460),
		new google.maps.LatLng(56.6653600, 12.83178),
		new google.maps.LatLng(56.665400, 12.83242),
		new google.maps.LatLng(56.6653600, 12.832980),
		new google.maps.LatLng(56.66481, 12.836500),
		new google.maps.LatLng(56.664730, 12.83778),
		new google.maps.LatLng(56.66456, 12.83924),
		new google.maps.LatLng(56.664390, 12.840300),
		new google.maps.LatLng(56.664300, 12.84106),
		new google.maps.LatLng(56.66382, 12.843230),
		new google.maps.LatLng(56.66378, 12.84374),
		new google.maps.LatLng(56.664030, 12.844280)];
	
		hmPath = new google.maps.Polyline({
			path: hmCoordinates,
			strokeColor: "#FF0000",
			strokeOpacity: 0.7,
			strokeWeight: 5
		});
		
		mlPath = new google.maps.Polyline({
			path: mlCoordinates,
			strokeColor: "#0000FF",
			strokeOpacity: 0.7,
			strokeWeight: 5
		});
	
		klPath = new google.maps.Polyline({
			path: klCoordinates,
			strokeColor: "#00FF00",
			strokeOpacity: 0.7,
			strokeWeight: 5
		});

		var markers = new Array();
		markers[0] = { name: "Start", description: "Startpunkt", category: "ovr", iconId: "S", lng: 12.833280189845247, lat: 56.667010243053099 };
		markers[1] = { name: "Mål", description: "Målplatsen", category: "ovr", iconId: "M", lng: 12.844286559215741, lat: 56.664031534156123 };
		markers[2] = { name: "Vätska", description: "Vätska", category: "vatska", iconId: "V", lng: 12.811839580535889, lat: 56.65849390831874 };
		markers[3] = { name: "Vätska", description: "Vätska", category: "vatska", iconId: "V", lng: 12.778719663619995, lat: 56.64203804962251 };
		markers[4] = { name: "Vätska", description: "Vätska", category: "vatska", iconId: "V", lng: 12.748850584030151, lat: 56.651399305833614 };
		markers[5] = { name: "Vätska", description: "Vätska", category: "vatska", iconId: "V", lng: 12.797677516937256, lat: 56.65120762099384 };
		markers[6] = { name: "21km", description: "21km", category: "hm", iconId: "21", lng: 12.831182361849001, lat: 56.666390463335709 };
		markers[7] = { name: "20km", description: "20km", category: "hm", iconId: "20", lng: 12.817553448706033, lat: 56.661814903029388 };
		markers[8] = { name: "19km", description: "19km", category: "hm", iconId: "19", lng: 12.808634762081841, lat: 56.655625339653909 };
		markers[9] = { name: "18km", description: "18km", category: "hm", iconId: "18", lng: 12.8033134546694, lat: 56.651401272876868 };
		markers[10] = { name: "17km", description: "17km", category: "hm", iconId: "17", lng: 12.789584107788448, lat: 56.648205222409956 };
		markers[11] = { name: "16km", description: "16km", category: "hm", iconId: "16", lng: 12.786774046118614, lat: 56.642966080451174 };
		markers[12] = { name: "15km", description: "15km", category: "hm", iconId: "15", lng: 12.780197707948794, lat: 56.645082454374851 };
		markers[13] = { name: "14km", description: "14km", category: "hm", iconId: "14", lng: 12.777750797607249, lat: 56.651604601997114 };
		markers[14] = { name: "13km", description: "13km", category: "hm", iconId: "13", lng: 12.76551001210165, lat: 56.655730085875568 };
		markers[15] = { name: "12km", description: "12km", category: "hm", iconId: "12", lng: 12.751647947455318, lat: 56.653483719354767 };
		markers[16] = { name: "11km", description: "11km", category: "hm", iconId: "11", lng: 12.740829883168571, lat: 56.646868129128151 };
		markers[17] = { name: "10km", description: "10km", category: "hm", iconId: "10", lng: 12.73455069858503, lat: 56.642790955336508 };
		markers[18] = { name: "9km", description: "9km", category: "hm", iconId: "9", lng: 12.744733119839957, lat: 56.645401853933322 };
		markers[19] = { name: "8km", description: "8km", category: "hm", iconId: "8", lng: 12.759274371781158, lat: 56.647897499957743 };
		markers[20] = { name: "7km", description: "7km", category: "hm", iconId: "7", lng: 12.772559435522956, lat: 56.64372035026463 };
		markers[21] = { name: "6km", description: "6km", category: "hm", iconId: "6", lng: 12.785031459100233, lat: 56.641876003534044 };
		markers[22] = { name: "5km", description: "5km", category: "hm", iconId: "5", lng: 12.789326873618268, lat: 56.646575661942258 };
		markers[23] = { name: "4km", description: "4km", category: "hm", iconId: "4", lng: 12.80050428993215, lat: 56.651596571415602 };
		markers[24] = { name: "3km", description: "3km", category: "hm", iconId: "3", lng: 12.80920741876812, lat: 56.654042057262821 };
		markers[25] = { name: "2km", description: "2km", category: "hm", iconId: "2", lng: 12.817382151232863, lat: 56.660187569916779 };
		markers[26] = { name: "1km", description: "1km", category: "hm", iconId: "1", lng: 12.828927332173638, lat: 56.664649667501941 };
		markers[27] = { name: "9km", description: "9km", category: "ml", iconId: "9", lng: 12.820275157320003, lat: 56.662774599259194 };
		markers[28] = { name: "8km", description: "8km", category: "ml", iconId: "8", lng: 12.809199385150187, lat: 56.65722983921745 };
		markers[29] = { name: "7km", description: "7km", category: "ml", iconId: "7", lng: 12.806464152251518, lat: 56.651750487790103 };
		markers[30] = { name: "6km", description: "6km", category: "ml", iconId: "6", lng: 12.794368, lat: 56.654106 };
		markers[31] = { name: "5km", description: "5km", category: "ml", iconId: "5", lng: 12.78744468417279, lat: 56.648892898960838 };
		markers[32] = { name: "4km", description: "4km", category: "ml", iconId: "4", lng: 12.80050428993215, lat: 56.651596571415602 };
		markers[33] = { name: "3km", description: "3km", category: "ml", iconId: "3", lng: 12.80920741876812, lat: 56.654042057262821 };
		markers[34] = { name: "2km", description: "2km", category: "ml", iconId: "2", lng: 12.817382151232863, lat: 56.660187569916779 };
		markers[35] = { name: "1km", description: "1km", category: "ml", iconId: "1", lng: 12.828927332173638, lat: 56.664649667501941 };
		markers[36] = { name: "4km", description: "4km", category: "kl", iconId: "4", lng: 12.831182361849001, lat: 56.666390463335709 };
		markers[37] = { name: "3km", description: "3km", category: "kl", iconId: "3", lng: 12.817553448706033, lat: 56.661814903029388 };
		markers[38] = { name: "2km", description: "2km", category: "kl", iconId: "2", lng: 12.817382151232863, lat: 56.660187569916779 };
		markers[39] = { name: "1km", description: "1km", category: "kl", iconId: "1", lng: 12.828927332173638, lat: 56.664649667501941 };

		//markers.forEach(function(item) {
		for (var i = 0; i < markers.length; i++) {
			var marker = createMarker(markers[i].name,
					new google.maps.LatLng(markers[i].lat, markers[i].lng),
					markers[i].category,
					markers[i].iconId);
			allMarkers.push(marker);
		//});
		}
        
		/*jQuery.get('/PM/assets/js/markers.xml', function(xml){
		jQuery.get('/maps/markers3.xml', function(xml){
    		jQuery(xml).find("marker").each(function(){
      			var name = jQuery(this).find('name').text();
      			var category = jQuery(this).find('category').text();
                var iconId = jQuery(this).find('iconId').text();
      
      			// create a new LatLng point for the marker
      			var lat = jQuery(this).find('lat').text();
      			var lng = jQuery(this).find('lng').text();
      			var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));

      			// add the marker itself
      			var marker = createMarker(name, point, category, iconId)
      			allMarkers.push(marker);
    		});*/

    		for (var i = 0; i < allMarkers.length; i++) {
            	if (allMarkers[i].category == "vatska" || allMarkers[i].category == "ovr") {
            		allMarkers[i].setMap(map);
                }
            }
    		
            show("hm");
            hide("ml");
            hide("kl");
		//});
	    
	    google.visualization.events.addListener(chart, 'onmouseover', function(e) {
	      if (mousemarker == null) {
	        mousemarker = new google.maps.Marker({
	          position: elevations[e.row].location,
	          map: map,
	          //icon: "http://maps.google.com/mapfiles/ms/icons/green-dot.png"
	          //icon: "/PM/assets/images/icons/maps/km.png"
	          icon: "/maps/markers/km.png"
	        });
	      } else {
	        mousemarker.setPosition(elevations[e.row].location);
	      }
	    });
	    
	    google.visualization.events.addListener(chart, 'onmouseout', function(e) {
	    	// Remove the rollover marker when the mouse leaves the chart
	    	  if (mousemarker != null) {
	    	    mousemarker.setMap(null);
	    	    mousemarker = null;
	    	  }
		    });
}
