window.addEvent('domready', function() {
	// You can skip the following two lines of code. We need them to make sure demos
	// are runnable on MooTools demos web page.
	if (!window.demo_path) window.demo_path = '';
	var demo_path = window.demo_path;
	// --
	$('meteoForm').addEvent('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//Empty the log and show the spinning indicator.
		var log = $('log_res').empty().addClass('ajax-loading');
		//Set the options of the form's Request handler. 
		//("this" refers to the $('myForm') element).
		this.set('send', {onComplete: function(response) { 
			log.removeClass('ajax-loading');
			log.set('html', response);
		}});
		//Send the form.
		this.send();
	});
	
	//create our Accordion instance
	var timer;
	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
		opacity: false,
		alwaysHide: true,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#41464D');
			$clear(timer);
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#528CE0');
		},
		onComplete: function(){
	        timer = this.display.delay(7000, this, (this.previous + 1) % this.togglers.length);
	    }
	});
});
