function calc_tax(theForm)
{
	var ps;
	var kw;
	var steuer;
	var typ = theForm.fahrzeugtyp.options[theForm.fahrzeugtyp.options.selectedIndex].value
	var kurs = 13.7603;
	
	if (Number(theForm.ps.value) > 0)
	{
		ps = Number(theForm.ps.value);
		kw = Math.round(ps/1.363636); 
	}
	else if (Number(theForm.kw.value) > 0)
	{
		kw = Number(theForm.kw.value);
		ps = Math.round(kw * 1.363636);
	}
	
	if (kw > 0 && ps > 0)
	{ 
		theForm.kw.value=kw;
		theForm.ps.value=ps;
	}
	

	if (typ == "pkw")
	{
		
		if (kw > 34 )
		{
			steuer = (kw-24) * 0.55;
			if (theForm.motor[0].checked && theForm.kat[1].checked)
			{
				steuer = steuer * 1.2;
			} 	
			if (steuer < 5.5)
			{
				steuer = 5.5
			}
		}
	
	}
	if (typ == "lkw")
	{
		if (kw > 34 )
		{
			steuer = (kw-24) * 0.55;
			if (steuer < 5.5)
			{
				steuer = 5.5;
			}
			if (steuer > 60)
			{
				steuer = 60;
			}
		}
	}
	if (typ == "krad")
	{
		steuer = 0;
		if (Number(theForm.hubraum.value) >= 100)
		{
			steuer = Number(theForm.hubraum.value) * 0.022;
		}
	}
	
	if (Math.round(kw) < 35 && (typ == "pkw" || typ == "lkw"))
	{
		if (theForm.kat[0].checked)
		{
  		theForm.out_euro_mon_m.value=6.05;
  		theForm.out_euro_4jahr_m.value=17.8;
  		theForm.out_euro_2jahr_m.value=35;
  		theForm.out_euro_jahr_m.value=66;
  	
  		theForm.out_euro_mon_j.value=6.05 * 12;
  		theForm.out_euro_4jahr_j.value=17.8 * 4;
  		theForm.out_euro_2jahr_j.value=35 * 2;
  		theForm.out_euro_jahr_j.value=66;
  		
  		theForm.out_ats_mon_m.value=83.25;
  		theForm.out_ats_4jahr_m.value=245.21;
  		theForm.out_ats_2jahr_m.value=481.34;
  		theForm.out_ats_jahr_m.value=908.18;
  		
  		theForm.out_ats_mon_j.value=Math.round(83.25 * 12);
  		theForm.out_ats_4jahr_j.value=Math.round(245.21 * 4);
  		theForm.out_ats_2jahr_j.value=Math.round(481.34 * 2);
  		theForm.out_ats_jahr_j.value=Math.round(908.18);
  	}
  	else
  	{
  		theForm.out_euro_mon_m.value=6.05 * 1.2;
  		theForm.out_euro_4jahr_m.value=17.8 * 1.2;
  		theForm.out_euro_2jahr_m.value=35 * 1.2;
  		theForm.out_euro_jahr_m.value=66 * 1.2;
  	
  		theForm.out_euro_mon_j.value=6.05 * 1.2 * 12 ;
  		theForm.out_euro_4jahr_j.value=17.8 * 1.2 * 4;
  		theForm.out_euro_2jahr_j.value=35 * 1.2 * 2;
  		theForm.out_euro_jahr_j.value=66 * 1.2;
  		
  		theForm.out_ats_mon_m.value=roundit(83.25 * 1.2);
  		theForm.out_ats_4jahr_m.value=roundit(245.21 * 1.2);
  		theForm.out_ats_2jahr_m.value=roundit(481.34 * 1.2);
  		theForm.out_ats_jahr_m.value=roundit(908.18 * 1.2);
  		
  		theForm.out_ats_mon_j.value=Math.round(83.25 * 1.2) * 12;
  		theForm.out_ats_4jahr_j.value=Math.round(245.21 * 1.2) * 4;
  		theForm.out_ats_2jahr_j.value=Math.round(481.34 * 1.2) * 2;
  		theForm.out_ats_jahr_j.value=Math.round(908.18 * 1.2);
  	}
	}
	else
	{
		theForm.out_euro_mon_m.value=roundit(steuer * 1.1);
		theForm.out_euro_4jahr_m.value=roundit(steuer * 1.08);
		theForm.out_euro_2jahr_m.value=roundit(steuer * 1.06);
		theForm.out_euro_jahr_m.value=roundit(steuer);
	  
	  theForm.out_euro_mon_j.value=roundit(steuer * 1.1 * 12);
		theForm.out_euro_4jahr_j.value=roundit(steuer * 1.08 * 12);
		theForm.out_euro_2jahr_j.value=roundit(steuer * 1.06 * 12);
		theForm.out_euro_jahr_j.value=roundit(steuer * 12);
		
		
	}

}

function roundit(theNumber)
{
	var tempNumber;
	
	tempNumber = theNumber * 100;
	tempNumber = Math.round(tempNumber);
	tempNumber = tempNumber / 100;
	
	return tempNumber
}

function set_readonly(theForm)
{
	var typ = theForm.fahrzeugtyp.options[theForm.fahrzeugtyp.options.selectedIndex].value
	
	if (typ == "pkw" || typ == "lkw")
	{
		theForm.hubraum.value="-----";
		theForm.hubraum.readonly=true;
		theForm.ps.value="0";
		theForm.hubraum.readonly=false;
		theForm.kw.value="0";
		theForm.hubraum.readonly=false;
	}
	if (typ == "krad")
	{
		theForm.hubraum.value="0";
		theForm.hubraum.readonly=false;
		theForm.ps.value="-----";
		theForm.hubraum.readonly=true;
		theForm.kw.value="-----";
		theForm.hubraum.readonly=true;
	}
}



