var xmlHttp;
var ListRef;
var FieldRef;
var StateRef;
var PCodeRef;

function fnDispList(str,ListID,FieldID,StateID,PCodeID)	{ 

	ListRef=ListID;
	FieldRef=FieldID;
	StateRef=StateID;
	PCodeRef=PCodeID;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)	{
	  alert ("Your browser does not support this feature.");
	  return;
	}  
		  
	var url="asyncSubs.asp";
	url=url+"?ListID="+ListRef+"&FieldID="+FieldRef+"&q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=substateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function substateChanged()
{ 
if (xmlHttp.readyState==4)	{ 
	document.getElementById(ListRef).innerHTML=xmlHttp.responseText;
	document.getElementById(ListRef).style.display="block";
   }
}

function fnHighlight(RowID)	{
	document.getElementById(RowID).style.background='#E1E8F7';
	document.getElementById(RowID).style.cursor="pointer";
}

function fnReset(RowID)	{
	document.getElementById(RowID).style.background='#FFFFFF';
}
function fnUpdateSub(NewVal,StateVal,PCodeVal)	{
	if (NewVal!=null)	{
		document.getElementById(FieldRef).value=NewVal;
		document.getElementById(StateRef).value=StateVal;
		document.getElementById(ListRef).innerHTML="";
		document.getElementById(ListRef).style.display="inline";
	}
}

function fnRemoveList(ListRef)	{
	setTimeout('fnRemoveListFinally(ListRef)',550);
}

function fnRemoveListFinally(ListRef)	{
	document.getElementById(ListRef).innerHTML="";
	document.getElementById(ListRef).style.display="inline";
}