function populateTextBox(clientId) 
{
	var dropDownTextBox     = document.all[clientId + "_dropDownTextBox"];
	var text = getSelectedText(clientId);
	dropDownTextBox.value = text; 
	if (clientId == "payToVendorCDAUC")
    {
		SetVendorType(clientId);
    }
   
    toggleDisplay(clientId);
}

function getSelectedText(clientId) 
{
    var dropDownListBox     = document.all[clientId + "_dropDownListBox"];
    return dropDownListBox.options[dropDownListBox.selectedIndex].text;     
}

function getSelectedValue(clientId) 
{
	var dropDownListBox     = document.all[clientId + "_dropDownListBox"];
    return dropDownListBox.options[dropDownListBox.selectedIndex].value;
}
   
function toggleDisplay(clientId) 
{
	var dropDownDiv = document.all[clientId + "_dropDownDiv"];
	if (dropDownDiv != null) 
    {
		if (dropDownDiv.style.display == "inline")
        {
            dropDownDiv.style.display = "none";
        }
        else if (dropDownDiv.style.display == "none") 
        {
			dropDownDiv.style.display = "inline";
        }
    }
}  

function changeInfo(clientId)               
{	
	var dropDownTextBox     = document.all[clientId + "_dropDownTextBox"];
    var dropDownListBox     = document.all[clientId + "_dropDownListBox"];
    var companyExists = false;
	for(i=0;i<dropDownListBox.length;i++)
	{
		var text = dropDownListBox.options[i].text;
		if(text.toLowerCase() == dropDownTextBox.value.toLowerCase())
		{
			var changedValue = dropDownListBox.options[i].value;
			dropDownListBox.selectedIndex = 0;
			dropDownListBox.options[dropDownListBox.selectedIndex].value = changedValue;
			companyExists = true;
		}
	}
	
	if(companyExists == false && dropDownListBox.selectedIndex != -1)
	{
		dropDownListBox.options[dropDownListBox.selectedIndex].value = 0;
	}
}

 