//========== 쿠키값 처리 함수 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

//로그인 관련 ---
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;
}
var uid = "";
//로그인
function loginFrame () {
	//페이지 URL
	var returl = document.location; 
	if (returl == null || returl == ""){
		returl = M_SITE;
	}
	returl = escape(returl);

	var login_url = "http://membership.chosun.com/login/protect_sso/sso_user_info.jsp?returl="+returl;
	var logout_url = "http://membership.chosun.com/login/logout.jsp?returl="+returl;
	var regist_url = "http://membership.chosun.com/join/registUser.jsp?site=chosun";
	var join_url = "http://membership.chosun.com/join/registUser.jsp?act=myindex&site=chosun";
	var idpw_url = "http://membership.chosun.com/join/registUser.jsp?act=idpw&site=chosun";
	var logStr;

	//로그인여부 - 쿠키값 확인
	if (!GetCookie('SMSESSION') || GetCookie('SMSESSION') == "LOGGEDOFF" || !GetCookie('SM_USER')) {
		logStr = "<li><b>ㆍ<\/b><a href=" + login_url + " target='_top'>로그인<\/a><\/li><li><b>ㆍ<\/b><a href=" + regist_url + " target='_top'>회원가입<\/a><\/li><li><b>ㆍ<\/b><a href=" + idpw_url + " target='_top'>아이디 / 비밀번호 찾기<\/a><\/li>";
	}
	else if (!GetCookie('dz_nm') || !GetCookie('dz_info')) {	//20070406 rainy
	var relogin_url = "http://membership.chosun.com/login/protect_sso/sso_user_info.jsp?returl="+returl;
		parent.location.href = relogin_url;
	}
	else {
		var uid = unescape(GetCookie('dz_nm'));
		logStr = "<li> <strong>" + uid + " <\/strong>님<\/li><li><b>ㆍ<\/b><a href=" + logout_url + " target='_top'>로그아웃<\/a><\/li><li><b>ㆍ<\/b><a href=" + join_url + " target='_top'>회원정보수정<\/a><\/li>";
	}
	
	return logStr;
}

	function flashWrite(url, w, h, vars, win, alt)
	{

	  var id = url.split("/")[url.split("/").length-1].split(".")[0];
	  if(vars == null) vars='';
	  if(win == null) win='opaque';

	  var objStr = "     <object ";

	  if(navigator.appName.match("Internet Explorer")){
		  objStr += "classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
	  } else {
		  objStr += "type='application/x-shockwave-flash' data='"+url+"' ";
	  }
		  objStr +="     id='"+id+"' style='width:"+w+"px; height:"+h+"px;'>";
		  objStr +="    <param name='base' value='.' />";
		  objStr+= "    <param name='showLiveConnect' value='true' />";
		  objStr +="    <param name='allowScriptAccess' value='always' />";
		  objStr +="    <param name='movie' value='"+url+"' />";
		  objStr +="    <param name='FlashVars' value='"+vars+"' />";
		  objStr +="    <param name='wmode' value='"+win+"' />";
		  objStr +="    <param name='menu' value='false' />";
		  objStr +="    <param name='quality' value='high' />";
		  objStr +="    <p>"+alt+"</p>";
		  objStr +="  </object>";

	  document.write(objStr);
	}



	var lVar_Layer=false;
	function lview(viewID){
		if(lVar_Layer==true){
		document.getElementById(viewID).style.display = 'none';
		lVar_Layer=false;
		} else {
		document.getElementById(viewID).style.display = 'block';
		lVar_Layer=true;
		}
		}
		function lclose(viewID){
		document.getElementById(viewID).style.display = 'none';
		lVar_Layer=false;
	}


var gnbWidthVal, gnbCenterWidth ;
if (gnbWidthVal == null || gnbWidthVal == "") gnbWidthVal = "835" ;
if (eval(gnbWidthVal) <= 835) gnbWidthVal = "835" ;
gnbCenterWidth = 450 + (gnbWidthVal-835) ;
document.write(" \
<style type='text/css'> \
#header{overflow:visible;position:relative;z-index:50;height:144px;padding-top:9px;} \
th,td{font-size:12px;font-family:돋움,Dotum,AppleGothic,sans-serif;} \
ul,li{list-style:none;} \
#s_gnb{width:970px;margin:0px auto 0 auto; border-bottom:2px solid #d02b31; height:24px;} \
#c_slogo{position:relative; float:left;padding:2px 0 0 20px; z-index:5;} \
#lnb{position:relative;float:right;margin:0px 0 0 0;z-index:6; } \
#lnb li.spn_chosun,#lnb li.busi,#lnb li#all_service,#lnb li#myremot{float:left;color:#8f8f8f;} \
#lnb li.s_menu_font{float:left;color:#333333;font-size:12px;padding-top:3px;letter-spacing:-1px; font-family: 'Dotum', '돋움'; line-height:14px;} \
#lnb li.s_menu_font a{font-size:12px;letter-spacing:-1px; color:#333333; font-family: 'Dotum', '돋움'; line-height:14px;} \
#lnb li img{vertical-align:middle;margin:0 0 2px 0;cursor:pointer;_cursor /**/:hand;} \
#lnb li span{padding:0 2px 0 1px;} \
#lnb li#all_service{position:relative;} \
#lnb li#myremot{position:relative;margin:0 0 0 12px;display:inline;} \
#all_service_list{position:absolute;top:15px;right:0px;width:282px;padding:12px 0 6px 10px;border:2px solid #afafaf;background-color:#fff;display:none;z-index:7; font-family: 'Dotum', '돋움'; font-size:12px; } \
#all_service_list ul{float:left;margin:0 20px 0 0;} \
#all_service_list ul.lastchild{margin:0;} \
#all_service_list ul li{float:none;margin:0 0 3px 0;letter-spacing:-1px;text-align:left;} \
#all_service_list ul li.all_view a{color:#cb7273;} \
#logo_join{clear:both;width:230px;} \
#logo_join h1{margin-left:42px;} \
#logo_join h1 img{vertical-align:top;margin-top:8px;} \
#logo_join ul li{float:left;margin-left:0px;display:inline;} \
#logo_join ul li,#logo_join ul li a,#logo_join ul li a:visited,#logo_join ul li a:active,#logo_join ul li a:hover{font-size:11px;color:#666;letter-spacing:-1px;} \
#gnb{position:absolute;top:43px;left:230px;width:740px;vertical-align:top;height:99px;overflow:hidden;} \
<\/style> \
");
document.write(" \
	<div id='s_gnb'> \
	<ul id='c_slogo'><a href='http://www.chosun.com/'><img src='http://image.chosun.com/cs/gnb/logo_chosun_s.gif' alt='chosun.com'></a></ul> \
	<ul id='lnb'> \
		<li class='s_menu_font'><a href='http://news.chosun.com/'>뉴스</a><span> | </span></li> \
		<li class='s_menu_font'><a href='http://news.chosun.com/se/'>스포츠·연예</a><span> | </span></li> \
		<li class='s_menu_font'><a href='http://newsplus.chosun.com/'>뉴스플러스</a><span> | </span></li> \
		<li class='s_menu_font'><a href='http://focus.chosun.com/'>포커스</a><span> | </span></li> \
		<li class='s_menu_font'><a href='http://blog.chosun.com/' target='_blank'>블로그</a><span> | </span></li> \
		<li class='s_menu_font'><a href='http://morningplus.chosun.com/' target='_blank'>모닝플러스</a><span> | </span></li> \
		<li id='all_service' class='s_menu_font' onMouseOut=\"lclose('all_service_list');\"> \
			<a onMouseOver=\"lview('all_service_list');\" style='cursor:pointer;_cursor /**/:hand;'>전체서비스</a> <img src='http://image.chosun.com/cs/gnb/open_allser_3.gif' alt='전체서비스보기' onMouseOver=\"lview('all_service_list');\"> \
			<div id='all_service_list' onMouseOver=\"lview('all_service_list');\"> \
				<ul> \
					<li><a href='http://danmee.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=danmee' target='_blank'>단미</a></li> \
					<li><a href='http://travel.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=travel' target='_blank'>여행<a></li> \
					<li><a href='http://careview.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=careview' target='_blank'>카리뷰</a></li> \
					<li><a href='http://image.chosun.com/sv/people/200710/people_db_main.html?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=people'>인물정보</a></li> \
				</ul> \
				<ul> \
					<li><a href='http://golf.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=golf' target='_blank'>골프</a></li> \
					<li><a href='http://keywui.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=keywui' target='_blank'>키위</a></li> \
					<li><a href='http://kid.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=kid' target='_blank'>소년조선</a></li> \
					<li><a href='http://comic.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=comic' target='_blank'>만화</a></li> \
					</ul> \
				<ul> \
					<li><a href='http://cafe.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=cafe' target='_blank'>카페</a></li> \
					<li><a href='http://bemil.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=bemil' target='_blank'>유용원M</a></li> \
					<li><a href='http://issue.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=issue'>이슈</a></li> \
					<li><a href='http://weather.chosun.com/'>날씨</a></li> \
				</ul> \
				<ul class='lastchild'> \
					<li><a href='http://review.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=review' target='_blank'>리뷰</a></li> \
					<li><a href='http://health.chosun.com/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=health' target='_blank'>헬스</a></li> \
					<li><a href='http://srchdb1.chosun.com/pdf/i_service/?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=pdf'>PDF·지면</a></li> \
					<li class='all_view'><a href='http://www.chosun.com/section/customer/sitemap.html?Dep0=chosunmain&Dep1=gnb&Dep2=bar&Dep3=all'>전체보기 <img src='http://image.chosun.com/cs/gnb/ic_list.gif' alt=''></a></li> \
				</ul> \
			</div> \
		</li> \
	</ul> \
</div> \
");

document.write(" \
<div id='logo_join'> \
	<h1><a href='http://choen.chosun.com/'><img src='http://image.chosun.com/choen/0902/logo.gif' alt='조엔 CHOEN'><\/a><\/h1> \
	<ul>"+loginFrame()+"<\/ul> \
	<div id='gnb'> \
");
	flashWrite('http://choen.chosun.com/js/navi_choen.swf','740','290','gnb','transparent','');
document.write(" \
	<\/div> \
<\/div> \
");
function openMenu(){document.getElementById('gnb').style.height='290'+"px";} 
function closeMenu(){document.getElementById('gnb').style.height='99'+"px";} 
