cookiename = "strval";
path="/";

function fontsizeChange(val)
{
	if (document.getElementById && document.createElement) {
		document.getElementById('all').className = val;
		weektime = 60 * 1000 * 60 * 24 * 7;
		expiresdate = addTime(new Date(), weektime);
		document.cookie = cookiename + "=" + val + ";expires=" + expiresdate + ";path=" + path;
		switch (val) {
			case 'font-superlarge':
				document.getElementById('fs1').style.backgroundPosition = 'bottom';
				document.getElementById('fs2').style.backgroundPosition = 'top';
				document.getElementById('fs3').style.backgroundPosition = 'top';
				break;
			case 'font-large':
				document.getElementById('fs1').style.backgroundPosition = 'top';
				document.getElementById('fs2').style.backgroundPosition = 'bottom';
				document.getElementById('fs3').style.backgroundPosition = 'top';
				break;
			case 'font-normal':
				document.getElementById('fs1').style.backgroundPosition = 'top';
				document.getElementById('fs2').style.backgroundPosition = 'top';
				document.getElementById('fs3').style.backgroundPosition = 'bottom';
				break;
		}
		if(document.getElementById('ajax-all')) {
			jQuery.noConflict();
			var $ = jQuery;
			var max = 0;
			$(".banner-box").each(function(){
				$(this).css("height",'');
				if ($(this).height() > max)
					max = $(this).height();
			});
			$(".banner-box").css("height",max);
		} else {
			jQuery.noConflict();
			var $ = jQuery;
			var max = 0;
			var max2 = 0;
			var max3 = 0;
			$(".box-bottom").each(function(){
				$(this).css("height",'');
				if ($(this).height() > max)
					max = $(this).height();

			});
			$(".photo h2").each(function(){
				$(this).css("height",'');
				if ($(this).height() > max2)
					max2 = $(this).height();

			});
			$(".top-box dl").each(function(){
				$(this).css("height",'');
				if ($(this).height() > max3)
					max3 = $(this).height();

			});
			$(".box-bottom").css("height",max);
			$(".photo h2").css("height",max2);
			$(".top-box dl").css("height",max3);
			
		}
    } else {
        alert('あなたのブラウザは文字サイズ変更未対応です。');
    }
}

function addTime(date, time) {
    date.setTime(date.getTime() + time);
    return date.toGMTString();
}

function getCookieValue(key) {
	var cookies = document.cookie.split("; ");
	for (var i = 0; i < cookies.length; i++) {
		var str = cookies[i].split("=");
		if (str[0] == key) {
			var cookie_value = unescape(str[1]);
			break;
		}
	}
    return cookie_value;
}

function getCookie(){
	document.getElementById('fs3').style.backgroundPosition = 'bottom';
	if (document.cookie) {
        strval = getCookieValue(cookiename);
        if (strval != null) {
            fontsizeChange(strval);
        }
    }
}
