
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) == "-")
			{if(Nummer.charAt(0) == "-") 
				Variable=Variable.concat("-");
			}

		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--)
		{ 
		if (i == Gross && Variable.charAt(i)=="0" )
			{Ausgabe= Ausgabe;
			 Gross=Gross-1;}

		else
			Ausgabe= Ausgabe.concat(Variable.charAt(i));		
		}
		return Ausgabe;

	}   


function FRAVerwA(Wert,Markiert,Faktor)
	{ 
	Ergebnis = 0;
	if (Markiert == true)
		{	
		Ergebnis = RAGeb(Wert);
		}
	Ergebnis =Faktor*Ergebnis;

	return Ergebnis;
	}

function FRAVerwB(Wert,Markiert,Faktor,Vorb)
	{ 

	Ergebnis = 0;
	if (Markiert == true)
		{	
		Ergebnis = RAGeb(Wert);
		}
	if (Vorb == true)
		{

		if (Faktor == "1.3")
			Faktor = "0.7";
		if (Faktor == 1.5)
			Faktor = "0.9";
		if (Faktor == "2.5")
			Faktor = "1.3";
		if (Faktor == "1.8")
			Faktor = "1.1";

		}

	Ergebnis =Faktor*Ergebnis;

	return Ergebnis;
	}

function GerGeb(Wert,Kl,Instanz)
	{ 	
	Ergebnis = 0;
	Faktor = "0";
	if (Kl)
		{
		if (Instanz == "2.5")
			{Faktor = "3";}
		else
			{Faktor = "4";}
		}


	Ergebnis = GerGebZR(Wert);	
	Ergebnis = Ergebnis * Faktor;

	return Ergebnis;
	}

function PostT(Wert1,Wert2,Wert3,Wert4)
 	{

	Ergebnis = "0";
		Ergebnis = PTP(Wert1);
		Ergebnis = Ergebnis + PTP(Wert2);
		Ergebnis = Ergebnis + PTP(Wert3);
		Ergebnis = Ergebnis + PTP(Wert4);
		
	return Ergebnis;	
	}

function PTP(Wert)
 	{Ergebnis = 0;
	if (Wert > 0)
		{Ergebnis = parseInt(Wert*20)/100;
		if (Ergebnis > 20)
			Ergebnis = 20;
		}
	return Ergebnis;	
	}

function Ergeb(Wert1,Wert2,Wert3,Wert4,Post,Steu,Satz)
 	{

	Ergebnis = Wert1*1+Wert2*1+Wert3*1+Wert4*1+Post*1;
	Ergebnis = parseInt(Ergebnis*100)/100;	
	if (Steu)
		Ergebnis = parseInt(Ergebnis*Satz)/100;	

	return Ergebnis;	
	}


function Berechnen()
 	{

	document.VR.RAVerwA.focus();
	document.VR.RAVerwB.focus();
	document.VR.RAVerwC.focus();
	document.VR.RAVerwD.focus();
	document.VR.GerVerw.focus();
	document.VR.PostP.focus();
	document.VR.MW.focus();
	}


/* ********** Gebührenrechnungen in Euro************* */

function RAGeb(StrW)
	{ 

	  if (StrW > 30000000)
		{StrW = 30000000;
		}


 	  var Geb = 25;
	  if (StrW >= 500000)
		{
		Geb = 2996;
		while (StrW > 500000)
   	  	  { StrW = StrW - 50000;
		    Geb = Geb + 150;
		  }
		 StrW = 0;
		}
	  if (StrW >= 200000)
		{
		Geb = 1816;
		while (StrW > 200000)
   	  	  { StrW = StrW - 30000;
		    Geb = Geb + 118;
		  }
		 StrW = 0;
		}
	  if (StrW >= 50000)
		{
		Geb = 1046;
		while (StrW > 50000)
   	  	  { StrW = StrW - 15000;
		    Geb = Geb + 77;
		  }
		 StrW = 0;
		}
	  if (StrW >= 25000)
		{
		Geb = 686;
		while (StrW > 25000)
   	  	  { StrW = StrW - 5000;
		    Geb = Geb + 72;
		  }
		 StrW = 0;
		}
	  if (StrW >= 10000)
		{
		Geb = 486;
		while (StrW > 10000)
   	  	  { StrW = StrW - 3000;
		    Geb = Geb + 40;
		  }
		 StrW = 0;
		}
	  if (StrW >= 5000)
		{
		Geb = 301;
		while (StrW > 5000)
   	  	  { StrW = StrW - 1000;
		    Geb = Geb + 37;
		  }
		 StrW = 0;
		}
	  if (StrW > 1500)
		{
		Geb = 105;
		while (StrW > 1500)
   	  	  { StrW = StrW - 500;
		  Geb= Geb + 28;
		  }
		 StrW = 0;
 		}
	  if (StrW > 300)
		{Geb = 25;
		 while (StrW > 300)
   	  	  { StrW = StrW - 300;
		  Geb= Geb + 20;
		  }
		 StrW = 0; 
		}
	   
	   return Geb;
	}

/* ******Gericht *************** */

function GerGebZR(StrW)
	{ 
 	  var Geb = 25;
	  if (StrW >= 500000)
		{
		Geb = 2956;
		while (StrW > 500000)
   	  	  { StrW = StrW - 50000;
		    Geb = Geb + 150;
		  }
		 StrW = 0;
		}
	  if (StrW >= 200000)
		{
		Geb = 1456;
		while (StrW > 200000)
   	  	  { StrW = StrW - 30000;
		    Geb = Geb + 150;
		  }
		 StrW = 0;
		}
	  if (StrW >= 50000)
		{
		Geb = 456;
		while (StrW > 50000)
   	  	  { StrW = StrW - 15000;
		    Geb = Geb + 100;
		  }
		 StrW = 0;
		}
	  if (StrW >= 25000)
		{
		Geb = 311;
		while (StrW > 25000)
   	  	  { StrW = StrW - 5000;
		    Geb = Geb + 29;
		  }
		 StrW = 0;
		}
	  if (StrW >= 10000)
		{
		Geb = 196;
		while (StrW > 10000)
   	  	  { StrW = StrW - 3000;
		    Geb = Geb + 23;
		  }
		 StrW = 0;
		}
	  if (StrW >= 5000)
		{
		Geb = 121;
		while (StrW > 5000)
   	  	  { StrW = StrW - 1000;
		    Geb = Geb + 15;
		  }
		 StrW = 0;
		}
	  if (StrW > 1500)
		{
		Geb = 65;
		while (StrW > 1500)
   	  	  { StrW = StrW - 500;
		  Geb= Geb + 8;
		  }
		 StrW = 0;
 		}
	  if (StrW > 300)
		{Geb = 25;
		 while (StrW > 300)
   	  	  { StrW = StrW - 300;
		  Geb= Geb + 10;
		  }
		 StrW = 0; 
		}

	   return Geb;
	}



