/* クッキー */

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, 1 Jan 1970 00:00:00 UTC";

		document.cookie = rc;

	}

}

var cookieObj = new class_cookielib();



/* FONT SIZE */

var fsize_val = 1;

var fsize_css_size = new Array();

fsize_css_size[0] = '/hib/common/css/font_small.css';

fsize_css_size[1] = '';

fsize_css_size[2] = '/hib/common/css/font_big.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="' + fsize_css_size[fsize_val] + '" \/>');

	}

}

function changeFontSize(num){

	cookieObj.setCookie('fsize',num,'/','');

	window.location.reload();

}

function outputFontSizeCtrl(){

	document.write('<ul class="textsize">');
    document.write('<li><img src="/hib/common/img/textsize.gif" alt="文字サイズ変更" width="112" height="23" /></li><!--');
		if(fsize_val != 2){
		document.write('--><li><a href="#" onclick="changeFontSize(2);return false;"><img src="/hib/common/img/textsize_01_off.gif" alt="大きく" width="57" height="23"  /></a></li><!--');
		} else {
		document.write('--><li><img src="/hib/common/img/textsize_01_on.gif" alt="大きく" width="57" height="23" /></li><!--');
		}

		if(fsize_val != 0){
		document.write('--><li><a href="#" onclick="changeFontSize(0);return false;"><img src="/hib/common/img/textsize_02_off.gif" alt="小さく" width="54" height="23" /></a></li><!--');
		} else {
		document.write('--><li><img src="/hib/common/img/textsize_02_on.gif" alt="小さく" width="54" height="23" /></li><!--');
		}

		if(fsize_val != 1){
		document.write('--><li><a href="#" onclick="changeFontSize(1);return false;"><img src="/hib/common/img/textsize_03_off.gif" alt="標準" width="58" height="23" /></a></li>');
		} else {
		document.write('--><li><img src="/hib/common/img/textsize_03_on.gif" alt="標準" width="58" height="23" /></li>');
		}

	document.write('</ul>');
}

