KPMG=function(){
this.dom=new newsi.HTML.DOM();
};
KPMG.prototype=newsi.html;
KPMG.prototype.CalculateTaxDifference=function(){
this.MainPerson;
this.Age;
this.Children;
this.Hours;
this.spouseAge;
this.spouseHours;
this.Age = this.gebid('txtAge').value;
this.Children = this.gebid('txtChildren').value;
this.Hours = this.gebid('txtHours').value;
this.spouseAge = this.gebid('txtSpouseAge').value;
this.spouseHours = this.gebid('txtSpouseHours').value;

this.MainPerson = new KPMGBudgCalc.Person(
	this.gebid('IncludeSpouse').checked, 
	this.GetSelectedItem('MyGender', 'M'), 
	Number(this.Age), 
	Number(this.Children), 
	Number(this.Hours), 
	this.GetSelectedItem('MaritalStatus', 'S'), 
	this.GetMyIncome(), 
	this.GetSelectedItem('SpouseGender', 'F'), 
	Number(this.spouseAge), 
	Number(this.spouseHours), 
	this.GetSpouseIncome(), 
	this.GetLevies(), 
	this.GetCarsForRoadTax(), 
	this.GetCompanyCars(), 
	this.GetSpouseCompanyCars(), 
	this.GetCompanyVans(), 
	this.GetSpouseCompanyVans()
	);
this.MainPerson.GetTax();
var objDiv;
objDiv = this.gebid('output');
this.dom.iH({el:objDiv,text:this.MainPerson.GetOutputs()});
objDiv = this.gebid('debugoutput');
this.dom.iH({el:objDiv,text:this.MainPerson.GetDebugOutputs()});
}

KPMG.prototype.GetMyIncome=function(){
var myIncome;
var savingsIncome;
var dividendIncome;
var employmentIncome;
var selfEmployedIncome;
var RentalIncome;
var NonStatePen;
selfEmployedIncome = this.gebid('txtSelfAnnlEmp').value;
RentalIncome = this.gebid('txtRentIncm').value;
savingsIncome = this.gebid('txtSavInc').value;
dividendIncome = this.gebid('txtDivIncm').value;
employmentIncome = this.gebid('txtAnnlEmp').value;
NonStatePen = this.gebid('txtNonStatePen').value;
myIncome = new KPMGBudgCalc.Income(Number(savingsIncome),Number(dividendIncome), Number(employmentIncome),  Number(RentalIncome), Number(selfEmployedIncome), Number(NonStatePen));
return myIncome;
};
KPMG.prototype.GetSpouseIncome=function(){
var spouseIncome;
var spouseSavingsIncome;
var spouseDividendIncome;
var spouseEmploymentIncome;
var spouseSelfEmployedIncome;
var spouseRentalIncome;
var SpouseNonStatePen;
spouseSelfEmployedIncome = this.gebid('txtSpouseSelfAnnlEmp').value;
spouseRentalIncome = this.gebid('txtSpouseRentIncm').value;
spouseSavingsIncome = this.gebid('txtSpouseSavInc').value;
spouseDividendIncome = this.gebid('txtSpouseDivIncm').value;
spouseEmploymentIncome = this.gebid('txtSpouseAnnlEmp').value;
SpouseNonStatePen = this.gebid('txtSpouseNonStatePen').value;
spouseIncome = new KPMGBudgCalc.Income(Number(spouseSavingsIncome),Number(spouseDividendIncome), Number(spouseEmploymentIncome),  Number(spouseRentalIncome), Number(spouseSelfEmployedIncome), Number(SpouseNonStatePen));
return spouseIncome;
};
KPMG.prototype.GetLevies=function(){
var CigPackets = 0;
var BeerUnits = 0;
var WineUnits = 0;
var SpiritsUnits = 0;
var FuelLitre = 0;
var FuelType;
var FlightsShort = 0;
var FlightsShortPr = 0
var FlightsLong = 0;
var FlightsLongPr = 0;
var IncludeSpouse = false;
var myLevies;
CigPackets = Number(this.gebid('txtCigs').value);
BeerUnits = Number(this.gebid('txtBeer').value);
WineUnits = Number(this.gebid('txtWine').value);
SpiritsUnits = Number(this.gebid('txtSpirits').value);
FuelLitre = Number(this.gebid('txtFuel').value);
FlightsShort = Number(this.gebid('txtFlghtShrtSt').value);
FlightsShortPr = Number(this.gebid('txtFlightShortPr').value);
FlightsLong = Number(this.gebid('txtFlghtLngSt').value);
FlightsLongPr = Number(this.gebid('txtFlghtLngPr').value);
FuelType = this.GetSelectedItem('VehFuel', 'U');
myLevies = new KPMGBudgCalc.Levies (BeerUnits, WineUnits, CigPackets, SpiritsUnits, FuelLitre, FuelType, FlightsShort, FlightsShortPr, FlightsLong, FlightsLongPr )
return myLevies;
};
KPMG.prototype.GetSelectedItem=function(groupName, defaultValue){
var retval = "";
var obj = document.getElementsByName(groupName);
var len = obj.length;
for (i = 0; i <len; i++){
	if (obj[i].checked){retval = obj[i].value;}
	}
if (retval == ""){retval = defaultValue;}
return retval;
};
KPMG.prototype.GetCarsForRoadTax=function(){
var retval = new Array();
if(this.gebid('chkCar1').checked){
	retval[retval.length] = new	KPMGBudgCalc.CarsForRoadTax( 
		this.GetSelectedItem('RoadTax1', 'NA'),
		this.GetSelectedItem('VehFuelRT1', 'U') 
		);
	}
if(this.gebid('chkCar2').checked){
	retval[retval.length] = new	KPMGBudgCalc.CarsForRoadTax(
		this.GetSelectedItem('RoadTax2', 'NA'), 
		this.GetSelectedItem('VehFuelRT2', 'U') 
		);
	}
if(this.gebid('chkCar3').checked){
	retval[retval.length] = new	KPMGBudgCalc.CarsForRoadTax( 
		this.GetSelectedItem('RoadTax3', 'NA'),
		this.GetSelectedItem('VehFuelRT3', 'U') 
		);
	}
if(this.gebid('chkCar4').checked){
	retval[retval.length] = new	KPMGBudgCalc.CarsForRoadTax( 
		this.GetSelectedItem('RoadTax4', 'NA'),
		this.GetSelectedItem('VehFuelRT4', 'U') 
		);
	}
return retval;
};
KPMG.prototype.GetCompanyCars=function(){
var retval = new Array();
if(this.gebid('chkCC1').checked){
	retval[retval.length] = new	KPMGBudgCalc.CompanyCar(
		Number(this.gebid('txtCC1LP').value),
		Number(this.gebid('txtCC1EM').value),
		this.gebid('chkCC1E4').checked,
		this.gebid('chkCC1Fuel').checked
		);
	}
if(this.gebid('chkCC2').checked ){
	retval[retval.length] = new	KPMGBudgCalc.CompanyCar(
		Number(this.gebid('txtCC2LP').value),
		Number(this.gebid('txtCC2EM').value),
		this.gebid('chkCC2E4').checked,
		this.gebid('chkCC2Fuel').checked
		);
	}
return retval;
};
KPMG.prototype.GetSpouseCompanyCars=function(){
var retval = new Array();
if(this.gebid('chkCC1').checked ){
	retval[retval.length] = new	KPMGBudgCalc.CompanyCar(
		Number(this.gebid('txtSpCC1LP').value),
		Number(this.gebid('txtSpCC1EM').value),
		this.gebid('chkSpCC1E4').checked,
		this.gebid('chkSpCC1Fuel').checked
		);
	}
if(this.gebid('chkCC2').checked){
	retval[retval.length] = new	KPMGBudgCalc.CompanyCar(
		Number(this.gebid('txtSpCC2LP').value),
		Number(this.gebid('txtSpCC2EM').value), 
		this.gebid('chkSpCC2E4').checked,
		this.gebid('chkSpCC2Fuel').checked
		);
	}
return retval;
};
KPMG.prototype.GetCompanyVans=function(){
var retval = new Array();
if(this.gebid('chkMyVanUse').checked){
	retval[retval.length] = new	KPMGBudgCalc.CompanyVan(this.gebid('chkMyVanFuel').checked);
	}
return retval;
};
KPMG.prototype.GetSpouseCompanyVans=function(){
var retval = new Array();
if(this.gebid('chkSpVanUse').checked){
	retval[retval.length] = new	KPMGBudgCalc.CompanyVan(this.gebid('chkSpVanFuel').checked);
	}
return retval;
};
KPMG.prototype.openwindow=function(WebPage){
window.open(WebPage,"mywindow","menubar=1,resizable=2,width=350,height=250,scrollbars=yes");
};
var kpmg=new KPMG();


