/* ==================================================
	Created:	March 6, 2007
	Purpose:	Functions to create and print logos. 
				Used primarily on:
				- displaySimpleEventList
				- displayGroupList 
================================================== */
	var defaultLogo = "na"; // custom code
	
	function makeLogo(name, logo, divider) {
		this.oname = name;
		this.ologo = logo;
		this.divider = (typeof(divider)!="undefined" && divider!="" ? divider : "");
	}

/* ==================================================
	LOGO LIST
================================================== */
	logoList = new Array;
	var i = 0;
//	logoList[i++] = new makeLogo("Florida Int&#39;l", "fiu");
	logoList[i++] = new makeLogo("My Little Pony", "my_little_pony");
	logoList[i++] = new makeLogo("Wyoming Shootout", "uwyo");
	logoList[i++] = new makeLogo("Lipizzaner Stallions Matinee Show", "lipizzaner");
	logoList[i++] = new makeLogo("Carrie Underwood", "underwood");
	logoList[i++] = new makeLogo("Jeff Dunham", "dunham_admat");
	logoList[i++] = new makeLogo("Tech N9ne & Paul Wall", "tech_n9ne");
	logoList[i++] = new makeLogo("Moscow Ballet&#39;s &quot;Great Russian Nutcracker&quot;", "nutcracker");
	logoList[i++] = new makeLogo("Staind w/ Finger Eleven", "staind");
	logoList[i++] = new makeLogo("Fireworks Festival 2008 Gate Admission", "fireworks");
	logoList[i++] = new makeLogo("Fireworks Festival 2008 Motorcycle Admission", "fireworks");
	logoList[i++] = new makeLogo("Alice Cooper", "alice_cooper");
	logoList[i++] = new makeLogo("Willie Nelson", "willie_nelson");
	logoList[i++] = new makeLogo("Wyoming Women&#39;s Expo Friday Admission", "wyowomxpo");
	logoList[i++] = new makeLogo("Wyoming Women&#39;s Expo Saturday Admission", "wyowomxpo");
	logoList[i++] = new makeLogo("Wyoming Women&#39;s Expo Two-Day Pass", "wyowomxpo");
	logoList[i++] = new makeLogo("Wyoming Women&#39;s Expo Speaker Luncheon", "wyowomxpo");
	logoList[i++] = new makeLogo("Steve Miller Band", "stevemillerband");
	logoList[i++] = new makeLogo("Buckcherry/Avenged Sevenfold", "buckcherry");
	logoList[i++] = new makeLogo("Oliver", "oliver");
	logoList[i++] = new makeLogo("Monster Truck Winternationals & Thrill Show", "monstertruck_winternational");
	logoList[i++] = new makeLogo("Cirque Dreams Jungle Fantasy", "cirquedreamsjungle");
	logoList[i++] = new makeLogo("Lord of the Dance", "lordofdance");
	logoList[i++] = new makeLogo("The Pajama Game", "pajamagame");
	logoList[i++] = new makeLogo("Dirty Rotten Scoundrels", "rottenscoundrels");
	logoList[i++] = new makeLogo("Disney Live! Winnie the Pooh", "winnie");
	logoList[i++] = new makeLogo("Blue Cross Blue Shield of Wyoming Shootout", "blue_cross");
	logoList[i++] = new makeLogo("PLAYHOUSE DISNEY LIVE!", "playhousedisney");
	logoList[i++] = new makeLogo("As I Lay Dying", "lay_dying");
	logoList[i++] = new makeLogo("Larry The Cable Guy", "cable_guy");
	logoList[i++] = new makeLogo("BB KING", "bb_king");
	logoList[i++] = new makeLogo("BB King", "bb_king");
	logoList[i++] = new makeLogo("Merle Haggard & the Strangers", "merle_haggard");
	logoList[i++] = new makeLogo("API", "api");
	logoList[i++] = new makeLogo("David Copperfield", "david_copperfield");
	logoList[i++] = new makeLogo("SLIPKNOT", "slipknot");
	logoList[i++] = new makeLogo("Gordon Lightfoot", "gordonlightfoot");
	logoList[i++] = new makeLogo("ZZ Top", "zztop");
	logoList[i++] = new makeLogo("API", "api");
	logoList[i++] = new makeLogo("David Cook", "david_cook");
	logoList[i++] = new makeLogo("2009 Wyoming Women&#39;s Expo Booth Space", "womens_expo");
	logoList[i++] = new makeLogo("Casting Crowns", "casting_crowns");	
	logoList[i++] = new makeLogo("Skillet", "Skillet");		
	//logos for displaypackageinfo.html, case 221527
	logoList[i++] = new makeLogo("Cirque Dreams", "cirque_dreams");					 
	logoList[i++] = new makeLogo("Annie", "annie");
	logoList[i++] = new makeLogo("Add Jesus Christ Superstar", "jc_superstar");
	logoList[i++] = new makeLogo("Hairspray", "hairspray");
	logoList[i++] = new makeLogo("Bill Cosby", "bill_cosby");
	logoList[i++] = new makeLogo("Bill Cosby Evening", "bill_cosby");
	logoList[i++] = new makeLogo("Add Rain", "rain");
	logoList[i++] = new makeLogo("Cabaret", "cabaret");
	//end logos for displaypackageinfo.html, case 221527
	logoList[i++] = new makeLogo("In the Mood", "inthemood");
	logoList[i++] = new makeLogo("Bad Boys Arenacross Races", "badboys");
	logoList[i++] = new makeLogo("Cirque Dreams illumination", "cirque_dreams");  
	logoList[i++] = new makeLogo("Ron White", "ron_white");
	logoList[i++] = new makeLogo("Blue Cross/Blue Shield of Wyoming Shootout", "wyoming");	
	logoList[i++] = new makeLogo("Bill Cosby Matinee", "bill_cosby");
	logoList[i++] = new makeLogo("Jesus Christ Superstar", "jc_superstar");
	logoList[i++] = new makeLogo("Rain", "rain");
	//logoList[i++] = new makeLogo("API Chili Cook-Off", "superman");
	logoList[i++] = new makeLogo("Carnival Of Madness", "carnivalofmadness");
	logoList[i++] = new makeLogo("Nickelodeon presents Storytime Live!", "storytime_live");

	logoList[i++] = new makeLogo("Eric Church", "eric_church");
	
	logoList[i++] = new makeLogo("WOMEN&#39;S EXPO 2 DAY PASS", "wwex");
	logoList[i++] = new makeLogo("WOMEN&#39;S EXPO FRIDAY PASS", "wwex");
	logoList[i++] = new makeLogo("WOMEN&#39;S EXPO SATURDAY PASS", "wwex");
	
	logoList[i++] = new makeLogo("Best of Broadway! Four Show Ticket Package", "season-logo");
	
	logoList[i++] = new makeLogo("A Chorus Line", "acllogostacked");
	logoList[i++] = new makeLogo("Riverdance", "dancer-logo_long");
	logoList[i++] = new makeLogo("Grease", "grease");
	logoList[i++] = new makeLogo("Wizard of Oz", "wizard_of_oz");
	
	logoList[i++] = new makeLogo("Halloween Massacre-Raid featuring Dope", "Dope");
	logoList[i++] = new makeLogo("Rodney Carrington", "Rodney-2010");
	logoList[i++] = new makeLogo("Jeff Dunham<br> IDENTITY CRISIS TOUR", "dunhamADMAT");
	
	logoList[i++] = new makeLogo("The Harlem Globetrotters", "globetrotters");
	logoList[i++] = new makeLogo("Magic Pass: 30 minute interactive event from <font color = red>5:30PM - 6:00PM</font><br> MUST have show ticket & Magic Pass for entry", "globetrotters");
	logoList[i++] = new makeLogo("VIP Package - Behind the Magic (Includes Magic Pass)", "globetrotters");
	
	logoList[i++] = new makeLogo("Chris Cagle", "chris-cagle");
	
	logoList[i++] = new makeLogo("API Chili Cook-Off", "2011APILogo");
	logoList[i++] = new makeLogo("Blizzard Music Tour 5.0 featuring Nelly", "BLIZZARD TOUR");
	logoList[i++] = new makeLogo("Three Days Grace", "Three Days Grace");
	
	logoList[i++] = new makeLogo("Newsboys w/ Kutless & Disciple", "newsboys");
	logoList[i++] = new makeLogo("Jared Rogerson", "JaredRogerson");
	logoList[i++] = new makeLogo("Wrangler Fashion Show", "NIRA");
	logoList[i++] = new makeLogo("Barney Live in Concert - Birthday Bash!", "BarneyBdayBash");
	logoList[i++] = new makeLogo("Carson & Barnes Circus", "CarsonBarnesCircus");
	logoList[i++] = new makeLogo("Godsmack", "Godsmack");
	logoList[i++] = new makeLogo("REBA", "Reba");
	logoList[i++] = new makeLogo("Broadway in Casper Season Package", "BroadwayInCasper2011");
	logoList[i++] = new makeLogo("Broadway in Casper - Choose at Least 2 Shows from the List Below", "BroadwayInCasper2011");
	logoList[i++] = new makeLogo("Hogadon Ski Pass Renewal", "hogadon");

	logoList[i++] = new makeLogo("The Christmas Music of Mannheim Steamroller", "MannheimSteamroller");
	logoList[i++] = new makeLogo("Young Frankenstein", "YoungFrank");
	logoList[i++] = new makeLogo("Elvis Lives!", "ElvisLives");
	logoList[i++] = new makeLogo("Mamma Mia!", "MammaMia");
	logoList[i++] = new makeLogo("Monster Trucks Winternationals and Bad Boys Arenacross Championships", "MonsterTruckBadboys");

	logoList[i++] = new makeLogo("9th Annual Methamphetamine & Substance Abuse Conference", "meth");
	logoList[i++] = new makeLogo("Monster Trucks Winternationals 25th Year!", "MonsterTruck25Years");
	logoList[i++] = new makeLogo("API Chili Cook-Off", "ApiChiliCookOff");
	logoList[i++] = new makeLogo("2012 Bridal Extravaganza", "BridalExtrav");
	logoList[i++] = new makeLogo("Professional Bull Riders", "PBR-TouringPro");
	logoList[i++] = new makeLogo("Five Finger Death Punch", "FiveFingerDeathPunch");

/* ==================================================
	EXTRA LIST
================================================== */
	extraList = new Array;
	var i = 0;
	extraList[i++] = ""; // DO NOT remove
	extraList[i++] = "The ";
	extraList[i++] = "at ";
	extraList[i++] = "@ ";
	extraList[i++] = "vs ";
	extraList[i++] = "vs. ";
	extraList[i++] = " FAMILY 4 PACK";
	extraList[i++] = " - Family Four Packs";
	extraList[i++] = " - Group Tickets";
	extraList[i++] = " - Student Matinee";
	extraList[i++] = " Time TBA";
	
	// sort extraList, greatest length first
	extraList.sort(function(a,b) {
		return (a.length > b.length) ? -1 : 1;
	});

/* ==================================================
	FULL-SIZED IMAGES LIST
================================================== */
	fullsizeList = new Array;
	var i = 0;
//	fullsizeList[i++] = new makeLogo("Rutgers Student Test", "StudentShirt");

/* ==================================================
	GROUP LIST
================================================== */
	logoGroupList = new Array;
	var i = 0;
	/*
	logoGroupList[i++] = new makeLogo(new Array("F","FB","FBS","FBI","FB3","STFB"), "football");
	logoGroupList[i++] = new makeLogo(new Array("BB"), "baseball");
	logoGroupList[i++] = new makeLogo(new Array("SB"), "softball");
	logoGroupList[i++] = new makeLogo(new Array("MB","MBS","MBI"), "basketball");
	logoGroupList[i++] = new makeLogo(new Array("WB","WBS","WBI"), "basketball");
	logoGroupList[i++] = new makeLogo(new Array("V","VB","MVB","WVB"), "volleyball");
	logoGroupList[i++] = new makeLogo(new Array("H"), "hockey");
	logoGroupList[i++] = new makeLogo(new Array("SOC","SO","MS","WS"), "soccer");
	logoGroupList[i++] = new makeLogo(new Array("CLD"), "calendar");
	*/
	logoGroupList[i++] = new makeLogo(["RI","RS"], "CNFR2011");
	logoGroupList[i++] = new makeLogo(["BB"], "BroadwayInCasper2011");
	logoGroupList[i++] = new makeLogo(["HOG"], "hogadon");

/* ==================================================
	MAIN LOGO FUNCTIONS
================================================== */
	function printLogo(name, group) {
		if(name=="" && group=="") return '';
		var logo = "";
		var divider = "";
		name = cleaner(name.toUpperCase());
		
		// remove appending dates/times (ie: "TITLE - Wed., Sept. 17 - 2pm")
		name = name.replace(/(( |,|-|\(|\bon\b|\bat\b){0,2} ?\b(mon|tue(s)?|wed(nes)?|thu(r(s)?)?|fri|sat(ur)?|sun)(day)?\b\.?( morning| afternoon| eve| evening| mat| aft.?)?\)?)?(( |,|-|\(|\bon\b|\bat\b){0,2} ?(\b(jan(uary)?|feb(ruary)?|mar(ch)?|apr(il)?|may|jun(e)?|jul(y)?|aug(ust)?|sep(t(ember)?)?|oct(ober)?|nov(ember)?|dec(ember)?)\b\.? \d{1,2}(th)?(,? ?(20)?\d{2})?\)?|\d{1,2}[/\- ]\d{1,2}([/\- ](20)?\d{2})?\)?))?(( |,|-|\(|\bon\b|\bat\b|@){0,2} ?\d{1,2}(:\d{2})? ?(a.?m.?|p.?m.?)\)?)?$/ig, "");
		
		// process extralist
		var extraName = name;
		for(var i=0; i<extraList.length; i++) {
			if(extraName.indexOf(extraList[i].toUpperCase())==0) {
				extraName = extraName.slice(extraList[i].length, extraName.length);
				break;
			}
		}
		for(var i=0; i<extraList.length; i++) {
			if(extraName.length - extraList[i].length>0 && extraName.indexOf(extraList[i].toUpperCase())==extraName.length - extraList[i].length) {
				extraName = extraName.slice(0, extraName.length - extraList[i].length);
				break;
			}
		}
		extraName = extraName.replace(/(( |,|-|\(|\bon\b|\bat\b){0,2} ?\b(mon|tue(s)?|wed(nes)?|thu(r(s)?)?|fri|sat(ur)?|sun)(day)?\b\.?( morning| afternoon| eve| evening| mat| aft.?)?\)?)?(( |,|-|\(|\bon\b|\bat\b){0,2} ?(\b(jan(uary)?|feb(ruary)?|mar(ch)?|apr(il)?|may|jun(e)?|jul(y)?|aug(ust)?|sep(t(ember)?)?|oct(ober)?|nov(ember)?|dec(ember)?)\b\.? \d{1,2}(th)?(,? ?(20)?\d{2})?\)?|\d{1,2}[/\- ]\d{1,2}([/\- ](20)?\d{2})?\)?))?(( |,|-|\(|\bon\b|\bat\b|@){0,2} ?\d{1,2}(:\d{2})? ?(a.?m.?|p.?m.?)\)?)?$/ig, "");
		
		// find logo match (start from end for most recently added logos)
		for(var i=logoList.length-1; i>=0; i--) {
			var listName = logoList[i].oname.toUpperCase();
			if(name==cleaner(listName) || extraName==cleaner(listName)) {
				logo = logoList[i].ologo;
				divider = logoList[i].divider;
				break;
			}
		}

		// custom code
		if(logo=="") {
			var str = name
			if (str.match("BACKYARDIGAN")) {
				logo[0] = "backyardigans";
			} else if(name.indexOf("MONSTER TRUCKS") > -1) {
				logo[0] = "monstertrucks";
			} else if(name.indexOf("GRUESOME TWOSOME") > -1) {
				logo[0] = "gruesome_twosome";
			} else if(name.indexOf("FLYLEAF") > -1) {
				logo[0] = "flyleaf";
			} else if(name.indexOf("BROADWAY YOUR WAY!") > -1) {
				logo[0] = "season-logo";
			} else if(name.indexOf("N9NE") > -1) {
				logo[0] = "n9ne";
			}
		}
		// end cc
		
		// find logo based on group
		if(logo=="") {
			if(typeof(fullGroupList)!="undefined" && group!="") {
				while(logo=="" && group!="") {
					for(var k=0; k<logoGroupList.length; k++) {
						for(var l=0; l<logoGroupList[k].oname.length; l++) {
							if(logoGroupList[k].oname[l]==group) {
								logo = logoGroupList[k].ologo;
								break;
							}
						}
						if(logo!="") break;
					}
					if(logo!="") break;
					var parent = "";
					for(var i=0; i<fullGroupList.length; i++) {
						if(fullGroupList[i].code==group) {
							parent = fullGroupList[i].parent;
						}
					}
					group = parent;
				}
			} else {
				for(var k=0; k<logoGroupList.length; k++) {
					for(var l=0; l<logoGroupList[k].oname.length; l++) {
						if(logoGroupList[k].oname[l]==group) {
							logo = logoGroupList[k].ologo;
							break;
						}
					}
				}
			}
		}
		
		// set DEFAULT LOGO if still not assigned
		if(logo=="") logo = defaultLogo;
		
		// determine if full sized image exists
		var fullSize = "";
		for(var i=0; i < fullsizeList.length; i++) {
			var listName = fullsizeList[i].oname.toUpperCase();
			if(name==cleaner(listName) || extraName==cleaner(listName)) {
				fullSize = fullsizeList[i].ologo;
				break;
			}
		}
		
		var imgSrc = "";
		
		// create and return logo source
		if(logo!="") {
			if(typeof(logo)=="string") {
				imgSrc = '<img src="'+imageWWWPath+'/logos/'+logo+'.gif" border="0" width="60" height="60" alt="'+extraName+'" class="logo" />';
			} else {
				for(var k=0; k<logo.length; k++) {
					if(k>0 && divider!="") {
						imgSrc += '<span class="logoDivider">'+divider+'</span>';
					} else {
						imgSrc += ' ';
					}
					imgSrc += '<img src="'+imageWWWPath+'/logos/'+logo[k]+'.gif" border="0" width="60" height="60" alt="'+extraName+'" class="logo" />';
				}
			}
			if(fullSize!="" && group!="ticketTransfers") {
				imgSrc = '<a href="#" onclick="toggleFullSize(this); return false;" class="thumbHide">' + imgSrc + '<br><small style="white-space:nowrap"><img src="'+imageWWWPath+'/fullsize/mag.gif" border="0" width="11" height="11" align="absmiddle"> view large</small><span><img src="'+imageWWWPath+'/fullsize/'+fullSize+'.gif" border="0" alt="'+name+'"><br><small style="white-space:nowrap"><img src="'+imageWWWPath+'/fullsize/close.gif" border="0" width="11" height="11" align="absmiddle"> click to close</small></span></a>';
			}
		}
		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 (for mini cart)
	function printSmallLogo(name, group) {
		var imgSrc = printLogo(name, group);
		if(imgSrc!="") {
			imgSrc = imgSrc.replace(/width="60" height="60"/ig, 'width="25" height="25" align="absmiddle"');
			
			//remove full size code
			imgSrc = imgSrc.replace(/((<a href[^>]+>){1}|(<br>(<([^>]+)>)+ view large(<([^>]+)>)+ click to close(<([^>]+)>)+))/ig, "");
		}
		return(imgSrc);
	}
