function loadStaffMember(element) {
	if (element) {
		// turn off all 
		resetStaffListingLinks();
		// get the link
		var link = element.href;
		// cut off the "html" at the end
		link = link.substring(0, link.length - 4);
		// add the "xml"
		link = link + "xml";
		// load the xml
//		$("#staffmemberdetails").load(link);
		$.get(link, function(xml) {
			displayStaffMember(xml);
		});
		// turn on the highlighting of the current element
		$(element.parentNode).addClass("active");
	}	
	return false;
}

function resetStaffListingLinks() {
	$('.stafflisting > li').removeClass("active");
}

function displayStaffMember(xml) {
	if($("status",xml).text() == "2") return;
	staffName = $("name",xml).text(); 
	staffFunction = $("function",xml).text(); 
	staffPhone = $("phone",xml).text(); 
	staffMail = $("mail",xml).text(); 
	staffPhoto = $("photo",xml).text();
	// hide the default image
	$(".defaultImage").css("display", "none");
	// set the values in the staff details paragraph
	if (staffPhoto && !staffPhoto.match("dms$")) {
		$(".staffmember > .photo").attr("src", staffPhoto);
		$(".staffmember > .photo").attr("alt", staffName);
		$(".staffmember > .photo").css("display", "block");
	} else {
		$(".staffmember > .photo").css("display", "none");
	}
	$(".staffmember > .info > .name > strong").html(staffName);
	$(".staffmember > .info > .function").html(staffFunction);
	$(".staffmember > .info > .phone").html(staffPhone);
	$(".staffmember > .info > .mail > a").attr("href", "mailto:" + staffMail);
	$(".staffmember > .info > .mail > a").html(staffMail);
	// show the staff details
	$("div.staffmember").css("display", "block");
}
