/* フォントサイズの変換 */
/* 元ソース　http://www.savechildren.or.jp/ */

// サイズ大中小で、読み込むべきCSSファイルを定義
cssTagS = '<link href="http://www.hospital.ono.hyogo.jp/shared/small.css" rel="stylesheet" type="text/css" media="all">';
cssTagM = '<link href="http://www.hospital.ono.hyogo.jp/shared/medium.css" rel="stylesheet" type="text/css" media="all">';
cssTagL = '<link href="http://www.hospital.ono.hyogo.jp/shared/large.css" rel="stylesheet" type="text/css" media="all">';

cookiename = "onoFontSize";

function  changeFontSize(s){
	exp=new Date();
	exp.setTime(exp.getTime()+1000*60*60*24*365);
	// 変数 s の値は、0, 1, 2 のどれか。Cookieにこの値を保存して再読み込み。
	document.cookie = cookiename + "=" + s + "; expires=" + exp.toGMTString();
	window.location.reload(true);
}

function LoadFontSize(){
	// Cookieを読み込み、変数を取り出す。
	allCookie = document.cookie+";";
	temp = allCookie.indexOf(cookiename);
	if (temp != -1) {
		temp2 = allCookie.indexOf("=",temp);
		temp3 = allCookie.indexOf(";",temp2);
		value = allCookie.substring(temp2+1, temp3);
	} else {
		value = null;
	}

	// 変数により、CSSのファイルを選択。（変数にURLは定義済み）
	if(value==0){
		document.write(cssTagS);
	}else if(value==1){
		document.write(cssTagM);
	}else if(value==2){
		document.write(cssTagL);
	}else{
		document.write(cssTagM);
	}
}

