// MooTools Slide Effects
// (c) 2007 Kennon Software Corporation

var slides = new Array(12);
var slidesBG = false;

function slidesBGToggle() {
	var x;

	if (slidesBG) {
		slidesBG = false;
		x = new Fx.Style('slide_bg', 'opacity').start(0,1).chain(function() { $E('div.quote').setStyle('display','block'); });
	} else {
		slidesBG = true;
		x = $E('div.quote').setStyle('display','none');
		x = new Fx.Style('slide_bg', 'opacity').start(1,0);
	}
}

function slidesHideAll(complete) {
	if (complete) {
		if (slidesBG) { slidesBGToggle(); }
	} else {
		if (!slidesBG) { slidesBGToggle(); }
	}

	for (var i=0; i < 12; i++) {
		if (!window.ie6) { document.getElementById('slideshow_' + String(i+1)).style.overflow = 'visible'; }
		slides[i].hide();
	}
}

// Auto Create
window.addEvent('domready', function(){
	var slidesBtn;

	for (var i=0; i < 12; i++) {
		slides[i] = new Fx.Slide('slideshow_' + String(i+1));
		slides[i].hide();

		slidesBtn = $('slideshow_b' + String(i+1));
		// Make exception for overrides, else process as normal
		if (i != 2) {
			eval("slidesBtn.addEvent('click', function(e) {	e = new Event(e); slidesHideAll(); slides[" + i + "].slideIn(); if (!window.ie6) { window.setTimeout('document.getElementById(\"slideshow_" + String(i+1) + "\").style.overflow = \"auto\";', 600); } e.stop(); });");
		}
	}
});


// MooTools Random Quotes
// (c) 2007 Kennon Software Corporation

/*
	(via dynamic generated include file) 
	var quotes = new Array('Quote 1','Quote 2','Quote 3','Quote 4');
	var quoteCount = 3;
*/
	var quoteIndex = $random(0,quoteCount);

var quote;

window.addEvent('domready', function(){
	quote = $E('div.quote');
	quote.className = 'quote pos' + String($random(1,4));
	quote.setHTML(quotes[$random(0,quoteCount)]);

	(function() {
		new Fx.Style(quote, 'opacity').start(1,0).chain(function() {
			quote.className = 'quote pos' + String($random(1,4));
			quote.setHTML(quotes[quoteIndex]);
			new Fx.Style(quote, 'opacity').start(0,1);
			quoteIndex += 1;
			if (quoteIndex > quoteCount) { quoteIndex = 0; }
		});
	}).periodical(10000);
});
