var bar_bool = false;
var body_bool = false;
var select_text = document.getElementById("select_text");
var text_tbl = document.getElementById("text_tbl");
var open_tbl = document.getElementById("open_tbl");
var bar = document.getElementById("open_bar");
var line_color = "#dddddd"; //선 색상
var roll_color = "#7fbb37"; //롤 오버 색상
var roll_font_color = "#ffffff"; //롤로버시 폰트 색상

function open_select() {
	if (bar_bool == false) {
		bar.style.display = "block";
		text_tbl.style.borderBottom = "0px";
		bar.style.borderTop = "0px";
		bar_bool = true;
		body_bool = true;
	} else {
		close_bar();
	}
}

function close_bar() {
	if (bar_bool == true) {
		bar.style.display = "none";
		text_tbl.style.borderBottom = "1px solid " + line_color;
		bar.style.borderTop = "1px solid " + line_color;
		bar_bool = false;
		body_bool = false;
	}
}

function select_menu (txt,num) {
	select_text.innerHTML = txt;
	close_bar();
}

bar.width = open_tbl.width;
tds = bar.getElementsByTagName("td");
for (i=0; i<tds.length; i++) {
	tds[i].width = open_tbl.width;
	tds[i].onmouseover = function() {
		this.style.cursor = "hand";
		this.style.cursor = "pointer";
		this.style.backgroundColor = roll_color;
		this.style.color = roll_font_color;
	}

	tds[i].onmouseout = function() {
		this.style.backgroundColor = "";
		this.style.color = "";
	}
}

document.body.onclick = function() {
	if (body_bool == false) {
		close_bar();
	} else {
		open_select();
	}
}
