function SetCookie(CookieName,CookieValue,CookieTimeoutDay){
var ExpaDate=new Date();//過期時間
var Timeout=CookieTimeoutDay*24*60*60*1000;
ExpaDate.setTime(ExpaDate.getTime()+Timeout);
document.cookie=CookieName+"="+escape(CookieValue)+";expires="+ExpaDate.toGMTString();
}
function GetCookie(CookieName){
var Result="";
var MyCookie=""+document.cookie+";";//Cookieを取る
var SearchName=CookieName+"=";
var StartOfCookie=MyCookie.indexOf(SearchName);//CookieにCookieNameの位置を取る
var EndOfCookie;
if(StartOfCookie!=-1){
StartOfCookie+=SearchName.length;//"="以降のCookieValueの開始位置
EndOfCookie=MyCookie.indexOf(";",StartOfCookie);
Result=unescape(MyCookie.substring(StartOfCookie,EndOfCookie));
}
return Result;
}
function ClearCookie(CookieName){
var ThreeDays=3*24*60*60*1000;
var expDate=new Date();
expDate.setTime(expDate.getTime()-ThreeDays);
document.cookie=CookieName+"="+escape("")+";expires="+expDate.toGMTString();
}