function calcDays(year, month, obj){
	if(year % 4 == 0){	var monthDays = new Array(0,31,29,31,30,31,30,31,31,30,31,30,31); }
	else{	var monthDays = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); }
	obj.update("");
	var days = monthDays[parseInt(month)];
	for(var d = 1; d <= days; d++){
		var option = new Element('option', { 'value' : d }).update(d);
		obj.insert(option);
	}
	
}
document.observe("dom:loaded", function() {
	$('departure_month').observe('change', function(){
		calcDays($('departure_year').value, $('departure_month').value, $('departure_day'))
	});
	$('departure_year').observe('change', function(){
		calcDays($('departure_year').value, $('departure_month').value, $('departure_day'))
	});
	$('arrival_month').observe('change', function(){
		calcDays($('arrival_year').value, $('arrival_month').value, $('arrival_day'))
	});
	$('arrival_year').observe('change', function(){
		calcDays($('arrival_year').value, $('arrival_month').value, $('arrival_day'))
	});
	
	$('frm_contact').observe('submit', function(e){
		//this.name.up().down('.title').removeClassName('error');
		this.email.up().down('.title').removeClassName('error');
		this.telephone.up().down('.title').removeClassName('error');
		var error = false;
		var ReSpaces = /^\s+$/;
		var ReMail = /[a-z0-9_+-]+@[a-z0-9]+\.[a-z]{2,6}/;
		/*if(this.name.value == '' || ReSpaces.test(this.name.value)){
			error |= true;
			this.name.up().down('.title').addClassName('error');
		}*/
		if(!ReMail.test(this.email.value)){
			this.email.up().down('.title').addClassName('error');
			if(this.telephone.value == '' || ReSpaces.test(this.telephone.value)){
				this.telephone.up().down('.title').addClassName('error');
				error |= true;
			}
		}
		if(error){e.stop();}
	});
});