
	var CShader = function () {
		createMethodReference(this, CElement)();
		this.tabs = null;
		this.activeTab = null;
		this.activeOffset = null;
		this.movOffset = 0;
		this.shadeSpeed = 19;
	};
	CShader.prototype = clone(CElement.prototype);
	
	CShader.prototype.move = function (offset) {
		if (this.tabs == null) {
			this.tabs = [];
			for (var c = 0; c < this.element.childNodes.length; c ++) {
				if (is_subclass_of(this.element.childNodes[c], 'shader-tab')) {
					var e = new CElement;
					e.setElement(this.element.childNodes[c]);
					
					this.tabs.push(e);
					if (e.style.display == '' || this.activeTab == null) {
						this.activeTab = e;
						this.activeOffset = this.tabs.length-1;
					}
					
					e.attachEvent('shadeoff-end', createMethodReference(this, this.shadeoffEnd));
				}
			}
		}
		
		this.activeTab.shadeoff(this.shadeSpeed, true);
		this.movOffset = offset;
	};
	
	CShader.prototype.shadeoffEnd = function () {
		if (this.movOffset != 0) {
			var i = this.activeOffset + this.movOffset;
			if (i < 0) 
				i = this.tabs.length - 1;
			if (i > this.tabs.length - 1)
				i = 0;
			
			this.activeOffset = i;
			this.activeTab = this.tabs[i];
			
			for (var k = 0; k < this.tabs.length; k ++) {
				this.tabs[k].style.display = 'none';
			}
			
			this.activeTab.style.display = '';
			this.activeTab.shadeoff(-this.shadeSpeed);
			this.movOffset = 0;
		}
	};

