function update() 
{
	typ = 0;
	var typ_wlasnosci = document.getElementsByName("PropertyType");
	for (i=0;i<typ_wlasnosci.length;i++){
		if (typ_wlasnosci[i].checked==true)
			typ=i+1;
	}
	val = document.getElementById("wart_n").value;
	splitstring = val.split(" ");
	val = "";
	for(i = 0; i < splitstring.length; i++)
		val += splitstring[i];
	if(val != '')
	{
		sum = 1.0*val;
		tax = 0.02*val;
		sum = sum + tax;
		document.getElementById("tax").value = tax.toFixed(2);
		temp = 0;
		
		if(val <= 3000)
			temp = 100;
		else if(val > 3000 && val <= 10000)
			temp = 100 + 0.03*(val - 3000);
		else if(val > 10000 && val <= 30000)
			temp = 310 + 0.02*(val - 10000);
		else if(val > 30000 && val <= 60000)
			temp = 710 + 0.01*(val - 30000);
		else if(val > 60000 && val <=1000000)
			temp = 1010 + 0.004*(val - 60000);
		else if(val > 1000000 && val <= 2000000)
			temp = 4770 + 0.002*(val - 1000000);
		else if(val > 2000000)
		{
			temp = 6770 + 0.0025*(val - 2000000);
			if (temp > 10000)
				temp = 10000;
		}
			
		if(typ < 3)
			temp = temp/2.0;
			
		sum = sum + temp;	
		document.getElementById("op_not").value = temp.toFixed(2);
		vat = 0.22*temp;
		
		if(typ > 1)
		{
			sum = sum + vat + 200;
			document.getElementById("wnioski").value = '200.00';
		}
		else
		{
			sum = sum + vat + 400;
			document.getElementById("wnioski").value = '400.00';
		}
			
		document.getElementById("suma").value = sum.toFixed(2);
		document.getElementById("vat_op_not").value = vat.toFixed(2);
	}
	else
	{
		document.getElementById("tax").value = '';
		document.getElementById("op_not").value = '';
		document.getElementById("vat_op_not").value = '';
		document.getElementById("op_sad").value = '';
		document.getElementById("wnioski").value = '';
		document.getElementById("suma").value = '';
	}
}