/* クッキーを利用してフォントサイズの大きさを記憶させる */
function class_cookielib(){
	this.getCookie = getCookie;
	this.setCookie = setCookie;
	this.removeCookie = removeCookie;
	
	var expireDate = new Date();
	expireDate.setFullYear(expireDate.getFullYear()+1);
	expireStr = "expires=" + expireDate.toUTCString();
	
	function getCookie(name){
	var gc=name+"=";
	var Cookie=document.cookie;
		if (Cookie.length>0) {
			var start=Cookie.indexOf(gc);
			if (start!=-1) {
				start+=gc.length;
				terminus=Cookie.indexOf(";",start);
				if (terminus==-1) terminus=Cookie.length;
					return unescape(Cookie.substring(start,terminus));
				}
			}
			return '';
		}
	
	function setCookie() {
	var key = arguments[0];
	var val = arguments[1];
	var path = (typeof(arguments[2]) != 'undefined' ? arguments[2] : '/');
	var exp = (typeof(arguments[3]) != 'undefined' ? arguments[3] : expireStr);
	var sc = key + "=" + escape(val) + "; path=" + path + "; " + exp;
	document.cookie = sc;
	}
	
	function removeCookie(key,path) {
		if(!path){
		path = '/';
	}
		var rc = key + "=; path=" + path + "; expires=Thu, 28 Jun 2001 00:00:00 UTC";
		document.cookie = rc;
	}
}
var cookieObj = new class_cookielib();


/* フォントサイズを大中小と動的に切り替える */
var fsize_val = 1;
var fsize_css_size = new Array();
fsize_css_size[0] = 'fsize_small.css';
fsize_css_size[1] = '';
fsize_css_size[2] = 'fsize_large.css';

function setFontSize(){
	if(cookieObj.getCookie('fsize') != ''){
		fsize_val = 1 * cookieObj.getCookie('fsize');
	}
	
	if(fsize_css_size[fsize_val]){
		document.write('<link rel="stylesheet" type="text\/css" href="http://www.ushio.co.jp/css/default/' + fsize_css_size[fsize_val] + '" \/>');
	}
}

function changeFontSize(num){
	cookieObj.setCookie('fsize',num,'/','');
	window.location.reload();
}
http://localhost:9001/template.html#
//実際にソースに記述
function outputFontSizeCtrl(){
	
	//「小」ボタン
	if(fsize_val != 0){
	document.write('<a href="#" onclick="changeFontSize(0);return false;"><img src="http://www.ushio.co.jp/images/tw/header/icon_small_def.gif" border="0" width="17" height="16" alt="小" title="小" /></a>');
	} else {
	document.write('<img src="http://www.ushio.co.jp/images/tw/header/icon_small_cur.gif" border="0" width="17" height="16" alt="小" title="小" />');
	}
	
	//「中」ボタン
	if(fsize_val != 1){
	document.write('<a href="#" onclick="changeFontSize(1);return false;"><img src="http://www.ushio.co.jp/images/tw/header/icon_medium_def.gif" border="0" width="17" height="16" alt="中" title="中" /></a>');
	} else {
	document.write('<img src="http://www.ushio.co.jp/images/tw/header/icon_medium_cur.gif" border="0" width="17" height="16" alt="中" title="中" />');
	}
	
	//「大」ボタン
	if(fsize_val != 2){
	document.write('<a href="#" onclick="changeFontSize(2);return false;"><img src="http://www.ushio.co.jp/images/tw/header/icon_large_def.gif" border="0" width="17" height="16" alt="大" title="大" /></a>');
	} else {
	document.write('<img src="http://www.ushio.co.jp/images/tw/header/icon_large_cur.gif" border="0" width="17" height="16" alt="大" title="大" />');
	}
	
	document.write('</p>');
}
