(function(){
	var bgSrc = ['contents_foot_bg.gif','contents_foot_bg02.gif','contents_foot_bg03.gif'];
	document.write('<style type="text/css">#document{background-image:url(/img/common/element/' + bgSrc[Math.floor(Math.random()*bgSrc.length)] + ')}</style>');
})();


/*
===========================================================
	フォントサイズ変更スクリプト（タイプC）
===========================================================
*/


/*
========== ::: 初期設定 ::: ==========
*/

// 値の単位を設定（必ずダブルクオートかクオートで括る）
var fontSizeUnit = "%";

// 一回の操作で変化させる値を設定（ダブルクオートやクオートで括らない）
var perOrder = 11;

// 初期状態の値を設定（ダブルクオートやクオートで括らない）
var defaultSize = 85;

// クッキーの名前（必ずダブルクオートかクオートで括る）
var ckName = "FSC";

// クッキーの有効期限（日）（ダブルクオートやクオートで括らない）
var ckDays = 1;

// クッキーのパス（必ずダブルクオートかクオートで括る。指定が不要の場合は"/"にする）
var ckPath = "/"


/*
========== ::: ページ読み込み時の値を設定 ::: ==========
*/

// クッキー読み出し
var fsCK = GetCookie( ckName );

if ( fsCK == null ){
  var currentSize = defaultSize;          //クッキーが無ければ現在の値を初期状態の値に設定
}
else{
  var currentSize = parseInt( fsCK );          //クッキーがあれば現在の値をクッキーの値に設定
}


/*
========== ::: head内にstyle要素を出力 ::: ==========
*/
document.writeln( '<style type="text/css">' );
document.write( 'body{font-size:' + currentSize + fontSizeUnit+ '}' );
document.writeln( '</style>' );


/*===================================
  [関数 fsc]
  引数CMDに渡される値に応じて
  変更後の値を算出しクッキーに書き込む。
====================================*/

function fsc( CMD ){

  // 拡大：現時点の値に一回の操作で変化させる値を加えて操作後の値"newSize"に代入
  if ( CMD == "larger" ){
    var newSize = Number( currentSize + perOrder );
    SetCookie( ckName , newSize );          //クッキー書き込み
  }

  // 縮小：現時点の値から一回の操作で変化させる値を引き操作後の値に代入
  // 現時点のサイズの値が一回の操作で変化させる値と同じならそのまま操作後の値に代入
  if ( CMD == "smaller" ){
    if ( currentSize != perOrder ){
      var newSize = Number( currentSize - perOrder );
      SetCookie( ckName , newSize );          //クッキー書き込み
    }
    else{
      var newSize = Number( currentSize );
    }
  }

  // 元に戻す：操作後の値を初期値にする
  if ( CMD == "default" ){
    DeleteCookie( ckName );          //クッキー削除
  }

  // ページの再読み込み
  // 再読み込みをすることで変更後の値を反映したstyle要素が出力される
  location.reload();
}

// _______________________________________ end of function fsc() ___


/*===================================
  [関数 SetCookie]
  クッキーに値を書き込む
====================================*/
function SetCookie( name , value ){
  var dobj = new Date();
  dobj.setTime(dobj.getTime() + 24 * 60 * 60 * ckDays * 1000);
  var expiryDate = dobj.toGMTString();
  document.cookie = name + '=' + escape(value) + ';expires=' + expiryDate + ';path=' + ckPath;
}

/*===================================
  [関数 GetCookie]
  クッキーを取得する
====================================*/
function GetCookie (name){
  var arg  = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen){
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

/*===================================
  [関数 getCookieVal]
  クッキーの値を抽出する
====================================*/
function getCookieVal (offset){
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset,endstr));
}

/*===================================
  [関数 DeleteCookie]
  クッキーを削除する
====================================*/
function DeleteCookie(name){
  if (GetCookie(name)){
    document.cookie = name + '=' +
    '; expires=Thu, 01-Jan-70 00:00:01 GMT;path='+ckPath;
  }
}
//ボックス表示切り替え
function boxChangeBuy(boxIdBuy){
	document.getElementById("recommendBuyOn").style.display = "none";
	document.getElementById("recommendBuyOff").style.display = "none";
	document.getElementById(boxIdBuy).style.display = "block";
	inputBoxBuy(boxIdBuy);
}

function boxChangeCheck(boxIdCheck){
	document.getElementById("recommendCheckOn").style.display = "none";
	document.getElementById("recommendCheckOff").style.display = "none";
	document.getElementById(boxIdCheck).style.display = "block";
	inputBoxCheck(boxIdCheck);
}

//状態を記憶する
function inputBoxBuy(idBuy) {
	setCookie("recommendBuy", idBuy);
	return(idBuy);
}
function inputBoxCheck(idCheck) {
	setCookie("recommendCheck", idCheck);
	return(idCheck);
}

//cookie処理
function getCookie(key) {
	var start, end;
	var tmp=document.cookie+";";
	var keyposition=tmp.indexOf(key, 0);
	if(keyposition!=-1) {
		tmp=tmp.substring(keyposition, tmp.length);
		start=tmp.indexOf("=", 0)+1;
		end=tmp.indexOf(";", start);
		return(unescape(tmp.substring(start, end)));
	}
	return("");
}
function setCookie(key, val) {
	var tmp= key+"="+escape(val)+";";

	time = new Date();
	time.setTime(time.getTime()+(60*60*24*1000*7));
	timeSet = "expires="+time.toGMTString();

	document.cookie = tmp + timeSet + ";path=/;";
	return true;
}

var Cookies = {
	conf:{
		separator: "|"
	},
	createCookies:function(cookieName, cookieValue, expires) {
		var date_ = new Date().getTime();
		var expires_ = new Date(date_+(86400000*expires));
		var value_ = cookieName+"="+escape(cookieValue)+";expires="+expires_.toGMTString()+";path=/;";
		document.cookie = value_;
	},
	getCookies:function(cookieName) {
		var cookies_ = document.cookie.split("; ");
		var cookieValue_ = "";
		for(i=0;i<cookies_.length;i++) {
			var result_ = cookies_[i].split("=");
			if (result_[0] == cookieName) {
				cookieValue_ = unescape(result_[1]);
				break;
			}
		}
		return cookieValue_;
	},
	appendCookies:function(cookieName, thisCookieValue, limit, expires) {
		var cookies_ = this.getCookies(cookieName);
		if (cookies_) {
			var cookie_ = cookies_.split(this.conf.separator);
			var limit_ = limit -1;
			if (cookie_.length >= limit_) {
				cookies_ = "";
				for (i=0;i<limit_;i++) {
					cookies_ += (i!=0) ? this.conf.separator+cookie_[i] : cookie_[i];
				}
			}

			if (cookies_.indexOf(thisCookieValue) == -1) {
				this.createCookies(cookieName, thisCookieValue + this.conf.separator + cookies_, expires);
			} else {}
		} else {
			this.createCookies(cookieName, thisCookieValue, expires);
		}
	},
	toArray:function(cookieValue) {
			return (cookieValue.indexOf(this.conf.separator) != -1) ? cookieValue.split(this.conf.separator) : cookieValue;
		}
}

var dispChange = function(){
	for(var i=0; i<arguments.length;i++){
		if(i==0)
		document.getElementById(arguments[i]).style.display = "block";
		else
		document.getElementById(arguments[i]).style.display = "none";
	}
}
//EOF