/* --------------------------------------------------
	Author:		Donna Latto
	Email:		dlatto@paciolan.com
	Created:	March 6, 2007
	Purpose:	Functions to create and print logos. 
				Used primarily on:
				- displaySimpleEventList
				- displayGroupList 
	Version Notes:
				3/29/07 - Added printStaticThumb 
				function to add clickable static 
				map thumbnails in places such as 
				cartdisplay.
				
				4/4/07 - Fixed formatting of 
				clickable thumbnail (in cartdisplay).
				
				8/30/07 - printStaticThumb -> printStaticLink
				to eliminate trouble of creating
				thumbnails.
-------------------------------------------------- */

	function makeMap(desc, mapfile) {
		this.desc = desc;
		this.mapfile = mapfile;
	}

	/* ----- Map list by event ---------- */
	smapList = new Array;
	var smli = 0;
//	smapList[smli++] = new makeMap("T07:TOUR:TOUR", "chaseFieldPhoto.jpg");
	smapList[smli++] = new makeMap("09:BP:BP", "2009-ST-brochure.JPG");
	
	/* ----- Map list by facility ---------- */
	fmapList = new Array;
	var fmli = 0;
//	fmapList[fmli++] = new makeMap("HUSKY STADIUM", "sample.gif");

	function printStaticMap(desc) {
		var theMap = "";
		var smapSrc = "";
		
		for(var a=0; a<smapList.length; a++) {
			if(desc.toUpperCase()==smapList[a].desc.toUpperCase()) {
				theMap = smapList[a].mapfile;
			}
		}
		if(desc.indexOf("TOUR")>-1)theMap = "maptour.jpg"; // custom code (default map for all tours)
		if(desc.indexOf("FF")>-1)theMap = "friarfestlogo.jpg"; // custom code (default map for all FriarFest)
		if(desc.indexOf("09:BP:BP")>-1)theMap = "map_thumb-09.gif"; // custom code (default map for all FriarFest)		
		if(desc.indexOf("10:BP:BP")>-1)theMap = "10-ST-map-thumb.gif";// custom code (default map for 10stp)				
		if(theMap=="") theMap = "map_thumb.gif"; // custom code (dbacks default map)

		if(theMap != "") {
			// mlb code below (add link to larger view of map)
			var theMapLarge = theMap.slice(0, theMap.indexOf(".")) + '_large' + theMap.slice(theMap.indexOf("."), theMap.length);

			if (desc.indexOf("TOUR")>-1) {
				smapSrc = '<p align="center"><img src="'+imageWWWPath+'/maps/'+theMap+'" border="0"></p>' +
					'<p align="center"><b><a href="javascript:popBox(\''+ imageWWWPath +'/maps/'+theMapLarge+'\', \'map\', 700, 500);">Click here to see a larger image</a><br>'
			}else{
				smapSrc = '<p align="center"><img src="'+imageWWWPath+'/maps/'+theMap+'" border="0"></p>' +
					'<p align="center"><b><a href="javascript:popBox(\''+ imageWWWPath +'/maps/'+theMapLarge+'\', \'map\', 710, 685);">Click here to see a larger image</a><br>' +			
				    // custom code : hide the link to interact map
					//'<br><a href=http://sandiego.padres.mlb.com/sd/ticketing/seating_pricing.jsp target=_blank>Click here to view the Padres Interactive<br>Seat Map in a new window.</a></b></p>'
					''
			}


		}
		return(smapSrc);
	}
	
	function printStaticLink(desc, fac) {
		var theMap = "";
		var smapSrc = fac;
		
		for(var a=0; a<smapList.length; a++) {
			if(desc.toUpperCase()==smapList[a].desc.toUpperCase()) {
				theMap = smapList[a].mapfile;
			}
		}
		
		for(var a=0; a<fmapList.length; a++) {
			if(fac.toUpperCase()==fmapList[a].desc.toUpperCase()) {
				theMap = fmapList[a].mapfile;
			}
		}

		if(theMap != "") {
			smapSrc = '<a href="javascript:popBox(\''+imageWWWPath+'/maps/'+theMap+'\', \'evenue\', 640, 480)">'+fac+'</a>';
		}
		return(smapSrc);
	}
	
	// mlb code below
	function printThumbLink(desc) {
		var theMap = "";
		var smapSrc = "";
		
		for(var a=0; a<smapList.length; a++) {
			if(desc.toUpperCase()==smapList[a].desc.toUpperCase()) {
				theMap = smapList[a].mapfile;
			}
		}
		if(desc.indexOf("TOUR")>-1)theMap = "chaseFieldPhoto.jpg"; // custom code (default map for all tours)
		if(theMap=="") theMap = "map.gif"; // custom code (dbacks default map)

		if(theMap != "") {
			// mlb code below (add link to larger view of map)
			var theMapLarge = theMap.slice(0, theMap.indexOf(".")) + '_large' + theMap.slice(theMap.indexOf("."), theMap.length);
			var theMapThumb = theMap.slice(0, theMap.indexOf(".")) + '_thumb' + theMap.slice(theMap.indexOf("."), theMap.length);
			smapSrc = '<table border="0" cellpadding="5" cellspacing="0"><tr><td align="center"><a href="javascript:popBox(\''+ imageWWWPath +'/maps/'+theMapLarge+'\', \'map\', 700, 500);"><img src="'+imageWWWPath+'/maps/'+theMapThumb+'" width="100" border="0"><br><small>click for larger image</small></a></td></tr></table>'
		}
		return(smapSrc);
	}