var show 				= new Array;

/*************************************************/
/* The section below allows for date formating.  */
/* This code is used to solve a problem with the */
/* Date(); function returning different date     */
/* format in different browsers.                 */
/*************************************************/

	var dateFormat = function () {
		var	token        = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g,
			timezone     = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
			timezoneClip = /[^-+\dA-Z]/g,
			pad = function (value, length) {
				value = String(value);
				length = parseInt(length) || 2;
				while (value.length < length)
					value = "0" + value;
				return value;
			};
	
		// Regexes and supporting functions are cached through closure
		return function (date, mask) {
			// Treat the first argument as a mask if it doesn't contain any numbers
			if (
				arguments.length == 1 &&
				(typeof date == "string" || date instanceof String) &&
				!/\d/.test(date)
			) {
				mask = date;
				date = undefined;
			}
	
			date = date ? new Date(date) : new Date();
			if (isNaN(date))
				throw "invalid date";
	
			var dF = dateFormat;
			mask   = String(dF.masks[mask] || mask || dF.masks["default"]);
	
			var	d = date.getDate(),
				D = date.getDay(),
				m = date.getMonth(),
				y = date.getFullYear(),
				H = date.getHours(),
				M = date.getMinutes(),
				s = date.getSeconds(),
				L = date.getMilliseconds(),
				o = date.getTimezoneOffset(),
				flags = {
					d:    d,
					dd:   pad(d),
					ddd:  dF.i18n.dayNames[D],
					dddd: dF.i18n.dayNames[D + 7],
					m:    m + 1,
					mm:   pad(m + 1),
					mmm:  dF.i18n.monthNames[m],
					mmmm: dF.i18n.monthNames[m + 12],
					yy:   String(y).slice(2),
					yyyy: y,
					h:    H % 12 || 12,
					hh:   pad(H % 12 || 12),
					H:    H,
					HH:   pad(H),
					M:    M,
					MM:   pad(M),
					s:    s,
					ss:   pad(s),
					l:    pad(L, 3),
					L:    pad(L > 99 ? Math.round(L / 10) : L),
					t:    H < 12 ? "a"  : "p",
					tt:   H < 12 ? "am" : "pm",
					T:    H < 12 ? "A"  : "P",
					TT:   H < 12 ? "AM" : "PM",
					Z:    (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
					o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4)
				};
	
			return mask.replace(token, function ($0) {
				return ($0 in flags) ? flags[$0] : $0.slice(1, $0.length - 1);
			});
		};
	}();
	
	// Some common format strings
	dateFormat.masks = {
		"default":       "ddd mmm d yyyy HH:MM:ss",
		shortDate:       "m/d/yy",
		mediumDate:      "mmm d, yyyy",
		longDate:        "mmmm d, yyyy",
		fullDate:        "dddd, mmmm d, yyyy",
		shortTime:       "h:MM TT",
		mediumTime:      "h:MM:ss TT",
		longTime:        "h:MM:ss TT Z",
		isoDate:         "yyyy-mm-dd",
		isoTime:         "HH:MM:ss",
		isoDateTime:     "yyyy-mm-dd'T'HH:MM:ss",
		isoFullDateTime: "yyyy-mm-dd'T'HH:MM:ss.lo"
	};
	
	// Internationalization strings
	dateFormat.i18n = {
		dayNames: [
			"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
			"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
		],
		monthNames: [
			"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
			"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
		]
	};
	
	// For convenience...
	Date.prototype.format = function (mask) {
		return dateFormat(this, mask);
	}

/**********************/
/* end date formating */
/**********************/

function Today() {
	var date = new Date();
	return(date.format("mm/dd/yyyy"));
}

function CompareDate(showdate) {
	if (Today() <= showdate) {
	 return('open');
	} else {
	 return('close');
	}
}

function AddShow(showdate, location, address, time, html) {
	var i = 0;
	var i = i + show.length;
	
	if (CompareDate(showdate) == "open")	{
  	show[i] = new Array();
		show[i][0] = (showdate);		
		show[i][1] = (location);
		show[i][2] = (address);	
		show[i][3] = (time);	
		show[i][4] = (html);	


	}		
}


function displayshow( ) {
	document.write("<ul>");
	
	if (show.length > 2) 
	{
  	for (var i=0; i<=show.length-(show.length-2)-1; i++) {
			if (show[i][4] != "") {
				document.write("<li padding-left: 5;><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + "<br><span style='font-family:arial; font-size:12px'>" + show[i][2] + "<br>" + show[i][3] + "<br>");
				document.write("<a href='" + show[i][4] + "' style='text-decoration:none' target='new'><i>Click for location information</i></a></span><br><img src='images/fill.gif' width='1' height='5'><br>");		
			} else {
				document.write("<li padding-left: 5;><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + "<br><span style='font-family:arial; font-size:12px'>" + show[i][2] + "<br>" + show[i][3] + "</a><br><img src='images/fill.gif' width='1' height='5'><br>");
			}	   
		} 
	} else {
		for (var i=0;i<=show.length-1;i++){
		if (show[i][4] != "") {
			document.write("<li><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + "<br><span style='font-family:arial; font-size:12px'>" + show[i][2] + "<br>" + show[i][3] + "<br>");
			document.write("<a href='" + show[i][4] + "' style='text-decoration:none' target='new'><i>Click for location information</i></a></span><br><img src='images/fill.gif' width='1' height='5'><br>");		
		} else {
			document.write("<li><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + "<br><span style='font-family:arial; font-size:12px'>" + show[i][2] + "<br>" + show[i][3] + "</span><br><img src='images/fill.gif' width='1' height='5'><br>");
		}		
	}
	document.write("</ul>");
	}
}


function displayshow_full() {
	document.write("<ul>");
	
	for (var i=0;i<=show.length;i++){
		if (show[i][4] != "") {
			document.write("<li><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + ",  " + show[i][2] + "&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;" + show[i][3] + " " +	"<br><a href='" + show[i][4] + "' style='text-decoration:none' target='new'><i>Click for location information</i></a><br><img src='images/fill.gif' width='1' height='5'><br>");		
		} else {
			document.write("<li><b><span style='Color:red'>" + show[i][0] + "</span></b><b>&nbsp;&nbsp;" + show[i][1] + " </b>" + ", " + show[i][2] + "&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;" + show[i][3] + "<br><img src='images/fill.gif' width='1' height='5'><br>");
		}		
	}
	document.write("</ul>");
}

function displaybanner( ) {
	var bdate = new Date();
	bdate.setDate(bdate.getDate()+5);
	var fdate =  bdate.format("mm/dd/yyyy");
	
	if (show.length > 1) {
  	for (var i=0; i<=show.length-(show.length-1)-1; i++) {
  		/*if (fdate >= show[i][0]) {*/
			document.write("<table width='762' border='0' cellpadding='0' cellspacing='1' bgcolor='#49271D' align='center'><tr><td>");
			document.write("<table width='760' border='0' cellpadding='0' cellspacing='0' bgcolor='#FAF4D4'>");
			document.write("<tr><td background='images/banner.gif' width='760' height='80'>");
			document.write("<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>");
			document.write("<td><img src='images/fill.gif' width='130' height='1'></td>");
			document.write("<td valign='top' align='center' width='630'><img src='images/fill.gif' width='1' height='60'><span style='font-family:arial; font-size:25px; color:#320033'><b>" + show[i][0] + "&nbsp;-&nbsp;" + show[i][1] + "</b></td>");
			document.write("</tr></table>");
			document.write("</tr></table></td></tr></table><img src='../gifs/fill.gif' width='1' height='2'><br>");
			/*}*/
		} 
	} else {
		for (var i=0;i<=show.length-1;i++) {
			document.write("<table width='762' border='0' cellpadding='0' cellspacing='1' bgcolor='#49271D' align='center'><tr><td>");
			document.write("<table width='760' border='0' cellpadding='0' cellspacing='0' bgcolor='#FAF4D4'>");
			document.write("<tr><td background='images/banner.gif' width='760' height='80'>");
			document.write("<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>");
			document.write("<td><img src='images/fill.gif' width='130' height='1'></td>");
			document.write("<td valign='top' align='center' width='630'><img src='images/fill.gif' width='1' height='60'><span style='font-family:arial; font-size:25px; color:#320033'><b>" + show[i][0] + "&nbsp;-&nbsp;" + show[i][1] + "</b></td>");
			document.write("</tr></table>");
			document.write("</tr></table></td></tr></table><img src='../gifs/fill.gif' width='1' height='2'><br>");
		}
	}
}