function CMProjectCategory_Slider(id,itemwidth,itemcount){
	this.id = id;
	this.objid = 'CMProjectCategory_Slider_' + id;
	this.itemwidth = itemwidth;
	this.itemcount = itemcount;
	this.currentindex = 0;
	this.duration = 500;
	this.step = 20;
	this.slidesteps = [];
	this.slideindex = 0;
	this.slideinterval = null;
	this.window = document.getElementById('CMProjectCategory_'+id+'_window');
	this.belt = document.getElementById('CMProjectCategory_'+id+'_belt');
	this.position = this.belt.offsetLeft;
	this.leftbutton = document.getElementById('CMProjectCategory_'+id+'_leftbutton');
	this.rightbutton = document.getElementById('CMProjectCategory_'+id+'_rightbutton');
	this.leftbutton.style.display = 'none';
	if(this.itemcount <= 1) this.rightbutton.style.display = 'none';
	this.window.style.height = this.belt.offsetHeight+'px';
}
CMProjectCategory_Slider.prototype.stepleft = function(){
	var nextindex = this.currentindex - 1;
	this.slide(nextindex);
}
CMProjectCategory_Slider.prototype.stepright = function(){
	var nextindex = this.currentindex + 1;
	this.slide(nextindex);
}
CMProjectCategory_Slider.prototype.slide = function(nextindex){
	this.leftbutton.style.display = nextindex==0?'none':'';
	this.rightbutton.style.display = nextindex==this.itemcount-1?'none':'';
	var dir = nextindex-this.currentindex;
	this.slidesteps = [];
	for(var i=0;i<Math.floor(this.duration / this.step);i++){
		var time = (this.step * i) / this.duration;
		var ratio = (2*time) - ((Math.pow(time,2)));
		var left = (this.currentindex*this.itemwidth) + (dir*Math.round(this.itemwidth * ratio));
		this.slidesteps.push(left);
	}
	this.slideindex = 0;
	this.slideinterval = setInterval(this.objid+'.slidestep();',this.step);
	this.currentindex = nextindex;
}
CMProjectCategory_Slider.prototype.slidestep = function(){
	if(this.slideindex >= this.slidesteps.length){
		clearInterval(this.slideinterval);
		this.slideinterval = null;
		this.belt.style.left = -(this.currentindex*this.itemwidth)+'px';
	}else{
		this.belt.style.left = -this.slidesteps[this.slideindex] + 'px';
		this.slideindex++;
	}
}
