// フォントサイズ
function fs( CMD ){
	uaName = navigator.userAgent;
	appName = navigator.appVersion;
	
  // FontSize: L
  if( CMD == "L" ){
	window.document.getElementById('FontSizeControl').href = 'large.css';
		setCookie("wordsize","large.css",true);
  }

  // FontSize: M
  else if ( CMD == "M" ){
	window.document.getElementById('FontSizeControl').href = 'reguler.css';
		setCookie("wordsize","reguler.css",true);
  }
  
  // FontSize: S
  else if ( CMD == "S" ){
	window.document.getElementById('FontSizeControl').href = 'small.css';
		setCookie("wordsize","small.css",true);
  }
  

  // === ::: 変更を加えるオブジェクトの判定 ::: ===
  //
  // NN4用エラーメッセージダイアログ
  if( document.layers ){
    window.alert( "このスクリプトはNetscape Communicator4.xでは動作しません" );
    return false;
  }
  
  // MacIE4用エラーメッセージダイアログ
  else if(( appName.indexOf("Mac",0) != -1 ) && ( uaName.indexOf("MSIE 4.0",0) != -1 )){
    window.alert( "このスクリプトはMacIE4.0では動作しません" );
    return false;
  }
}

function setCookie(name,value,expire)
{
	var str = name +"="+escape(value)+";domain="+location.hostname+";path=/;";
	//var str = name +"="+escape(value)+";domain=metro.ewmjapan.com;path=/;";
	if (expire)
	{
		var period = 7;	// 有効期限日数
		// 有効期限の作成
		var nowtime = new Date().getTime();
		var clear_time = new Date(nowtime + (60 * 60 * 24 * 1000 * period));
		var expires = clear_time.toGMTString();
		str+="expires=" + expires;
		//alert(str);
	}
	document.cookie=str;
}

  
function initLoad()
  {
  	cookieData = document.cookie;
  	//alert(cookieData);
  	if (cookieData == "")
  	{
  		window.document.getElementById('FontSizeControl').href ="reguler.css";
  		return;
  	}
  	var name = "wordsize=";
  	start = cookieData.indexOf(name);
  	//alert(start);
  	if (start != -1)
	{
		cookieData=cookieData.substring(start+name.length,start+name.length+12);
		//alert(cookieData);
		window.document.getElementById('FontSizeControl').href =cookieData;
	}
  	
  }


