function bncTabs(page) {
	this.bncHoverOn = function() {
		this.className = 'bnctab bnctabHover';
	}
	this.bncHoverOff = function(){
		this.className = 'bnctab';
	}
	this.page = page;
	this.tabids = new Array();
}

bncTabs.prototype.initTabs = function() {
	var tmp=getCookie(this.page+'.bncTab');
	if(tmp=='') {
		tmp = 0;
	}
	if(tmp>=this.tabids.length) {
		tmp = this.tabids.length-1;
	}
	this.toggleTab(this.tabids[tmp]);
	return this.tabids[tmp];
}

bncTabs.prototype.addTabId = function(id) {
	this.tabids.push(id);
}

bncTabs.prototype.toggleTab = function(id){
	var idx=0;
	for (f=0;f<this.tabids.length;f++){
		if(id==this.tabids[f]) {
			idx = f;
		}
		var cobj = document.getElementById('tabcontent'+this.tabids[f]);
		if(cobj!=null) {
			cobj.style.display='none';
		}
		var tobj = document.getElementById('tab'+this.tabids[f]);
		if(tobj!=null) {
			tobj.className = 'bnctab';
			tobj.onmouseover = this.bncHoverOn;
			tobj.onmouseout = this.bncHoverOff;
		}
	}
	document.getElementById('tabcontent'+id).style.display='block';
	document.getElementById('tab'+id).className = 'bnctabActive';
	document.getElementById('tab'+id).onmouseover = '';
	document.getElementById('tab'+id).onmouseout = '';

	setCookie(this.page+'.bncTab',idx);
}
