function doSetKeyedSelectOptions ( db_path , selectName , viewName , keyItem , returnItem ) {	var tmpIndex = keyItem.selectedIndex;	parentSelect = keyItem.Name;	globalSelect = selectName;//	prompt ( 'URL', db_path + '/agAjaxLookup?openagent&lkupview=' + viewName + '&lkupkey=' + keyItem[tmpIndex].text + '&returnitem=' + returnItem );	var myAjax = new Ajax.Request(		'/' + db_path + '/agAjaxLookup?openagent',		{method: 'get', parameters: 'lkupview=' + viewName + '&lkupkey=' + keyItem[tmpIndex].text + '&returnitem=' + returnItem , onComplete: setOptions }    );}function setOptions ( originalRequest ) {	var theSel = $(globalSelect);	theSel.options.length = 0; // removes all options.	var newValuesXML = originalRequest.responseXML;	var document_nodes = newValuesXML.getElementsByTagName("document" );	var element_node = document_nodes[0].firstChild;	if ( element_node.nodeName == 'Error' && element_node.text == 'DocumentNotFound' ) {		theSel.options[0] = new Option ( '- None set up -' );		return;	}	theSel.options[0] = new Option ( '- Please Select -' );	var counter = 1	do {		if ((element_node.nodeType!=3)&&(element_node.nodeType!=8))		{			if (window.ActiveXObject) { 				var nodevalue = element_node.text ;			} else { 				var nodevalue = element_node.textContent;			}			if (nodevalue !='' && element_node.name != 'Error' ) {				theSel.options.length = (counter);				theSel.options[theSel.options.length] = new Option ( nodevalue );				counter = counter + 1;			} 		}		element_node = element_node.nextSibling;	} while ( element_node != null );	theSel.selectedIndex=0;}function doClearSelectOptions( selectname , parentSelect ) {	var theSel = $(selectname);	theSel.options.length = 0; // removes all options.//	theSel.options[0] = new Option ( "- Select a " + parentSelect + " First -" );}