//フォントサイズの拡大・縮小
var typenum = "";
typenum = eval(getCookie('style'));
if(!typenum){typenum=2;}
//var typeList=new Array('ss','s','medium','l','ll');
var typeList=new Array('S','M','L');
value_style=typeList[typenum-1];

//読み込んだときにCookieからstyleを読み込んでcssを書き出す
function setCss() {
document.write('<link href="/css/font' + value_style + '.css" rel="stylesheet" type="text/css" media="all" />');
}

//Cookieの取り出し（慣用的）
function getCookie(name) {
	var cookieStr = document.cookie;
	var existNum = cookieStr.indexOf(name);
	if(existNum != -1)
	{
		start = existNum + name.length + 1;
		end = cookieStr.indexOf(";" , start);
		if(end == -1){end = cookieStr.length;}
		var cookieValue = cookieStr.substring(start,end);
		return cookieValue;
	}
	else{return "";}
}


//Cookieに選択したタイプ（S,M,L）を書き込む
function setStyle(num) {
	if(num){
	//typenum+=num;
	typenum = num;
	if( 1 > typenum ){ typenum="1"; }else if( typenum > 3){ typenum="3"; }
	}
	styletype=typenum;
	sizeString='style=';
	sizeString+=escape(styletype);
	sizeString+= "; path=/";
	document.cookie =sizeString ;
	window.location.reload();
}

//document.write(cssName);
setCss();

function fontsize_change() {
	var c = getCookie("style");
	var s = "";
	if(c == 1) {
		s += '<a href="#" onclick="setStyle(1); return false;" class="current"><img src="/img/small.gif" /></a>';
	} else {
		s += '<a href="#" onclick="setStyle(1); return false;"><img src="/img/small_g.gif" /></a>';
	}
	if(c == 2 || !c) {
		s += '<a href="#" onclick="setStyle(2); return false;" class="current"><img src="/img/medium.gif" /></a>';
	} else {
		s += '<a href="#" onclick="setStyle(2); return false;"><img src="/img/medium_g.gif" /></a>';
	}
	if(c == 3) {
		s += '<a href="#" onclick="setStyle(3); return false;" class="current"><img src="/img/large.gif" /></a>';
	} else {
		s += '<a href="#" onclick="setStyle(3); return false;"><img src="/img/large_g.gif" /></a>';
	}
	document.write(s);
}

/*
function sav_cook()
{
	coknam = "jssample";
	coktxt = document.frm1.txt1.value;
	day0 = new Date();
	day0.setTime(day0.getTime()+60*60*24*1000);
	endday = day0.toGMTString();
	document.cookie = coknam+"="+escape(coktxt)+";expires="+endday;
}
*/
