﻿// JScript 文件


    var xmlHttp;
	function createXMLHttpRequest() {
		if (window.ActiveXObject) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		else if (window.XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
		}
	}
	
	
	function Click_Login(){
	    var email = document.getElementById("AccountLogin1_Email").value;
	    var pwd = document.getElementById("AccountLogin1_password").value;
	    if (email=="")
	    {
	        alert("Please enter your Email!");
			return false;
	    }
	    else if (pwd=="")
	    {
	        alert("Please enter your Password!");
			return false;
	    }
	    else
	    {
		    createXMLHttpRequest();
		    var now= new Date();
		    url="/Ajax/AjaxLogin.aspx?email=" + email +"&pwd=" + pwd + "&Key=" + now.getSeconds();
		    xmlHttp.onreadystatechange = handleStateChange;
		    xmlHttp.open("GET", url, true);
		    xmlHttp.send(null);
		}
	}
	
		
	function handleStateChange() {
	    if(checkxmlHttp.readyState == 1)//表示正在加载
         {
             document.getElementById("LoginShow").innerHTML ="<img style=\"margin-left:80px;\" src=\"images/5-0.gif\" />";
        }
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
			
			    document.getElementById("LoginShow").innerHTML = xmlHttp.responseText;
				//window.alert(xmlHttp.responseText);
			}
			    //window.alert('成功');
		}
			//window.alert(xmlHttp.status);
		else
		{
		
		}
	}
	
	
	var checkxmlHttp;
	function createcheckXMLHttpRequest() {
		if (window.ActiveXObject) {
			checkxmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		else if (window.XMLHttpRequest) {
			checkxmlHttp = new XMLHttpRequest();
		}
	}
	
	function Check_Login()
	{
	        createcheckXMLHttpRequest();
		    var now= new Date();
		    url="/Ajax/AjaxLogin.aspx?act=checklogin&Key=" + now.getMilliseconds();
		    checkxmlHttp.onreadystatechange = CheckhandleStateChange;
		    checkxmlHttp.open("GET", url, true);
		    checkxmlHttp.send(null);
	}
	
	function CheckhandleStateChange() {
	    if(checkxmlHttp.readyState == 1)//表示正在加载
         {
             document.getElementById("LoginShow").innerHTML ="<img style=\"margin-left:80px;\" src=\"/images/5-0.gif\" />";
        }
		if(checkxmlHttp.readyState == 4) {
			if(checkxmlHttp.status == 200) {
			    if (checkxmlHttp.responseText!="")
			    {
			        document.getElementById("LoginShow").innerHTML = checkxmlHttp.responseText;
			    }
			}

		}
		else
		{
		
		}
	}
	
	function Click_GoReg(){
	    window.location.href='/CustomerSignup.aspx';
	}
	
	
	var GoOutHttp;
	function createGooutXMLHttpRequest() {
		if (window.ActiveXObject) {
			GoOutHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		else if (window.XMLHttpRequest) {
			GoOutHttp = new XMLHttpRequest();
		}
	}
	
	
    function LogOut()
	{
	        createGooutXMLHttpRequest();
		    var now= new Date();
		    url="/Ajax/AjaxLogin.aspx?act=GoOut&Key=" + now.getSeconds();
		    GoOutHttp.onreadystatechange = LogOuthandleStateChange;
		    GoOutHttp.open("GET", url, true);
		    GoOutHttp.send(null);
	}
	
	function LogOuthandleStateChange() {
	    if(checkxmlHttp.readyState == 1)//表示正在加载
         {
             document.getElementById("LoginShow").innerHTML ="<img style=\"margin-left:80px;\" src=\"/images/5-0.gif\" />";
        }
		if(GoOutHttp.readyState == 4) {
			if(GoOutHttp.status == 200) {
			    if (GoOutHttp.responseText!="")
			    {
			        document.getElementById("LoginShow").innerHTML = GoOutHttp.responseText;
			    }
			}

		}
		else
		{
		
		}
	} 



    
