

var whichMonth
var whichDay
var whichYear
var whichDisplayDate


function selectDay(theDay, theMonth, theYear,fullMonth) {
	
	var d = new Date();	
	d.setFullYear(theYear);		
	d.setDate(theDay);		
	d.setMonth(theMonth);
	
	//	document.theForm.pickup_month.value = theMonth
	//	document.theForm.pickup_day.value = theDay
	//	document.theForm.pickup_year.value = theYear
	//	document.theForm.display_date.value = fullMonth + " " + theDay + ", " + theYear

	whichMonth.value = fullMonth
	whichDay.value = theDay
	whichYear.value = theYear
	whichDisplayDate.value = fullMonth + " " + theDay + ", " + theYear
	
	closeCalendar()
	chkdate(whichDisplayDate.value);
	// alert(whichMonth.value)


}

function calendar_highlight(elem) {
	e = document.getElementById(elem)
	e.style.backgroundColor = '#dddddd'
	e.style.cursor = 'pointer'
	e.style.color = '#cc0000'
}
function calendar_unhighlight(elem) {
	e = document.getElementById(elem)
	e.style.backgroundColor = '#ffffff'
	e.style.cursor = 'normal'
	e.style.color = '#000000'
}

currentCal = 1

function cal_next() {
	
	cal_1 = document.getElementById('cal1');
	cal_2 = document.getElementById('cal2');
	cal_3 = document.getElementById('cal3');
	
	cal_1.style.display = 'none'
	cal_2.style.display = 'none'
	cal_3.style.display = 'none'
	
	switch(currentCal) {
		case 1:
			cal_2.style.display = 'inline'
			currentCal = 2
			break;
		case 2:
			cal_3.style.display = 'inline'
			currentCal = 3
			break;
		case 3:
			cal_1.style.display = 'inline'
			currentCal = 1
			break;
		default:
			cal_1.style.display = 'inline'
			currentCal = 1
			break;
	}

}

function cal_previous() {
	
	cal_1 = document.getElementById('cal1');
	cal_2 = document.getElementById('cal2');
	cal_3 = document.getElementById('cal3');
	
	cal_1.style.display = 'none'
	cal_2.style.display = 'none'
	cal_3.style.display = 'none'
	
	switch(currentCal) {
		case 1:
			cal_3.style.display = 'inline'
			currentCal = 3
			break;
		case 2:
			cal_1.style.display = 'inline'
			currentCal = 1
			break;
		case 3:
			cal_2.style.display = 'inline'
			currentCal = 2
			break;
		default:
			cal_1.style.display = 'inline'
			currentCal = 1
			break;
	}

}


function closeCalendar() {
	popupCalendars.style.display = 'none'
}

function displayCalendar() {
	whichMonth = document.theForm.pickup_month
	whichDay = document.theForm.pickup_day
	whichYear = document.theForm.pickup_year
	whichDisplayDate = document.theForm.pickup_display_date
	
	popupCalendars.style.display = 'inline' 

}
