/* RTI Home.js */

var rti;
if(!rti) rti = {};

/*
var RTIHomeButtons = new Class({
	initialize: function(options) {
		this.el = options.el;
		this.field = options.field;
		this.loadingDiv = options.loaderEl;
		this.progress = new Element('div').setProperty('id', 'progress');
		this.fade = new Fx.Style(this.field, 'opacity', {duration: 300});
		this.el.addEvent('click', function(evt) {
			(new Event(evt)).stop();
			this.ajax(evt);
		}.bindWithEvent(this));
	},
	ajax: function(evt) {
		
		this.progress.injectInside(this.loadingDiv);
		
		this.fade.chain(function() {
			var myAjax = new Ajax(
				'/home_info.php?p=' + evt.target.id, {
				method: 'get',
				update: this.field,
				onComplete: this.finish.bind(this)
			}).request();
		}.bind(this)).start(1,0);
		
	},
	finish: function() {
		this.fade.start(0,1);
		this.progress.remove();
	}
});
*/
var navSlideShow;
document.addEvent('domready', function(){

	// cache the navigation elements
	var navs = $('navigation-slideshow').getElements('a');

	// create a basic slideshow
	navSlideShow = new SlideShow('navigation-slideshow', {
		autoplay: true,
		delay: 7000,
		transition: 'pushLeft',
		selector: 'div', // only create slides out of the images
		onShow: function(data){
			// update navigation elements' class depending upon the current slide
			navs[data.previous.index].removeClass('current');
			navs[data.next.index].addClass('current');
		}
	});

	navs.each(function(item, index){
		// click a nav item ...
		item.addEvent('click', function(event){
			event.stop();
			navSlideShow.pause();
			// pushLeft or pushRight, depending upon where
			// the slideshow already is, and where it's going
			var transition = (navSlideShow.index < index) ? 'pushLeft' : 'pushRight';
			// call show method, index of the navigation element matches the slide index
			// on-the-fly transition option
			navSlideShow.show(index, {transition: transition});
		});
	});

	// tips, for pretty
	new Tips(navs, {
		fixed: true,
		text: '',
		offset: {
			x: -100,
			y: 20
		}
	});
	

});
