// JavaScript Document
function index_f_chk_int(obj){

if(_CF_checkinteger(obj.form.txtinteresse.value) || ! obj.form.txtinteresse.value.length == 0){obj.form.chkIntsuAl.checked=true;}else{obj.form.chkIntsuAl.checked=false;obj.form.chkIntsuDal.checked=false;};

}

function index_f_chk_intleg(obj){
	obj.form.selectinc.disabled=false;

if(obj.checked){alert('Il calcolo degli interessi legali verrà automatizzato');obj.form.txtTipoCalcoloInt.disabled=false;obj.form.chkAutoIntMora2.checked=false;obj.form.txtinteresse.value='';obj.form.chkAutoIntMora.checked=false;  obj.form.txtinteresse.disabled=obj.checked;obj.form.selectinc.options[7].selected=true;obj.form.chkDalconst.checked=false;obj.form.chkAlconst.checked=false}else {alert('Gli interessi non verranno automatizzati');obj.form.txtTipoCalcoloInt.disabled=true;obj.form.txtinteresse.disabled=false;obj.form.txtTipoCalcoloInt.options[0].selected=true; obj.form.selectinc.options[0].selected=true;obj.form.chkAutoIntMora2.checked=false;}
}

function index_f_chk_intmor(obj){
if(obj.checked){alert('Il calcolo degli interessi moratori verrà automatizzato');obj.form.txtTipoCalcoloInt.options[0].selected=true;obj.form.txtinteresse.value='';obj.form.chkAutoIntLeg.checked=false;obj.form.txtinteresse.disabled=obj.checked;obj.form.selectinc.options[7].selected=true;obj.form.chkIntsuAl.checked=true;obj.form.chkDalconst.checked=false;obj.form.chkAlconst.checked=false}else {alert('Il calcolo degli moratori non verrà automatizzato');obj.form.txtinteresse.disabled=false;obj.form.chkAutoIntMora2.checked=false;obj.form.selectinc.options[0].selected=true;obj.form.chkIntsuAl.checked=false;obj.form.chkIntsuDal.checked=false;}
}

function index_f_chk_intmor2(obj){
javascript:if(obj.form.chkAutoIntMora.checked){}else{obj.checked=false}

}

function index_f_chk_txtTipoCalcoloInt(obj){
if(obj.form.txtTipoCalcoloInt.value=='1'){obj.form.selectinc.options[0].selected=true;obj.form.selectinc.disabled=true;}else {obj.form.selectinc.disabled=false;}
}


function index_f_chk_riv(obj){
if(obj.checked) {} else	{obj.form.chkIntsuAl.checked=false;if(obj.form.chkAutoIntLeg.checked || obj.form.chkAutoIntMora.checked){obj.form.chkIntsuDal.checked=true;}else {}}
}

function index_f_chkintsual(obj){
if(obj.checked){obj.form.chkIntsuDal.checked=false;obj.form.chkIntsu75.checked=false;obj.form.txtinteresse.disabled=false;obj.form.chkAutoIntLeg.disable=false;obj.form.chkAutoIntLeg.disable=false;}else{obj.form.txtinteresse.disabled=true;obj.form.chkAutoIntLeg.checked=false;obj.form.chkIntCap.checked=false;}
}

function index_f_chkintsudal(obj){
if(obj.checked){obj.form.chkIntsuAl.checked=false;obj.form.chkIntsu75.checked=false;obj.form.txtinteresse.disabled=false;obj.form.chkAutoIntLeg.disable=false;obj.form.chkAutoIntLeg.disable=false;}else{obj.form.txtinteresse.disabled=true;obj.form.chkAutoIntLeg.checked=false;obj.form.chkIntCap.checked=false;}
}

function index_f_chkintsu75(obj){
if(obj.checked){obj.form.chkIntsuAl.checked=false;obj.form.chkIntsuDal.checked=false;obj.form.txtinteresse.disabled=false;obj.form.chkAutoIntLeg.disable=false;obj.form.chkAutoIntLeg.disable=false;}else{obj.form.txtinteresse.disabled=true;obj.form.chkAutoIntLeg.checked=false;obj.form.chkIntCap.checked=false;}
}

function index_f_chkintcap(obj){
if(obj.checked){obj.form.chkImpInizConst.checked=false;obj.form.txtinteresse.disabled=false;}else {}
}

function index_f_chkdalconst(obj){
if(obj.checked){obj.form.chkAlconst.checked=false;obj.form.chkImpInizConst.checked=true;}else {obj.form.chkImpInizConst.checked=false;}
}

function index_f_chkalconst(obj){
if(obj.checked){obj.form.chkDalconst.checked=false;obj.form.txtinteresse.disabled=false; if(obj.form.selectinc.options[0].selected){alert('Affinchè l\'opzione selezionata abbia efficacia\nconsigliamo di selezionare uno sviluppo diverso da intero');}}else {}
}

function index_f_chkimpinizconst(obj){
if(obj.checked){obj.form.chkIntCap.checked=false;obj.form.chkSumImpIniziale.checked=false;}else {}
}

function index_f_chksumimpiniziale(obj){
if(obj.checked){obj.form.chkImpInizConst.checked=false;}else {}
}


//----------------------
		function chkformriv(f1){
	//questa funzione è utilizzata in index.html
			
		var mess="";
		var ret=1
		f1.pdal.value=f1.pdal2.value+"/"+f1.pdal3.value+"/"+f1.pdal4.value;
		f1.pal.value=f1.pal2.value+"/"+f1.pal3.value+"/"+f1.pal4.value;
		var per_dal    = new periodo(f1.pdal2.value+"/"+f1.pdal3.value+"/"+f1.pdal4.value)
		var per_al     = new periodo(f1.pal2.value+"/"+f1.pal3.value+"/"+f1.pal4.value)
        var messaggioperiodi = '- I periodi introdotti devono essere compresi tra '+vprimo_periodo+ " e "+vultimo_periodo+" (ultimo indice ISTAT)\n"

		if(f1.chkRiv.checked)
		{//se ha chiesto la rivalutazione monetaria
		if(chkPeriodoInRange(per_dal)){}else{mess=mess+messaggioperiodi;ret=ret*0};
		if(chkPeriodoInRange(per_al)){}else{mess=mess+messaggioperiodi;ret=ret*0};
		//alert("*"+f1.pal.value+"*")
		}else{}
		
		if(_CF_checkeurodate(f1.pdal.value)){}else{mess=mess+'- Errore nel campo data del PERIODO Dal\n';ret=ret*0}
		if(_CF_checkeurodate(f1.pal.value)){}else{mess=mess+'- Errore nel campo data del PERIODO Al\n';ret=ret*0}
		if(_CF_checknumber(f1.txtimporto.value)){}else{mess=mess+'- Errore nel campo IMPORTO. Inserire solo caratteri numerici, separando i decimali con la virgola\n';ret=ret*0}
		if(_CF_checknumber(f1.txtinteresse.value)){}else{mess=mess+'- Errore nel campo INTERESSE\n';ret=ret*0}
        if(ret>0*1){return true}else{alert(mess);return false}
		}
		
		function chkformint(f1){
		//questa funzione è utilizzata in index.html
			
		var mess="";
		var ret=1
		f1.pdal.value=f1.pdal2.value+"/"+f1.pdal3.value+"/"+f1.pdal4.value;
		f1.pal.value=f1.pal2.value+"/"+f1.pal3.value+"/"+f1.pal4.value;
		var per_dal    = new periodo(f1.pdal2.value+"/"+f1.pdal3.value+"/"+f1.pdal4.value)
		var per_al     = new periodo(f1.pal2.value+"/"+f1.pal3.value+"/"+f1.pal4.value)
		if(_CF_checkeurodate(f1.pdal.value)){}else{mess=mess+'- Errore nel campo data Dal\n';ret=ret*0}
		if(_CF_checkeurodate(f1.pal.value)){}else{mess=mess+'- Errore nel campo data Al\n';ret=ret*0}
		if(_CF_checknumber(f1.txtimporto.value)){}else{mess=mess+'- Errore nel campo IMPORTO.Inserire solo caratteri numerici, separando i decimali con la virgola\n';ret=ret*0}
		if(_CF_checknumber(f1.txtinteresse.value)){}else{mess=mess+'- Errore nel campo INTERESSE\n';ret=ret*0}
        if(ret>0*1){return true}else{alert(mess);return false}
		}

