var g = new function(){
	this._load = false;
	this.init = function(){
		this._load = true;
	}
	this.isLoad = function(){ return this._load; }
}
var slists = new function(){
	this._list = null;
	this.init = function(){
		this._list = new Array;
		var el = document.getElementsByClassName("nkbList");
		el.each(function(e){
			if(e.id.match(/nkb_(.+)/)) slists._list.push(RegExp.$1);
		});
	}
	this.show = function(id){
		if(!this._list) this.init();
		if(id == "ALL") this._showAll();
		else this._show(id);
	}
	this._showAll = function(){
		this._list.each(function(id){
			$("nka_" + id).className = "";
			$("nkb_" + id).style.display = "block";
		});
		$("nka_ALL").className = "act";
	}
	this._show = function(id){
		this._list.each(function(id2){
			if(id2 != id){
				$("nka_" + id2).className = "";
				$("nkb_" + id2).style.display = "none";
			}
		});
		$("nka_ALL").className = "";
		$("nka_" + id).className = "act";
		$("nkb_" + id).style.display = "block";
	}
}
var btypes = new function(){
	this._sels = null;
	this.init = function(){
		this._sels = new Object;
	}
	this.show = function(id){
		if(!this._sels) this.init();
		var aid = "bta_" + id;
		var flg = false;
		if(!this._sels[aid]){
			this._sels[aid] = true;
			$(aid).className = "act";
			flg = true;
		}
		else {
			this._sels[aid] = false;
			$(aid).className = "";
		}
		var el = document.getElementsByClassName("btp" + id);
		el.each(function(e){ btypes._actClass(e, flg); });
	}
	this._actClass = function(elm, flg){
		if(flg) elm.className += " act";
		else elm.className = elm.className.replace(/ act/, "");
	}
}
var curmdls = new function(){
	this._mode = false;
	this.upd = function(){
		if(!this._mode){
			this._mode = true;
			var el = document.getElementsByClassName("oldmdl");
			el.each(function(e){ e.style.display = "none"; });
			$("nka_MDL").className = "act";
		}
		else {
			this._mode = false;
			var el = document.getElementsByClassName("oldmdl");
			el.each(function(e){ e.style.display = "block"; });
			$("nka_MDL").className = "";
		}
	}
}

window.onload = function(){
	g.init();
	slists.show("ALL");
}
function onNkey(id){
	if(!g.isLoad()) return false;
	slists.show(id);
	return false;
}
function onBt(id){
	if(!g.isLoad()) return false;
	btypes.show(id);
	return false;
}
function onCur(){
	if(!g.isLoad()) return false;
	curmdls.upd();
	return false;
}

