window.addEvent('load', function() {
	if($$('body').get('id') == "index") {
		new Slideshow({slideDuration:5000, slideTransitionDuration:1000, hasButtons:true});
		new Slider({theSlider:$('slider_sectors'), itemsShown:4});
		new Slider({theSlider:$('slider_sections'), itemsShown:4});

		/* Slideshow tabs */
		var theTabs = $$('#slider_tabs li');
		theTabs.each(function(elem, index) {
			elem.getElement('a').addEvent('click', function(evt) {
				evt.stop();

				theTabs.removeClass('current');
				$$('.slider').removeClass('current');

				elem.addClass('current');
				$$('.slider')[index].addClass('current');
			});
		});

		/* Custom bevaviour for slider images */
		$$('.slider li').addEvents({
			'mouseenter': function() {
				this.getElements('img')[1].fade('out');
			},
			'mouseleave': function() {
				this.getElements('img')[1].fade('in');
			}
		});
	}
});

window.addEvent('domready', function() {
	$(document.body).removeClass('js-disabled');

	/* Navigation */
	$$('#mainnav_sleeve>ul>li').addEvents({
		'mouseenter':function() {
			this.addClass('over');
		},
		'mouseleave':function() {
			this.removeClass('over');
		}
	});

	$$('#mainnav_sleeve>ul>li>a').addEvent('focus', function() {
		$$('#mainnav_sleeve>ul>li.over').removeClass('over');
		this.getParent().addClass('over');
	});

	$$('#mainnav_sleeve>ul>li div li:last-child a').addEvent('focus', function() {
		this.getParents('li')[1].addClass('over');
	});
});
