/* --------------------------------------------------
	Created:	March 6, 2007
	Purpose:	Functions to create and print logos. 
				Used primarily on:
				- displaySimpleEventList
				- displayGroupList 
-------------------------------------------------- */

	function makeLogo(name, logo) {
		this.oname = name;
		this.ologo = logo;
	}

	logoList = new Array;
	var i = 0;
	
//	logoList[i++] = new makeLogo("Florida Int&#39;l", "fiu");
	logoList[i++] = new makeLogo("WWE Raw Live!", "rawlive_us");
	logoList[i++] = new makeLogo("Reading Royals", "reading_royals");
	logoList[i++] = new makeLogo("Florida Everblades", "florida_everblades");
	logoList[i++] = new makeLogo("Long Beach Ice Dogs", "longbeach_icedogs");
	logoList[i++] = new makeLogo("Texas Wildcatters", "texas_wildcatters");
	logoList[i++] = new makeLogo("San Diego Gulls", "sandiego_gulls");
	logoList[i++] = new makeLogo("Dayton Bombers", "dayton_bombers");
	logoList[i++] = new makeLogo("Season Tickets", "stocktonthunder");
	logoList[i++] = new makeLogo("St. Louis Steamers", "steamers_primary");
	logoList[i++] = new makeLogo("Baltimore Blast", "BlastShards");
	logoList[i++] = new makeLogo("Chicago Storm", "chicago_storm");
	logoList[i++] = new makeLogo("Milwaukee Wave", "wave_0506");
	logoList[i++] = new makeLogo("Philadelphia KiXX", "PhiliKixxLogo");
	logoList[i++] = new makeLogo("Game of the Month", "stocktonthunder");
	logoList[i++] = new makeLogo("10 Pack", "stocktonthunder");
	logoList[i++] = new makeLogo("Saturday Night Special", "stocktonthunder");
	logoList[i++] = new makeLogo("An Evening With Neil Diamond - Grand Opening Gala", "neildiamond");
	logoList[i++] = new makeLogo("An Evening With Neil Diamond", "neildiamond");
	logoList[i++] = new makeLogo("8 Pack", "stocktonthunder");
	logoList[i++] = new makeLogo("The Bob Dylan Show", "bob-dylan_000");
	logoList[i++] = new makeLogo("newsboys with everybodyduck", "graphic-wducks1");
	logoList[i++] = new makeLogo("The Wiggles-Live!", "wiggles");
	logoList[i++] = new makeLogo("The Wiggles-Live! 6:30PM", "wiggles");
	logoList[i++] = new makeLogo("Sesame Street Live &quot;Super Grover! Ready for Action&quot; FRI - 7PM", "supergrover1");
	logoList[i++] = new makeLogo("Sesame Street Live &quot;Super Grover! Ready for Action&quot; SAT - 10:30AM", "supergrover1");
	logoList[i++] = new makeLogo("Sesame Street Live &quot;Super Grover! Ready for Action&quot; SAT - 2PM", "supergrover1");
	logoList[i++] = new makeLogo("Sesame Street Live &quot;Super Grover! Ready for Action&quot; SUN - 1PM", "supergrover1");
	logoList[i++] = new makeLogo("Sesame Street Live &quot;Super Grover! Ready for Action&quot; SUN - 4:30PM", "supergrover1");
	logoList[i++] = new makeLogo("Champions on Ice", "championsonice");
	logoList[i++] = new makeLogo("The &quot;World Famous&quot; Lipizzaner Stallions", "stallion");
	logoList[i++] = new makeLogo("The Cheetah Girls with Special Guest Miley Cyrus as Hannah Montana", "cheetahgirls");
	logoList[i++] = new makeLogo("Champions on Ice", "champs_on_ice");
	logoList[i++] = new makeLogo("Soccer Family 4 Pack", "cougars_primary");
	logoList[i++] = new makeLogo("Soccer 3 Game Mini Plan", "cougars_primary");
	logoList[i++] = new makeLogo("February Mini Plan", "cougars_primary");
	logoList[i++] = new makeLogo("March Mini Plan", "cougars_primary");
	logoList[i++] = new makeLogo("January Mini-Plan", "cougars_primary");
	logoList[i++] = new makeLogo("Carlos Mencia &quot;Live&quot;", "carlos_mencia");
	logoList[i++] = new makeLogo("Vicente Fernandez", "vincente_logo");
	logoList[i++] = new makeLogo("The Warrior&#39;s Cup presents &quot;The Takeover&quot;", "warriors_cup");
	logoList[i++] = new makeLogo("KAT Country presents PBR Enterprise Rent-A-Car Tour", "pbr_logo");	
	logoList[i++] = new makeLogo("Disney&#39;s High School Musical: The Ice Tour", "hsm_logo");
	logoList[i++] = new makeLogo("Summer Splash 2007 starring Chris Brown", "chris_brown");
	logoList[i++] = new makeLogo("Josh Groban", "josh_groban");
	logoList[i++] = new makeLogo("Josh Groban- Buy Tickets", "josh_groban");
	logoList[i++] = new makeLogo("Gwen Stefani- Buy Tickets", "gwen_stefani");
	logoList[i++] = new makeLogo("Ozzy Osbourne Platinum VIP Package", "ozzy");
	logoList[i++] = new makeLogo("Ozzy Osbourne Gold VIP Package", "ozzy");
	logoList[i++] = new makeLogo("Ozzy Osbourne & Rob Zombie-Order Tickets", "ozzy");
	logoList[i++] = new makeLogo("Ozzy Osbourne Silver VIP Package", "ozzy");
	logoList[i++] = new makeLogo("Larry the Cable Guy-Order Tickets", "larry");
	logoList[i++] = new makeLogo("Disney&#39;s High School Musical: The Ice Tour- Buy Tickets", "high");
	logoList[i++] = new makeLogo("WWE Smackdown/ECW Live-Order Tickets", "wwe");
	logoList[i++] = new makeLogo("Heath vs. Haynes - Mixed Martial Arts", "heath");
	logoList[i++] = new makeLogo("Jingle Ball 2007-Order Tickets", "jingle_ball");
	logoList[i++] = new makeLogo("Disney On Ice Princess Wishes", "princess_wishes");
	logoList[i++] = new makeLogo("Disney On Ice  Princess Wishes", "princess_wishes");
	logoList[i++] = new makeLogo("The &quot;World Famous&quot; LIPIZZANER STALLIONS - Sunday, June 22nd, 2008 2:00 PM", "wfls-logo-web");
	logoList[i++] = new makeLogo("The &quot;World Famous&quot; LIPIZZANER STALLIONS - Sunday, June 22nd, 2008 6:00 PM", "wfls-logo-web");
	logoList[i++] = new makeLogo("Boise Burn 4/12/08", "burn");
	logoList[i++] = new makeLogo("Central Valley Coyotes 4/19/08", "coyotes");
	logoList[i++] = new makeLogo("Amarillo Dusters 5/17/08", "duster");
	logoList[i++] = new makeLogo("Tri-Cities Fever 5/24/08", "fever");
	logoList[i++] = new makeLogo("Central Valley Coyotes 6/14/08", "coyotes");
	logoList[i++] = new makeLogo("Boise Burn 6/21/08", "burn");
	logoList[i++] = new makeLogo("Spokane Shock 7/12/08", "shock");
	logoList[i++] = new makeLogo("Tri-Cities Fever 7/19/08", "fever");
	logoList[i++] = new makeLogo("GARY V 25TH ANNIVERSARY - FRIDAY, JUNE 13TH, 8:00 PM", "garyv_25thanniversary");	
	logoList[i++] = new makeLogo("WWE RAW - SUMMER SLAM TOUR - SUNDAY, JUNE 8, 2008 - 5PM", "wwe_raw");
	logoList[i++] = new makeLogo("CINDERELLA / WARRANT - WEDNESDAY JULY 2, 2008 - 8:00 PM", "cinderella");	
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS THE BIRDS - FRIDAY, JUNE 13, 2008 - 7:00 PM","birds");
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS PILLOW TALK - FRIDAY, JULY 11, 2008 - 7:00 PM", "pillowtalk");
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS ANNIE GET YOUR GUN - FRIDAY, AUGUST 8, 2008 - 7:00 PM", "annie");
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS BORN YESTERDAY - FRIDAY, SEPTEMBER 12, 2008 - 7:00 PM", "born");
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS ABBOTT AND COSTELLO MEET FRANKENSTEIN - FRIDAY, OCTOBER 24, 2008 - 7:00 PM", "franken");
	logoList[i++] = new makeLogo("FOF CLASSIC CINEMA PRESENTS BLACK STALLION - SUNDAY, NOVEMBER 23, 2008 - 2:00 PM", "Stallion");
	logoList[i++] = new makeLogo("ICARUS JONES COLLECTIVE CD RELEASE PARTY - JUNE 13, 2008 - 9:00 PM", "2009vibe");
	logoList[i++] = new makeLogo("SUPER DANCE PARTY LATIN - FRI 08/01/08 - DOORS 6:00 PM / DANCE 7:00 PM", "civicfront");
	logoList[i++] = new makeLogo("HERE COMES THE FUNK!! - FRI 8/15/08 - 7:00 PM / DOORS 6:00 PM", "civicfront");
	logoList[i++] = new makeLogo("Joan Sebastian SUN 6/14/09 - 6:00 PM", "Joan_Sebastian");	
	logoList[i++] = new makeLogo("Corona Comedy Night @ Stockton Arena - FRI 6/19/09 - 9:00 PM", "corona_comedy");

	logoList[i++] = new makeLogo("Amarillo Dusters 5/17/08", "duster");
	logoList[i++] = new makeLogo("Amarillo Dusters 5/17/08", "luche_libre");


	extraList = new Array;
	var i = 0;
	
	extraList[i++] = "";
	extraList[i++] = "The ";
	extraList[i++] = "at ";
	extraList[i++] = "@ ";
	extraList[i++] = "<center>";
	extraList[i++] = "<center>at ";
	extraList[i++] = "vs ";
	extraList[i++] = "vs. ";
	extraList[i++] = "<a>";
	extraList[i++] = "</a>";
	extraList[i++] = " FAMILY 4 PACK";
	
	// NEW (accomodates more than one logo)
	function printLogo(name, group) {
		var logo = new Array();
		name = name.toUpperCase();
		
		while(name.indexOf("  ")>-1) {
			name = name.replace(/  /g, " ");
		}

		for(var i=0; i < logoList.length; i++) {
			var listName = logoList[i].oname.toUpperCase();
			listName = listName.replace(/'/,"&#39;"); // fix apostrophes
			for(var j=0; j < extraList.length; j++) {
				var listExtra = extraList[j].toUpperCase();
				if(
					(listName + listExtra == name || listExtra + listName == name) && 
					!(logo.length>0 && logo[logo.length-1]==logoList[i].ologo)
				) {
					logo.push(logoList[i].ologo);
				}
			}
		}

		if(logo.length==0) {
		// custom code
			var str = name
			if (str.match("KITCHENER")) {
				logo[0] = "kitchenerrangers_crest";
			} else if (str.match("GLOBETROTTERS")) {
				logo[0] = "globetrotters";
			} else if (str.match("HOCKEY PLAYOFF")) {
				logo[0] = "kellycup";
			} else if (str.match("HIGH SCHOOL MUSICAL")) {
				logo[0] = "highschool_musical";
			} else if (str.match("ROUND")) {
				logo[0] = "kellycup";
			} else if (str.match("MARCO ANTONIO SOLIS")) {
				logo[0] = "marco_antonio_solis";
			} else if (str.match("MARTIAL ARTS")) {
				logo[0] = "satnfights";
			} else if (str.match("ELITEXC")) {
				logo[0] = "satnfights";
			} else if (str.match("RINGLING")) {
				logo[0] = "ringling_bros";
			} else if(name.indexOf("2007 U18") > -1) {
				logo[0] = "hockey_u18";
			} else if(name.indexOf("COLD CRAWL") > -1) {
				logo[0] = "cold_crawl";
			} else if(name.indexOf("VICENTE FERNANDEZ") > -1) {
				logo[0] = "fernandez";
			} else if (str.match("CENTRAL VALLEY COYOTES")) {
				logo[0] = "centralvalley_coyotes";
			} else if(name.indexOf("TRI-CITIES FEVER") > -1) {
				logo[0] = "tricities_fever";
			} else if(name.indexOf("BOISE BURN") > -1) {
				logo[0] = "boise_burn";
			} else if(name.indexOf("SPOKANE SHOCK") > -1) {
				logo[0] = "spokane_shock";
			} else if(name.indexOf("RIO GRANDE VALLEY DORADOS") > -1) {
				logo[0] = "rio_grande";
			} else if(name.indexOf("PEORIA PIRATES") > -1) {
				logo[0] = "peoria_pirates";
			} else if(name.indexOf("SESAME STREET") > -1) {
				logo[0] = "sesame_street";
			} else if(name.indexOf("SAN JOAQUIN") > -1) {
				logo[0] = "san_joaquin";
			} else if(name.indexOf("ALL AMERICAN") > -1) {
				logo[0] = "allamerican_crawl";
			} else if(name.indexOf("PRO BULL RIDING") > -1) {
				logo[0] = "pro_bull_riding";
			} else if(name.indexOf("LUCHE LIBRE") > -1) {
				logo[0] = "luche_libre";
			} else if(name.indexOf("CORONA COMEDY") > -1) {
				logo[0] = "corona_comedy";

			} else if(name.indexOf("ONTARIO REIGN") > -1) {
				logo[0] = "ontario_reign";
			} else if(name.indexOf("STEELHEADS") > -1) {
				logo[0] = "idaho_steelheads";
			} else if(name.indexOf("CONDORS") > -1) {
				logo[0] = "bakersfield_condors";
			} else if(name.indexOf("GRIZZLIES") > -1) {
				logo[0] = "utah_grizzlies";
			} else if(name.indexOf("SALMON") > -1) {
				logo[0] = "victoria_salmon_kings";
			} else if(name.indexOf("WRANGLERS") > -1) {
				logo[0] = "lasvegas_wranglers";
			} else if(name.indexOf("ROADRUNNERS") > -1) {
				logo[0] = "phoenix_roadrunners";
			} else if(name.indexOf("FRESNO FALCONS") > -1) {
				logo[0] = "fresno_falcons";
			} else if(name.indexOf("ALASKA ACES") > -1) {
				logo[0] = "alaska_aces";

			} else if(name.indexOf("STOCKTOBER") > -1) {
				logo[0] = "stocktoberfest";

			} else if(name.indexOf("PACIFIC VS CAL") > -1) {
				logo[0] = "pacificlogo";

			} else if(name.indexOf("COSTUME") > -1) {
				logo[0] = "costume_crawl";


			} else if(name.indexOf("LOS INQUIETOS DEL NORTE") > -1) {
				logo[0] = "losinquietos_delnorte";
			}
		// end custom code
		}	

		if(logo.length==0) {
			if(typeof(fullGroupList)!="undefined" && group!="") {
				while(logo.length==0 && group!="") {
					switch(group) {
						case "F": // football
							logo.push("football"); break;
						case "BB": // baseball
							logo.push("baseball"); break;
						case "RODEO": // baseball
							logo.push("rodeo"); break;
						case "SB": // softball
							logo.push("softball"); break;
						case "MB": case "WB": // basketball
							logo.push("basketball"); break;
						case "VB": case "MVB": case "WVB": // volleyball
							logo.push("volleyball"); break;
						case "H": // hockey
							logo.push("hockey"); break;
						case "SOC": case "MS": case "WS": // soccer
							logo.push("soccer"); break;
						case "CCS": // stockton_cougars
							logo.push("stockton_cougars"); break;
					}
					var parent = "";
					for(var i=0; i<fullGroupList.length; i++) {
						if(fullGroupList[i].code==group) {
							parent = fullGroupList[i].parent;
						}
					}
					group = parent;
				}
				if(logo.length==0) logo.push("na"); // default
			} else {
				switch(group) {
					case "F": case "FBS": case "FBI": // football
						logo.push("football"); break;
					case "BB": // baseball
						logo.push("baseball"); break;
					case "SB": // softball
						logo.push("softball"); break;
					case "MB": case "MBS": case "MBI":  // basketball
						logo.push("basketball"); break;
					case "WB": case "WBS": case "WBI":  // basketball
						logo.push("basketball"); break;
					case "VB": case "MVB": case "WVB": // volleyball
						logo.push("volleyball"); break;
					case "H": // hockey
						logo.push("hockey"); break;
					case "SOC": case "MS": case "WS": // soccer
						logo.push("soccer"); break;
					default: // not avail
						logo.push("na"); break;
				}
			}
		}
		var imgSrc = "";

		if(logo.length>0) {
			for(var k=0; k<logo.length; k++) {
				imgSrc += '<img src="'+imageWWWPath+'/logos/'+logo[k]+'.gif" border="0" width="60" height="60" alt="'+name+'">';
			}
		}
		return(imgSrc);
	}

	function toggleFullSize(thumb) {
		if(thumb.className=="thumbHide") {
			thumb.className = 'thumbShow';
		} else if(thumb.className=="thumbShow") {
			thumb.className = 'thumbHide';
		}
	}
	
	// print smaller logo for calendar
	function printCalLogo(name, group) {
		var imgSrc = printLogo(name, group);
		if(imgSrc!="") {
			imgSrc = imgSrc.replace(/width="60" height="60"/ig, 'width="40" height="40"');
			
			//remove full size code
			imgSrc = imgSrc.replace(/((<a href[^>]+>){1}|(<br>(<([^>]+)>)+ view large(<([^>]+)>)+ click to close(<([^>]+)>)+))/ig, "");
		}
		return(imgSrc);
	}