/*
spcGMap.prototype.toggleLegend = function()
{
	this.legendvisible = !this.legendvisible;

	if (this.legendvisible)
	{
		if (this.panelLegend == undefined)
			this.createLegend();

		this.panelLegend.style.display = 'block';
	}
	else
		this.panelLegend.style.display = 'none';
}
*/
spcGMap.prototype.createLegend = function()
{
	var self = this;
		
	var panelLegend = document.createElement('div');
	panelLegend.className = "panelLegend";
	panelLegend.onmouseout = function() { self.pingType(0); };

	var   mapTypes = mapmeta.types
		, theType
		, panelHTML = '<table class="legendTable">';

//	for (i = 0; i < mapTypes.length; i++) {
	for(i in mapTypes)
	{
		theType = mapTypes[ i ];
		
		// onmouseover for normal web use
		// onmousedown for digital schoolboards
		if (theType.icon) panelHTML += '<tr onmouseover="mygmap.pingType('+i+');" onmousedown="mygmap.pingType('+i+');"><td class="legendSymbol"><img src="gfx/map_icons/' + theType.icon.filename + '" /></td><td style="width: 100%;">'+theType.name+'</td></tr>';
	}
	
	panelLegend.innerHTML = panelHTML + '</table>';

	return panelLegend;
}






