/*
		Usage:
		new SimpleSlideShow(wrapperElement, arrayOfImagesSources [, options]);
		
		Options:
		fadeTime: time in ms for the fade between images
		stayTime: time between two fades
		
		License:
		MIT-Style-License
		Copyright: Jan Kassens <janATkassens.net>
		*/
		
		var SimpleSlideShow = new Class({
			
			Implements: Options,
			
			options: {
				fadeTime: 1000,
				stayTime: 3000
			},
			
			initialize: function(wrapper, images, options) {
				var params = Array.link(arguments, {wrapper: $defined, images: Array.type, options: Object.type});
				this.wrapper = $(params.wrapper);
				this.setOptions(params.options);
				
				this.images = (params.images || JSON.decode(this.wrapper.get('images'))).map(function(image){
					return new Element('img', {
						src: image, width: '100%', height: '100%',
						tween: {duration: this.options.fadeTime}
					});
				}, this);
				this.index = 0;
				this.topImage = this.images[0].inject(this.wrapper);
				this.fade.delay(this.options.stayTime, this);
			},
			
			fade: function() {
				this.index = (this.index + 1) % this.images.length;
				this.bottomImage = this.topImage;
				this.topImage = this.images[this.index]
					.fade('hide')
					.inject(this.wrapper)
					.fade('in');
				this.fade.delay(this.options.stayTime + this.options.fadeTime, this);
			}
			
		});
		
window.addEvent('domready', function() {

	var header_data = ['themes/images/header/header1.jpg',
		'themes/images/header/header02.jpg',
		'themes/images/header/header03.jpg',
		'themes/images/header/header05.jpg',
		'themes/images/header/header04.jpg'];
	$$('.slideheader').each(function(slideshow){
		new SimpleSlideShow(slideshow, header_data );
	});
	
	new Tips($$('.infobulle'));
	var initMultiBox = new multiBox({
		mbClass: '.popin',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		descClassName: '.popin-desc',
		container: $(document.body),
		useOverlay: true,
		maxSize: {w:600, h:400},
		addRollover: false,
		addOverlayIcon: false,
		addChain: false,
		recalcTop: true,
		addTips: false
	});

});
