// OAE-ExpoWeekHoursCalendar.js
// This script creates table rows for all Expo calendar dates.
// Written by: Brian Bahn
// Updated: 04/12/2010

////////////////////////////////////////////////////////////
// User variables and image array section.                //
// Edit only within this section.                         //
////////////////////////////////////////////////////////////

// Table caption.
var strTableCaption = "";

// Edit presentation calendar fields in this array using comma separated quoted format.  
// Fields: 
// 1. Date
// 2. Hours
var aryExpoWeekDatesHours = new Array
	(
//	"11/18/2009", "10 &ndash; 5", 
//	"11/19/2009", "5 &ndash; 9", 
//	"11/20/2009", "4 &ndash; 9", 
//	"11/21/2009", "9 &ndash; 6:30", 
//	"11/22/2009", "11 &ndash; 5"//, 
	"04/21/2010", "10 &ndash; 5", 
	"04/22/2010", "5 &ndash; 9", 
	"04/23/2010", "4 &ndash; 9", 
	"04/24/2010", "9 &ndash; 6:30", 
	"04/25/2010", "11 &ndash; 5"
	);

var aryDayNames = new Array
	(
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
	);

var aryMonthNames = new Array
	(
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
	);

var aryDateOrdinals = new Array
	(
  "th",
  "st",
  "nd",
  "rd",
  "th",
  "th",
  "th",
  "th",
  "th",
  "th",
  "th"
	);


////////////////////////////////////////////////////////////
// Data Processing section.                               //
////////////////////////////////////////////////////////////

function fnExpoWeekHoursCalendar()
	{
	var idxCalendarDates; 
	var strDay; 
	var strDayWeek; 
	var datDate; 
	
	// Declare table.
	document.write('<table id="tblPresentationCalendar"');
	// Write table caption.
//	document.write('<caption>' + strTableCaption) + '</caption>';
	// Write table header.
	var datToday = new Date(aryExpoWeekDatesHours[0]);
	document.write('<thead>');
	document.write('<tr><th colspan="5" style="background: lightyellow; color: black;">Expo Week Special Store Hours<br /><span style=\"font-size: smaller; font-weight: normal;\">' + String(aryMonthNames[datToday.getMonth()]) + ', ' + String(datToday.getFullYear()) + '</span></th></tr>');
	document.write('<tr><th colspan="2">Expo Setup</th><th colspan="3" style="background: red;">Expo Sale</th></tr>');
	document.write('<tr>');
	for (var idxCalendarDates = 0; idxCalendarDates < aryExpoWeekDatesHours.length; idxCalendarDates++)
		{
		var datToday = new Date(aryExpoWeekDatesHours[idxCalendarDates]);
		strDay = String(aryDayNames[datToday.getDay()]);
		document.write('<th>' + strDay.substr(0,3) + '<br /></th>');
		idxCalendarDates++; 
		}
	document.write('</tr></thead>');
	// Write table footer.
	document.write('<tfoot><tr>');
	document.write('<td colspan="5" style="font-style: italic;">* Midwest Mountaineering will be closed<br />during the following hours for Expo set-up:<br />Wed after 5 p.m., Thu until 5 p.m., Fri until 4 p.m.<br />* We open one hour early on Saturday and Sunday! <p style="margin: 0px 3px; margin-top: 3px; text-align: center;"><a href="http://www.thriftyoutfitters.com/" target="_blank">Thrifty Outfitters</a> is open normal hours during expo set-up.&nbsp; Enter Thrifty Outfitters from Cedar Ave during Expo setup.</p></td>');
	document.write('</tr></tfoot>');
	// Write table body.
	document.write('<tbody><tr>');

	// Write rows of data.
	for (var idxCalendarDates = 0; idxCalendarDates < aryExpoWeekDatesHours.length; idxCalendarDates++)
		{
		// Get day field from calendar dates array.
		var datToday = new Date(aryExpoWeekDatesHours[idxCalendarDates]);
		strDay = String(aryDayNames[datToday.getDay()]);
		datDate = aryExpoWeekDatesHours[idxCalendarDates]; 
		// Create a cell in the table for this calendar day from calendar dates array.
		strDD = datDate.substring(3,5);
		if (idxCalendarDates == 0)
			{
			document.write('<td style=\"cursor: default\" title=\"Expo Setup\">');	
			}
		if (idxCalendarDates == 2)
			{
			document.write('<td style=\"cursor: default\" title=\"Customer Appreciation Night\">');	
			}
		if (idxCalendarDates >= 4)
			{
			document.write('<td style=\"cursor: default\" title=\"Outdoor Adventure Expo\">');	
			}
		idxCalendarDates++; 
		document.write('<div class="date">' + strDD + '</div>');
		if (idxCalendarDates >= 4)
			{
			document.write('<b>');
			document.write('<div class="dayNote">' + aryExpoWeekDatesHours[idxCalendarDates] + '</div>');
			document.write('</b>');
			}
		else
			{
			document.write('<div class="dayNote">' + aryExpoWeekDatesHours[idxCalendarDates] + '</div>');
			}
		document.write('</td>');
		}
	// Close body, table.
	document.write('</tr></tbody></table>');
	}


// End of OAE-ExpoWeekHoursCalendar.js
