/*
 ÀÛ¼ºÀÚ : ¾×ÅäÁî¼ÒÇÁÆ® À¥°³¹ßÆÀ ·ùÀÎ»ó
 ÃÖÃÊÀÛ¼º : 2010³â 01¿ù 26ÀÏ
 ¸¶Áö¸· ¾÷µ¥ÀÌÆ® : 2010³â 01¿ù 26ÀÏ
*/

// ÃÖ±Ù°Ô½Ã¹°
function toggleList(id, tit_tag) {
	var wrapper = document.getElementById(id),
		titles = wrapper.getElementsByTagName(tit_tag),
		tit_anchors = [];
	init();
	binder();
	function init() {
		var len = titles.length,
			title,
			anchor,
			cont_id,
			i = 0;
		for (; i < len; i++) {
			title = titles[i];
			anchor = title.getElementsByTagName('a')[0];
			tit_anchors.push(anchor);
			cont_id = anchor.getAttribute('href', 2).split('#')[1];
			anchor.content = document.getElementById(cont_id);
		}
	}
	function binder() {
		var t_len = titles.length,
			ta_len = tit_anchors.length,
			anchor,
			i = 0;
		for (; i < ta_len; i++) {
			anchor = tit_anchors[i];
			anchor.onfocus = anchor.onclick = anchor.onmouseover = function () {
				hideAll();
				this.childNodes[0].src = this.childNodes[0].src.replace('_off.gif', '_on.gif');
				this.content.className = 'listWrap';
				return false;
			};
		}
	}
	function hideAll() {
		var len = tit_anchors.length,
			title,
			anchor,
			i = 0;
		for (; i < len; i++) {
			anchor = tit_anchors[i];
			title = anchor.parentNode;
			tabimg = anchor.childNodes[0];
			tabimg.src = tabimg.src.replace('_on.gif', '_off.gif');
			anchor.content.className = 'alt';
		}
	}
}
