// JavaScript Document  ©2007 made by mp-tsyle.com

function Runden(x) {
  var k = (Math.round(x * 100) / 100).toString();
  k += (k.indexOf('.') == -1)? '.00' : '00';
  var p = k.indexOf('.'), m = k.indexOf('-.');
  var f = (p == 0 || m == 0)? '0,' : ',';
  return k.substring(0, p) + f + k.substring(p+1, p+3);
}

function berechnen(){
	$F13_out = document.Formular.C13.value*document.Formular.C7.value/document.Formular.F7.value;
	document.Formular.F13.value = Math.round($F13_out); 
	document.getElementById("F13").firstChild.nodeValue = Math.round($F13_out);
	$C18_out = document.Formular.C8.value/1000*document.Formular.C13.value*(document.Formular.C11.value/100); 
	
	with (document.Formular) C18.value = Runden(parseFloat($C18_out));
	document.getElementById("C18").firstChild.nodeValue = Runden(parseFloat($C18_out)) + " EUR";
	
	$C23_out = document.Formular.C7.value/document.Formular.C8.value;
	$F23_out = document.Formular.F7.value/document.Formular.F8.value;
	
	with (document.Formular) C23.value = Runden(parseFloat($C23_out));
	document.getElementById("C23").firstChild.nodeValue = Runden(parseFloat($C23_out));
	
	with (document.Formular) F23.value = Runden(parseFloat($F23_out));
	document.getElementById("F23").firstChild.nodeValue = Runden(parseFloat($F23_out));
	
	$F18_out = $C18_out*$C23_out/$F23_out;
	with (document.Formular) F18.value = Runden(parseFloat($F18_out));
	document.getElementById("F18").firstChild.nodeValue = Runden(parseFloat($F18_out)) + " EUR";
	
	$F26_out = $C18_out-$F18_out;
	with (document.Formular) F26.value = Runden(parseFloat($F26_out));
	document.getElementById("Differenz").firstChild.nodeValue = Runden(parseFloat($F26_out)) + " EUR";
	
	// Klasse C23 berechen
	if($C23_out <= 2.2){
		$Klasse_C23 = "G";
	}
	if(($C23_out > 2.2) && ($C23_out < 2.4)){
		$Klasse_C23 = "F";
	}
	if(($C23_out >= 2.4) && ($C23_out < 2.6)){
		$Klasse_C23 = "E";
	}
	if(($C23_out >= 2.6) && ($C23_out < 2.8)){
		$Klasse_C23 = "D";
	}
	if(($C23_out >= 2.8) && ($C23_out < 3.0)){
		$Klasse_C23 = "C";
	}
	if(($C23_out >= 3.0) && ($C23_out < 3.2)){
		$Klasse_C23 = "B";
	}
	if($C23_out > 3.2){
		$Klasse_C23 = "A";
	}
	// Klasse F23 berechen
	if($F23_out <= 2.2){
		$Klasse_F23 = "G";
	}
	if(($F23_out > 2.2) && ($F23_out < 2.4)){
		$Klasse_F23 = "F";
	}
	if(($F23_out >= 2.4) && ($F23_out < 2.6)){
		$Klasse_F23 = "E";
	}
	if(($F23_out >= 2.6) && ($F23_out < 2.8)){
		$Klasse_F23 = "D";
	}
	if(($F23_out >= 2.8) && ($F23_out < 3.0)){
		$Klasse_F23 = "C";
	}
	if(($F23_out >= 3.0) && ($F23_out < 3.2)){
		$Klasse_F23 = "B";
	}
	if($F23_out > 3.2){
		$Klasse_F23 = "A";
	}
	document.getElementById("C21").firstChild.nodeValue = $Klasse_C23;
	document.getElementById("F21").firstChild.nodeValue = $Klasse_F23;

}
