// JavaScript Document

//Cookieよりフォントサイズ適用
function intSize(){
	var str = "sugi_font_size";
	var size = getCookie(str);
		if (size == "L") {
			large();
		} else if (size == "M") {
			middle();
		} else if (size == "S") {
			small();
		} else {
			middle();
		}
//		alert(document.cookie);
}

//大サイズ処理
function large(){
		var element = document.getElementById("new_style");
		SetCookie("sugi_font_size","L");
		element.style.fontSize="18px";
}
//中サイズ処理
function middle(){
		var element = document.getElementById("new_style");
		SetCookie("sugi_font_size","M");
		element.style.fontSize="12px";
}
//小サイズ処理
function small(){
		var element = document.getElementById("new_style");
		SetCookie("sugi_font_size","S");
		element.style.fontSize="10px";
}
//Cookieセット
function SetCookie(key, val){
	document.cookie = key + "=" + escape(val) + ";path=/";
}


//Cookie取得
function getCookie(key) {
	// Cookieから値を取得する
	var cookieString = document.cookie;

	// 要素ごとに ";" で区切られているので、";" で切り出しを行う
	var cookieKeyArray = cookieString.split(";");

	// 要素分ループを行う
	for (var i=0; i<cookieKeyArray.length; i++) {
		var targetCookie = cookieKeyArray[i];

		// 前後のスペースをカットする
		targetCookie = targetCookie.replace(/^\s+|\s+$/g, "");

		var valueIndex = targetCookie.indexOf("=");
		if (targetCookie.substring(0, valueIndex) == key) {
			// キーが引数と一致した場合、値を返す
			return(unescape(targetCookie.slice(valueIndex + 1)));
		}
	}

	return "";
}

