
function ChkNumber(Nummer)
	{var Variable="";
	 var Ausgabe = "";
	Komma = 0;

	        Gross = Nummer.length - 1;
		for(i = Gross; i >= 0; i--)
		{ if (isNaN(Nummer.charAt(i)) != true)
			Variable=Variable.concat(Nummer.charAt(i));

		if (Nummer.charAt(i)=="," && Komma==0 || Nummer.charAt(i)=="." && Komma==0)
			{Variable=Variable.concat(".");
			 Komma = Komma+1;
			}
		}
		Gross = Variable.length - 1;
		if (Gross == 0)
			Ausgabe="0";
		for(i = Gross; i >= 0; i--)
		{ 
		Ausgabe= Ausgabe.concat(Variable.charAt(i));		
		}
		return Ausgabe;

	}   

function Gericht(Wert)
	{  
	  Wert = ChkNumber(Wert);

	 if (Wert < 40)
		{document.Straf.Instanz[0].checked = true;
		 document.Straf.Hoehe.value = 1;
		}

	 if (Wert < 5000 && Wert >= 40)
		{document.Straf.Instanz[1].checked = true;
		 document.Straf.Hoehe.value = 2;
		}

	if (Wert >= 5000)
		{document.Straf.Instanz[2].checked = true;
		 document.Straf.Hoehe.value = 3;
		}

	
	  Wert = parseInt(Wert *10)/100;
	 if (Wert < 40)
		Wert = 40;

	 if (Wert > 15000)
		Wert = 15000;

	  return Wert;
	}

function RGrundG(Rahmen,Basis,Oben,Ja)
{	Wert = Oben * 1;
	{
		Rahmen = Rahmen * 1;
	
		Wert = Wert- Basis * 1;
		Wert = Wert * Rahmen;
		Wert = Wert*1 + Basis * 1;
	}
		if (Ja == false)
			Wert = 0;
	return Wert;
}

function RVerfG(Rahmen,Inst,Ja)
{
	if (Inst == 1)
		{
		Oben = 100*1;
		Basis = 10*1;
		}
	if (Inst == 2)
		{
		Oben = 250*1;
		Basis = 20*1;
		}
	if (Inst == 3)
		{
		Oben = 250*1;
		Basis = 30*1;
		}

	Wert = RGrundG(Rahmen,Basis,Oben,Ja)			
			
	return Wert;
}

function RVerfG2(Rahmen,Inst,Ja)
{
	if (Inst == 1)
		{
		Oben = 100*1;
		Basis = 10*1;
		}
	if (Inst == 2)
		{
		Oben = 250*1;
		Basis = 20*1;
		}
	if (Inst == 3)
		{
		Oben = 300*1;
		Basis = 40*1;
		}

	Wert = RGrundG(Rahmen,Basis,Oben,Ja)			
		
			
	return Wert;
}

function RVerfG3(Rahmen,Inst,Ja,Faktor)
{	
	if (Inst == 1)
		{
		Oben = 200*1;
		Basis = 20*1;
		}
	if (Inst == 2)
		{
		Oben = 400*1;
		Basis = 30*1;
		}
	if (Inst == 3)
		{
		Oben = 470*1;
		Basis = 70*1;
		}

	Wert = RGrundG(Rahmen,Basis,Oben,Ja)* Faktor;
		
			
	return Wert;
}


function Probe(Ja,Vergl)
	{ 


	Wert = Vergl;

	if (Ja)
		{Wert = true;
		document.Straf.Einstell.checked = false;
		}
	return  Wert;
	}


function ProbeB(Ja,Vergl)
	{ 


	Wert = Vergl;

	if (Ja)
		Wert = false;
	
	document.Straf.TGC.checked = Wert;
		
	return  Wert;
	}




function PTP(Geb1,Geb2,Geb2a,Geb2b,Geb3,Geb4,Geb5)
	{
	 Wert= Geb1 * 1 + Geb2 * 1 + Geb2a * 1+ Geb2b* 1+ Geb3 * 1 + Geb4 * 1 + Geb5 * 1;
 	 
	Wert = Wert * 20;
	
	Wert = parseInt(Wert)/100;

	 if (Wert > 20)
		Wert = 20;
	
	 return Wert;
	}


function Summe(Geb1,Geb2,Geb2a,Geb2b,Geb3,Geb4,Geb5,Steu)
	{
	 Wert= Geb1 * 1 + Geb2 * 1 + Geb2a * 1+ Geb2b* 1+ Geb3 * 1 + Geb4 * 1 + Geb5 * 1;
 	 
	WertA = Wert * 20;
	
	WertA = parseInt(WertA)/100;

	 if (WertA > 20)
		WertA = 20;

	Wert = parseInt((WertA+Wert)* Steu)/100;	
	 return Wert;
	}

function Gebuehr()
	{	
		document.Straf.Gebuehr1.focus();
		document.Straf.Gebuehr2.focus();
		document.Straf.Gebuehr2a.focus();
		document.Straf.Gebuehr2b.focus();
		document.Straf.Gebuehr3.focus();
		document.Straf.Gebuehr4.focus();
		document.Straf.Gebuehr5.focus();
		document.Straf.Post.focus();
		document.Straf.Gesamt.focus();

	}




