		<!--
		
		DOM = (document.getElementById) ? true : false;
		NS4 = (document.layers) ? true : false;
		IE = (document.all) ? true : false;

		var currTipoImmobile;
		var currTipologiaFabb;
		var currAliquota;
		var currDetrazione;
		//		

		/* 
			Imposta l'unita' di misura della consistenza a seconda della categoria selezionata.
		*/
		function ChangeConsistenza(cboCategoria)
		{
			var cboTarget = window.document.forms['frmData'].elements['cboTipoConsistenza'];
			
			switch (cboCategoria.options[cboCategoria.selectedIndex].value.substring(0, 1))
			{
				case 'A':
					document.getElementById("lblConsistenza").innerHTML = 'vani';
					break;
				case 'B':
					document.getElementById("lblConsistenza").innerHTML = 'mc.';
					break;
				case 'C':
					document.getElementById("lblConsistenza").innerHTML = 'mq.';
					break;
				default:
					document.getElementById("lblConsistenza").innerHTML = '&nbsp;';
			}
		}

		/* 
			Verifica che tutti i campi obbligatori siano stati valorizzati.
		*/
		function CheckRequiredFields()
		{
			var sFieldCaption 
			
			var ctrToCheck = window.document.forms['frmData'].elements['cboTipoImmobile'];
			
			if((!ctrToCheck) || ctrToCheck.selectedIndex < 0) {
				alert("Selezionare un comune ed un [Tipo immobile].");
				return false;
			};
			
			if (ctrToCheck.options[ctrToCheck.selectedIndex].value == 0) {
				alert("Il campo [Tipo immobile] e' obbligatorio.");
				ctrToCheck.focus();
				return false;
			};

			ctrToCheck = window.document.forms['frmData'].elements['txtRendita'];
			if (ctrToCheck.value.length == 0) {
				alert("Il campo [Rendita] e' obbligatorio.");
				ctrToCheck.focus();
				return false;
			};

			ctrToCheck = window.document.forms['frmData'].elements['txtPercPossesso'];
			if (ctrToCheck.value.length == 0) {
				alert("Il campo [% possesso] e' obbligatorio.");
				ctrToCheck.focus();
				return false;
			};
			
			return true;
		}

		/* 
			Mostra/abilita i campi a seconda del Tipo di Immobile selezionato.
		*/
		function ShowFields(nOption)
		{
			var sLabelRendita

			if (IE || DOM) {
				//document.getElementById("TdInagibile").disabled = ((nOption == 1 || nOption == 2) && currTipologiaFabb != 1 && currTipologiaFabb != 2) ? false : true;
				document.getElementById("TdInagibile").disabled = ((nOption == 1 || nOption == 2) && !IsPrimaCasa() && !IsPertinenza()) ? false : true;
				//document.getElementById("chkInagibile").disabled = ((nOption == 1 || nOption == 2) && currTipologiaFabb != 1 && currTipologiaFabb != 2) ? false : true;
				document.getElementById("chkInagibile").disabled = ((nOption == 1 || nOption == 2) && !IsPrimaCasa() && !IsPertinenza()) ? false : true;

				if(document.getElementById("chkInagibile").disabled) document.getElementById("chkInagibile").checked = false;
				var obj = null;
				obj = document.getElementById("TdConduzioneDiretta");
				if(obj != null) obj.disabled = (nOption == 5) ? false : true;
				obj = document.getElementById("chkConduzioneDiretta")
				if(obj != null) obj.disabled = (nOption == 5) ? false : true;
				
				if(document.getElementById("tdCaratteristicheSconosciute") != null)
				{
					var enabled = (document.getElementById("chkCaratteristicheSconosciute").checked == true);
					document.getElementById("TdCategoria").disabled = (enabled) ? false : true;
					document.getElementById("cboCategoria").disabled = (enabled) ? false : true;
					document.getElementById("TdClasse").disabled = (enabled) ? false : true;
					document.getElementById("cboClasse").disabled = (enabled) ? false : true;
					document.getElementById("TdConsistenza").disabled = (enabled) ? false : true;
					document.getElementById("txtConsistenza").disabled = (enabled) ? false : true;
				}
				
				switch (nOption)//(currTipoImmobile) //(document.getElementById("cboTipoImmobile").value)
				{
					case '1', '2':
						sLabelRendita = 'Rendita (non rival.)';
						break;
					case '3':
						sLabelRendita = 'Valore contabile';
						break;
					case '4':
						sLabelRendita = 'Valore venale';
						break;
					case '5':
						sLabelRendita = 'Reddito dominicale';
						break;
					default:
						sLabelRendita = 'Rendita (non rival.)';
				};
				document.getElementById("lblRendita").innerHTML = sLabelRendita;

				ShowFieldsFabbricato();
			} 
		}

		/* 
			Mostra/abilita i campi a seconda della Tipologia di fabbricato selezionato.
		*/
		function ShowFieldsFabbricato()
		{
			//var bEnabled = ((currTipologiaFabb == 1 || currTipologiaFabb == 3) && currDetrazione != 0);
			var bEnabled = ((IsPrimaCasa() || currTipologiaFabb == 3) && currDetrazione != 0);
			
			document.getElementById("TdNumeroDetrazioni").disabled = !bEnabled; 
			document.getElementById("TdLblNumeroDetrazioni").disabled = !bEnabled; 
			document.getElementById("txtNumeroDetrazioni").disabled = !bEnabled; 
			document.getElementById("TdDetrazSpettante").disabled = !bEnabled; 
			var obj = document.getElementById("chkDetrazSpettante");
			obj.disabled = !bEnabled; 
			obj.checked = bEnabled; 
		}

		/* 
			Inizializa il form.
		*/
		function Startup()
		{
			StripComputedCode(window.document.forms['frmData'].elements['cboTipoImmobile']);
			
			var obj = document.getElementById("LinkImpostDovuta");
			if(obj != null)
			{
				window.location.href = "#LinkImpostDovuta";
			}
		}
		
		function SubmitIfValid()
		{
			if (typeof(Page_ClientValidate) == 'function') 
				if(!Page_ClientValidate()) return false; 
		
			if(CheckRequiredFields()==true)
			{
				window.document.forms['frmData'].submit();
			}
			else
			{
				return false;
			}
		}


		function StripComputedCode(cboObj)
		{
			var code = cboObj.value; 
			if(code.length == 0) return false;
			
			var elem = code.split("#");
			currTipoImmobile = elem[0];
			currTipologiaFabb = elem[1];
			currAliquota = elem[2];
			currDetrazione = elem[3];	
			
			ShowFields(currTipoImmobile);		
		}
		
		function IsPrimaCasa(){
			return (currTipologiaFabb == 1 || currTipologiaFabb == 9);
		}
		
		function IsPertinenza(){
			return (currTipologiaFabb == 2 || currTipologiaFabb == 10);
		}
		
		function ShowHelp(page){
			var helpWin;
			helpWin = window.open(page, 'helpWin', "location=no, width=380, height=500, left=450, top=20, scrollbars=yes"); 
			helpWin.focus();
		}

		function ShowPrint(page){
			var printWin;
			printWin = window.open(page, 'printWin', "location=no, resizable=yes, scrollbars=yes, toolbar=yes, menubar=yes, width=650, height=550, left=20, top=0, scrollbars=yes"); 
			printWin.focus();
		}
		
		function ShowPayWin(page){
			if (typeof(Page_ClientValidate) == 'function') 
				if(!Page_ClientValidate()) return false; 

			var payWin;
			window.name = 'ICIcomWindow';
			payWin = window.open(page, 'payWin', "location=no, resizable=yes, scrollbars=yes, toolbar=yes, menubar=yes, width=800, height=600, left=20, top=0, scrollbars=yes"); 
			payWin.focus();
		}
		
		function ShowErrDatePayWin(){
			alert('Per effettuare il pagamento on-line la \'Data Versamento\' utilizzata durante il calcolo deve essere quella odierna.');		
		}
		//-->
