// JavaScript Document

<!--

function JSFG_writeNextMeetingTable() {

	htmlCode = 
'	<TABLE WIDTH="95%"  BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">' +
'	<TR>' +
'		<TH WIDTH="43%">Next Meeting</TH>' +
'		<TH WIDTH="44%">Date</TH>' +
'		<TH WIDTH="13%">Time</TH>' +
'	</TR>' +
'	<TR>' +
'		<TD><CENTER>New Member  Orientation Meeting</CENTER></TD>' +
'		<TD><CENTER>'

			document.write(htmlCode)
	
			// This JavaScript sets the next meeting date automatically 
			// Initialize variables to be used
			// Initialize X to the day the meeting is held (Sunday=0, Monday=1, ...)
			var X = 1;  // Regular meeting day is Monday
			// Initialize Y to the hour the meeting ends (Military time - 0..23 hours)
			var Y = 12; // Meeting ends at 12:00 P.M. (Noontime)
			// Create Date that contains current date
			var D = new Date();
			// Format the current date output string
			var S = D.toLocaleDateString();
			// Adjust date according to current date and time
			// Check for holidays - If today is a holiday, set the meeting
			// date to tomorrow (Note: These dates must be updated each year
			// to correspond to the HPCUMC holiday schedule)
			if ( S == "Monday, January 17, 2005" ||
				  S == "Monday, February 21, 2005" ||
				  S == "Monday, April 12, 2005" ||
				  S == "Monday, May 30, 2005" ||
				  S == "Monday, July 04, 2005" ||
				  S == "Monday, September 05, 2005" ||
				  S == "Monday, December 26, 2005")
			 {
			  D.setDate( D.getDate() + 1);
			  // Debug comments
			  // document.write("Current day is a holiday");
			  // document.write("  Calculated Day is: ");
			  // document.write(D.getDay());
			  // document.write("  Calculated Hour is: ");
			  // document.write(D.getHours());
			  // document.write("  Calculated Date is: ");
			  // document.write(D.getDate());
			 }// end of if (check holidays) clause
			else
			 {
			  // Check for regular meeting day - If today is not a holiday,
			  // and today is not a regular meeting day, calculate the next
			  // meeting day.
			  if ( D.getDay() != X )
				{
				 // if today is not the day after a holiday, calculate
				 // next meeting normally
				 // else if today is a holiday and the time is afternoon,
				 // calculate next regular meeting date
				 // Format the calculated next meeting date output string
				 var S = D.toLocaleDateString()		
				 if (!( S == "Tuesday, January 18, 2005" ||
						  S == "Tuesday, February 22, 2005" ||		
						  S == "Tuesday, April 13, 2004" ||
						  S == "Tuesday, June 1, 2004" ||
						  S == "Tuesday, July 06, 2004" ||
						  S == "Tuesday, September 07, 2004" ||
						  S == "Tuesday, December 28, 2004"))
				  {
					D.setDate( D.getDate() + ((6+X-D.getDay()) % 7) + 1 );
					// Debug comments
					// document.write("Today is not a holiday nor the day after and it is not the regular meeting day.");
					// document.write("  Calculated Day is: ");
					// document.write(D.getDay());
					// document.write("  Calculated Hour is: ");
					// document.write(D.getHours());
					// document.write("  Calculated Date is: ");
					// document.write(D.getDate());
				  }// end if clause
				 else
				  {
					if ( D.getHours() >= 12 )
					 {
					  D.setDate( D.getDate() + ((6+X-D.getDay()) % 7) + 1 );
					  // Debug comments
					  // document.write("Today is not a holiday but it is the meeting day because it is the day after a holiday and the meeting is over.");
					  // document.write("  Calculated Day is: ");
					  // document.write(D.getDay());
					  // document.write("  Calculated Hour is: ");
					  // document.write(D.getHours());
					  // document.write("  Calculated Date is: ");
					  // document.write(D.getDate());
					 }// end of if (D.getHours() >= 12) clause
				  }// end of else clause
				}// end of if(D.getDay() != X) clause
			  else
				{
				 // Check to see if meeting is over - If today is not a holiday
				 // and it is a regular meeting day, and if the meeting is over
				 // then calculate the next meeting day.  Otherwise, take no
				 // action.
				 if ( D.getHours() >= 12 )
				  {
					D.setDate( D.getDate() + ((6+X-D.getDay()) % 7) + 1 );
					// Debug comments
					// document.write("Today is not a holiday but it is the meeting day and the meeting is over.");
					// document.write("  Calculated Day is: ");
					// document.write(D.getDay());
					// document.write("  Calculated Hour is: ");
					// document.write(D.getHours());
					// document.write("  Calculated Date is: ");
					// document.write(D.getDate());
				  }// end of if (D.getHours() >= 12) clause
				}// end of else if (D.getDay() != X) clause
			 }// end of else if (check for holidays) clause
			// Format the calculated next meeting date output string
			var S = D.toLocaleDateString()
			// Check for holidays - If calculated day is a holiday, set the meeting
			// date to the next day (Note: These dates must be updated each year
			// to correspond to the HPCUMC holiday schedule)		
			if ( S == "Monday, January 17, 2005" ||
				  S == "Monday, February 21, 2005" ||		
				  S == "Monday, April 12, 2004" ||
				  S == "Monday, May 30, 2005" ||
				  S == "Monday, July 04, 2005" ||
				  S == "Monday, September 05, 2005")		
				  //  S == "Monday, December 26, 2005")
			{
				D.setDate( D.getDate() + 1);
				// Debug comments
				// document.write("\nOriginal calculated date is a holiday");
				// document.write("  Re-calculated Day is: ");
				// document.write(D.getDay());
				// document.write("  Re-calculated Hour is: ");
				// document.write(D.getHours());
				// document.write("  Re-calculated Date is: ");
				// document.write(D.getDate());
			}	// end of if (check holidays) clause		
			// Check for week between Christmas and New Years
			// - If calculated day is Dec. 27 2004, set the meeting
			// date to the next week on Tuesday Jan 4
			// (Note: These dates must be updated each year
			// to correspond to the HPCUMC holiday schedule)		
			if ( S == "Monday, December 26, 2005")
			{
			  D.setDate( D.getDate() + 8);
			  // Debug comments
			  // document.write("\nOriginal calculated date is a holiday");
			  // document.write("  Re-calculated Day is: ");
			  // document.write(D.getDay());
			  // document.write("  Re-calculated Hour is: ");
			  // document.write(D.getHours());
			  // document.write("  Re-calculated Date is: ");
			  // document.write(D.getDate());
			 }// end of if (check holidays) clause
			// Format the final calculated date output string
			var S = D.toLocaleDateString()
			// Write the final calculated date output string to the page
			
			document.write(S)

	htmlCode = 
'	</CENTER></TD>' +
'		<TD><CENTER>8:00AM</CENTER></TD>' +
'	</TR>' +
'	<TR>' +
'		<TD><CENTER>General Membership Meeting</CENTER></TD>' +
'		<TD><CENTER>'
		
	document.write(htmlCode)
	
			<!-- This JavaScript sets the next meeting date automatically 
			var S = D.toLocaleDateString()
			// Write the calculated date out to the page

			document.write(S)

	htmlCode = 
'	</CENTER></TD>' +
'		<TD><CENTER>9:00 AM</CENTER></TD>' +
'	</TR>' +
'	</TABLE>'

	document.write(htmlCode)
}
-->