// cookie read write

function getTodayCookieName(prefix) // Written by saboojr : 2002-10-19
{
  var dtCurDate, nYear, nMonth, nDate;

  dtCurDate = new Date();
  	
  nYear = dtCurDate.getFullYear();
  nMonth = dtCurDate.getMonth() + 1;
  nDate = dtCurDate.getDate();
  
  if (typeof(prefix) != 'string' || prefix == '')
    prefix = 'HSJ';
  
  return prefix + nYear.toString() + nMonth.toString() + nDate.toString();
}

function getCookie(name)
{
	var nameOfCookie = name + "=";
	var x = 0;
	  
	while ( x <= document.cookie.length )
	{
		var y = (x + nameOfCookie.length);
		
		if (document.cookie.substring(x,y) == nameOfCookie) {
			if ((endOfCookie = document.cookie.indexOf(";",y)) == -1)
				endOfCookie = document.cookie.length;
	    
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
	  
		x = document.cookie.indexOf( " ", x ) + 1;
	  
		if ( x == 0 )
			break;
	}
	return "";
}

function setCookie(name, value, expiredays)
{
	var todayDate = new Date();
			
	todayDate.setDate( todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// layer pupop cookie
function closeLayerPopup(strName)
{
	setCookie(getTodayCookieName(strName), "ns", 1);
	eval(strName).style.display = 'none';
}

function openLayerPopup(strName)
{
	if (getCookie(getTodayCookieName(strName)) != "ns")
	{
		eval(strName).style.display = 'inline';
		return true;
	}
	return false;
}

function agreeRememberID(obj)
{
	if (obj.checked)
	{
		if (!confirm('ID ÀúÀåÀ» À§ÇØ¼­ ÄíÅ°(Cookie) »ç¿ëÀ» µ¿ÀÇ ÇÏ½Ã°Ú½À´Ï±î?'))
			obj.checked = false;
	}
}
