// フォントサイズ
function fs( CMD ){
	uaName = navigator.userAgent;
	appName = navigator.appVersion;
	
  // FontSize: L
  if( CMD == "L" ){
	window.document.getElementById('FontSizeControl').href = '/css/fsl.css';
	setCookie("wordsize","/css/fsl.css",true);
  }

  // FontSize: M
  else if ( CMD == "M" ){
	window.document.getElementById('FontSizeControl').href = '/css/fsm.css';
	setCookie("wordsize","/css/fsm.css",true);
  }
  
  // FontSize: S
  else if ( CMD == "S" ){
	window.document.getElementById('FontSizeControl').href = '/css/fss.css';
	setCookie("wordsize","/css/fss.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 ="/css/fsm.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;
	}
  	
  }


//ポップアップをする
function popup600(url) {
  sw = window.open(url, 'win600', 'width=620,height=600,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}


//プリントアウトのメニューを開く
function printout() {
	window.print();
}
