//This script is desgined to house javascript functions used throughout the web site.



function checkContactForm(form)

{

	var name = window.ContactForm.CustomerName.value.replace(/\s/g, "");

	var email = window.ContactForm.EmailAddress.value.replace(/\s/g, "");

	var solution = window.ContactForm.NeededSolution.value.replace(/\s/g, "");

	var source = window.ContactForm.Source.value.replace(/\s/g, "");



	//window.alert(name);



	if (name == "")

	{

		window.alert("Please complete the name field.");

		window.ContactForm.CustomerName.focus();

		window.ContactForm.CustomerName.select();

		return false;

	}



	if (email == "")

	{

		window.alert("Please complete the email field.");

		window.ContactForm.EmailAddress.focus();

		window.ContactForm.EmailAddress.select();

		return false;

	}



	if (solution == "")

	{

		window.alert("Please select a business solution.");

		window.ContactForm.NeededSolution.focus();

		return false;

	}



	if (source == "")

	{

		window.alert("Please select a referral source.");

		window.ContactForm.Source.focus();

		return false;

	}



	return true;

}





function checkEmailForm(form)

{

	var from = window.EmailForm.CustomerEmailAddress.value.replace(/\s/g, "");

	var subject = window.EmailForm.EmailSubject.value.replace(/\s/g, "");

	var body = window.EmailForm.EmailBody.value.replace(/\s/g, "");



	if (from == "")

	{

		window.alert("Please complete the from field.");

		window.EmailForm.CustomerEmailAddress.focus();

		window.EmailForm.CustomerEmailAddress.select();

		return false;

	}



	if (subject == "")

	{

		window.alert("Please complete the subject field.");

		window.EmailForm.EmailSubject.focus();

		window.EmailForm.EmailSubject.select();

		return false;

	}



	if (body == "")

	{

		window.alert("Please enter a message.");

		window.EmailForm.EmailBody.focus();

		window.EmailForm.EmailBody.select();

		return false;

	}



	return true;

}





function checkTAForm(form)

{

	//window.alert("Hello");



	var name = window.TechnicalAssistance.CustomerName.value.replace(/\s/g, "");

	var email = window.TechnicalAssistance.EmailAddress.value.replace(/\s/g, "");

	var company = window.TechnicalAssistance.Company.value.replace(/\s/g, "");

	var product = window.TechnicalAssistance.Product.value.replace(/\s/g, "");

	var version = window.TechnicalAssistance.ProductVersion.value.replace(/\s/g, "");

	var issue = window.TechnicalAssistance.Issue.value.replace(/\s/g, "");



	if (name == "")

	{

		window.alert("Please complete the name field.");

		window.TechnicalAssistance.CustomerName.focus();

		window.TechnicalAssistance.CustomerName.select();

		return false;

	}



	if (email == "")

	{

		window.alert("Please complete the email field.");

		window.TechnicalAssistance.EmailAddress.focus();

		window.TechnicalAssistance.EmailAddress.select();

		return false;

	}



	if (company == "")

	{

		window.alert("Please complete the company field.");

		window.TechnicalAssistance.Company.focus();

		window.TechnicalAssistance.Company.select();

		return false;

	}



	if (product =="")

	{

		window.alert("Please enter a product.");

		window.TechnicalAssistance.Product.focus();

		return false;

	}



	if (version == "")

	{

		window.alert("Please enter a version.");

		window.TechnicalAssistance.ProductVersion.focus();

		window.TechnicalAssistance.ProductVersion.select();

		return false;

	}



	if (issue == "")

	{

		window.alert("Please complete the issue field.");

		window.TechnicalAssistance.Issue.focus();

		window.TechnicalAssistance.Issue.select();

		return false;

	}



	return true;

}







//This function will generate the HTML necessary to accept user search criteria.

function generateSearchForm()

{

	//window.alert("Test");



	document.writeln ("<SCRIPT LANGUAGE=JAVASCRIPT>");

	document.writeln ("function check_entries()");

	document.writeln ("{");

	document.writeln ("if (Search_engine.Search_criteria.value == '')");

	document.writeln ("{");

	document.writeln ("window.alert('Please submit search criteria');");

	document.writeln ("document.Search_engine.Search_criteria.focus();");

	document.writeln ("document.Search_engine.Search_criteria.select();");

	document.writeln ("return false;");

	document.writeln ("}");

	document.writeln ("document.Search_engine.SubmitValue.value=document.Search_engine.submitButton;");

	document.writeln ("return true;");

	document.writeln ("}");



	document.writeln ("function place_cursor()");

	document.writeln ("{");

	document.writeln ("document.Search_engine.Search_criteria.focus();");

	document.writeln ("document.Search_engine.Search_criteria.select();");

	document.writeln ("}");



	document.writeln ("</SCRIPT>");



	document.writeln ("<FORM NAME=\"Search_engine\" onSubmit=\"return check_entries()\" METHOD=POST ACTION=\"http://www.victorpendleton.net/searchEngine/\">");

	document.writeln ("<INPUT TYPE=TEXT NAME=\"Search_criteria\" MAXLENGTH=100 SIZE=10>");

	document.writeln ("");

	document.writeln ("<INPUT TYPE=HIDDEN NAME=\"SubmitValue\" VALUE=\"test\">");

	document.writeln ("<INPUT TYPE=SUBMIT NAME=\"Search\" VALUE=\"Find\" onClick=\"this.form.submitButton = this.name; return true;\">");

	document.writeln ("</FORM>");



	document.writeln ("<SCRIPT LANGUAGE=JAVASCRIPT>");

	document.writeln ("place_cursor();");

	document.writeln ("</SCRIPT>");

}





//This function will generate the custom title for each web page

//Created March 27, 2002

function generateTitle(strTitle)

{

	document.writeln("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF WIDTH=\"100%\" HEIGHT=50>");

	document.writeln("<TR>");

	document.writeln("<TD ALIGN=CENTER WIDTH=\"100%\">");

	document.write("<SPAN CLASS=\"title\">");

	document.write(strTitle);

	document.writeln("</SPAN>");

	document.writeln("</TD>");

	document.writeln("</TR>");

	document.writeln("</TABLE>");

}







//This function is designed to modularize the creation of the page layouts

function createPage(intAction)

{

	switch (intAction)

	{

		case 10:

			//Create the opening table structure and the first column

			document.writeln("<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0");

			document.writeln("<TR WIDTH=\"100%\">");

			document.writeln("<TD WIDTH=100 VALIGN=TOP BGCOLOR=#FFFFFF>");

			break;

		case 20:

			//Closing the first column and creating the second column

			document.writeln("</TD>");

			document.writeln("<TD WIDTH=500 VALIGN=TOP>");

			break;

		case 30:

			//Closing the second column and closing the table structure

			document.writeln("</TD>");

			document.writeln("</TR>");

//			document.writeln("<TR>");

//			document.writeln("<TD ALIGN=CENTER COLSPAN=2>");

//			document.writeln("<A HREF=\"mailto:info@victorpendleton.net\">Inform us of any difficulties you may have using this site</A>");

//			document.writeln("</TD>");

//			document.writeln("</TR>");

			document.writeln("</TABLE>");

			break;

		default:

			break;

	}	

}





function checkLogOnForm(form)

{

	var userID = window.LogOn.UserID.value.replace(/\s/g, "");

	var password = window.LogOn.Password.value.replace(/\s/g, "");



	if (userID == "")

	{

		window.alert("Please enter an userID.");

		window.LogOn.UserID.focus();

		window.LogOn.UserID.select();

		return false;

	}



	if (password == "")

	{

		window.alert("Please enter a password.");

		window.LogOn.Password.focus();

		window.LogOn.Password.select();

		return false;

	}



	return true;

}





function processCustomer(acctID)

{

	//window.alert(document.customers.actionFlag.value);

	document.customers.acctID.value = acctID;

	document.customers.submit();

}



function customersForm(action)

{

	switch (action)

	{		

		case 20:

			var firstName = window.customers.firstName.value.replace(/\s/g, "");

			var lastName = window.customers.lastName.value.replace(/\s/g, "");

			var userID = window.customers.userID.value.replace(/\s/g, "");

			var password = window.customers.password.value.replace(/\s/g, "");



			if (firstName == '')

			{

				window.alert("Please enter a first name.");

				window.customers.firstName.focus();

				window.customers.firstName.select();

				return false;

			}



			if (lastName == '')

			{

				window.alert("Please enter a last name.");

				window.customers.lastName.focus();

				window.customers.lastName.select();

				return false;

			}



			if (userID == '')

			{

				window.alert("Please select an userID.");

				window.customers.userID.focus();

				window.customers.userID.select();

				return false;

			}



			if (password == '')

			{

				window.alert("Please enter a password.");

				window.customers.password.focus();

				window.customers.password.select();

				return false;

			}



			return true;

			

			break;

		case 60:

			var firstName = window.customers.firstName.value.replace(/\s/g, "");

			var lastName = window.customers.lastName.value.replace(/\s/g, "");

			var password = window.customers.password.value.replace(/\s/g, "");

			var updatePassword = window.customers.updatePassword.value.replace(/\s/g, "");



			if (firstName == '')

			{

				window.alert("Please enter a first name.");

				window.customers.firstName.focus();

				window.customers.firstName.select();

				return false;

			}



			if (lastName == '')

			{

				window.alert("Please enter a last name.");

				window.customers.lastName.focus();

				window.customers.lastName.select();

				return false;

			}



			//Verify that a password has been entered

			if (password == '')

			{

				window.alert("Please enter a password.");

				window.customers.password.focus();

				window.customers.password.select();

				return false;

			}



			return true;

			break;

		default:

			return true;

	}

}





function releaseForm(action)

{

//	window.alert(action);

	var intSearchFromPos;

	switch (action)

	{		

		case 80:

		//Inserting information into the system

			var fileName = window.release.fileName.value.replace(/\s/g, "");

			var fileVersion = window.release.fileVersion.value.replace(/\s/g, "");

			var fileLocation = window.release.fileLocation.value.replace(/\s/g, "");



			if (fileName == "")

			{

				window.alert("Please enter a file name.");

				window.release.fileName.focus();

				window.release.fileName.select();

				return false;

			}



			if (fileVersion == "")

			{

				window.alert("Please enter a file version.");

				window.release.fileVersion.focus();

				window.release.fileVersion.select();

				return false;

			}



			if (fileLocation == "")

			{

				window.alert("Please enter a file location.");

				window.release.fileLocation.focus();

				window.release.fileLocation.select();

				return false;

			}

			else

			{

				intSearchFromPos = window.release.fileLocation.value.lastIndexOf("\\");

				var downloadname = window.release.fileLocation.value.substr(intSearchFromPos + 1);

				if (downloadname == "")

				{

					window.alert("Please select a file to download.");

					return false;

				}

				else

				{

					window.release.downloadname.value = downloadname.replace(/\s/g, "%20");

				}

			}



			return true;

			

			break;

		default:

			return true;

	}

}





//This form is designed to store the release information into a variable

//to pass to the calling page.

function storeReleaseInfo(arrayReleaseInfo)

{

	var releaseInfo;

	releaseInfo = arrayReleaseInfo;

	window.release.releaseInfo.value = releaseInfo;

	//window.alert(window.release.releaseInfo.value.replace(/\s/g, ""));

	window.release.submit();

}





//This function is designed to house actions that should be taken on the search engine pages.

function searchEngineMaintenance(pageIndicator)

{			

	switch (pageIndicator)

	{

		case 10:	//An entry is being submitted into the search engine

			if(document.searchEngine.page_name.value.replace(/\s/g, "") == '')

			{

				document.searchEngine.page_name.focus();

				document.searchEngine.page_name.select();

				window.alert("Please enter a Page name.");

								

				return false;

			}



			if (document.searchEngine.page_location.value.replace(/\s/g, "") == '')

			{

				document.searchEngine.page_location.focus();

				document.searchEngine.page_location.select();

				window.alert("Please enter the location of the target page.");

							

				return false;

			}



			if (document.searchEngine.page_url.value.replace(/\s/g, "") == '')

			{

				document.searchEngine.page_url.focus();

				document.searchEngine.page_url.select();

				window.alert("Please enter the url of the target page.");

							

				return false;

			}



			break;

		case 20:	//An existing entry is being updated in the search engine

			break;

		default:

			break;

	}



	return true;

}





function generatePageInformation(intPageID)

{

	if (intPageID == '')

	{

		window.alert("An error occurred while retrieving page information. Please try again or contact your administrator.");



		return false;

	}

	else

	{

		//window.alert(intPageID);

		document.searchEngine.pageID.value = intPageID;

		//window.alert(document.searchEngine.pageID.value);

		document.searchEngine.submit();



		return true;

	}

}



function removePage(intPageID)

{

	var intMessage;



	if (intPageID == '')

	{

		window.alert("An error occurred while removing the page information. Please try again or contact your administrator.");



		return false;

	}

	else

	{

		if (confirm("Are you sure you want to remove this page?"))

		{

			document.searchEngine.pageID.value = intPageID;

			document.searchEngine.processFlag.value = '69';

			document.searchEngine.submit();



			return true;

		}

		else

		{

			return false;

		}

	}

}





//The following global variable and two functions will be used to capture and

//submit recipients for the activeUsers and private messaging functionality.

var userArray = new Array();





//Used to populate the userArray array with the intended recipients.

function activeUsers (strUserID)

{

	var actionFlag=0;

	var numberOfUsers = userArray.length;

	//window.alert(numberOfUsers);

	if (numberOfUsers == 0)

	{

		removed = userArray.splice(0,0,strUserID);

	}

	else

	{

		//Verify that the string does not already exist in the Array

		//If so remove the string, else add it.

		for (i=0; i<=numberOfUsers; i++)

		{

			if (userArray[i] == strUserID)

			{

				window.alert('Removing the user from the recipient list.');

				removed = userArray.splice(i, 1)

				actionFlag = -1;

			}

		}



		//The userId does not exist in the array, add the User to the array

		if (actionFlag == 0)

		{

			removed = userArray.splice(0,0,strUserID);

		}

	}

	//window.alert(strUserID);

}





//Used to populate the recipients variable from the userArray array

function generateUserList()

{ 

	var strRecipientsFromArray = ' ';

	var numberOfUsers = userArray.length;

	//window.alert(numberOfUsers);

	if (numberOfUsers == 0)

	{

		window.alert('Please select a message recipient');

		return false;

	}

	else

	{

		for (i=0; i<numberOfUsers; i++)

		{

			if (i==0)

			{

				//window.alert(userArray[i]);

				strRecipientsFromArray = userArray[i];

				//window.alert(strRecipientsFromArray);

			}

			else

			{

				//window.alert(strRecipientsFromArray);

				strRecipientsFromArray = strRecipientsFromArray + userArray[i];

			}



			if ( (i==0 && numberOfUsers > 1) || (i<numberOfUsers-1) )

			{

				//window.alert(strRecipientsFromArray);

				strRecipientsFromArray = strRecipientsFromArray + ',';

			}

		}

		parent.frames["Post"].message.recipients.value = strRecipientsFromArray;



//		window.alert(strRecipientsFromArray);

		return true;

	}

}





function printPage() 

{

	window.print();

  	//setTimeout('window.close()', 2000);

}





function processOrderID(orderID)

{

	document.customers.orderID.value = orderID;

	document.customers.submit();

}





//Added 10:50 PM 5/21/2003 for Project Management

//This form is designed to store the projectID into a variable

//to pass to the calling page.

function storeProjectID(projectID)

{

	var storedProjectID;

	storedProjectID = projectID;

	window.listProjects.projectID.value = storedProjectID;

	//window.alert(window.release.releaseInfo.value.replace(/\s/g, ""));

	window.listProjects.submit();

}





//Added 10:50 PM 5/21/2003 for Project Management

//Modified 1:05 PM 5/22/2003. Calling the check_dates() function to check times.
//Modified 3:30 PM 5/22/2003. This for is now accepting hour, minute and am/pm data.
//Modified 10:35 PM 5/22/2003. Adding logic to handle midnight and noon scenarios.
//Modified 10:08 AM 5/23/2003 to coerce hour and minutes into the expected format.
function checkProjectTime(form)

{

	var curDate = window.logHours.start_date.value.replace(/\s/g, "");

	var hours = window.logHours.hoursWorked.value.replace(/\s/g, "");
	var minutes = window.logHours.minutesWorked.value.replace(/\s/g, "");

	var calculatedHours = 0;


	//Check the start/stop hour/minutes.
	var startHour = window.logHours.startHour.value.replace(/\s/g, "");
	var startMinute = window.logHours.startMinute.value.replace(/\s/g, "");
	var stopHour = window.logHours.stopHour.value.replace(/\s/g, "");
	var stopMinute = window.logHours.stopMinute.value.replace(/\s/g, "");

	//To conform with the expected format the hours/minutes must be a length of two
	if ( startHour.length == 1)
	{
		startHour = "0" + startHour;
	}
	if ( startMinute.length == 1)
	{
		startMinute = "0" + startMinute;
	}
	if ( stopHour.length == 1)
	{
		stopHour = "0" + stopHour;
	}
	if ( stopMinute.length == 1)
	{
		stopMinute = "0" + stopMinute;
	}


	var startAM = window.logHours.startAMPM.value;
	var stopAM = window.logHours.stopAMPM.value;
	var start;
	var stop;

	if ( curDate == "" )

	{

		window.alert("Please enter a date.");

		window.logHours.start_date.focus();

		window.logHours.start_date.select();

		return false;

	}

	else

	{

		//window.logHours.date.value = window.logHours.date.replace(/\//g, "")

	}



	if ( (hours == "") && (minutes == "") )

	{

		if ( (startHour != "") && (startHour > 0) && (startHour < 13) && !(isNaN(startHour)) )
		{
			if ( (startMinute != "") && (startMinute >= 0) && (startMinute < 60) && !(isNaN(startMinute)) )
			{
				if ( (stopHour != "") && (stopHour > 0) && (stopHour < 13) && !(isNaN(stopHour)) )
				{
					if ( (stopMinute != "") && (stopMinute >= 0) && (stopMinute < 60) && !(isNaN(stopMinute)) )
					{
						//Is this in the afternoon?
						if (startAM == 1)
						{
							//Check for the midnight hour
							if ( startHour == "12" )
							{
								start = "00" + startMinute;
							}
							else
							{
								start = startHour + startMinute;
							}
						}
						else
						{
							//check for the noon hour
							if ( startHour == "12" )
							{
								start = startHour + startMinute;
							}
							else
							{
								start = ( parseInt(12) + parseInt(startHour) ) + startMinute;
							}
						}

						if (stopAM == 1)
						{

							//Check for the midnight hour
							if ( stopHour == "12" )
							{
								stop = "00" + stopMinute;
							}
							else
							{
								stop = stopHour + stopMinute;
							}
						}
						else
						{
							//check for the noon hour
							if ( stopHour == "12" )
							{
								stop = stopHour + stopMinute;
							}
							else
							{
								stop = ( parseInt(12) + parseInt(stopHour) ) + stopMinute;
							}
						}
						window.logHours.startTime.value = start;
						window.logHours.stopTime.value = stop;

						//window.alert(start);
						//window.alert(stop);
						//return false;
						return checkTimes(start, stop);
					}//Done checking the stop minute
					else
					{
						window.alert("Please enter a valid stop minute.");
						window.logHours.stopMinute.focus();

						window.logHours.stopMinute.select();

						return false;
					}
				}//Done checking the stop hour
				else
				{
					window.alert("Please enter a valid stopping hour.");
					window.logHours.stopHour.focus();

					window.logHours.stopHour.select();

					return false;
				}
			}//Done checking start Minute
			else
			{
				window.alert("Please enter a valid start minute.");
				window.logHours.startMinute.focus();

				window.logHours.startMinute.select();

				return false;
			}
		}//Done checking start hour
		else
		{
			window.alert("Please enter a valid start hour.");
			window.logHours.startHour.focus();

			window.logHours.startHour.select();

			return false;
		}
	}//Done checking the hoursWorked field
	else
	{
		//verfiy that the hoursWorked is numeric.
		//Convert the number of hours worked to clock hours starting at 0800.
		if ( (hours >= 0) && (parseFloat(hours) < parseFloat(16)) && !(isNaN(hours)) )
		{
			//Verify that the minutesWorked is numeric
			if ( (minutes >= 0) && (parseFloat(minutes) < parseFloat(60)) && !(isNaN(minutes)) )
			{
				//Set the start time to 06:00
				window.logHours.startTime.value = '06:00';
				//Set the stop time to 08:00 plus hoursWorked
				window.logHours.stopTime.value = parseFloat( parseFloat(6) + parseFloat(hours) ) + ':' + minutes;
			
				//window.alert(window.logHours.stopTime.value);
				return true;
			}
			else
			{
				window.alert("Invalid entry for minutes.");
				window.logHours.minutesWorked.focus();
				window.logHours.minutesWorked.select();
				return false;
			}
		}
		else
		{
			window.alert("Invalid number of hours.");
			window.logHours.hoursWorked.focus();
			window.logHours.hoursWorked.select();
			return false;
		}
	}

}





//Added 10:50 PM 5/21/2003 for Project Management

function logMoreHours()

{

	if ( confirm("Would you like to log more hours?") )

	{

		//window.location.replace("http://www.localhost/prueba/support/index.htm");

	}

	else

	{

		//window.location.replace("http://www.localhost/prueba/support/index.htm");

	}

}


//Add May 22, 2003 at 11:19.
// This function will check to make sure that the Start date is not greater than the end date
function checkTimes(startTime, endTime)
{
	if ( startTime >= endTime )
	{
		window.alert('The Stopping time must be greater than the Starting time.');
		return false;
	}

	return true;
}


//Add May 22, 2003 at 11:19.
// This function will dynamically generate a drop list containing the years for the calendar
// This funciton is being modified to calculate one year prior as well.
function generate_year()
{
	var current_date = new Date();
	current_year = current_date.getFullYear();
	//window.alert(current_year);
		
	document.write("<SELECT NAME=Year ID=Year>");
	for (i = 1; i < 4; i++)
	{
		switch (i)
		{
			case 1:
				--current_year;
				document.write("<OPTION VALUE="+ current_year + " >" + current_year );
				break;
			case 2:
				current_year++;
				document.write("<OPTION VALUE="+ current_year + " SELECTED>" + current_year );
				break;
			default:
				current_year++;
				document.write("<OPTION VALUE="+ current_year + " >" + current_year );
				break;
		}
		
	}
	document.write("<\/SELECT>");
}


//Add May 22, 2003 at 11:19.
// This function will generate a drop list for the months that will be used for the calendar
function generate_month()
{
	var current_date = new Date();
	current_month = current_date.getMonth();

	switch (current_month)
	{
		case 0:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 1:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0>January");
			document.write("<OPTION VALUE=1 SELECTED>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 2:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2 SELECTED>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 3:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3 SELECTED>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 4:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4 SELECTED>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 5:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5 SELECTED>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 6:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6 SELECTED>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 7:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7 SELECTED>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 8:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8 SELECTED>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 9:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9 SELECTED>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 10:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10 SELECTED>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
		break;
		case 11:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11 SELECTED>December");		
			document.write("<\/SELECT>");
		break;
		default:
			document.write("<SELECT NAME=Month ID=Month>");
			document.write("<OPTION VALUE=0 SELECTED>January");
			document.write("<OPTION VALUE=1>February");
			document.write("<OPTION VALUE=2>March");
			document.write("<OPTION VALUE=3>April");
			document.write("<OPTION VALUE=4>May");
			document.write("<OPTION VALUE=5>June");
			document.write("<OPTION VALUE=6>July");
			document.write("<OPTION VALUE=7>August");
			document.write("<OPTION VALUE=8>September");
			document.write("<OPTION VALUE=9>October");
			document.write("<OPTION VALUE=10>November");
			document.write("<OPTION VALUE=11>December");		
			document.write("<\/SELECT>");
	}
}


//Add May 22, 2003 at 11:19.
//This function generates the calendar that will be displayed
function display_date(passed_year, passed_month, passed_day, action)
{
	//var action = 1;

	var year = passed_year;
	var new_month = passed_month;
	var new_day = passed_day;
		
	var current_date = new Date(year, new_month, new_day);

	current_date.setDate(1);
	var first_of_month = current_date;

	var current_day = first_of_month.getDay();

	var current_date = first_of_month.getDate();

	var current_month = first_of_month.getMonth();

	switch (current_month)
	{
		case 0: case 2: case 4: case 6: case 7: case 9: case 11:
			last_day = 31;
			break;
		case 3: case 5: case 8: case 10:
			last_day = 30;
			break;
		case 1:
			//Determine and handle the possibility of leap year
			if ( (year % 100) == 0 )
			{
				if ( (year % 400) == 0 )
				{
					last_day = 29;
				}
				else
				{
					last_day = 28;
				}
			}
			else if ( (year % 4) == 0 )
			{
				last_day = 29;
			}
			else
			{
				last_day = 28;
			}
			break;
	}
		
	var month_name;

	switch (current_month)
	{
		case 0:
			month_name = "January";
			break;
		case 1:
			month_name = "February";
			break;
		case 2:
			month_name = "March";
			break;
		case 3:
			month_name = "April";
			break;
		case 4:
			month_name = "May";
			break;
		case 5:
			month_name = "June";
			break;
		case 6:
			month_name = "July";
			break;
		case 7:
			month_name = "August";
			break;
		case 8:
			month_name = "September";
			break;
		case 9:
			month_name = "October";
			break;
		case 10:
			month_name = "November";
			break;
		case 11:
			month_name = "December";
			break;
	}

	if (action == 1)	//Start date calendar
	{
		var status = window.document.logHours.openCalendar.value;

		switch (status)
		{
			case 'Open':

				//window.alert(window.document.logHours.Year.value);

				Start_Calendar_window = window.open("", "Start_Date_Calendar", "height=250,width=450,resizable=no");
		
				Start_Calendar_window.document.write("<HTML><HEAD>");
				Start_Calendar_window.document.write("<TITLE>START DATE CALENDAR</TITLE>");
				Start_Calendar_window.document.write("<SCRIPT LANGUAGE=\"JAVASCRIPT\">");
				Start_Calendar_window.document.write("function currentDate(message)");
				Start_Calendar_window.document.write("{ window.opener.logHours.start_date.value = message; }");
				Start_Calendar_window.document.write("<\/SCRIPT>");
				Start_Calendar_window.document.write("</HEAD><BODY>");

				Start_Calendar_window.document.write("<DIV ALIGN=CENTER>");
				Start_Calendar_window.document.write("<FORM NAME='Calendar'>");
				Start_Calendar_window.document.write("<TABLE BORDER=1 CELLPADDING=1 CELLSPACING=1>");

				Start_Calendar_window.document.write("<TR>");
				Start_Calendar_window.document.write("<TD COLSPAN=7 ALIGN=CENTER>");
				Start_Calendar_window.document.write("<B>" + month_name + "&nbsp;&nbsp;&nbsp;" + year + "</B>");
				Start_Calendar_window.document.write("</TD>");
				Start_Calendar_window.document.write("</TR>");

				Start_Calendar_window.document.write("<TR>");
				Start_Calendar_window.document.write("<TD>Sunday</TD>");
				Start_Calendar_window.document.write("<TD>Monday</TD>");
				Start_Calendar_window.document.write("<TD>Tuesday</TD>");
				Start_Calendar_window.document.write("<TD>Wednesday</TD>");
				Start_Calendar_window.document.write("<TD>Thursday</TD>");
				Start_Calendar_window.document.write("<TD>Friday</TD>");
				Start_Calendar_window.document.write("<TD>Saturday</TD>");
				Start_Calendar_window.document.write("</TR>");


				//This code will set the calendar months back to 1-12 instead of 0-11 as they are in the array.
				current_month = current_month + 1;

				switch (current_day)
				{
					case 0:
						Start_Calendar_window.document.write ("<TR>");

						current_day = 1;
								
						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}
								
							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 1:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 2;

						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");
								
							var week_ending = current_day % 7
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 2:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 3;

						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 3:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 4;

						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 4:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 5;

						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 5:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 6;
							
						for (i = 1; i <= last_day; i++)
						{
							//Start_Calendar_window.document.write("<A HREF='javascript:currentDate(" + i + ")'>");
							Start_Calendar_window.document.write("<A HREF=");
							Start_Calendar_window.document.write("\"javascript:currentDate(\'");
							Start_Calendar_window.document.write(year);
							Start_Calendar_window.document.write("/");
							Start_Calendar_window.document.write(current_month);
							Start_Calendar_window.document.write("/");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write("\')\">");
								
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}
								
							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 6:
						Start_Calendar_window.document.write ("<TR>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						Start_Calendar_window.document.write ("<TD>&nbsp;</TD>");

						current_day =7;

						for (i = 1; i <= last_day; i++)
						{
							Start_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + year + "/" + current_month + "/" + i + "\')\">");
							Start_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							Start_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							Start_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							Start_Calendar_window.document.write(i);
							Start_Calendar_window.document.write(" </SPAN> ");
							Start_Calendar_window.document.write("</TD>");
							Start_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								Start_Calendar_window.document.write("</TR>");
								Start_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								Start_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					default:
						break;
				}

				Start_Calendar_window.document.write("</TABLE>");
				Start_Calendar_window.document.write("</FORM>");
				Start_Calendar_window.document.write("</DIV>");
				Start_Calendar_window.document.write("</BODY></HTML>");

				window.document.logHours.openCalendar.value = "Close";
				break;
			case 'Close':
				if (Start_Calendar_window.closed)
					window.document.logHours.openCalendar.value = "Open";
				else
				{
					Start_Calendar_window.close();
					window.document.logHours.openCalendar.value = "Open";
				}
				break;					
			default :
				break;
		}
	}
	else	//The End date calendar
	{
		var status = window.document.logHours.openCalendar_end.value;
		switch (status)
		{
			case 'Open':

				End_Calendar_window = window.open("", "End_Date_Calendar", "height=250,width=450");
		

				End_Calendar_window.document.write("<HTML>");
				End_Calendar_window.document.write("<HEAD>");
				End_Calendar_window.document.write("<STYLE TYPE=\"text/css\">");
				End_Calendar_window.document.write(" A:link {color: blue; text-decoration:none;} ");
				End_Calendar_window.document.write(" A:visited {color: blue; text-decoration: none;} ");
				End_Calendar_window.document.write(" A:active {color: green; text-decoration: none;} ");
				
				End_Calendar_window.document.write("<\/STYLE>");
				End_Calendar_window.document.write("<TITLE>END DATE CALENDAR</TITLE>");
				End_Calendar_window.document.write("<SCRIPT LANGUAGE=\"JAVASCRIPT\">");
				End_Calendar_window.document.write("function currentDate(message)");
				End_Calendar_window.document.write("{ window.opener.logHours.end_date.value = message; }");
				End_Calendar_window.document.write("<\/SCRIPT>");
				End_Calendar_window.document.write("<\/HEAD>");

				End_Calendar_window.document.write("<BODY>");

				End_Calendar_window.document.write("<DIV ALIGN=CENTER>");
				End_Calendar_window.document.write("<FORM NAME='Calendar'>");
				End_Calendar_window.document.write("<TABLE BORDER=1 CELLPADDING=1 CELLSPACING=1>");

				End_Calendar_window.document.write("<TR>");
				End_Calendar_window.document.write("<TD COLSPAN=7 ALIGN=CENTER>");
				End_Calendar_window.document.write("<B>" + month_name + "&nbsp;&nbsp;&nbsp;" + year + "</B>");
				End_Calendar_window.document.write("</TD>");
				End_Calendar_window.document.write("</TR>");

				End_Calendar_window.document.write("<TR>");
				End_Calendar_window.document.write("<TD>Sunday</TD>");
				End_Calendar_window.document.write("<TD>Monday</TD>");
				End_Calendar_window.document.write("<TD>Tuesday</TD>");
				End_Calendar_window.document.write("<TD>Wednesday</TD>");
				End_Calendar_window.document.write("<TD>Thursday</TD>");
				End_Calendar_window.document.write("<TD>Friday</TD>");
				End_Calendar_window.document.write("<TD>Saturday</TD>");
				End_Calendar_window.document.write("</TR>");


				//This code will set the calendar months back to 1-12 instead of 0-11 as they are in the array.
				current_month = current_month + 1;

				switch (current_day)
				{
					case 0:
						End_Calendar_window.document.write ("<TR>");

						current_day = 1;
								
						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}
								
							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 1:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 2;

						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");
								
							var week_ending = current_day % 7
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 2:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 3;

						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 3:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 4;

						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 4:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 5;

						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 5:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
							
						current_day = 6;
							
						for (i = 1; i <= last_day; i++)
						{
							//End_Calendar_window.document.write("<A HREF='javascript:currentDate(" + i + ")'>");
							End_Calendar_window.document.write("<A HREF=");
							End_Calendar_window.document.write("\"javascript:currentDate(\'");
							End_Calendar_window.document.write(current_month);
							End_Calendar_window.document.write("/");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write("/");
							End_Calendar_window.document.write(year);
							End_Calendar_window.document.write("\')\">");
								
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN VALUE=" + i + ">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}
								
							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					case 6:
						End_Calendar_window.document.write ("<TR>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");
						End_Calendar_window.document.write ("<TD>&nbsp;</TD>");

						current_day =7;

						for (i = 1; i <= last_day; i++)
						{
							End_Calendar_window.document.write("<A HREF=\"javascript:currentDate(\'" + current_month + "/" + i + "/" + year + "\');\">");
							End_Calendar_window.document.write("<TD ALIGN=RIGHT>");
							End_Calendar_window.document.write("<INPUT TYPE=HIDDEN NAME=field" + i + " VALUE=" + i + "> ");
							End_Calendar_window.document.write(" <SPAN onmouseover = \"this.style.backgroundColor= \'blue\'; return true\" onmouseout= \"this.style.backgroundColor= \'white\'; return true\"> ");
							End_Calendar_window.document.write(i);
							End_Calendar_window.document.write(" </SPAN> ");
							End_Calendar_window.document.write("</TD>");
							End_Calendar_window.document.write("</A>");

							var week_ending = current_day % 7;
							if (week_ending == 0)
							{
								End_Calendar_window.document.write("</TR>");
								End_Calendar_window.document.write("<TR>");
							}
							if (i == last_day)
							{
								End_Calendar_window.document.write("</TR>");
							}

							current_day++;
							if (current_day > 7)
							{
								current_day = 1;
							}
						}
						break;
					default:
						break;
				}

				End_Calendar_window.document.write("</TABLE>");
				End_Calendar_window.document.write("</FORM>");
				End_Calendar_window.document.write("</DIV>");

				End_Calendar_window.document.write("</BODY>");
				End_Calendar_window.document.write("</HTML>");

				window.document.logHours.openCalendar_end.value = "Close";
				break;
			case 'Close':
				if (End_Calendar_window.closed)
					window.document.logHours.openCalendar_end.value = "Open";
				else
				{
					End_Calendar_window.close();
					window.document.logHours.openCalendar_end.value = "Open";
				}
				break;					
			default :
				window.alert(window.document.logHours.Year.value);
				window.alert("The function is not working properly");

				break;
		}
	}

}


//Added 3:15 PM 5/31/2003 for Project Management

//Designed to store the employeeID into a variable

//to pass to the receiving page.

function storeEmployeeID(employee)

{

	window.listEmployees.employee.value = employee;

	window.listEmployees.submit();

}



//Added 7:00 PM 5/31/2003 for Project Management

//Designed to store the entryID into a variable

//to pass to the receiving page.

function storeEntryID(entryID)

{

	var storedEntryID;

	storedEntryID = entryID;

	window.listEmpEntries.entryID.value = storedEntryID;

	window.listEmpEntries.submit();

}




