// Copyright 2006 Andreas Koch

function MarkerGroup(map)
{
	this.addMarker = function(ID, Marker)
	{
		this.markers.push(Marker);
		if(this.visible)
		{
			this.map.addOverlay(Marker);
		}
		this.occupied[ID]=true;
		return null;
	}
	
	this.addMarkerBuf = function(ID, Marker)
	{
		this.markers.push(Marker);
		this.markersBuff.push(Marker);
		this.occupied[ID]=true;
		return null;
	}
	
	this.flushMarkerBuf = function()
	{
		if(this.visible)
		{
			for(var i=0; i<this.markerBuf.length; i=i+1)
			{
				this.map.addOverlay(Marker);
			}
		}
	}
	 
	this.contains = function(ID)
	{
		var rv = false;
		if(this.occupied[ID])
		{
			rv = true;
		}
		return rv;
	}
	
	this.show = function()
	{
		for(var i=0; i<this.markers.length; i++)
		{
			this.map.addOverlay(this.markers[i]);
		}
		this.visible=true;
		return null;
	}
	
	this.hide = function()
	{
		for(var i=0; i<this.markers.length; i++)
		{
			this.map.removeOverlay(this.markers[i]);
		}
		this.visible=false;
		return null;
	}
	
	this.togleVisible = function()
	{
		if(this.visible)
		{
			this.hide();
		} else
		{
			this.show();
		}
	}
	
	this.clearAll = function()
	{
		this.markers = new Array();
		this.occupied = new Array();
	}
	
	this.markerBuf = new Array(); 
	this.map = map;
	this.visible = false;
	this.markers = new Array();
	this.occupied = new Array();
}