var GoogleMap = new Class({

	Extends: Options,
	options: {
		points: [],
		zoom: 15
	},

	initialize: function(cont, options) {
		this.setOptions(options);
		
		// create map
		this.setBounds();
		var center = this.bounds ? this.bounds.getCenter() : new google.maps.LatLng(this.options.points[0].lat, this.options.points[0].lon);
		this.map = new google.maps.Map($(cont), {
			zoom: this.options.zoom,
			center: center,
			mapTypeId: google.maps.MapTypeId.ROADMAP,
			mapTypeControl: false
		});
		if (this.bounds)
			this.map.fitBounds(this.bounds);
		
		// add points
		this.options.points.each(function(point) {
			new google.maps.Marker({
				position: new google.maps.LatLng(point.lat, point.lon),
				map: this.map
			});
		}, this);
	},
	
	setBounds: function() {
		if (this.options.points.length <= 1) return;
		
		this.bounds = new google.maps.LatLngBounds();
		this.options.points.each(function(point, key) {
			this.bounds.extend(new google.maps.LatLng(point.lat, point.lon));
		}, this);
	}
	
})
