function setCookie(theName,theValue,theDay)
{
	if ((theName != null) && (theValue != null))
	{
		expDay = "Wed, 01 Jan 2020 18:56:35 GMT";	// 沒有指定的話就是2020年
		if (theDay != null)
		{
			theDay = eval(theDay);	// 就算是字串的話也設定成數值
			setDay = new Date();
			setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
			expDay = setDay.toGMTString();
		}
		document.cookie = theName + "="+escape(theValue)+";expires="+expDay;
		return true;
	}
	return false;
}

function deleteCookie(theName)
{
	document.cookie = theName + "=;expires=Thu,01-Jan-70 00:00:01 GMT";
	return true;
}

function getCookie(theName)
{
	theName += "=";	// 新增=（等號）並省略搜尋
	theCookie = document.cookie+";";	// 搜尋時最後一個項目要避免為-1
	start = theCookie.indexOf(theName);	// 搜尋所指定的名稱
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		return unescape(theCookie.substring(start+theName.length,end));
	}
	return false;
}
