﻿// 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) {

	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] = '主页';
	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] = '乘坐 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] = '特惠';
	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] = '旅游';
	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] = '咨询处';
	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';



	/* -----------------------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_sc.gif" width="286" height="48" alt="东日本旅客铁路公司"></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="12" height="16"></td>');
	document.write('<td><a href="'+path+'../e/index.html"><img src="'+path+'../img/f_language/l_en_off.gif" alt="English" width="54" 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+'../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="14" 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;
		}
	}


	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;
			}
		}
	}
