
function setCookie(s){
	cName = "DPA=";
	exp = new Date();
	exp.setTime(exp.getTime() + 31536000000);
	document.cookie = cName + s + "; path=/" + "; expires=" + exp.toGMTString();
}

function getCookie(){
	zoom = "";
	cName = "DPA=";
	tmpCookie = document.cookie + ";";
	start = tmpCookie.indexOf(cName);
	if (start != -1)
	{
		end = tmpCookie.indexOf(";", start);
		zoom = tmpCookie.substring(start + cName.length, end);
		document.getElementById("top").style.fontSize = zoom;
	} else {
		document.getElementById("top").style.fontSize = "small";
	}
}

function textSizeUp(){
	currentSize = document.getElementById("top").style.fontSize;
	selectSize = "";
	if ( currentSize == "small" || !currentSize ){
		selectSize = "100%";
	}
	else if ( currentSize == "100%" ){
		selectSize = "120%";
	}
	else if ( currentSize == "120%" ){
		selectSize = "160%";
	}
	else if ( currentSize == "160%" ){
		m = escape("これ以上文字サイズを大きくはできません。");
		alert(unescape(m));
		selectSize = "160%";
	}
	else {
		selectSize = "small";
	}
	document.getElementById("top").style.fontSize = selectSize;
	setCookie(selectSize);
}

function textSizeDown(){
	currentSize = document.getElementById("top").style.fontSize;
	selectSize = "";
	if ( currentSize == "200%" ){
		selectSize = "180%";
	}
	else if ( currentSize == "180%" ){
		selectSize = "160%";
	}
	else if ( currentSize == "160%" ){
		selectSize = "120%";
	}
	else if ( currentSize == "120%" ){
		selectSize = "100%";
	}
	else if ( currentSize == "100%" ){
		selectSize = "small";
	}
	else {
		m = escape("これ以上文字サイズを小さくはできません。");
		alert(unescape(m));
		selectSize = "small";
	}
	document.getElementById("top").style.fontSize = selectSize;
	setCookie(selectSize);
}
