﻿<!--
function SendSearch2(){
   if (document.search_form2.p.value == "")
       alert ("キー・ワードを入力して下さい。");
   else{
       document.search_form2.action="http://search.china-airlines.com/cgi-bin/tornado/searcher"
       document.search_form2.submit();
   }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenu2(targ,selObj,restore){ //v3.0
gb=new Array(13);

gb[2]="http:" + "//www.china-airlines.com/ch/index.htm";
gb[3]="http:" + "//gb.china-airlines.com/gate/gb/www.china-airlines.com/ch/index.htm"
gb[4]="http:" + "//www.china-airlines.com/hk/index.htm"
gb[5]="http:" + "//www.china-airlines.com/en/index.htm"
gb[6]="http:" + "//www.chinaairlines.de"
gb[7]="http:" + "//www.china-airlines.nl/"
gb[8]="http:" + "//www.china-airlines.at/"
gb[9]="http:" + "//www.china-airlines.com/italy/index.htm"
gb[10]="http:" + "//www.china-airlines.com/en/index.htm"
gb[11]="http:" + "//www.china-airlines.co.kr"


if (selObj.selectedIndex==0 || selObj.selectedIndex==1){return;}
  eval(targ+".location='"+gb[selObj.selectedIndex]+"'");
  if (restore) selObj.selectedIndex=0;
}

function check1() {
  var f = document.form2;
  var y = '';
  if (f.dfpcard.value == ''||f.dfpcard.value == 'Card No.') {y+='You forget to keyin the [Card No.]!\n';}
  if (f.pincode.value == '') {y+='You forget to keyin the [Password]!\n';}
  if (y=='') {
	return true;
  } else {
	alert(y);
	return false;
  }
}

function get_cookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg) {
	  offset=j;
      if (document.cookie.substring(offset+1, 1) == ";") {
          return null;
      }
      if (offset+1>clen) {
          return null;
      }
	  var endstr = document.cookie.indexOf (";", offset);
	  if (endstr == -1) {endstr = document.cookie.length;}
	  return unescape (document.cookie.substring(offset, endstr));
    }
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function get_cookie2(name) {
  var strArg = name+"=";
  var nArgLen = strArg.length;
  var nCookieLen = document.cookie.length;
  var nEnd;
  var i = 0;
  var j;
  while (i < nCookieLen) {
    j = i + nArgLen;
    if (document.cookie.substring(i,j) == strArg) {
      nEnd=document.cookie.indexOf (";",j);
      if (nEnd==-1) {
        nEnd=document.cookie.length;
      }
      return decodecookie(unescape(document.cookie.substring(j,nEnd)));
    }
    i=document.cookie.indexOf(" ",i)+1;
    if (i==0) break;
  }
  return null;
}

function decodecookie(str) {
  var strArr;
  var strRtn="";
  strArr=str.split("a");
  for (var i=strArr.length-1;i>=0;i--) {
    strRtn+=String.fromCharCode(eval(strArr[i]));
  }
  return strRtn;
}

function chkPwdField() {
  var f = document.form2;
  if (document.all['divTxt'].style.display == 'none' & f.pincode.value==''){
  	document.all['divTxt'].style.display = 'block';
  	document.all['divPwd'].style.display = 'none';
  }else if(f.pincode.value==''){
  	document.all['divTxt'].style.display = 'none';
  	document.all['divPwd'].style.display = 'block';
  	f.pincode.focus();
  }else{
  	document.all['divTxt'].style.display = 'none';
  	document.all['divPwd'].style.display = 'block';
  }
}

function SendSearch2() {
  if (document.search_form2.p.value == ""||document.search_form2.p.value == "search") {
	alert ("キー・ワードを入力して下さい。");
  } else {
	document.search_form2.action="http://search.china-airlines.com/cgi-bin/tornado/searcher"
	document.search_form2.submit();
  }
}

function IsValidURL(){
	bValid = true
	bFoundSVR = false
	bFoundDIR = false
	bFoundURL = false
	strSVRFilter = "/calec."
	strDIRFilter = "" + 
		".com/club/ .com/e_club/ .com/tir/ .com/teclub/ .com/tclub/ " + 
		".com/echeckin/ " + 
		".com/olb/ " + 
		".com/emenu/ .com/eshopping/ ./com/experience/ ./com/talent/"
		
	strURLFilter = ".htm calmiles activation ebqry"
	arSVR = strSVRFilter.split(" ")
	arDIR = strDIRFilter.split(" ")
	arURL = strURLFilter.split(" ")
	
	strURL = location.href.toLowerCase();
	
	for (i=0;i<=arSVR.length-1;i++){
		if (strURL.indexOf(arSVR[i])>0){
			bFoundSVR = true
			break;
		}
	}
	
	if (bFoundSVR){
		for (i=0;i<=arDIR.length-1;i++){
			if (strURL.indexOf(arDIR[i])>0){
				bFoundDIR = true;
				break;
			}
		}
	}
	
	if (bFoundDIR){
		for (i=0;i<=arURL.length-1;i++){
			if (strURL.indexOf(arURL[i])>0){
				bFoundURL = true;
				break;
			}
		}
	}
	
	if (bFoundDIR && !bFoundURL){
		if (strURL.indexOf("https")==-1){
			bValid = false;
		}
	}
	
	return bValid;
}

bOK = IsValidURL()
if (!bOK){
	alert("すみません。 指定されたURLを訪問したが間違っています。 チャイナエアラインは、システムのホームページにリダイレクトされます。");
	window.location.href="http://www.china-airlines.co.jp/";
}

//////
function createXMLHttpRequest() {
  var XMLhttpObject = null;
  try {
    XMLhttpObject = new XMLHttpRequest();
  } catch (e) {
    try {
      XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {

        return null;
      }
    }
  }
  return XMLhttpObject;
}

/*firefox*/ 
function __firefox(){ 
HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style); 
window.constructor.prototype.__defineGetter__("event", __window_event); 
Event.prototype.__defineGetter__("srcElement", __event_srcElement); 
} 
function __element_style(){ 
return this.style; 
} 
function __window_event(){ 
return __window_event_constructor(); 
} 
function __event_srcElement(){ 
return this.target; 
} 
function __window_event_constructor(){ 
if(document.all){ 
return window.event; 
} 
var _caller = __window_event_constructor.caller; 
while(_caller!=null){ 
var _argument = _caller.arguments[0]; 
if(_argument){ 
var _temp = _argument.constructor; 
if(_temp.toString().indexOf("Event")!=-1){ 
return _argument; 
} 
} 
_caller = _caller.caller; 
} 
return null; 
} 
if(window.addEventListener){ 
__firefox(); 
} 
/*end firefox*/

function detectBrowser()//判斷是否用IE瀏覽器
 { 
  var sAgent = navigator.userAgent.toLowerCase();
  this.isIE = (sAgent.indexOf("msie")!=-1); //IE6.0-7
  this.isFF = (sAgent.indexOf("firefox")!=-1);//firefox
  this.isSa = (sAgent.indexOf("safari")!=-1);//safari
  this.isOp = (sAgent.indexOf("opera")!=-1);//opera
  this.isNN = (sAgent.indexOf("netscape")!=-1);//netscape
  this.isMa = this.isIE;//marthon
  this.isOther = (!this.isIE && !this.isFF && !this.isSa && !this.isOp && !this.isNN && !this.isSa);//unknown Browser
 }
 
function winunload() {

}
//function abortHttp() {
  //xmlhttp.abort();
//}
window.onbeforeunload = function () {
 var oBrowser = new detectBrowser();
 //if (oBrowser.isIE)
 //{
 
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey) {
if (document.getElementById('CoreBox') != null) {
  xmlhttp = createXMLHttpRequest();

  if (xmlhttp) {

    xmlhttp.onreadystatechange = winunload;
    
    //false - 表示發送消息之後一直等待回應（即同步執行的方式）； true - 表示發送消息之後不等待回應
    xmlhttp.open("GET","/e_club/jp/logout_j.asp",false);  
    xmlhttp.send(null);
    //timerID = setTimeout("abortHttp()",10*1000); //逾時
  }
}
}
 //}
 
}

//-->
