$(document).ready(function() {
//bind autocomplete to lookup element	
$.ajax({
		url: "/as/peoplexml?openview",
		dataType: "xml",
			success: function(xmlResponse) {
				var data = $("personentry", xmlResponse).map(function() {
					return {
						value: $("uname1", this).text(),
						label: $("uname2", this).text(),
						link: $("uname3", this).text()
					};
				}).get();
				$('#lookup, #people_lookup').autocomplete({
					source: data,
					minLength: 2,
					focus: function(event, ui) {
						return false;
					},
					select: function(event, ui) {
					location.href= '/a/' + ui.item.link;
					}
				});	
			}
		});
});
	

