function populateEvents(x)
{ 
//<!-- Begin
var count = 0;
var upcommingcount = 0;
var pastcount = 0;
var calEvent = [
// ******************************************************************
// JavaScript by: Jon Couch
// ******************************************************************
// Do not change any thing above this comment line.
// This is where you type in the events. Please follow pattern. 
// ["##/##/####","explain the event"],
// If this pattern is not followed the program will no work correctly
// ******************************************************************



["11/16/2011","PACA Event - Boeing Tour (luncheon)"],
["01/12/2012","PACA Event - Post Holiday Gala"],
["02/08/2012","PACA Event - Regulatory Panel Discussion"],
["04/11/2012","PACA Event - Air National Guard (luncheon)"],
["05/10/2012","PACA Event - Fun Night"],
["07/28/2012","PACA Event - Very Wide Open Golf Tourney"],












[" "," "],
// ***********************************************
// Do not change anything below this comment line.
// ***********************************************
];


if (x == 1) 
	{
	document.write("<b>Past Events:</b><br>");
	for (var y = 0; y < (calEvent.length -1); y++)
	{
		var days = 0;
		var difference = 0;
		eventDate = new Date(calEvent[y][0]);
		today = new Date();
		today.setHours(00);
		today.setMinutes(00);
		today.setSeconds(00);
		today.setMilliseconds(00);
		difference = eventDate - today;
		days = Math.round(difference/(1000*60*60*24));
		if (days < 0)
			{
			document.write(calEvent[y][0] + "  " + calEvent[y][1] + "<br>");
			pastcount++;
			}
	}
	if (pastcount == 0) 
		{
		document.write("There are no past events available<br>");
		}


	document.write("<br><b>Upcoming Events:</b><br>");
	for (var z = 0; z < (calEvent.length -1); z++)
	{
		var days = 0;
		var difference = 0;
		eventDate = new Date(calEvent[z][0]);
		today = new Date();
		today.setHours(00);
		today.setMinutes(00);
		today.setSeconds(00);
		today.setMilliseconds(00);
		difference = eventDate - today;
		days = Math.round(difference/(1000*60*60*24));
		if (days >= 0)
			{
			document.write(calEvent[z][0] + "  "  + calEvent[z][1] + "<br>");
			upcommingcount++;
			}
	}
	if (upcommingcount == 0) 
		{
		document.write("There are no upcoming events available<br>");
		}
}



if (x == 2)
	{
	document.write("<b>Upcoming events</b><br>");
	for (var j = 0; j < (calEvent.length -1); j++)	
		{
		var days = 0;
		var difference = 0;
		eventDate = new Date(calEvent[j][0]);
		today = new Date();
		today.setHours(00);
		today.setMinutes(00);
		today.setSeconds(00);
		today.setMilliseconds(00);
		difference = eventDate - today;
		days = Math.round(difference/(1000*60*60*24));
		if (days >= 0 && count < 2)
			{
			document.write(calEvent[j][0] + "  "  + calEvent[j][1] + "<br>");
			count++;
			}
		}
	if (count == 0) 
		{
		document.write("There are no upcoming events available<br>");
		}
	}



}//  End -->
