
/* クッキー */
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();

function onresize_handler(){
	if(document.layers){
		window.location.reload();
	}
}
window.onresize = onresize_handler;

/* テキストサイズの変更 */
var txtsize_val = 0;
var txtsize_css_size = new Array();
txtsize_css_size[0] = '100%';
txtsize_css_size[1] = '120%';
txtsize_css_size[2] = '140%';


function setTextSize(fl_update){
	if(cookieObj.getCookie('txtsize') != ''){
		txtsize_val = 1 * cookieObj.getCookie('txtsize');
	}
	document.write('<style type="text/css">');
	document.write('div#wrap { font-size:' + txtsize_css_size[txtsize_val] + '; }');
	/*document.write('* html body div#wrap th { font-size:' + txtsize_css_size[txtsize_val] + '; }');
	document.write('* html body div#wrap td { font-size:' + txtsize_css_size[txtsize_val] + '; }');*/
	document.write('</style>');
	
	
	if (txtsize_val == 0){
		document.write('<style type="text/css">');
		document.write('div#head dl dd#fontsize_small a { background: url(/common/images/head/fontsize_small.gif) 0 -27px no-repeat; }');
		document.write('</style>');
	}
	
	else{
		if(txtsize_val == 2){
			document.write('<style type="text/css">');
			document.write('div#head dl dd#fontsize_large a { background:url(/common/images/head/fontsize_large.gif) 0 -27px no-repeat; }');
			document.write('</style>');
		}
		else{
			document.write('<style type="text/css">');
			document.write('div#head dl dd#fontsize_middle a { background: url(/common/images/head/fontsize_middle.gif) 0 -27px no-repeat; }');
			document.write('</style>');
	  }
	}
	
}


function largeTextSize(){
	var fl_update = false;
	var tmp_val = 2;
	if(tmp_val >= 2 && tmp_val < txtsize_css_size.length){
		txtsize_val = tmp_val;
		fl_update = true;
	}
	if(fl_update){
		cookieObj.setCookie('txtsize',txtsize_val,'/','');
		window.location.reload();
	}
}

function mediumTextSize(){
	var fl_update = false;
	var tmp_val = 1;
	if(tmp_val >= 1 && tmp_val < txtsize_css_size.length){
		txtsize_val = tmp_val;
		fl_update = true;
	}
	if(fl_update){
		cookieObj.setCookie('txtsize',txtsize_val,'/','');
		window.location.reload();
	}
}


function defaultTextSize(){
	var fl_update = false;
	var tmp_val = 0;
	if(tmp_val >= 0 && tmp_val < txtsize_css_size.length){
		txtsize_val = tmp_val;
		fl_update = true;
	}
	if(fl_update){
		cookieObj.setCookie('txtsize',txtsize_val,'/','');
		window.location.reload();
	}
}





