var currentlySelectedDate;

function showhide(ID) 
{
	var div = document.getElementById(ID)
	
	//div.style.visibility = (div.style.visibility == 'hidden') ? 'visible' : 'hidden';
	div.style.display = (div.style.display == 'none') ? 'block' : 'none';
}

function selectCurrentDate(itemID)
{
	var theDate = parent.document.getElementById(itemID);
	
	var dateID = new String(theDate.value);
	dateID = dateID.replace(/\//g,"_");
	var selectedDate = self.document.getElementById(dateID);
	
	if (selectedDate == null)
		return;
	
	selectedDate.style.backgroundColor = "#FF6600";
	selectedDate.style.color = "white";
	
	currentlySelectedDate = selectedDate;
}

// select the new date change the text field and close the calendar
function changeDate(year, month, day, itemID, dateID)
{
	var theDate = parent.document.getElementById(itemID);
	
	calID = itemID.replace(/Date/i, "Cal");
	var theCalendar = parent.document.getElementById(calID);
	
	theDate.value= month + "/" + day + "/" + year;
	
	if (currentlySelectedDate)
	{
		currentlySelectedDate.style.backgroundColor = "white";
		currentlySelectedDate.style.color = "black";
	}
	
	
	var selectedDate = self.document.getElementById(dateID);
	selectedDate.style.backgroundColor = "#FF6600";
	selectedDate.style.color = "white";
	
	currentlySelectedDate = selectedDate;
	theCalendar.style.display = "none"; // now close the calendar since a date has been selected
}