	var xmlHttp;

function createXMLHttpRequest() {
	if (typeof XMLHttpRequest != "undefined") {  // Mozilla / Safari / IE7
		//alert("no undefined");
		xmlHttp = new XMLHttpRequest();
		return xmlHttp;
    } else if (window.ActiveXObject) {        // IE
		//alert("windowsActive");
        var aVersions = [ "MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0",
                 "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHttp"
                ];
        for (var x = 0; x < aVersions.length; x++) {
            try {
                xmlHttp = new ActiveXObject(aVersions[x]);
                return xmlHttp;
            } catch (e) {
                // Do nothing
            }
        } // for
    } // if...else
    throw new Error("XMLHttp object could be created.");
}

//檢查帳號, 有無此帳號及是否已設定--Login
function ChkACSetEn(InputVal) {
	var Request ="sid=lnsac&AccountNo="+InputVal;
	var url = "GetData.php";//SearchAccount.php
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgAccountEn; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgAccountEn(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){ 
			document.forms[0].submit();
		}else{
			document.getElementById('MsgAC').innerHTML = response;
		}
	}
}
function LoginChkEn(AccNo,CHKNo,PWNo) {
	var Request ="sid=lnchk&Account="+AccNo+"&Password="+PWNo+"&Check="+CHKNo;
	var url = "GetData.php";//SearchLogin
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showLoginChkEn; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showLoginChkEn(){
	var strMsg; 
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){ 
			document.forms[0].submit();
		}else{
			document.getElementById('dispIDNo').className="ChkWrong";
			document.getElementById('dispIDNo').innerHTML =response; 
			document.forms[0].Password.value="";
			document.forms[0].AccountCHK.value="";
		}
	}
}
//忘記密碼，確認個人資料--ForgetPassword 2010-07-15 modify
function Individual(AccNo,IDno,Surname,GivenName,Email) {
	var Request ="sid=fgchk&AccountNo="+AccNo+"&Surname="+Surname+"&GivenName="+GivenName+"&Email="+Email+"&IDno="+IDno;
	var url = "GetData.php";//SearchIndividual
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showIndividual; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showIndividual(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){ 
			document.forms[0].Token.value="Go";
			document.forms[0].submit();
		}else{
			document.getElementById('TipArea').innerHTML = response;
		}
	}
}
//檢查證照號碼--首次設定審核證件--Login/LoginFirst
function AJCheckIDEn(AccNo,IdNo,SelVal) {
	var Request ="sid=lfsid&AID="+AccNo+"&IDNo="+IdNo+"&SelNo="+SelVal;
	var url = "GetData.php";//SearchID.php
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgIDEn; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgIDEn(){
	var strMsg; 
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){ 
			document.forms[0].submit();
		}else{
			document.getElementById('dispIDNo').className="red";
			document.getElementById('dispIDNo').innerHTML =response; 
		}
	}
}
//檢查AccountCHK for SetProfile 0808
function CHKSet(InputVal) {
	var Request ="sid=lfset&AccountCHK="+InputVal;
	var url = "GetData.php";//SearchCHK
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgCHKSet; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgCHKSet(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){
			response="<img src='http://www.pcapitalforex.com/images/ok.gif'>"; 
		}else{
			document.forms[0].AccountCHK.value="";
		}
		document.getElementById('disp').innerHTML = response;
	}
}
//檢查E-mail有無重覆 0808
function CheckEmail(InputVal,InputVal2) {
	var Request ="sid=chkem&Email="+InputVal+"&AccountNo="+InputVal2;
	var url = "GetData.php";//SearchEmail
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgEmail; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgEmail(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response=="Pass"){
			response="<img src='http://www.pcapitalforex.com/images/ok.gif'>";key="On";
		}else{
			document.forms[0].Email.value="";key="Off";
		}
		document.getElementById('MsgEmail').innerHTML = response;
		document.forms[0].EmailKey.value=key;
	}
}
//檢查AccountCHK-->應該沒用了
function SearchCHK(InputVal) {
	var Request ="AccountCHK="+InputVal;
	var url = "SearchCHK.php";
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgCHK; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgCHK(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		if(response!=0){ Msg="<img src='http://www.pcapitalforex.com/images/no.gif'> 抱歉！已有人使用，請重新設定"; key="Off";
		}else{ Msg="<img src='http://www.pcapitalforex.com/rl/images/ok.gif'>"; key="On";}
		document.getElementById('disp').innerHTML = Msg;
		document.Step4.CHKKey.value=key;
	}
}

//取歷史指數
function GetHistory(val){
	var Request ="sid=gtd&TID="+val;
	var url = "GetData.php";//GetTrend
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showResault; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
}
//修改資料
function ModifyAC(val,col){
	var Request ="AID="+val+"&CID="+col;
	var url = "GetModifyAC.php";
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showResault; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 

function showResault(){
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		document.getElementById('SC').innerHTML=response;
	}
}
//修改內容
function GetShowFA(val){
	var Request ="AID="+val;
	var url = "GetShowFA.php";
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showResault; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
//主頁經濟看板
function GetIndexEcon(){
	var Request ="sid=iec";
	var url = "GetData.php";
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgIEC; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgIEC(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		document.getElementById('main_left_2_main').innerHTML = response;
	}
}
//圖片驗證
function CheckCode(InputVal) {
	var Request ="sid=svr&VerifyCode="+InputVal;
	var url = "GetData.php";//SearchVerifyR
	//var xmlHttp = new XMLHttpRequest();
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgCHK; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
//分析
function GetEA(conuntry,val){
	var Request ="sid=sea&cid="+conuntry+"&tid="+val;
	var url = "GetData.php";
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = showMsgCHK; //配合顯示的函數但不用加()
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(Request);
} 
function showMsgCHK(){
	var strMsg; var go;
    if(xmlHttp.readyState == 4) {
		var response=xmlHttp.responseText;
		document.getElementById('disp').innerHTML = response;
	}
}

