function tmHolidays(nYear, nHoliday)
{
	var nTh;
	var nMonth;
	var nTargetday;
	var nEarliestDate;
	var nWeekday;
	var thisDate;
	
	if (nHoliday == "") {
		return nHoliday;
	}
	switch(nHoliday)
	{
	  case "ML King Day":
	  case 1:  // ML King Day
		  nTargetday = 1;
		  nMonth = 0;
		  nTh = 3;
		  break;
	  case "Presidents Day":
	  case 2:  // Presidents Day
		  nTargetday = 1;
		  nMonth = 1;
		  nTh = 3;
		  break;
	  case "Memorial Day":
	  case 3:  // Memorial Day
		  nTargetday = 1;
		  nMonth = 4;
		  nTh = 4;
		  break;
	  case "Labor Day":
	  case 4:  // Labor Day
		  nTargetday = 1;
		  nMonth = 8;
		  nTh = 1;
		  break;
	  case "Columbus Day":
	  case 5:  // Columbus Day
		  nTargetday = 1;
		  nMonth = 9;
		  nTh = 2;
		  break;
	  case "Election Day":
	  case 6:  // Election Day
		  nTargetday = 1;
		  nMonth = 10;
		  nTh = 1;
		  break;
	  case "Thanksgiving Day":
	  case 7:  // Thanksgiving Day
		  nTargetday = 4;
		  nMonth = 10;
		  nTh = 4;
		  break;
	  case "Black Friday":
	  case 7:  // Black Friday
		  nTargetday = 5;
		  nMonth = 10;
		  nTh = 4;
		  break;
	  case "Saturday Before Halloween":
	  case 8:  // Saturday Before Halloween
		  nTargetday = 6;
		  nMonth = 9;
		  nTh = 4;
		  break;
	  default:
	      
	}
		
	nEarliestDate = 1 + 7 * (nTh - 1);
	thisDate = new Date(nYear,nMonth,nEarliestDate);
	nWeekday = thisDate.getDay()	
	
	if (nTargetday == nWeekday ) {
		nOffset = 0;
	}
	else
	{
	  if (nTargetday < nWeekday) {
		  nOffset = nTargetday + (7 - nWeekday);
	  }
	  else {
		  nOffset = (nTargetday + (7 - nWeekday)) - 7;
	  }
	}	
	if (nHoliday == 3 || nHoliday == "Memorial Day") {
		if ((nEarliestDate + nOffset + 7) <= 31) {
			nEarliestDate += 7;
		}
	}
	else if (nHoliday == 6 || nHoliday == "Election Day") {
		nEarliestDate += 1;
	}
	else if (nHoliday == 8 || nHoliday == "Saturday Before Halloween") {
		if ((nEarliestDate + nOffset + 7) <= 31) {
			nEarliestDate += 7;
		}
	}
		
	var tHolidayDate = new Date(nYear, nMonth, nEarliestDate + nOffset);
	
	return tHolidayDate;
}
// ****************************************************************************
// ****************************************************************************
// ****************************************************************************
function dayOfWeekForHoliday(nYear, nHoliday)
{
	var h;
	var dayOfWeek;
	
	switch (nHoliday)
	{
	  case "Christmas Day":
	  case 1:  // Christmas Day
		  h = new Date(nYear, 12, 25);
		  break;
	  case "Independence Day":
	  case 2:  // Independence Day
		  h = new Date(nYear, 7, 4);
		  break;
	  case "Halloween":
	  case 3:  // Halloween
		  h = new Date(nYear, 10, 31);
		  break;
	}
	
	dayOfWeek = h.getDay();
	
	return dayOfWeek;
	
}
