// Copyright © 2004 Australasian Management and Technology (AMAT) PTY LTD, Suite 8, 340 Darling Street, Balmain NSW 2041, Australia. All rights reserved. 
// Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

// AMAT MortgageFirst Stamp Duty Calculator

function doStampDutyCalculations(n)
{
	//function to calculate the Stamp Duty on Mortgage
	if (n == 6)
	{
		var loanAmount = parseFloat(document.Q5.principal.value);
		var propertyValue = parseFloat(document.Q5.propertyValue.value);
		//var propertyValue = 0;
		var state = document.Q5.state.value;
		var mortgageType = "";
		var loanType = "";

		if (document.Q5.homemortgage5(0).checked)
		{
			mortgageType = document.Q5.homemortgage5(0).value;
		}
		else
		{
			mortgageType = document.Q5.homemortgage5(1).value;
		}

		if (document.Q5.loantype5(0).checked)
		{
			loanType = document.Q5.loantype5(0).value;
		}
		else
		{
			loanType = document.Q5.loantype5(1).value;
		}

		if (debug == 1)
		{
			alert (loanAmount);
			alert (propertyValue);
			alert (state);
			alert (mortgageType);
			alert (loanType);
		}
		
		calculateMortgageStampDuty (loanAmount, propertyValue, state, mortgageType, loanType);
	}
}

// Function to calculate the Total Stamp Duty on Mortgage

function calculateMortgageStampDuty (loanAmount, propertyValue, state, mortgageType, loanType)
{
	var totalMortgageStampDuty = 0;
	var mortgageRegistrationFee = 0;
	var transfeeFee = 0;
	var transferStampDuty = 0;
	var mortgageStampDuty = 0;
	var loanAmountTemp = 0;
	var propertyValueTemp = 0;
	var LMIPremium = 0;
	
	if ((loanAmount == "") && (propertyValue == ""))
	{
		window.alert("You have not entered a value!");
		return "";
	}
	
	if ((isNaN(loanAmount)) || (isNaN(propertyValue)))
	{
		window.alert("You have not entered a value!");
		return "";
	}
	
	
	if (loanAmount == "")
	{
		loanAmount = 0;
	}
	
	if (propertyValue == "")
	{
		propertyValue = 0;
	}
	
	propertyValueTemp = propertyValue;
	
	if ((propertyValueTemp % 100) != 0 )
	{
		var mod = eval(100 - (propertyValueTemp % 100));
		propertyValueTemp = -(-propertyValueTemp - mod);
	}
	
	loanAmountTemp = loanAmount;
	
	if ((loanAmountTemp % 100) != 0)
	{
		var mod2 = eval(100 - (loanAmountTemp % 100));
		loanAmountTemp = -(-loanAmountTemp - mod2);
	}
	
	mortgageRegistrationFee = fRegistrationFee (state);
	transferFee = fTransferFee (propertyValue, propertyValueTemp, state);
	transferStampDuty = fTransferStampDuty (propertyValue, propertyValueTemp, state, mortgageType);
	mortgageStampDuty = fMortgageStampDuty (loanAmountTemp, state, mortgageType);
	LMIPremium = fLMIPremium (loanAmount, propertyValue, state, mortgageType, loanType);
	
	if (debug == 1)
	{
		alert (mortgageRegistrationFee);
		alert (transferFee);
		alert (transferStampDuty);
		alert (mortgageStampDuty);
		alert (LMIPremium);
	}
	
	totalMortgageStampDuty = mortgageRegistrationFee + transferFee  + transferStampDuty + mortgageStampDuty + LMIPremium;
	
	document.getElementById("table3").innerHTML = 
	'<table class="doctext">' +
	'<tr><td width="100"></td><td><font size="2"><b>Mortgage Registration Fee:</b></font></td><td><b><font size="2">$' + numval(mortgageRegistrationFee, 2) + '</font></b></td></td></tr>' +
	'<tr><td></td><td><font size="2"><b>Transfer Fee:</b></font></td><td><b><font size="2">$' + numval(transferFee, 2) + '</font></b></td></tr>' +
	'<tr><td></td><td><font size="2"><b>Stamp Duty on Transfer:</b></font></td><td><b><font size="2">$' + numval(transferStampDuty, 2) + '</font></b></td></tr>' +
	'<tr><td></td><td><font size="2"><b>Stamp Duty on Mortgage:</b></font></td><td><b><font size="2">$' + numval(mortgageStampDuty, 2) + '</font></b></td></tr>' + 
	'<tr><td></td><td><font size="2"><b>LMI Premium (incl Stamp Duty):</b></font></td><td><b><font size="2">$' + numval(LMIPremium, 2) + '*</font></b></td></tr>' + 
	'<tr><td></td><td><font size="2"><b>Total:</b></font></td><td><b><font size="2">$' + numval(totalMortgageStampDuty, 2) + '</font></td></tr>' + 
	'<tr><td colspan="3"><br><br><b>' + getConcessionSchemes(state) + '</b></td></tr>' +
	'</table>';
	
	document.getElementById("disclaimer").innerHTML = strStampDuty;
	document.getElementById("spacer").innerHTML = '<br><br><br><br>';
			
//	return totalMortgageStampDuty;
}

// Function to calculate the Total Stamp Duty on Transfer

function calculateTransferStampDuty (loanAmount, propertyValue, state, mortgageType)
{
	var totalMortgageStampDuty = 0;
	var mortgageRegistrationFee = 0;
	var transfeeFee = 0;
	var transferStampDuty = 0;
	var mortgageStampDuty = 0;
	var loanAmountTemp = 0;
	var propertyValueTemp = 0;
	
	if ((loanAmount == "") && (propertyValue == ""))
	{
		window.alert("You have not entered a value!");
		return "";
	}
	
	propertyValueTemp = propertyValue;

	
	if ((propertyValueTemp % 100) != 0 )
	{
		var mod = eval(100 - (propertyValueTemp % 100));
		propertyValueTemp = -(-propertyValueTemp - mod);
	}
	
	loanAmountTemp = loanAmount;
	
	if ((loanAmountTemp % 100) != 0)
	{
		var mod2 = eval(100 - (loanAmountTemp % 100));
		loanAmountTemp = -(-loanAmountTemp - mod2);
	}

	mortgageRegistrationFee = fRegistrationFee (state);
	transferFee = fTransferFee (propertyValue, propertyValueTemp, state);
	transferStampDuty = fTransferStampDuty (propertyValueTemp, state, mortgageType);
	mortgageStampDuty = fMortgageStampDuty (loanAmountTemp, state, mortgageType);

	if (debug == 1)
	{
		alert(mortgageType);
		alert(mortgageRegistrationFee);
		alert(transferFee);
		alert(transferStampDuty);
		alert(mortgageStampDuty);
	}
	
	totalTransferStampDuty = mortgageRegistrationFee + transferFee  + transferStampDuty + mortgageStampDuty;
	
	return totalTransferStampDuty;
}

// MORTGAGE REGISTRATION FEE

function fRegistrationFee (state)
{
	var registrationFee = 0;

	if (state == "VIC")
	{
		registrationFee = 59;
	}
	
	if (state == "NSW")
	{
		registrationFee = 75;
	}
	
	if (state == "ACT")
	{
		registrationFee = 82;
	}
	
	if (state == "QLD")
	{
		registrationFee = 105.60;
	}
	
	if (state == "SA")
	{
		registrationFee = 98;
	}
	
	if (state == "TAS")
	{
		registrationFee = 85.50;
	}
	
	if (state == "WA")
	{
		registrationFee = 75;
	}
	
	if (state == "NT")
	{
		registrationFee = 90;
	}

	return registrationFee;
}

// TRANSFER FEE

function fTransferFee (propertyValue, propertyValueTemp, state)
{
	var transferFee = 0;
		
	if (state == "VIC")
	{
		if ((propertyValue % 1000) != 0)
		{
			var mod =  eval(1000 - (propertyValue % 1000));
			propertyValue= -(-propertyValue - mod);
		}
		
		if ((propertyValue > 0) && (propertyValue <= 500000))
		{
			transferFee = (propertyValue / 1000) * 2.46 + 90;
		}
		else
		{
			transferFee = 1320;
		}
	}
	
	if (state == "NSW")
	{
		transferFee = 75;
	}
	
	if (state == "ACT")
	{
		transferFee = 160;
	}
	
	if (state == "QLD")
	{
		if ((propertyValue % 10000) != 0)
		{
			var mod =  eval(10000 - (propertyValue % 10000));
			propertyValue = -(-propertyValue - mod);
		}
		
		if (propertyValue <= 180000)
		{
			transferFee = 105.6;
		}
		else
		{
			transferFee = eval((((propertyValue - 180000) / 10000) * 22.6) + 105.6);
		}
		
	}
	
	if (state == "SA")
	{
		if (propertyValueTemp <= 5000)
		{
			transferFee = 98;
		}
		else if (propertyValueTemp > 5000 && propertyValueTemp <= 20000)
		{
	        	transferFee = 109;
		}
	    	else if (propertyValueTemp > 20000 && propertyValueTemp <= 40000)
		{
	        	transferFee = 121;
		}
	    	else if (propertyValueTemp > 40000 && propertyValueTemp <= 50000)
		{
	        	transferFee = 174;
		}
	    	else if (propertyValueTemp > 50000)
		{
			if ((propertyValue % 10000) != 0)
			{
				var mod = eval(10000 - (propertyValue % 10000));
				propertyValue = -(-propertyValue - mod);
			}
		        transferFee = eval((((propertyValue - 50000) / 10000) * 54) + 174);
		}
	}
	
	if (state == "TAS")
	{
		transferFee = 130;
	}
	
	if (state == "WA")
	{
		if (propertyValueTemp <= 85000)
		{
			transferFee = 75;
		}
		else if ((propertyValueTemp > 85000) && (propertyValueTemp <= 120000))
		{
			transferFee = 85;
		}
		else if ((propertyValueTemp > 120000) && (propertyValueTemp <= 200000))
		{
			transferFee = 105;
		}
		else
		{
			tempProperty = (propertyValueTemp - 200000) / 100000;
			
			for (var i = 0, k = 1; tempProperty > i && tempProperty > k; i++, k++);
			{
				transferFee = (k * 20) + 105;
			}
		}
		
	}
	
	if (state == "NT")
	{
		transferFee = 90;
	}
	
	return transferFee;
}

// MORTGAGE STAMP DUTY

function fMortgageStampDuty (loanAmountTemp, state, mortgageType)
{
	var mortgageStampDuty = 0;
		
	if (state == "VIC") 
	{
		/*
		if ((loanAmountTemp % 200) != 0)
		{
			var mod = eval(200 - (loanAmountTemp % 200));
			loanAmountTemp  = -(-loanAmountTemp - mod);
		}
		
		if (loanAmountTemp <= 10000) 
		{
			mortgageStampDuty = 4;
		}
		else 
		{
			mortgageStampDuty = eval((((loanAmountTemp - 10000)/200)*0.8) + 4);
		}
		*/
		mortgageStampDuty = 0;
	}
	
	if (state == "NSW") 
	{
		if ((loanAmountTemp % 1000) != 0)
		{
			var mod =eval(1000 - (loanAmountTemp %1000));
			loanAmountTemp = -(-loanAmountTemp - mod);
		}
		
		if (loanAmountTemp <= 16000) 
		{
			mortgageStampDuty = 5;
		}
		else 
		{
			mortgageStampDuty = eval((((loanAmountTemp - 16000)/1000)*4) + 5);
		}
	}
	
	if (state == "ACT") 
	{
		mortgageStampDuty = 0;
	}
	
	if (state == "QLD") 
	{
		//mortgageStampDuty = eval(amount * 0.004);
		
		if (mortgageType == "OO")
		{
			if (loanAmountTemp > 70000)
			{
				mortgageStampDuty = (loanAmountTemp - 70000) * 0.0043;
			}
			else
			{
				mortgageStampDuty = loanAmountTemp * 0.0003;
			}
		}
		else
		{
			mortgageStampDuty = loanAmountTemp * 0.0043
		}
	}
	
	if (state == "SA") 
	{
		//if (amount <= 6000)
		//{
		//	mortgageStampDuty = 10;
		//}
		//else if ((amount > 6000) && (mortgageType == "OO"))
		//{
		//	mortgageStampDuty = eval((((amount - 6000)/100)*0.35) + 10);
		//}
		//else
		//{
		//	mortgageStampDuty = eval((((amount - 6000)/100)*0.45) + 10);
		//}
		
		if (loanAmountTemp <= 400)
		{
			mortgageStampDuty = 0;
		}
		else if ((loanAmountTemp > 400) && (loanAmountTemp <= 6000))
		{
			mortgageStampDuty = 10;
		}
		else
		{
			mortgageStampDuty = eval((((loanAmountTemp - 6000)  / 100) * 0.35) + 10);
		}
		
	}
	
	if (state == "TAS") 
	{
		if (loanAmountTemp <= 8000) 
		{
			mortgageStampDuty = 20;
		}
		else if ((loanAmountTemp > 8000) && (loanAmountTemp <= 10000)) 
		{
			mortgageStampDuty = eval((((loanAmountTemp - 8000)/100)*0.25) + 20);
		}
		else 
		{
			mortgageStampDuty = eval((((loanAmountTemp - 10000)/100)*0.35) + 25);
		}
	}
	
	if (state == "WA") 
	{
		if (mortgageType == "OO")
		{
			mortgageStampDuty = eval(loanAmountTemp * 0.0025);
		}
		else
		{
			if (loanAmountTemp <= 35000)
			{
				mortgageStampDuty = eval(loanAmountTemp * 0.0025);
			}
			else
			{
				mortgageStampDuty = eval((((loanAmountTemp - 35000) / 100) * 0.4) + 87.5);
			}
		}
	}
	
	if (state == "NT") 
	{
		mortgageStampDuty = 0;
	}
	
	return mortgageStampDuty;
}

//TRANSFER STAMP DUTY

function fTransferStampDuty(propertyValue, propertyValueTemp, state, mortgageType) 
{
	var transferStampDuty = 0;
	
	if (state == "VIC") 
	{
		if (propertyValueTemp <= 20000) 
		{
			transferStampDuty = eval(((propertyValueTemp) / 100) * 1.4);
	
		}
		else if ((propertyValueTemp > 20000) && (propertyValueTemp <= 115000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 20000) / 100) * 2.4) + 280);
		}
		else if ((propertyValueTemp > 115000) && (propertyValueTemp <= 870000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 115000) / 100) * 6) + 2560);
		}
		else 
		{
			transferStampDuty = eval(((propertyValueTemp) / 100) * 5.5) ;
		}
	}
	
	if (state == "NSW") 
	{
		if (propertyValueTemp <= 14000) 
		{
			transferStampDuty = eval((propertyValueTemp / 100) * 1.25);
		}
		else if ((propertyValueTemp > 14000) && (propertyValueTemp <= 30000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 14000) / 100) * 1.5) + 175);
		}
		else if ((propertyValueTemp > 30000) && (propertyValueTemp <= 80000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 30000) / 100) * 1.75) + 415);
		}
		else if ((propertyValueTemp > 80000) && (propertyValueTemp <= 300000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 80000) / 100) * 3.5) + 1290);
		}
		else if ((propertyValueTemp > 300000) && (propertyValueTemp <= 1000000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 300000) / 100) * 4.5) + 8990);
		}
		else if (propertyValueTemp >= 3000000)
		{
			transferStampDuty = eval((((propertyValueTemp - 3000000) / 100) * 7) + 150490);
		}
		else 
		{
			transferStampDuty = eval((((propertyValueTemp - 1000000) / 100) * 5.5) + 40490);
		}
	}
	
	//if (state == "NSW")
	//{
	//	if (propertyValue < 500000)
	//	{
	//		transferStampDuty = eval(0);
	//	}
	//	else if (propertyValue <= 1000000)
	//	{
	//		transferStampDuty = eval((((propertyValueTemp - 300000) / 100) * 4.5) + 8990);
	//	}
	//	else 
	//	{
	//		transferStampDuty = eval((((propertyValueTemp - 1000000) / 100) * 5.5) + 40490);
	//	}
		//alert (propertyValue);
	//}
	
	//if (state == "ACT") 
	//{
	//	if (amount <= 14000) 
	//	{
	//		transferStampDuty = eval((amount/100)*1.25);
	//	}
	//	else if ((amount > 14000) && (amount <= 30000)) 
	//	{
	//		transferStampDuty = eval((((amount - 14000)/100)*1.5) + 175);
	//	}
	//	else if ((amount > 30000) && (amount <= 60000)) 
	//	{
	//		transferStampDuty = eval((((amount - 30000)/100)*2) + 415);
	//	}
	//	else if ((amount > 60000) && (amount <= 100000)) 
	//	{
	//		transferStampDuty = eval((((amount - 60000)/100)*2.5) + 1015);
	//	}
	//	else if ((amount > 100000) && (amount <= 300000)) 
	//	{
	//		transferStampDuty = eval((((amount - 100000)/100)*3.5) + 2015);
	//	}
	//	else if ((amount > 300000) && (amount <= 1000000)) 
	//	{
	//		transferStampDuty = eval((((amount - 300000)/100)*4.5) + 9015);
	//	}
	//	else 
	//	{
	//		transferStampDuty = eval((((amount - 1000000)/100)*5.5) + 40515);
	//	}
	//}
	
	if (state == "ACT")
	{
		if (propertyValueTemp <= 100000) {
			transferStampDuty = eval((propertyValueTemp/100)*2);
			
			if (transferStampDuty < 20) {
				transferStampDuty = 20;
			}
		}
		else if ((propertyValueTemp > 100000) && (propertyValueTemp <= 200000)) {
			transferStampDuty = eval((((propertyValueTemp - 100000)/100)*3.5) + 2000);
		}
		else if ((propertyValueTemp > 200000) && (propertyValueTemp <= 300000)) {
			transferStampDuty = eval((((propertyValueTemp - 200000)/100)*4) + 5500);
		}
		else if ((propertyValueTemp > 300000) && (propertyValueTemp <= 500000)) {
			transferStampDuty = eval((((propertyValueTemp - 300000)/100)*5.5) + 9500);
		}
		else if ((propertyValueTemp > 500000) && (propertyValueTemp <= 1000000)) {
			transferStampDuty = eval((((propertyValueTemp - 500000)/100)*5.75) + 20500);
		}
		else {
			transferStampDuty = eval((((propertyValueTemp - 1000000)/100)*6.75) + 49250);
		}
	}
	
	if (state == "QLD") 
	{

		if (mortgageType == "OO")
		{
			if (propertyValueTemp <= 250000)
			{
				transferStampDuty = eval((propertyValueTemp / 100) * 1);
			}
			else if ((propertyValueTemp > 250000) && (propertyValueTemp <= 500000)) 
			{
				transferStampDuty = eval((((propertyValueTemp - 250000)/100)*3.5) + 2500);
			}
			else 
			{
				transferStampDuty = eval((((propertyValueTemp - 500000)/100)*3.75) + 11250);
			}
		}
		else
		{

			if (propertyValueTemp <= 20000)
			{
				transferStampDuty = eval((propertyValueTemp / 100) * 1.5);
			}
			else if ((propertyValueTemp > 20000) && (propertyValueTemp <= 50000)) 
			{
				transferStampDuty = eval((((propertyValueTemp - 20000) / 100) * 2.25) + 300);
			}
			else if ((propertyValueTemp > 50000) && (propertyValueTemp <= 100000)) 
			{
				transferStampDuty = eval((((propertyValueTemp - 50000) / 100) * 2.75) + 975);
			}
			else if ((propertyValueTemp > 100000) && (propertyValueTemp <= 250000)) 
			{
				transferStampDuty = eval((((propertyValueTemp - 100000) / 100) * 3.25) + 2350);
			}
			else if ((propertyValueTemp > 250000) && (propertyValueTemp <= 500000)) 
			{
				transferStampDuty = eval((((propertyValueTemp - 250000) / 100) * 3.5) + 7225);
			}
			else 
			{
				transferStampDuty = eval((((propertyValueTemp - 500000)/100) * 3.75) + 15975);
			}	
		}
	}
	
	if (state == "SA") 
	{
		if (propertyValueTemp <= 12000) 
		{
			transferStampDuty = eval((propertyValueTemp/100)*1);
		}
		else if ((propertyValueTemp > 12000) && (propertyValueTemp <= 30000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 12000)/100)*2) + 120);
		}
		else if ((propertyValueTemp > 30000) && (propertyValueTemp <= 50000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 30000)/100)*3) + 480);
		}
		else if ((propertyValueTemp > 50000) && (propertyValueTemp <= 100000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 50000)/100)*3.5) + 1080);
		}
		else if ((propertyValueTemp > 100000) && (propertyValueTemp <= 500000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 100000)/100)*4) + 2830);
		}
		else if ((propertyValueTemp > 500000) && (propertyValueTemp <= 1000000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 500000)/100)*4.5) + 18830);
		}
		else 
		{
			transferStampDuty = eval((((propertyValueTemp - 1000000)/100)*5) + 41330);
		}
	}
	
	if (state == "TAS") 
	{
		if (propertyValueTemp <= 1300) 
		{
			transferStampDuty = 20;
		}
		else if ((propertyValueTemp > 1300) && (propertyValueTemp <= 10000)) 
		{
			transferStampDuty = eval((propertyValueTemp/100)*1.5);
		}
		else if ((propertyValueTemp > 10000) && (propertyValueTemp <= 30000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 10000)/100)*2) + 150);
		}
		else if ((propertyValueTemp > 30000) && (propertyValueTemp <= 75000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 30000)/100)*2.5) + 550);
		}
		else if ((propertyValueTemp > 75000) && (propertyValueTemp <= 150000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 75000)/100)*3) + 1675);
		}
		else if ((propertyValueTemp > 150000) && (propertyValueTemp <= 225000)) 
		{
			transferStampDuty = eval((((propertyValueTemp - 150000)/100)*3.5) + 3925);
		}
		else 
		{
			transferStampDuty = eval((((propertyValueTemp - 225000)/100)*4) + 6550);
		}
	}
	
	if (state == "WA") 
	{
		//if (propertyValueTemp <= 80000) 
		//{
		//	transferStampDuty = eval((propertyValueTemp/100)*1.95);
		//}
		//else if ((propertyValueTemp > 80000) && (propertyValueTemp <= 100000)) 
		//{
		//	transferStampDuty = eval((((propertyValueTemp - 80000)/100)*2.85) + 1560);
		//}
		//else if ((propertyValueTemp > 100000) && (propertyValueTemp <= 250000)) 
		//{
		//	transferStampDuty = eval((((propertyValueTemp - 100000)/100)*3.7) + 2130);
		//}
		//else if ((propertyValueTemp > 250000) && (propertyValueTemp <= 500000)) 
		//{
		//	transferStampDuty = eval((((propertyValueTemp - 250000)/100)*4.55) + 7680);
		//}
		//else 
		//{
		//	transferStampDuty = eval((((propertyValueTemp - 500000)/100)*4.85) + 19055);
		//}
		if ((mortgageType == "OO") && (propertyValueTemp <= 135000))
		{
			if (propertyValueTemp <= 100000)
			{	
				transferStampDuty = eval((propertyValueTemp/100)*1.5);
			}
			else
			{
				transferStampDuty = eval((((propertyValueTemp - 100000)/100)*5.5) + 1500);
			}
		}
		else
		{
			if (propertyValueTemp <= 80000)
			{	
				transferStampDuty = eval((propertyValueTemp/100)*2);
			}
			else if ((propertyValueTemp > 80000) && (propertyValueTemp <= 100000))
			{
				transferStampDuty = eval((((propertyValueTemp - 80000)/100)*3) + 1600);
			}
			else if ((propertyValueTemp > 100000) && (propertyValueTemp <= 250000))
			{
				transferStampDuty = eval((((propertyValueTemp - 100000)/100)*4.15) + 2200);
			}
			else if ((propertyValueTemp > 250000) && (propertyValueTemp <= 500000))
			{
				transferStampDuty = eval((((propertyValueTemp - 250000)/100)*5.15) + 8425);
			}
			else
			{
				transferStampDuty = eval((((propertyValueTemp - 500000)/100)*5.5) + 21300);
			}
		}
	}
	
	if (state == "NT") 
	{
		if (propertyValueTemp <= 500000) 
		{
			newPropertyValueTemp = eval(propertyValueTemp / 1000);
			transferStampDuty = eval((0.065 * Math.pow(newPropertyValueTemp,2)) + (21 * newPropertyValueTemp));
		}
		else 
		{
			transferStampDuty = eval(5.4 * (propertyValueTemp/100));
		}
		
		if (mortgageType == "OO")
		{
			transferStampDuty = transferStampDuty - 1500;
			
			if (transferStampDuty < 0)
			{
				transferStampDuty = 0;
			}
		}
	}
	
	return transferStampDuty;
}

function getConcessionSchemes(state)
{
	var text = "";
	
	if (state == "VIC") 
	{
		text = "<u><i>First home buyers with families: </i></u>" +
			   "<ul>" +
			   "<li>You must have at least one dependant child to qualify</li>" + 
			   "<li>Properties valued under $150,000 are exempt from full stamp duties; after which there is a reducing scale on stamp duty exemptions for properties between $150,000 and $200,000</li>" +
			   "<li>Income tests don't apply</li>"+
			   "<li>For properties priced under $500,000, an additional First Home Bonus of $5,000 may be received on top of the FHOG</li>"+
			   "</ul>" +
			   "<u><i>Home buyers with conecession cards: </i></u>" +
			   "<ul>" +
			   "<li>Properties valued under $150000 are exempt from full stamp duties; after which there is a reducing scale on stamp duty exemptions for properties between $150,000 and $200,000</li>" +
			   "<li>Must have one of the following types of cards:<ul>"+
			       "<li>Pensioner Concession Card (Department of Social Security or Department of Veterans' Affairs)</li>" + 
				   "<li>Veterans' Affairs Gold Card</li>" + 
				   "<li>Health Benefits Card</li>" + 
				   "<li>Health Care Card</li>"
				   "</ul>" +
			   "</li></ul>";
	}
	else if (state == "NSW") 
	{	   
		text = "<u><i>First Home Plus scheme: </i></u>" +
			   "<ul>" +
			   "<li>For metropolitan areas:<ul>"+
			       "<li>Properties purchased up to $500,000 are exempt from full stamp duties&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>" + 
				   "</ul>" +
			   "<li>For country areas:<ul>"+
			       "<li>Properties purchased up to $500,000 are exempt from full stamp duties&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>" + 
				   "</ul>" +
			   "<li>For first homes priced between $500,000 and $600,000, the concession phases out on a sliding scale</li>" +
			   "</li></ul>";
	}
	else if (state == "ACT") 
	{
		text = "<u><i>Stamp Duty Relief Scheme (where household income is less than $45,000): </i></u>" +
			   "<ul>" +
			   "<li>Properties valued up to $116,000 are exempt from full stamp duties</li>" + 
			   "<li>Reducing scale of stamp duty concessions for properties between $116,000 and $140,000</li>" +
			   "<li>Must use property as main residence OR may be first home OR re-entering home ownership where a property wasn't owned for last two years)</li>" +
			   "</ul>";
	}
	else if (state == "QLD") 
	{
		text = "<u><i>First Home Buyer Rebate:</i></u>" +
			   "<ul>" +
			   "<li>Properties valued up to $250,000 are exempt from full stamp duties</li>" + 
			   "<li>Reducing scale of stamp duty concessions for properties between $250,000 and $500,000</li>" +
			   "<li>Must use property as main residence and first home</li>"+
			   "<li>Mortgage Stamp Duty is not payable by a first home borrower for the first $250,000 of a loan to buy or build their first home</li>"+
			   "<li>Must not be an investment property</li>"+
			   "</ul>";
	}
	else if (state == "SA") 
	{
		text = "<u><i>First Home Buyer Concession:</i></u>" +
			   "<ul>" +
			   "<li>Properties valued up to $100,000 are exempt from full stamp duties</li>" + 
			   "<li>Reducing scale of stamp duty concessions for properties between $100,000 and $130,000</li>" +
			   "<li>Must use property as main residence and first home</li>"+
			   "<li>Must not be an investment property</li>"+
			   "</ul>";	
	}
	else if (state == "TAS") 
	{
		text = "<u><i>Stamp Duty Concession:</i></u>" +
			   "<ul>" +
			   "<li>For properties valued under $120,000, stamp duty becomes an interest free loan payable over a span of two years</li>" + 
			   "<li>Must use property as main residence and first home</li>"+
			   "</ul>";
	}
	else if (state == "WA") 
	{
		text = "<u><i>Concessional Rate:</i></u>" +
			   "<ul>" +
			   "<li>Only applies to properties with a dutiable value not more than $135,000</li>" + 
			   "<li>Concessional rate is $1.50 per $100 (or part thereof) up to $100,000 and then $5.50 per $100 for the balance</li>" + 
			   "<li>Must be principal place of residence or business undertaking</li>" + 
			   "<li>Full details are available in section 75AE of the Stamp Act (1921)</li>" + 
			   "</ul>" +
			   "<u><i>First Home Owners Rebate:</i></u>" +
			   "<ul>" +
			   "<li>Properties purchased up to $220,000 are exempt from full stamp duties</li>" +
			   "<li>Rebate amount will be the lesser of $500 or amount of duty payable</li>" + 
			   "<li>Applicable to vacant land valued under $52,000 or property (house and land) valued under $135,000</li>" + 
			   "<li>Must use property as main residence and first home</li>"+
			   "<li>Full details are available in section 75AG of the Stamp Act (1921)</li>" + 
			   "</ul>"; 
	}
	else if (state == "NT") 
	{
		text = "<u><i>First Home Rebate Scheme:</i></u>" +
			   "<ul>" +
			   "<li>Rebate will be the lesser of $2780 or the total stamp duty payable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>" + 
			   "<li>Must use property as main residence and first home</li>" + 
			   "</ul>";		
	}
	
	return text;
}