/* ==================================================
	Author:		Donna Latto
	Email:		dlatto@paciolan.com
	Created:	March 6, 2007
	Purpose:	Functions to create and print 
				color-coded price level legend.
	Version Notes:
				4/4/07 - Updated format so it's 
				based on event descriptions and 
				levels - so it's easier to figure 
				out by simply looking on the event 
				page rather than digging for 
				config/price level codes. 
================================================== */

	function addColor(event, level, color) {
		this.event = event;
		this.level = level;
		this.color = color;
	}

	var defaultColors = new Array();
	var colorList = new Array;
	var cli = 0;

//	colorList.push( new addColor("config", "levelDesc", "ff0000") );
	colorList[cli++] = new addColor("FB", "SECTIONS 1-3, 4 & 8 (Rows A-M), 9-11, & 24 (Rows A-M) - NO PRIORITY SEATING DONATION REQUIRED", "8ca28c");
	colorList[cli++] = new addColor("FB", "SECTIONS 5 - 7 (Rows 33-36) - Price includes PRIORITY SEATING DONATION", "c67129");
	colorList[cli++] = new addColor("FB", "SECTION 6 (Rows 1-32) & SECTIONS 4 & 8 (Rows 33-36) - Price includes PRIORITY SEATING DONATION", "9c0029");
	colorList[cli++] = new addColor("FB", "SECTIONS 5, 7, & 26 (Rows 1-32) - Price includes PRIORITY SEATING DONATION", "ceba31");
	colorList[cli++] = new addColor("FB", "SECTIONS 4, 8, & 25 (Rows 1-32) - Price includes PRIORITY SEATING DONATION", "0065a5");
	colorList[cli++] = new addColor("FB", "SECTIONS 5 - 7 (Rows A-M) - Price includes PRIORITY SEATING DONATION", "086939");
	colorList[cli++] = new addColor("FB", "SECTION 24 (Rows 1-32) & SECTION 25 (Rows A-M) - Price includes PRIORITY SEATING DONATION", "c67573");	

	colorList[cli++] = new addColor("FB", "SECTION 6 (Rows 1-32)-SECTIONS 4, 8 (Rows 33-36) - Price includes PRIORITY SEATING DONATION", "9c0021");	 
	colorList[cli++] = new addColor("FB", "SECTIONS 5, 7, 26 (Rows 1-32) - Price includes PRIORITY SEATING DONATION", "efd731");   
	colorList[cli++] = new addColor("FB", "SECTIONS 4, 8, 25 (Rows 1-32) - Price includes PRIORITY SEATING DONATION", "0071bd");
	colorList[cli++] = new addColor("FB", "SECTION 24 (Rows 1-32)-SECTION 25 (Rows A-M) - Price includes PRIORITY SEATING DONATION", "d6827b");
	colorList[cli++] = new addColor("FB", "SECTIONS 11-12, 21-23 SIDELINE RESERVED", "ffc794");
	colorList[cli++] = new addColor("FB", "SIDELINE RESERVED", "9cb69c");  
	colorList[cli++] = new addColor("FB", "EAST ENDZONE RESERVED", "949a9c");

	colorList[cli++] = new addColor("MB", "BASELINE & CORNER (SECTIONS 22-24 & 26) - Price Includes Priority Seating Donation", "0065a5");
	colorList[cli++] = new addColor("MB", "UPPER SIDELINE & CORNERS (SECTIONS 8-20)", "52a639");
	colorList[cli++] = new addColor("MB", "SIDELINE COURTSIDE (FLOOR SEATING) - Price Includes Priority Seating Donation", "d91918");
	colorList[cli++] = new addColor("MB", "BASELINE COURTSIDE (FLOOR SEATING) - Price Includes Priority Seating Donation", "6a1f80");	
	colorList[cli++] = new addColor("MB", "BASELINE & CORNER (SECTIONS 22, 23, 24, & 26)", "0065a5");

	colorList[cli++] = new addColor("MB", "BASELINE COURTSIDE (SECTIONS 5 & 23) -<b>OBSTRUCTED VIEW SEATS ONLY</b>", "d1861b");
	colorList[cli++] = new addColor("MB", "LOWER BOWL CORNER (SECTIONS 5, 23, & 36) -<b>OBSTRUCTED VIEW SEATS ONLY</b>", "0064a6");
	colorList[cli++] = new addColor("MB", "UPPER SIDELINE & CORNERS(SECTIONS 8-20)", "56a53d");
	colorList[cli++] = new addColor("MB", "UPPER BASELINE (SECTIONS 3-7 & 21-25)", "0c6235");

	function printColor(count, event, level) {
		if(level==-1) return '';
		
		var theColor = "";
		for(var b=0; b<colorList.length; b++) {
			if(
				event.toUpperCase()==colorList[b].event.toUpperCase() &&
				level.toUpperCase()==colorList[b].level.toUpperCase()
			) {
				theColor = colorList[b].color;
				break;
			}
		}
		if(theColor=="" && defaultColors.length>0) {
			theColor = defaultColors[count];
		}
		if(theColor=="") {
			return "";
		} else {
			return '<img src="'+imageWWWPath+'/spacer.gif" width="15" height="15" class="colorBox" style="background-color: #'+theColor+';">';
		}
	}

