function initialize() {
  var myOptions = {
    zoom: 7,
    center: new google.maps.LatLng(56.2, 11.4),
    mapTypeId: google.maps.MapTypeId.TERRAIN,
    mapTypeControlOptions: {
      style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
    },
    navigationControlOptions: {
      style: google.maps.NavigationControlStyle.SMALL
    }    
  };

var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
 
  var imageFVI = new google.maps.MarkerImage('img/findveji16.png',
      new google.maps.Size(16,16),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the middle
      new google.maps.Point(8,8));
/*
  var imagePIS = new google.maps.MarkerImage('img/pis16.png',
      new google.maps.Size(16,16),
      new google.maps.Point(0,0),
      new google.maps.Point(8,8));
*/
  var imageOther = new google.maps.MarkerImage('img/andre8.png',
      new google.maps.Size(8,8),
      new google.maps.Point(0,0),
      new google.maps.Point(4,4));

  setMarkers(map, fvi, imageFVI, addRedirect);
  // setMarkers(map, pis, imagePIS, addRedirect);
  setMarkers(map, others, imageOther, addInfoWindow);
}
 
function setMarkers(map, locations, image, addFunction) {
  for (var i = 0; i < locations.length; i++) {
    var loc = locations[i];
    var myLatLng = new google.maps.LatLng(loc[1], loc[2]);
    var marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image,
        flat: true,
        clickable: true,
        title: loc[0]
    });
	  addFunction(map, marker, loc[0], loc[3]);
  }
}

function addRedirect(map, marker, title, content) {
  google.maps.event.addListener(marker, 'click', function() {
    window.location.assign("http://www.findveji.dk/index.php/findvej_projekt/detail/" + content + "/56.html");
  });
}

function addInfoWindow(map, marker, title, content) {
 	var infowindow = new google.maps.InfoWindow({
     	content: "<div class='infoWindow'><h1>" + title + "</h1><div class='infoContent'><p>" + content + "</p></div>"
 	});
  google.maps.event.addListener(marker, 'click', function() {
    infowindow.open(map,marker);
  });
}

