function Tabber() {
this.df = {active: 0,interval: null,tabclass: 't'};


	
/* for (var n in arguments[0]) { this.df[n]=arguments[0][n]; }; */
this.getTabs = function() {
        var retnode = [];
        var elem = document.getElementById('main').getElementsByTagName('*');
		var regexp = new RegExp("(^|\\s)" + this.df.tabclass.replace(/\-/g, "\\-") + "(\\s|$)");
        for (var i = 0; i < elem.length; i++) {
			if (regexp.test(elem[i].className)) retnode.push(elem[i]);
        }
        return retnode;
    };

	this.links = [];
	this.lLinks = document.getElementById('leftMenu').getElementsByTagName('a');
	this.rLinks = document.getElementById('rightMenu').getElementsByTagName('a');
    for (var i = 0; i < this.lLinks.length; i++) { this.links.push(this.lLinks[i]); }
	for (var i = 0; i < this.rLinks.length; i++) { this.links.push(this.rLinks[i]); }

	this.show = function(number) {
		this.tabs[0].style.display = (number>0)? 'none': 'block';

        for (var i = 0; i < this.tabs.length-1; i++) {
			this.tabs[i+1].style.display = ((i+1)==number) ? 'block' : 'none';

			if ((i+1)==number)
				this.addClass(this.links[i], 'active');
			else if (this.links[i])
				this.removeClass(this.links[i], 'active');
		}

		this.df.active = number;
    };

	this.rotate = function(interval) {
	    this.show(this.df.active);
        this.df.active++;
 		if (this.df.active >= this.tabs.length) this.df.active = 1;

        var self = this;
        this.timer1 = setTimeout(function(){self.rotate(interval);}, interval*1000);
    };

/*	this.next = function() {
		this.df.active++;
    	if(this.df.active >= this.tabs.length) this.df.active = 1;
		this.show(this.df.active);

	};

	this.previous = function() {
		this.df.active--;
    	if(!this.df.active) this.df.active = this.tabs.length;
		this.show(this.df.active);

	};*/
	this.contains = function(el, item, from) {
		return el.indexOf(item, from) != -1;
	};

	this.hasClass = function(el, className){
		return this.contains(el.className, className, ' ');
	};

	this.addClass = function(el, className){
		if (!this.hasClass(el, className)) el.className = (el.className + ' ' + className).replace(/\s{2,}/g, ' ').replace(/^\s+|\s+$/g, '');
	};

	this.removeClass = function(el, className){
		el.className = el.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
		el.className.replace(/\s{2,}/g, ' ').replace(/^\s+|\s+$/g, '');
	};


	this.tabs = this.getTabs();
	this.show(this.df.active);

	var self = this;
	for (var i = 0; i < this.links.length; i++) {
	this.links[i].customindex = i+1;
	this.links[i].onmouseover= function(){
		if (self.timer1) clearTimeout(self.timer1);
		self.show(this.customindex);
	    if (self.df.interval) self.timer1 = setTimeout(function(){self.rotate(self.df.interval);}, self.df.interval*1000);
		return false;
	};
	this.links[i].onclick = function(){
		if (self.timer1) clearTimeout(self.timer1);
		self.show(this.customindex);
		self.df.interval = 0;
		return false;
	  };
    }

	if (this.df.interval) this.rotate(this.df.interval);
};
