var aperto = false;
function opendivlingua(idl, sz){
	cambio = function(){
		aperto = !aperto;
	};
	hl = 19;
	pd = 4;
	h = (sz)*(hl+pd);
	t = h+hl;
	if(!aperto){
		new Effect.Morph(idl, {
		  style: 'top:-'+t+'px;height:'+h+'px',
		  duration: 0.5 , afterFinish:cambio
		});
	}else{
		new Effect.Morph(idl, {
		  style: 'top:0px;height:0px',
		  duration: 0.5 , afterFinish:cambio
		});
	}
}
function mysql2js_date(dt){
	part=dt.split("-");
	d = new Date();
	d.setFullYear(part[0]);
	d.setMonth(part[1]-1);
	d.setDate(part[2]);
	return d;
}
function aggiornaCampi(){
	dal = Calendar.intToDate(sel_dal.selection.get());
	al = Calendar.intToDate(sel_al.selection.get());

	//$('dal_alberghi_clone').update(dal.strftime("%x"));
    //$('al_alberghi_clone').update(al.strftime("%x"));
    //$('notti_alberghi_clone').update(dateDiff(dal,al).fullDays);
}
function giorniOkArriviePartenze(date){
	if (date.getDay() == 1 || date.getDay() == 3 || date.getDay() == 5) {
        return false;
    } else {
        return false;
    }

}
function onSelectDate(a, b ){
	date = Calendar.intToDate(this.selection.get());

	sel_al.args.min =  new Date(date);
	sel_al.args.min.setDate( sel_al.args.min.getDate()+1);

	date.setDate(date.getDate()+7);

	sel_al.selection.set(date);

	$(sel_al.args.inputField).value = Calendar.printDate(date, sel_al.args.dateFormat);

	aggiornaCampi();
	this.hide();
}
function checkSelectedDate(){
	aggiornaCampi();
	this.hide();
}


