// JavaScript Document

function toThisTop2010() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}else if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
	if (x > 0 || y > 0) {
		window.setTimeout("toThisTop2010()", 20);
	}
}
function toThisTopLinkAdd2010(){
	if (document.getElementById) {
		var linkElms = document.getElementsByTagName('a');
		for(i = 0; i < linkElms.length; i++){
			if(linkElms[i].href.match(/#top$/)){
				linkElms[i].onclick = function(){toThisTop2010(); return false;}
			}
		}
	}
}

function replace_search_form2(){
	var html = '';
	html += '<form method="get" name="search_form2">';
	html += '<select name="menu1" class="bklink" onChange="MM_jumpMenu('+"'parent'"+',this,0)">';
	html += '<option>世界のサイト</option>';
	html += '<option>-----------------------</option>';
	html += '<option value="http://www.china-airlines.com/ch/">中文版（繁体字）</option>';
	html += '<option value="http://gb.china-airlines.com/gate/gb/www.china-airlines.com/ch/">中文版（簡体字）</option>';
	html += '<option value="http://www.chinaairlines.com.hk/">香港版</option>';
	html += '<option value="http://www.china-airlines.com/en/">グローバルサイト（英語）</option>';
	html += '<option value="http://www.chinaairlines.de/">ドイツ</option>';
	html += '<option value="http://www.china-airlines.nl/">オランダ</option>';
	html += '<option value="http://www.china-airlines.at/">オーストリア</option>';
	html += '<option value="http://www.china-airlines.it/">イタリア</option>';
	html += '<option value="http://www.china-airlines.fr/">フランス</option>';
	html += '<option value="http://www.china-airlines.com/uk/">英国・アイルランド</option>';
	html += '<option value="http://www.china-airlines.com/en/promotionen/">北米</option>';
	html += '<option value="http://www.china-airlines.co.kr/">韓国</option>';
	html += '<option value="http://www.china-airlines.co.th/">タイ</option>';
	html += '<option value="http://www.china-airlines.com/vn/">ベトナム</option>';
	html += '<option value="http://www.china-airlines.com/au/">オーストラリア（英語）</option>';
	html += '</select>';
	html += '&nbsp;';
	html += '<input type="hidden" name="o" value="4">';
	html += '<input type="hidden" name="v" value="root">';
	html += '<input class="menu1" type="hidden" name="r" value="2">';
	html += '</form>';

	if(document.getElementById('TopLink')){
		document.getElementById('TopLink').innerHTML = html;
	}

}


//TOPページのキャンペーンバナー入れ替え ここから
function topCampaignImg(){
	if(!document.getElementById("topCampaignImg")){
		return;
	}
	var topCampaignImgElm = document.getElementById("topCampaignImg");
	topCampaignImgElm.onmouseover = function(){
		clearInterval(topCampaignImgTimerID);
	}
	topCampaignImgElm.onmouseout = function(){
		topCampaignImgTimerID = setInterval('topCampaignImgChange()',7000);
	}
	topCampaignImgChangeNum = Math.floor(Math.random()*(topCampaignImgChangeHtml.length));
	topCampaignImgChange();
	topCampaignImgTimerID = setInterval('topCampaignImgChange()',7000);
}
function topCampaignImgChange(){
	topCampaignImgChangeNum ++;
	var num = topCampaignImgChangeNum % topCampaignImgChangeHtml.length;
	document.getElementById("topCampaignImg").innerHTML = topCampaignImgChangeHtml[num];
}
//TOPページのキャンペーンバナーえ ここまで


function windowonload2010(){
	toThisTopLinkAdd2010();
	replace_search_form2();
	//return;
}

