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));		
		}
		location.replace('#Berechn');
		return Ausgabe;

	}   



function Gebberechn(StreitW,Faktor,MwSt)
{	Faktor= Faktor*1;

	Ergebn = parseInt((RAGeb(StreitW)*Faktor*100)+0.5)/100;

	Ergebn = PostundMwst(Ergebn,MwSt,"0");
     	return Ergebn;
} 	

function GebMB(StreitW,Faktor,bla)
{	Faktor= Faktor*1;
	Ergebn= 0;

	if (bla == true)
		{Ergebn = parseInt((RAGeb(StreitW)*Faktor*100)+0.5)/100;
		if (Ergebn < 10)
			{Ergebn = 10;
			}
		}
	else
		{Ergebn = 0;
		}

     	return Ergebn;
} 	

function GebMBA(StreitW,Faktor,bla,blub)
{	Faktor= Faktor*1;
	Ergebn= 0;

	if (blub == false)
		{Faktor = Faktor * 2;
		}
	if (bla == true)
		{Ergebn = parseInt((RAGeb(StreitW)*Faktor*100)+0.5)/100;
		}
	else
		{Ergebn = 0;
		}

     	return Ergebn;
} 	

function GK(StreitW,Check)
{	StreitW = StreitW*1;
	
	Ergebn = 0;

	if (document.Mahnbesch.CGK.checked == 1)
		{
		 var Ergebn = parseInt(GerGebZR(StreitW)*50)/100;

	 	 if (Ergebn < 23)
			Ergebn = 23;
		}
	 return Ergebn;
}


function Berechnen()
{	
	document.ZivilR.Kost.focus();
	document.ZivilR.KostV.focus();
}	


function PTP(KRA,VBKost,KVollst,Auss)
	{     StreitW = KRA*1 + VBKost * 1 + KVollst * 1 + Auss * 1;
	
	      Ergebn=parseInt((StreitW*20)+0.5)/100;

		 if (Ergebn > 20)
			Ergebn = 20;
	      return Ergebn;
	}

function Summe(KGericht,KRA,VBKost,KVollst,Post,AusG,Faktor)
{
	 Faktor = Faktor *100
	 Ergebn= parseInt(KGericht * 100+AusG*Faktor + KRA * Faktor + KVollst * Faktor + VBKost * Faktor + Post * Faktor)/100;
  	 return Ergebn;
}

function Aend(Vor)
{	
	if (Vor == true)
		{Ergebn = 1.16;
		}
	else
		{
		Ergebn = 1.19;
		}

  	 return Ergebn;
}

function Rechen()
 {
   		document.Mahnbesch.Gericht.focus();
   		document.Mahnbesch.Ausser.focus();
  		document.Mahnbesch.Titel.focus();
   		document.Mahnbesch.VB.focus();
   		document.Mahnbesch.RAVoll.focus();
   		document.Mahnbesch.Post.focus();
   		document.Mahnbesch.Gesamt.focus();
   		document.Mahnbesch.GesamtA.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;
	}



/* ************** Berechnung der Postauslagen und MwSt.************/
function PostundMwst(Geb,Steu,Post)
	{if (Geb < 10)
		Geb = 10;
	 Steu=Steu*100;
	 Zuschl=0;
	if (Post == 0)
		{ Zuschl = (Geb *20)+0.5;
		  Zuschl = parseInt(Zuschl)/100;
	
		     {if (Zuschl > 20)
			Zuschl = 20;
	     	     }
		}
	 MWSt=parseInt((Geb+Zuschl)*Steu+0.5)/100;
	 return MWSt;
	}
