window.addEvent('domready', function() {
//			var elSwap = new ElementSwap('.div_swap',{
//				activateOnLoad: 'el3',
//				autoPlay: true
//			});
			//elSwap.start('el3');
			
			
//			var el = $('el1');
//			el.className = "elactive";
//			alert(el.style.zIndex);
//			el.fade(0);
//			el.style.zIndex = 1001;
//			$('el1').style.zIndex = 1003;

	// Slideshow settings
	var showDuration = 7000; 
	var supercontainer = $('intro-banners'); 
	var container = $('intro-banners-items'); 
	var images = container.getElements('div'); 
	var selectors = $$('.intro-button');
	var currentIndex = 0; 
	var interval; 
	
	// Shut down all images except first
	images.each(function(img,i){ 
		if(i > 0) {
			img.set('opacity',0); 
		} 
	}); 
	
	// Show next slide
	var show = function() { 
		selectors[currentIndex].className = "intro-button intro-selector-item";
		images[currentIndex].fade('out'); 
		images[currentIndex = currentIndex < images.length - 1 ? currentIndex+1 : 0].fade('in');
		selectors[currentIndex].className = "intro-button intro-selector-item-active";
	}; 
	
	// Program buttons
	selectors.each(function(button,i){ 		
		button.addEvent('click', function(){
			newIndex = this.id.substring(this.id.length - 1,this.id.length) - 1;
			if(newIndex != currentIndex){
				selectors[currentIndex].className = "intro-button intro-selector-item";
				images[currentIndex].fade('out'); 
				images[currentIndex = newIndex].fade('in');
				selectors[currentIndex].className = "intro-button intro-selector-item-active";
			}
		});
	}); 	
	
	// Stop on mouseenter
	supercontainer.addEvent('mouseenter', function(){
		interval = $clear(interval);
	});
	
	// Continue slideshow on mouseleave
	supercontainer.addEvent('mouseleave', function(){
		interval = show.periodical(showDuration); 
	});
	
	// Start once the page is finished loading
	window.addEvent('load',function(){
		interval = show.periodical(showDuration); 		
	});
	
});
