var xmlhttp

xmlhttp=null

function loadXMLDoc(url,xml,frm)
{
	xmlhttp=null
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
  	{
  		xmlhttp=new XMLHttpRequest()
  	}
	// code for IE
	else if (window.ActiveXObject)
  	{
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  	}

	if (xmlhttp!=null)
  	{
  		xmlhttp.onreadystatechange = function ()
		{
			// if xmlhttp shows "loaded"
			if (xmlhttp.readyState==4)
		  	{
  				// if "OK"
		  		if (xmlhttp.status==200)
    				{
					//frm.value = xmlhttp.responseText;
					var returnText = xmlhttp.responseText;
					var optionValue, optionText, i;

					if (typeof(frm) == 'string')
					{
						window.top.location.reload();
					}
					else
					{
						if (typeof(selectOneTxt) == 'string')
						{
							frm.options.length = 0;
							frm.options[0] = new Option('-- '+selectOneTxt+' --','');
							i = 1;
						}
						else if (typeof(selectOneTxt) == 'number')
						{
							i = selectOneTxt;
						}
						else
						{
							i = 0;
						}
	
						while (returnText.length > 0)
						{
							if (returnText.indexOf('~')>0)
							{
								optionValue=returnText.substring(0,returnText.indexOf('~'));
								returnText=returnText.substring(returnText.indexOf('~')+1,returnText.length);
							}
							else
							{
								optionValue=returnText;
								returnText='';
							}

							if (optionValue.indexOf('|')>0)
							{
								optionText=optionValue.substring(0,optionValue.indexOf('|'));
								optionValue=optionValue.substring(optionValue.indexOf('|')+1,optionValue.length);
							}
							else
							{
								optionText = optionValue;
							}
	
							frm.options[i] = new Option(optionValue,optionText);
							
							if (typeof(selectedValue) == 'string')
							{

								if (selectedValue==optionValue)
								{
									frm.options[i].selected = true;
								}
							}

							i++;
						}
					}
    				}
		  		else
    				{
		    			alert("Problem retrieving XML data")
    				}
  			}
		}
  		xmlhttp.open("POST",url,true)
  		xmlhttp.send(xml)
  	}
	else
  	{
  		alert("Your browser does not support XMLHTTP.")
  	}
}