//フォントサイズ可変スクリプト　Ver.1.10 ---------------------
// 2007.05.19 修正: KSW Awaya

//設定ここから --------------------------------

//サイズリスト
SizeList = new Array (60,70,74,90,100);

//デフォルトサイズのインデックス数
DefaultKey = 2;

//Bodyタグに挿入するID名
BodyID = "default";

//設定ここまで、以下編集禁止 --------------------------------


if(GetCookie("FontZoom") == "none"){
	WriteCookie("FontZoom", DefaultKey);
}


//document.writeln('<style type="text/css"><!--');
//document.writeln('#'+BodyID+'{font-size: '+SizeList[Number(GetCookie("FontZoom"))]+'%;}');
//document.writeln('//--></style>');
document.writeln('<style type="text/css"><!--');
document.writeln('body{font-size: '+SizeList[Number(GetCookie("FontZoom"))]+'%;}');
document.writeln('--></style>');


function cgfont(value){
	var key = Number(GetCookie("FontZoom"));
	if(value=="large" && key < SizeList.length-1){
		key += 1;
	}else if(value=="small" && key > 0){
		key -= 1;
	}else if(value=="default"){
		key = DefaultKey;
	}
//	if(document.all){
//		document.all(BodyID).style.fontSize = SizeList[key] + "%";
//	}
//	if(document.getElementById){
//		document.getElementById(BodyID).style.fontSize = SizeList[key] + "%";
//	}
	document.body.style.fontSize = SizeList[key] + "%";
	WriteCookie("FontZoom", key);
}


function WriteCookie(name,value){
	tmp = name+"="+value+";";
	tmp += "expires=Fri, 31-Dec-2030 23:59:59;";
	tmp += "path=/;";
	document.cookie = tmp;
}

function GetCookie(value){
	data = document.cookie+";";
	tmp = data.indexOf(value,0);
	if(tmp != -1){
		size = data.substring(tmp,data.length);
		start = size.indexOf("=",0);
		end = size.indexOf(";",start);
		return(unescape(size.substring(start+1,end)));
	}else{
		return "none";
	}
}
