//----------------------------------------------------
//常數定義
var myRegExpPattern_Acc = /^[A-Z0-9\-_.@]{5,}$/i;									//帳號：最少5位英數字，-_.@也可
var myRegExpPattern_Aid = /^[A-Z]{1}[A-Z0-9]{9}$/i;									//服務人員代碼：首位為英文字，後9位為英數字
var myRegExpPattern_Email = /^[A-Z0-9._%+-]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}$/i;		//Email address (anchored; no consecutive dots)
var myRegExpPattern_Mobile = /^09[0-9]{8}$/i;										//手機號碼：10位數字，首2位為"09"
var myRegExpPattern_Bankcode = /^[A-Z0-9]{4}$/i;									//通路代碼：4位英數字
var myRegExpPattern_Branchcode = /^[A-Z0-9]{1,10}$/i;								//分支代碼：最多10位英數字
//----------------------------------------------------


function FixStatus(str) { 
  status = str;
}

function chkStatus() {
	var NewWindow = window.open("empty.asp","testPopup","top=0,left=0,width=10,height=10");    
	if (!NewWindow){    
		   alert("您的瀏覽器正使用快顯封鎖功能(阻擋彈跳視窗)，可能導致部分功能無法正常使用，\n\n請解除快顯封鎖或將本網站加入至信任網域，以正常瀏覽本網站，謝謝您。");          
	}else{
		NewWindow.close();
	} 
}   
//setTimeout("chkStatus()",1000);

function OpenModalWindow(theURL,features) {
	var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
	if (isMSIE)	{
		window.showModalDialog(theURL,self,features);
	}
	else {
		alert('請使用Microsoft Internet Explorer開啟');
//		var features_ = features + ',modal=yes';
//		window.open(theURL,winPara,features_);
	}
}

function OpenSameNameWindow(theURL,winName,features,middleUrl,popupText,popupMode) {
	popupMode = popupMode.toLowerCase();

	switch (popupMode) {
	case "alert":
		alert(popupText);
		var myWindow = window.open(middleUrl,winName,features);
		myWindow.focus();
		myWindow.location.href = theURL;

		break;
	case "confirm":
		if (confirm(popupText)) {
			var myWindow = window.open(middleUrl,winName,features);
			myWindow.focus();
			myWindow.location.href = theURL;
		}
		else {
			//do nothing
		}

		break;
	default:

		break;
	}

}

function OpenNewWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function LTrim(str) {
	var whitespace = new String(" \t\n\r");
    var s = new String(str);

    if (whitespace.indexOf(s.charAt(0)) != -1) {
        var j=0, i = s.length;
        while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
            j++;
        }
        s = s.substring(j, i);
    }
    return s;
}
	
function RTrim(str) {
    var whitespace = new String(" \t\n\r");
    var s = new String(str);
	
    if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
        var i = s.length - 1;
        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
            i--;
        }
        s = s.substring(0, i+1);
    }
    return s;
}
	
function Trim(str) {
    return RTrim(LTrim(str));
}

function trimtxt(val,id){
	newval=Trim(val);
	document.getElementById(id).value=newval;	
}