
function AtiraClassToggler(classStandard,classHover,classSelected,itemIds) {
	this.classStandard = classStandard;
	this.classHover = classHover;
	this.classSelected = classSelected;
	this.itemIds = itemIds;
	this.attachEvents();
}

AtiraClassToggler.prototype.attachEvents = function() {
	var item;
	for (var i=0;i<this.itemIds.length;i++) {
		if (item = document.getElementById(this.itemIds[i])) {
			item.atiraClassToggler = this;
			if (item.className!=this.classSelected) {
				item.onmouseover = function() {this.atiraClassToggler.mouseDidEnter(this)};
				item.onmouseout = function() {this.atiraClassToggler.mouseDidLeave(this)};
			} 
		}
	}
}

AtiraClassToggler.prototype.mouseDidEnter = function(lmnt) {
	lmnt.className = this.classHover;
}

AtiraClassToggler.prototype.mouseDidLeave = function(lmnt) {
	lmnt.className = this.classStandard;
}

AtiraClassToggler.prototype.mouseDidLeaveSelected = function(lmnt) {
	lmnt.className = this.classSelected;
}

AtiraClassToggler.prototype.setSelected = function(id) {
	var item;
	for (var i=0;i<this.itemIds.length;i++) {
		if (item = document.getElementById(this.itemIds[i])) {
			if (this.itemIds[i] == 'tab_'+id) {
				item.onmouseout = function() {this.atiraClassToggler.mouseDidLeaveSelected(this)};
				item.className = this.classSelected; 
			} else {
				item.onmouseout = function() {this.atiraClassToggler.mouseDidLeave(this)};
				item.className = this.classStandard;
			}
		}
	}
}