//***********************************************************************************//
//Ajax 重新產生《驗證碼》的 Function;
//***********************************************************************************//
function Re_NewNumber(divID, MSG_LANG)
{
   var obj       = document.getElementById(divID);
   var url       = '/manager/include/VCode_aj_ReNo.php';
   var postStr   = 'MSG_LANG=' + MSG_LANG + '&parm=' + new Date().getTime();
   var XmlHR_Obj = InitXMLHttpRequestObject();

//   obj.innerHTML = '<font color="#FF0000">Loading..........  Please Wait!!</font>';

   if(XmlHR_Obj)
   {
      XmlHR_Obj.open('POST', url, true);
      XmlHR_Obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
      XmlHR_Obj.send(postStr);

      XmlHR_Obj.onreadystatechange = function()
      {
       if(XmlHR_Obj.readyState == 4 && XmlHR_Obj.status == 200) {
          obj.innerHTML = XmlHR_Obj.responseText;
          }
      }//End of XmlHR_Obj.onreadystatechange = function();

   }//End of if(XmlHR_Obj);

}//End of function Re_NewNumber(divID, MSG_LANG);



//***********************************************************************************//
//Ajax 確認《帳號》是否重複 的資料 Function;
//***********************************************************************************//
function Chk_OnSubmit(Login_Verify_Code, MSG_LANG)
{
   if(Login_Verify_Code == '') {
      alert('請輸入驗證碼!');
      document.getElementById('Login_Verify_Code').focus();
      document.getElementById('Login_Verify_Code').select();
      return false;
      } 

   var obj_Form  = document.getElementById('Contact_Form');
   var url       = '/manager/include/VCode_aj_ChkNo.php';
   var postStr   = 'Login_Verify_Code=' + Login_Verify_Code + '&MSG_LANG=' + MSG_LANG + '&parm=' + new Date().getTime();
   var XmlHR_Obj = InitXMLHttpRequestObject();

//   obj.innerHTML = '<font color="#FF0000">Loading..........  Please Wait!!</font>';

   if(XmlHR_Obj)
   {
      XmlHR_Obj.open('POST', url, true);
      XmlHR_Obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
      XmlHR_Obj.send(postStr);

      XmlHR_Obj.onreadystatechange = function()
      {
       if(XmlHR_Obj.readyState == 4 && XmlHR_Obj.status == 200) {
          var retren_Val = XmlHR_Obj.responseText.split('|');
          if(parseInt(retren_Val[0]) > 0) {
             document.getElementById('Login_Send_Msg').style.display  = '';
             document.getElementById('Login_Send_Ctrl').style.display = 'none';
	           obj_Form.submit();
             }
          else {
             alert(retren_Val[1]);
	           document.getElementById(retren_Val[2]).focus();
	           document.getElementById(retren_Val[2]).select();
             return false;
             }

          }

      }//End of XmlHR_Obj.onreadystatechange = function();

   }//End of if(XmlHR_Obj);

}//End of function Chk_OnSubmit(Login_Verify_Code);




//***********************************************************************************//
// 表單確定送出前的 資料 Function;
//***********************************************************************************//
function CheckValue(theForm)
{
   if(theForm.vc_realname.value.length < 2 ) {
      alert("請填寫您的姓名!");
      theForm.vc_realname.focus();
      theForm.vc_realname.select();
      return false;
      }

   if(!theForm.vc_email.value ) {
      alert("請輸入您的E-mail!!");
      theForm.vc_email.focus();
      theForm.vc_email.select();
      return false;
      }

	 if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('vc_email').value))) {
      alert("請輸入正確的 E-mail 格式!!");
      document.getElementById('vc_email').focus();
      document.getElementById('vc_email').select();
      return false;
		  }

   if(theForm.vc_tel0.value.length < 2) {
      alert("請填寫您的聯絡電話!");
      theForm.vc_tel0.focus();
      theForm.vc_tel0.select();
      return false;
      }

   if(theForm.vc_subject0.value.length < 2) {
      alert("請填寫主旨!");
      theForm.vc_subject0.focus();
      theForm.vc_subject0.select();
      return false;
      }

   if(theForm.txt_statement0.value.length < 2 ) {
      alert("請填寫內容!");
      theForm.txt_statement0.focus();
      return false;
      }

   if(document.getElementById('Login_Verify_Code').value.length != 5 ) {
      alert("請輸入驗證碼!");
      document.getElementById('Login_Verify_Code').focus();
      document.getElementById('Login_Verify_Code').select();
      return false;
      }

   Chk_OnSubmit(document.getElementById('Login_Verify_Code').value, 'TW');
      
   return false;

}
//***********************************************************************************//
//END
//***********************************************************************************//
