  	// Over here we make a call back to our server side page and return the results from our query 
	// to a DIV tag sitting under the text box
function asbGetXmlHttp()
	{
		var oXmlHttp=false;
	
		// -----> This method was provided from Jim Ley's website 
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try {
			oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		try {
			oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			oXmlHttp = false;
		}
		}
		/*@end @*/
	

		if (!oXmlHttp && typeof XMLHttpRequest!='undefined') 
		{
			oXmlHttp = new XMLHttpRequest();
		}
		
		return oXmlHttp;	  
	}	

function doSortRecent (sort_parts,sort_order,sort_by,modeID) {
	if (sort_order == "no") {
		sort_order = "DESC";
	} else {
		if (sort_order == 'DESC') {
			sort_order = "ASC";
		} else {
			sort_order = "DESC";
		}
	}
	var selDivID;
	var oXmlHttp;
	oXmlHttp=asbGetXmlHttp();
	var sUrl;
//asbTRACE("Show recent:"+modeID);
	if (modeID == 1) {
		selDivID = 'recentDocuments';
		sUrl="/site/support/sup_RecentDocumentSubmit.php?RENT_PARTS=" + sort_parts + "&DOCU_SORT=" + sort_by + "&DOCU_ORDER=" + sort_order + "&";
	} else {
		selDivID = 'recentDownload';
		sUrl="/site/support/sup_RecentDownloadSubmit.php?RENT_PARTS=" + sort_parts + "&DOCU_SORT=" + sort_by + "&DOCU_ORDER=" + sort_order + "&";
	}
	oXmlHttp.open("GET", sUrl, true);
	oXmlHttp.onreadystatechange=function() 
	{
		if (oXmlHttp.readyState==4) {
			if (oXmlHttp.responseText!="") {
				asbShowPartsDiv(selDivID, oXmlHttp.responseText);
			} else {
				// asbHidePartsDiv(selDivID);
			}
		} else {
		}
	}
	oXmlHttp.send(null)
}

function asbGetRecentPartsFromServerByButtom (recentDivID,partsTextID,partsDivID,closeDivID,fBy) {
    if (document.getElementById('tat_table')){ document.body.removeChild(document.getElementById('tat_table')); }
	var sValue;
	var txtCtrl;
	if (fBy == 1) {
		txtCtrl=document.getElementById(partsTextID);
		sValue = txtCtrl.value;
		var oXmlHttp;
		oXmlHttp=asbGetXmlHttp();
		var sUrl;
/*
		sUrl="/site/sup/sup_RecentPartsInformation.php" + "?fNo=" + sValue;
		oXmlHttp.open("GET", sUrl, true);
		oXmlHttp.onreadystatechange=function() 
		{
			if (oXmlHttp.readyState==4) {
				if (oXmlHttp.responseText!="") {
					document.getElementById(partsDivID).style.visibility = 'hidden';
					document.getElementById(partsDivID).style.display = 'none';
					document.getElementById(closeDivID).style.visibility = 'hidden';
					document.getElementById(closeDivID).style.display = 'none';
					asbShowPartsDiv(recentDivID, oXmlHttp.responseText);
asbTRACE("Show recent:ok ");
				} else {
					asbHidePartsDiv(recentDivID);
asbTRACE("Show recent:non ");
				}
			}
		}

		if (!document.getElementById('tab_recent')) {
			oXmlHttp.send(null)
			oXmlHttp=asbGetXmlHttp();
*/
			sUrl="/site/sup/sup_GetClosePartsList.php" + "?fNo=" + sValue;
//asbTRACE("Show List: " + sUrl );
			oXmlHttp.open("GET", sUrl, true);
			oXmlHttp.onreadystatechange=function() 
			{
				if (oXmlHttp.readyState==4) {
					if (oXmlHttp.responseText!="") {
						asbShowPartsDiv(closeDivID, oXmlHttp.responseText);
					} else {
						asbHidePartsDiv(closeDivID)
					}
				}
			}
//		}

	} else {
		sValue = partsTextID;
		var oXmlHttp;
		oXmlHttp=asbGetXmlHttp();
		var sUrl;
		sUrl="/site/sup/sup_RecentPartsInformation.php" + "?fNo=" + sValue;
		oXmlHttp.open("GET", sUrl, true);
		oXmlHttp.onreadystatechange=function() 
		{
			if (oXmlHttp.readyState==4) {
				if (oXmlHttp.responseText!="") {
					document.getElementById(partsDivID).style.visibility = 'hidden';
					document.getElementById(partsDivID).style.display = 'none';
					document.getElementById(closeDivID).style.visibility = 'hidden';
					document.getElementById(closeDivID).style.display = 'none';
					asbShowPartsDiv(recentDivID, oXmlHttp.responseText);
				} else {
					asbHidePartsDiv(recentDivID);
				}
			}
		}
//asbTRACE(recentDivID +": " + document.getElementById(recentDivID).style.display );
	}
	oXmlHttp.send(null);
}



// Get Parts Information From Server
function asbGetPartsInformFromServer(sDivID,sTextID)
	{
		var sValue;
		var txtCtrl;
		txtCtrl=document.getElementById(sTextID);
		sValue = txtCtrl.value;
		var oXmlHttp;
		oXmlHttp=asbGetXmlHttp();
		
		var sUrl;
		sUrl="/site/sup/sup_GetPartsInformation.php" + "?fNo=" + sValue;
		oXmlHttp.open("GET", sUrl, true);
		
		oXmlHttp.onreadystatechange=function() 
		{
			if (oXmlHttp.readyState==4) 
			{
				if (oXmlHttp.responseText!="")
				{
					asbShowPartsDiv(sDivID, oXmlHttp.responseText);
				}				
				else
				{	
					asbHidePartsDiv(sDivID)
				}
			}
		}
		
		oXmlHttp.send(null)
	}

	// Get Parts List From Server
	function asbGetPartsListFromServer(sDivID,sNo)
	{
		var sValue;
		var txtCtrl;
		txtCtrl=document.getElementById('partsGroupCategory');
		sValue = txtCtrl.value;	
		if (sNo > 1)
		{
			txtCtrl=document.getElementById('partsHeadCategory');
			sValue = sValue + txtCtrl.value;
			if (sNo > 2)
			{
				txtCtrl=document.getElementById('partsTypeCategory');
				sValue = sValue + txtCtrl.value;
			}
				if (sNo > 3)
				{
					txtCtrl=document.getElementById('partsClassCategory');
					if (txtCtrl.value != "100")
					{
						sValue = sValue + txtCtrl.value;
					}
				}

		}

		var oXmlHttp;
		oXmlHttp=asbGetXmlHttp();
		
		var sUrl;
		sUrl="/site/sup/sup_GetPartsListData.php" + "?fNo=" + sValue
		oXmlHttp.open("GET", sUrl, true);
		
		oXmlHttp.onreadystatechange=function() 
		{
			if (oXmlHttp.readyState==4) 
			{
				if (oXmlHttp.responseText!="")
				{
					asbShowPartsDiv(sDivID, oXmlHttp.responseText);
				}				
				else
				{	
					asbHidePartsDiv(sDivID)
				}
			}
		}
		
		oXmlHttp.send(null)
	}

// Get Parts Group, Head, Class From Server
	function asbGetPartsGroupFromServer(sDivID,sNo)
	{
		var sValue;
		var txtCtrl;
		txtCtrl=document.getElementById('partsGroupCategory');
		sValue = txtCtrl.value;	
		if (sNo > 1)
		{
			txtCtrl=document.getElementById('partsHeadCategory');
			sValue = sValue + txtCtrl.value;
			if (sNo > 2)
			{
				txtCtrl=document.getElementById('partsTypeCategory');
				sValue = sValue + txtCtrl.value;
			}
				if (sNo > 3)
				{
					txtCtrl=document.getElementById('partsClassCategory');
					if (txtCtrl.value != "100")
					{
						sValue = sValue + txtCtrl.value;
					}
				}

		}

		var oXmlHttp;
		oXmlHttp=asbGetXmlHttp();
		
		var sUrl;
		sUrl="/site/sup/sup_GetPartsGroupData.php" + "?fNo=" + sValue;
		oXmlHttp.open("GET", sUrl, true);
		
		oXmlHttp.onreadystatechange=function() 
		{
			if (oXmlHttp.readyState==4) 
			{
				if (oXmlHttp.responseText!="")
				{
					asbShowPartsDiv(sDivID, oXmlHttp.responseText);
				}				
				else
				{	
					asbHidePartsDiv(sDivID)
				}
			}
		}
		
		oXmlHttp.send(null)
	}

// ----

function asbHidePartsDiv(sDivID){
	document.getElementById(sDivID).style.visibility = 'hidden';
	document.getElementById(sDivID).style.display = 'none';
}
	
function asbShowPartsDiv(sDivID, sDivContent) {
	var divMenu;
	divMenu=document.getElementById(sDivID);
	var sInnerHtml;
		sInnerHtml=sDivContent;
	divMenu.innerHTML = sInnerHtml;
	
	divMenu.style.visibility = 'visible';
	divMenu.style.display = 'block';
}

function SwitchPartsDiv(sRatioID_1,sRatioID_2,sTermID_1,sTermID_2,closeDivID,sNo){
	if (sNo == 1) {
		document.getElementById(sRatioID_1).style.visibility = 'visible';
		document.getElementById(sRatioID_1).style.display = 'block';
		document.getElementById(sTermID_1).style.visibility = 'visible';
		document.getElementById(sTermID_1).style.display = 'block';
		document.getElementById(sRatioID_2).style.visibility = 'hidden';
		document.getElementById(sRatioID_2).style.display = 'none';
		document.getElementById(sTermID_2).style.visibility = 'hidden';
		document.getElementById(sTermID_2).style.display = 'none';
	}
	if (sNo == 2) {
		document.getElementById(sRatioID_2).style.visibility = 'visible';
		document.getElementById(sRatioID_2).style.display = 'block';
		document.getElementById(sTermID_2).style.visibility = 'visible';
		document.getElementById(sTermID_2).style.display = 'block';
		document.getElementById(sRatioID_1).style.visibility = 'hidden';
		document.getElementById(sRatioID_1).style.display = 'none';
		document.getElementById(sTermID_1).style.visibility = 'hidden';
		document.getElementById(sTermID_1).style.display = 'none';
		document.getElementById(closeDivID).style.visibility = 'hidden';
		document.getElementById(closeDivID).style.display = 'none';
	}
}

function ReturnPartsListDiv(listDivID,recentDivID){
	document.getElementById(listDivID).style.visibility = 'visible';
	document.getElementById(listDivID).style.display = 'block';
	document.getElementById(recentDivID).style.visibility = 'hidden';
	document.getElementById(recentDivID).style.display = 'none';
}

function asbTRACE(sText) {
//		document.getElementById("txtTRACE").value = sText;
/*
		var sMessage = window.document.forms[0].txtTRACE.value;
		sMessage = sMessage + sText + "\n";
		window.document.forms[0].txtTRACE.value = sMessage;
*/
}

