﻿// JScript 檔

ajax_UserControls_LoginLogoutPanel_index();

var obj_UserControls_LoginLogoutPanel_index;
function ajax_UserControls_LoginLogoutPanel_index()
{
			     
     if (window.XMLHttpRequest) 
     { 
          // Mozilla, Safari,...
          obj_UserControls_LoginLogoutPanel_index = new XMLHttpRequest();
          if (obj_UserControls_LoginLogoutPanel_index.overrideMimeType) {
               obj_UserControls_LoginLogoutPanel_index.overrideMimeType('text/xml');
          }
     } 
     else if (window.ActiveXObject) 
     {  
         // IE
	     try
	     {
		     obj_UserControls_LoginLogoutPanel_index = new ActiveXObject("Msxml2.XMLHTTP");
	     }
	     catch(e)
	     {
		     try
		     {
			     obj_UserControls_LoginLogoutPanel_index = new ActiveXObject("Microsoft.XMLHTTP");
		     }
		     catch(e1)
		     {
			     obj_UserControls_LoginLogoutPanel_index = null;
		     }
	     }
	  }
				
	  if(obj_UserControls_LoginLogoutPanel_index!=null)
	  {
	        var strData = "code=libniz";
			obj_UserControls_LoginLogoutPanel_index.onreadystatechange = PR_ajax_UC_LLP_index;
			obj_UserControls_LoginLogoutPanel_index.open("POST", "/UserControls/LoginLogoutPanel/ajax_index.aspx",  true);
			obj_UserControls_LoginLogoutPanel_index.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			obj_UserControls_LoginLogoutPanel_index.send(strData);
                        
			
	  }
	  return false;
}

function PR_ajax_UC_LLP_index()
{
        
	if(obj_UserControls_LoginLogoutPanel_index.readyState == 4)
	{
                
		if(obj_UserControls_LoginLogoutPanel_index.status == 200)
		{
                        
			var retval=obj_UserControls_LoginLogoutPanel_index.responseText;
			//div_UC_LLP_index.innerHTML = retval;
			document.getElementById('div_UC_LLP_index').innerHTML = retval;
                        
		}
		else
		{
			//alert("執行錯誤1!" );
		}
	}
}





var obj_UserControls_LoginLogoutPanel_ajax_index;
function ajax_UserControls_LoginLogoutPanel_ajax_index()
{
      
     if (window.XMLHttpRequest)
     {
          obj_UserControls_LoginLogoutPanel_ajax_index = new XMLHttpRequest();
          if (obj_UserControls_LoginLogoutPanel_ajax_index.overrideMimeType) {
               obj_UserControls_LoginLogoutPanel_ajax_index.overrideMimeType('text/xml');
          }
     }
     else if (window.ActiveXObject)
     {
           // IE
	       try
	       {
                 obj_UserControls_LoginLogoutPanel_ajax_index = new ActiveXObject("Msxml2.XMLHTTP");
	       }
	       catch(e)
	       {
		         try
		         {
                      obj_UserControls_LoginLogoutPanel_ajax_index = new ActiveXObject("Microsoft.XMLHTTP");
		         }
		         catch(e1)
		         {
                      obj_UserControls_LoginLogoutPanel_ajax_index = null;
		         }
	       }
	 }
	 
     if(obj_UserControls_LoginLogoutPanel_ajax_index!=null)
	 {
	       
	       //select radio button
	       var strData = "account_txtbox=" + document.getElementById('account_txtbox').value + "&password_txtbox=" + document.getElementById('password_txtbox').value + "&motion_radio=" + document.getElementById('set_value').value;
           
           obj_UserControls_LoginLogoutPanel_ajax_index.onreadystatechange = ProcessResponse_ajax_UserControls_LoginLogoutPanel_ajax_index;
           obj_UserControls_LoginLogoutPanel_ajax_index.open("POST", "/UserControls/LoginLogoutPanel/ajax_checkin.aspx",  true);
           obj_UserControls_LoginLogoutPanel_ajax_index.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
           obj_UserControls_LoginLogoutPanel_ajax_index.send(strData);
           
               
	 }
	 return false;
}

function ProcessResponse_ajax_UserControls_LoginLogoutPanel_ajax_index()
{
     if(obj_UserControls_LoginLogoutPanel_ajax_index.readyState == 4)
     {
          if(obj_UserControls_LoginLogoutPanel_ajax_index.status == 200)
          {
                     	  
               var retval=obj_UserControls_LoginLogoutPanel_ajax_index.responseText;
               
               
               if (retval=="no")
               {
                    //restart
                    ajax_UserControls_LoginLogoutPanel_index();
                    
                    alert('登入失敗，請確認您的Email帳號與密碼輸入正確。');
               }
               else
               {
                    document.getElementById('div_UC_LLP_index').innerHTML = retval;	
               }
                     			
          }
          else
          {
               //alert("執行錯誤2!");
          }
    }
}



var obj_UserControls_LoginLogoutPanel_ajax_checkout;
function ajax_UserControls_LoginLogoutPanel_ajax_checkout()
{	     
     if (window.XMLHttpRequest)
     {
          obj_UserControls_LoginLogoutPanel_ajax_checkout = new XMLHttpRequest();
          if (obj_UserControls_LoginLogoutPanel_ajax_checkout.overrideMimeType) {
               obj_UserControls_LoginLogoutPanel_ajax_checkout.overrideMimeType('text/xml');
          }
     }
     else if (window.ActiveXObject)
     {
           // IE
	       try
	       {
                 obj_UserControls_LoginLogoutPanel_ajax_checkout = new ActiveXObject("Msxml2.XMLHTTP");
	       }
	       catch(e)
	       {
		         try
		         {
                      obj_UserControls_LoginLogoutPanel_ajax_checkout = new ActiveXObject("Microsoft.XMLHTTP");
		         }
		         catch(e1)
		         {
                      obj_UserControls_LoginLogoutPanel_ajax_checkout = null;
		         }
	       }
	 }
	 
     if(obj_UserControls_LoginLogoutPanel_ajax_checkout!=null)
	 {
	       //select radio button
	       var strData = "";

           obj_UserControls_LoginLogoutPanel_ajax_checkout.onreadystatechange = ProcessResponse_ajax_UserControls_LoginLogoutPanel_ajax_checkout;
           obj_UserControls_LoginLogoutPanel_ajax_checkout.open("POST", "/UserControls/LoginLogoutPanel/ajax_checkout.aspx",  true);
           obj_UserControls_LoginLogoutPanel_ajax_checkout.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
           obj_UserControls_LoginLogoutPanel_ajax_checkout.send(strData);
	 }
	 return false;
}

function ProcessResponse_ajax_UserControls_LoginLogoutPanel_ajax_checkout()
{
     if(obj_UserControls_LoginLogoutPanel_ajax_checkout.readyState == 4)
     {
          if(obj_UserControls_LoginLogoutPanel_ajax_checkout.status == 200)
          {
                 
               
               var retval=obj_UserControls_LoginLogoutPanel_ajax_checkout.responseText;
                     			
               
               ajax_UserControls_LoginLogoutPanel_index();
               
               alert('登出成功，歡迎您下次來訪。');
               
                     			
          }
          else
          {
               //alert("執行錯誤3!");
          }
    }
}



