//À¥ÁøÀ» Á¦¿ÜÇÑ ÆäÀÌÁöµéÀÇ ¸Þ´º ÄÁÆ®·Ñ(À¥Áø urlÀ» Àý´ë·Î ÀâÀ½)

preURL = "/img/";

var viewSubTime;
var subM0 = -1;
var subM1 = -1;
isFirst = true
initChk = 0
var initChkTime
var menuCode;
submenuHTML = new Array()
submenuImage = new Array()
layerHTML = "";
subHeight = new Array()
menuDepthImage = new Array()


menuDepth0 = new Array
(
	"kpa",6,
	"infozone",8,
	"statistics",6,
	"cyberpr",4,
	"participation",5
);

menuDepth1 = new Array();
menuDepth1[0] = new Array(0,0,0,0,0,0)
menuDepth1[1] = new Array(0,6,0,0,0,3,0,0)
menuDepth1[2] = new Array(0,0,0,0,0,0)
menuDepth1[3] = new Array(0,0,0,0)
menuDepth1[4] = new Array(0,0,0,0,0,0)

linkURL0 = new Array()
linkURL1 = new Array()
for(i=0;i<menuDepth1.length;i++)
{
	linkURL0[i] = new Array()
	linkURL1[i] = new Array()
	for(j=0;j<menuDepth1[i].length;j++)
		linkURL1[i][j] = new Array()
}

//////////////// MAIN URL //////////////////

linkURL0[0][0] = "/kpa/ceo.jsp"
linkURL0[0][1] = "/kpa/overview.jsp"
linkURL0[0][2] = "/kpa/history.jsp"
linkURL0[0][3] = "/kpa/organization.jsp"
linkURL0[0][4] = "/kpa/member_sk1.jsp"
linkURL0[0][5] = "/kpa/contact.jsp"


linkURL0[1][0] = "/infozone/cartoon/overview.jsp"
linkURL0[1][1] = "/infozone/knowledge/knowledge.jsp?menu=1&section=1&htnum=1&imgnum=1"
linkURL0[1][2] = "/infozone/law/law.jsp"
linkURL0[1][3] = "/infozone/notice/notice.jsp"
//linkURL0[1][4] = "/infozone/diary/diary.jsp"
linkURL0[1][4] = "/infozone/namelist/namelist.jsp"
linkURL0[1][5] = "/infozone/digest/digest.jsp"
linkURL0[1][6] = "/infozone/publication/publication.jsp"
linkURL0[1][7] = "/infozone/animation.jsp"

linkURL0[2][0] = "/statistics/price/price_list.jsp"
linkURL0[2][1] = "/statistics/month/month_list.jsp"
linkURL0[2][2] = "/statistics/logistic/logistic_list.jsp"
//linkURL0[2][3] = "/statistics/develop/develop_list.jsp"
linkURL0[2][3] = "/statistics/foreign/foreign_list.jsp"
//linkURL0[2][4] = "/statistics/domestic/general/general_list.jsp"
//linkURL0[2][4] = "/statistics/foreign/foreign_list.jsp"
linkURL0[2][4] = "/statistics/develop/develop_list.jsp"
linkURL0[2][5] = "/statistics/exclusive/total/total.jsp"
/*
linkURL0[3][0] = "/cyberpr/oilnews/oilnews.jsp"
linkURL0[3][1] = "/cyberpr/kpanews/kpanews.jsp"
linkURL0[3][2] = "/cyberpr/member_news/member_news.jsp"
linkURL0[3][3] = "/cyberpr/briefing/briefing.jsp"
linkURL0[3][4] = "/cyberpr/policy/policy.jsp"
*/
//linkURL0[3][0] = "/cyberpr/oilnews/oilnews.jsp"
linkURL0[3][0] = "/cyberpr/kpanews/kpanews.jsp"
linkURL0[3][1] = "/cyberpr/member_news/member_news.jsp"
linkURL0[3][2] = "/cyberpr/briefing/briefing.jsp"
linkURL0[3][3] = "/cyberpr/policy/policy.jsp"

linkURL0[4][0] = "/participation/common_sense/common_sense.jsp"
linkURL0[4][1] = "/participation/qna/qna.jsp"
//linkURL0[4][2] = "/participation/freeboard/freeboard.jsp"
linkURL0[4][2] = "/participation/poll/poll.jsp"
linkURL0[4][3] = "/participation/link/link.jsp"
linkURL0[4][4] = "/participation/member/agreement.jsp"

//////////////// SUB_0 URL //////////////////

linkURL1[0][4][0] = "/kpa/member_sk1.jsp"
linkURL1[0][4][1] = "/kpa/pre_member.jsp"

//////////////// SUB_1 URL //////////////////

linkURL1[1][1][0] = "/infozone/knowledge/knowledge.jsp?menu=1&section=1&htnum=1&imgnum=1"
linkURL1[1][1][1] = "/infozone/knowledge/knowledge.jsp?menu=2&section=9&htnum=9&imgnum=2"
linkURL1[1][1][2] = "/infozone/knowledge/knowledge.jsp?menu=3&section=12&htnum=12&imgnum=3"
linkURL1[1][1][3] = "/infozone/knowledge/knowledge.jsp?menu=4&section=15&htnum=15&imgnum=4"
linkURL1[1][1][4] = "/infozone/knowledge/knowledge.jsp?menu=5&section=18&htnum=18&imgnum=5"
linkURL1[1][1][5] = "/infozone/knowledge/knowledge.jsp?menu=6&section=23&htnum=23&imgnum=6"
//linkURL1[1][1][6] = "/infozone/knowledge/knowledge.jsp?menu=7&section=26&htnum=27&imgnum=7"

linkURL1[1][5][0] = "/infozone/digest/digest.jsp"
//linkURL1[1][6][1] = "/infozone/magazine/magazine.jsp"
linkURL1[1][5][1] = "http://sabo.oil.or.kr"
//linkURL1[1][6][2] = "/infozone/annual/index.html"
//linkURL1[1][6][2] = "/infozone/annual/statistics/price_list.jsp"
linkURL1[1][5][2] = "/infozone/annual/situation/topsituation.jsp?menu=1&section=1"

//////////////// SUB_2 URL //////////////////
/*

linkURL1[2][4][0] = "/statistics/domestic/general/general_list.jsp"
linkURL1[2][4][1] = "/statistics/domestic/crude/crude_list.jsp"
linkURL1[2][4][2] = "/statistics/domestic/produce/produce_list.jsp"
linkURL1[2][4][3] = "/statistics/domestic/consume/consume_list.jsp"
linkURL1[2][4][4] = "/statistics/domestic/import/import_list.jsp"
linkURL1[2][4][5] = "/statistics/domestic/export/export_list.jsp"
*/

//linkURL1[2][6][0] = "/statistics/exclusive/total/total.jsp"
//linkURL1[2][6][1] = "/statistics/exclusive/company/company_list.jsp"
//linkURL1[2][6][2] = "/statistics/exclusive/foreign/foreign_list.jsp"
//linkURL1[2][6][3] = "/statistics/research/list.jsp"


//////////////// SUB_3 URL //////////////////



//////////////// SUB_4 URL //////////////////

                       
                       
for(i=0;i<menuDepth0.length/2;i++)
{                      
	if(categoryCode == menuDepth0[i*2])
		menuCode = i   
}                      
                       
categoryCodeN = menuDepth1[menuCode].length
subMaxheight = 0
subboxheight = categoryCodeN * 21

function chgimg(mode,k)
{
		subLayer = eval("dynamenu" + k)
		subM0 = k
		objimg = "smi" + k  ;
		document.all[objimg].src= menuDepthImage[categoryCodeN+k].src ;
		if(mode == 0)
			viewSubTime = setTimeout("viewSubmenu()",200)
		if(isFirst)
		{
			subM1 = k
			isFirst = false
		}
}

function backimg(k)
{
 clearTimeout(viewSubTime)
 objimg = "smi" + k  ;
 document.all[objimg].src= menuDepthImage[k].src ;
}


function viewSubmenu()
{
	target_layer0 = eval("dynamenu"+subM0)
	target_layer0.style.visibility = "visible";
	if(subM1 != subM0)
	{
		backimg(subM1)
		target_layer1 = eval("dynamenu"+subM1)
		target_layer1.style.visibility = "hidden";
		subM1 = subM0
	}
	if(subM0 != subDepth0)//<=====================
	{
		if(subDepth0 != "disable" && subDepth1 != "disable")
			backimg(subDepth0)
	}
}

function color(i,n)
{
	eval("document.sms"+i+"_"+n).src = submenuImage[i][n*2+1].src
	if(subDepth0 != i || subDepth1 != n)//<=========================
	{
		if(subDepth0 != "disable" && subDepth1 != "disable")
			eval("document.sms"+subDepth0+"_"+subDepth1).src = submenuImage[subDepth0][subDepth1*2].src
	}
}

function back(i,n)
{
	if(subDepth0 != i || subDepth1 != n)
		eval("document.sms"+i+"_"+n).src = submenuImage[i][n*2].src
}


function loadmenu()
{
	if(subDepth0 != "disable")
		setTimeout("chgimg(0,"+subDepth0+")",250);
	else if(subM0 != -1)
		setTimeout("backimg("+subM0+")",250);
	if(subDepth1 != "disable")
		eval("document.sms"+subDepth0+"_"+subDepth1).src = submenuImage[subDepth0][subDepth1*2+1].src
	else if(subM1 != -1)//<======================
	{
		if(subM0 != subM1 && subDepth1 != "disable")
		{
			target_layer0 = eval("dynamenu"+subM1)
			target_layer0.style.visibility = "hidden";
		}
	}
	initSubBox()
}

function menuInit(n)
{
	if(n == 1)
		initChk ++
	else
		initChk --
	if(initChk<1)
		initChkTime = setTimeout("loadmenu()",250)
	else
		clearTimeout(initChkTime)
}

function initSubBox()
{
	if(menuCode != 0)
	{
		for(i=0;i<menuDepth1[menuCode].length;i++)//3Â÷¸Þ´ºÁß ÃÖ´ë°ª
		{
			subLayer = eval("dynamenu" + i)
			subHeight[i] = subLayer.clientHeight
			if(subMaxheight<subHeight[i])
				subMaxheight = subHeight[i]
		}
		if(subNavBox.clientHeight<subMaxheight)
			subNavBox.height = subMaxheight
		for(i=0;i<menuDepth1[menuCode].length;i++)//ÃÖ´ë°ª¿¡ µû¶ó 3Â÷¸Þ´º top ¼³Á¤
		{
			subLayer = eval("dynamenu" + i)
			if(subMaxheight > subboxheight)
				test = subMaxheight
			else
				test = subboxheight
			if(subLayer.offsetHeight + subLayer.offsetTop > test)
				subLayer.style.pixelTop = subLayer.style.pixelTop - (subLayer.style.pixelTop + subLayer.offsetHeight - test)
		}
		if(subDepth0 == "disable" && subDepth1 == "disable" && subM0 != -1)
		{
			target_layer0 = eval("dynamenu"+subM1)
			target_layer0.style.visibility = "hidden";
		}
	}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
