// 쿠키 설정하기 ##################################################
function setCookie(name, value, expiredays) {
	var value = name+"="+escape(value)+"; path=/;";
	if (typeof(expiredays) != "undefined") {
		var todayDate = new Date();
		todayDate.setDate(todayDate.getDate()+expiredays);
		value += " expires="+todayDate.toGMTString()+";";
	}
	document.cookie = value;
}

// 쿠키 가져오기 ##################################################
function getCookie(name) {
	var arg = new String(name+"=");
	var argLen, cookesLen, end;
	var i = 0, j;

	argLen = arg.length;
	cookesLen = document.cookie.length;

	if (cookesLen > 0) {
		while (i < cookesLen) {
			j = i + argLen;
			if (document.cookie.substring(i, j) == arg) {
				end = document.cookie.indexOf (";", j);
				if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(j, end));
			}

			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
	}
	return("");
}

