
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--)
		{ 
		if (i == Gross && Variable.charAt(i)=="0" )
			{Ausgabe= Ausgabe;
			 Gross=Gross-1;}

		else
			Ausgabe= Ausgabe.concat(Variable.charAt(i));		
		}
		return Ausgabe;

	}   

function RechenAR()
 	{

	document.ArbR.AussG.focus();
	document.ArbR.RAG.focus();
	document.ArbR.GerG.focus();
	document.ArbR.RAV.focus();
	document.ArbR.Zu.focus();
	document.ArbR.Post.focus();
	document.ArbR.Gesamt.focus();
	document.ArbR.GesamtA.focus();
	}

function GebGerichtA(StreitW,Fakt,Aus,MBK,KlG,BerG)
{	if (StreitW == NaN)
		StreitW = 0;
	if (StreitW > 30000000);
	Ergebn = 0;

	if (Aus == true)
		{ 
		  if (MBK == true || KlG == true || BerG == true)
			{

			if (Fakt > 1.5)
				{;
				 Fakt = Fakt- 0.75;
				}
			else 
				{
				Fakt = parseInt(Fakt/0.02)/100;
				}
			}
			Ergebn = parseInt((RAGeb(StreitW)*Fakt*100)+0.5)/100;
			if (Ergebn	<10)
				{Ergebn = 10;}
		}


	return Ergebn;

}

function GebGerichtB(StreitW,MBK,KlG,BerG)
{	if (StreitW == NaN)
		StreitW = 0;
	if (StreitW > 30000000);
	Ergebn = 0;
	Fakt = 0;

 	if (MBK == true || KlG == true || BerG == true)
		{ 
		  if (MBK == true) 
			Fakt = 1.5;
		 
		 if (KlG == true)
			Fakt = 2.5;
		
		if (BerG == true)
			Fakt = 2.8;
			
			Ergebn = parseInt((RAGeb(StreitW)*Fakt*100)+0.5)/100;
			if (Ergebn	<10)
				{Ergebn = 10;}

		
		}

	return Ergebn;

}

function GebGerichtC(StreitW,MBK,KlG,BerG,Ver)
{	if (StreitW == NaN)
		StreitW = 0;
	if (StreitW > 30000000);
	Ergebn = 0;
	Fakt = 0;



	if (MBK == true || KlG == true || BerG == true)
		{ 
		  if (MBK == true) 
			{Fakt = 0.4;
			 Ergebn = parseInt((GerGebZR(StreitW)*Fakt*100)+0.5)/100;

			  if (MBK == true && Ergebn < 15)
				{
				DatE = confirm("Der Mahnbescheid wird nach dem 01.07.2006 bei Gericht eingereicht (sonst Abbrechen drücken)");

				 if (DatE == true)
				  	{
					  Ergebn=18 ;
					}
				else
					{
				  	  Ergebn=15 ;
					}
				}
			}
		 
		 if (KlG == true)
			{Fakt = 2.0;
			if (Ver == true)
				Fakt = 0.0;
			 Ergebn = parseInt((GerGebZR(StreitW)*Fakt*100)+0.5)/100;
			}
		
		if (BerG == true)
			{Fakt = 3.2;
			 Ergebn = parseInt((GerGebZR(StreitW)*Fakt*100)+0.5)/100;
			}
		
		}


	return Ergebn;

}


function GebGerichtD(StreitW,MBK,KlG,BerG,Ver)
{	if (StreitW == NaN)
		StreitW = 0;
	if (StreitW > 30000000);
	Ergebn = 0;
	Fakt = 0;

	if ( Ver == true)
		{
		 if (MBK == true || KlG == true || BerG == true)
			{Fakt = 1.0;
			 if (BerG == true)
				{Fakt = 1.3;
				}
			 Ergebn = parseInt((RAGeb(StreitW)*Fakt*100)+0.5)/100;

			 if (Ergebn	<10)
				{Ergebn = 10;}
			}
		else
			{Fakt = 1.5;
			 Ergebn = parseInt((RAGeb(StreitW)*Fakt*100)+0.5)/100;

			 if (Ergebn	<10)
				{Ergebn = 10;}
			}


		}

	return Ergebn;

}

function PTP(Wert1,Wert2,Wert3,Wert4)
	{ Ergebn = Wert1*1+Wert2*1+Wert3*1+Wert4*1;

	Ergebn = Ergebn *0.2;

	if (Ergebn > 20)
		{Ergebn = 20;}

	return Ergebn;
	}


function GebGerichtE(StreitW,Fakt)
	{	if (StreitW == NaN)
		StreitW = 0;
	if (StreitW > 30000000);

	Ergebn = 0;
	
	Ergebn = parseInt((RAGeb(StreitW)*Fakt*100)+0.5)/100;
	

	return Ergebn;
	}

function Summe(Wert1,Wert2,Wert3,Wert4,WertG,Wert5,Fakt)
	{
	Ergebn =(Wert1*1+Wert2*1+Wert3*1+Wert4*1+Wert5*1)*Fakt+WertG*1
	Ergebn = parseInt(Ergebn *100+0.49)/100;
	
	return Ergebn;
	}


/**********************************/


function Regelgeb(StreitW,Faktor,MwSt)
{
    StreitW = StreitW * Waehrung;
	Ergebn = parseInt((RAGeb(StreitW)*Faktor*100)+0.5)/100;	

	Ergebn = PostundMwst(Ergebn,MwSt,"1");
     	return Ergebn;
} 

function Gebberechn(StreitW,Faktor,MwSt,Erhoehung,wieviel)
{	Faktor= Faktor*1+(Erhoehung*wieviel);

	Ergebn = parseInt((RAGeb(StreitW)*Faktor*100)+0.5)/100;
	Ergebn = PostundMwst(Ergebn,MwSt,"0");
     	return Ergebn;
} 	

function Gericht(StreitW,Faktor)
{	StreitW = StreitW;
		Ergebn = parseInt((GerGebZR(StreitW)*Faktor*100)+0.5)/100;

	return Ergebn;
}

function GerichtMB(StreitW,Faktor)
{	StreitW = StreitW;
		Ergebn = parseInt((GerGebZR(StreitW)*Faktor*100)+0.5)/100;

	if (Ergebn < 15)
		{Ergebn = 15;
		}
	return Ergebn;
}



/* ********** 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 *************** */



/* ************** Berechnung der Postauslagen und MwSt.************/

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;
	}
