﻿    this.Sleep = function ZZzzzZZzzzzzzZZZz(naptime){
        return;
        naptime = naptime * 1000;
        var sleeping = true;
        var now = new Date();
        var alarm;
        var startingMSeconds = now.getTime();
        while(sleeping){
            alarm = new Date();
            alarmMSeconds = alarm.getTime();
            if(alarmMSeconds - startingMSeconds > naptime){ sleeping = false; }
        }        
    }

//Microsoft.XMLHTTP

function Session_Abandon() {
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { //Msxml2.XMLHTTP
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }  
          xmlhttp.open("POST", "Session_Abandon.asp" , true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   //alert(xmlhttp.responseText)
               }
               else {
                   //alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          //this.Sleep(0.5) 
          xmlhttp.send();
          return 

}

function window_load() {
   if (document.getElementById("post_drawfont")) {
      document.getElementById("post_drawfont").src="/drawfont/?sys=" + Math.random()
      document.getElementById("post_drawfont").src="/drawfont/?sys2=" + Math.random()
   }
   
   if (document.all.Member_bankcard_yes) {
       if (document.all.Member_bankcard_yes(0).checked) {
           document.all.Member_bankcard_yes(0).click()
       }
       else if (document.all.Member_bankcard_yes(1).checked) {
           document.all.Member_bankcard_yes(1).click()
       }
   }
   
   if (document.all.Buy48H) {
      if (document.all.PINJIA) {
          chk24HbuyAutoPingJia(document.all.Buy48H ,'PINJIA')
      }
   }
   
   
   if (document.all.Set_Member_no) {
      if (document.all.get_Member_no) {
          onGet_Member_no(document.all.Set_Member_no,'get_Member_no')
      }
   }

   if (document.all.Set_appreciation) {
      if (document.all.Appreciation) {
          onAppreciation(document.all.Set_appreciation,'Appreciation')
      }
   }

   if (document.getElementsByName("setf")(0)) {
       
       if (document.all.selltype) {
           if (document.all.selltype.value == 'sell') {
               if (document.all.search_type) {
                   document.all.search_type(0).click()
               }
           }
       
           if (document.all.selltype.value == 'buy') {
               if(document.all.search_type) {
                  document.all.search_type(1).click()
               }
           }
       }

      //if (document.getElementsByName("setf")(0).value == "") {
         //load_left_GameName(document.getElementsByName("left_game_list_flag")(0).value)
         if (document.getElementById("jb1")) {
            left_GameName_ButtonMouseOver(document.getElementById("jb1"),"2")
         }
         
         if (document.getElementsByName("setf")(0).value.toLowerCase() == "") {
             list_length = 19
         }
         if (!(document.getElementsByName("setf")(0).value.toLowerCase() == "")) {
             list_length = 25
         }
         //alert (list_length)
         //ChangeMainMenu(2,list_length)

         //將選單值歸位
         
         //後台用---
         if (document.all.Games_no) {
             showMenuGames("/GetWebInfo/GetGames" ,"Games_no" ,document.all.GameMenuClass)
         }
         
         if (document.all.Games_server_no) {
             showMenuGames('/GetWebInfo/GetGamesServer?Games_no=' + document.all.GameMenuClass.value,'Games_server_no' ,document.all.GameServerMenuClass)
         }
         
         if (document.all.GamesItem) {
             showMenuGames("/GetWebInfo/GetGames" ,"GamesItem" ,document.all.GameMenuClass)
         }

         if (document.all.GameServer) {
             showMenuGames('/GetWebInfo/GetGamesServer?Games_no=' + document.all.GameMenuClass.value,'GameServer' ,document.all.GameServerMenuClass)
         }
         
         //showMenuGames("GetGames.asp" ,"GamesItem")
         
         if (document.all.GamesItem2) {
             showMenuGames("/GetWebInfo/GetGames?alllist=-1" ,"GamesItem2" ,document.all.GameMenuClass2)
         }
         
         if (document.all.GameServer2) {
             showMenuGames('/GetWebInfo/GetGamesServer?Games_no=' + document.all.GameMenuClass2.value + '&alllist=-1','GameServer2' ,document.all.GameServerMenuClass2)
         }
         
         if (document.all.drawfont) {
             document.all.drawfont.src = "/drawfont/?sys=" + Math.random()
             document.all.drawfont.src = "/drawfont/?sys2=" + Math.random()
         }
         
      //}

   }
   

   if ((document.getElementsByName("setf")(0).value.toLowerCase() == "listgameitem") && (!(document.all.GameMenuClass.value=="")) && (!(document.all.GameMenuClass.value=="0"))) {
       if (document.all.GameMenuClass) {
          load_left_GamesServer(document.all.GameMenuClass.value ,1)
       }

       if (document.getElementById("jb2")) {
          left_GameName_ButtonMouseOver(document.getElementById("jb2"),"2")
       }
       
       if (document.getElementById("jb2")) {
          left_GameName_ButtonMouseOut(document.getElementById("jb2"),"1")
       }
   }

ChangeMainMenu(2 ,19)
//load_left_GameName(2)
} 

function clearitemDetail(thisObj) {
         if (!document.all.clearFlag.value == "1") {
             document.all.clearFlag.value = "1"
             thisObj.value = ""
         }
}

function changebackgroundboard(value) {
   if (value == "1") {
     document.all.gameboard.background="images/d001.gif"
   }
   if (value == "2") {
     document.all.gameboard.background="images/d001_2.gif"
   }
}
//載入左邊遊戲選單
function load_left_GameName(flag) {
         //flag ==>> 2 熱門遊戲

          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 

              } 
              
          }   
         
         if (document.getElementsByName("setf")(0).value.toLowerCase() == "") {
             list_length = 19
         }
         if (!(document.getElementsByName("setf")(0).value.toLowerCase() == "")) {
             list_length = 25
         }
//alert("/javascript/left_GameName.asp?flag=" + flag + "&list_length=" + list_length )
          xmlhttp.open("GET", "/javascript/left_GameName.asp?flag=" + flag + "&list_length=" + list_length + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.getElementById("tableContainer").innerHTML = xmlhttp.responseText
               }
            }; 
          }

          //this.Sleep(0.5) 
          xmlhttp.send();
          
          return  
}

function load_left_GamesServer(gameno ,flag) {
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 

              } 
              
          }   
          
         if (document.getElementsByName("setf")(0).value.toLowerCase() == "") {
             list_length = 19
         }
         if (!(document.getElementsByName("setf")(0).value.toLowerCase() == "")) {
             list_length = 25
         }
//alert("/javascript/left_GameName.asp?gameno=" + gameno + "&flag=" + flag + "&list_length=" + list_length)
          xmlhttp.open("GET", "/javascript/left_GameName.asp?gameno=" + gameno + "&flag=" + flag + "&list_length=" + list_length  + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.getElementById("tableContainer").innerHTML = xmlhttp.responseText
                   document.getElementsByName("left_game_no_flag")(0).value = gameno
                   showMenuGames('GetGamesServer.asp?Games_no=' + gameno  ,'GameServer')
                   document.getElementsByName("GamesItem")(0).value = gameno  
               }
            }; 
          }

          //this.Sleep(0.5) 
          xmlhttp.send();
          
          return 

}

function left_GameName_ButtonMouseOver(ButtonObj ,changeID) {
         if (document.getElementsByName("left_game_list_flag")(0)) {
            if (document.getElementsByName("left_game_list_flag")(0).value) {
               if (changeID == document.getElementsByName("left_game_list_flag")(0).value) {
                  if (changeID == document.getElementsByName("left_game_list_flag")(0).value) {
                     ButtonObj.background='images/d002.gif'
                  }
                  else {
                     ButtonObj.background='images/d003.gif'
                  }
                  
               }
               else {
                  ButtonObj.background='images/d002.gif'
               }
            }
         }
}

function left_GameName_ButtonMouseOut(ButtonObj ,changeID) {
         if (document.getElementsByName("left_game_list_flag")(0)) {
            if (document.getElementsByName("left_game_list_flag")(0).value) {
               if (changeID == document.getElementsByName("left_game_list_flag")(0).value) {
                  ButtonObj.background='images/d002.gif'
               }
               else {
                  ButtonObj.background='images/d003.gif'
               }
            }
         }
}

function left_GameName_ButtonMouseClick(ButtonObj ,changeID) {
         document.getElementById("jb1").background='images/d003.gif'
         document.getElementById("jb2").background='images/d003.gif'
         document.getElementById("jb3").background='images/d003.gif'
         ButtonObj.background='images/d002.gif'
         document.getElementsByName("left_game_list_flag")(0).value = changeID
         document.getElementsByName("left_game_no_flag")(0).value = "0"
         //load_left_GameName(document.getElementsByName("left_game_list_flag")(0).value)
}

function GameListControl(Gameno ,serverno) {
         document.getElementsByName("GameServer")(0).value = serverno
         //location.href = "?set=ListGameItem&GamesNo=" + Gameno + "&Serverno=" + serverno
         if (document.all.search_type(0).checked) {
             st = "sell"
         }
         
         if (document.all.search_type(1).checked) {
             st = "buy"
         }
         
         location.href = "?set=ListGameItem&selltype=" + st + "&GamesItem=" + Gameno + "&GameServer=" + serverno + "&Item_category_no=0&SearchKey="
}





function showMenuGames(xmlpath ,listobj ,ReadObj){
    
    //for (var i=0;i<listobj.length;i++) {
    //     document.getElementsByName(listobj)(0).remove (0)
    //}
    
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("GET", xmlpath, true); 
    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
          //alert(xmlhttp.responseXML)
              var form=document.src_type;
              var m,na=[],color;
	          
	          if (document.getElementsByName(listobj)(0)) {
	              var m=document.getElementsByName(listobj)(0)
                  var na=getNodeValue(xmlhttp.responseXML,'item','value');
                  if (m.length==undefined) {
                      return
                  }
                  m.length=na.length;
                  for (var i=0;i<na.length ;i++){
                       m[i].text=na[i][1];
                       m[i].value=(na[i][0]).split('-')[0];
                       color = (na[i][0]).split('-')[1];
                       m[i].style.color = color;
                  }
                  if (!(new String(ReadObj)=="undefined")) {
                     if (!ReadObj.value == "") {
                         document.getElementsByName(listobj)(0).value = ReadObj.value
                     }
                  }
              }
              
          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send();      
}


function idChecker(idNumber) /*函數宣告*/
{
    var pass=0; /*為了通過後面的防呆所以...*/
    var num=new Array(11); /*用來存轉換碼加九個數字 */
    var sum=0; /*計算經過公式後的加總*/
    input=idNumber; /*存文字框的內容*/
    var table=new Array(10,11,12,13,14,15,16,17,18,34,19,20,21,22,35,23,24,25,26,27,28,29,32,30,31,33); /*轉換的對照表*/
    /*以下是防呆*/
    if(input.length!=10)
        return 2 //長度不合
    else if(input.charCodeAt(0)<"A".charCodeAt(0)||input.charCodeAt(0)>"Z".charCodeAt(0))
        return 3 // 第一個字母要英文
    else if(input.charCodeAt(1)!="1".charCodeAt(0)&&input.charCodeAt(1)!="2".charCodeAt(0))
        alert("第一個數字必須是1或2");
    else
    {
        for(p=2;p<10;p++)
        {
            if(input.charCodeAt(p)<"0".charCodeAt(0)||input.charCodeAt(p)>"9".charCodeAt(0))
            {
                return 4 // 後九碼要數字
                break;
            }
            else
                pass++;
        }
    }
    if(pass!=8)
        return false;
    /*以上是防呆*/
    num[1]=table[input.charCodeAt(0)-65]%10;
    num[0]=(table[input.charCodeAt(0)-65]-num[1])/10;
    for(p=1;p<10;p++)
        num[p+1]=input.charCodeAt(p)-48;
    for(p=1;p<9;p++)
        num[p]=num[p]*(10-p); /*套用公式*/
    for(p=0;p<11;p++)
        sum+=num[p];
    if(sum%10==0) /*檢查*/
        return 0; //OK
    else
        return 1;
    //return ture;
}

function leftTrim(sString) 
{
while (sString.substring(0,1) == " ")
{
sString = sString.substring(1, sString.length);
}
return sString;
}

function rightTrim(sString) 
{
while (sString.substring(sString.length-1, sString.length) == " ")
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

function trimAll(sString) 
{
while (sString.substring(0,1) == " ")
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == " ")
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}


function getNodeValue(xmldoc,key,label) {

	var na=[],l;
	var xml=xmldoc.getElementsByTagName(key);
	//alert(xml.length);
	if (xml.length>0){
		for (var i=0;i<xml.length;i++){
			l=Math.max(na.length,na.length-1);
			if(xml[i].getAttribute(label)!='' && xml[i].getAttribute(label)!=null){
				na[l]=[xml[i].getAttribute(label),xml[i].childNodes[0].nodeValue];
			}else{
				na[l]=[key,xml[i].childNodes[0].nodeValue];
			}
		}
	}

	return na
}

function SubmitSearch (thisform) {
         
         thisform.submit()
}

function submitmainweb(action) {
         if (document.all.tmpsubmit) {
            document.all.tmpsubmit.action = action
            document.all.tmpsubmit.submit()
         }
}

function ForgetTypeSet(thisObj) {
//alert (thisObj.checked)
         if (thisObj.checked) {
             document.all.PromptText.innerText = "Email："
         }
         else {
             document.all.PromptText.innerText = "帳號："
         }
         
}

 function CheckMail(objMail) {
          var Myemail = objMail.value;
          var rege = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9])+$/;
          if (Myemail.length == 0 || rege.exec(Myemail) == null) {
             return false;
          }
          return true;
 }


function checkMailFormat (emailObj) {
 if(emailObj.value.length!=0)
  {
    if (emailObj.value.charAt(0)=='.' ||        
         emailObj.value.charAt(0)=='@'||       
         emailObj.value.indexOf('@', 0) == -1 || 
         emailObj.value.indexOf('.', 0) == -1 || 
         emailObj.value.lastIndexOf('@')==emailObj.value.length-1 || 
         emailObj.value.lastIndexOf('.')==emailObj.value.length-1)
     {
      return false;
      }
   }
 else
  {
   return false;
   }
 return true;
} 


function  CheckInfo(logFlag) {
    var vbTab = String.fromCharCode(9)
    var xmlpath = "chk_ForgetPassword_Info/?system=" + Math.random()


    if (document.all.Member_id.value.replace(" ","") == "") {
        if (document.all.ForgetType.checked) {
            alert("請輸入電子郵件!")
        }
        else {
            alert("請輸入註冊帳號!")
        }
        
        document.all.Member_id.focus()
        return false;
    }
    
    if (document.all.ForgetType.checked) {
        if (!CheckMail(document.all.Member_id)) {
            alert("EMAIL 格式錯誤！")
            return false;
        }
    }    

    if (document.all.Member_name.value.replace(" ","") == "") {
        alert("請輸入真實姓名!") 
        document.all.Member_name.focus()
        return false;
    }
    
    if (document.all.Member_national_id.value.replace(" ","") == "") {
        alert("請輸入身分證字號!") 
        document.all.Member_national_id.focus()
        return false;
    }
    if (document.all.Member_birthday.value.replace(" ","") == "") {
        alert("請輸入身出生日期!") 
        document.all.Member_birthday.focus()
        return false;
    }    
    
    if (document.all.ForgetType.checked) {       
        var PostString = "ForgetType=1&Member_id=" + document.all.Member_id.value + "&Member_name=" + document.all.Member_name.value + "&Member_national_id=" + document.all.Member_national_id.value + "&Member_birthday=" + document.all.Member_birthday.value
    }
    if (!(document.all.ForgetType.checked)) {
        var PostString = "ForgetType=0&Member_id=" + document.all.Member_id.value + "&Member_name=" + document.all.Member_name.value + "&Member_national_id=" + document.all.Member_national_id.value + "&Member_birthday=" + document.all.Member_birthday.value
    }
    
    
    if (logFlag == "1") {
       PostString = PostString  + "&LoginType=1" + "&Member_ans=" + document.all.Member_ans.value
    }
    //alert(PostString)
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded;charset=utf-8")
    xmlhttp.setRequestHeader ("Content-Length",PostString.length)
    
    xmlhttp.onreadystatechange = function(){ 
      if (xmlhttp.readyState == 4) {
         if (xmlhttp.status == 200) {
         //alert(xmlhttp.responseText)
            if (logFlag == "1") {
               if (xmlhttp.responseText == vbTab) {
                  alert("問題回答錯誤!")
                  document.all.Member_ans.focus()
                  return false;
               }
               else {
                  //alert(xmlhttp.responseText)
                  if (xmlhttp.responseText == "0") {
                      alert("注意！補發新密碼每日僅限一次。")
                  }
                  else {
                     location.href = "?Set=Msg&MsgNumber=54101299"
                  }
               }

            }
            else {
               if (xmlhttp.responseText == vbTab) {
                  alert("查無會員資料!")
               }
               else {
                  document.all.forgot_info_x.style.display = "none"
                  document.all.tr_quez.style.display = ""
                  prompt_text.innerHTML = xmlhttp.responseText
               }
            }
         }
         else {
         //alert(xmlhttp.responseText)
            alert("Ajax 系統錯誤!")
         }
      };
    }
    

    //this.Sleep(0.5) 
    xmlhttp.send(PostString);      
        
}


function SubmitPasswordReGet() {
         
}

function getcalendar(thisObj) {
         calreturn = window.showModalDialog("calendar.asp?" + Math.random ,null, "dialogWidth:270px; dialogHeight:320px; status:0; scroll:no;");
         if (!calreturn == "") {
            thisObj.value = calreturn 
         }
          
         else {
            thisObj.value = ""
         }

}

function getChtCalendar(thisObj) {
         calreturn = window.showModalDialog("Calendar_Cht.asp?" + Math.random ,null, "dialogWidth:270px; dialogHeight:320px; status:0; scroll:no;");
         if (!calreturn == "") {
            thisObj.value = calreturn 
         }
          
         else {
            thisObj.value = ""
         }

}


//檢查密碼函數 (會員註冊)
function chkMemberPassword(Password ,BoardObj){
    //if (!(Password.length > 0)) {
    //    getmsgboard('4' ,BoardObj ,'23')
    //    return false
    //}

    //if (Password.length < 6 || Password.length > 12) {
    //    getmsgboard('4' ,BoardObj ,'21')
    //    return false
    //}
    
    //if (Password.length >= 6 && Password.length <= 12) {
    //    getmsgboard('1' ,BoardObj ,'22')
    //    return false
    //}
    
    if (Password == form1.Member_id.value) {
        getmsgboard('4' ,BoardObj ,'25')
        return true;
    }
    
    getmsgboard('2' ,BoardObj ,'15')
    var xmlpath = "chk_RegMemberAjax/chkMemberPassword/"
    var MemVar = "MemPassword=" + ((((Password.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
          //alert (xmlhttp.responseText)
              if (xmlhttp.responseText == String.fromCharCode(9) + String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'23')
                  return false
              }

              if (xmlhttp.responseText == String.fromCharCode(9) + String.fromCharCode(9) + String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'21')
                  return false
              }
                            
              if (xmlhttp.responseText == String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'24')
                  return false
              }
              
              if (xmlhttp.responseText == Password) {
                  getmsgboard('1' ,BoardObj ,'22')
                  return false
              }

          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send(MemVar);  


}


//檢查確認密碼函數 (會員註冊)
function chkMemberRePassword(Password ,RePassword ,BoardObj){
    if (RePassword == "") {
        getmsgboard('4' ,BoardObj ,'33')
        return false
    }
    
    if (Password == RePassword) {
        getmsgboard('1' ,BoardObj ,'32')
        return false
    }
    
    if (!(Password == RePassword)) {
        getmsgboard('4' ,BoardObj ,'31')
        return false
    }
    

}


//檢查姓名函數 (會員註冊)
function chkMemberName(MemName ,BoardObj){
    if (MemName == ""){
        getmsgboard('4' ,BoardObj ,'44')
        return false
    }

    if (MemName.length < 2 || MemName.length > 5){
        getmsgboard('4' ,BoardObj ,'42')
        return false
    }

    getmsgboard('2' ,BoardObj ,'4')
    var xmlpath = "chk_RegMemberAjax/chkMemberName/"
    var MemVar = "MemName=" + ((((MemName.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'41')
                  return false
              }
              
              if (xmlhttp.responseText == MemName ){
                  getmsgboard('1' ,BoardObj ,'43')
                  return false
              }
          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send(MemVar);  
}


//檢查帳號函數 (會員註冊)
function chkMemberIdExist(MemId ,BoardObj) {
    //if (trimAll(MemId) == "") {
    //    getmsgboard('2',mem1,'1')
    //    return false
    //}
    getmsgboard('2' ,BoardObj ,'15')
    var xmlpath = "chk_RegMemberAjax/chkMemberIdExist/"
    var MemVar = "MemId=" + ((((MemId.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
       //alert(xmlhttp.responseText )
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == String.fromCharCode(9)){
                  getmsgboard('2' ,BoardObj ,'1')
                  return false
              }

              if (xmlhttp.responseText == String.fromCharCode(9) + String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'12')
                  return false
              }
                            
              if (xmlhttp.responseText == String.fromCharCode(13) + String.fromCharCode(10)){
                  getmsgboard('4' ,BoardObj ,'17')
                  return false
              }
              
              if (xmlhttp.responseText == "") {
                  getmsgboard('1' ,BoardObj ,'16')
                  return false
              }
              
              if (!(xmlhttp.responseText == "")) {
                  getmsgboard('4' ,BoardObj ,'14')
                  return false
              }
          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send(MemVar);   
}

//檢查會員的EMAIL
function chkMemberMail(InpuField ,BoardObj) {
    var Mail = InpuField.value
    getmsgboard('2' ,BoardObj ,'62')


    
    var xmlpath = "chk_RegMemberAjax/chkMemberMailUsing/"
    var MemVar = "Mail=" + ((((Mail.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == "0") {
                  getmsgboard('4' ,BoardObj ,'64')
              }
              
              else {
                  if (checkMailFormat (InpuField)) {
                      getmsgboard('1' ,BoardObj ,'63')
                      return false        
                  }
                  if (!(checkMailFormat (InpuField))) {
                      getmsgboard('4' ,BoardObj ,'61')
                      return false
                  }
              }
          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send(MemVar);     
}



//選擇會員生日
function getMemberBirthdayCalendar(InpuField ,BoardObj) {
    getcalendar(InpuField)
    InpuField.blur()
}

//選擇台灣民國日期
function getChineseDate(InpuField ,BoardObj) {
    getChtCalendar(InpuField)
    InpuField.blur()
}


function IsNumeric(sText)
{	//判斷是否為數值
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
 }

//取得該年當月的最大天數
function getMaxDate(Year ,Month) {
  var TryMonth = 0
  var TryYear = 0

  if (IsNumeric(Year) && IsNumeric(Month)) {
     if (eval(Month) == 12) {
        TryMonth = 1
        TryYear = eval(Year) + 1
     }
     
     else {
        TryMonth = eval(Month) + 1
        TryYear = eval(Year)   
     }
     var TmpDate = new Date (TryYear + "/" + TryMonth + "/1") 
     TmpDate = DateChange(TmpDate ,1) //TmpDate - 1
     var ReturnDay = (TmpDate.getDate()) //.getDay()
     //alert(TmpDate)
     //alert(ReturnDay) //(TmpDate)
     return ReturnDay
  }
  
  else {
     return 0
  }

}

function DateChange(DateValue ,Day)
{
  //可以加上错误处理
  var a = DateValue 
  a = a.valueOf()
  a = a - Day * 24 * 60 * 60 * 1000
  a = new Date(a)
  return a;
}

//檢查會員生日(日期是否沒有符合規定)
function chkMemberBirthday(Yeay_InpuField ,Month_InpuField ,Day_InpuField ,BoardObj) {
    if (Yeay_InpuField.value == "0" || Month_InpuField.value == "0" || Day_InpuField.value == "0") {
        getmsgboard('2' ,BoardObj ,'5')
        return false
    }
    
    var MaxDays = getMaxDate((eval(Yeay_InpuField.value)), Month_InpuField.value)
    var InDay = eval(Day_InpuField.value)
    var bDate = Yeay_InpuField.value +"/" + Month_InpuField.value + "/" + Day_InpuField.value
    var cDate = (eval(Yeay_InpuField.value)) +"/" + Month_InpuField.value + "/" + Day_InpuField.value

    if (MaxDays < InDay) {
        getmsgboard('4' ,BoardObj ,'54')
        return false        
    }
    
    getmsgboard('2' ,BoardObj ,'53')
    var xmlpath = "chk_RegMemberAjax/chkMemberBirthday/"
    var MemVar = "date=" + cDate

    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == cDate) {
                  getmsgboard('1' ,BoardObj ,'51')
                  return false
              }
              
              if (!(xmlhttp.responseText == cDate)) {
                  getmsgboard('4' ,BoardObj ,'50')
                  return false
              }
              
          }
       }; 
    }

    //this.Sleep(0.5) 
    xmlhttp.send(MemVar);   
}



//檢查會員生日(日期是否沒有符合規定)
function chkMemberBirthday2(Yeay_InpuField ,Month_InpuField ,Day_InpuField) {
    if (Yeay_InpuField.value == "0" || Month_InpuField.value == "0" || Day_InpuField.value == "0") {
        //getmsgboard('2' ,BoardObj ,'5')
        return false
    }
    
    var MaxDays = getMaxDate((eval(Yeay_InpuField.value)), Month_InpuField.value)
    var InDay = eval(Day_InpuField.value)
    var bDate = Yeay_InpuField.value +"/" + Month_InpuField.value + "/" + Day_InpuField.value
    var cDate = (eval(Yeay_InpuField.value)) +"/" + Month_InpuField.value + "/" + Day_InpuField.value

    if (MaxDays < InDay) {
        alert('生日格式有錯!('+ Yeay_InpuField.value +'年'+ Month_InpuField.value +'月只有'+ MaxDays  +'天,請重新選擇)')
        Day_InpuField.value = 1
        return false
    }
    
    var xmlpath = "chk_RegMemberAjax/chkMemberBirthday/"
    var MemVar = "date=" + cDate

    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == cDate) {
                  //getmsgboard('1' ,BoardObj ,'51')
                  return false
              }
              
              if (!(xmlhttp.responseText == cDate)) {
                  //getmsgboard('4' ,BoardObj ,'50')
                  return false
              }
              
          }
       }; 
    }

    xmlhttp.send(MemVar);   
}







//檢查會員身分證發證日期(日期是否沒有符合規定)
function chkMemberID_Date(Yeay_InpuField ,Month_InpuField ,Day_InpuField ,BoardObj) {
    if (Yeay_InpuField.value == "0" || Month_InpuField.value == "0" || Day_InpuField.value == "0") {
        getmsgboard('2',memE,'E')
        return false
    }
    
    var MaxDays = getMaxDate((eval(Yeay_InpuField.value) + 1911), Month_InpuField.value)
    var InDay = eval(Day_InpuField.value)
    var bDate = Yeay_InpuField.value +"/" + Month_InpuField.value + "/" + Day_InpuField.value
    var cDate = (eval(Yeay_InpuField.value) + 1911) +"/" + Month_InpuField.value + "/" + Day_InpuField.value

    if (MaxDays < InDay) {
        getmsgboard('4' ,BoardObj ,'E5')
        return false        
    }
    
    //if (Yeay_InpuField.value == "0" || Month_InpuField.value == "0" || Day_InpuField.value == "0") {
    //    getmsgboard('4' ,BoardObj ,'E4')
    //    return false
    //}
    
    getmsgboard('2' ,BoardObj ,'53')
    var xmlpath = "chk_RegMemberAjax/chkMemberBirthday/"
    var MemVar = "date=" + cDate

    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == cDate) {
                  getmsgboard('1' ,BoardObj ,'E2')
                  return false
              }
              
              //alert(xmlhttp.responseText)
              if (!(xmlhttp.responseText == cDate)) {
                  getmsgboard('4' ,BoardObj ,'E3')
                  return false
              }
              
          }
       }; 
    }

    xmlhttp.send(MemVar);   
}

//身分證基本檢查
function idChk(idNum,BoardObj) {
    if (idNum == "") {getmsgboard('4' ,BoardObj ,'D3') ; return false}
    
    getmsgboard('2' ,BoardObj ,'D5')
    
    // 如果身分證驗證錯誤
    switch (check_identity (idNum)) {
            case 0 : {getmsgboard('1' ,BoardObj ,'D2') ;return false}
            case 1 : {getmsgboard('4' ,BoardObj ,'D1') ;return false}
            case 2 : {getmsgboard('4' ,BoardObj ,'D4') ;return false}
            case 3 : {getmsgboard('4' ,BoardObj ,'D6') ;return false}
            case 4 : {getmsgboard('4' ,BoardObj ,'D7') ;return false}
    }
}

//檢測身分證真偽
function CheckIdentification(IDCard_Number ,IDDate ,BoardObj ,button) {
    // 如果身分證驗證錯誤
    switch (check_identity (IDCard_Number)) {
            //case 0 : {getmsgboard('1' ,BoardObj ,'D2') ;return true}
            case 1 : {getmsgboard('4' ,BoardObj ,'D1') ;return true}
            case 2 : {getmsgboard('4' ,BoardObj ,'D4') ;return true}
            case 3 : {getmsgboard('4' ,BoardObj ,'D6') ;return true}
            case 4 : {getmsgboard('4' ,BoardObj ,'D7') ;return true}
    }
    
    for (i=0; i<IDDate.split("/").length; i++) {        
         if (trimAll(IDDate.split("/")[i]) == "" || trimAll(IDDate.split("/")[i]) == "0") {
             getmsgboard('4' ,BoardObj ,'45')
             return true;
         }
    }
    
    button.disabled = true
    if (IDCard_Number.value == "") {
        getmsgboard('4' ,BoardObj ,'F5')
        button.disabled = false
        return false
    }
    getmsgboard('2' ,BoardObj ,'F3')
    var xmlpath = "chk_RegMemberAjax/IdentificationCardCheck/"
    var MemVar = "IDCard_Number=" + IDCard_Number + "&IDDate=" + IDDate
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              //alert(xmlhttp.responseText)
              switch (xmlhttp.responseText) {
                      case "0" :
                           {getmsgboard('1' ,BoardObj ,'F4');form1.TmpIDCardNumber.value=IDCard_Number ;form1.TmpIDCardDate.value=IDDate ;button.disabled = false ;return false}
                      case "1" :
                           {getmsgboard('4' ,BoardObj ,'F7');button.disabled = false ;return false}
                      case "4" :
                           {getmsgboard('4' ,BoardObj ,'F8');button.disabled = false ;return false}
                      case "3" :
                           {getmsgboard('4' ,BoardObj ,'F9');button.disabled = false ;return false}
                      case "2" :
                           {getmsgboard('4' ,BoardObj ,'FA');button.disabled = false ;return false}
                      case "5" :
                           {getmsgboard('4' ,BoardObj ,'FB');button.disabled = false ;return false}
                      case String.fromCharCode(9) + String.fromCharCode(9) :
                           {getmsgboard('4' ,BoardObj ,'F5');button.disabled = false ;return false}
                      case String.fromCharCode(9) :
                           {getmsgboard('4' ,BoardObj ,'F9');button.disabled = false ;return false}
                      case "9" :
                           {getmsgboard('4' ,BoardObj ,'FC');button.disabled = false ;return false}
              }
              
          }
          //alert(xmlhttp.responseText)
       }; 
    }

    xmlhttp.send(MemVar);   
}


function getmsgboard(Board_no ,BoardObj ,PromptText_no) {
        Tmp = (document.getElementById("board" + Board_no).outerHTML)
        BoardObj.innerHTML = (Tmp.replace('{msg}',getmsg(PromptText_no))).replace("board" + Board_no ,"table" + Board_no)
        return false;
}

function submaskCtrl(SubMaskObj ,thisObj) {
         if (thisObj.checked) {
             SubMaskObj.style.display = ""
             SubMaskObj.style.top = "1076px" 
             SubMaskObj.style.width = "738" 
             //SubMaskObj.style.top = "594px" 
             //SubMaskObj.style.height = "120" 
             //SubMaskObj.style.z-index="0"
         }

         if (!(thisObj.checked)) {
             SubMaskObj.style.display = "none"
             //SubMaskObj.style.top = "998" 
             //SubMaskObj.style.height = "120" 
             //SubMaskObj.style.z-index="0"
         }

}

function getmsg(msg_no) {
         switch (msg_no) {
         
                 //帳號檢測文件
                 case "1"  : {return "由英文字母（不區分大小寫）、數字（0-9）、下劃線、連字元號組成，長度為6-12個字元。"}
                 case "11" : {return "請填寫帳號！"}
                 case "12" : {return "帳號長度為 6-12 個字元，請重新輸入帳號！"}
                 case "13" : {return "帳號不能填寫中文！"}
                 case "14" : {return "您填寫的會員帳號已被使用，請更改！"}
                 case "15" : {return "正在檢測中,請稍候！"}
                 case "16" : {return "帳號檢測成功，可以使用。"}
                 case "17" : {return "帳號應該是數字、字母、下劃線、連字元號，不允許出現漢字、空格、點等其他字元，請重新填寫帳號！"}                 
                 
                 case "2"  : {return "密碼長度為 6-12 位元，字母請區分大小寫，為了你的帳號安全，請使用字母加數字的組合，建議帳號密碼勿與其他遊戲、其他交易網相同。"}
                 case "21" : {return "密碼長度為 6-12 位，請重新填寫！"}
                 case "22" : {return "密碼格式正確！"}    
                 case "23" : {return "請填寫密碼！"}    
                 case "24" : {return "密碼中不允許含有&,%,=,+,'字元，請重新填寫密碼！"}
                 case "25" : {return "密碼不可與帳號相同！"}
                                  
                 case "3"  : {return "請再填寫一遍你上面填寫的密碼。"}
                 case "31" : {return "兩次填寫密碼不相同，請重新填寫確認密碼！"}
                 case "32" : {return "確認密碼正確。"}
                 case "33" : {return "確認密碼不能為空，請重新填寫！"}
                 
                 case "4"  : {return "不實姓名無法交易和取款。姓名只能是中文，長度為2 - 5 個字元。"}
                 case "41" : {return "真實姓名只能是中文！"}
                 case "42" : {return "真實姓名長度不能少於2個或者大於5個！"}
                 case "43" : {return "真實姓名填寫正確。"}
                 case "44" : {return "請填寫真實姓名。"}
                 case "45" : {return "發證日期尚未確認。"}
                 case "46" : {return "身分證號碼上未填寫。"}
                 
                 case "5"  : {return "請認真填寫你的生日，註冊完成後不可更改。"}
                 case "50" : {return "出生日期選擇錯誤。"}
                 case "51" : {return "出生日期選擇正確。"}
                 case "52" : {return "出生日期不可為空。"}
                 case "53" : {return "正在檢測中,請稍候！"}
                 case "54" : {return "出生日期填寫錯誤(請確認當月的天數)。"}

                 case "6"  : {return "請填寫你真實的電子信箱。"}
                 case "61" : {return "請填寫正確的電子郵件位址！"}
                 case "62" : {return "正在檢測中,請稍候！"}
                 case "63" : {return "郵箱檢測成功，可以使用。"}
                 case "64" : {return "電子郵件已經被其他用戶使用，請改用其他電子郵件。"}

                 case "6x1"  : {return "請選擇您的性別！"}
                 case "6x11"  : {return "請確認您的性別！"}
                 case "6x12"  : {return "性別選擇完成！"}
                 
                 case "6x2"  : {return "請填寫您的暱稱！"}
                 case "6x21"  : {return "暱稱長度為 2-12 位，請重新填寫！"}
                 case "6x22"  : {return "暱稱僅能中文英文與數字的組合，不允許含有&,%,=,+,'字元，請重新填寫密碼！，請重新填寫！"}
                 case "6x23"  : {return "暱稱可以使用！"}
                 case "6x24"  : {return "暱稱已經被其他用戶使用！"}
                 
                 case "7"  : {return "請填寫真實的詳細地址，不真實的地址將無法索取發票。"}
                 case "71" : {return "地址填寫完成。"}
                 case "72" : {return "可能是有問題的地址。"}
                 case "73" : {return "地址目前為空的。"}
                 
                 case "8"  : {return "請填寫你的行動電話。"}
                 case "81" : {return "行動電話只能是數字組成！。"}
                 case "82" : {return "行動電話填寫完成。"}
                 
                 case "8x"  : {return "請填寫正確的行動電話號碼。"}
                 case "8x1" : {return "行動電話只能是數字組成！。"}
                 case "8x2" : {return "行動電話填寫完成。"}
                 case "8x3" : {return "驗證碼簡訊處理中..."}
                 case "8x4" : {return "您填寫的行動電話已被使用，一支電話只能一位會員使用，請更改！"}
                 case "8x5" : {return "手機簡訊發送失敗！"}
                 case "8x6" : {return "系統十分鍾內不能連續發送簡訊，請稍候再試！"}
                 case "8x7" : {return "行動電話驗證碼已發送到你的行動電話，請填寫行動電話驗證碼。"}
                                  
                 case "9" : {return "請填寫你的行動電話收到的4位英文或數字驗證碼(注意英文大小寫)。"}
                 case "91" : {return "驗證碼填寫正確。"}
                 case "92" : {return "驗證碼填寫錯誤，請核對驗證碼。"}
                                  
                 case "A"  : {return "請用你填寫的固定電話，撥打 (02) 7720-1868 進行固定電話驗證。 "}
                 case "A1" : {return "請填寫並<font color='#FF0000'>驗證</font>你的固定電話。"}
                 case "A2" : {return "固定電話只能是數字組成！"}
                 case "A3" : {return "固定電話長度不正確！"}
                 case "A4" : {return "固定電話填寫正確，請用你填寫的固定電話，撥打 (02) 7720-1868 進行固定電話驗證。 "}
                 case "A5" : {return "請填寫固定電話！。"}
                 case "A6" : {return "固定電話驗證成功！。"}
                 case "A7" : {return "固定電話驗證失敗，請用你填寫的固定電話，撥打 (02) 7720-1868 進行固定電話驗證。"}
                 
                 case "B"  : {return "請填寫正確的固定電話號碼。"}
                 case "B1" : {return "正在檢測中,請稍候！"}
                 case "B2" : {return "固定電話查無驗證記錄，請確認已撥打(02) 7720-1868 進行固定電話驗證。"}
                 case "B3" : {return "固定電話已驗證通過。"}
                 //case "B4" : {return "請填寫正確的固定電話號碼。"}
                 
                 case "C"  : {return "連絡時注意事項,例如xx至xx方便接聽來電等等,此欄位可不填。"}
                 case "C1" : {return "聯絡說明填寫完成。"}
                 case "C2" : {return "聯絡說明未填寫。"}
                 
                 case "D"  : {return "請填寫你的身分證字號，真實身分證字號將用於取回密碼、儲值、取款等重要事項。 "}
                 case "D1" : {return "身分證字號格式不正確！"}
                 case "D2" : {return "身分證字號檢測正確！"}
                 case "D3" : {return "身分證字號不可為空！"}
                 case "D4" : {return "身分證字號長度錯誤！"}
                 case "D5" : {return "正在檢測中,請稍候！"}
                 case "D6" : {return "身分證字號第一個字元必須為字母！"}
                 case "D7" : {return "身分證字號後九碼必須為數字！"}
                            
                 case "E"  : {return "請選擇你的身分證發證日期。 "}
                 case "E1" : {return "抱歉，身分證發證日期在民國94年12月以前不能驗證！ "}
                 case "E2" : {return "身分證發證日期選擇完成。"}
                 case "E3" : {return "身分證發證日期格式錯誤。"}
                 case "E4" : {return "請填寫身分證發證日期。"}
                 case "E5" : {return "身分證發證日期填寫錯誤(請確認當月的天數)。"}

                 case "F"  : {return "你填寫的身分證必須通過驗證才能成功註冊為會員。 "}
                 case "F1" : {return "請先驗證您的行動電話！ "}
                 case "F2" : {return "請先驗證您的固定電話！ "}
                 case "F3" : {return "正在檢測中,請稍候！ "}
                 case "F4" : {return "身分檢測成功，可以註冊。"}
                 case "F5" : {return "身分證號碼不可為空。"}
                 case "F6" : {return "請填寫身分證發證日期。"}
                 case "F7" : {return "您輸入的身分證有誤。"}
                 case "F8" : {return "此身分證字號被鎖定,24小時內不能註冊。"}
                 case "F9" : {return "您輸入的發證日期錯誤。"}
                 case "FA" : {return "身分證驗證失敗,請重新確認輸入的資料。"}
                 case "FB" : {return "身分證驗證連線作業忙碌,請稍後重試。"}
                 case "FC" : {return "身分證已經被其他使用者註冊過。"}
                 
                 case "G" : {return "請選擇一個您的問題。"}
                 case "G1" : {return "請正確選擇您的問題。"}
                 case "G2" : {return "您的問題選擇完成。"}
                 
                 case "H" : {return "請填寫問題的答案。"}
                 case "H1" : {return "請填寫您要回答問題的答案。"}
                 case "H2" : {return "回答問題內容填寫完成。"}
                 //case "FB" : {return "身分證驗證發生異常錯誤,請連繫網站管理員。"}
         }
         
}

//檢察連絡事項
function chkContactExplain(ContactExplainText ,BoardObj) {
     if (trimAll(ContactExplainText) == "") {
         getmsgboard('2' ,BoardObj ,'C2')
     }
     if (!trimAll(ContactExplainText) == "") {
         getmsgboard('2' ,BoardObj ,'C1')
     }
   
}

//註冊時驗正固定電話
function RegisterChkTelPhone(locnumber, phoneNumber ,BoardObj) {
    getmsgboard('2' ,BoardObj ,'B1') ;
    if (trimAll(phoneNumber) == "") {
        getmsgboard('4' ,BoardObj ,'9') ;return true;
    }
    
    // 檢查電話號碼長度
    if (!(phoneNumber.length >= 8)) {
       getmsgboard('4' ,BoardObj ,'A3');
       return true;             
    }
    if (locnumber == "") {
        getmsgboard('4' ,BoardObj ,'A5');
        return true;            
    }
         
    if (!IsNumeric(phoneNumber)) {
       getmsgboard('4' ,BoardObj ,'A2');
       return true;             
    }

    //取得是否已有固定電話驗證
    var xmlpath = "chk_RegMemberAjax/RegMemberPhoneConfirm/"
    var MemVar = "PhoneNumber=" + phoneNumber //"MobileNumber=" + ((((MobilePhoneValue.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == "1") {
                  form1.TmpPhone.value = locnumber + phoneNumber
                  getmsgboard('1' ,BoardObj ,'A6') ;return true;
              }
              if (!(xmlhttp.responseText == "1")) {
                  getmsgboard('4' ,BoardObj ,'A7') ;return true;
              }
 
          }
       }; 
    }

    xmlhttp.send(MemVar);   
         
}

//檢測手機驗證碼
function RegisterChkMobileChkCode(ChkCode ,BoardObj) {
    if (trimAll(ChkCode) == "") {
        getmsgboard('2' ,BoardObj ,'9') ;return true;
    }
    MobilePhoneValue = document.all.mobileTel.value + document.all.mobileTel1.value + document.all.mobileTel2.value
    var xmlpath = "chk_RegMemberAjax/RegisterChkMobileChkCode/"
    var MemVar = "MobileNumber=" + ((((MobilePhoneValue.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == ChkCode) {
                  getmsgboard('1' ,BoardObj ,'91') ;return true;
              }
              if (!(xmlhttp.responseText == ChkCode)) {
                  getmsgboard('4' ,BoardObj ,'92') ;return true;
              }
 
          }
       }; 
    }

    xmlhttp.send(MemVar);   
}

//傳送手機驗證碼
function SendMobileChkCode(MobileHeadNumberObj ,MobileSecNumberObj ,MobileLastNumberObj ,BoardObj) {
    if ((!(trimAll(MobileHeadNumberObj.value) == "") && !(trimAll(MobileSecNumberObj.value)) == "" && (!trimAll(MobileLastNumberObj.value) == ""))) {
        //如果不是號碼
        if (!(IsNumeric(MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value))) {
            getmsgboard('4' ,BoardObj ,'81');
            return true;
        }
    }
    else {
        getmsgboard('4' ,mem8 ,'8');
        return true;
    }
    
    getmsgboard('2',BoardObj ,'8x3')
    
    //-----------------------------------------
    var MobilePhoneValue = MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value
    var xmlpath = "chk_RegMemberAjax/RegMemberSendSms/"
    var MemVar = "MobileNumber=" + ((((MobilePhoneValue.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              switch (xmlhttp.responseText) {
                     case "0" : {getmsgboard('1' ,BoardObj ,'8x7') ;
                                 form1.mobileVerifyCode.focus() ;
                                 form1.TmpMobile.value = MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value;
                                 return true;}
                     case "1" : {getmsgboard('4' ,BoardObj ,'8x6') ;return true;}
                     case "2" : {getmsgboard('4' ,BoardObj ,'8x1') ;return true;}
                     case "3" : {getmsgboard('4' ,BoardObj ,'8x5') ;return true;}
                     case "4" : {getmsgboard('4' ,BoardObj ,'8x4') ;return true;}
                     case "5" : {getmsgboard('1' ,BoardObj ,'8x7') ;form1.mobileVerifyCode.focus() ;return true;}

              }
          }
       //alert(xmlhttp.responseText)
       }; 
    }

    xmlhttp.send(MemVar);   

}


function chkMemberAddress(AddressObject ,BoardObj ) {
    getmsgboard('2' ,BoardObj ,'15')
    AddressValue = AddressObject.value
    
    if (trimAll(AddressValue) == "") {
        getmsgboard('2' ,BoardObj ,'73')
        return false;
    }
    
    var xmlpath = "chk_RegMemberAjax/chkMemberAddress/"
    var MemVar = "AddressStr=" + ((((AddressValue.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
          
              if (xmlhttp.responseText == "2" || xmlhttp.responseText == "1") {
                  getmsgboard('1' ,BoardObj ,'71')
                  return false;
              }

              if (xmlhttp.responseText == "3") {
                  getmsgboard('2' ,BoardObj ,'72')
                  return false;
              }
              
              if (xmlhttp.responseText == "4") {
                  getmsgboard('2' ,BoardObj ,'73')
                  return false;
              }

          }
       }; 
    }

    xmlhttp.send(MemVar);   
        
}

//檢查手機驗號碼
function chkMemberRegMobile(MobileHeadNumberObj ,MobileSecNumberObj ,MobileLastNumberObj ,BoardObj) {
    if ((!(trimAll(MobileHeadNumberObj.value) == "") && !(trimAll(MobileSecNumberObj.value)) == "" && (!trimAll(MobileLastNumberObj.value) == ""))) {
        
        //如果是號碼
        if (IsNumeric(MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value)) {
            getmsgboard('1' ,BoardObj ,'82');
            return true;
        }
        
        //如果不是號碼
        if (!(IsNumeric(MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value))) {
            getmsgboard('4' ,BoardObj ,'81');
            return true;
        }
        
    }
    
    else {
        getmsgboard('4' ,BoardObj ,'8');
        return true;
    }    
}

function jumpfield(sourcefield,length,tofield){
         if(sourcefield.value.length >= length) {
            tofield.focus()
         }
}

//檢查固定電話內容
function chkMemberTelType (locnumber,PhoneNumber ,BoardObj) {
         // 檢查電話號碼長度
         if (!(PhoneNumber.length >= 8)) {
            getmsgboard('4' ,BoardObj ,'A3');
            return true;             
         }
         if (locnumber == "") {
            getmsgboard('4' ,BoardObj ,'A5');
            return true;            
         }
         
         if (!IsNumeric(PhoneNumber)) {
            getmsgboard('4' ,BoardObj ,'A2');
            return true;             
         }
         getmsgboard('1' ,BoardObj ,'A4');

}
//檢查暱稱是否存在
function chkMember_NickName(field ,BoardObj) {
    getmsgboard('2' ,BoardObj ,'15')
    var xmlpath = "chk_RegMemberAjax/chkMember_NickName/"
    var MemVar = "Member_nickname=" + ((((field.value.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              if (xmlhttp.responseText == String.fromCharCode(9)){
                  getmsgboard('2' ,BoardObj ,'6x2')
                  return false
              }

              if (xmlhttp.responseText == String.fromCharCode(9) + String.fromCharCode(9)){
                  getmsgboard('4' ,BoardObj ,'6x21')
                  return false
              }
                            
              if (xmlhttp.responseText == String.fromCharCode(13) + String.fromCharCode(10)){
                  getmsgboard('4' ,BoardObj ,'6x22')
                  return false
              }
              
              if (xmlhttp.responseText == "") {
                  getmsgboard('1' ,BoardObj ,'6x23')
                  return false
              }
              
              if (!(xmlhttp.responseText == "")) {
                  getmsgboard('4' ,BoardObj ,'6x24')
                  return false
              }
          }
          //alert(xmlhttp.responseText)
       }; 
    }

    xmlhttp.send(MemVar);          
}


function chkMemberSex(field,BoardObj) {
         if (field.value=="0") {
             getmsgboard('4' ,BoardObj ,'6x11')
         }
         
         else {
             getmsgboard('1' ,BoardObj ,'6x12')
         }
}

function chkQuiz (field ,BoardObj) {
         if (field.value == "0") {
             getmsgboard('4' ,BoardObj ,'G1')
         }
         else {
             getmsgboard('1' ,BoardObj ,'G2')
         }
}

function chkMember_ans(field ,BoardObj) {
         field.value = trimAll(field.value)
         if (trimAll(field.value) == "") {
             getmsgboard('4' ,BoardObj ,'H1')
         }

         if (!(trimAll(field.value) == "")) {
             getmsgboard('1' ,BoardObj ,'H2')
         }
         
}

function frmswitch() {
         
}

function ReMoveItem(Item_no ,returnvalue) {
         if (window.confirm('您確定要移除此寶物(或物品求購)嗎？')) {
             window.open("?set=removeitem&item_no=" + Item_no ,'system_iframe')
         }
}

function ReMoveAllItem(thisform) {
         if (window.confirm('您確定要移除所選取的寶物嗎？')) {
             thisform.submit()
         }
}

function chk24HbuyAutoPingJia(thisObj ,CheckedObj) {
         for (i=0; i <= document.getElementsByName(CheckedObj).length - 1; i++) {
              if (thisObj.checked == true) {
                  document.getElementsByName(CheckedObj)(i).disabled = false
              }
              
              else {
                  document.getElementsByName(CheckedObj)(i).disabled = true
              }
         } 
}

function onAppreciation(thisObj ,CheckedObj) {
         if (thisObj.checked == true) {
             document.getElementsByName(CheckedObj)(0).disabled = false
             document.getElementsByName(CheckedObj)(0).focus()
         }

         else {
             //document.getElementsByName(CheckedObj)(0).value = ""
             document.getElementsByName(CheckedObj)(0).disabled = true
         }
}

function onGet_Member_no(thisObj ,CheckedObj) {
         if (thisObj.checked == true) {
             document.getElementsByName(CheckedObj)(0).disabled = false
             document.getElementsByName(CheckedObj)(0).focus()
         }

         else {
             //document.getElementsByName(CheckedObj)(0).value = ""
             document.getElementsByName(CheckedObj)(0).disabled = true
         }
}

function selectAll(thisobj ,CheckObjectText) {
         for (i=0; i <= document.getElementsByName(CheckObjectText).length - 1; i++) {
             if (thisobj.checked==true) {
                 document.getElementsByName(CheckObjectText)(i).checked = true
             }
             else {
                 document.getElementsByName(CheckObjectText)(i).checked = false
             }
         }
}

//移交
function transferItem(Item_no) {
         if (window.confirm('請您再次確定寶物已經移交到對方，如果已經確定，請繼續！')) {
             window.open("?set=transferItem&Item_no=" + Item_no ,'system_iframe')
             //location.href="?set=transferItem&Item_no=" + Item_no
             //system_iframe
         }         
}

//領取並評價
function ReceiveItem(Item_no) {
         if (window.confirm('請您確定寶物已經領取到，如果確定已經領取，請繼續！')) {
             location.href = "?set=receive&Item_no=" + Item_no
             //window.open("?set=ReceiveItem&Item_no=" + Item_no ,'system_iframe')
             //system_iframe
         }         
}


function MasinGetImgIdToCookies(ObjText) {
    var xmlpath = "img_select/setToCookies/"
    var MemVar = "action=read"
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {            
              if (!(xmlhttp.responseText == "")) {
                  //alert(xmlhttp.responseText)
                  if (xmlhttp.responseText=="OVERIMAGE") {
                      alert('圖片數量最多僅可選取三張!')
                  }
                  else {
                      document.getElementById(ObjText).innerHTML=xmlhttp.responseText;
                      window.close() ;
                      return false
                  }
              }
          }
          
       }; 
    }

    xmlhttp.send(MemVar);          
}

function PingJiaBuyerItem(Item_no) {
         //alert('評價買方')
         location.href="?set=ItemPingJiaBuyer&item_no=" + Item_no
}

// 移除問題 (限未回覆)
function MoveQuestion (BBS_no) {

         if (window.confirm('您確定要移除此問題嗎?')) {
             window.open('?set=MoveQuestion&bbs_no=' + BBS_no ,'Iframe5285')
         }
}

function order(item_no) {
  if (window.confirm('即將確認訂購，您確定要購買此寶物嗎？')) {
      window.open('?set=buyItem&item_no=' + item_no ,'Iframe5285')
  }
}

function callsubmask(display_ctrl) {
         if (display_ctrl == 1) {
             document.body.scroll="no"

             //document.body.scrolling="yes"
             flow_window_mask.style.filter = "Alpha(opacity=0)"
             flow_window_mask.style.opacity = 0 //(opacity / 100); 
             flow_window_mask.style.MozOpacity = 0 //(opacity / 100); 
             flow_window_mask.style.KhtmlOpacity = 0 //(opacity / 100); 

             opacity("flow_window_mask", 1, 30, 120)
             flow_window_mask.style.position = "absolute"
             flow_window_mask.style.display = ""
             flow_window_mask.style.border = "0px"
             flow_window_mask.style.background = "#000000"
             flow_window_mask.style.left = document.body.scrollLeft
             flow_window_mask.style.top = document.body.scrollTop
             flow_window_mask.style.width = document.body.clientWidth + document.body.scrollLeft //document.body.scrollLeft
             flow_window_mask.style.height = document.body.clientHeight + document.body.scrollTop //document.body.scrollTop
             flow_window_mask.style.zIndex = 0
         }
         else {
             document.body.scroll="auto"
             //flow_window_mask.style.filter = "Alpha(opacity=100)"
             flow_window_mask.style.filter = "Alpha(opacity=0)"
             flow_window_mask.style.opacity = 0 //(opacity / 100); 
             flow_window_mask.style.MozOpacity = 0 //(opacity / 100); 
             flow_window_mask.style.KhtmlOpacity = 0 //(opacity / 100); 

             flow_window_mask.style.position = "absolute"
             flow_window_mask.style.display = "none"
             flow_window_mask.style.border = "0px"
             flow_window_mask.style.background = "#000000"
             flow_window_mask.style.left = 0
             flow_window_mask.style.top = 0
             flow_window_mask.style.width = 0
             flow_window_mask.style.height = 0
             flow_window_mask.style.zIndex = 0
         }
}

function call_flow(display_ctrl,width,height) {
         if (width == undefined) {
             width = 800
         }
         if (height == undefined) {
             height = 600
         }
         
         if (display_ctrl == 1) {
             var div1 = new ygDD('flow_window'); //CALL YGDD

             if (flow_window) {
                 callsubmask(display_ctrl)
                 var MyWidth = width
                 var MyHeight = height
                 var Xpos = (document.body.clientWidth-MyWidth) /2 
                 var Ypos = (document.body.clientHeight-MyHeight) /2
                 flow_window.style.position = "absolute"
                 flow_window.style.display = ""
                 flow_window.style.border = "1px solid #E3EEFB"
                 flow_window.style.background = "#FFFFFF"
                 flow_window.style.left = Xpos  + document.body.scrollLeft   //"0px"; 
                 flow_window.style.top = Ypos  + document.body.scrollTop //"0px"; 
                 flow_window.style.width = MyWidth //"10px";
                 flow_window.style.height = MyHeight //"19px";
                 flow_window.style.zIndex = 1
                 flow_table.height="100%"
             }
         }
         else {
                 callsubmask(display_ctrl)
                 var MyWidth = 0
                 var MyHeight = 0
                 var Xpos = (document.body.clientWidth-MyWidth) /2 
                 var Ypos = (document.body.clientHeight-MyHeight) /2
                 flow_window.style.position = "absolute"
                 flow_window.style.display = "none"
                 flow_window.style.border = "1px solid #E3EEFB"
                 flow_window.style.background = "#FFFFFF"
                 flow_window.style.left = 0
                 flow_window.style.top = 0
                 flow_window.style.width = MyWidth //"10px";
                 flow_window.style.height = MyHeight //"19px";
                 flow_window.style.zIndex = 1
                 flow_table.height="100%"
                 //location.reload()
         }    
}

function Sell_Detail(item_trade_no) {
         if_td.innerHTML = "<iframe name='detail_iframe' scrolling='yes' height='100%' width='100%' style='border: 1px solid #C0C0C0; padding: 0' border='0' frameborder='0'></iframe>"
         document.frames("detail_iframe").document.write("") ;
         document.frames("detail_iframe").document.close();
         var url = "sellinfo_detail.asp?id=" + item_trade_no
         call_flow(1)
         //window.open("sellinfo_detail.asp?id=" + item_trade_no,"detail_iframe")
         Get_sellinfoDetail(item_trade_no ,"detail_iframe")
}

function Get_sellinfoDetail(item_trade_no ,iframe) {
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "sellinfo_detail.asp?id=" + item_trade_no + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.frames(iframe).document.write (xmlhttp.responseText)
                   document.frames(iframe).document.close()
               }
               else {
                   alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          xmlhttp.send();
          return 

}

function ReSubmask() {
         if (flow_window.style.display == "") {
            callsubmask(0)
            call_flow(1)
         }
}


function Convert(id ,type) {
         if (type == 1) {
             typeText = "黑"
         }

         if (type == 2) {
                  typeText = "好友"
         }
           
         if (window.confirm('即將轉換至' + typeText + '名單，您確定要執行轉換動做嗎？')) {
               var xmlhttp 
             if (window.XMLHttpRequest) { 
                 xmlhttp = new XMLHttpRequest();
             } 
             else if (window.ActiveXObject) {   
                 try 
                 { 
                     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
                 } 
                 catch(e) 
                 { 
                     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
                 } 
             }   
             xmlhttp.open("GET", "convert.asp?id=" + id + "&type=" + type + "&sys=" + Math.random(), true); 
             xmlhttp.onreadystatechange = function(){ 
               if (xmlhttp.readyState == 4) {
                  if (xmlhttp.status == 200) {
                      if (xmlhttp.responseText == "1") {
                         alert('轉換完成！')
                         location.reload()
                      }
                      else if (xmlhttp.responseText == "2") {
                         alert('禁止轉換！')
                      }
                      else {
                         alert('轉換失敗！')
                      }
                  }
                  else {
                      alert ("錯誤訊息：\n" + xmlhttp.responseText)
                  }
               }; 
             }
             xmlhttp.send();
             return 
         
         }
}


function RemoveFriends(id ,type) {
         if (type == 1) {
             typeText = "黑"
         }

         if (type == 2) {
                  typeText = "好友"
         }
           
         if (window.confirm('即將從' + typeText + '名單移除該名單，您確定要執行刪除動做嗎？')) {
               var xmlhttp 
             if (window.XMLHttpRequest) { 
                 xmlhttp = new XMLHttpRequest();
             } 
             else if (window.ActiveXObject) {   
                 try 
                 { 
                     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
                 } 
                 catch(e) 
                 { 
                     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
                 } 
             }   
             xmlhttp.open("GET", "RemoveFriends.asp?id=" + id + "&type=" + type + "&sys=" + Math.random(), true); 
             xmlhttp.onreadystatechange = function(){ 
               if (xmlhttp.readyState == 4) {
                  if (xmlhttp.status == 200) {
                      if (xmlhttp.responseText == "1") {
                         alert('刪除完成！')
                         location.reload()
                      }
                      else if (xmlhttp.responseText == "2") {
                         alert('禁止刪除！')
                      }
                      else {
                         alert('刪除失敗！')
                      }
                  }
                  else {
                      alert ("錯誤訊息：\n" + xmlhttp.responseText)
                  }
               }; 
             }
             xmlhttp.send();
             return 
         
         }
}


function AddFriends(type ,Friend_Member_no) {
         //if (Friend_Member_no == undefined) {
            if_td.innerHTML = "<iframe name='detail_iframe' scrolling='yes' height='100%' width='100%' style='border: 1px solid #C0C0C0; padding: 0' border='0' frameborder='0'></iframe>"
            document.frames("detail_iframe").document.write("") ;
            document.frames("detail_iframe").document.close();
            call_flow(1)
            Get_FriendsForm(type  ,"detail_iframe" ,Friend_Member_no)
         //}

}

function Get_FriendsForm(type ,iframe ,Friend_Member_no) {
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "addfriends.asp?type=" + type + "&Friend_Member_no=" + Friend_Member_no + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.frames(iframe).document.write (xmlhttp.responseText)
                   document.frames(iframe).document.close()
               }
               else {
                   alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          xmlhttp.send();
          return 

}

function WawaChange(WawaID ,ChangeLevel){
         //alert(WawaID + '*' + ChangeLevel)
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "setwawa.asp?WawaID=" + WawaID + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.all.wawalocal.innerHTML = xmlhttp.responseText
               }
               else {
                   alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          xmlhttp.send();
          return 


}


//銀行分行
function BuildBranch(BankNo) {
          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "/BuildBranch/?Bank_No=" + BankNo + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   //document.all.wawalocal.innerHTML = xmlhttp.responseText
                   //alert(xmlhttp.responseText)
                   document.all.Bank_branch_name.outerHTML = xmlhttp.responseText
               }
               else {
                   alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          xmlhttp.send();
          return 


}

function deletecomplainant2(ItemObj,postobj) {
var tmpstr = ""
         for (var i=0;i<document.getElementsByName(ItemObj).length;i++){
              if (document.getElementsByName(ItemObj)(i).checked) {
                  if (tmpstr == "") {
                      tmpstr = document.getElementsByName(ItemObj)(i).value
                  }
                  else {
                      tmpstr = tmpstr + "," + document.getElementsByName(ItemObj)(i).value
                  }
              }
         }
         if(tmpstr == "") {
            alert('請選取要刪除的項目!')
         }
         else {
         if (window.confirm('您確定要刪除所選的項目嗎?')) {
                 postobj.submit()
         }
         }
}

function writeComp2(PostObj) {
   if (PostObj.CompType.value == "0") {  
       alert('請選擇申訴項目!')
       return
   }

   if (PostObj.CompSubject.value == "") {  
       alert('請填寫申訴主題!')
       return
   }

   if (PostObj.CompBody.value == "") {  
       alert('請填寫申訴內容!')
       return
   }
   
   PostObj.submit()
}


function buy_confirm_pay(item_no ,item_trade_no) {
         if (window.confirm('您確定要購買此寶物嗎?')) {
             location.href = "?set=buyItem&Item_no=" + item_no + "&Item_Trade_no=" + item_trade_no
         }
}


function DeclineExchange(item_no ,item_trade_no) {
         if (window.confirm('您確定要拒絕購買此寶物嗎?')) {
             location.href = "?set=DeclineExchange&Item_no=" + item_no + "&Item_Trade_no=" + item_trade_no
         }
}



function Message_Detail(message_no ,Message_type) {
         if_td.innerHTML = "<iframe name='detail_iframe' scrolling='yes' height='100%' width='100%' style='border: 1px solid #C0C0C0; padding: 0' border='0' frameborder='0'></iframe>"
         document.frames("detail_iframe").document.write("") ;
         document.frames("detail_iframe").document.close();
         call_flow(1)
         Get_MessageInfoDetail(message_no ,Message_type,"detail_iframe")
}



function Get_MessageInfoDetail(message_no ,Message_type ,iframe) {
          var xmlhttp 

          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "MessageInfoDetail.asp?id=" + message_no + "&,Message_type=" + Message_type + "&sys=" + Math.random(), true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   document.frames(iframe).document.write (xmlhttp.responseText)
                   document.frames(iframe).document.close()
               }
               else {
                   alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
            }; 
          }
          xmlhttp.send();
          return 

}

function addFavorite(item_no) {
      if (window.confirm('您要將該寶物加入您的最愛嗎?')) {  
          system_iframe.location.href='addFavorite/?item_no=' + item_no
      }
}

function deleteFavorite(Favorite_form) {
   var j = 0
   for (var i=0;i<document.getElementsByName("Item_Select").length;i++){
       if (document.getElementsByName("Item_Select")(i).checked) {
           j ++
       }
   }

   if (j > 0) {
     if (window.confirm('您確定要刪除選取的項目嗎?')) {
         document.all.deleteform.target = "system_iframe"
         document.all.deleteform.action = "deleteFavorite/"
         document.all.deleteform.submit()
     }
   }
   else {
     alert('請選取您要刪除的項目!')
   }
}

function deleteqa(Favorite_form) {
   var j = 0
   for (var i=0;i<document.getElementsByName("Item_Select").length;i++){
       if (document.getElementsByName("Item_Select")(i).checked) {
           j ++
       }
   }
   if (j > 0) {
     if (window.confirm('您確定要刪除選取的項目嗎?')) {
         document.all.deleteform.target = "system_iframe"
         document.all.deleteform.action = "deleteqa/"
         document.all.deleteform.submit()
     }
   }
   else {
     alert('請選取您要刪除的項目!')
   }
}

function bankfieldctrl(ctrlcode) {
         if (document.getElementsByName("Bank_name")(0) && document.getElementsByName("Bank_branch_name")(0) && document.getElementsByName("Member_Bank_account_no")(0)) {
             if (ctrlcode=="1") {
                 document.getElementsByName("Bank_name")(0).disabled = false
                 document.getElementsByName("Bank_branch_name")(0).disabled = false
                 document.getElementsByName("Member_Bank_account_no")(0).disabled = false
             }
             else if (ctrlcode=="0"){
                 document.getElementsByName("Bank_name")(0).disabled = true
                 document.getElementsByName("Bank_branch_name")(0).disabled = true
                 document.getElementsByName("Member_Bank_account_no")(0).disabled = true
             }
         }
}


function SaveModifyMember(form){
 form.action = "SaveModifyMember/"
 form.target = "system_iframe"
 form.submit()
 //"_blank" 
}

function SendCheckMail(form,Mail) {
         form.action = "CheckRegMail/"
         form.target = "system_iframe"
         form.submit()

         //alert('5285已經傳送一封信件到您要變更的新信箱，請到您新指定的信箱內收取驗證信，並依照信件指示操做！')
         //alert('信箱未變更無須驗證！')

}

function Sendtelphone(form) {
         form.action = "CheckPhone/"
         form.target = "system_iframe"
         form.submit()

         //alert('5285已經傳送一封信件到您要變更的新信箱，請到您新指定的信箱內收取驗證信，並依照信件指示操做！')
         //alert('信箱未變更無須驗證！')

}



//傳送手機驗證碼
function SendMobileChkCode2(MobileHeadNumberObj ,MobileSecNumberObj ,MobileLastNumberObj) {
    if ((!(trimAll(MobileHeadNumberObj.value) == "") && !(trimAll(MobileSecNumberObj.value)) == "" && (!trimAll(MobileLastNumberObj.value) == ""))) {
        //如果不是號碼
        if (!(IsNumeric(MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value))) {
            alert('手機號碼有問題!')
            return true;
        }
    }
    
    //-----------------------------------------
    var MobilePhoneValue = MobileHeadNumberObj.value + MobileSecNumberObj.value + MobileLastNumberObj.value
    var xmlpath = "chk_RegMemberAjax/RegMemberSendSms/"
    var MemVar = "MobileNumber=" + ((((MobilePhoneValue.replace("%","%25")).replace("+","%2B")).replace("=","%3D")).replace("&","%26")).replace(" ","%20")
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
    xmlhttp.open("POST", xmlpath, true); 
    xmlhttp.setRequestHeader ("CONTENT-TYPE","application/x-www-form-urlencoded")
    xmlhttp.setRequestHeader ("Content-Length",MemVar.length)

    xmlhttp.onreadystatechange = function(){ 
       if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {
              switch (xmlhttp.responseText) {
                     case "0" : {alert('行動電話驗證碼已發送到你的行動電話，請填寫行動電話驗證碼。') ;
                                 return true;}
                     case "1" : {alert('系統十分鍾內不能連續發送簡訊，請稍候再試！');break;}
                     case "2" : {alert('行動電話只能是數字組成！');break;}
                     case "3" : {alert('手機簡訊發送失敗！');break;}
                     case "4" : {alert('您填寫的行動電話已被使用，一支電話只能一位會員使用，請更改！');break;}
                     case "5" : {alert('行動電話驗證碼已發送到你的行動電話，請填寫行動電話驗證碼。');break;}
              }
          }
       //alert(xmlhttp.responseText)
       }; 
    }

    xmlhttp.send(MemVar);   

}


function deletsafelock(form) {
   var j = 0
   for (var i=0;i<document.getElementsByName("Item_Select").length;i++){
       if (document.getElementsByName("Item_Select")(i).checked) {
           j ++
       }
   }
   if (j > 0) {
     if (window.confirm('您確定要刪除選取的項目嗎?')) {
         document.all.deleteform.target = "system_iframe"
         document.all.deleteform.action = "deletesafe/"
         document.all.deleteform.submit()
     }
   }
   else {
     alert('請選取您要刪除的項目!')
   }
}

function write_safe_memo(Memo) {
//alert(Memo)
//return
         document.all.deleteform.target = "system_iframe"
         document.all.deleteform.action = "write_safe_memo/?field=" + Memo
         document.all.deleteform.submit()
}

function getrepassword(thisform) {
         document.forms(thisform.name).target = "system_iframe"
         document.forms(thisform.name).action = "GetRePassword/"
         document.forms(thisform.name).submit()

}

function getremember(thisform) {
         document.forms(thisform.name).target = "system_iframe"
         document.forms(thisform.name).action = "GetReMember/"
         document.forms(thisform.name).submit()
}


function MenuSet(MenuName,Ctrl) {

          var xmlhttp 
          if (window.XMLHttpRequest) { 
              xmlhttp = new XMLHttpRequest();
          } 
          else if (window.ActiveXObject) {   
              try 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
              catch(e) 
              { 
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
              } 
          }   
          xmlhttp.open("GET", "MenuSet.asp?MenuName=" + MenuName + "&Ctrl=" + Ctrl + "&sys=" + Math.random() , true); 
          xmlhttp.onreadystatechange = function(){ 
            if (xmlhttp.readyState == 4) {
               if (xmlhttp.status == 200) {
                   //alert(xmlhttp.responseText)
               }
               else {
                   //alert ("錯誤訊息：\n" + xmlhttp.responseText)
               }
               //alert(xmlhttp.responseText)
            }; 
          }
          xmlhttp.send();
          return 

}
function wawachange_save() {
         system_iframe.location.href = "/wawachange_save/"
}         
