function initialize(amount,zoomlevel) {

  var center = new google.maps.LatLng(56.15909,10.205312);

  var myOptions = {
    zoom: zoomlevel,
    center: center,
	navigationControl: true,
	mapTypeControl: false,
	streetViewControl: false,
	mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  for (var i=1;i<=amount;i++){ addLatLng(map,i) } //skal laves sådan her ellers virker info window ikke

}

function addLatLng(map,eventid) { 

  var location = document.getElementById('event'+eventid).getAttribute("location");
  var myPosition = new google.maps.LatLng(location.split(",")[0],location.split(",")[1]);
  var category = document.getElementById('event'+eventid).getAttribute("category");
  var contentString = document.getElementById('event'+eventid).innerHTML;
  
	var pattern = /(\-?\d{1,3}\.\d+)([, ]+)([\+\-]*\d{1,3}\.\d+)\b/;
	var isValidLatLng = pattern.test(myPosition);	

	if(isValidLatLng){
		 
		var marker = new google.maps.Marker({
		  position: myPosition,
		  map: map,
		  icon: 'ajrgfx/gfx/'+category+'_marker.png'
		});
			 
		var infowindow = new google.maps.InfoWindow({
		    content: contentString,
		    maxWidth: 300
		});
			 
		google.maps.event.addListener(marker, 'click', function() {
		  infowindow.open(map,marker);
		});
		
	}
 
}

