//========== ÄíÅ°°ª Ã³¸® ÇÔ¼ö S
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {	//while open
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break; 
	}	//while close
	return null;
}
//========== ÄíÅ°°ª Ã³¸® ÇÔ¼ö E

tmp = CatID.substring(0, 2);

// SUBMENU LINE ½ÃÀÛ 
var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;
var currentimg    = null;

var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

// Open Hidden Layer
function mopen(n)
{
    var mm  = document.getElementById('gnb2_'+n);
    var l = document.getElementById('gnb2_s'+n);
    var sel_img = document.getElementById('gnb2open_'+n);    
    if(l)
    {
		mm.className='sel';
		sel_img.src='http://image.chosun.com/cs/gnb/ic_sel_gnb.gif'
        mcancelclosetime();
        l.style.display='block';
        if(currentLayer && (currentLayerNum != n)){
            currentLayer.style.display='none';
			currentitem.className='';
			currentimg.src='http://image.chosun.com/cs/gnb/ic_open_gnb.gif'
			sel_menu();
		}
        currentLayer = l;
        currentitem = mm;
		currentimg = sel_img;
        currentLayerNum = n;            
    }
    else if(currentLayer)
    {
        currentLayer.style.display='none';
		currentitem.className='';
		currentimg.src='http://image.chosun.com/cs/gnb/ic_open_gnb.gif'
		sel_menu();
        currentLayerNum = 0;
        currentitem = null;
        currentLayer = null;
		currentimg = null;
    }
}
// Turn On Close Timer
function mclosetime()
{
    closeTimer = window.setTimeout(mclose, TimeOut);
}
// Cancel Close Timer
function mcancelclosetime()
{
    if(closeTimer)
    {
        window.clearTimeout(closeTimer);
        closeTimer = null;
    }
}
// Close Showed Layer
function mclose()
{
    if(currentLayer && noClose!=1)
    {
        currentLayer.style.display='none';
		currentitem.className='';
		currentimg.src='http://image.chosun.com/cs/gnb/ic_open_gnb.gif'
        currentLayerNum = 0;
		sel_menu();
        currentLayer = null;
        currentitem = null;
		currentimg = null;
    }
    else
    {
        noClose = 0;
    }
    currentLayer = null;
    currentitem = null;
}

function sel_menu(){
	if(tmp)	{
		if(tmp == '14' || tmp == '15'){		
			document.getElementById('gnb2_10').className='sel';
		}else if(tmp != '10'){
		document.getElementById('gnb2_'+tmp).className='sel';
		}
	}else{}
}
// Close Layer Then Click-out
document.onclick = mclose; 

//·Î±×ÀÎ °ü·Ã ---
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {	//while open
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break; 
	}	//while close
	return null;
}
//·Î±×ÀÎ
function loginFrame () {
	//ÆäÀÌÁö URL
	var returl = document.location; 
	if (returl == null || returl == ""){
		returl = M_SITE;
	}
	returl = escape(returl);

	var login_url = "https://membership.chosun.com/login/protect_sso/sso_user_info.jsp?returl="+returl;
	var logout_url = "https://membership.chosun.com/login/logout.jsp?returl="+returl;
	var regist_url = "https://membership.chosun.com/join/registUser.jsp?site=chosun";
	var join_url = "https://membership.chosun.com/join/registUser.jsp?act=myindex&site=chosun";
	var idpw_url = "https://membership.chosun.com/join/registUser.jsp?act=idpw&site=chosun";
	var logStr;

	//·Î±×ÀÎ¿©ºÎ - ÄíÅ°°ª È®ÀÎ
	if (!GetCookie('SMSESSION') || GetCookie('SMSESSION') == "LOGGEDOFF" || !GetCookie('SM_USER')) {
		logStr = "<li><span>¤ý</span><a href=" + login_url + " target='_top'>·Î±×ÀÎ</a></li><li><span>¤ý</span><a href=" + regist_url + " target='_top'>È¸¿ø°¡ÀÔ</a></li><li><span>¤ý</span><a href=" + idpw_url + " target='_top'>¾ÆÀÌµð / ºñ¹Ð¹øÈ£ Ã£±â</a></li>";
	}
	else if (!GetCookie('dz_nm') || !GetCookie('dz_info')) {	//20070406 rainy
	var relogin_url = "https://membership.chosun.com/login/protect_sso/sso_user_info.jsp?returl="+returl;
		parent.location.href = relogin_url;
	}
	else {
		logStr = "<li><span class='user_name'>"+unescape(GetCookie('dz_nm'))+"</span>´Ô</li>" ;
		logStr = logStr + "<li><span>¤ý</span><a href=" + logout_url + " target='_top'>·Î±×¾Æ¿ô</a></li><li><span>¤ý</span><a href=" + join_url + " target='_top'>Á¤º¸¼öÁ¤</a></li>";
		logStr = logStr + "<li><span>¤ý</span><a href=http://blog.chosun.com/" + GetCookie('SM_USER') + " target='_blank'>³»ºí·Î±×</a></li>";
	}
	
	return logStr;
}
document.write(" \
<style type='text/css'> \
body {font-size:12px;font-family:µ¸¿ò,Dotum;} \
fieldset,img{border:none;} \
hr,legend{display:none;} \
input,textarea,select{background-color:#fff;font-family:inherit;} \
#logo_etc{float:none;clear:both;margin:0;padding:0;height:60px;} \
#logo{position:relative;width:235px;float:left;margin:0 0px 0 19px;display:inline;} \
#logo h1{float:left;font-style:normal;font-size:12px;margin:7px 4px 0 0;} \
#logo h1 img{vertical-align:top;} \
#logo h2{float:left;font-style:normal;font-size:12px;margin-top:7px;} \
#logo h2 img{vertical-align:top;} \
#logo ul#login{position:absolute;top:38px;left:0px;} \
#logo ul#login li{float:left;font-size:11px;color:#666666;} \
#logo ul#login li a{font-size:11px;color:#666666;letter-spacing:-1px;line-height:12px;} \
#logo ul#login li span{color:#333;font-weight:bold;} \
#logo ul#login li span.user_name{color:#666;} \
#lang{float:left;width:55px;margin:0 55px 0 0;line-height:16px;} \
#lang li{margin:2px 0 0 0;padding:0 0 1px 8px;border-bottom:1px solid #cdcdcd;background:url('http://image.chosun.com/cs/gnb/bul_sq_9f.gif') 0 6px no-repeat;} \
#lang li.firstchild{margin:0;padding:0 0 0 6px;} \
#lang li.lastchild{border:none;padding:0 0 0 8px;} \
#tot_search{width:266px;float:left;margin:8px 0 0 0;} \
#tot_search fieldset input{vertical-align:middle;} \
.search_box{position:relative;background:url('http://image.chosun.com/cs/gnb/bg_search.gif') left top no-repeat;margin-right:3px;width:250px;height:24px;} \
.search_box input.search_text{border:none;width:205px;margin:3px 0 2px 3px;font-size:12px;font-family:'Dotum';color:#333;ime-mode:active;} \
.search_box input.search_btn{position:absolute;top:0px;left:217px;} \
.popular_search{float:none;clear:both;margin-top:3px;} \
#top_ban{float:right;width:250px;height:57px;margin:5px 0 -2px 0;padding:0;} \
#gnb_new{float:none;clear:both;position:relative;width:970px;height:39px;margin:0;background:url('http://image.chosun.com/focus/2009/08/bg_gnb_focus.gif') left top repeat-x;z-index:2;} \
#gnb1{float:left;margin:0 0 0 19px;display:inline;} \
#gnb1 li{float:left;margin:0;} \
#gnb1 li img#gnb_sel{float:left;} \
#gnb1 li span{padding:0 8px 0 8px;} \
#gnb1 li #gnb2{float:left;margin:4px 16px 0 0;padding:10px 10px 8px 7px;background-color:#5978a4;letter-spacing:-1px;display:inline;} \
#gnb2 li{position:relative;float:left;margin:0 9px 0 0;padding:0;line-height:14px;} \
#gnb2 li a{color:#fff;font-weight:bold;} \
#gnb2 li a:hover{color:#FFF;text-decoration:underline;} \
#gnb2 li.sel a{color:#FFF;text-decoration:underline;} \
#gnb2 li#gnb2_11, #gnb2 li#gnb2_12, #gnb2 li#gnb2_13, #gnb2 li#gnb2_14, #gnb2 li#gnb2_15, #gnb2 li#gnb2_16{background:none;margin:0 6px; 0 0;letter-spacing:0px;} \
#gnb2 li img{vertical-align:middle;margin:0 0 0 1px;} \
#gnb2 li ul{position:absolute;top:20px;left:0px;display:none;width:100px;padding:14px 0 15px 0;border:2px solid #6d788c;background-color:#fff;overflow:hidden;} \
#gnb2 li ul li{float:none !important;margin:6px 0 0 5px;} \
#gnb2 li ul li span{font-weight:bold;color:#999;padding:0 0 0 0 !important;} \
#gnb2 li ul li a{color:#333 !important;;font-weight:normal !important;text-decoration:none !important;} \
#gnb2 li ul li a:hover{text-decoration:underline !important;} \
#gnb3{float:right;margin:10px 10px 0 0;display:inline;} \
#gnb3 li{float:left;} \
\
#all_list{width:270px;} \
</style> \
	<!-- logo_etc --> \
	<div id='logo_etc'> \
		<div id='logo'> \
			<h1><a href='http://www.chosun.com/'><img src='http://image.chosun.com/cs/gnb/logo_chosun_s.gif' alt='chosun.com'></a></h1> \
			<h2><a href='http://focus.chosun.com/'><img src='http://image.chosun.com/cs/gnb/chosun_title_focus.gif' alt='Æ÷Ä¿½º'></a></h2> \
			<ul id='login'>" +loginFrame()+ "</ul> \
		</div> \
		<ul id='lang'> \
			<li class='firstchild'><a href='http://japanese.chosun.com/' target='_blank'>ìíÜâåÞ</a></li> \
			<li><a href='http://english.chosun.com/' target='_blank'>English</a></li> \
			<li class='lastchild'><a href='http://chn.chosun.com/' target='_blank'>ñéÙþ</a></li> \
		</ul> \
		<div id='tot_search'> \
			<form method='get' action='http://search.chosun.com/search/totalSearch.jsp' target='_blank'> \
				<fieldset> \
					<legend>ÅëÇÕ°Ë»ö</legend> \
					<div class='search_box'><input type='text' name='searchTerm' id='searchTerm' class='search_text' tabindex='1' title='°Ë»ö¾î ÀÔ·Â'><input type='image' src='http://image.chosun.com/cs/gnb/gnb_search_btn.gif' class='search_btn' alt='ÅëÇÕ°Ë»ö'></div> \
				<fieldset> \
			</form> \
			<div class='popular_search'><iframe src='http://news.chosun.com/common/r_search/popular/' title='ÃßÃµ°Ë»ö¾î' width='262' height='18' frameborder='0' scrolling='no'></iframe></div></div> \
		<div id='top_ban'><noscript><iframe src='http://news.chosun.com/event/GnbIssue/index.html' title='ÇÖÀÌ½´ ¹è³Ê' width='250' height='57' frameborder='0' scrolling='no'><\/iframe></noscript> \
		");
		ban_ran = Math.floor(Math.random()*3+1);
		if (ban_ran > 1){
			document.write("<iframe src='http://news.chosun.com/event/GnbIssue/index.html' title='ÇÖÀÌ½´ ¹è³Ê' width='250' height='57' frameborder='0' scrolling='no'><\/iframe>");
		} else {
			document.write("<iframe src='http://news.chosun.com/event/GnbPromotion/index.html' title='ÇÁ·Î¸ð¼Ç ¹è³Ê' width='250' height='57' frameborder='0' scrolling='no'><\/iframe>");
		}
document.write(" \
	<\/div> \
	<\/div> \
	<!-- logo_etc // --> \
	<!-- gnb --> \
	<div id='gnb_new'> \
		<ul id='gnb1'> \
			<li><a href='http://news.chosun.com/'><img src='http://image.chosun.com/focus/2009/08/focus_gmenu1.gif' alt='´º½º'></a><img src='http://image.chosun.com/focus/2009/08/focus_gnb_line.gif' alt=''></li> \
			<li><span></span><a href='http://news.chosun.com/se/'><img src='http://image.chosun.com/focus/2009/08/focus_gmenu2.gif' alt='½ºÆ÷Ã÷¤ý¿¬¿¹'></a><span></span><img src='http://image.chosun.com/focus/2009/08/focus_gnb_line.gif' alt=''></li> \
			<li><span></span><a href='http://newsplus.chosun.com/'><img src='http://image.chosun.com/focus/2009/08/focus_gmenu3.gif' alt='´º½ºÇÃ·¯½º'></a><span></span></li> \
			<li><a href='http://focus.chosun.com/'><img src='http://image.chosun.com/cs/gnb/focus_gmenu4_on.gif' id='gnb_sel' alt='Æ÷Ä¿½º'></a> \
				<ul id='gnb2'> \
					<li id='gnb2_16'><a href='http://issue.chosun.com/'>ÀÌ½´</a></li> \
					<li id='gnb2_11'><a href='http://focus.chosun.com/subMain.jsp?pt=M'>ÀÎ¹°</a></li> \
					<li id='gnb2_12'><a href='http://focus.chosun.com/subMain.jsp?pt=C'>±â¾÷</a></li> \
					<li id='gnb2_13'><a href='http://focus.chosun.com/subMain.jsp?pt=O'>±â°ü</a></li> \
					<!--li id='gnb2_14'><a href='http://focus.chosun.com/subMain.jsp?pt=N'>³ª¶ó</a></li> \
					<li id='gnb2_15'><a href='http://focus.chosun.com/subMain.jsp?pt=R'>Áö¿ª</a></li--> \
				</ul> \
			</li> \
		</ul> \
		<ul id='gnb3'> \
			<li><a href='http://photo.chosun.com/'><img src='http://image.chosun.com/focus/2009/08/focus_sm1.gif' alt='Æ÷Åä'></a></li> \
			<li><a href='http://video.chosun.com/'><img src='http://image.chosun.com/focus/2009/08/focus_sm2.gif' alt='µ¿¿µ»ó'></a></li> \
			<li><a href='http://forum.chosun.com/'><img src='http://image.chosun.com/focus/2009/08/focus_sm3.gif' alt='Åä·Ð¸¶´ç'></a></li> \
			<li><a href='http://news.chosun.com/ranking/'><img src='http://image.chosun.com/focus/2009/08/focus_sm4.gif' alt='·©Å·'><!--img src='http://image.chosun.com/cs/gnb/focus_sm4.gif' alt='·©Å·'--></a></li> \
			<li><a href='http://blog.chosun.com/' target='_blank'><img src='http://image.chosun.com/focus/2009/08/focus_sm5.gif' alt='ºí·Î±×'></a></li> \
		</ul> \
	</div> \
	<!-- gnb --> \
");
sel_menu();