// 탭 메뉴에 적용되는 자바스크립트 
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab"){
			thismenu = tabAnchor.item(i);
		} else {
			continue;
		}
		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onmouseover = thismenu.onclick = thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this) return false;
			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace("on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += "on";
			}
			this.container.current = this;
			return false;
		}

		if (!thismenu.container.first) thismenu.container.first = thismenu;
	}
	if (tabContainer.first) tabContainer.first.onclick();
}

// 문서를 읽고 나서 함수를 호출할 때 적용되는 자바스크립트
window.onload = function() {initTabMenu("tabArea");}






// 메인최신글, 포폴최신글 롤링

// banner_roll("div태그 id", 배너1개높이, 딜레이, 1칸이동속도, 0);
function banner_roll(div_id, banner_height, banner_delay, banner_speed, this_height)
{
var div_tag = document.getElementById(div_id);
var a_tag, i;

this_height ++;
if(this_height < banner_height) {
div_tag.style.top = -this_height;
setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", " + this_height + ");", banner_speed);
} else {
a_tag = div_tag.getElementsByTagName("A");
div_tag.appendChild(a_tag[0]);
div_tag.style.top = 0;
setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", 0);", banner_delay);
}

return true;
}
