/* --------------------------------------------------
	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("Cal", "berkeley");
	logoList[i++] = new makeLogo("Oregon", "uoregon");
	logoList[i++] = new makeLogo("Oregon State", "oregonstate");
	logoList[i++] = new makeLogo("UCLA", "ucla");
	logoList[i++] = new makeLogo("USC", "usc");
	logoList[i++] = new makeLogo("Washington", "washington");

	logoList[i++] = new makeLogo("ProRodeo Austin and Josh Turner", "josh_turner");
	logoList[i++] = new makeLogo("ProRodeo Austin Xtreme Bull Riding and Kevin Fowler", "kevin_fowler");
	logoList[i++] = new makeLogo("ProRodeo Austin and The Wreckers", "the-wreckers");
	logoList[i++] = new makeLogo("ProRodeo Austin and Aly & Aj", "aly--aj");
	logoList[i++] = new makeLogo("ProRodeo Austin and Trace Adkins", "trace_adkins");
	logoList[i++] = new makeLogo("ProRodeo Austin and Blake Shelton", "blake_shelton");
	logoList[i++] = new makeLogo("ProRodeo Austin and Miranda Lambert", "miranda-lambert");
	logoList[i++] = new makeLogo("ProRodeo Austin and Foreigner", "foreigner");
	logoList[i++] = new makeLogo("ProRodeo Austin Bill Engvall", "bill_engvall");
	logoList[i++] = new makeLogo("ProRodeo Austin and Kenny Rogers", "kenny_rogers");
	logoList[i++] = new makeLogo("ProRodeo Austin Finals and Neal McCoy", "neal-mccoy");
	logoList[i++] = new makeLogo("ProRodeo Austin and Lonestar", "lonestar");
	logoList[i++] = new makeLogo("ProRodeo Austin and Taylor Hicks", "taylorhicks");
	logoList[i++] = new makeLogo("ProRodeo Austin and Diana Reyes", "diana_reyes");	
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Randy Rogers Band", "randyrogersband");	
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Rodney Atkins", "rodneyatkins_2_e");	
	logoList[i++] = new makeLogo("ProRodeo and Gretchen Wilson", "gretchen_wilson");	
	logoList[i++] = new makeLogo("ProRodeo and Willie Nelson", "willie_nelson");	
	logoList[i++] = new makeLogo("ProRodeo and Tracy Lawrence", "tracy_lawrence");	
	logoList[i++] = new makeLogo("ProRodeo and Styx", "styx");	
	logoList[i++] = new makeLogo("ProRodeo and Miranda Lambert", "miranda_lambert2");	
	logoList[i++] = new makeLogo("ProRodeo and George Jones", "george_jones");	
	logoList[i++] = new makeLogo("ProRodeo and Natasha Bedingfield", "natasha_bedingfield");	
	logoList[i++] = new makeLogo("ProRodeo and Joe Nichols", "joe_nichols");	
	logoList[i++] = new makeLogo("ProRodeo and Jason Aldean", "jason_aldean");	
	logoList[i++] = new makeLogo("ProRodeo and Sean Kingston", "sean_kingston");	
	logoList[i++] = new makeLogo("ProRodeo and Kevin Fowler", "kevin_fowler2");		
	logoList[i++] = new makeLogo("ProRodeo and Neal McCoy", "neal_mccoy");
	logoList[i++] = new makeLogo("Hot Dog and Fountain Drink plus the Wednesday, March 5th ProRodeo with Tracy Lawrence", "tracy_lawrence");
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Jimmy Wayne", "jimmy-wayne");
	logoList[i++] = new makeLogo("ProRodeo and Jesse McCartney", "jesse-mccartney");
	logoList[i++] = new makeLogo("ProRodeo and Akon", "akon");
	logoList[i++] = new makeLogo("ProRodeo and Kellie Pickler", "kelliepickler");
	logoList[i++] = new makeLogo("ProRodeo and Eli Young Band", "eyb");
	logoList[i++] = new makeLogo("ProRodeo and Randy Travis", "randytravis");
	logoList[i++] = new makeLogo("ProRodeo and Jack Ingram", "jack-ingram");
	logoList[i++] = new makeLogo("ProRodeo and Sara Barellis", "sarabareilles");
	logoList[i++] = new makeLogo("ProRodeo and Sara Bareilles", "sarabareilles");
	logoList[i++] = new makeLogo("ProRodeo and Creedence Clearwater Revisited", "ccr");
	logoList[i++] = new makeLogo("ProRodeo and Carlos Mencia", "carlosmencia");
	logoList[i++] = new makeLogo("ProRodeo and Craig Morgan", "craigmorgan");
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Eli Young Band", "eyb");
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Joe Nichols", "joe-nichols");
	logoList[i++] = new makeLogo("ProRodeo and Gary Allan", "gary-allan");
	logoList[i++] = new makeLogo("ProRodeo and Wade Bowen", "wade-bowen");
	logoList[i++] = new makeLogo("ProRodeo and Charley Pride", "charley-pride");
	logoList[i++] = new makeLogo("ProRodeo and Doobie Brothers", "doobie-brothers");
	logoList[i++] = new makeLogo("ProRodeo and Shinedown", "shinedown");
	logoList[i++] = new makeLogo("ProRodeo and Steve Wariner", "steve-wariner");
	logoList[i++] = new makeLogo("ProRodeo and Jordin Sparks", "jordin-sparks");
	logoList[i++] = new makeLogo("ProRodeo and Lady Antebellum", "lady-antebellum");
	logoList[i++] = new makeLogo("ProRodeo and Randy Rogers", "randy-rogers");
	logoList[i++] = new makeLogo("ProRodeo and Boys Like Girls", "boys-like-girls");
	logoList[i++] = new makeLogo("ProRodeo and Billy Currington", "billy-currington");
	logoList[i++] = new makeLogo("Xtreme Bull Riding and Big Time Rush", "big_time_rush");
	logoList[i++] = new makeLogo("ProRodeo and Blake Shelton", "blake_shelton");
	logoList[i++] = new makeLogo("ProRodeo and Clay Walker", "clay_walker");
	logoList[i++] = new makeLogo("ProRodeo and Dierks Bentley", "dierks_bentley");
	logoList[i++] = new makeLogo("ProRodeo and Easton Corbin", "easton_corbin");
	logoList[i++] = new makeLogo("ProRodeo and xxxx", "eli_young_band");
	logoList[i++] = new makeLogo("ProRodeo and Joan Jett", "joan_jett");
	logoList[i++] = new makeLogo("ProRodeo and xxxx", "joe_nichols");
	logoList[i++] = new makeLogo("ProRodeo and xxxx", "josh_turner");
	logoList[i++] = new makeLogo("ProRodeo and xxxx", "kevin_fowler");
	logoList[i++] = new makeLogo("ProRodeo and Loretta Lynn", "loretta_lynn");
	logoList[i++] = new makeLogo("ProRodeo and Rick Springfield", "rick_springfield");
	logoList[i++] = new makeLogo("ProRodeo and Ronnie Milsap", "ronnie_milsap");
	logoList[i++] = new makeLogo("ProRodeo and Jason Derulo", "jason_derulo");  
	logoList[i++] = new makeLogo("Rodeo Austin Fairgrounds Season Pass", "Fairgrounds");
	logoList[i++] = new makeLogo("Rodeo Austin Carnival & Fairgrounds Season Combo", "Carnival");
	logoList[i++] = new makeLogo("One Day Carnival Wristband", "Carnival");
	logoList[i++] = new makeLogo("ProRodeo and LeAnn Rimes", "leann_rimes");
	logoList[i++] = new makeLogo("Xtreme Bulls and Chris Young", "chris_young");
	logoList[i++] = new makeLogo("ProRodeo and Clay Walker", "clay_walker");
	logoList[i++] = new makeLogo("ProRodeo and The Josh Abbott Band", "josh_abbott_band");
	logoList[i++] = new makeLogo("ProRodeo and Josh Turner", "josh_turner");
	logoList[i++] = new makeLogo("ProRodeo and Sara Evans", "sara_evans");
	logoList[i++] = new makeLogo("ProRodeo and Stoney LaRue", "stoney_larue");
	logoList[i++] = new makeLogo("ProRodeo and The Band Perry", "the_band_perry");
	logoList[i++] = new makeLogo("ProRodeo and Gavin DeGraw", "gavin_degraw");
	logoList[i++] = new makeLogo("Super Shootout and Eli Young Band", "eyb");
	logoList[i++] = new makeLogo("ProRodeo and The Bellamy Brothers", "bellamy_brothers");
	logoList[i++] = new makeLogo("ProRodeo Finals and Kevin Fowler", "kevin_fowler");
	logoList[i++] = new makeLogo("ProRodeo and Jake Owen", "jake_owen");
	logoList[i++] = new makeLogo("ProRodeo and Demi Lovato", "demi_lovato");
	logoList[i++] = new makeLogo("ProRodeo and Glen Campbell", "glen_campbell");

	logoList[i++] = new makeLogo("Fairgrounds One Day Access", "fairgrounds");
	logoList[i++] = new makeLogo("Fairgrounds Season Pass", "fairgrounds");
	logoList[i++] = new makeLogo("Carnival & Fairgrounds One Day Pass Combo", "carnival");
	logoList[i++] = new makeLogo("One Day Carnival Wristband without Fairgrounds Admission", "carnival");
	logoList[i++] = new makeLogo("Carnival Season Pass without Fairgrounds Admission", "carnival");
	logoList[i++] = new makeLogo("Carnival & Fairgrounds Season Combo", "carnival");


	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("BRET MICHAELS")) {
				logo[0] = "bret_michaels";
			} else if(name.indexOf("XXXXX") > -1) {
				logo[0] = "xxxx";
			}
		// 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 "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;
					}
					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);
	}
	
	// print very small logo
	function printSmallLogo(name, group) {
		var imgSrc = printLogo(name, group);
		if(imgSrc!="") {
			imgSrc = imgSrc.replace(/width="60" height="60"/ig, 'width="30" height="30" align="absmiddle"');
			
			//remove full size code
			imgSrc = imgSrc.replace(/((<a href[^>]+>){1}|(<br>(<([^>]+)>)+ view large(<([^>]+)>)+ click to close(<([^>]+)>)+))/ig, "");
		}
		return(imgSrc);
	}

	// custom code (print large logo - for displaygrouplist)
	function printBigLogo(name, group) {
		var logo = "";
		var imgSrc = "";
		
		switch(group) {
			case "PA": logo = "twuni"; break;
			case "GB": logo = "gbpac"; break;
			case "WS": logo = "wcfso"; break;
			case "SW": logo = "theatre"; break;
			case "SM": logo = "som"; break;
			case "EC": logo = "uniComplex"; break;
			default: logo = "twuni"; break;
		}
		
		if(logo!="") {
			imgSrc = '<img src="'+imageWWWPath+'/logos/'+logo+'.jpg" border="0" alt="'+name+'">';
			imgSrc = imgSrc.replace(/.gif"/ig, '.jpg"');
		}
		return(imgSrc);
	}

