  var events = new Array();
    
            events[events.length] = {"StartTime":"20-08-2009 19:30:00","EndTime":"20-08-2009 21:30:00","Title":"Absalons Kirke","Longitude":12.550300000000,"Latitude":55.665400000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/17"};
			
			 events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Emdrup Kirke","Longitude":12.528300000000,"Latitude":55.721300000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/19"};
			 
			 events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Engholmkirken","Longitude":12.336500000000,"Latitude":55.862100000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/20"};
			 
			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"F&oslash;ns Kirke","Longitude":9.836240000000,"Latitude":55.4272100000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/21"};
			  
			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Husby Kirke","Longitude":9.866000000000,"Latitude":55.3707600000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/21"};
			  
			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Kristkirken","Longitude":12.545000000000,"Latitude":55.6676000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/18"};
			  
			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Udby Kirke","Longitude":9.851800000000,"Latitude":55.4371100000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/21"};
			  
			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"&Oslash;rslev Kirke","Longitude":9.913700000000,"Latitude":55.4052000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/21"};

			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"KFUM og KFUK i Danmark","Longitude":12.522500000000,"Latitude":55.6663000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/15"};

			  events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Samvirkende Menighedsplejer","Longitude":12.515200000000,"Latitude":55.6654000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/16"};

			events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Apostelkirken","Longitude":12.551000000000,"Latitude":55.6716000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/35"};

events[events.length] = {"StartTime":"20-08-2009 20:30:00","EndTime":"20-08-2009 20:30:00","Title":"Vor Frue Kirke","Longitude":10.204930000000,"Latitude":56.1582400000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/vorfruekirke"};
 
 events[events.length] = {"StartTime":"20-08-2009 19:30:00","EndTime":"20-08-2009 21:30:00","Title":"H&oslash;jdevangskirken","Longitude":12.605100000000,"Latitude":55.647700000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/50"};
  
events[events.length] = {"StartTime":"20-08-2009 19:30:00","EndTime":"20-08-2009 21:30:00","Title":"Sk&aelig;ring Kirke","Longitude":10.304500000000,"Latitude":56.234100000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/52"};

events[events.length] = {"StartTime":"20-08-2009 19:30:00","EndTime":"20-08-2009 21:30:00","Title":"Trinitatis Kirke","Longitude":12.576100000000,"Latitude":55.681600000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/51"};

events[events.length] = {"StartTime":"20-08-2009 19:30:00","EndTime":"20-08-2009 21:30:00","Title":"Sct. Andreas Kirke","Longitude":12.568600000000,"Latitude":55.686000000000,"Location":"Description of the Church","AttendeeCount":1,"EventDetailsLink":"http://kirkeweb.dk/53"};



     
    var appZoomLevel = 6;
  
  
  function GoogleMapApplication() {
        this.map = new GMap2(document.getElementById("GoogleMap"));
    }
        
    GoogleMapApplication.prototype.initialize = function() {
        this.map.addControl(new GLargeMapControl());
        this.map.setCenter(new GLatLng(56.30434864830831, 10.469970703125), appZoomLevel);
        
        Array.forEach(events, function(eventObj) {
            var marker = this.getMarker(eventObj);
            if(marker!=null)
                this.map.addOverlay(marker);
        }, this);
    }    
    
    GoogleMapApplication.prototype.getMarker = function(serializedEvent) {
        if(serializedEvent.Longitude==0 && serializedEvent.Latitude==0)
            return null;
            
        var point = new GLatLng(serializedEvent.Latitude, serializedEvent.Longitude);        
        var marker = new GMarker(point);
        
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(
                "<div class='map_title'>"+serializedEvent.Title+"</div>"+
                //"<div class='map_description'><strong>Description: </strong>"+serializedEvent.Location+"</div>"+
                (serializedEvent.EventDetailsLink.length!=0?"<div class='map_link'><a href='"+serializedEvent.EventDetailsLink+"'>Lęs mere</a></div>":"")
                );
        });
                
        return marker;
    }
            
    var app;
    function load() {
      if (GBrowserIsCompatible()) {      
        app = new GoogleMapApplication();
        app.initialize();
      }
    }


window.onload = load;
window.onunload = GUnload;
