//***********************************************************************************//
//Ajax 重新產生《驗證碼》的 Function;
//***********************************************************************************//
function Re_NewNumber(divID, MSG_LANG)
{
   var obj       = document.getElementById(divID);
   var url       = 'manager/include/ajax_lib/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(Verify_Code, MSG_LANG)
{
   if(Verify_Code == '') {
      alert('Please input the Code!');
      document.getElementById('Verify_Code').focus();
      document.getElementById('Verify_Code').select();
      return false;
      } 

   var obj_Form  = document.getElementById('contact-inquiry');
   var url       = 'manager/include/ajax_lib/VCode_aj_ChkNo.php';
   var postStr   = 'Verify_Code=' + 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) {
	           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(Verify_Code);



//***********************************************************************************//
//Contact Us 所需檢查的欄位值;
//***********************************************************************************//
function CheckValue_EN()
{

   if(document.getElementById('the_name').value == "") {
      alert("Please input the Name !!");
      document.getElementById('the_name').focus();
      document.getElementById('the_name').select();
      return false;
      }			

   if(document.getElementById('the_tel').value == "") {
      alert("Please input the Tel !!");
      document.getElementById('the_tel').focus();
      document.getElementById('the_tel').select();
      return false;
      }

   if(document.getElementById('the_email').value == "") {
      alert("Please input the E-Mail !!");
      document.getElementById('the_email').focus();
      document.getElementById('the_email').select();
      return false;
      }			

   if((document.getElementById('the_email').value.indexOf('@', 0) == -1) || (document.getElementById('the_email').value.indexOf('.', 0) == -1)) {
      alert("Please input the E-Mail !!");
      document.getElementById('the_email').focus();
      document.getElementById('the_email').select();
      return false;
      }

   if(document.getElementById('the_content').value == "") {
      alert("Please input the Message !!");
      document.getElementById('the_content').focus();
      document.getElementById('the_content').select();
      return false;
      }

   if(document.getElementById('Verify_Code').value.length != 5 ) {
      alert("Please input the Code!");
      document.getElementById('Verify_Code').focus();
      document.getElementById('Verify_Code').select();
      return false;
      }

   Chk_OnSubmit(document.getElementById('Verify_Code').value, 'EN');

}
//***********************************************************************************//
//END
//***********************************************************************************//
