function zeroAdd(value)
	{
	value = new String(value)
	return (value.length==1) ? '0' + value : value
	}

function outDate(d)
	{
	n = new Date(d)				
	return zeroAdd(n.getDate()) + '/' + zeroAdd((n.getMonth() + 1)) + '/' + n.getYear()
	}
	
function inDate(d)
	{
	tmp = d.value.split('/')
	dateObj = new Date(tmp[2],tmp[1]-1,tmp[0])
	return dateObj.getTime()
	}
			
function CheckDate(cal)
	{
	chinObj  = document.getElementById('checkin')
	choutObj = document.getElementById('checkout')
	
	nowIn  = inDate(chinObj)
	nowOut = inDate(choutObj)
	
	if(cal==1 && nowIn>=nowOut) nowOut = nowIn  + 86400000
	if(cal==2 && nowOut<=nowIn) nowIn  = nowOut - 86400000
	
	chinObj.value  = outDate(nowIn)
	choutObj.value = outDate(nowOut)
	}