window.onload = function () {
	getCookie();
}

function setCookie(s){
	cName = "jiminniigata=";
	exp = new Date();
	exp.setTime(exp.getTime() + 31536000000);
	document.cookie = cName + s + "; path=/" + "; expires=" + exp.toGMTString();
}

function getCookie(){
	zoom = "";
	cName = "jiminniigata=";
	tmpCookie = document.cookie + ";";
	start = tmpCookie.indexOf(cName);
	if (start != -1){
		end = tmpCookie.indexOf(";", start);
		zoom = tmpCookie.substring(start + cName.length, end);
		document.getElementById("wrapper").style.fontSize = zoom;
	} else {
		document.getElementById("wrapper").style.fontSize = "100%";
	}
}

/* 小 */
function textSize1(){
		selectSize = "90%";
		document.getElementById("wrapper").style.fontSize = selectSize;
		setCookie(selectSize);
}

/* 中 */
function textSize2(){
		selectSize = "100%";
		document.getElementById("wrapper").style.fontSize = selectSize;
		setCookie(selectSize);
}

/* 大 */
function textSize3(){
		selectSize = "125%";
		document.getElementById("wrapper").style.fontSize = selectSize;
		setCookie(selectSize);
}


/* サイズの取得 */
function getSize(){
	NowSize = "";
	cName = "jiminniigata=";
	tmpCookie = document.cookie + ";";
	start = tmpCookie.indexOf(cName);
	if (start != -1){
		end = tmpCookie.indexOf(";", start);
		NowSize = tmpCookie.substring(start + cName.length, end);
		NowSize = (NowSize.split("%")).join("");
		//alert(parseInt(NowSize));
		return(NowSize);
	} else {
		NowSize = "100";
	}
}




function textSmaller(){
	//60%を下限
	selectSize = "";
	selectSize = parseInt(getSize()) - 20;
	if (parseInt(selectSize) < 60){
	}else{
		selectSize = selectSize + "%";
		document.getElementById("wrapper").style.fontSize = selectSize;
		setCookie(selectSize);
	}
}

function textLarger(){
	//160%を上限
	selectSize = getSize();
	if(selectSize != undefined){
		selectSize = parseInt(getSize());
	}else{
		selectSize = '100';
	}
	selectSize = parseInt(selectSize) + 20;
	if (parseInt(selectSize) > 160){
	}else{
		selectSize = selectSize + "%";
		document.getElementById("wrapper").style.fontSize = selectSize;
		setCookie(selectSize);
	}
}

function textStandard(){
	selectSize = "100%";
	document.getElementById("wrapper").style.fontSize = selectSize;
	setCookie(selectSize);
}
