﻿//フォントサイズ可変スクリプト　Ver.1.10 ---------------------

//設定ここから --------------------------------

//サイズリスト
SizeList = new Array (80,100,105);

//デフォルトサイズのインデックス数
DefaultKey = 0;

//Bodyタグに挿入するID名
BodyID = "Body";

//フォントサイズ変更ボタンを押したときのパラメータ
ChangeFontSizeList = new Array ('small','default','large');
//フォントサイズ変更ボタンのID
ChangeFontSizeImageIdList = new Array ('cgfont_small','cgfont_default','cgfont_large');
////フォントサイズ変更ボタン未選択時のイメージ
//ChangeFontSizeImageDisableList = new Array ('Portals/0/image/header/btn_txtS.gif','Portals/0/image/header/btn_txtM.gif','Portals/0/image/header/btn_txtL.gif');
////フォントサイズ変更ボタン選択時のイメージ
//ChangeFontSizeImageEnableList = new Array ('Portals/0/image/header/btn_txtS_ov.gif','Portals/0/image/header/btn_txtM_ov.gif','Portals/0/image/header/btn_txtL_ov.gif');

//設定ここまで、以下編集禁止 --------------------------------
if(GetCookie("StudioRikiyFSS") == "none"){
	key = DefaultKey;
}else if (!isNaN(GetCookie("StudioRikiyFSS"))){
	key = Number(GetCookie("StudioRikiyFSS"));
}else{
	key = DefaultKey;
}

document.writeln('<style type="text/css"><!--');
document.writeln('#'+BodyID+'{font-size: '+SizeList[key]+'%;}');
document.writeln('//--></style>');

function cgfont(value){
/*
	if(value=="large" && key < SizeList.length-1){
		key += 1;
	}else if(value=="small" && key > 0){
		key -= 1;
	}else if(value=="default"){
		key = DefaultKey;
	}
*/
	key = DefaultKey;
	for(i=0; i < ChangeFontSizeList.length; i++)
	{
		if (ChangeFontSizeList[i] == value) key = i;
	}
	
	size = SizeList[key] + "%";
	if(document.all){
		document.all(BodyID).style.fontSize = size;
	}
	if(document.getElementById){
		document.getElementById(BodyID).style.fontSize = size;
	}
	WriteCookie("StudioRikiyFSS",key)
}

function WriteCookie(name,value){
	tmp = name+"="+value+";";
	tmp += "expires=Fri, 31-Dec-2030 23:59:59;";
	tmp += "path=/;";
	document.cookie = tmp;
}

function GetCookie(value){

	data = document.cookie+";";
	tmp = data.indexOf(value,0);
	if(tmp != -1){
		size = data.substring(tmp,data.length);
		start = size.indexOf("=",0);
		end = size.indexOf(";",start);
		return(unescape(size.substring(start + 1,end)));
	}else{
		return "none";
	}
}



/*----ロールオーバー---*/

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}


/* Google Anyliticsコード */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16896999-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


