
function showContent(iCategoryID, recordID, bIsListing, sContentDiv, sLoadingDiv, sDisable){
	var sUrl;

	//Modify this to customise ajax process
	sUrl = "ajaxRetrieveHomeList.asp?iParentID=" + recordID+"&iCategoryID="+iCategoryID+"&bIsListing="+bIsListing;

	generateContent(recordID, sContentDiv, sLoadingDiv, sDisable, sUrl, iCategoryID);
}

function showFloorPlan(recordID, sContentDiv, sLoadingDiv, sDisable){
	var sUrl;

	//Modify this to customise ajax process
	sUrl = "ajaxRetrieveFloorPlanList.asp?iFloorPlanID=" + recordID;

	generateContent(recordID, 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, iCategoryID)
{
	var xmlHttp;

	//Set up ajax object
	xmlHttp = GetXmlHttpObject()

	if ( xmlHttp==null )
	{
		alert ("Browser does not support HTTP Request");
		return
	}

	if ( recordID.length > 0 ) {
		//document.getElementById(sDisable).disabled			= true;
		//alert(document.getElementById(sContentDiv));
		document.getElementById(sContentDiv).style.display	= "none";
		//alert(sUrl+" - "+sLoadingDiv);
		document.getElementById(sLoadingDiv).style.display	= "";
	}

	xmlHttp.onreadystatechange=function(){
		updateContent(xmlHttp, sContentDiv, sLoadingDiv, sDisable, iCategoryID);	
	};

	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, iCategoryID) 
{ 
	//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);
		//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
}