
function checkTempergussAT()
{
	var strShowTemperGussPDF = document.getElementById('SHOWTEMPERGUSSPDF').value;
	
	if(strShowTemperGussPDF != "FALSE")
	{
		//window.open("InfoDocs/Handbuch_MS_uk_Seite 310.pdf",height=800,width=600);
		//alert(strShowTemperGussPDF);
	}
		
	
}

function initDruckverlustReiter()
{
	if (document.getElementById('IDC_MEDIUM_COMBO') == null)
		return;

	message=document.getElementById('DRUVERL_ALERT_MSG').value;
	if(message){ alert(message); }
	document.getElementById('DRUVERL_ALERT_MSG').value='';

	Medium = document.getElementById('IDC_MEDIUM_COMBO').options[document.getElementById('IDC_MEDIUM_COMBO').selectedIndex].value;
	if (Medium == "IDC_USERDEFINED")
	{
		// Dichte und Viskosität dürfen eingegeben werden; Betriebsdruck wird nicht benötigt; Calc-Knopf auch nicht
		componentEnable('IDC_FLUIDDICHTE');
		componentEnable('IDC_FLUIDDICHTE_UNITS_COMBO');
		componentEnable('IDC_KIN_VISCO');
		componentEnable('IDC_KIN_VISCO_UNITS_COMBO');
		componentEnable('IDC_DYN_VISCO');
		componentEnable('IDC_DYN_VISCO_UNITS_COMBO');

		componentDisable('IDC_CALCSTOFFDATEN_BUT');
	}
	else
	{
		componentDisable('IDC_FLUIDDICHTE');
		componentDisable('IDC_FLUIDDICHTE_UNITS_COMBO');
		componentDisable('IDC_KIN_VISCO');
		componentDisable('IDC_KIN_VISCO_UNITS_COMBO');
		componentDisable('IDC_DYN_VISCO');
		componentDisable('IDC_DYN_VISCO_UNITS_COMBO');

		componentEnable('IDC_CALCSTOFFDATEN_BUT');
	}
	
	storeDruckverlustResultUnits();
}

function storeDruckverlustResultUnits()
{
	selectedIdDruckverlustOutput = document.getElementById('IDC_DRUCKVERLUST_RESULT_COMBO').options[document.getElementById('IDC_DRUCKVERLUST_RESULT_COMBO').selectedIndex].value;
	selectedIdAequiLaengeOutput = document.getElementById('IDC_AEQUI_LAENGE_RESULT_COMBO').options[document.getElementById('IDC_AEQUI_LAENGE_RESULT_COMBO').selectedIndex].value;

    document.getElementById('TECHVAL_OUTPUT_DRUCKVERLUST_UNIT').value = selectedIdDruckverlustOutput;
    document.getElementById('TECHVAL_OUTPUT_AEQUILAENGE_UNIT').value  = selectedIdAequiLaengeOutput;
}

function InvalidateStoffdaten()
{
	document.getElementById('IDC_DYN_VISCO').value = ''
	document.getElementById('IDC_KIN_VISCO').value = ''
	document.getElementById('IDC_FLUIDDICHTE').value = ''
	InvalidateDruckverlust();
}

function InvalidateDruckverlust()
{
	//document.getElementById('IDC_DRUCKVERLUST_RESULT_COMBO').setAttribute("items", 'ID_NONE=0');
	dialog.IDC_DRUCKVERLUST_RESULT_COMBO.setNewItemList( 'ID_NONE=0' );
	initCombobox('IDC_DRUCKVERLUST_RESULT_COMBO');
	
	//document.getElementById('IDC_AEQUI_LAENGE_RESULT_COMBO').setAttribute("items", 'ID_NONE=0');
	dialog.IDC_AEQUI_LAENGE_RESULT_COMBO.setNewItemList( 'ID_NONE=0' );
	initCombobox('IDC_AEQUI_LAENGE_RESULT_COMBO');
	
	document.getElementById('IDC_REYN_ZAHL').value = '0'
	document.getElementById('IDC_REIB_ZAHL').value = '0'
}

function onBerechneDenDruckverlust()
{
	Volumenstrom = GetZahlFromEdit("IDC_VOLUMENSTROM");
	Stroemgeschw = GetZahlFromEdit("IDC_STROEM_GESCHW");
	if ((Volumenstrom <= 0) && (Stroemgeschw <= 0))
	{
		message = document.getElementById('IDC_ERROR_DRUVERL_1').value;		// Bitte geben Sie entweder Volumenstrom oder StrÃ¶mungsgeschwindigkeit ein!
		alert(message);
		return false;
	}
	kinVisco = GetZahlFromEdit("IDC_KIN_VISCO");
	dynVisco = GetZahlFromEdit("IDC_DYN_VISCO");
	Dichte = GetZahlFromEdit("IDC_FLUIDDICHTE");

	selectedMedium = document.getElementById('IDC_MEDIUM_COMBO').options[document.getElementById('IDC_MEDIUM_COMBO').selectedIndex].value;
// alert(selectedMedium);
	if (selectedMedium == 'IDC_USERDEFINED')
	{
		if ((kinVisco <= 0) && (dynVisco <= 0))
		{
			message = document.getElementById('IDC_ERROR_DRUVERL_2').value;	// Bitte geben Sie bei benutzerdefiniertem Medium entweder kinematische oder dynamische ViskositÃ¤t ein!
			alert(message);
			return false;
		}
		if (Dichte <= 0)
		{
			message = document.getElementById('IDC_ERROR_DRUVERL_3').value;	// Bitte geben Sie die Dichte des Mediums ein!
			alert(message);
			return false;
		}
	}
	else
	{
		if ((kinVisco <= 0) && (dynVisco <= 0))
		{
			/* -mw- 12.12.2013: In diesem Fall berechnen wir künftig die Stoffdaten dynamisch
			message = document.getElementById('IDC_ERROR_DRUVERL_4').value;	// Bitte berechnen Sie zuerst die Stoffdaten
			alert(message);
			return false;
			*/
		}
	}
	return true;
}

function initAnschlussDlg()
{

	schlauchtyp		 = dialog.IDC_GEWAEHLTER_SCHLAUCH.getText();
	Nennlaengeberechnenchecked = document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').value;
	DIN2827checked = document.getElementById('IDC_MS_AUSLEGUNG_DIN2827_CHECKBOX').checked;
	bewegungsart	 = document.getElementById('bewegungsart').value;
	

	Label_Ausdruck = document.getElementById('P_AUSGABE_LABEL').value ;
	
	Nennweite = document.getElementById('IDC_NENNWEITE').value ;
	Nennweite = Nennweite.replace("ID_","");
	//alert(Nennweite);
	//alert(Nennlaengeberechnenchecked);
	// alert(schlauchtyp);
	
	if( bewegungsart == "ID_SCHWING" && Nennweite > 100)
	    Nennlaengeberechnenchecked = 'false';
	    
	if( Label_Ausdruck == "SF3")
	{
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF3').style.visibility = 'visible';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF4').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_PND').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_Unit').style.visibility = 'visible';
	}
	else if( Label_Ausdruck == "SF4")
	{
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF3').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF4').style.visibility = 'visible';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_PND').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_Unit').style.visibility = 'visible';
	}	
	else if( Label_Ausdruck == "PND")
	{
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF3').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF4').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_PND').style.visibility = 'visible';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_Unit').style.visibility = 'hidden';
	}
	else
	{
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF3').style.visibility = 'visible';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_SF4').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_PND').style.visibility = 'hidden';
	 document.getElementById('IDC_GEWAEHLTER_SCHLAUCH_PN_Unit').style.visibility = 'visible';
	}	
	
	if (schlauchtyp.indexOf("RZ") == 0)  
	{
		document.getElementById('IDC_GRAT_U_SPALTFREI_CHECK').value = false;
		// componentDisable('IDC_GRAT_U_SPALTFREI_CHECK');  --> führt zu Problemen ...
		document.getElementById('IDC_GRAT_U_SPALTFREI_CHECK').style.visibility = 'hidden';
		document.getElementById('IDC_GRAT_U_SPALTFREI_LABEL').style.visibility = 'hidden';
	}
	
	changeAnschlusstyp('IDC_ANSCHLUSSART_LINKS_COMBO','IDC_ANSCHLUSSTYP_LINKS_COMBO','IDC_WERKSTOFF_LINKS_COMBO');
	changeAnschlusstyp('IDC_ANSCHLUSSART_RECHTS_COMBO','IDC_ANSCHLUSSTYP_RECHTS_COMBO','IDC_WERKSTOFF_RECHTS_COMBO');

	auswahlweg	 = document.getElementById('auswahlweg').value;
	bewegungszustand = document.getElementById('bewegungszustand').value;	// BEW2 = Wärmedehnung !!!
	
	strATWahlLinks = document.getElementById('IDC_AT_WAHL_LINKS').innerHTML;
	strATWahlRechts = document.getElementById('IDC_AT_WAHL_RECHTS').innerHTML;
	
	if (auswahlweg == 'AUSWAHL_EINSATZFALL' )
	{
		document.getElementById('IDC_MINIMUM_LAENGE_LABEL').style.visibility = 'hidden';
		document.getElementById('IDC_BERECHNETE_LAENGE_LABEL').style.visibility = 'visible';

		if(Nennlaengeberechnenchecked == 'true')
		{
			bewegungsart	 = document.getElementById('bewegungsart').value;
			if (bewegungsart == "ID_WAERME_BGN090")
			{
				document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'hidden';
				document.getElementById('IDC_NENNLAENGE').style.visibility = 'hidden';
				document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'hidden';
				document.getElementById('IDC_A_MASS_LABEL').style.visibility = 'visible';
				document.getElementById('IDC_A_MASS').style.visibility = 'visible';
				document.getElementById('IDC_A_MASS_UNITS_COMBO').style.visibility = 'visible';
				document.getElementById('IDC_B_MASS_LABEL').style.visibility = 'visible';
				document.getElementById('IDC_B_MASS').style.visibility = 'visible';
				document.getElementById('IDC_B_MASS_UNITS_COMBO').style.visibility = 'visible';
			}
			else
			{
				document.getElementById('IDC_A_MASS_LABEL').style.visibility = 'hidden';
				document.getElementById('IDC_A_MASS').style.visibility = 'hidden';
				document.getElementById('IDC_A_MASS_UNITS_COMBO').style.visibility = 'hidden';
				document.getElementById('IDC_B_MASS_LABEL').style.visibility = 'hidden';
				document.getElementById('IDC_B_MASS').style.visibility = 'hidden';
				document.getElementById('IDC_B_MASS_UNITS_COMBO').style.visibility = 'hidden';
	
				if (bewegungsart == "ID_WAERME_LATERAL")
				{
					if(strATWahlLinks != "" && strATWahlRechts != "")
					{
						document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'visible';
						document.getElementById('IDC_NENNLAENGE').style.visibility = 'visible';
						document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'visible';
					}
					else
					{
						document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'hidden';
						document.getElementById('IDC_NENNLAENGE').style.visibility = 'hidden';
						document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'hidden';
					}
				}
				else
				{
					document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'hidden';
					document.getElementById('IDC_NENNLAENGE').style.visibility = 'hidden';
					document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'hidden';
				}
			}
		}
		else if(Nennlaengeberechnenchecked == 'false')
		{
  		     	document.getElementById('IDC_A_MASS_LABEL').style.visibility = 'hidden';
			document.getElementById('IDC_A_MASS').style.visibility = 'hidden';
			document.getElementById('IDC_A_MASS_UNITS_COMBO').style.visibility = 'hidden';
			document.getElementById('IDC_B_MASS_LABEL').style.visibility = 'hidden';
			document.getElementById('IDC_B_MASS').style.visibility = 'hidden';
			document.getElementById('IDC_B_MASS_UNITS_COMBO').style.visibility = 'hidden';
		       	
   			document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'visible';
		     	document.getElementById('IDC_NENNLAENGE').style.visibility = 'visible';
		     	document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'visible';
		     	
   			document.getElementById('IDC_BERECHNETE_LAENGE_LABEL').style.visibility = 'hidden';
	  		document.getElementById('IDC_BERECHNETE_LAENGE').style.visibility = 'visible';
		     	document.getElementById('IDC_BERECHNETE_LAENGE_EINHEIT').style.visibility = 'visible';
		     	document.getElementById('IDC_MINIMUM_LAENGE_LABEL').style.visibility = 'visible';
		     	
   			if( bewegungszustand == 'BEW4' && Nennweite > 100)
		     	{
		     	   document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'hidden';
	  		   document.getElementById('IDC_NENNLAENGE').style.visibility = 'hidden';
		     	   document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'hidden';
		     	   
			   document.getElementById('IDC_BERECHNETE_LAENGE_LABEL').style.visibility = 'hidden';
	  		   document.getElementById('IDC_BERECHNETE_LAENGE').style.visibility = 'hidden';
		     	   document.getElementById('IDC_BERECHNETE_LAENGE_EINHEIT').style.visibility = 'hidden';
		     	   document.getElementById('IDC_MINIMUM_LAENGE_LABEL').style.visibility = 'hidden';
		     	}
		}
	}      
	else
	{
		document.getElementById('IDC_MINIMUM_LAENGE_LABEL').style.visibility = 'visible';
		
		document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'visible';
		document.getElementById('IDC_NENNLAENGE').style.visibility = 'visible';
		document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'visible';
		//document.getElementById('IDC_NENNLAENGE_LABEL').style.visibility = 'hidden';
		//document.getElementById('IDC_NENNLAENGE').style.visibility = 'hidden';
		//document.getElementById('IDC_NENNLAENGE_UNITS_COMBO').style.visibility = 'hidden';
		
		document.getElementById('IDC_BERECHNETE_LAENGE_LABEL').style.visibility = 'hidden';

		document.getElementById('IDC_A_MASS_LABEL').style.visibility = 'hidden';
		document.getElementById('IDC_A_MASS').style.visibility = 'hidden';
		document.getElementById('IDC_A_MASS_UNITS_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_B_MASS_LABEL').style.visibility = 'hidden';
		document.getElementById('IDC_B_MASS').style.visibility = 'hidden';
		document.getElementById('IDC_B_MASS_UNITS_COMBO').style.visibility = 'hidden';
	}
}

function changeAnschlusstyp(id,target_id, target2_id)
{
	selectedElement = document.getElementById(id).options[document.getElementById(id).selectedIndex].value;
	newitems = Anschlusstypen[selectedElement];
	
	//target_element = document.getElementById(target_id);
	//target_element.setAttribute("items", newitems);
	dialog[target_id].setNewItemList( newitems );
	initCombobox(target_id);

	newitems = Werkstoffe[selectedElement];
	
	//target_element = document.getElementById(target2_id);
	//target_element.setAttribute("items", newitems);
	dialog[target2_id].setNewItemList( newitems );
	
	initCombobox(target2_id);
}

function checkSucheAT(Knopf)
{
	TS	= document.getElementById('vorgabe_TS').value;
	if (Knopf == 'IDC_SUCHEN_LINKS')
	{
		Anschlussart = document.getElementById('IDC_ANSCHLUSSART_LINKS_COMBO').options[document.getElementById('IDC_ANSCHLUSSART_LINKS_COMBO').selectedIndex].value;
		Anschlusstyp = document.getElementById('IDC_ANSCHLUSSTYP_LINKS_COMBO').options[document.getElementById('IDC_ANSCHLUSSTYP_LINKS_COMBO').selectedIndex].value;
		Werkstoff = document.getElementById('IDC_WERKSTOFF_LINKS_COMBO').options[document.getElementById('IDC_WERKSTOFF_LINKS_COMBO').selectedIndex].value;
	}
	else
	{
		Anschlussart = document.getElementById('IDC_ANSCHLUSSART_RECHTS_COMBO').options[document.getElementById('IDC_ANSCHLUSSART_RECHTS_COMBO').selectedIndex].value;
		Anschlusstyp = document.getElementById('IDC_ANSCHLUSSTYP_RECHTS_COMBO').options[document.getElementById('IDC_ANSCHLUSSTYP_RECHTS_COMBO').selectedIndex].value;
		Werkstoff = document.getElementById('IDC_WERKSTOFF_RECHTS_COMBO').options[document.getElementById('IDC_WERKSTOFF_RECHTS_COMBO').selectedIndex].value;
	}
	/*
	if ( (parseFloat(TS) > 300) && (Werkstoff != 'WS_EDELSTAHL') )
	{
		message = document.getElementById('errorTemperatur').value;
		if(message){ alert(message); }
		message = "";
		return;
	}
	*/
	if ((Anschlussart == 'FLANSCH') && (Anschlusstyp == 'FEST') && (Werkstoff == 'WS_MEDIUM_EDELSTAHL'))
	{
		message = document.getElementById('errorWerkstoff1').value;
		if(message){ alert(message); }
		message = "";
		return;
	}
	if ((Anschlussart == 'GEWINDE') && (Anschlusstyp == 'DREHBAR_2TLG') && (Werkstoff == 'WS_TEMPER'))
	{
		message = document.getElementById('errorWerkstoff2').value;
		if(message){ alert(message); }
		message = "";
		return;
	}

	ekSubmit(Knopf);
}

/* Reagiere auf Event in Tabelle
function changedEinsatzfall()
{
	newcode = document.isycat.IDC_MS_EINSATZFALL_AUSWAHL_TABELLE.value;
	newcode = newcode.replace('IDC_MS_EINSATZFALL_AUSWAHL_TABELLE_', '');
	// alert(newcode);
	changedEinsatzfallDoIt(newcode);
}
*/

function changeBewegungsArtCombo()
{
	dialog.IDC_ART_BEWEGUNG_COMBO.setNewItemList( ArtBew[$F('IDC_BEWEGUNGSZUSTAND_COMBO')] );
	changeBewegungsArtBild();
}

function changeBewegungsArtBild()
{
	test = document.getElementById('IDC_BEWEGUNGSZUSTAND_COMBO').value ;
	if(test != 'BEW5')
		Bart = document.getElementById('IDC_ART_BEWEGUNG_COMBO').options[document.getElementById('IDC_ART_BEWEGUNG_COMBO').selectedIndex].value;
	else
	    Bart = '';
	
	Nennlaengeberechnenchecked = document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').checked;
	DGRL_Berechnung = document.getElementById('IDC_RADIO_DGRL_JA').checked;

	Nennweite = document.getElementById('IDC_NENNWEITE_COMBO').value ;
	Nennweite = Nennweite.replace("ID_","");
	//alert(Nennweite);
	
	newBild = 'Bild_Ausgabe_Maske_Einsatzfall_blank.gif';
   	gifpfad = document.getElementById('gifpath').value;

	if (Bart == 'ID_MONTAGE_LATERAL') newBild = 'bgnlat.gif';
	if (Bart == 'ID_WAERME_LATERAL') newBild = 'bgnlat2.gif';
	if (Bart == 'ID_WAERME_BGN090') newBild = 'bgn090.gif';
	if (Bart == 'ID_WAERME_BGN180') newBild = 'bgn180.gif';
	if (Bart == 'ID_HUB_BGN180')	newBild = 'bgn180.gif';
	if (Bart == 'ID_HUB_SEGMENT')	newBild = 'bgnseg.gif';
	
	if (Bart == 'ID_SCHWING' && Nennweite < 125)	newBild = 'bgn090_schwingk125.gif';
	if (Bart == 'ID_SCHWING' && Nennweite > 100)	newBild = 'bgn090_schwingg100.gif';
	
	//alert(newBild);
	if (Nennlaengeberechnenchecked == false)
	   newBild = 'Bild_Ausgabe_Maske_Einsatzfall_blank.gif';
	
	document.getElementById('IDC_ART_BEWEGUNG_IMAGE').src = gifpfad + newBild;

	if ((Bart == 'ID_WAERME_BGN090') || (Bart == 'ID_MONTAGE_LATERAL'))
	{
		document.getElementById('IDC_INFO_MS_EINSATZFALL').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_2').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_3').style.visibility = 'hidden';
	}
	else if ((Bart == 'ID_HUB_BGN180') || (Bart == 'ID_WAERME_BGN180'))
	{
		document.getElementById('IDC_INFO_MS_EINSATZFALL').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_2').style.visibility = 'visible';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_3').style.visibility = 'hidden';
	}	
	else if (Bart == 'ID_SCHWING' && Nennweite < 125) 
	{
		document.getElementById('IDC_INFO_MS_EINSATZFALL').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_2').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_3').style.visibility = 'visible';
	}
	else
	{
		document.getElementById('IDC_INFO_MS_EINSATZFALL').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_2').style.visibility = 'hidden';
		document.getElementById('IDC_INFO_MS_EINSATZFALL_3').style.visibility = 'hidden';
	}	


	if ((Bart == 'ID_HUB_BGN180') || (Bart == 'ID_WAERME_BGN180') || (Bart == 'ID_WAERME_BGN090'))
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'visible';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'visible';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';

	}
	else if (Bart == 'ID_MONTAGE_LATERAL')
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'visible';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';
	}
	else if (Bart == 'ID_WAERME_LATERAL')
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';


	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'visible';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';
	}
	else if (Bart == 'ID_HUB_SEGMENT')
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'visible';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'visible';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';
	}

	else if (Bart == 'ID_SCHWING' && Nennweite > 100)
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';
	}
	
	else if (Bart == 'ID_SCHWING'&& Nennweite < 125)
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'visible';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'visible';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  Version = document.getElementById('ID').value ;
	  if(Version == "SALESVERSION")
	  {
	   	     document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'visible';
	  	     document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'visible';
	  	     document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'visible';
          }
          else
          {
	   	     document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'hidden';
	  	     document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'hidden';
	  	     document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'hidden';
	  }
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'visible';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'visible';
	}
	else
	{
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').checked = false;
	  Nennlaengeberechnenchecked = false;
	  document.getElementById('IDC_MS_NENNLAENGE_BERECHNEN_CHECKBOX').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'hidden';
	}
	
	
	if(Nennlaengeberechnenchecked == false)
	{
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S1_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S2_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S3_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S3_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S4_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_LABEL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_S_EINHEIT_COMBO').style.visibility = 'hidden';

	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_ALPHA_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_WERTA_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_A_EINHEIT_COMBO').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_RADIUS_LABEL').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R').style.visibility = 'hidden';
	  document.getElementById('IDC_WAERMEDEHNUNG_R_EINHEIT_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_MONTAGE_GROUPBOX').style.visibility = 'hidden';
	  document.getElementById('IDC_INFO_MS_EINSATZFALL').style.visibility = 'hidden';
	  document.getElementById('IDC_INFO_MS_EINSATZFALL_2').style.visibility = 'hidden';
	  document.getElementById('IDC_INFO_MS_EINSATZFALL_3').style.visibility = 'hidden';
	  
	  document.getElementById('IDC_ART_BEWEGUNG_COMBO').style.visibility = 'hidden';
	  document.getElementById('IDC_ART_BEWEGUNG_LABEL').style.visibility = 'hidden';
	}
	else
	    document.getElementById('IDC_MONTAGE_GROUPBOX').style.visibility = 'visible';
	
	if( DGRL_Berechnung == true)
	{
 	    document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = 'visible';
	    document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = 'visible';
	    document.getElementById('IDC_FLUIDGRUPPE_LABEL').style.visibility = 'visible';
	    document.getElementById('IDC_FLUIDZUSTAND_LABEL').style.visibility = 'visible';
		
		document.getElementById('IDC_RADIO_DGRL_RESULT').style.visibility = 'visible';
	}
	else
	{
	    document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = 'hidden';
	    document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = 'hidden';
	    document.getElementById('IDC_FLUIDGRUPPE_LABEL').style.visibility = 'hidden';
	    document.getElementById('IDC_FLUIDZUSTAND_LABEL').style.visibility = 'hidden';
		
		document.getElementById('IDC_RADIO_DGRL_RESULT').style.visibility = 'hidden';
	}

	
	
}

function checkEinsatzfallBewegungen(subParam)
{
	
	//Erst Test ob Suche überhaupt erlaubt ist!
	Stroemungszustand = document.getElementById('IDC_STROEMUNGSZUSTAND_COMBO').value ;
	Bewegungszustand =  document.getElementById('IDC_BEWEGUNGSZUSTAND_COMBO').value ;
	
	//alert('Stroem='+Stroemungszustand);	
	//alert('Beweg='+Bewegungszustand);
	
	if( Stroemungszustand == 'STROEM3' || Bewegungszustand == 'BEW5')
	{
	    alert(document.getElementById("MS_HINWEIS_NICHT_ISO10380_ABGEDECKT").value);
	    document.getElementById('MIN_KATEGORIE').value = 0;
	    return;
	}
	
	test = document.getElementById('IDC_BEWEGUNGSZUSTAND_COMBO').value ;
	//alert ('Test='+test);
	if(test != 'BEW4' && test != 'BEW5')
		Bart = document.getElementById('IDC_ART_BEWEGUNG_COMBO').options[document.getElementById('IDC_ART_BEWEGUNG_COMBO').selectedIndex].value;
	else
		Bart = '';

	if ((Bart == 'ID_HUB_BGN180') || (Bart == 'ID_WAERME_BGN180'))
	{
		if (( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S3').value != 0) ) ||
		    ( (document.getElementById('IDC_WAERMEDEHNUNG_S2').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S4').value != 0) ) )
		{
			message = document.getElementById('invalidBewegungBGN180').value;
			if(message){ alert(message); }
			return;
		}
	}
	else if  (Bart == 'ID_WAERME_BGN090')
	{
		/*
		bOK = true;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S3').value != 0) ) 
		   bOK = false;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S2').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S4').value != 0) ) 
		   bOK = false;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S3').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S4').value != 0) ) 
		   bOK = false;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S2').value != 0) &&
			  (document.getElementById('IDC_WAERMEDEHNUNG_S3').value != 0) ) 
		   bOK = false;
		if (document.getElementById('IDC_WAERMEDEHNUNG_S1').value == 0) 
		   bOK = false;
		*/
		bOK = false;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value != 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S2').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S3').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S4').value == 0) ) 
		   bOK = true;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S2').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S3').value != 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S4').value == 0) ) 
		   bOK = true;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value != 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S2').value != 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S3').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S4').value == 0) ) 
		   bOK = true;
		if ( (document.getElementById('IDC_WAERMEDEHNUNG_S1').value != 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S2').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S3').value == 0) &&
			 (document.getElementById('IDC_WAERMEDEHNUNG_S4').value != 0) ) 
		   bOK = true;
		if (! bOK )
		{
			message = document.getElementById('invalidBewegungBGN090').value;
			if(message){ alert(message); }
			return;
		}
	}
	
	var DIN2827_CHECKBOX = document.getElementById('IDC_MS_AUSLEGUNG_DIN2827_CHECKBOX').checked;
	if(DIN2827_CHECKBOX)
	{
		document.getElementById('IDC_GRAT_U_SPALTFREI_CHECK').value = true;
	}
	else
	{
		document.getElementById('IDC_GRAT_U_SPALTFREI_CHECK').value = false;
	}
	
	ekSubmit(subParam);
}

/*
function changedEinsatzfall2(evt)
{
	newcode = event.srcElement.id;
	newcode = newcode.replace('IDC_MS_EINSATZFALL_AUSWAHL_TABELLE_', '');
	newcode = newcode.replace('_IMAGE', '');
	newcode = newcode.replace('_0', '');
	// alert(newcode);
	changedEinsatzfallDoIt(newcode);
}
*/

function checkDGRL(modus)
{
	if (document.getElementById('IDC_ABNAHMEN_COMBO') == null)
		return;		// Wenn wir z.B. den direkten Weg zur Druckverlustberechnung gehen, dann gibt es den Reiter gar nicht
		
	var Verfahren = document.getElementById('IDC_ABNAHMEN_COMBO').options[document.getElementById('IDC_ABNAHMEN_COMBO').selectedIndex].value;
 
 	
	// ist das ueberhaupt zulaessig?
	var PS	   			= document.getElementById('vorgabe_PS').value;
	var auswahlweg 		= document.getElementById('auswahlweg').value;
	var DGRL_Berechnung = document.getElementById('IDC_RADIO_DGRL').value;

	if ((Verfahren == 'ID_ABNAHME_DGRL') &&
		((PS <= 0.5) || (auswahlweg == 'AUSWAHL_NENNDATEN') || (DGRL_Berechnung == 'IDC_RADIO_DGRL_NEIN') ))
	{   
		if (modus == 'warnung')
		{
			message = document.getElementById('noDGRLmessage').value;
			if(message){ alert(message); }
		}
		document.getElementById('IDC_ABNAHMEN_COMBO').selectedIndex = 1;
		Verfahren = document.getElementById('IDC_ABNAHMEN_COMBO').options[document.getElementById('IDC_ABNAHMEN_COMBO').selectedIndex].value;
		setzePruefReiterVisibility(Verfahren);
		return;
	}

	setzePruefReiterVisibility(Verfahren);

	if (Verfahren == 'ID_ABNAHME_DGRL')
	{ 
		// bestimme erforderliche Kategorie, ändere nur wenn erforderlich < gewählt
		onDGLRchange('MS_ERGAENZEN');
		onDGLRKategoriechange('MS_ERGAENZEN');
	}
}

// ID_ABNAHME_31B=$ID_ABNAHME_31B$|ID_ABNAHME_22=$ID_ABNAHME_22$

function setzePruefReiterVisibility(Verfahren)
{
	var DGRLvisibility = 'hidden';
	var Restvisibility = 'visible';
	if (Verfahren == 'ID_ABNAHME_DGRL')
	{
		DGRLvisibility = 'visible';
		Restvisibility = 'hidden';
	}
	else if (Verfahren == 'ID_ABNAHME_OHNE')
	{
		DGRLvisibility = 'hidden';
		Restvisibility = 'hidden';
	}
	
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_1_LABEL').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_2_LABEL').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_3_LABEL').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_4_LABEL').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_5_LABEL').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_1').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_2').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_3').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_4').style.visibility = Restvisibility;
	document.getElementById('IDC_RADIO_MS_ABNAHME_SONSTIGE_5').style.visibility = Restvisibility;

	document.getElementById('IDC_RADIO_ROHR_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_RADIO_ROHR').style.visibility = DGRLvisibility;
	document.getElementById('IDC_RADIO_BEHAELTER_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_RADIO_BEHAELTER').style.visibility = DGRLvisibility;
	document.getElementById('IDC_VOLUMEN_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_VOLUMEN_EDIT').style.visibility = DGRLvisibility;
	document.getElementById('IDC_VOLUMEN_UNIT_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_FLUIDGRUPPE_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_FLUIDZUSTAND_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = DGRLvisibility;
	document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = DGRLvisibility;
	//alert( 	document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = DGRLvisibility);
	document.getElementById('IDC_VORGABE_KATEGORIE_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_VORGABE_KATEGORIE_COMBO').style.visibility = DGRLvisibility;
	
	/*
	document.getElementById('IDC_ZUSAETZLICHE_DOKU_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_ZEUGNIS_DGRL_31B_CHECKBOX').style.visibility = DGRLvisibility;
	document.getElementById('IDC_ZEUGNIS_DGRL_31B_CHECKBOX_LABEL').style.visibility = DGRLvisibility;
	document.getElementById('IDC_ZEUGNIS_DGRL_22_CHECKBOX').style.visibility = DGRLvisibility;
	document.getElementById('IDC_ZEUGNIS_DGRL_22_CHECKBOX_LABEL').style.visibility = DGRLvisibility;
	*/
	document.getElementById('IDC_ABNAHME_RESULT_RAHMEN').style.visibility = DGRLvisibility;
	document.getElementById('IDC_ABNAHME_RESULT_TEXT').style.visibility = DGRLvisibility;

	if (DGRLvisibility == 'hidden')
		document.getElementById('IDC_DGRL_WARNUNG_INSTABIL').style.visibility = DGRLvisibility;
}

function setzePruefumfangTextDGRL(selindex)
{
	if (selindex <= 0)
		result = document.getElementById('pruef_fix_ms_katGIP').value;
	if (selindex == 1)
		result = document.getElementById('pruef_fix_ms_kat1').value + '<br>' + document.getElementById('pruef_var_ms_kat1').value;
	if (selindex == 2)
		result = document.getElementById('pruef_fix_ms_kat2').value + '<br>' + document.getElementById('pruef_var_ms_kat2').value;
	if (selindex == 3)
		result = document.getElementById('pruef_fix_ms_kat3').value + '<br>' + document.getElementById('pruef_var_ms_kat3').value;
	if (selindex == 4)
		result = document.getElementById('pruef_fix_ms_kat4').value + '<br>' + document.getElementById('pruef_var_ms_kat4').value;

	document.getElementById('IDC_ABNAHME_RESULT_TEXT').innerHTML = result;
}

function ergInitTab(tab)
{
	//element = getElementFrom(evt);
	//tab = getTabFrom(element);

	//alert('InitTab:'+tab);
	
	ergShowTab(tab);
}

function ergOnloadTab()
{
	// alert('davor');
	Tab = dialog.IDC_ERGAENZENTABCTRL.getSelected();
	// Beim allerersten Laden ist der selektierte Reiter leer
	if (typeof(document.getElementById('IDC_ERGAENZENTABCTRL').selected) == 'undefined')
	{
		Tab = 'IDC_PRUEFBESCHEINIGUNG';
	}
	ergShowTab(Tab);
}

function ergShowTab(selektierterTab)
{
   	stype = document.getElementById('systemtype').value;
	//alert( 'ergshowtab:'+selektierterTab);
	if (selektierterTab == 'IDC_PRUEFBESCHEINIGUNG')
	{
		if (document.getElementById('IDC_ABNAHMEN_COMBO') == null)
			return;

		Verfahren = document.getElementById('IDC_ABNAHMEN_COMBO').options[document.getElementById('IDC_ABNAHMEN_COMBO').selectedIndex].value;
		setzePruefReiterVisibility(Verfahren);

		// ACHTUNG: kundenversion
		if (stype == 'SALESVERSION')
		{
//			document.getElementById('IDC_ANSCHLUSSTECHNIK_GUS').style.visibility = 'hidden';
//			document.getElementById('IDC_ANSCHLUSSTECHNIK_COMBO').style.visibility = 'hidden';
		}
	}
	else if (selektierterTab == 'IDC_DRUCKVERLUST')
	{
		document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_VORGABE_KATEGORIE_COMBO').style.visibility = 'hidden';
		if (stype == 'SALESVERSION')
		{
//			document.getElementById('IDC_ANSCHLUSSTECHNIK_GUS').style.visibility = 'hidden';
//			document.getElementById('IDC_ANSCHLUSSTECHNIK_COMBO').style.visibility = 'hidden';
		}
	}
	else if (selektierterTab == 'IDC_TABHEADER_ZUBEHOER')
	{
		if (stype == 'SALESVERSION')
		{
			// document.getElementById('IDC_ANSCHLUSSTECHNIK_GUS').style.visibility = 'hidden';
			// document.getElementById('IDC_ANSCHLUSSTECHNIK_COMBO').style.visibility = 'hidden';
		}
		document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_VORGABE_KATEGORIE_COMBO').style.visibility = 'hidden';
	}
	else
	{
		document.getElementById('IDC_FLUIDGRUPPE_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_FLUIDZUSTAND_COMBO').style.visibility = 'hidden';
		document.getElementById('IDC_VORGABE_KATEGORIE_COMBO').style.visibility = 'hidden';

		if (stype == 'SALESVERSION')
			recalcPrice();
	}
}

function recalcPrice()
{
	// alert('Preise recalc');
	// !!! nicht für Kundenversion
   	stype = document.getElementById('systemtype').value;
	if (stype != 'SALESVERSION') return;
	
	return;	// 04/2009: Kalkulation im Moment immer diabled ...

	anschluss_grat = document.getElementById('anschluss_gus').value;
	
	if (anschluss_grat == 'true')
	{
//		document.getElementById('IDC_ANSCHLUSSTECHNIK_GUS').style.visibility = 'visible';
//		document.getElementById('IDC_ANSCHLUSSTECHNIK_COMBO').style.visibility = 'hidden';
	}
	else
	{
//		document.getElementById('IDC_ANSCHLUSSTECHNIK_GUS').style.visibility = 'hidden';
//		document.getElementById('IDC_ANSCHLUSSTECHNIK_COMBO').style.visibility = 'visible';
	}
	

	calcSchlauch();
	calcEndhuelse();
	calcATL();
	calcATR();
	calcSumAT();
	calcMKGZuschlag();
	calcZeiten();
	calcAufpreise();
}

function calcSchlauch()
{
	pSchlauch = GetZahlFromEdit('SCHLAUCH_PREIS');
    // alert(pSchlauch);
	Laenge = GetZahlFromStatic('IDC_NENNWEITE_NL');
    // alert(Laenge);

	Endpreis = Round2(Laenge * pSchlauch / 1000);
	SetZahlInStatic('SCHLAUCHPREIS', Endpreis);
}

function calcEndhuelse()
{
	pHuelse = GetZahlFromEdit('PREIS_ENDHUELSE');
	nAnz = GetZahlFromStatic('ANZ_ENDHUELSEN');

	Endpreis = Round2(nAnz * pHuelse);
	SetZahlInStatic('PR_ENDHUELSEN', Endpreis);
}

function calcATL()
{
	pAT1 = GetZahlFromEdit('ATL_PREIS_1');
	pAT2 = GetZahlFromEdit('ATL_PREIS_2');
	pAT3 = GetZahlFromEdit('ATL_PREIS_3');
	pAT4 = GetZahlFromEdit('ATL_PREIS_4');

	Endpreis = Round2(pAT1 + pAT2 + pAT3 + pAT4);
	SetZahlInStatic('SUMME_LI', Endpreis);
}

function calcATR()
{
	pAT1 = GetZahlFromEdit('ATR_PREIS_1');
	pAT2 = GetZahlFromEdit('ATR_PREIS_2');
	pAT3 = GetZahlFromEdit('ATR_PREIS_3');
	pAT4 = GetZahlFromEdit('ATR_PREIS_4');

	Endpreis = Round2(pAT1 + pAT2 + pAT3 + pAT4);
	SetZahlInStatic('SUMME_RE', Endpreis);
}

function calcSumAT()
{
	pAT1 = GetZahlFromStatic('SUMME_LI');
	pAT2 = GetZahlFromStatic('SUMME_RE');

	Endpreis = Round2(pAT1 + pAT2);
	SetZahlInStatic('SUMME_ANSCHLUSSTEILE', Endpreis);
}

function calcMKGZuschlag()
{
	pAT1 = GetZahlFromStatic('SUMME_ANSCHLUSSTEILE');
	pAT2 = GetZahlFromStatic('PR_ENDHUELSEN');
	pZU = GetZahlFromEdit('MGK_ZUSCHLAG_PROZENT');

	if (pZU == 0)
		Endpreis = 0;
	else
		Endpreis = Round2( (pAT1 + pAT2) * (pZU / 100) );
	SetZahlInStatic('MGK_ZUSCHLAG', Endpreis);
}

function calcZeiten()
{
	zRuest = GetZahlFromEdit('IDC_RUESTZEITEN');
	Losgr  = GetZahlFromEdit('IDC_LOSGROESSE');
	zMont  = GetZahlFromEdit('IDC_MONTAGEZEIT_STK');
	STDsatz = GetZahlFromEdit('STUNDENSATZ');
	SonstigesA = GetZahlFromEdit('SONSTIGES_A');
	SonstigesB = GetZahlFromEdit('SONSTIGES_B');
	SonstigesC = GetZahlFromEdit('SONSTIGES_C');

	if (Losgr == 0)
		zRuestStueck = 0;
	else
		zRuestStueck = Round2(zRuest / Losgr);

	zFertigung = zRuestStueck + zMont;

	pMontage = Round2( (zFertigung / 60) * STDsatz);

	// berechne Gesamtkosten:
	pAT1 = GetZahlFromStatic('SUMME_ANSCHLUSSTEILE');
	pAT2 = GetZahlFromStatic('PR_ENDHUELSEN');
	pAT3 = GetZahlFromStatic('MGK_ZUSCHLAG');
	pAT4 = GetZahlFromStatic('SCHLAUCHPREIS');
	pHKgesamt = Round2( pMontage + SonstigesA + SonstigesB + SonstigesC + pAT1 + pAT2 + pAT3 + pAT4);

	SetZahlInStatic('RUESTZEIT_STK', zRuestStueck);
	SetZahlInStatic('FERTIGUNGSZEIT_STK', zFertigung);
	SetZahlInStatic('MONTAGE', pMontage);
	SetZahlInStatic('SUMME_HERSTELLKOSTEN', pHKgesamt);
}

function calcAufpreise()
{
	zENGK = GetZahlFromEdit('ENTWICKLUNGSGEMEINKOSTEN_PROZENT');
	zVWGK = GetZahlFromEdit('VERWALTUNGSGEMEINKOSTEN_PROZENT');
	zVEGK = GetZahlFromEdit('VERTRIEBSGEMEINKOSTEN_PROZENT');
	zGZ1  = GetZahlFromEdit('GEWINNZUSCHLAG_FIX_PROZENT');
	zGZ2  = GetZahlFromEdit('GEWINNZUSCHLAG_VARIABEL_PROZENT');
	zPROV = GetZahlFromEdit('PROVISION_PROZENT');
	zSKON = GetZahlFromEdit('SKONTI_PROZENT');
	zVERP = GetZahlFromEdit('FRACHTKOSTEN_PROZENT');
	aVERP = GetZahlFromEdit('FRACHTKOSTEN_ABSOLUT');

	pHKgesamt = GetZahlFromStatic('SUMME_HERSTELLKOSTEN');

	if (zENGK == 0)
		pENGK = 0;
	else
		pENGK = Round2( pHKgesamt * (zENGK / 100) );
	SetZahlInStatic('ENTWICKLUNGSGEMEINKOSTEN', pENGK);

	if (zVWGK == 0)
		pVWGK = 0;
	else
		pVWGK = Round2( pHKgesamt * (zVWGK / 100) );
	SetZahlInStatic('VERWALTUNGSGEMEINKOSTEN', pVWGK);

	if (zVEGK == 0)
		pVEGK = 0;
	else
		pVEGK = Round2( pHKgesamt * (zVEGK / 100) );
	SetZahlInStatic('VERTRIEBSGEMEINKOSTEN', pVEGK);

	pSelbst   = Round2(pHKgesamt + pENGK + pVWGK + pVEGK);
	SetZahlInStatic('SELBSTKOSTEN', pSelbst);

	if (zGZ1 == 0)
		pGZ1 = 0;
	else
		pGZ1 = Round2( pSelbst * (zGZ1 / 100) );
	SetZahlInStatic('GEWINNZUSCHLAG_FIX', pGZ1);

	if (zGZ2 == 0)
		pGZ2 = 0;
	else
		pGZ2 = Round2( pSelbst * (zGZ2 / 100) );
	SetZahlInStatic('GEWINNZUSCHLAG_VARIABEL', pGZ2);

	pSelbstVK = Round2(pSelbst + pGZ1 + pGZ2);
	SetZahlInStatic('SELBSTKOSTENVERKAUFSPREIS', pSelbstVK);

	if (zPROV == 0)
		pPROV = 0;
	else
		pPROV = Round2( pSelbstVK * (zPROV / 100) );
	SetZahlInStatic('PROVISION', pPROV);

	if (zSKON == 0)
		pSKON = 0;
	else
		pSKON = Round2( pSelbstVK * (zSKON / 100) );
	SetZahlInStatic('SKONTI', pSKON);

	pNettoVK  = Round2(pSelbstVK + pPROV + pSKON);
	SetZahlInStatic('NETTOVERKAUFSPREIS', pNettoVK);

	if (zVERP == 0)
		pVERP = 0;
	else
		pVERP = Round2( pNettoVK * (zVERP / 100) );
	SetZahlInStatic('FRACHTKOSTEN', pVERP);

	if (aVERP <= 0)
		aVERP = 0;
	else
		aVERP = Round2( aVERP );
	SetZahlInStatic('FRACHTKOSTEN_ABSRESULT', aVERP);

	pVK	      = Round2(pNettoVK + pVERP + aVERP);
	SetZahlInStatic('VERKAUFSPREIS', pVK);
	SetZahlInEdit('vk_preis_result', pVK);

	// Jetzt noch die laufenden Prozente zur Info berechnen:
	// pHKgesamt ist 100%
	SetZahlInStatic('SUMME_HERSTELLKOSTEN_PROZENT_GESAMT', 100);

	prozSelbstKst = Round2((pSelbst / pHKgesamt) * 100);
	SetZahlInStatic('SELBSTKOSTEN_PROZENT_GESAMT', prozSelbstKst);

	prozNettoVK = Round2((pNettoVK / pHKgesamt) * 100);
	SetZahlInStatic('NETTOVERKAUFSPREIS_PROZENT_GESAMT', prozNettoVK);

	prozVK = Round2((pVK / pHKgesamt) * 100);
	SetZahlInStatic('VERKAUFSPREIS_PROZENT_GESAMT', prozVK);
}


function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}


function druckeKalkulation(element) 
{ 
        // NEU!!! Muss noch speziell angepasst werden da Audruck nicht sonderlich gut aussieht! tf
        
        var STYLE_PATH=document.getElementById("STYLE_PATH").value; 
        var STYLES="<link rel='stylesheet' type='text/css' href='"+STYLE_PATH+"wit_print.css'>" 

        var div_array=document.getElementsByTagName('div'); 
        for(var i=1;i<div_array.length;i++) 
        { 
                if(div_array[i].id=="IDC_MS_KALKULATION_TABELLE") 
                { 
                        top.isyiframe.document.body.innerHTML = "<script>widgets = []; </script>" + STYLES + div_array[i].innerHTML; 
                        top.isyiframe.focus(); 
                        top.isyiframe.print(); 
                } 
        } 
} 



// # ============================================================================
// # Überprüfung, ob die Zubehoer-Bedingungen auf IDD_MS_ERGAENZEN i.O. sind:
// # ============================================================================

function checkZubehoerInfo(element)
{
	if (document.getElementById("IDC_COMBO_MS_ZUBEHOER_SCHUTZ_ISO_1").value == "ID_5")	
	{
		var nGesamtlaenge = 0;
		var lx	= 0;
		
		var objL1 	= document.getElementById("IDC_EDIT_LAENGE_LINKS");
		var objL2 	= document.getElementById("IDC_EDIT_LAENGE_RECHTS");
		
		l1Unit = document.getElementById("IDC_COMBO_UNIT_LAENGE_LINKS").value;
		l2Unit = document.getElementById("IDC_COMBO_UNIT_LAENGE_RECHTS").value;
		
		l1Value = getZahlFromEdit(objL1.id);
		l2Value = getZahlFromEdit(objL2.id);
		
		//alert("l1Value: "+l1Value+"\nl2Value: "+l2Value)
		if (l1Value == null) l1Value = 0;
		if (l2Value == null) l2Value = 0;
		
		//if (l1Value > 0) 
		checkZahl(objL1);
		//if (l2Value > 0) 
		checkZahl(objL2);
		
		var nNL 	= getZahlFromStatic("IDC_HIDDEN_NENNLAENGE");
		var nATL 	= getZahlFromStatic("IDC_HIDDEN_AT_RECHTS");
		var nATR 	= getZahlFromStatic("IDC_HIDDEN_AT_LINKS");
		
		if ( (l1Value > 0) || (l2Value > 0) )
		{ 
			if (l1Unit != "MM")
			{
				switch (l1Unit) 
				{
					  case "CM":
					    l1Value = l1Value * 100;
					    break;
					  case "M":
					    l1Value = l1Value * 1000;
					    break;
					  case "INCH":
					    l1Value = l1Value * 25,4;
					    break;
					  case "FOOT":
					    l1Value = l1Value * 304,8;
					    break;
					  default:
					    break;
				}
			}
			
			if (l2Unit != "MM")
			{
				switch (l2Unit) 
				{
					  case "CM":
					    l2Value = l2Value * 100;
					    break;
					  case "M":
					    l2Value = l2Value * 1000;
					    break;
					  case "INCH":
					    l2Value = l2Value * 25,4;
					    break;
					  case "FOOT":
					    l2Value = l2Value * 304,8;
					    break;
					  default:
					    break;
				}
			}
			
			lx = l1Value + l2Value;
			if (nNL > 0)
				nGesamtlaenge = nNL - (nATL + nATR);
        	else
				nGesamtlaenge = nATL + nATR;
				
	        if (lx > nGesamtlaenge)
	        {
	        	alert(document.getElementById("ERRORMSG_MS_ZUBEHOER_LAENGEN_1").value+" "+nGesamtlaenge+" "+document.getElementById("ERRORMSG_MS_ZUBEHOER_LAENGEN_2").value );
	        	element.value = "0";
	        	objL1.value = "0";
	        	objL2.value = "0";
				element.select();
				element.focus();
				return false;
				
			}
			else
			{
				ekSubmit(element);
			}
		}
	}
	
}


// # ============================================================================
// # getZahlFromStatic
// # ============================================================================

function getZahlFromStatic(elementID)
{
	sZahl = document.getElementById(elementID).value;
	sZahl = sZahl.replace(/,/,'.');
	if (sZahl == '')
		return(0);
	else
	{
		nZahl = parseFloat(sZahl);
		if (isNaN(nZahl) == true)
			return(0);
		else
			return(nZahl);
	}
}

// # ============================================================================
// # getZahlFromEdit
// # ============================================================================

function getZahlFromEdit(elementID)
{
	sZahl = $F(elementID);
    // document.getElementById(elementID).value;
	sZahl = sZahl.replace(/,/,'.');
	
	if (sZahl == '')
		return(0);
	else
	{
		nZahl = parseFloat(sZahl);
		if (isNaN(nZahl) == true)
			return(0);
		else
			return(nZahl);
	}
}


// # ============================================================================
// # Überprüfung, ob in einem Feld eine korrekte Zahl eingegeben wurde
// # ============================================================================
function checkZahl(element)
{

	var bIsZahl = false;
	
	if (!(element.value == "0")) 
	{
		zahl = getZahlFromEdit(element.id);
		if( zahl <= 0 ) 
		{
			//errormsg = document.getElementById("ERRORMSG_WRONG_INPUT").value;
			//alert(errormsg);
			element.value = "";
			element.select();
		}
		else
			bIsZahl = true;
	
		sZahl = document.getElementById(element.id).value;
		sAusdr = /[^0-9.,]/;

		if (sAusdr.exec(sZahl) != null)
		{	
			//errormsg = document.getElementById("ERRORMSG_WRONG_INPUT").value;
			//alert(errormsg);
			element.value = "";
			element.select();
		}
		else
			bIsZahl = true;
	}
	
	return bIsZahl;
}