function showSaleSettlementFee(iPrice, bStrata, sContentDiv, sLoadingDiv, sDisable){
	var sUrl;

	//Modify this to customise ajax process
	sUrl = "process-sale-results.asp?sale_price=" + iPrice+"&strata_titled=" + bStrata;

	generateContent(1, sContentDiv, sLoadingDiv, sDisable, sUrl);
}

function showPurchaseSettlementFee(iPrice, bFHO, bReside, bStrata, bVacant, sContentDiv, sLoadingDiv, sDisable){
	var sUrl;

	//Modify this to customise ajax process
	sUrl = "process-purchase-results.asp?purchase_price=" + iPrice + "&strata_titled=" + bStrata + "&reside_after_settlement=" + bReside + "&first_home_buyer=" + bFHO + "&vacant_land=" + bVacant;

	generateContent(1, sContentDiv, sLoadingDiv, sDisable, sUrl);
}


/*** function generateContent ********************************************

This function use ajax to shows dynamic content

recordID	- id parameter use in asp page
bPreload	- loading status
sContentDiv	- the name of div container that is use for displaying the dynamic content
sLoadingDiv	- the name of div container that is use for displaying loading status
sDisableDiv	- the name of object that you want to disable to minimise errors
sUrl		- the ajax asp page name
***********************************************************************/
function generateContent(recordID, sContentDiv, sLoadingDiv, sDisable, sUrl)
{
	var xmlHttp;

	//Set up ajax object
	xmlHttp = GetXmlHttpObject()

	if ( xmlHttp==null )
	{
		alert ("Browser does not support HTTP Request");
		return
	}

	if ( recordID.length > 0 ) {
		if ( sDisable != null ) { 
			document.getElementById(sDisable).disabled		= true;
		}
		document.getElementById(sContentDiv).style.display	= "none";
		//alert(sUrl+" - "+sLoadingDiv);
		document.getElementById(sLoadingDiv).style.display	= "";
	}

	xmlHttp.onreadystatechange=function(){
		updateContent(xmlHttp, sContentDiv, sLoadingDiv, sDisable);	
	};

	xmlHttp.open("GET",sUrl,true);
	xmlHttp.send(null);
}

/*** function updateContent ********************************************

This function use ajax to update dynamic content

sContentDiv	- the name of div container that is use for displaying the dynamic content
sLoadingDiv	- the name of div container that is use for displaying loading status
sDisableDiv	- the name of object that you want to disable to minimise errors
***********************************************************************/
function updateContent(xmlHttp, sContentDiv, sLoadingDiv, sDisable) 
{ 
	//Show everything when finish loading
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById(sContentDiv).innerHTML			= xmlHttp.responseText;
		document.getElementById(sContentDiv).style.display		= "";
		document.getElementById(sLoadingDiv).style.display		= "none"; //alert(sDisable);
		
		if ( sDisable != null ) { 
			document.getElementById(sDisable).disabled			= false;
		}
	}
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null

	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}

	return objXMLHttp
}
