function writeDateInput(parentName) {
	var dateNow  = new Date();
	//var tomorrow  = new Date(dateNow.getTime() + 86400000);
	var tomorrow  = new Date(dateNow.getTime());

	var parent = document.getElementById(parentName)

	var DateInInput = document.createElement('input')
	DateInInput.setAttribute('type', 'hidden')
	DateInInput.setAttribute('id', 'DateIn')
	DateInInput.setAttribute('name', 'DateIn')
	DateInInput.setAttribute('value', (tomorrow.getMonth()+1) +'/'+ tomorrow.getDate() +'/'+ tomorrow.getFullYear())
	parent.appendChild(DateInInput)

	var calButton = document.createElement('img')
	calButton.setAttribute('id', 'f_trigger_c')
	calButton.setAttribute('name', 'f_trigger_c')
	calButton.className = 'right'
	calButton.setAttribute('alt', '')
	calButton.src = 'images/img1.gif'
	if (calButton.style.cursor) {
		calButton.style.cursor = "pointer"
	}

	parent.appendChild(calButton)

	var domDateInSelect = document.createElement("select")
	domDateInSelect.onchange = function() {makeDate(this)}
	domDateInSelect.setAttribute("id", "domDateIn")
	domDateInSelect.setAttribute("name", "domDateIn")
	domDateInSelect.style.margin = "0px 10px 0px 0px"

	var nextDay = tomorrow.getDate();
	var curMonth = tomorrow.getMonth();
	var curYear = tomorrow.getFullYear();
	var nextYear = curYear + 1;
	var months = new Array( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
	var tempOption = null

	for( var h=1; h <= 31; h++) {
		tempOption = document.createElement('option')
		tempOption.value = h
		if( nextDay == h) {
			tempOption.setAttribute('selected', 'selected')
		}
		tempOption.appendChild(document.createTextNode(h))
		domDateInSelect.appendChild(tempOption)
	}

	parent.appendChild(domDateInSelect)

	var monDateInSelect = document.createElement('select')
	monDateInSelect.onchange = function() {makeDate(this)}
	monDateInSelect.setAttribute('id', 'monDateIn')
	monDateInSelect.setAttribute('name', 'monDateIn')

	for( var m=curMonth; m < months.length; m++) {
		tempOption = document.createElement('option')
		tempOption.value = (m+1) + "/" + curYear
		tempOption.appendChild(document.createTextNode(months[m] + " " + curYear))
		monDateInSelect.appendChild(tempOption)
	}

	for( var m = 0; m <= curMonth; m++) {
		tempOption = document.createElement('option')
		tempOption.value = (m+1) + "/" + nextYear
		tempOption.appendChild(document.createTextNode(months[m] + " " + nextYear))
		monDateInSelect.appendChild(tempOption)
	}

	parent.appendChild(monDateInSelect)

	Calendar.setup({
		inputField		: "DateIn",     // id of the input field
		ifFormat   		: "%B %e, %Y",      // format of the input field
		button			: "f_trigger_c",  // trigger for the calendar (button ID)
		onUpdate		: updateSelect,
		align			: "Tl",           // alignment (defaults to "Bl")
		singleClick		: true,
		range			: [tomorrow.getFullYear(), (tomorrow.getFullYear() + 1)],
		disableFunc		: validateDate
	});
}
