
function getListName()
{
	new Ajax.Request('/directory/get_name.html', {method:'post', postBody:'LastName='+$F('lastname'), onSuccess:showResponse});
}

function getListNameSec(feed)
{
	new Ajax.Request('/directory/get_name.html', {method:'post', postBody:'LastName='+feed, onSuccess:showResponse});
}

function getListAll()
{
	new Ajax.Request('/directory/get_all.html', {method:'post', postBody:'All=1', onSuccess:showResponse});
}

function getListDept()
{
	post = $('department').value.replace('&',"~amp~");
	new Ajax.Request('/directory/get_dept.html', {method:'post', postBody:'Department='+post, onSuccess:showResponse});
}

function getListDeptSec(dept)
{
	var listBox = $('department');
	var options = listBox.getElementsByTagName('option');
	options = $A(options);

	options.each(function(s,index){
		if(options[index].value == dept)
		{
			$('department').options[index].selected = true;
		}
		});

	post = dept.replace('&',"~amp~");
	new Ajax.Request('/directory/get_dept.html', {method:'post', postBody:'Department='+post, onSuccess:showResponse});
}

function getListBldg()
{
	var dept = $('building').value;
	post = dept.replace('&',"~amp~");
	new Ajax.Request('/directory/get_bldg.html', {method:'post', postBody:'Building='+post, onSuccess:showResponse});
}

function getListBldgSec(bldg)
{

	var listBox = $('building');
	var options = listBox.getElementsByTagName('option');
	options = $A(options);

	options.each(function(s,index){
		if(options[index].value == bldg)
		{
			$('building').options[index].selected = true;
		}
		});

	post = bldg.replace('&',"~amp~");
	new Ajax.Request('/directory/get_bldg.html', {method:'post', postBody:'Building='+post, onSuccess: showResponse});

}

function showResponse(req)
{
	//Element.hide('output');
	$('output').innerHTML = req.responseText;
	//new Effect.BlindDown('output',{duration: 0.3});
}

function showLoading()
{
	$('output').innerHTML = '<img src="/directory/loading.gif" style="border:none;">';
}

function getAutoComplete()
{
new Ajax.Autocompleter("lastname", "ac_choices", "/directory/get_name_ac.html", {paramName: "LastName", frequency: 0.2, minChars: 2});
}

Event.observe(window, 'load', function(){/*Element.hide('output');*/getAutoComplete();});