window.onload = function() {
	var chgCont = new Array();
	var seenCont;
chgCont.push("<a href='insurin.html#bot'><img src='common/image/cm.jpg' alt='BOTについて' align='left' width='870' height='220' border='0'>");
chgCont.push("<a href='tonyo.html#metabo'><img src='common/image/cm2.jpg' alt='メタボリックシンドロームと糖尿病' align='left' width='870' height='220' border='0'>");
chgCont.push("<a href='kusuri.html'><img src='common/image/cm3.jpg' alt='自分に合った薬とは？' align='left' width='870' height='220' border='0'>");
chgCont.push("<a href='kusuri.html'><img src='common/image/cm4.jpg' alt='インクレチン関連薬' align='left' width='870' height='220' border='0'>");
var newCont = chgCont[0]; // デフォルトで表示されるもの（クッキーをオフにしている場合など）
	var cExpires;
	var nowDate = new Date();
	nowDate.setDate(nowDate.getDate()+7); //１週間後にクッキー消滅
	cExpires = nowDate.toGMTString();
	var cookieValue = document.cookie;
	var startOfValue = cookieValue.indexOf(" seenCont=");
	if (startOfValue == -1) {
   		startOfValue = cookieValue.indexOf("seenCont=");
   		if (startOfValue == -1) {
      			seenCont = 0;
      			newCont = chgCont[seenCont];
   		}
	}
	if (seenCont != 0) {
   		startOfValue = cookieValue.indexOf("=", startOfValue) + 1;
   		var endOfValue = cookieValue.indexOf(";", startOfValue);
   		if (endOfValue == -1) {
      			endOfValue = cookieValue.length;
   		}
   		seenCont = Number(cookieValue.substring(startOfValue, endOfValue));
   		if (seenCont<chgCont.length-1) {
      			seenCont++;
   		} else {
      			seenCont = 0;
   		}
   		newCont = chgCont[seenCont];
	}
	document.cookie = "seenCont=" + seenCont + ";expires=" + cExpires + ";";
	document.getElementById("dynamicContents").innerHTML = newCont;
};

