function addzero( value )
{
	while( value.length<2 ) value = String("0") + value;
	return value;
}

function checkDateOrder(b_frm, ci_day, ci_month_year) {
	if (document.getElementById) {
		var b_frm = document.getElementById(b_frm);
		// create date object from checkin values
		// set date to 12:00 to avoid problems with one
		// date being wintertime and the other summertime
		var my = b_frm[ci_month_year].value.split("-");
	    var ci = new Date (my[0], my[1]-1, b_frm[ci_day].value, 12, 0, 0, 0);

        // create date object from checkout values
	    my = b_frm[co_month_year].value.split("-");
	    var co = new Date (my[0], my[1]-1, b_frm[co_day].value, 12, 0, 0, 0);

		// if checkin date is at or after checkout date,
		// add a day full of milliseconds, and set the
		// selectbox values for checkout date to new value
	    if (ci >= co){
    	    co.setTime(ci.getTime() + 1000 * 60 * 60 * 24);
	        b_frm[co_day].value =  co.getDate();
    	    var com = co.getMonth()+1;
	        b_frm[co_month_year].value = co.getFullYear() + "-" + com;
    	}
	}
}
