var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function goMenu(r_val){
	switch(r_val){
		case "01_01" : location.href = "http://www.yahoo.co.kr"; break;
		case "01_02" : location.href = "/html/company02.php?pgID=01&subID=02"; break;
		case "01_03" : location.href = "/html/company03.php?pgID=01&subID=03"; break;
		case "01_04" : location.href = "/html/company04.php?pgID=01&subID=04"; break;
		case "01_05" : location.href = "/html/company05.php?pgID=01&subID=05"; break;
		case "01_06" : location.href = "/html/company06.php?pgID=01&subID=06"; break;
		case "01_07" : location.href = "/html/company07.php?pgID=01&subID=07"; break;
		case "02_01" : location.href = "/html/biotech01.php?pgID=02&subID=01"; break;
		case "02_02" : location.href = "/html/biotech02.php?pgID=02&subID=02"; break;
		case "03_01" : location.href = "/html/business01.php?pgID=03&subID=01"; break;
		case "03_02" : location.href = "/html/business02.php?pgID=03&subID=02"; break;
		case "03_03" : location.href = "/html/business03.php?pgID=03&subID=03"; break;
		case "03_04" : location.href = "/html/business04.php?pgID=03&subID=04"; break;
		case "03_05" : location.href = "/html/business05.php?pgID=03&subID=05"; break;
		case "03_06" : location.href = "/html/business06.php?pgID=03&subID=06"; break;
		case "03_07" : location.href = "/html/business07.php?pgID=03&subID=07"; break;
		case "03_08" : location.href = "/html/business08.php?pgID=03&subID=08"; break;
		case "03_09" : location.href = "/html/business01_02.php?pgID=03&subID=09"; break;
		case "03_10" : location.href = "/html/business01_03.php?pgID=03&subID=10"; break;
		case "04_01" : location.href = "/html/public01.php?pgID=04&subID=01"; break;
		case "04_02" : location.href = "/html/public02.php?pgID=04&subID=02"; break;
		case "04_03" : location.href = "/html/public03.php?pgID=04&subID=03"; break;
		case "04_04" : location.href = "/html/public04.php?pgID=04&subID=04"; break;
		case "04_05" : location.href = "/board/board.php?pgID=04&subID=05&pgbcd=H101"; break;
		case "04_06" : location.href = "/board/board.php?pgID=04&subID=06&pgbcd=H102"; break;
		case "04_07" : location.href = "/board/board.php?pgID=04&subID=07&pgbcd=H103"; break;
		case "05_01" : location.href = "/board/board.php?pgID=05&subID=01&pgbcd=G101"; break;
		case "05_02" : location.href = "/board/board.php?pgID=05&subID=03&pgbcd=G103"; break;
		case "05_03" : location.href = "/board/board.php?pgID=05&subID=02&pgbcd=G102"; break;
		case "07_01" : location.href = "/html/sitemap.php?pgID=07&subID=01"; break;
		case "08_01" : location.href = "/member_join.php?pgID=08&subID=01"; break;
		
		default : location.href = "/"; break;
	}
}
//dropMenu ±¸¼º ½ÃÀÛ
function defaultMenu(id, isJunior, isRealName)
{
	if (dropMenu != null && typeof dropMenu != "undefined") {
		
		if (document.cookie.indexOf("HG_LOGIN=")>-1 && !isJunior && id.indexOf(entoi_id_prefix) == -1) {
			var html = preDiv + makeLayer(0,id,isRealName) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		} else {
			var html = preDiv + makeLayer(4,id) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		}
	}
}
function toiMenu(id, isJunior)
{
	if (dropMenu != null && typeof dropMenu != "undefined") {
		if (document.cookie.indexOf("HG_LOGIN=")>-1 && !isJunior && id.indexOf(entoi_id_prefix) == -1) {
			var html = preDiv + makeLayer(1,id) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		} else {
			var html = preDiv + makeLayer(4,id) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		}
	}
}
function chatMenu(id, isJunior, status)
{
	if (dropMenu != null && typeof dropMenu != "undefined") {
		if (document.cookie.indexOf("HG_LOGIN=")>-1 && !isJunior && id.indexOf(entoi_id_prefix) == -1) {
			isChatBlocked = status ;
			var html = preDiv + makeLayer(0,id) + makeLayer(2,id, status) + sufDiv ; 
			dropMenu.innerHTML = html ;
			setMenu(id);
		} else {
			var html = preDiv + makeLayer(4,id) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		}
	}
}
function CJMenu(id, isJunior, status)
{
	if (dropMenu != null && typeof dropMenu != "undefined") {
		if (document.cookie.indexOf("HG_LOGIN=")>-1 && !isJunior && id.indexOf(entoi_id_prefix) == -1) {
			isChatBlocked = status ;
			var html = preDiv + makeLayer(0,id) + makeLayer(3,id, status) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		} else {
			var html = preDiv + makeLayer(4,id) + sufDiv ; 
			dropMenu.innerHTML = html;
			setMenu(id);
		}
	}
}
//dropMenu ±¸¼º ³¡








// ÇÃ·ÎÆÃ ¹è³Ê interface
function initRightBanner()
{
	floatingBanner("RightBanner", 836, 148);
}
// wwwÇÃ·ÎÆÃ ¹è³Ê interface
function initMRightBanner()
{
	floatingBanner("RightBanner", 798, 296);
}


// start floating ¹è³Ê
function floatingBanner(objname, posX, posY)
{
	var obj = getRef(objname);
	obj.style.top = document.body.scrollTop + posY;
	obj.style.visibility = "visible";
	obj.style.setExpression("left", "calXBanner(" + posX + ")", "javascript");
	window.setInterval("calYBanner('" + objname +"', " + posY + ")", 10);
}

function calXBanner(posX)
{
	//var edge = (document.body.clientWidth - 790) / 2;
	//if( edge < 0 ) edge = 0;
	var edge = 20;
	return posX + edge;
}
function calYBanner(objname, posY)
{
	//alert(objName);
	var obj = getRef(objname);
	var yBannerPos, yScrollTopPos;
	var yLimitPos;
	var interval;
	var yNewPos;
	var yNewTop;
	var dHeight = posY;

	yScrollTopPos = parseInt(document.body.scrollTop, 10);
	yBannerPos = parseInt(obj.style.top, 10);
	if (document.body.scrollTop < dHeight) {
		yLimitPos = dHeight;
	}
	else {
		yLimitPos = document.body.scrollTop + 20;
	}

	if (yBannerPos != yLimitPos) {
		yNewPos = Math.ceil(Math.abs(yLimitPos - yBannerPos) / 20);

		if (yLimitPos < yBannerPos) {
			yNewPos = -yNewPos;
		}

		yNewTop = parseInt(obj.style.top, 10) + yNewPos;
		if (yNewTop > document.body.scrollHeight) {
			obj.style.top = document.body.scrollHeight;
		}
		else {
			obj.style.top = yNewTop;
		}
	  }
}
// end floating ¹è³Ê



// ºê¶ó¿ìÀú¿¡ µû¸¥ idÀÌ¸§À¸·Î id°´Ã¼ ºÎ¸£±â
function getRef(id)
{
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

//###################################################################################
// ¹®¼­¿¡ ÀÖ´Â ¿ÀºêÁ§Æ® °ªÀ» ³Ñ°Ü¹Þ½À´Ï´Ù.
// r_cd = °Ë»çÇÒ °ª
// r_fm = ÇÁ·¹ÀÓ °ª.
//###################################################################################
function get_object(r_cd,r_frame){
	var g_val;
	if(r_frame){
		g_val = r_frame.document.getElementById(""+r_cd);
	}else{
		g_val = document.getElementById(""+r_cd);
	}
	return g_val;
}