/* 
 スタイル読み込みスクリプト ReadStyle.js


/* ----------------- 変数宣言 -------------------*/
var FontSize;
var BGColor;
var Unit;
var Obj;

Units = new Array('%','px','pt','em');

/* ----------------- 初期設定 -------------------*/
/* IDの指定 */
//文字サイズを変更したい要素のID
Obj = 'container';
footer = 'footermenu';
title = 'gtitle';
right = 'rightselectbox';
rightframe = 'rightframe';
rightword = 'word';

/* サイズの単位（0 = %、1 = px、2 = pt, 3= em） */
Unit = 0;

/* Cookieの有効期限（日数） */
ExpireDays = 30;


/* -------------------- 実　行 ---------------------*/
ReadCookie();

/* -------------------- 関　数 ---------------------*/
/* Cookie呼出 */
function ReadCookie() {
	if (document.cookie) {
		Cookie = document.cookie;
		if (Cookie.match(/FontSize=([\d.]*)/)) {
			FontSize = RegExp.$1;
		}
		i = j = 0;
		tmp1 = " " + document.cookie + ";";
		while (i < tmp1.length) {
			j = tmp1.indexOf(";", i);
			tmp2 = tmp1.substring(i + 1, j);
			k = tmp2.indexOf("=");
			if (tmp2.substring(0, k) == "BGColor") {
				BGColor = unescape(tmp2.substring(k + 1, j - i - 1));
			}
			i = j + 1;
		}
	}
}

/* スタイル変更 */
function SetStyle() {
	if (FontSize != null) {
		document.getElementById(Obj).style.fontSize = FontSize + Units[Unit];
	}
	if (BGColor != null) {
		if(BGColor=="#000000"){
			document.getElementById(Obj).style.backgroundColor = BGColor;
			document.getElementById(Obj).style.color = "#FFFFFF";
			document.getElementById(footer).style.backgroundColor = "#333333";
			document.getElementById(footer).style.color = "#FFFFFF";
			if(document.getElementById(title)){
				document.getElementById(title).style.color = BGColor;
			}
			for(var i=0; i<document.links.length; i++) {
				if(document.links[i].className == "linkcolor"){
				document.links[i].style.color="#000000";
				}else{
				document.links[i].style.color="#FFFFFF";
				}
			}
		}
		document.getElementById(Obj).style.backgroundColor = BGColor;
	}
}

