/* --------------------------------------------------
	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;
	}

/* --------------------------------------------------
	LOGO LIST
-------------------------------------------------- */
	logoList = new Array;
	var i = 0;
//	logoList[i++] = new makeLogo("Florida Int&#39;l", "fiu");
	logoList[i++] = new makeLogo("Ball State", "bsu");
	logoList[i++] = new makeLogo("Samford", "samford");
	logoList[i++] = new makeLogo("Mercer", "mercer");
	logoList[i++] = new makeLogo("Birmingham-Southern", "bsc");
	logoList[i++] = new makeLogo("Georgia State", "gsu");
	logoList[i++] = new makeLogo("Rider", "rider");
	logoList[i++] = new makeLogo("Mississippi State", "msstate");
	logoList[i++] = new makeLogo("North Carolina A&T", "ncat");
	logoList[i++] = new makeLogo("Southern Miss", "usm");
	logoList[i++] = new makeLogo("Jacksonville State", "jsu");
	logoList[i++] = new makeLogo("Marshall", "marshall");
	logoList[i++] = new makeLogo("Alabama", "ua");
	logoList[i++] = new makeLogo("Houston", "uh");
	logoList[i++] = new makeLogo("Troy", "troy");
	logoList[i++] = new makeLogo("Tulane", "tulane");
	logoList[i++] = new makeLogo("East Carolina", "ecu");
	logoList[i++] = new makeLogo("Troy University", "troyst");
	logoList[i++] = new makeLogo("Memphis", "memphis");
	logoList[i++] = new makeLogo("Marshall University", "marshall");
	logoList[i++] = new makeLogo("UTEP", "utep");
	logoList[i++] = new makeLogo("Rice", "rice");
	logoList[i++] = new makeLogo("SMU", "smu");
	logoList[i++] = new makeLogo("Central Florida", "ucf");
	logoList[i++] = new makeLogo("UCF", "ucf");
	logoList[i++] = new makeLogo("Oklahoma", "ou");
	logoList[i++] = new makeLogo("Georgia", "uga");
	logoList[i++] = new makeLogo("Birmingham Bowl", "birminghamBowl");
	logoList[i++] = new makeLogo("West Alabama", "uwat");
	logoList[i++] = new makeLogo("Wyoming Cowboys", "uwyo");
	logoList[i++] = new makeLogo("Minnesota", "umn");
	logoList[i++] = new makeLogo("DePaul", "depaul");
	logoList[i++] = new makeLogo("Winston-Salem State", "wssu");
	logoList[i++] = new makeLogo("South Florida", "south_fl");
	logoList[i++] = new makeLogo("Central Flordia", "ucf");
	logoList[i++] = new makeLogo("Papajohns.com Bowl", "papaJohnBowl");
	logoList[i++] = new makeLogo("C-USA Tournament", "conf_usa");
	logoList[i++] = new makeLogo("C-USA Tournament All Session", "conf_usa");
	logoList[i++] = new makeLogo("C-USA Tournament Ticket Donation", "conf_usa");
	logoList[i++] = new makeLogo("C-USA VIP Tournament Package", "conf_usa");
	logoList[i++] = new makeLogo("Women&#39;s NIT ADULT", "wnit");
	logoList[i++] = new makeLogo("Women&#39;s NIT YOUTH", "wnit");
	logoList[i++] = new makeLogo("Alcorn State", "alcorn");
	logoList[i++] = new makeLogo("papajohns.com Bowl Game", "papaJohnBowl");
	logoList[i++] = new makeLogo("Michigan State", "msu");
	logoList[i++] = new makeLogo("Florida State", "fsu");
	logoList[i++] = new makeLogo("Tulsa", "utulsa");
	logoList[i++] = new makeLogo("2007 Football Home Games", "uab_helmet2");
	logoList[i++] = new makeLogo("2007 Football Away Games", "uab_helmet2");
	logoList[i++] = new makeLogo("Basketball Season Tickets", "basketball");
	logoList[i++] = new makeLogo("Basketball Season Ticket", "basketball");
	
	logoList[i++] = new makeLogo("Stetson", "stetson");
	logoList[i++] = new makeLogo("Eastern Kentucky", "eku");
	logoList[i++] = new makeLogo("Jacksonville", "ju");	   
	
	logoList[i++] = new makeLogo("Cincinnati", "uc");
	logoList[i++] = new makeLogo("Alabama A&M", "aamu");
	logoList[i++] = new makeLogo("Old Dominion", "odu");
	logoList[i++] = new makeLogo("Alabama State", "alasu");

	logoList[i++] = new makeLogo("Florida Atlantic", "fau");
	logoList[i++] = new makeLogo("Tennessee", "utk");
	logoList[i++] = new makeLogo("South Carolina", "sc");
	logoList[i++] = new makeLogo("NIT Season Tip-Off Monday Nov. 24th.", "NIT");
	logoList[i++] = new makeLogo("NIT Season Tip-Off Tuesday, Nov. 25th.", "NIT");	
	logoList[i++] = new makeLogo("Savannah State", "savstate");
	logoList[i++] = new makeLogo("Louisiana Lafayette", "louisiana"); 	
	logoList[i++] = new makeLogo("UAB vs Alabama - Adult $12", "ua"); 	
	logoList[i++] = new makeLogo("UAB vs Alabama - Youth $8.00", "ua"); 	
	logoList[i++] = new makeLogo("UAB vs Mississippi State - Adult $12", "miss_st_"); 	
	logoList[i++] = new makeLogo("UAB vs Mississippi State - Youth $8", "miss_st_"); 	
	logoList[i++] = new makeLogo("Blazer Boosters Donation", "blazerboosters");	
	logoList[i++] = new makeLogo("Troy - September 19th, Troy, AL", "troy");
	logoList[i++] = new makeLogo("Texas A & M - September 26th, College Station , TX.", "tamu");
	logoList[i++] = new makeLogo("Ole Miss - October 17th, Oxford, MS.", "olemiss");
	logoList[i++] = new makeLogo("Marshall - October 24th, Huntington, WV", "marshall");
	logoList[i++] = new makeLogo("UTEP - October 31st, El Paso, TX", "utep");
	logoList[i++] = new makeLogo("Memphis - November 14th, Memphis, TN", "memphis");
	logoList[i++] = new makeLogo("East Carolina - November 21st, Greenville, NC", "ecu");
	logoList[i++] = new makeLogo("2009 Football Media Guide", "uab_helmet2");	
	
	logoList[i++] = new makeLogo("Troy - 9/19/09, Troy, AL", "troy");
	logoList[i++] = new makeLogo("Texas A&M - 9/26/09, Col Sta , TX", "tamu");
	logoList[i++] = new makeLogo("Ole Miss - 10/17/09, Oxford, MS", "olemiss");
	logoList[i++] = new makeLogo("Marshall-10/24/09 Huntington, WV", "marshall");
	logoList[i++] = new makeLogo("UTEP - 10/31/09, El Paso, TX", "utep");
	logoList[i++] = new makeLogo("Memphis - 11/14/09, Memphis, TN", "memphis");
	logoList[i++] = new makeLogo("Blazer Kids Club Membership", "uabkids");
	logoList[i++] = new makeLogo("Blazer Kids Club", "uabkids");	
	logoList[i++] = new makeLogo("ECU - 11/21/09, Greenville, NC", "ecu");	
	logoList[i++] = new makeLogo("Men&#39;s Soccer Season Pass", "soccer2");	
	logoList[i++] = new makeLogo("Women&#39;s Soccer Season Pass", "soccer2");
	logoList[i++] = new makeLogo("Volleyball Season Pass", "volleyball2");
	logoList[i++] = new makeLogo("Men&#39;s Soccer Family Season Pass", "soccer2");
	logoList[i++] = new makeLogo("Women&#39;s Soccer Family Season Pass", "soccer2");
	logoList[i++] = new makeLogo("Volleyball Family Season Pass", "volleyball2");
	logoList[i++] = new makeLogo("Florida Atlantic", "See attachment", "fau"); 	
	logoList[i++] = new makeLogo("Florida A&M", "famu");
	logoList[i++] = new makeLogo("Middle Tennessee State", "mtsu");
	logoList[i++] = new makeLogo("ETSU", "etsu");
	logoList[i++] = new makeLogo("Butler", "butler");
	logoList[i++] = new makeLogo("NELLY vs BOW WOW Celebrity Basketball Game", "bball-art");	
	logoList[i++] = new makeLogo("DERTY ENT vs CASH MONEY MILLIONAIRES", "bball-art");
	logoList[i++] = new makeLogo("Adult Ticket UAB vs Alabama", "ua");
	logoList[i++] = new makeLogo("Youth Ticket UAB vs Alabama", "ua");
	logoList[i++] = new makeLogo("Florida Atlantic", "FAU2");
	logoList[i++] = new makeLogo("ECU", "ecu");
	logoList[i++] = new makeLogo("Marvin Sapp in Concert", "sapp");	
	logoList[i++] = new makeLogo("Marvin Sapp", "sapp");	
	logoList[i++] = new makeLogo("UAB Basketball $1 Promotional Ticket", "basketball");
	logoList[i++] = new makeLogo("$99 Promotional First Time Buyer Season Ticket", "basketball");
	logoList[i++] = new makeLogo("Basketball 2010-11 Single Game Tickets!", "basketball");
	logoList[i++] = new makeLogo("Southeast Missouri State", "semo2");
	logoList[i++] = new makeLogo("South Alabama", "South_Alabama");
	logoList[i++] = new makeLogo("Kent State", "kent");
	logoList[i++] = new makeLogo("VCU", "vcu");
	logoList[i++] = new makeLogo("George Washington", "gwu");
	logoList[i++] = new makeLogo("UAB vs Alabama", "alabamalogo");	
	logoList[i++] = new makeLogo("UAB vs Alabama Standing Room Only", "alabamalogo");	 
	logoList[i++] = new makeLogo("Youth Ticket - UAB vs Alabama", "alabamalogo");	 
	logoList[i++] = new makeLogo("Adult Ticket - UAB vs Alabama", "alabamalogo");	 
	logoList[i++] = new makeLogo("Florida", "ufl"); 
	logoList[i++] = new makeLogo("Mississippi State", "miss_st_"); 
	logoList[i++] = new makeLogo("Florida Tech", "FloridaTechPanthers");
	logoList[i++] = new makeLogo("Auburn Montgomery", "aum_warhawks");
	logoList[i++] = new makeLogo("Creighton", "creighton2");
	logoList[i++] = new makeLogo("Murray State", "murraystate");
	logoList[i++] = new makeLogo("UT-Martin", "utm2");
	logoList[i++] = new makeLogo("MTSU", "mtsu");
	

/* --------------------------------------------------
	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("FST", "FSG"), "uab_helmet2");	//custom code, group logos
	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("BST","FF","BS"), "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("NIT"), "NIT");
	logoGroupList[i++] = new makeLogo(new Array("CUSA"), "cusa12");		
/* --------------------------------------------------
	MAIN LOGO FUNCTIONS
-------------------------------------------------- */
	function printLogo(name, group) {
		var logo = "";
		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)?\)?)?(( |,|-|\(|\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)?\)?)?(( |,|-|\(|\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;
					break;
				}
			}

		// 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
		//template enhancement, no default logo for renewals
		if(group!="renewals") {
		if(logo=="") logo = "na";
		} else {
			if(logo=="") logo = "football";  //change to different default renewal logo, or comment out to remove default logo function on Renewal Process	
		}	
		
		// 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+'" align="absmiddle">';
			} else {
				for(var k=0; k<logo.length; k++) {
					imgSrc += '<img src="'+imageWWWPath+'/logos/'+logo[k]+'.gif" border="0" width="60" height="60" alt="'+extraName+'" align="absmiddle"> ';
				}
			}
			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
	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 - function to print the VFS
	
	function print_jpg(name, imgDir, mWidth, mHeight ) {
	  var img = "";
	  name = name.toUpperCase();
	
	// modified to use section name as image name. the file name for the view has to be = the area code
	  var imgSrc = "";
	
	  if(name != "") {
	   imgSrc =  '<img src="'+imageWWWPath+'/'+imgDir+'/'+name+'.jpg" class="imagelink" width="'+mWidth+'" Height="'+mHeight+'"><br>' ;  
	      imgSrc = imgSrc + '<img src="$(imageWWWPath)/blank.gif" border="0" width="13" height="1">View from section <b>'+ name +'</b><br><br>';
	  }
	
	  return(imgSrc);
	 } 

	
