var limit = 1;//Cookieの有効期限(14日間)
var imgNo = 0;
//以下、画像のリスト
var imgList = new Array;
imgList[0] = "http://test.morihara.jp/sponichi/_common/img/top/visiual01.jpg";
imgList[1] = "http://test.morihara.jp/sponichi/_common/img/top/visiual02.jpg";
imgList[2] = "http://test.morihara.jp/sponichi/_common/img/top/visiual03.jpg";
imgList[3] = "http://test.morihara.jp/sponichi/_common/img/top/visiual04.jpg";
imgList[4] = "http://test.morihara.jp/sponichi/_common/img/top/visiual05.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();
