// JavaScript Document

now_today = new Date();

now = new Date(now_today.getTime() + (14 * 86400000));
Tag = now.getDate();
Monat = now.getMonth();
Jahr = now.getFullYear();

var tomorrow = new Date(now_today.getTime() + (15 * 86400000));
tDay = tomorrow.getDate();
tMonth = tomorrow.getMonth();
tYear = tomorrow.getYear();
if (tYear < 2000) tYear += 1900; // Netscape

if ((Jahr % 4 == 0) && (Jahr % 100 != 0) || (Jahr % 400 == 0)) {
	feb_days = 29;
} else {
	feb_days = 28;
}

/**/
day_array = [31, feb_days, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
Monat_days = day_array[Monat];


function write_days ()
{
	for (d=1; d<=Monat_days; d++) {
		document.write('<option value="'+d+'">'+d+'</option>');
	}	
}

function write_monthyear ()
{
	for (i=Monat; i<12; i++) {
		if (i<10) {
			document.write("<option value="+Jahr+'0'+(i)+">"+month_array[i]+" "+Jahr+"</option>");
		} else {
			document.write("<option value="+Jahr+''+(i)+">"+month_array[i]+" "+Jahr+"</option>");
		}
	}
	for (k=0; k<Monat+1; k++) {
		if (k<10) {
			document.write("<option value="+(Jahr+1)+'0'+(k)+">"+month_array[k]+" "+(Jahr+1)+"</option>");
		} else {
			document.write("<option value="+(Jahr+1)+''+(k)+">"+month_array[k]+" "+(Jahr+1)+"</option>");
		}
	}
}

// bestwestern functions

function toggleInterstitial(form)
{	
	passed=validatePropertySearchFormAll(form);
		
	if(passed==true){
		setStyle('mainbody', 'none');
		setStyle('interstl', 'block');
	}
	return passed;
	
}


function selectCurrentDate(){

	// day select -> onload
	document.selectHotelForm.arrivalDay.value = Tag;
	document.selectHotelForm.departureDay.value = tDay;	
	// month / year select -> onload
	if (Monat < 10) {
		document.selectHotelForm.arrivalMonthYear.value = Jahr+'0'+Monat;
	} else {
		document.selectHotelForm.arrivalMonthYear.value = Jahr+''+Monat;
	}		
	
	
	if (tMonth < 10) {
		document.selectHotelForm.departureMonthYear.value = tYear+'0'+tMonth;
	} else {
		document.selectHotelForm.departureMonthYear.value = tYear+''+tMonth;
	}	
}