/**
 * @author Sampson Yee
 */
/****************************/
/****  Football Markers  ****/
/****************************/
var iconMarkers = new Array();

iconMarkers['red']    = new GIcon(G_DEFAULT_ICON, 'images/football_marker_red.png');
iconMarkers['orange'] = new GIcon(G_DEFAULT_ICON, 'images/football_marker_orange.png');
iconMarkers['yellow'] = new GIcon(G_DEFAULT_ICON, 'images/football_marker_yellow.png');
iconMarkers['green']  = new GIcon(G_DEFAULT_ICON, 'images/football_marker_green.png');
iconMarkers['blue']   = new GIcon(G_DEFAULT_ICON, 'images/football_marker_blue.png');
iconMarkers['purple'] = new GIcon(G_DEFAULT_ICON, 'images/football_marker_purple.png');
iconMarkers['brown']  = new GIcon(G_DEFAULT_ICON, 'images/football_marker_brown.png');

iconMarkers['red'].shadow    = 'images/football_marker_shadow.png';
iconMarkers['orange'].shadow = 'images/football_marker_shadow.png';
iconMarkers['yellow'].shadow = 'images/football_marker_shadow.png';
iconMarkers['green'].shadow  = 'images/football_marker_shadow.png';
iconMarkers['blue'].shadow   = 'images/football_marker_shadow.png';
iconMarkers['purple'].shadow = 'images/football_marker_shadow.png';
iconMarkers['brown'].shadow  = 'images/football_marker_shadow.png';

iconMarkers['red'].iconSize    = new GSize(22, 32);
iconMarkers['orange'].iconSize = new GSize(22, 32);
iconMarkers['yellow'].iconSize = new GSize(22, 32);
iconMarkers['green'].iconSize  = new GSize(22, 32);
iconMarkers['blue'].iconSize   = new GSize(22, 32);
iconMarkers['purple'].iconSize = new GSize(22, 32);
iconMarkers['brown'].iconSize  = new GSize(22, 32);

iconMarkers['red'].shadowSize    = new GSize(46, 28);
iconMarkers['orange'].shadowSize = new GSize(46, 28);
iconMarkers['yellow'].shadowSize = new GSize(46, 28);
iconMarkers['green'].shadowSize  = new GSize(46, 28);
iconMarkers['blue'].shadowSize   = new GSize(46, 28);
iconMarkers['purple'].shadowSize = new GSize(46, 28);
iconMarkers['brown'].shadowSize  = new GSize(46, 28);

iconMarkers['red'].iconAnchor    = new GPoint(11, 32);
iconMarkers['orange'].iconAnchor = new GPoint(11, 32);
iconMarkers['yellow'].iconAnchor = new GPoint(11, 32);
iconMarkers['green'].iconAnchor  = new GPoint(11, 32);
iconMarkers['blue'].iconAnchor   = new GPoint(11, 32);
iconMarkers['purple'].iconAnchor = new GPoint(11, 32);
iconMarkers['brown'].iconAnchor  = new GPoint(11, 32);

iconMarkers['red'].infoWindowAnchor    = new GPoint(11, 1);
iconMarkers['orange'].infoWindowAnchor = new GPoint(11, 1);
iconMarkers['yellow'].infoWindowAnchor = new GPoint(11, 1);
iconMarkers['green'].infoWindowAnchor  = new GPoint(11, 1);
iconMarkers['blue'].infoWindowAnchor   = new GPoint(11, 1);
iconMarkers['purple'].infoWindowAnchor = new GPoint(11, 1);
iconMarkers['brown'].infoWindowAnchor  = new GPoint(11, 1);

function getMarkerColor(strClassName) {
	switch(strClassName)
	{
		case 'AAAA':
			return 'red'
			break;
		case 'AAA':
			return 'blue'
			break;
		case 'AA':
			return 'green'
			break;
		case 'A':
			return 'yellow'
			break;
		case 'City':
			return 'orange'
			break;
		default:
			return 'yellow'
			break;
	}
}


/*
 * Begin Football Legend
 */
function FootballLegendControl() {
}

FootballLegendControl.prototype = new GControl();

FootballLegendControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  container.style.border = "1px solid #666666";
  container.style.padding = "3px";
  
  var divLegend = document.createElement("div");
  divLegend.style.backgroundColor = "white";
  divLegend.style.border = "1px solid #666666";
  divLegend.style.fontSize = "80%";
  divLegend.style.padding = "5px";
    
  container.appendChild(divLegend);
  divLegend.innerHTML = '<b>Legend:</b><hr style=\"width:100px;\"/>' +
                        '&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/football_marker_red.png" width="11" height="16" /> = AAAA <br/>' +
                        '&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/football_marker_blue.png" width="11" height="16" /> = AAA <br/>' +
                        '&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/football_marker_green.png" width="11" height="16" /> = AA <br/>' +
                        '&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/football_marker_yellow.png" width="11" height="16" /> = A <br/>' +
                        '&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/football_marker_orange.png" width="11" height="16" /> = City';
  
  map.getContainer().appendChild(container);
  return container;
}

FootballLegendControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 30));
}

/*
 * End Football Legend
 */