// JavaScript Document
	function setTFeeTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.tFee1.value));
		var f2=nvl(parseInt(window.document.incomeBody.tFee2.value));
		var f3=nvl(parseInt(window.document.incomeBody.tFee3.value));
		var f4=nvl(parseInt(window.document.incomeBody.tFee4.value));
		var f5=nvl(parseInt(window.document.incomeBody.tFee5.value));
		var f6=nvl(parseInt(window.document.incomeBody.tFee6.value));
		var f7=nvl(parseInt(window.document.incomeBody.tFee7.value));
		var f8=nvl(parseInt(window.document.incomeBody.tFee8.value));
		var f9=nvl(parseInt(window.document.incomeBody.tFee9.value));
		var f10=nvl(parseInt(window.document.incomeBody.tFee10.value));
		var f11=nvl(parseInt(window.document.incomeBody.tFee11.value));
		var f12=nvl(parseInt(window.document.incomeBody.tFee12.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12;
		window.document.incomeBody.ttFee.value=mySum;
	}
	function setTFineTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.tFine1.value));
		var f2=nvl(parseInt(window.document.incomeBody.tFine2.value));
		var f3=nvl(parseInt(window.document.incomeBody.tFine3.value));
		var f4=nvl(parseInt(window.document.incomeBody.tFine4.value));
		var f5=nvl(parseInt(window.document.incomeBody.tFine5.value));
		var f6=nvl(parseInt(window.document.incomeBody.tFine6.value));
		var f7=nvl(parseInt(window.document.incomeBody.tFine7.value));
		var f8=nvl(parseInt(window.document.incomeBody.tFine8.value));
		var f9=nvl(parseInt(window.document.incomeBody.tFine9.value));
		var f10=nvl(parseInt(window.document.incomeBody.tFine10.value));
		var f11=nvl(parseInt(window.document.incomeBody.tFine11.value));
		var f12=nvl(parseInt(window.document.incomeBody.tFine12.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12;
		window.document.incomeBody.ttFine.value=mySum;
	}
	function setTVatTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.tVat1.value));		
		var f2=nvl(parseInt(window.document.incomeBody.tVat2.value));
		var f3=nvl(parseInt(window.document.incomeBody.tVat3.value));
		var f4=nvl(parseInt(window.document.incomeBody.tVat4.value));
		var f5=nvl(parseInt(window.document.incomeBody.tVat5.value));
		var f6=nvl(parseInt(window.document.incomeBody.tVat6.value));
		var f7=nvl(parseInt(window.document.incomeBody.tVat7.value));
		var f8=nvl(parseInt(window.document.incomeBody.tVat8.value));
		var f9=nvl(parseInt(window.document.incomeBody.tVat9.value));
		var f10=nvl(parseInt(window.document.incomeBody.tVat10.value));
		var f11=nvl(parseInt(window.document.incomeBody.tVat11.value));
		var f12=nvl(parseInt(window.document.incomeBody.tVat12.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12;
		window.document.incomeBody.ttVat.value=mySum;
	}	
	function setTCompTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.tComp1.value));
		var f2=nvl(parseInt(window.document.incomeBody.tComp2.value));
		var f3=nvl(parseInt(window.document.incomeBody.tComp3.value));
		var f4=nvl(parseInt(window.document.incomeBody.tComp4.value));
		var f5=nvl(parseInt(window.document.incomeBody.tComp5.value));
		var f6=nvl(parseInt(window.document.incomeBody.tComp6.value));
		var f7=nvl(parseInt(window.document.incomeBody.tComp7.value));
		var f8=nvl(parseInt(window.document.incomeBody.tComp8.value));
		var f9=nvl(parseInt(window.document.incomeBody.tComp9.value));
		var f10=nvl(parseInt(window.document.incomeBody.tComp10.value));
		var f11=nvl(parseInt(window.document.incomeBody.tComp11.value));
		var f12=nvl(parseInt(window.document.incomeBody.tComp12.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12;
		window.document.incomeBody.ttComp.value=mySum;
	}
	function setTFeeColumn()
	{
		setTFeeTotal();
		setTVatTotal();
		setGrandTotal()
	}
	function setTFineColumn()
	{
		setTFineTotal();
		setTVatTotal();
		setGrandTotal()
	}
	function setTVatColumn()
	{
		setTVatTotal();
		setGrandTotal()
	}
	function setTCompColumn()
	{
		setTCompTotal();
		setGrandTotal()
	}
	


	function setOFeeTotal()
	{
		
		var f1=nvl(parseInt(window.document.incomeBody.oFee1.value));
		var f2=nvl(parseInt(window.document.incomeBody.oFee2.value));
		var f3=nvl(parseInt(window.document.incomeBody.oFee3.value));
		var f4=nvl(parseInt(window.document.incomeBody.oFee4.value));
		var f5=nvl(parseInt(window.document.incomeBody.oFee5.value));
		
		var f6=nvl(parseInt(window.document.incomeBody.oFee6.value));
		var f7=nvl(parseInt(window.document.incomeBody.oFee7.value));
		var f8=nvl(parseInt(window.document.incomeBody.oFee8.value));

		var f9=nvl(parseInt(window.document.incomeBody.oFee9.value));
		var f10=nvl(parseInt(window.document.incomeBody.oFee10.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10;
		window.document.incomeBody.otFee.value=mySum;
	}
	function setOFineTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.oFine1.value));
		var f2=nvl(parseInt(window.document.incomeBody.oFine2.value));
		var f3=nvl(parseInt(window.document.incomeBody.oFine3.value));
		var f4=nvl(parseInt(window.document.incomeBody.oFine4.value));
		var f5=nvl(parseInt(window.document.incomeBody.oFine5.value));
		var f6=nvl(parseInt(window.document.incomeBody.oFine6.value));
		var f7=nvl(parseInt(window.document.incomeBody.oFine7.value));
		var f8=nvl(parseInt(window.document.incomeBody.oFine8.value));
		var f9=nvl(parseInt(window.document.incomeBody.oFine9.value));
		var f10=nvl(parseInt(window.document.incomeBody.oFine10.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10;
		window.document.incomeBody.otFine.value=mySum;
	}
	function setOVatTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.oVat1.value));
		var f2=nvl(parseInt(window.document.incomeBody.oVat2.value));
		var f3=nvl(parseInt(window.document.incomeBody.oVat3.value));
		var f4=nvl(parseInt(window.document.incomeBody.oVat4.value));
		var f5=nvl(parseInt(window.document.incomeBody.oVat5.value));
		var f6=nvl(parseInt(window.document.incomeBody.oVat6.value));
		var f7=nvl(parseInt(window.document.incomeBody.oVat7.value));
		var f8=nvl(parseInt(window.document.incomeBody.oVat8.value));
		var f9=nvl(parseInt(window.document.incomeBody.oVat9.value));
		var f10=nvl(parseInt(window.document.incomeBody.oVat10.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10;
		window.document.incomeBody.otVat.value=mySum;
	}	
	function setOCompTotal()
	{
		var f1=nvl(parseInt(window.document.incomeBody.oComp1.value));
		var f2=nvl(parseInt(window.document.incomeBody.oComp2.value));
		var f3=nvl(parseInt(window.document.incomeBody.oComp3.value));
		var f4=nvl(parseInt(window.document.incomeBody.oComp4.value));
		var f5=nvl(parseInt(window.document.incomeBody.oComp5.value));
		var f6=nvl(parseInt(window.document.incomeBody.oComp6.value));
		var f7=nvl(parseInt(window.document.incomeBody.oComp7.value));
		var f8=nvl(parseInt(window.document.incomeBody.oComp8.value));
		var f9=nvl(parseInt(window.document.incomeBody.oComp9.value));
		var f10=nvl(parseInt(window.document.incomeBody.oComp10.value));
		var mySum=f1+f2+f3+f4+f5+f6+f7+f8+f9+f10;
		window.document.incomeBody.otComp.value=mySum;
	}
	
	function oFeeColumns()
	{
		setOFeeTotal();
		setOVatTotal();
		setGrandTotal()
	}
	function oFineColumns()
	{
		setOFineTotal();
		setOVatTotal();
		setGrandTotal()
	}
	function oVatColumns()
	{
		setOVatTotal();
		setGrandTotal()
	}
	function oCompColumns()
	{
		setOCompTotal();
		setGrandTotal()
	}

	function setGrandTotal()
	{
		var tFee=nvl(parseInt(window.document.incomeBody.ttFee.value));
		var tFine=nvl(parseInt(window.document.incomeBody.ttFine.value));
		var tComp=nvl(parseInt(window.document.incomeBody.ttComp.value));
		var tVat=nvl(parseInt(window.document.incomeBody.ttVat.value));
		var oFee=nvl(parseInt(window.document.incomeBody.otFee.value));
		var oFine=nvl(parseInt(window.document.incomeBody.otFine.value));
		var oVat=nvl(parseInt(window.document.incomeBody.otVat.value));
		var oComp=nvl(parseInt(window.document.incomeBody.otComp.value));
		var grandTotal=tFee+tFine+tVat-tComp+oFee+oFine+oVat-oComp;
		window.document.incomeBody.grandTotal.value=grandTotal;
	}
	
	function nvl(one)
	{
		if(!one>0)
		{
			one=0;
		}
		one=parseInt(one);
		return one;
	}

	function getInt(one)
	{
		var two=one.length;
		var myOutput="";
		for(var i=0; i<two; i++)
		{
			var ch=one.substr(i,1);
			if(checkInt(ch)==1)
			{
				myOutput=myOutput+ch;
			}
		}
		return myOutput;
	}

	function checkInt(one)
	{
		var result=0;
		if(one==0)
		{
			result=1;
		}
		else if(one==1)
		{
			result=1;
		}
		else if(one==2)
		{
			result=1;
		}
		else if(one==3)
		{
			result=1;
		}
		else if(one==4)
		{
			result=1;
		}
		else if(one==5)
		{
			result=1;
		}
		else if(one==6)
		{
			result=1;
		}
		else if(one==7)
		{
			result=1;
		}
		else if(one==8)
		{
			result=1;
		}
		else if(one==9)
		{
			result=1;
		}
		return result;
	}

	function setTVat1()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee1.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine1.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat1.value=vat;		
	}
	function setTVat2()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee2.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine2.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat2.value=vat;		
	}
	function setTVat3()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee3.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine3.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat3.value=vat;		
	}
	function setTVat4()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee4.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine4.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat4.value=vat;		
	}
	function setTVat5()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee5.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine5.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat5.value=vat;		
	}
	function setTVat6()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee6.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine6.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat6.value=vat;		
	}
	function setTVat7()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee7.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine7.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat7.value=vat;		
	}
	function setTVat8()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee8.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine8.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat8.value=vat;		
	}
	function setTVat9()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee9.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine9.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat9.value=vat;		
	}
	function setTVat10()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee10.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine10.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat10.value=vat;		
	}
	function setTVat11()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee11.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine11.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat11.value=vat;		
	}
	function setTVat12()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.tFee12.value));
		var fine=nvl(parseInt(window.document.incomeBody.tFine12.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.tVat12.value=vat;		
	}

	function setOVat1()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee1.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine1.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat1.value=vat;		
	}

	function setOVat2()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee2.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine2.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat2.value=vat;		
	}
	function setOVat3()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee3.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine3.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat3.value=vat;		
	}
	function setOVat4()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee4.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine4.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat4.value=vat;		
	}
	function setOVat5()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee5.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine5.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat5.value=vat;		
	}
	function setOVat6()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee6.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine6.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat6.value=vat;		
	}
	function setOVat7()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee7.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine7.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat7.value=vat;		
	}
	function setOVat8()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee8.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine8.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat8.value=vat;		
	}
	function setOVat9()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee9.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine9.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat9.value=vat;		
	}
	function setOVat10()
	{
		var vatParcent=parseFloat(window.document.incomeBody.hiddenVatRate.value);
		var fee=nvl(parseInt(window.document.incomeBody.oFee10.value));
		var fine=nvl(parseInt(window.document.incomeBody.oFine10.value));
		var vat=((fee+fine)*vatParcent)/100;
		vat=Math.round(vat);
		window.document.incomeBody.oVat10.value=vat;		
	}
	function setTreatmentTotal()
	{
		var fee=nvl(parseInt(window.document.treatmentBody.fee.value));
		var fine=nvl(parseInt(window.document.treatmentBody.fine.value));
		var vat=nvl(parseInt(window.document.treatmentBody.vat.value));
		var discount=nvl(parseInt(window.document.treatmentBody.discount.value));
		var total=(fee+fine+vat-discount);
		window.document.treatmentBody.received.value=total;
	}
	function setTreatmentVatAndTotal()
	{
		var vatParcent=parseFloat(window.document.treatmentBody.vatParcent.value);
		if(!vatParcent>0)
		{
			vatParcent=0;
		}
		//alert(vatParcent);
		var fee=nvl(parseFloat(window.document.treatmentBody.fee.value));
		var fine=nvl(parseFloat(window.document.treatmentBody.fine.value));
		var newVat=((fee+fine)*vatParcent)/100;
		newVat=Math.round(newVat);
		window.document.treatmentBody.vat.value=newVat;
		setTreatmentTotal();
	}
