//文字サイズ切替
function fontChange(size){
	switch(size){
		case "small":
			document.body.style.fontSize = "70%";
		break;
		case "medium":
			document.body.style.fontSize = "80%";
		break;
		case "big":
			document.body.style.fontSize = "95%";
		break;
		default:
			return;
		break;
	}
	CookieWrite("font_size",size,365);
}

//Cookie書き込み
function CookieWrite(kword, kdata, kday) {

	// クッキーが利用可能かどうか
	if(!navigator.cookieEnabled){
		return;
	}
	sday = new Date();
	sday.setTime(sday.getTime() + (kday * 1000 * 60 * 60 * 24));
	s2day = sday.toGMTString();

	document.cookie = kword + "=" + kdata + ";expires=" + s2day + ";path=/diet-youki.jp;";
}

//Cookie読み込み
function CookieRead(kword) {


	if(typeof(kword) == "undefined"){
		return;															// 何もしないで戻る
	}
	kword = kword + "=";
	kdata = "";
	scookie = document.cookie + ";";									// クッキー情報を読み込む
	start = scookie.indexOf(kword);										// キーワードを検索
	if (start != -1){													// キーワードと一致するものあり
  		end = scookie.indexOf(";", start);								// 情報の末尾位置を検索
		kdata = unescape(scookie.substring(start + kword.length, end));	// データ取り出し
	}

	fontChange(kdata);
}
