
// ÇöÀç ÆäÀÌÁö ÄÚµå(¿ëµµ : 1. GNB mouseOver½Ã on ÀÌ¹ÌÁö Á¦¾î)
var currentPageCode;

// ³×ºñ°ÔÀÌ¼Ç ¸®½ºÆ®
var listInfo = [
	{
		link:"/sub_1_1.html",
		alt:"ÇÐÈ¸¼Ò°³",
		subList:[
			{
				link:"/sub_1_1.html",
				name:"ÇÐÈ¸¼Ò°³"
			},
			{
				link:"/sub_1_2.html",
				name:"È®È¸ÀÎ»ç¸»"
			},
			{
				link:"/sub_1_3.html",
				name:"ÇÐÈ¸Á¤°ü"
			},
			{
				link:"/sub_1_4.html",
				name:"ÇÐÈ¸¿¬Çõ"
			},
			{
				link:"/sub_1_5.html",
				name:"ÇÐÈ¸ÀÓ¿øÇöÈ²"
			},
			{
				link:"/sub_1_6.html",
				name:"Ã£¾Æ¿À½Ã´Â ±æ"
			}
		]
	},
	{
		link:"/sub_2_1.html",
		alt:"³í¹®±ÔÁ¤/ÀÚ·á",
		subList:[
			{
				link:"/sub_2_1.html",
				name:"³í¹®Åõ°í±ÔÁ¤"
			},
			{
				link:"/sub_2_2.html",
				name:"³í¹®ÀÛ¼º±ÔÁ¤"
			},
			{
				link:"/sub_2_3.html",
				name:"³í¹®½É»ç±ÔÁ¤"
			},
			{
				link:"/bbs/list.php?&bbs_id=detra17",
				name:"Âü°íÀÚ·á"
			},
			{
				link:"/sub_2_5.html",
				name:"¿¬±¸À±¸®±ÔÁ¤"
			}
		]
	},
	{
		link:"/sub_3_1.html",
		alt:"³í¹®¿­¶÷",
		subList:[
			{
				link:"/sub_3_1.html",
				name:"³í¹®¿­¶÷"
			}
		]
	},
	{
		link:"/sub_4_1.html",
		alt:"ÇÐÈ¸ÀÛÇ°Àü",
		subList:[
			{
				link:"/sub_4_1.html",
				name:"ÀÛÇ°Á¦Ãâ"
			},
			{
				link:"/sub_4_2.html",
				name:"ÀÛÇ°°¶·¯¸®"
			}
		]
	},
	{
		link:"/sub_5_1.html",
		alt:"È¸¿ø¼­ºñ½º",
		subList:[
			{
				link:"/sub_5_1.html",
				name:"È¸¿ø°¡ÀÔ¾È³»"
			},
			{
				link:"/sub_5_2.html",
				name:"È¸¿ø°¡ÀÔ"
			},
			{
				link:"/sub_5_3.html",
				name:"È¸¿ø¸íºÎ"
			}
		]
	},
	{
		link:"/sub_6_1.html",
		alt:"Áõ¸í¼­¹ß±Þ½ÅÃ»",
		subList:[
			{
				link:"/sub_6_1.html",
				name:"Áõ¸í¼­¹ß±Þ½ÅÃ»"
			}
		]
	},
	{
		link:"#",
		alt:"°Ô½ÃÆÇ¸ðÀ½",
		subList:[
			{
				link:"/bbs/list.php?&bbs_id=detra1",
				name:"°øÁö»çÇ×"
			},
			{
				link:"/bbs/list.php?&bbs_id=detra2",
				name:"µðÀÚÀÎ´º½º"
			},
			{
				link:"/bbs/list.php?&bbs_id=detra3",
				name:"È¸¿øµ¿Á¤"
			}
		]
	}
];

// ¸ÞÀÎ ³×ºñ º¸ÀÌ±â
function showGNB(idx,isMain) {
	idx = Number(idx);
	var div = document.getElementById("deth1_"+idx);
	if(div){
		div.style.display = 'block';
	}
	var img = document.getElementById("topMenuImage_"+idx);//¸¶¿ì½º¿À¹öµÈ ÀÌ¹ÌÁö id

	var currentIdx = Number(currentPageCode.substr(0,1))-1;
	var currentCategoryImage = document.getElementById("topMenuImage_"+currentIdx);//ÇöÀç ÆäÀÌÁöÀÇ ÀÌ¹ÌÁö id
	if(!isMain){
		img.src='/images/nav_top_0'+(idx+1)+'_on.gif'
		if(currentIdx < 6)//¸Þ´ºÄÚµå°¡ GNBº¸´Ù ¸¹±â ¶§¹®¿¡ ÇöÀç È°¼ºÈ­µÈ ¸Þ´º´Â ¾øÀ» ¼ö ÀÖ´Ù.
			currentCategoryImage.src='/images/nav_top_0'+(currentIdx+1)+'_off.gif'
	}
}

// ¸ÞÀÎ ³×ºñ °¨Ãß±â
function hideGNB(idx,isMain) {
	idx = Number(idx);
	var div = document.getElementById("deth1_"+idx);
	if(div){
		div.style.display = 'none';
	}
	var img = document.getElementById("topMenuImage_"+idx);//¸¶¿ì½º¿À¹öµÈ ÀÌ¹ÌÁö id

	var currentIdx = Number(currentPageCode.substr(0,1))-1;
	var currentCategoryImage = document.getElementById("topMenuImage_"+currentIdx);//ÇöÀç ÆäÀÌÁöÀÇ ÀÌ¹ÌÁö id
	if(!isMain){
		img.src='/images/nav_top_0'+(idx+1)+'_off.gif'
		if(currentIdx < 6)
			currentCategoryImage.src='/images/nav_top_0'+(currentIdx+1)+'_on.gif'
	}
}

// ¸ÞÀÎ ³×ºñ ±×¸®±â
function gnbWrite(pageCd){
	currentPageCode = pageCd;
	var currentCategoryCode = pageCd.split("-")[0];
	var idx;

	var topMenu = '';
	topMenu+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	topMenu+='<tr>';
	topMenu+='<td width="120"><a href="/index.html"><img src="/images/logo.gif" border="0"></a></td>';
	topMenu+='<td width="770" valign="bottom" style="padding:0 0 10 0;">';
	topMenu+='<table border="0" cellspacing="0" cellpadding="0"><tr>';
	for(var i = 0 ; i < 6 ; i ++){
		idx = 1 + i;
		if(idx == currentCategoryCode){
			//¶Ç´Â »ý¼ºµÈ ÄÚµå¿Í ÇöÀç ÆäÀÌÁö ÄÚµå¿Í ¸ÂÀ» °æ¿ì on
			topMenu+='			<td valign="top"><div class="deth1" onmouseover="javascript:showGNB(\''+i+'\',true);" onmouseout="javascript:hideGNB(\''+i+'\',true);"><a href="'+listInfo[i].link+'"><img src="/images/nav_top_0'+idx+'_on.gif" id="topMenuImage_'+i+'" /></a><br/>';
		}else{
			topMenu+='			<td valign="top"><div class="deth1" onmouseover="javascript:showGNB(\''+i+'\',false);" onmouseout="javascript:hideGNB(\''+i+'\',false);"><a href="'+listInfo[i].link+'"><img src="/images/nav_top_0'+idx+'_off.gif" id="topMenuImage_'+i+'" /></a><br/>';
		}
		if (listInfo[i].subList.length > 1) {
			topMenu+='				<div id="deth1_'+i+'" style="display:none; position:absolute; padding:10 10 10 10; width:100; background:url(/images/white.png); line-height:20pt;">';
			for(var j = 0 ; j < listInfo[i].subList.length ; j ++){
				topMenu+='					<div><a href="'+listInfo[i].subList[j].link+'" class="navi">'+listInfo[i].subList[j].name+'</a></div>';
			}
		}else{
			topMenu+='				<div id="deth1_'+i+'" style="display:none; position:absolute;">';
		}
		topMenu+='					</div>';
		topMenu+='				</div></td><td width="20"></td>';
	}
	topMenu+='</tr></table>';
	topMenu+='				</td>';
	topMenu+='			<td width="110" valign="bottom" style="padding:0 0 10 0;">';
	topMenu+='				<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	topMenu+='					<tr>';
	topMenu+='					<td align="left" valign="bottom"><a href="/bbs/list.php?&bbs_id=detra1"><img src="/images/nav_notice.gif"></a></td>';
	topMenu+='					<td align="right" valign="bottom"><a href="mailto:detra@detra.org"><img src="/images/nav_contact.gif"></a></td>';
	topMenu+='				</table>';
	topMenu+='			</td>';
	topMenu+='			</tr>';
	topMenu+='		</table>';

	document.writeln(topMenu);
}

// ¼­ºê ¸Þ´º ±×¸®±â
function writeLeftMenu(pageCd) {
	currentPageCode = pageCd;
	var currentCategoryCode = pageCd.split("-")[0];
	var currentDetailCode = pageCd.split("-")[1];
	var idx;

	var leftMenu = '';
	leftMenu+='				<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	for(var i = 0 ; i < listInfo[currentCategoryCode-1].subList.length ; i ++){
		idx = 1 + i;
		if(idx == currentDetailCode){
			leftMenu+='					<tr>';
			leftMenu+='						<td style="padding:0 0 20 0;"><a href="'+listInfo[currentCategoryCode-1].subList[i].link+'"><img src="/images/nav_left0'+currentCategoryCode+'_0'+idx+'_on.gif"></a></td>';
			leftMenu+='					</tr>';
		}else{
			leftMenu+='					<tr>';
			leftMenu+='						<td style="padding:0 0 20 0;"><a href="'+listInfo[currentCategoryCode-1].subList[i].link+'"><img src="/images/nav_left0'+currentCategoryCode+'_0'+idx+'_off.gif"></a></td>';
			leftMenu+='					</tr>';
		}
	}
	leftMenu+='				</table>';

	document.writeln(leftMenu);
}

// ÇÃ·¡½Ã ³Ö±â
function flashWrite(url,w,h,id,bg,vars,win){

	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);

}
