//フォントサイズ
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 ){
    alert( "このスクリプトはNetscape Communicator4.xでは動作しません" );
    return false;
  }
  
  // MacIE4用エラーメッセージダイアログ
  else if(( appName.indexOf("Mac",0) != -1 ) && ( uaName.indexOf("MSIE 4.0",0) != -1 )){
    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 popHTML(layerid, img, legend, imgclass)
	{
	var swHTML='';
	swHTML += '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n';
	swHTML += '<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\">\n';
	swHTML += '<head>\n';
	swHTML += '	<title>東京都交通局</title>\n';
	swHTML += '	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n';
	swHTML += '		<meta name=\"keywords\" content=\"\" />\n';
	swHTML += '		<meta name=\"description\" content=\"\" />\n';
	swHTML += '	<script type=\"text/JavaScript\" src=\"/js/script.js\"></script>\n';
	swHTML += '	<link rel=\"stylesheet\" href=\"/css/static/import.css\" type=\"text/css\" media=\"screen, tv\" />\n';
	swHTML += '	<link rel=\"stylesheet\" href=\"/css/fsm.css\" type=\"text/css\" media=\"screen, tv\" id=\"FontSizeControl\" />\n';
	swHTML += '	<link rel=\"stylesheet\" href=\"/css/print.css\" type=\"text/css\" media=\"print\" />\n';
	swHTML += '  <script type=\"text/JavaScript\" src=\"/js/script.js\"></script>\n';
	swHTML += '</head>\n';
	swHTML += '<body>\n';
	swHTML += '<div id=\"' + layerid + '\">\n';
	swHTML += '<div id=\"LayerBody\">\n';
	swHTML += '<div id=\"LayerContents\">\n';
	swHTML += '<p class=\"b_print\"><a href=\"javascript:printout();\">印刷する</a></p>\n';
	swHTML += '<p class=\"set_center\"><img src=\"' + img + '" alt=\"\" class=\"' + imgclass + '\" /></p>\n';
	swHTML += legend + '\n';
	swHTML += '<p class=\"b_close\"><a href=\"javascript:window.close();\">閉じる</a></p>\n';
	swHTML += '</div>\n';
	swHTML += '</div>\n';
	swHTML += '<div id=\"LayerHeader\">\n';
	swHTML += '<div id=\"LayerHeaderGeneral\">\n';
	swHTML += '</div>\n';
	swHTML += '</div>\n';
	swHTML += '<!-- -->\n';
	swHTML += '<div id=\"LayerFooter\">\n';
	swHTML += '<div id=\"IdFooterGeneral\" class=\"FooterPop\">\n';
	swHTML += '<p id=\"IdFooterCopy\">本サイト上の文書や画像等に関する諸権利は東京都に帰属します。本サイト上の文書・画像等の無断使用・転載を禁止します。<br />Copyright&copy;2010 Bureau of Transportation. Tokyo Metropolitan Government. All Rights Reserved.</p>\n';
	swHTML += '</div>\n';
	swHTML += '</div>\n';
	swHTML += '</div>\n';
	swHTML += '</body>\n';
	swHTML += '</html>\n';
  return(swHTML);
}


function popupI450(img) {
}

// Subway imgPopup
function popupI650(img) {

	sw = window.open('', 'sw', 'width=670,resizable=yes,scrollbars=yes');
	var swHTML = '';
	var layerid = 'LayerBase650_G';
	var imgclass = '';

	var legend = '';
	legend += '<table class=\"LegendSubway\">\n';
	legend += '<tr>\n';
	legend += '<td><img src=\"/subway/stations/i/icon_wheelchair.gif\" width=\"20\" height=\"20\" alt=\"車いす昇降機付階段\" title=\"車いす昇降機付階段\" />車いす昇降機付階段</td>\n';
	legend += '<td><img src=\"/subway/stations/i/icon_escalator.gif\" width=\"20\" height=\"20\" alt=\"エスカレーター(一部に整備)\" title=\"エスカレーター(一部に整備)\" />エスカレーター(一部に整備)</td>\n';
	legend += '</tr>\n';
	legend += '<tr>\n';
	legend += '<td><img src=\"/subway/stations/i/icon_escalator_f.gif\" width=\"20\" height=\"20\" alt=\"エスカレーター(フル装備)\" title=\"エスカレーター(フル装備)\" />エスカレーター(フル装備)</td>\n';
	legend += '<td><img src=\"/subway/stations/i/icon_elevator.gif\" width=\"20\" height=\"20\" alt="エレベーターのある出口" title="エレベーターのある出口" />エレベーターのある出口</td>\n';
	legend += '</tr>\n';
	legend += '</table>\n';

	sw.document.open();
	sw.document.write( popHTML(layerid, img, legend, imgclass) );
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	}
}

// Bus imgPopup
function popupI650_b(img) {
	sw = window.open('', 'sw', 'width=670,resizable=yes,scrollbars=yes');
	var swHTML = '';
	var layerid = 'LayerBase650_G';
	var imgclass = 'busBorder';

	var legend = '';

	sw.document.open();
	sw.document.write( popHTML(layerid, img, legend, imgclass) );
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	}
}

// Toden imgPopup
function popupI650_t(img) {
	sw = window.open('', 'sw', 'width=670,resizable=yes,scrollbars=yes');
	var swHTML = '';
	var layerid = 'LayerBase650_G';
	var imgclass = '';

	var legend = '';
	legend += '<table class=\"LegendToden\">\n';
	legend += '<tr>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_toilet.jpg\" width=\"20\" height=\"20\" alt=\"トイレ\" title=\"トイレ\" /></td><td class="legend">トイレ</td>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_toilet_2.jpg\" width=\"20\" height=\"20\" alt=\"だれでもトイレ\" title=\"だれでもトイレ\" /></td><td class="legend">だれでも<br />トイレ</td>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_musium.jpg\" width=\"20\" height=\"20\" alt=\"美術館・博物館\" title=\"美術館・博物館\" /></td><td class="legend">美術館・<br />博物館</td>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_camera.jpg\" width=\"20\" height=\"20\" alt=\"撮影ポイント\" title=\"撮影ポイント\" /></td><td class="legend">撮影<br />ポイント</td>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_view.jpg\" width=\"20\" height=\"20\" alt=\"見どころ\" title=\"見どころ\" /></td><td class="legend">見どころ</td>\n';
	legend += '<td class="icon"><img src=\"/toden/stations/i/icon_convenience.jpg\" width=\"20\" height=\"20\" alt=\"コンビニ\" title=\"コンビニ\" /></td><td class="legend">コンビニ</td>\n';
	legend += '</tr>\n';
	legend += '</table>\n';

	sw.document.open();
	sw.document.write( popHTML(layerid, img, legend, imgclass) );
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	}
}

// Subway 立体図
function popupI800(img) {
	sw = window.open('', 'sw', 'width=820,resizable=yes,scrollbars=yes');
	var swHTML = '';
	var layerid = 'LayerBase800n_G';
	var imgclass = 'ImgSolid';

	var legend = '<p class=\"set_center t_20\"><img src=\"/bus/noriba/i/solid_legend.gif\" width=\"700\" height=\"251\" alt=\"\" class=\"ImgSolid\" /></p>\n';
	legend += '<div class=\"c\">\n';
	legend += '<p class=\"b_gateway\"><a href=\"gateway.html\">駅出入口情報</a></p>\n';
	legend += '</div>\n';
	legend += '<p class="caution_gateway">［注］出口に関するエレベーターエスカレーター情報はこちらをご覧ください。</p>\n';

	sw.document.open();
	sw.document.write( popHTML(layerid, img, legend, imgclass) );
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	}
}


function popup450(url) {
  sw = window.open(url, 'win450', 'width=470,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function popup500(url) { //Toeiファン 荒川線切り絵館
  sw = window.open(url, 'win500', 'width=520,height=650,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function popup630(url) {
  sw = window.open(url, 'win630', 'width=650,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function popup650(url) {
  sw = window.open(url, 'win650', 'width=670,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function popup800(url) {
  sw = window.open(url, 'win800', 'width=820,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function popupfree(url, width) {
  feature = 'width=' + width + ',scrollbars=yes,resizable=yes';
  sw = window.open(url, 'winfree', feature);
	if (sw != null)  {
		sw.focus();
	}
}

function popupblank(url) {
  sw = window.open(url, '_blank');
	if (sw != null)  {
		sw.focus();
	}
}

function printout() {
	window.print();
}

function focusP(url) {
	if(window.opener == null) {
		pw = window.open(url, '_blank');
	}
	else if (!window.opener.closed)  {
		window.opener.location.href = url;
		window.opener.focus();
	} else {
		pw = window.open(url, '_blank');
	}
}


function timetable(directory) {
	url = '/' + directory + '/timetable/index.html';

	if(window.opener == null) {
		pw = window.open(url, '_blank');
	}
	else if (!window.opener.closed)  {
		window.opener.location.href = url;
		window.opener.focus();
	} else {
		pw = window.open(url, '_blank');
	}

	window.close();
}

// ----------------------------------------------



function popImgSJ(img)
	{
	sw = window.open('', 'sw', 'width=820,resizable=yes,scrollbars=yes');
	var swHTML='';
	swHTML += '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n';
	swHTML += '<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\">\n';
	swHTML += '<head>\n';
	swHTML += '  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\" />\n';
	swHTML += '  <title> </title>\n';
	swHTML += '  <meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n';
	swHTML += '  <link rel=\"stylesheet\" href=\"/css/static/import.css\" type=\"text/css\" media=\"screen, tv\" />\n';
	swHTML += '  <link rel=\"stylesheet\" type=\"text/css\" href=\"/css/fsm.css\" media=\"screen, tv\" id=\"FontSizeControl\" />\n';
	swHTML += '  <link rel=\"stylesheet\" href=\"/css/print.css\" type=\"text/css\" media=\"print\" />\n';
	swHTML += '  <script type=\"text/JavaScript\" src=\"/js/script.js\"></script>\n';
	swHTML += '</head>\n';
	swHTML += '<body>\n';
	swHTML += '    <div id=\"LayerBaseFree_G\">\n';
	swHTML += '        <div id=\"LayerBody\">\n';
	swHTML += '      <div id=\"LayerContents\">\n';
	swHTML += '<p class=\"set_center\"><img src=\"' + img + '" alt=\"\"  /></p>\n';
	swHTML += '      </div>\n';
	swHTML += '          </div>\n';
	swHTML += '            <div id=\"LayerHeader\">\n';
	swHTML += '            <div id=\"LayerHeaderGeneral\">\n';
	swHTML += '                <div id=\"LayerHeader_l\">\n';
	swHTML += '          <p><img src=\"/g/logo_pop.gif\" width=\"152\" height=\"25\" alt=\"\" title=\"\" /></p>\n';
	swHTML += '        </div>\n';
	swHTML += '              </div>\n';
	swHTML += '    </div>\n';
	swHTML += '      </div>\n';
	swHTML += '  </body>\n';
	swHTML += '</html>\n';

	sw.document.open();
	sw.document.write( swHTML );
	sw.document.close();

	if (sw != null)  {
		sw.focus();
	}
}

// バス路線図
function popup650Select(url)
{
	n = url.selectedIndex;
	sw = window.open(url.options[n].value, 'win650', 'width=670,scrollbars=yes,resizable=yes');
	if (sw != null)  {
		sw.focus();
	}
}

function SubWindow(friID) {

	var width = 550;
	var height = 700;
	var top = (screen.height - height) / 3;
	var left = (screen.width - width) / 2;

win = window.open("http://www.kotsu.metro.tokyo.jp/fri/fri" + friID + ".html",
						"furikae",
						"left=" + left + "," +
						"top=" + top + "," +
						"width=" + width + "," +
						"height=" + height + "," +
						"menubar=yes," +
						"location=yes," +
						"directories=yes," +
						"status=yes," +
						"scrollbars=yes," +
						"resizable=yes," +
						"toolbar=yes");

}


//-------------------------------------------------------------------
//スライド表示
function slide_on(id,s){
	var c;
	c = document.getElementById(id + '-ddcontent');
	c.style.zoom=1;
	c.style.height = 'auto';
	c.style.display = 'block';
	c.style.opacity = s / 100;
	c.style.filter = 'alpha(opacity='+s+')';
}

function slide_off(id){
	var c;
	c = document.getElementById(id + '-ddcontent');
	c.style.display = 'none';
	c.style.opacity = 0;
	c.style.filter = 'alpha(opacity=0)';
}


