﻿<!--
var popup = null;

function getCookie(name)
{
	var first;
	var str = name + "=";

	//alert(document.cookie)

	if(document.cookie.length > 0)
	{
		find = document.cookie.indexOf(str);
		if(find == -1) return;

		first = find + str.length;
		end = document.cookie.indexOf(";", first);
		if(end == -1) end = document.cookie.length;

		return unescape(document.cookie.substring(first, end));
	}
}

function setCookie(name, value, expiredate, path)
{
	var ck = name + "=" + escape(value) + ((expiredate == null) ? "" : (";expires=" + expiredate.toGMTString())) + ";path=/";

	document.cookie = ck;
}

function focusMove()
{
	document.forms[0].elements[0].focus();
}

function banEnter()
{
	if(event.keyCode == 13) { event.returnValue = false; }
}

function openWin(url, name, width, height, left, top, opt)
{
	var x = (screen.width/2) - (width/2);
	var y = (screen.height/2) - (height/2) - 50;

	if(top != null || left != null)
	{
		x = left;
		y = top;
	}

	if(!getCookie(name))
	{
		popup = window.open(url, name, 'width='+width+',height='+height+',left='+x+',top='+y+','+opt);
		popup.focus();
	}
}

function closeWin(url, ck_expires)
{
	if (ck_expires != null)
	{
		if (ck_expires == 0)
		{
			setCookie(window.name, "On");
		}
		else
		{
			var expires = new Date();

			expires.setTime(expires.getTime() + 60*60*24*1000*ck_expires);
			setCookie(window.name, "On", expires);
		}
	}

	if (url != null)
	{
		opener.location = url;
	}

	window.close();
}


function logout()
{
	expireDate = new Date();
	expireDate.setDate(expireDate.getDate()-1);

	setCookie("SESSIONID", "", expireDate);
	setCookie("id", "", expireDate);
	setCookie("email", "", expireDate);
	setCookie("gid", "", expireDate);
	alert("로그아웃 되었습니다. 이용해주셔서 감사합니다.");
	window.location = "/";
}

function check_apply(tno, url)
{
	if (!getCookie("SESSIONID"))
	{
		alert("로그인 하신후 이용하세요.");
		window.location = "/member/login.html?url=" + url;
		return;
	}

	location.href = "/cgi-bin/app_register.cgi?tno=" + tno;
}


function onKeyDownLogin()
{
  if(window.event.keyCode == 13)
  {
    window.event.returnValue = false;
    document.all["UserLogin_btnLogin"].click();
  }
}

function onKeyDownLogin2()
{
  if(window.event.keyCode == 13)
  {
    window.event.returnValue = false;
    document.all["UserLogin_btnLogin2"].click();
  }
}

function onKeyDownSearch()
{
  if(window.event.keyCode == 13)
  {
    window.event.returnValue = false;
    document.all["btnSiteSearch"].click();
  }
}

function onKeyDownSearch2()
{
  if(window.event.keyCode == 13)
  {
    window.event.returnValue = false;
    document.all["btnSubSiteSearch"].click();
  }
}

//-->

