var guide = {
	/*	makeAccordions finds all the accordion layouts on the page and makes an accordion
			for each one. If I wanted this function to be more useful, I might make the selector
			that is passed in a variable.	*/
	makeAccordions: function(){
		/*	find all the dl elements with the class "Accordion"	*/
		$$('div#training').each(function(el){
			/*	make a new accordion with the elements in the dl element.

			Element.getElements works like $$() does - it returns an array of
			elements that match that selector. Unlike $$(), getElements starts
			at the Element on which it's called so it acts like a filter.	*/
			new Accordion(el.getElements('p.distance'), el.getElements('p.detail'), {show: -1, alwaysHide: true});
		});
	},
//	doSlider: function(){
//		mySlider = new Fx.Slide('training', {
//			duration: 1000, 
//			transition: Fx.Transitions.expoOut,
//			mode : 'horizontal'
//		}).hide();
//		mySlider.slideIn();
//	},
	init: function(){
		this.makeAccordions();
//		this.doSlider();
	}
};
window.onDomReady(guide.init.bind(guide));

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout1', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout2', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout3', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout4', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout5', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout6', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function(){
	mySlider = new Fx.Slide('workout7', {duration: 1000, mode : 'horizontal'}).hide();
	mySlider.slideIn();
});

window.addEvent('load', function() {
	var statuslinks = $$('p.day span');
	statuslinks.each(function(slink) {
		var dayid = slink.id;
		slink.addEvent('click', function(e) {
			e = new Event(e).stop();
			var url = "/days/index.php?dayid="+dayid;
			new Ajax(url, {
				method: 'get',
				update: slink
			}).request();
		});
	});
});