var TabSelector = new (function () {
	var HIDDEN_DISPLAY  = "none";
	var HIDDEN_POSITION = "absolute";
	var SHOW_DISPLAY    = "block";
	var SHOW_POSITION   = "static";
	var ENABLE_CLASS    = "tab_enable";
	var DISABLE_CLASS   = "tab_disable";

	this.now_head = null;
	this.now_body_style = null;
	this.check = function (id) {
		var head_elem, body_elem, body_style;

		/* For Opera for WILLCOM Air Edge Phone */
		if(navigator.userAgent.match(/^.*WILLCOM.*Opera.*$/))
			return false;

		if(typeof(document.getElementById) == "undefined")
			return false;
		head_elem = document.getElementById("head_" + id);
		body_elem = document.getElementById(id);
		if(typeof(head_elem) == "undefined")
			return false;
		if(typeof(body_elem) == "undefined")
			return false;
		if(typeof(body_elem.style) == "undefined")
			return false;
		body_style = body_elem.style;
		if(typeof(body_style.display) == "undefined")
			return false;
		if(typeof(body_style.position) == "undefined")
			return false;
		if(typeof(head_elem.className) == "undefined")
			return false;

		return true;
	};
	this.select = function (id) {
		var head, body_style;

		if(!this.check(id))
			return true;

		if(this.now_body_style && this.now_head) {
			this.now_body_style.display  = HIDDEN_DISPLAY;
			this.now_body_style.position = HIDDEN_POSITION;
			this.now_head.className      = DISABLE_CLASS;
		}
		body_style = document.getElementById(id).style;
		head = document.getElementById("head_"+id);

		body_style.display  = SHOW_DISPLAY;
		body_style.position = SHOW_POSITION;
		head.className      = ENABLE_CLASS;

		this.now_body_style = body_style;
		this.now_head = head;

		return false;
	};
});
