﻿//------------------------------------------------------------------------------
var ActivePath = '';
var ActiveIndex = -1;
//------------------------------------------------------------------------------

// mouse over out
/*
function changeImg(THIS,FLAG){
	SRC = THIS.src;
	if(FLAG == 1){
		THIS.src = THIS.src.replace('_off.','_on.');
	}else{
		THIS.src = THIS.src.replace('_on.','_off.');
	}
}

// imgchange
var gnavi_imgs = new Array();

function jre_header(path,name) {
    ActivePath = path;
    //--------------------------------------------------------------------------
    // renewal code
    //--------------------------------------------------------------------------
    if( check_new_old() ) return jre_header_renew( path, name );

	menu_url = new Array();
	menu_name = new Array();
	menu_off = new Array();
	menu_on = new Array();
	menu_img = new Array();
	menu_img_on  = new Array();
	menu_img_off = new Array();
	menu_img_over= new Array();
	var genre_number = 0;

	//from SSL
	if (location.protocol=='https:'){
		path='http://www.jreast.co.jp/e/'
	}

	// -----------------------Main Menu Start Here--------------------- 

	//JR-EAST HOME
	genre1_name = new Array();
		genre1_name[0] = 'home';

	menu_url [1] = 'index.html';
	menu_name[1] = 'Home';
	menu_img [1] = genre1_name[0];
	menu_img_on  [1] = ''+path+'img/m_'+genre1_name[0]+'_03.gif';
	menu_img_off [1] = ''+path+'img/m_'+genre1_name[0]+'_01.gif';
	menu_img_over[1] = ''+path+'img/m_'+genre1_name[0]+'_02.gif';

	//Using JR East
	genre2_name = new Array();
		genre2_name[0] = 'using';
		genre2_name[genre2_name.length] = 'using';

	menu_url [2] = genre2_name[0]+'/index.html';
	menu_name[2] = 'Using JR East';
	menu_img [2] = genre2_name[0];
	menu_img_on  [2] = ''+path+'img/m_'+genre2_name[0]+'_03.gif';
	menu_img_off [2] = ''+path+'img/m_'+genre2_name[0]+'_01.gif';
	menu_img_over[2] = ''+path+'img/m_'+genre2_name[0]+'_02.gif';

	//Special Offers
	genre3_name = new Array();
		genre3_name[0] = 'special';
		genre3_name[genre3_name.length] = 'special';

	menu_url [3] = genre3_name[0]+'/index.html';
	menu_name[3] = 'Special Offers';
	menu_img [3] = genre3_name[0];
	menu_img_on  [3] = ''+path+'img/m_'+genre3_name[0]+'_03.gif';
	menu_img_off [3] = ''+path+'img/m_'+genre3_name[0]+'_01.gif';
	menu_img_over[3] = ''+path+'img/m_'+genre3_name[0]+'_02.gif';

	//Trips
	genre4_name = new Array();
		genre4_name[0] = 'trips';
		genre4_name[genre4_name.length] = 'trips';

	menu_url [4] = genre4_name[0]+'/index.html';
	menu_name[4] = 'Trips';
	menu_img [4] = genre4_name[0];
	menu_img_on  [4] = ''+path+'img/m_'+genre4_name[0]+'_03.gif';
	menu_img_off [4] = ''+path+'img/m_'+genre4_name[0]+'_01.gif';
	menu_img_over[4] = ''+path+'img/m_'+genre4_name[0]+'_02.gif';

	//Information Counters
	genre5_name = new Array();
		genre5_name[0] = 'info_counters';
		genre5_name[genre5_name.length] = 'info_counters';

	menu_url [5] = genre5_name[0]+'/index.html';
	menu_name[5] = 'Information Counters';
	menu_img [5] = genre5_name[0];
	menu_img_on  [5] = ''+path+'img/m_'+genre5_name[0]+'_03.gif';
	menu_img_off [5] = ''+path+'img/m_'+genre5_name[0]+'_01.gif';
	menu_img_over[5] = ''+path+'img/m_'+genre5_name[0]+'_02.gif';

	//IR
	genre6_name = new Array();
		genre6_name[0] = 'investor';
		genre6_name[genre6_name.length] = 'investor';

	menu_url [6] = genre6_name[0]+'/index.html';
	menu_name[6] = 'IR';
	menu_img [6] = genre6_name[0];
	menu_img_on  [6] = ''+path+'img/m_'+genre6_name[0]+'_03.gif';
	menu_img_off [6] = ''+path+'img/m_'+genre6_name[0]+'_01.gif';
	menu_img_over[6] = ''+path+'img/m_'+genre6_name[0]+'_02.gif';


	//About Us
	genre7_name = new Array();
		genre7_name[0] = 'aboutus';
		genre7_name[genre7_name.length] = 'aboutus';

	menu_url [7] = genre7_name[0]+'/index.html';
	menu_name[7] = 'About Us';
	menu_img [7] = genre7_name[0];
	menu_img_on  [7] = ''+path+'img/m_'+genre7_name[0]+'_03.gif';
	menu_img_off [7] = ''+path+'img/m_'+genre7_name[0]+'_01.gif';
	menu_img_over[7] = ''+path+'img/m_'+genre7_name[0]+'_02.gif';
	

	// -----------------------Main Menu End Here--------------------- 
	document.write('<table border="0" cellpadding="0" cellspacing="0" width="760">');
	document.write('<tr valign="top">');
	document.write('<td width="286"><a href="'+path+'index.html"><img src="'+path+'img/jr_logo_en.gif" width="286" height="48" alt="EAST JAPAN RAILWAY COMPANY"></a></td>');
	document.write('<td align="right">');
	document.write('<table border="0" cellspacing="0" cellpadding="0" style="margin:3px 5px 0 0;">');
	document.write('<tr>');
	document.write('<td><a href="'+path+'../index.html"><img src="'+path+'../img/f_language/l_ja_off.gif" alt="日本語" width="42" height="16" onmouseover="changeImg(this,1)" onmouseout="changeImg(this,0)"></a></td>');
	document.write('<td><img src="'+path+'img/_.gif" alt="" width="13" height="16"></td>');
	document.write('<td><a href="'+path+'../sc/index.html"><img src="'+path+'../img/f_language/l_sc_off.gif" alt="?体中文" width="57" height="16" onmouseover="changeImg(this,1)" onmouseout="changeImg(this,0)"></a></td>');
	document.write('<td><img src="'+path+'img/_.gif" alt="" width="14" height="16"></td>');
	document.write('<td><a href="'+path+'../tc/index.html"><img src="'+path+'../img/f_language/l_tc_off.gif" alt="繁體中文" width="56" height="16" onmouseover="changeImg(this,1)" onmouseout="changeImg(this,0)"></a></td>');
	document.write('<td><img src="'+path+'img/_.gif" alt="" width="12" height="16"></td>');
	document.write('<td><a href="'+path+'../kr/index.html"><img src="'+path+'../img/f_language/l_kr_off.gif" alt="???" width="45" height="16" onmouseover="changeImg(this,1)" onmouseout="changeImg(this,0)"></a></td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	         
            
            
            
            

	//if (name=='home'){
//	document.write('<table border="0" cellpadding="0" cellspacing="0" width="760">');
//	document.write('<tr>');
//	document.write('<td><img src="'+path+'img/m_l.gif" width="5" height="26" border="0" alt=""></td>');
//	document.write('<td><a href="'+path+'index.html" onMouseOver="imgchange(\'m_home\',\''+path+'img/m_home_02.gif\')" onMouseOut="imgchange(\'m_home\',\''+path+'img/m_home_01.gif\')"><img src="'+path+'img/m_home_01.gif" width="86" height="26" border="0" alt="Home" name="m_home"></a></td>');
//	document.write('<td><a href="'+path+'using/index.html" onMouseOver="imgchange(\'m_using\',\''+path+'img/m_using_02.gif\')" onMouseOut="imgchange(\'m_using\',\''+path+'img/m_using_01.gif\')"><img src="'+path+'img/m_using_01.gif" width="126" height="26" border="0" alt="Using JR East" name="m_using"></a></td>');
//	document.write('<td><a href="'+path+'special/index.html" onMouseOver="imgchange(\'m_special\',\''+path+'img/m_special_02.gif\')" onMouseOut="imgchange(\'m_special\',\''+path+'img/m_special_01.gif\')"><img src="'+path+'img/m_suica_01.gif" width="122" height="26" border="0" alt="Special Offers" name="m_special"></a></td>');
//	document.write('<td><a href="'+path+'trips/index.html" onMouseOver="imgchange(\'m_trips\',\''+path+'img/m_trips_02.gif\')" onMouseOut="imgchange(\'m_trips\',\''+path+'img/m_trips_01.gif\')"><img src="'+path+'img/m_card_01.gif" width="80" height="26" border="0" alt="Trips" name="m_trips"></a></td>');
//	document.write('<td><a href="'+path+'info_counters/index.html" onMouseOver="imgchange(\'m_info_counters\',\''+path+'img/m_info_counters_02.gif\')" onMouseOut="imgchange(\'m_info_counters\',\''+path+'img/m_info_counters_01.gif\')"><img src="'+path+'img/m_info_counters_01.gif" width="161" height="26" border="0" alt="Information Counters" name="m_info_counters"></a></td>');
//	document.write('<td><a href="'+path+'investor/index.html" onMouseOver="imgchange(\'m_investor\',\''+path+'img/m_investor_02.gif\')" onMouseOut="imgchange(\'m_investor\',\''+path+'img/m_investor_01.gif\')"><img src="'+path+'img/m_investor_01.gif" width="67" height="26" border="0" alt="IR" name="m_investor"></a></td>');
//	document.write('<td><a href="'+path+'aboutus/index.html" onMouseOver="imgchange(\'m_aboutus\',\''+path+'img/m_aboutus_02.gif\')" onMouseOut="imgchange(\'m_aboutus\',\''+path+'img/m_aboutus_01.gif\')"><img src="'+path+'img/m_aboutus_01.gif" width="102" height="26" border="0" alt="About Us" name="m_aboutus"></a></td>');
//	document.write('<td><img src="'+path+'img/m_r.gif" width="11" height="26" border="0" alt=""></td>');
//	document.write('</table>');
//	}



	for(i=0; genre1_name[i]; i++){
		if (name==genre1_name[i]){
			genre_number = 1;
		}
	}

	for(i=0; genre2_name[i]; i++){
		if (name==genre2_name[i]){
			genre_number = 2;
		}
	}

	for(i=0; genre3_name[i]; i++){
		if (name==genre3_name[i]){
			genre_number = 3;
		}
	}

	for(i=0; genre4_name[i]; i++){
		if (name==genre4_name[i]){
			genre_number = 4;
		}
	}

	for(i=0; genre5_name[i]; i++){
		if (name==genre5_name[i]){
			genre_number = 5;
		}
	}

	for(i=0; genre6_name[i]; i++){
		if (name==genre6_name[i]){
			genre_number = 6;
		}
	}
	
	for(i=0; genre7_name[i]; i++){
		if (name==genre7_name[i]){
			genre_number = 7;
		}
	}


	var parts01_off = '<td><a href="';
	var parts02_off = '" onMouseOver="imgchange(\'';
	var parts03_off = '\',\'';
	var parts04_off = '\')" onMouseOut="imgchange(\'';
	var parts05_off = '\',\'';
	var parts06_off = '\')" target="_top"><img src="';
	var parts07_off = '" name="';
	var parts08_off = '" alt="';
	var parts09_off = '" border="0"></a></td>';

	var parts01_on = '<td><a href="';
	var parts02_on = '" target="_top"><img src="';
	var parts03_on = '" alt="';
	var parts04_on = '" border="0"></a></td>';

	for(i=1; menu_name[i]; i++){
		if(menu_url[i].indexOf('http://',0)==-1){
			menu_on [i] = parts01_on + path + menu_url[i] + parts02_on + menu_img_on[i] + parts03_on  + menu_name[i] + parts04_on;
			
			menu_off[i] = parts01_off + path + menu_url[i] + parts02_off + menu_img[i] + parts03_off + menu_img_over[i] + parts04_off + menu_img[i] + parts05_off + menu_img_off[i] + parts06_off + menu_img_off[i] + parts07_off + menu_img[i] + parts08_off + menu_name[i] + parts09_off;
		}
		else {
			menu_on [i] = parts01_on + menu_url[i] + parts02_on + menu_img_on[i] + parts03_on + menu_name[i] + parts04_on;
			
			menu_off[i] = parts01_off + menu_url[i] + parts02_off + menu_img[i] + parts03_off + menu_img_over[i] + parts04_off + menu_img[i] + parts05_off + menu_img_off[i] + parts06_off + menu_img_off[i] + parts07_off + menu_img[i] + parts08_off + menu_name[i] + parts09_off;
		}
	}

	document.write('<table border="0" cellpadding="0" cellspacing="0" width="760">');
	document.write('<tr>');
	document.write('<td><img src="'+path+'img/m_l.gif" width="5" height="26" border="0" alt=""></td>');

	for(i=1; menu_name[i]; i++){
		
		if (genre_number==i){
			document.write(menu_on[i]);
		}
		else{
			document.write(menu_off[i]);
		}
		
	}

	document.write('<td><img src="'+path+'img/m_r.gif" width="11" height="26" border="0" alt=""></td>');
	document.write('</tr>');
	//document.write('<tr><td colspan="8" bgcolor="#65C466"><img src="'+path+'img/_.gif" width="1" height="2" border="0" alt=""></td></tr>');
	document.write('</table>');

}


// imgchange
	function imgchange(imgname, imgnum) {
		if(document.images) {
			if(gnavi_imgs[imgnum]) {
			document.images[imgname].src = gnavi_imgs[imgnum].src;
			}
			else {
			document.images[imgname].src = imgnum;
			}
		}
	}
*/

//------------------------------------------------------------------------------
// under renewal code
//------------------------------------------------------------------------------
/*
function check_new_old(){
    var menuList = new Array();
    var self_url	= window.location.href;
	//[--MenuList--BEGIN]
    //Top
	menuList.push( 'e/' );
	menuList.push( 'e/index.html' );
	//Timetalbes
	menuList.push( 'e/timetables/index.html' );
	//Fares&Pages
	menuList.push( 'e/pass/index.html');				
	menuList.push( 'e/eastpass/index.html');			
	menuList.push( 'e/suica-nex/index.html');		
	menuList.push( 'e/pass/tokunai_pass.html');
	menuList.push( 'e/pass/tokyo_free.html');
	menuList.push( 'e/pass/yokohama_minatomirai.html');
	menuList.push( 'e/pass/kamakura_enoshima.html');
	menuList.push( 'e/pass/holiday_pass.html');
	menuList.push( 'e/pass/weekend_pass.html');
	menuList.push( 'e/pass/twoday_pass.html');	
	menuList.push( 'e/pass/seishun18.html');
	menuList.push( 'e/pass/suica.html');
	menuList.push( 'e/ticket/index.html');
	menuList.push( 'e/ticket/types.html');
	menuList.push( 'e/ticket/purchase.html');
	menuList.push( 'e/ticket/changes');
	menuList.push( 'e/ticket/accidents.html');
	menuList.push( 'e/ticket/examining.html');
	menuList.push( 'e/charge/index.asp');
	//Route & Maps
	menuList.push( 'e/routemaps/index.html');
	menuList.push( 'e/nex/index.html');
	menuList.push( 'e/nex/tickets.html');
	menuList.push( 'e/nex/suica_nex.html');
	menuList.push( 'e/nex/seating.html');
	menuList.push( 'e/nex/facilities.html');
	menuList.push( 'e/nex/narita.html');
	menuList.push( 'e/nex/service_center.html');
	menuList.push( 'e/routemaps/tohokushinkansen.html');
	menuList.push( 'e/routemaps/akitashinkansen.html');
	menuList.push( 'e/routemaps/yamagatashinkansen.html');
	menuList.push( 'e/routemaps/joetsushinkansen.html');
	menuList.push( 'e/routemaps/naganoshinkansen.html');
	menuList.push( 'e/routemaps/cassiopeia_hokutosei.html');
	menuList.push( 'e/routemaps/hitachi.html');
	menuList.push( 'e/routemaps/azusa_kaiji.html');
	menuList.push( 'e/routemaps/nikko_kinugawa.html');
	menuList.push( 'e/routemaps/superviewodoriko.html');
	menuList.push( 'e/routemaps/sazanami_wakashio.html');
	menuList.push( 'e/routemaps/kusatsu_minakami.html');
	menuList.push( 'e/routemaps/hakucho_tsugaru.html');
	menuList.push( 'e/routemaps/inaho_kamoshika.html');
	menuList.push( 'e/routemaps/resortshirakami.html');
	menuList.push( 'e/routemaps/slbanetsumonogatari.html');
	menuList.push( 'e/routemaps/kirakirauetsu.html');
	//Featured Destinations
	menuList.push( 'e/destinations/index.html');
	menuList.push( 'e/destinations/nikko_kinugawa.html');
	menuList.push( 'e/destinations/fuji.html');
	menuList.push( 'e/destinations/sendai_matsushima.html');
	menuList.push( 'e/destinations/aizu.html');
	menuList.push( 'e/destinations/hiraizumi.html');
	menuList.push( 'e/destinations/kusatsu_minakami.html');
	menuList.push( 'e/destinations/karuizawa.html');
	menuList.push( 'e/destinations/izu.html');
	menuList.push( 'e/destinations/yokohama.html');
	menuList.push( 'e/destinations/shirakamisanchi.html');
	menuList.push( 'e/destinations/niigata_sado.html');
	menuList.push( 'e/destinations/gala.html');
	//Customer Support
	menuList.push( 'e/customer_support/index.html');
	menuList.push( 'e/customer_support/service_center.html');
	menuList.push( 'e/customer_support/information_center.html');
	menuList.push( 'e/customer_support/infoline.html');
	menuList.push( 'e/stations/index.html');
	menuList.push( 'e/customer_support/accesibility.html');
	//Investor Relations
	menuList.push( 'e/investor/index.html');
	//About Us
	menuList.push( 'e/aboutus/index.html');
	//[--MenuList--END]
    for( n = 0; n < menuList.length; n ++ ){
        if( self_url.match( menuList[n] + '$' ) ) return true;
    }
    return false;
}
*/
//function jre_header_renew(path, key_index) {
function jre_header(path, key_index) {
	document.write('<div id="header" class="clearfix">');
	document.write('<table border="0" cellpadding="0" cellspacing="0" width="950">');
	document.write('<tr valign="top">');
	document.write('<td width="286"><a href="'+key_index+'index.html"><img src="'+path+'img/logoEJR.gif" width="286" height="48" alt="EAST JAPAN RAILWAY COMPANY"></a></td>');
	document.write('<td align="right"><a href="http://www.acprail.com/"><img src="'+path+'img/powered_acp.gif" width="135" height="44" alt="Powered by ACP Rail International"></a>');
	document.write('</tr>');
	document.write('</table>');
	
	//document.write('<p class="logo"><a href="'+path+'index.html"><img src="'+path+'img/renew/common/logo.gif" alt="EAST JAPAN RAILWAY COMPANY" width="286" height="48" /></a></p>');
	//document.write('<ul>');
	//document.write('<li>|<a href="'+path+'../index.html">日本語</a></li>');
	//document.write('<li>|<a href="'+path+'../tc/index.html">繁體中文</a></li>');
	//document.write('<li>|<a href="'+path+'../sc/index.html">簡体中文</a></li>');
	//document.write('<li>|<a href="'+path+'../kr/index.html">한국어</a></li>');
	//document.write('</ul>');
	
	document.write('</div>');

   	document.write('<link rel="stylesheet" type="text/css" href="'+path+'css/renew/common.css" media="screen,print" />');
    //document.write('<link rel="stylesheet" type="text/css" href="common.css" media="screen,print" />');
    //document.write('<link rel="stylesheet" type="text/css" href="'+path+'css/renew/print.css" media="print" />');
	document.write('<script src="fonctions/jquery-1.4.1.js" type="text/javascript" language="javascript"></script>');
	//document.write('<script src="'+path+'fonctions/naviswitcher.js" type="text/javascript" language="javascript"></script>');
	document.write('<script src="'+path+'fonctions/gnavi.js" type="text/javascript" language="javascript"></script>');

    ActivePath = key_index;
	ImagesPath=path;
    if( key_index == undefined ) {
        ActiveIndex = -1;
        return;
    }

    switch( key_index.toLowerCase() ){
        case 'timetables':
            ActiveIndex = 0;
            break;
        case 'pass':
        case 'using':
            ActiveIndex = 1;
            break;
        case 'routemaps':
            ActiveIndex = 2;
            break;
        case 'destinations':
            ActiveIndex = 3;
            break;
        case 'customer_support':
            ActiveIndex = 4;
            break;
        case 'investor':
            ActiveIndex = 5;
            break;
        case 'aboutus':
            ActiveIndex = 6;
            break;
        default:
            ActiveIndex = -1;
            break;
    }

}

