Event.observe(window, 'load', function() {
	setup_slides()
})

/*
	SLIDES
*/
var setup_slides = function() {
	// load our controls
	els = $$('.slides .controls a')
	// if there are any controls found
	if(els.length > 0) {
		// loop through each control
		for(var i = 0; i < els.length; i++) {
			// current link
			var el = els[i]
			// setup our click tracking
			Event.observe(el, 'click', function(event) {
				Event.stop(event)
				change_slide(event.element())
				event.element().blur()
			})
		}
	}
}

var change_slide = function(link) {
	// setup our regex to pick the number
	regex = /([0-9]+)/
	// load which slide
	var slide = regex.exec(link.href)
	// if we found a match
	if(slide) {
		// calculate new offset
		offset = 0 - ((parseInt(slide) - 1) * 700)
		// move the container
		new Effect.Move(link.up('.slides').down('.container'), { x: offset, y: 0, mode: 'absolute', duration: 0.5, transition: Effect.Transitions.sinoidal });
	}
}