
var Location = Class.create();

Location.prototype =
{
	initialize: function(_latitude, _longitude, _zoom, _text, _canvas)
	{
		document.getElementById(_canvas).innerHtml = "";
		
		// Set location
		
		this.setLatitude(_latitude);
		this.setLongitude(_longitude);
		this.setZoom(_zoom);
		this.setText(_text);
		
		// Set map canvas
		
		this.setCanvas(_canvas);
		
		// Create point
		
		var point = new google.maps.LatLng(this.getLatitude(), this.getLongitude());
		
		// Set map options
		
		var options = {zoom: this.getZoom(), center: point, mapTypeId: google.maps.MapTypeId.SATELLITE};
		
		// Create map
		
		var map = new google.maps.Map(document.getElementById(this.getCanvas()), options);
		
		// Create marker
		
		var marker = new google.maps.Marker({position: point, map: map, title: this.getText()});
		
		// Create info-window
		
		var text = this.getText();
		var info = new google.maps.InfoWindow({content: '<div id="infowin" class="infowindow-content">' + text + '</div>'});
		info.open(map, marker);
		
		google.maps.event.addListener(marker, 'click', function()
		{
			info.open(map, marker);
		});
	},
	
	
	setLatitude: function(latitude)
	{
		this.latitude = latitude;
	},
	
	
	getLatitude: function()
	{
		return this.latitude;
	},
	
	
	setLongitude: function(longitude)
	{
		this.longitude = longitude;
	},
	
	
	getLongitude: function()
	{
		return this.longitude;
	},
	
	
	setZoom: function(zoom)
	{
		this.zoom = zoom;
	},
	
	
	getZoom: function()
	{
		return this.zoom;
	},
	
	
	setText: function(text)
	{
		this.text = text;
	},
	
	
	getText: function()
	{
		return this.text;
	},
	
	
	setCanvas: function(canvas)
	{
		this.canvas = canvas;
	},
	
	
	getCanvas: function()
	{
		return this.canvas;
	}
};
