function openpopup(){
popurl="map/map.htm"
winpops=window.open(popurl,"","width=500,height=430")
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function checkEnter(pfield, pname)
{
    var field = pfield.value
    var msg
    var status = true

    if (field.length == 0)
        {
        msg = "The " + pname + " field must be entered."
        alert(msg)
        status = false
        }

    return status
}

function checkNumb(pnumb, pname)
{
    var numb = pnumb.value
    var message
    var indx
    var status = false

    for (var indx = 0; indx < numb.length; indx++) /* the field should contain at least one digit */
        {
        if (numb.charAt(indx) >= "0" && numb.charAt(indx) <= "9")
            {
            status = true
            }
        }
    for (var indx = 0; indx < numb.length; indx++)
        {
        if (!((numb.charAt(indx) >= "0" && numb.charAt(indx) <= "9") ||
             numb.charAt(indx) == " " ||
             numb.charAt(indx) == "." ||
             numb.charAt(indx) == ","))
            {
            status = false
            }
        }
    if (!status)
        {
        msg = "The " + pname + " field must be a number."
        alert(msg)
        }
    return status
}

function parseNumb(pnumbstr)
{
    var numb = pnumbstr.value
    var indx

    indx = numb.indexOf(",")
    while (indx != -1)
        {
        numb = numb.substring(0,indx) + numb.substring(indx*1 + 1,numb.length)
        indx = numb.indexOf(",")
        }

    indx = numb.indexOf(" ")
    while (indx != -1)
        {
        numb = numb.substring(0,indx) + numb.substring(indx*1 + 1,numb.length)
        indx = numb.indexOf(" ")
        }

    return numb
}

function parseMonth(pyear, pmonth)
{
    var year  = parseNumb(pyear)
    var month = parseNumb(pmonth)
    var period
    var indx

    period = Math.ceil(month*1 + year*12)

    return period
}

function checkLoan(pLoan)
{
    var LoanAmt = pLoan
    var status

    if (checkEnter(LoanAmt,"Loan Amount"))
        {
        status = checkNumb(LoanAmt,"Loan Amount")
        }
    
    return status

}

function checkRepay(pRepay)
{
    var RepayAmt = pRepay
    var status   = true

    if (checkEnter(RepayAmt,"Repay Amount"))
        {
        if (checkNumb(RepayAmt,"Repay Amount"))
            {
            if (RepayAmt.value == 0)
                {
                alert("The Repay Amount can not be zero.")
                status = false
                }
            }
        else
            {
            status = false
            }
        }
    else
        {
        status = false
        }

    return status

}

function checkIntRate(pIntRate)
{
    var IntRate = pIntRate
    var status  = true

    if (checkEnter(IntRate,"Interest Rate"))
        {
        if (checkNumb(IntRate,"Interest Rate"))
            {
            if (IntRate.value == 0)
                {
                alert("The Interest Rate can not be zero.")
                status = false
                }
            }
        else
            {
            status = false
            }
        }
    else
        {
        status = false
        }

    return status

}

function checkTermY(pYear)
{
    var TermYear = pYear
    var status   = true

    if (checkEnter(TermYear,"Year Period"))
        {
        if (checkNumb(TermYear,"Year Period"))
            {
            if (TermYear.value > 30)
                {
                alert("The Year Period can not be longer than 30 years.")
                status = false
                }
            }
        else
            {
            status = false
            }
        }
    else
        {
        status = false
        }

    return status
}

function checkTermM(pMonth)
{
    var TermMonth = pMonth
    var status    = true

    if (checkEnter(TermMonth,"Month Period"))
        {
        if (checkNumb(TermMonth,"Month Period"))
            {
            if (TermMonth.value > 11)
                {
                alert("Please use the Year field to enter a period longer than 11 months.")
                status = false
                }
            }
        else
            {
            status = false
            }
        }
    else
        {
        status = false
        }

    return status
}

function CalcRepayAmt(pLoanAmt, pIntRate, pTerm)
{
    var RepayAmt

    RepayAmt = pLoanAmt * pIntRate/(1 - Math.pow((1 + pIntRate*1),-pTerm))
    RepayAmt = Math.ceil(RepayAmt)

    return RepayAmt
}

function CalcRepay()
{
    var LoanAmount
    var InterestRate
    var MonthTerm   

    if (checkLoan(document.repay.LoanAmt1) &&
        checkIntRate(document.repay.IntRate1) &&
        checkTermY(document.repay.TermYear1) &&
        checkTermM(document.repay.TermMonth1))
        {
        LoanAmount   = parseNumb(document.repay.LoanAmt1)
        InterestRate = parseNumb(document.repay.IntRate1)/1200
        MonthTerm    = parseMonth(document.repay.TermYear1,document.repay.TermMonth1)

        document.repay.RepayAmt1.value = CalcRepayAmt(LoanAmount, InterestRate, MonthTerm)
        document.Convert.ConvertAmnt.value = document.repay.RepayAmt1.value
        }
    else
        {
        document.repay.RepayAmt1.value = " "
        }
}

function CalcTerm()
{

/* Calculate the Repaid Period */

    var MonthTerm    = 0        
    var YearTerm     = 0
    var MaxTerm      = 30 * 12     /* 30 years */
    var LoanAmount
    var RepayAmount
    var InterestRate
    var MinRepay


    if (checkLoan(document.repay.LoanAmt2) &&
        checkRepay(document.repay.RepayAmt2) &&
        checkIntRate(document.repay.IntRate2))
        {
        LoanAmount   = parseNumb(document.repay.LoanAmt2)
        RepayAmount  = parseNumb(document.repay.RepayAmt2)
        InterestRate = parseNumb(document.repay.IntRate2)/1200
        MinRepay     = CalcRepayAmt(LoanAmount, InterestRate, MaxTerm)

        if (RepayAmount < MinRepay)
            {
            Msg = "Sorry, the minimum repayment amount must be " + MinRepay + " dollars."
            alert(Msg)
            document.repay.TermYear2.value  = " "
            document.repay.TermMonth2.value = " "
            }
        else
            {
            MonthTerm = Math.log(RepayAmount/(RepayAmount - LoanAmount * InterestRate)) / Math.log(1 + InterestRate)
            MonthTerm = Math.ceil(MonthTerm)

            YearTerm = Math.floor(MonthTerm / 12)
            MonthTerm = MonthTerm - (YearTerm * 12)
            document.repay.TermYear2.value  = YearTerm
            document.repay.TermMonth2.value = MonthTerm 
            }
        }
    else
        {
        document.repay.TermYear2.value  = " "
        document.repay.TermMonth2.value = " "
        }
}

function CalcLoan()
{
    var LoanAmt

    var RepayAmount
    var InterestRate
    var MonthTerm

    if (checkRepay(document.repay.RepayAmt3) &&
        checkIntRate(document.repay.IntRate3) &&
        checkTermY(document.repay.TermYear3) &&
        checkTermM(document.repay.TermMonth3))
        {
        RepayAmount  = parseNumb(document.repay.RepayAmt3)
        InterestRate = parseNumb(document.repay.IntRate3)/1200
        MonthTerm    = parseMonth(document.repay.TermYear3,document.repay.TermMonth3)

        LoanAmt = RepayAmount * (1 - Math.pow((1 + InterestRate*1),-MonthTerm))/InterestRate
        document.repay.LoanAmt3.value = Math.floor(LoanAmt)
        }
    else
        {
        document.repay.LoanAmt3.value = " "
        }
}

function CurrencyPopup(ConvertAmount){ 
CurrencyWindow = window.open ('', 'CurrencyWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,height=150,width=450')
CurrencyWindow.focus()
CurrencyWindow.location.href='http://currency.xe.net/ecc/input.cgi?from=AUD&amount='+ConvertAmount    
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function select_item(name, value) {
	this.name = name;
	this.value = value;
}

function get_selection(select_object) {
	contents = new select_item();
	for(var i=0;i<select_object.options.length;i++) {
		if(select_object.options[i].selected == true) {
			contents.name = select_object.options[i].text;
			contents.value = select_object.options[i].value;
		}
	}
	return contents;
}

function StripChars(strIn) {
	var newstr = "";
	var Chars = "0123456789.";
    for (var i = 0; i < strIn.length; i++) {
       if (Chars.indexOf(strIn.charAt(i)) == -1) {}
	   else {
	   	newstr = newstr + strIn.charAt(i);
	   }
    }
	return newstr;
}

function stampduty(formfield) {
	var amount = StripChars(formfield.amount.value);
	var loanamount = StripChars(formfield.loanamount.value);
	var state = get_selection(formfield.state);
	var type = "OO"
	for (i=0; i< formfield.elements.length; i++) {
		if (formfield.elements[i].name == 'Type') {
			for (s=0;s < 2; s++) {
				if (formfield.Type[s].checked == true) {
					type = formfield.Type[s].value;
				}
			}
		}
	}
	if ((amount == "") && (loanamount == "")) {
		window.alert("You have not entered any values!");
		return;
	}
	t_amount = amount;
	if ((amount % 100) != 0 ) {
			var mod = eval(100-(amount % 100));
			amount = -(-amount - mod);
	}
	
	if ((loanamount % 100) != 0 ) {
			var mod2 = eval(100-(loanamount % 100));
			loanamount = -(-loanamount- mod2);
	}
	
//********************** Victoria *************************
	if (state.value == "VIC") {

		if ((t_amount % 1000) != 0 ) {
			var mod = eval(1000-(t_amount % 1000));
			t_amount = -(-t_amount - mod);
		}
		if ((t_amount > 0) && (t_amount <= 500000)) {
			var transfer = (t_amount / 1000) * 2.46 + 90;
		}
		else {
			var transfer = 1320;
		}
		mortgage = 59;
		//var exnotes = "First Home Buyers with Families\n- Full stamp duty exemption for properties valued up to $115,000\n- Stamp duty concessions on a reducing scale for properties between $115,000 to $165,000\n- Have one or more dependent children and gross combined taxable income not exceeding $39,000 (1 child) or $40,000 (2 or more children)\n\nHome Buyers with Concession Cards\n- Full stamp duty exemption for properties valued up to $100,000\n- Stamp duty concessions on a reducing scale for properties between $100,000 to $130,000\n- Have a Pensioner Concession Card (Department of Social Security or Department of Veterans' Affairs), Veterans' Affairs Gold Card, Health Benefits Card, or Health Care Card.";
		var exnotes = "First Home Buyers with Families\n- Must have at least 1 dependant child\n- Full stamp duty exemption for properties valued up to $150,000\n- Stamp duty concessions on a reducing scale for properties between $150,000 to $200,000\n- Income tests no longer apply\n\nHome Buyers with Concession Cards\n- Full stamp duty exemption for properties valued up to $150,000\n- Stamp duty concessions on a reducing scale for properties between $150,000 to $200,000\n- Have a Pensioner Concession Card (Department of Social Security or Department of Veterans' Affairs), Veterans' Affairs Gold Card, Health Benefits Card, or Health Care Card.";

		if (amount <= 20000) {
			var duty = eval(((amount)/100)*1.4);
	
		}
		else if ((amount > 20000) && (amount <= 115000)) {
			var duty = eval((((amount - 20000)/100)*2.4) + 280);
		}
	
		else if ((amount > 115000) && (amount <= 870000)) {
			var duty = eval((((amount - 115000)/100)*6) + 2560);
		}
		
		else {
			var duty = eval(((amount)/100)*5.5) ;
		}
		if ((loanamount % 200) != 0 ) {
			var mod = eval(200-(loanamount % 200));
			loanamount = -(-loanamount- mod);
		}
		if (loanamount <= 10000) {
			var loanduty = 4;
		}
		else {
			var loanduty = eval((((loanamount - 10000)/200)*0.8) + 4);
		}
	}

//********************** New South Wales *************************
	else if (state.value == "NSW") {
		var mortgage = 60;
		var transfer = 60;
		var exnotes = "First Home Plus Scheme\n- Full stamp duty exemption for properties valued up to $200,000 for metropolitan areas and $175,000 in country NSW\n- Stamp duty concessions on a reducing scale for properties between $200,000 and $300,000 in metropolitan areas\n- Stamp duty concessions on a reducing scale for properties between $175,000 and $200,000 in country NSW";	
	
		if (amount <= 14000) {
			var duty = eval((amount/100)*1.25);
		}
	
		else if ((amount > 14000) && (amount <= 30000)) {
			var duty = eval((((amount - 14000)/100)*1.5) + 175);
		}
	
		else if ((amount > 30000) && (amount <= 80000)) {
			var duty = eval((((amount - 30000)/100)*1.75) + 415);
		}
	
		else if ((amount > 80000) && (amount <= 300000)) {
			var duty = eval((((amount - 80000)/100)*3.5) + 1290);
		}
	
		else if ((amount > 300000) && (amount <= 1000000)) {
			var duty = eval((((amount - 300000)/100)*4.5) + 8990);
		}
		
		else {
			var duty = eval((((amount - 1000000)/100)*5.5) + 40490);
		}
		if ((loanamount % 1000) != 0 ) {
			var mod = eval(1000-(loanamount % 1000));
			loanamount = -(-loanamount- mod);
		}
		if (loanamount <= 16000) {
			var loanduty = 5;
		}
		else {
			var loanduty = eval((((loanamount - 16000)/1000)*4) + 5);
		}
		
	}

//********************** ACT *************************
	else if (state.value == "ACT") {
		var mortgage = 78;
		var transfer = 155;
		var loanduty = 0;
		var exnotes = "Stamp Duty Relief Scheme\n- Full stamp duty exemption for properties valued up to $116,000\n- Stamp duty concessions on a reducing scale for properties between $116,000 and $140,000 in metropolitan areas\n- Property must be for principal residence and may be first home or re-entering home ownership (not held property for last two years)\n- Total household income must be less than $45,000";	
	
		if (amount <= 100000) {
			var duty = eval((amount/100)*2);
			if (duty < 20) {
				duty = 20;
			}
		}
		else if ((amount > 100000) && (amount <= 200000)) {
			var duty = eval((((amount - 100000)/100)*3.5) + 2000);
		}
		else if ((amount > 200000) && (amount <= 300000)) {
			var duty = eval((((amount - 200000)/100)*4) + 5500);
		}
		else if ((amount > 300000) && (amount <= 500000)) {
			var duty = eval((((amount - 300000)/100)*5.5) + 9500);
		}
		else if ((amount > 500000) && (amount <= 1000000)) {
			var duty = eval((((amount - 500000)/100)*5.75) + 20500);
		}
		else {
			var duty = eval((((amount - 1000000)/100)*6.75) + 49250);
		}
	}

//********************** Queensland *************************
	else if (state.value == "QLD") {
		if ((t_amount % 10000) != 0 ) {
			var mod = eval(10000-(t_amount % 10000));
			t_amount = -(-t_amount - mod);
		}
		if (t_amount <=180000) {
			var transfer = 100;
		}
		else {
			var transfer = eval((((t_amount - 180000)/10000)*21.5)+100);
		}
		var mortgage = 100;
		
		if (type == 'OO') {
			var exnotes = "Owner Occupied Concession:\nThese rates are applicable only where property is not being gifted or transferred between spouses. In these cases, investment rates are applicable.\n\nFirst Home Buyer Rebate:\nFull stamp duty exemption for properties valued up to $80,000\n- Stamp duty concessions on a reducing scale for properties between $80,000 and $160,000 in metropolitan areas\n- Property must be first home and intended as principal residence";
		
			if(loanamount > 70000){
				loanduty = (loanamount - 70000) * 0.004;
			}
			else{
				loanduty = 0;
			}
			if (amount <= 250000) {
				var duty = eval((amount/100)*1);
			}
			else if ((amount > 250000) && (amount <= 500000)) {
				var duty = eval((((amount - 250000)/100)*3.5) + 2500);
			}
			else {
				var duty = eval((((amount - 500000)/100)*3.75) + 11250);
			}
		}
		else {
			var exnotes = "";
			
			loanduty = loanamount * 0.004
			if (amount <= 20000) {
				var duty = eval((amount/100)*1.5);
			}
			else if ((amount > 20000) && (amount <= 50000)) {
				var duty = eval((((amount - 20000)/100)*2.25) + 300);
			}
			else if ((amount > 50000) && (amount <= 100000)) {
				var duty = eval((((amount - 50000)/100)*2.75) + 975);
			}
			else if ((amount > 100000) && (amount <= 250000)) {
				var duty = eval((((amount - 100000)/100)*3.25) +2350);
			}
			else if ((amount > 250000) && (amount <= 500000)) {
				var duty = eval((((amount - 250000)/100)*3.5) + 7225);
			}
			else {
				var duty = eval((((amount - 500000)/100)*3.75) + 15975);
			}
		}
		
	}

//********************** South Australia *************************
	else if (state.value == "SAN") {
		if (amount <= 5000)
	        transfer = 87;
	    if (amount > 5000 && amount <= 20000)
	        transfer = 97;
	    if (amount > 20000 && amount <= 40000)
	        transfer = 108;
	    if (amount > 40000 && amount <= 50000)
	        transfer = 155;
	    if (amount > 50000) {
			if ((t_amount % 10000) != 0 ) {
				var mod = eval(10000-(t_amount % 10000));
				t_amount = -(-t_amount - mod);
			}
	        var transfer = eval((((t_amount - 50000)/10000)*48) + 155);
		}
		mortgage = 90.5;
		var exnotes = "First Home Buyers Concession\n- Full stamp duty exemption for properties valued up to $80,000\n- Stamp duty concessions on a reducing scale for properties between $80,000 and $130,000 in metropolitan areas\n- Property must be first home and intended as principal residence";
		if (amount <= 12000) {
			var duty = eval((amount/100)*1);
		}
	
		else if ((amount > 12000) && (amount <= 30000)) {
			var duty = eval((((amount - 12000)/100)*2) + 120);
		}
	
		else if ((amount > 30000) && (amount <= 50000)) {
			var duty = eval((((amount - 30000)/100)*3) + 480);
		}
	
		else if ((amount > 50000) && (amount <= 100000)) {
			var duty = eval((((amount - 50000)/100)*3.5) + 1080);
		}
	
		else if ((amount > 100000) && (amount <= 500000)) {
			var duty = eval((((amount - 100000)/100)*4) + 2830);
		}
		else if ((amount > 500000) && (amount <= 1000000)) {
			var duty = eval((((amount - 500000)/100)*4.5) + 18830);
		}
		else {
			var duty = eval((((amount - 1000000)/100)*5) + 41330);
		}
		
		if (loanamount <= 400) {
			var loanduty = 0;
		}
		else if ((loanamount > 400) && (loanamount <= 4000)) {
			var loanduty = 10;
		}
		else if ((loanamount > 4000) && (loanamount <= 10000)) {
			var loanduty = eval((((loanamount - 4000)/100)*0.25) + 10);
		}
		else {
			var loanduty = eval((((loanamount - 10000)/100)*0.35) + 25);
		}
	}

//********************** Tasmania *************************
	else if (state.value == "TAS") {
		var mortgage = 85.50;
		var transfer = 130;
		var exnotes = "Stamp Duty Concession\n- Interest free loan of total stamp duty payable over a span of two years\n- Applicable to properties valued up to $120,000\n- Property must be first home and intended as principal residence";
		if (amount <= 1300) {
			var duty = 20;
		}
		else if ((amount > 1300) && (amount <= 10000)) {
			var duty = eval((amount/100)*1.5);
		}
	
		else if ((amount > 10000) && (amount <= 30000)) {
			var duty = eval((((amount - 10000)/100)*2) + 150);
		}
	
		else if ((amount > 30000) && (amount <= 75000)) {
			var duty = eval((((amount - 30000)/100)*2.5) + 550);
		}
	
		else if ((amount > 75000) && (amount <= 150000)) {
			var duty = eval((((amount - 75000)/100)*3) + 1675);
		}
	
		else if ((amount > 150000) && (amount <= 225000)) {
			var duty = eval((((amount - 150000)/100)*3.5) + 3925);
		}
		
		else {
			var duty = eval((((amount - 225000)/100)*4) + 6550);
		}
		
		if (loanamount <= 8000) {
			var loanduty = 20;
		}
		else if ((loanamount > 8000) && (loanamount <= 10000)) {
			var loanduty = eval((((loanamount - 8000)/100)*0.25) + 20);
		}
		else {
			var loanduty = eval((((loanamount - 10000)/100)*0.35) + 25);
		}
	}

//********************** Western Australia *************************
	else if (state.value == "WAN") {
		if (amount <= 85000) {
			var transfer = 75;
		}
		else if ((amount > 85000) && (amount <= 120000)) {
			var transfer = 85;
		}
		else if ((amount > 120000) && (amount <= 200000)) {
			var transfer = 105;
		}
		else {
			tempProperty = (amount - 200000) / 100000;
			for (var i=0, k=1; tempProperty >i && tempProperty > k ; i++, k++);
			var transfer = (k * 20) + 105;
			//var transfer = eval((((amount - 200000)/100000)*20)+105);
		}
		mortgage = 75;
		var exnotes = "Concessional Rate\n-Applies to purchase of principal place of residence or business undertaking with a dutiable value not exceeding $135,000.\nThe concessional rate is $1.50 per $100 (or part thereof) up to $100,000 and $5.50 per $100 (or part thereof) for that amount between $100,000 and $135,000.\nApplication forms are available on request. Full details are contained in section 75AE of the Stamp Act 1921.\n\nFirst Home Owners Rebate\n- Rebate of $500 or amount of duty payable, whichever is lesser\n- Vacant land valued up to, $52,000 and property (house and land) up to $135,000\n- Property must be first home and intended as principal residence.\nFull details are contained in section 75AG of the Stamp Act 1921.";
		if (type == 'OO' && amount <= 135000) {
			if (amount <= 100000) {	
				var duty = eval((amount/100)*1.5);
			}
			else {
				var duty = eval((((amount - 100000)/100)*5.5) + 1500);
			}
		}
		else {
			if (amount <= 80000) {	
				var duty = eval((amount/100)*2);
			}
		
			else if ((amount > 80000) && (amount <= 100000)) {
				var duty = eval((((amount - 80000)/100)*3) + 1600);
			}
		
			else if ((amount > 100000) && (amount <= 250000)) {
				var duty = eval((((amount - 100000)/100)*4.15) + 2200);
			}
		
			else if ((amount > 250000) && (amount <= 500000)) {
				var duty = eval((((amount - 250000)/100)*5.15) + 8425);
			}
		
			else {
				var duty = eval((((amount - 500000)/100)*5.5) + 21300);
			}
		}
		if (loanamount <= 35000) {
			var loanduty = eval(loanamount * 0.0025);
		}
		else {
			var loanduty = eval((((loanamount - 35000)/100)*0.4) + 87.5);
		}
		
	}

//********************** Northern Territory  *************************
	else if (state.value == "NT") {
		var mortgage = 90;
		var transfer = 90;
		var loanduty = 0;
		var exnotes = "First Home Rebate Scheme\n- A rebate of up to $2780 off the total stamp duty payable\n- Property must be first home and intended as principal residence";
	
		if (amount <=500000) {
			newamount = eval(amount / 1000);
			var duty = eval((0.065 * Math.pow(newamount,2)) + (21 * newamount));
		}
	
		else {
			var duty = eval(5.4 * (amount/100));
		}
	}
	total = eval(duty + loanduty + mortgage + transfer);
	total = rounding(total);
	duty = rounding(duty);
	loanduty = rounding(loanduty);
	mortgage = rounding(mortgage);
	transfer = rounding(transfer);
	
	formfield.duty.value = duty;
	formfield.loanduty.value = loanduty;
	formfield.mortgage.value = mortgage;
	formfield.transfer.value = transfer;
	formfield.total.value = total;
	formfield.notes.value = exnotes;
}
function rounding(n) {
	pennies = n * 100;
	pennies = Math.round(pennies);
	strPennies = "" + pennies;
	len = strPennies.length;
	return strPennies.substring(0, len - 2) + "." + strPennies.substring((len - 2), len);
}
