﻿function CambioData(){
	if(CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.IsDate()){
		if(CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.IsDate()){
			if(CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.GetData()<=CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.GetData()){
				CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.SelData(dt2dtstr(aggiungiGiorni(CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.GetData(),7)));
				visMsg(false);
			}
			else{
				if(((CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.GetData()-CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.GetData())/86400000)>28){
					CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.SelData(dt2dtstr(aggiungiGiorni(CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.GetData(),27)))
					visMsg(true)
				}
			}
		}			
		CAL_Obj_ctl00_ContentPlaceHolder1_calDataPartenza.DataMinima=aggiungiGiorni(CAL_Obj_ctl00_ContentPlaceHolder1_calDataArrivo.GetData(),7)
	}
}

function aggiungiGiorni(data,numeroGiorni){
	var millisecondi=3600000*24*numeroGiorni
	data.setTime(data.getTime()+millisecondi)
	return data			
}
function visMsg(vis){
	var liv=document.getElementById("msgMax")
	if(vis)
		liv.style.display="block"
	else
		liv.style.display="none"
}
function hidemax(){
	document.getElementById('divMassimaData').style.display='none';
}
function moreOptions(){
    if((document.getElementById("tabMore").style.display=="none")||(document.getElementById("tabMore").style.display=="")){
        document.getElementById("tabMore").style.display="block"
    }
    else{
        document.getElementById("tabMore").style.display="none"
    }
}

function txtNome_focus(obj,testo){
    if(obj.value==testo)
        obj.value="";
}
function txtNome_blur(obj,testo){
    if(obj.value=="")
        obj.value=testo;
}