/*
 * nownuri gnb script
 */

//document.title = "³ª¿ì´©¸® - ³ª ¿ì¸® ±×¸®°í ÇÔ²²ÇÏ´Â ¼¼»ó";
//window.name = "nownuri_main";

/*
 * Á¦ÈÞ »çÀÌÆ®°¡ ¾Æ´Ï¸é ¿ÞÂÊ ¸¶ÁøÀ» ÁØ´Ù.
 * Á¦ÈÞ »çÀÌÆ®´Â OBJECT·Î ¿¬°áµÇ¹Ç·Î ¸¶ÁøÀ» BODY ÅÂ±×¿¡¼­ ¼³Á¤ÇØ¾ß ÇÑ´Ù.
 */
if(location.href.search("http://www.nownuri.net/nowmain/jheader.htm") == -1)
	{
	document.body.leftMargin = 10;
	}

var _gnb_html;

/*************************************************************************
 * error protect, check variable in nowiatool.js
 *************************************************************************/
if(typeof(_g_NownuriTicket) != "string")
	{
	_g_NownuriTicket = "";
	}

if(typeof(_g_cookies) == "undefined")
	{
	_g_cookies = "";
	}

/*************************************************************************
 * gnb html
 *************************************************************************/
_gnb_html = '\
<table width="780" border="0" cellspacing="0" cellpadding="0">\
<tr> \
<td width="95"><a href="http://www.nownuri.net/nowmain/" target="_top"><img src="http://www.nownuri.net/nowmain/img/bi.gif" width="95" height="30" border="0"></a></td>\
<td width="278"><img src="http://www.nownuri.net/nowmain/img/top_text.gif" width="150" height="32"></td>\
<td>\
<img src="http://www.nownuri.net/nowmain/img/bg.gif" width="10" height="32" border="0">\
<img src="http://www.nownuri.net/nowmain/img/m_line.gif" width="1" height="32"><a href="http://nnbbs1.nownuri.net:8037/news/" target="_top"><img src="http://www.nownuri.net/nowmain/img/m_news.gif" width="100" height="32" border="0"></a>\
<img src="http://www.nownuri.net/nowmain/img/m_line.gif" width="1" height="32"><a href="http://www.nownuri.net/newbbs/" target="_top"><img src="http://www.nownuri.net/nowmain/img/m_bbs.gif" width="100" height="32" border="0"></a>\
<img src="http://www.nownuri.net/nowmain/img/m_line.gif" width="1" height="32"><a href="http://www.nownuri.net/webclub/clubmain.htm" target="_top"><img src="http://www.nownuri.net/nowmain/img/m_club.gif" width="100" height="32" border="0"></a>\
<img src="http://www.nownuri.net/nowmain/img/m_line.gif" width="1" height="32"><a href="http://www.nownuri.net/nowmain/mail_list.php" target="_top"><img src="http://www.nownuri.net/nowmain/img/m_mail02.gif" width="100" height="32" border="0"></a>\
<img src="http://www.nownuri.net/nowmain/img/m_line.gif" width="1" height="32"></td>\
</tr>\
</table>\
<table width="780" border="0" cellspacing="0" cellpadding="0" height="2">\
<tr>\
<td width="101" bgcolor="#BABABA"></td>\
<td width="273" bgcolor="#BABABA"></td>\
<td width="101" bgcolor="#3377CC"></td>\
<td width="101" bgcolor="#EE6666"></td>\
<td width="102" bgcolor="#FFAA44"></td>\
<td width="102" bgcolor="#78A910"></td>\
</tr>\
</table>\
<table width="780" border="0" cellspacing="0" cellpadding="0">\
<tr bgcolor="#F1F1F1"> \
';
if(_g_NownuriTicket != "")
	{
	var uname = "ÀÌ¿ëÀÚ";
	if(typeof(_g_session) == "object" && _g_session.uname != "")
		{
		uname = _g_session.uname;
		}
	_gnb_html += '\
<td width="228">\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="15" height="1">\
<a href="#null" onclick="javascript:_g_Pf(\'i\');">\
<font color="#333333">'+uname+'´Ô, Áñ°Å¿î ÇÏ·ç µÇ½Ê½Ã¿À.\
</a>\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="15" height="1">\
<span id="_gnb_myinfo"></span>\
</font></td>\
<td width="292">\
<a onclick="javascript:_g_Logout();" style="cursor:hand">\
<img src="http://www.nownuri.net/nowmain/img/bulogout.gif" border="0">\
</a>\
</td>\
	';
	}
else
	{
	if(location.href.search("http://client.nownuri.net:8080/access1") != -1 
		|| location.href.search("https://client.nownuri.net:8443/access1") != -1 
	/*	|| location.href.search("http://join.nownuri.net/megatrans/") != -1
		|| location.href.search("http://join.nownuri.net/trans_megatofree.asp") != -1
		|| location.href.search("http://join.nownuri.net/trans_megatoprim.asp") != -1 */
		|| location.href.search("://join.nownuri.net/") != -1
		)
		{
		_gnb_html += '<td width="390"></td><td width="140"></td>';
		}
	else
		{
		_gnb_html += '\
<form method="post" action="http://client.nownuri.net:8080/access1" name="_g_login" onSubmit="return _g_Login(this);">\
<input type="hidden" name="request_uri" value="http://www.nownuri.net/nowmain/">\
<input type="hidden" name="service" value="byullogin">\
<input type="hidden" name="idflag" value="1">\
<td width="390" height="25" valign="middle">\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="10" height="1"><font color="#999999"><b>ID</b></font> \
<input type="text" name="user" size="10" maxlength="8">&nbsp;\
<font color="#999999"><b>PW</b></font> \
<input type="password" name="password" size="10" maxlength="10">&nbsp;\
<input type="image" src="http://www.nownuri.net/nowmain/img/bu_newlogin.gif" width="46" height="20" border="0" align="absmiddle">\
<input type="checkbox" name="save">IDÀúÀå&nbsp;\
<input type="checkbox" name="nIsSecure">º¸¾ÈÁ¢¼Ó&nbsp;\
</td>\
</form>\
<td width="140" height="25" bgcolor="#F1F1F1" valign="middle"><!--a href="http://join.nownuri.net/join_main.asp" target="_top" class="head">È¸¿ø°¡ÀÔ</a> \
| <a href="#null" onclick="javascript:window.open(\'http://join.nownuri.net/search_id_popup.asp\',\'_blank\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=420,height=300\')" class="head">ID</a>/<a href="#null" onclick="javascript:window.open(\'http://join.nownuri.net/search_passwd_popup.asp\',\'_blank\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=450,height=400\')" class="head">PW Ã£±â</a--></td>\
		';
		}
	}
_gnb_html += '\
<td height="25" align="rignt">\
<img src="http://www.nownuri.net/nowmain/img/ico_mail.gif" width="20" height="25" align="absmiddle" border="0"><font color="#666666"><a href="http://www.nownuri.net/nowmain/mail_list.php" target="_top" class="head">ÆíÁö</a><span id="_g_newmail">\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="4" height="1"></span>\
<img src="http://www.nownuri.net/nowmain/img/ico_msg.gif" width="20" height="25" align="absmiddle" border="0"><a href="#null" onclick="_g_Memo();" target="_top" class="head">ÂÊÁö</a><span id="_g_newmemo">\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="4" height="8"></span>\
<img src="http://www.nownuri.net/nowmain/img/ico_my.gif" width="20" height="25" align="absmiddle"><a href="https://join.nownuri.net/chg_baseinfo_frm.asp" target="_top" class="head">³»Á¤º¸</a>\
<img src="http://www.nownuri.net/nowmain/img/dum.gif" width="4" height="1">\
<img src="http://www.nownuri.net/nowmain/img/ico_sitemap.gif" width="20" height="25" align="absmiddle"><a href="http://www.nownuri.net/sitemap/sitemap_main.htm" target="_top" class="head">»çÀÌÆ®¸Ê</a></font></td>\
</tr>\
<tr bgcolor="#BABABA"> \
<td colspan="3" height="1"></td>\
</tr>\
</table>\
<script language="javascript" src="http://www.nownuri.net/script/menu/datathink_las.js"></script>\
';
document.writeln(_gnb_html);
_g_init();
/*************************************************************************
 *
 * session helper function
 *
 *************************************************************************/
/*
 * ÃÊ±âÈ­ 
 */
function _g_init()
	{
	var uid="";
	if(_g_NownuriTicket == "" && typeof(document._g_login) == "object")
		{
		for(cookie in _g_cookies)
			{
			if(cookie == "ByulUser")
				{
				if(_g_cookies[cookie] != "undefined")
					{
					uid = _g_cookies[cookie];
					}
				}
			}

		if(uid != "")
			{
			document._g_login.user.value = uid;
			document._g_login.save.checked = true;
			document._g_login.password.focus();
			}
		else
			{
			document._g_login.user.focus();
			}

		if(document.getElementById('nIsSecure'))
			{
			document.getElementById('nIsSecure').onclick=setSecureLogin;
			}

		if((NownuriSecureLoginCookie = getCookie("NownuriSecureLogin")) != -1)
			{
			document.getElementById('nIsSecure').checked = true;
			}
		}
	}

/*
 * ·Î±×ÀÎ
 */
function _g_Login(eForm)
	{
	if(eForm.user.value == "")
		{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		eForm.user.focus();
		return false;
		}

	if(eForm.password.value == "")
		{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		eForm.password.focus();
		return false;
		}

	// jsite¿ë gnbÀÏ¶§´Â ·Î±×ÀÎÈÄ ¸ÞÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÑ´Ù. (ÀÌµ¿ÇÒ urlÀ» ¾Ë ¼ö ¾ø´Ù.)

	if(location.href.indexOf("jheader.htm") < 0)
		{
		eForm.request_uri.value = top.location.href;
		}

	// º¸¾ÈÁ¢¼Ó
	if(eForm.nIsSecure.checked == true)
		{
		eForm.action = "https://client.nownuri.net:8443/access1";
		}
	else
		{
		eForm.action = "http://client.nownuri.net:8080/access1";
		}

	_g_setUserId(eForm);
	return true;
	}

/*
 * ·Î±×¾Æ¿ô
 */
function _g_Logout()
	{
	if(typeof(_g_session) == "object" && _g_session.status >= 2)
		{
		_g_session.disconnect(_g_NownuriTicket);
		}
	else
		{
		window.top.location.replace("http://client.nownuri.net:8080/logout?request_uri=http://www.nownuri.net/nowmain/");
		}
	}

/*
 * ÂÊÁö È®ÀÎ
 */
function _g_Memo() 
	{
	window.open("http://client.nownuri.net:9033/app/recvmemo.cgi","sendform","resizable=no,scrollbars=no,width=500,height=300");
	}

/*
 * ÇÁ·ÎÇÊ º¸±â
 */
function _g_Pf(userid)
	{
    var url = "http://client.nownuri.net:8088/profile2/profile.cgi?";
    url = url + "userid=" + userid;

    var name = "pf" + userid;
    var pfTop = 10;//screen.availHeight /2 - 160;
    var pfLeft = 10;//screen.availWidth /2 - 300;
    var features = "width=500, height=345, toolbar=0, top=" + pfTop + ", left=" + pfLeft;

    window.open(url,name,features);
    return;
	}

/*
 * ·Î±×ÀÎ ¾ÆÀÌµð¸¦ ÀúÀå
 */
function _g_setUserId(eForm) 
	{   
	var expireDate = new Date;
	expireDate.setTime(expireDate.getTime() + 60*60*24*365*100);
	if(eForm.save.checked)
		{
		var tmp = "ByulUser=" + eForm.user.value + "; expires="+expireDate.toGMTString()+"; path=/; domain=nownuri.net;";
		document.cookie = tmp ;
		}
	else
		{
		var tmp = "ByulUser=; expires=-1; path=/; domain=nownuri.net;";
		document.cookie = tmp ;
		}
	var tmpid = "NOW_ID=" + eForm.user.value + "; expires="+expireDate.toGMTString()+"; path=/; domain=nownuri.net;";
	document.cookie = tmpid ;
	}


/*
 * ·Î±×ºÐ¼® °ü·Ã
 */

//document.writeln("<script src='http://www.nownuri.net/script/log/acecounter_main.js'></script>");


function getCookie(CookieName)
{
    var str = document.cookie;
    var searchCookie = CookieName + "=";
    var offsetCookieName;
    var end;

    if (document.cookie.length > 0)
    {
        offsetCookieName = document.cookie.indexOf(searchCookie);
        if ( offsetCookieName != -1)
        {
            end = document.cookie.indexOf(";", offsetCookieName);
            if( end == -1 )
            {
                end = document.cookie.length;
            }

            return unescape(document.cookie.substring(offsetCookieName,end));
        }
        else
        {
            return -1;
        }
    }
    return -1;
}

/*
 * º¸¾ÈÁ¢¼Ó
 */

function setSecureLogin()
{
	if (document.getElementById('nIsSecure').checked == true)
	{
		setSecureLoginCook(0);
	}
	else
	{
		setSecureLoginCook(1);
	}
}

function setSecureLoginCook(mode)
{
	var SecureCookieName = "NownuriSecureLogin";
	var sValue = "NownuriSecureLogin";
	if(mode == 0)
	{
		expireDate = new Date(2016,4,8,0,0,0); 
		document.cookie = SecureCookieName + "=" + escape(sValue) + "; domain=nownuri.net; path=\; expires=" + expireDate.toGMTString()+";";
	}
	else
	{
		expireDate = new Date(1999,4,8,0,0,0); 
        	document.cookie = SecureCookieName + "=" + escape(sValue) + "; domain=nownuri.net; path=\; expires=" + expireDate.toGMTString()+";";   		
	}
}
