switch (language)
{
	case "si" :
	case "hr" :
		alert_dates = "Datum dolaska mora biti prije datuma odlaska!";
		break;
	case "de" :
	case "it" :
	case "en" :
	default :
		alert_dates = "Date of arrival must be before date of departure!";
		break;
}
var today = new Date();
var checkin = new Date();
var checkout = new Date();
checkin.setDate(today.getDate()+from_today);
checkout.setDate(checkin.getDate()+period);
str_checkin = checkin.getFullYear() + '-' + (1+checkin.getMonth()) + '-' +checkin.getDate();
str_checkout = checkout.getFullYear() + '-' + (1+checkout.getMonth()) + '-' +checkout.getDate();

function submitTDSearchForm(myForm)
{
	with (myForm)
	{
		if (strToDate(date_checkin.value) >= strToDate(date_checkout.value)) { alert(alert_dates); return false; };
		eval("var f=window.open('','TDSearch','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600');")
		f.focus();
		return true;
	}
}

function strToDate(strDate)
{
	// konvertira string formata YYYY-MM-DD u varijablu tipa Date
	var myDate = new Date();
	myYear = strDate.substr(0,4);
	myMonth = parseInt(strDate.substr(5,2),10)-1;
	myDay = strDate.substr(8,2);
	myDate.setFullYear(myYear, myMonth, myDay);
	return myDate;
}
