function carrousel(carr, items, images){
	var _this    = this;
	_this.carrousel = carr;
	_this.items  = items  || new Array(); // array met div id's
	_this.images = images || new Array(); // array met backgroundimages
	
	var init = function(){
		for(var i=0;i<_this.items.length;i++){
			if(hasClass(_this.items[i],"caritem-visible")) _this.activeIndex = i;
		}
		_this.start();
		_this.reSifr();
	};
	
	_this.getSwapSecs = function(div){
		var cl = div.className.split(" ");
		for(var i=0;i<cl.length;i++){
			var c = cl[i].split("secs_");
			if(c.length==2){
				return c[1];
			}
		}
		return 0;
	}
	
	_this.start = function(){
		swap = function() {
			clearTimeout(x);
			// if(evdebug) alert(_this.carrousel.id + "in");
			swapClass(_this.items[_this.activeIndex],"caritem-visible","caritem-hidden");
			_this.activeIndex = (_this.activeIndex+1>=_this.items.length) ? 0 : _this.activeIndex+1;
			swapClass(_this.items[_this.activeIndex],"caritem-hidden","caritem-visible");
			var myImage = "url('" + _this.images[_this.activeIndex] + "')";
			_this.carrousel.style.backgroundImage = myImage;
			_this.reSifr();
			s = _this.getSwapSecs(_this.items[_this.activeIndex]);
			x = setTimeout("swap()", parseInt(s)*1000);
		}
		var s = _this.getSwapSecs(_this.items[_this.activeIndex]);
		var x = setTimeout("swap()", parseInt(s)*1000);
	}
	
	_this.reSifr = function(){
		sIFR.replace(helvetica, {
			  selector: ".feat-foto .carrousel h2"
			, css: '.sIFR-root { text-transform: uppercase; font-size: 18px; color: #FFFFFF; }'
			, transparent : true
			, offsetTop : 2
		});
	}
	
	addEvent(window,"load", init);	
}



