// ÄíÅ°Á¤º¸ °¡Á®¿À±â
function getCookie(strName)
{
	var strArg = new String(strName + "=");	
	var nArgLen, nCookieLen, nEnd;
	var i = 0, j;

	nArgLen    = strArg.length;
	nCookieLen = document.cookie.length;

	if(nCookieLen > 0) {
		while(i < nCookieLen) {
			j = i + nArgLen;
			if(document.cookie.substring(i, j) == strArg) {
				nEnd = document.cookie.indexOf (";", j);
				if(nEnd == -1) nEnd = document.cookie.length;
				return unescape(document.cookie.substring(j, nEnd));
			}
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
	}
	return("");
}

function handleEnter (field, event) 
{ 
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; 
	if (keyCode == 13) 
	{ 
		fLoginCtrl();
	} 
	else 
	return true; 
}      

var strLoginId = getCookie("USR_ID");
var strLoginNm = getCookie("USR_NM");
var intLoginCnt = getCookie("LOGIN_CNT");
var strMemLevel = parseInt(getCookie("USR_LEVEL"));

function fLogin(intMenuNo)
{
	document.writeln("<table width=100% border=0 cellspacing=0 cellpadding=0>");
	document.writeln("<tr> ");
	document.writeln("	<td><a href='/'><img src=/common_img/img_main_logo.gif width=204 height=125 border='0'></a></td>");
	document.writeln("</tr>");
	document.writeln("<tr>");
	document.writeln("	<td align=center>");
	if (strLoginId == "")
	{	
		document.writeln("	<table width=160 border=0 cellspacing=0 cellpadding=0>");
		document.writeln("	<form name='LoginForm' method='post'>");
		document.writeln("	<tr> ");
		document.writeln("		<td></td>");
		document.writeln("		<td height=9></td>");
		document.writeln("	</tr>");
		document.writeln("	<tr> ");
		document.writeln("		<td><input type=text name=LOGIN_ID tabindex='1' size=15 style='background-color:#FFFFFF;border:1 solid #DCDCDC; FONT-FAMILY: µ¸¿ò; FONT-SIZE: 9pt' onkeypress='return handleEnter(this, event);'></td>");
		document.writeln("		<td width=55 rowspan=2><a href='javascript:fLoginCtrl();'><img src=/common_img/btn_login.gif tabindex='3' width=55 height=37 border=0></a></td>");
		document.writeln("	</tr>");
		document.writeln("	<tr> ");
		document.writeln("		<td><input type=password name=LOGIN_PWD tabindex='2' size=15 style='background-color:#FFFFFF;border:1 solid #DCDCDC; FONT-FAMILY: µ¸¿ò; FONT-SIZE: 9pt' onkeypress='return handleEnter(this, event);'></td>");
		document.writeln("	</tr>");
		document.writeln("	<tr> ");
		document.writeln("		<td height=15></td>");
		document.writeln("		<td></td>");
		document.writeln("	</tr>");
		document.writeln("	<tr> ");
		document.writeln("		<td colspan=2  align=center>");
		document.writeln("		<a href='/member/member_info.htm'><img src=/common_img/btn_registration.gif width=49 height=11 align=absmiddle border='0'></a> &nbsp;&nbsp;");
		document.writeln("		<a href='/member/MemSearchForm.asp'><img src=/common_img/btn_idpw_search.gif width=93 height=12 align=absmiddle border='0'></a>");
		document.writeln("		</td>");
		document.writeln("	</tr>");
		document.writeln("	</form>");
		document.writeln("	</table>");
	}
	else
	{
		document.writeln("<table width=150 border=0 cellspacing=0 cellpadding=0>");
		document.writeln("<tr> ");
		document.writeln("	<td height=9></td>");
		document.writeln("</tr>");
		if (strMemLevel >= 25)
		{
			document.writeln("<tr> ");
			document.writeln("	<td align='center'><a href='/manager/' target='_blank'><font color='blue'><b>°ü¸®ÀÚ ÆäÀÌÁö</b></font></a></td>");
			document.writeln("</tr>");
		}
		document.writeln("<tr> ");
		document.writeln("	<td><img src=/common_img/img_main_smile.gif width=15 height=15 align=absmiddle> <strong>"+strLoginNm+"´Ô </strong></td>");
		document.writeln("</tr>");
		document.writeln("<tr> ");
		document.writeln("	<td style=padding-left:15pt>"+intLoginCnt+"¹øÂ° ¹æ¹®ÀÌ½Ê´Ï´Ù.</td>");
		document.writeln("</tr>");
		document.writeln("<tr> ");
		document.writeln("	<td height=20  align=right valign=bottom><font class=c7>");
		document.writeln("<a href='/member/ModInterFase.asp'>°³ÀÎÁ¤º¸¼öÁ¤</a>");
		document.writeln("</font><a href='javascript:fLogOut();'><img src=/common_img/btn_logout.gif width=41 height=12 align=absmiddle border='0'></a></td>");
		document.writeln("</tr>");
		document.writeln("</table>");
	}	
	document.writeln("	</td>");
	document.writeln("</tr>");
	document.writeln("<tr> ");
	document.writeln("	<td><img src=/common_img/img_left_menu_line.gif width=204 height=12></td>");
	document.writeln("</tr>");
	document.writeln("<tr> ");
	document.writeln("	<td>");
	document.writeln("	<table width=100% border=0 cellspacing=0 cellpadding=0>");
	document.writeln("	<tr> ");
	if (intMenuNo == 1)
	{
		document.writeln("		<td><a href='/about/alumni_greeting.htm'><img src=/common_img/img_menu_01_on.gif width=204 height=41 border='0'></a></td>");
	}
	else
	{
		document.writeln("		<td><a href='/about/alumni_greeting.htm'><img src=/common_img/img_menu_01_off.gif width=204 height=41 border='0'></a></td>");
	}
	document.writeln("	</tr>");
	document.writeln("	<tr> ");
	if (intMenuNo == 2)
	{
		document.writeln("		<td><a href='/applicants/application.asp?BbsId=schedule'><img src=/common_img/img_menu_02_on.gif width=204 height=41 border='0'></a></td>");
	}
	else
	{
		document.writeln("		<td><a href='/applicants/application.asp?BbsId=schedule'><img src=/common_img/img_menu_02_off.gif width=204 height=41 border='0'></a></td>");
	}
	document.writeln("	</tr>");
	document.writeln("	<tr> ");
	if (intMenuNo == 3)
	{
		document.writeln("		<td><a href='/alumni/BbsList.asp?BbsId=alumninews'><img src=/common_img/img_menu_03_on.gif width=204 height=41 border='0'></td>");
	}
	else
	{
		document.writeln("		<td><a href='/alumni/BbsList.asp?BbsId=alumninews'><img src=/common_img/img_menu_03_off.gif width=204 height=41 border='0'></td>");
	}
	document.writeln("	</tr>");
	document.writeln("	<tr> ");
	if (intMenuNo == 4)
	{
		document.writeln("		<td><a href='/sponsors/Sponsors.asp?BbsId=sponsors'><img src=/common_img/img_menu_04_on.gif width=204 height=41 border='0'></a></td>");
	}
	else
	{
		document.writeln("		<td><a href='/sponsors/Sponsors.asp?BbsId=sponsors'><img src=/common_img/img_menu_04_off.gif width=204 height=41 border='0'></a></td>");
	}
	document.writeln("	</tr>");
	document.writeln("	</table>");
	document.writeln("	</td>");
	document.writeln("</tr>");
	document.writeln("</table>");
	document.writeln("<iframe name='CtrlBox' src='' width='0' height='0' frameborder='0' marginwidth='0' marginheight='0'></iframe>");
}

function fTop()
{
	document.writeln("<table width=100% height=28 border=0 cellpadding=0 cellspacing=0>");
	document.writeln("<tr> ");
	document.writeln("<td width=324></td>");
	document.writeln("	<td width=35><a href='/'><img src=/common_img/img_footer_menu_01.gif width=35 height=7 border='0'></a></td>");
	document.writeln("	<td width=49><a href='/member/english.htm'><img src=/common_img/img_footer_menu_02.gif width=49 height=7 border='0'></a></td>");
	document.writeln("	<td width=67><a href='/member/member_info.htm'><img src=/common_img/img_footer_menu_03.gif width=67 height=7 border='0'></a></td>");
	document.writeln("	<td width=33><a href='/member/help_info.htm'><img src=/common_img/img_footer_menu_04.gif width=33 height=7 border='0'></a></td>");
	document.writeln("	<td width=60><a href='mailto:webmaster@dukemba.or.kr'><img src=/common_img/img_footer_menu_05.gif width=60 height=7 border='0'></a></td>");
	document.writeln("	<td width=54><a href='/member/sitemap.htm'><img src=/common_img/img_footer_menu_06.gif width=54 height=7 border='0'></a></td>");
	document.writeln("</tr>");
	document.writeln("</table>");
}
function fLoginCtrl()
{
	if (document.LoginForm.LOGIN_ID.value == "")
	{
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		document.LoginForm.LOGIN_ID.focus();
		return;
	}

	if (document.LoginForm.LOGIN_PWD.value == "")
	{
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		document.LoginForm.LOGIN_PWD.focus();
		return;
	}

	CtrlBox.location.href = "/member/MemLoginCtrl.asp?UsrId="+document.LoginForm.LOGIN_ID.value+"&UsrPwd="+document.LoginForm.LOGIN_PWD.value;
}
// ÄíÅ° »èÁ¦
function delCookie( name )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate()-1 );
	document.cookie = name+"=; domain=dukemba.or.kr; path=/; expires="+todayDate.toGMTString()+";";
}

function fLogOut()
{
	delCookie("USR_ID");
	delCookie("USR_NM");
	delCookie("USR_LEVEL");
	window.location.href = '/';
}

function fBottom()
{
	document.writeln("<img src='/common_img/img_footer.gif' width='944' height='65'>");
}

