// JavaScript Document
var limit = 14;//Cookieの有効期限(14日間)
var imgNo = 0;
//以下、画像のリスト
var imgList = new Array;
imgList[0] = "images/mainimg01.jpg";
imgList[1] = "images/mainimg02.jpg";


//if(document.cookie.length > 0) imgNo = parseInt(document.cookie.substring(6,99));
function getCookie(key) {
tmp = document.cookie + ";";
tmp1 = tmp.indexOf(key, 0);
if (tmp1 == -1) {
return "";
}
tmp = tmp.substring(tmp1, tmp.length);
start = tmp.indexOf("=", 0) + 1;
end = tmp.indexOf(";", start);
return (unescape(tmp.substring(start, end)));
}
var cook1 = getCookie("imgNo");
if (cook1 == "") {
imgNo = 0;
} else {
imgNo = parseInt(cook1);
}
document.write("<img src=\"" + imgList[imgNo] + "\" alt=\"\">");
if (++imgNo >= imgList.length) {
imgNo = 0;
}
var d = new Date();
d.setTime(d.getTime() + 24 * limit * 60 * 60 * 1000);
document.cookie = "imgNo=" + imgNo + " ; expires=" + d.toGMTString();
