function updateProfile(pid,dir) {
	$.getJSON("http://www.wcl.american.edu/includes/functions/profiles.cfc?wsdl",{ method : 'getProfile', returnformat : 'json', queryformat : 'column', last_profile : pid, direction : dir},
		function(r) {
			var prof_more;
			if (r.ROWCOUNT==1) {
				prof_more = r.DATA.PROFILE_URL;
				prof_more = prof_more.toString().replace('\#.*','');
				$('<img>').attr('src',r.DATA.PHOTO_URL);
				$('#current_profile').fadeOut('slow',function() {
					$('#profile_link').attr('href',r.DATA.PROFILE_URL).text(r.DATA.DESCRIPTION+'');
					$('#profile_img_link').attr('href',r.DATA.PROFILE_URL);
					profileLinksPrevNext(r.DATA.PROFILE_ID);
					$('#current_profile img').attr({
						'src' : r.DATA.PHOTO_URL,
						'alt' : r.DATA.NAME
					});
				}).fadeIn("slow");
				$('#profile_more').attr('href',prof_more);
			}
       });
}
function profileLinksPrevNext(pid) {
	$('#profile_next').unbind().click(function (){updateProfile(pid,'>');return false;});
	$('#profile_prev').unbind().click(function (){updateProfile(pid,'<');return false;});
}
$(document).ready(function() {
	profileLinksPrevNext(profile_id);
});