var winScroller;
var person_just_shown_id = -1;

window.addEvent('domready', function(){
	// use scroll fx to scroll to person after being shown
	winScroller = new Fx.Scroll(window);						 
									 
	this.scroll2Person = function(){
		//scroll to person
		// test that a person was actually clicked
		if (person_just_shown_id != -1){
			// scroll to it
			winScroller.toElement($(id));
		}
	}
	
	this.updateShownPersonId = function(toggler, el){
		id = el.getParent().id;
		person_just_shown_id = id;
	}
	
	// initialise click listeners to establish which person is selected

	// initialise mootools accordion effect
	var people_accordion = new Accordion($$('.togglers'), $$('.togglable_descriptions'), {
		display: -1,
		alwaysHide: true,
		onActive: updateShownPersonId,
		onComplete:scroll2Person
		
	});									 
});