﻿var $ =function(ID){return document.getElementById(ID);};
//enter eventd
function checkenter(evt,para,option)
{
	evt = evt ? evt : (window.event ? window.event : null);	
	if(evt.keyCode == 13)
	{
		switch(para)
		{
			case 0:
				var option=document.getElementById(option);
				option.focus();
				break;
			case 1:
				setTimeout(option,100)
				break;
		}
		return false;
	}
}
function getQueryString(key)
{
	var locString = location.search;
	var reg = new RegExp("(\\?|\\&)" + key + "=([^\\&]*)(\\&?)","i").exec(locString);
	return RegExp.$2;
}
//Login
function Login()
{
	var txtEmail1=$("txtEmail1");
	var txtPassword=$("txtPassword");
	if(txtEmail1.value=="")
	{
		alert("Email can't be empty.");
		return;
	}
	if(txtPassword.value=="")
	{
		alert("Password can't be empty.");
		return;
	}	
	var result=aion.ajax.common.Login(txtEmail1.value,txtPassword.value).value;
	if(result!="")
	{
		$("tbIsLogin").style.display="";
		$("tbNotLogin").style.display="none";
		$("tdLoginInfo").innerHTML=result;
	}
	else
	{
		$("tbIsLogin").style.display="none";
		$("tbNotLogin").style.display="";
		alert("Email or Password Error.");
	}
	txtEmail1.value="";
	txtPassword.value="";
}
//LoOut
function Logout()
{
	var result=aion.ajax.common.Logout().value;
	$("tbIsLogin").style.display="none";
	$("tbNotLogin").style.display="";
}
//CheckLogin
function CheckLogin()
{
	var result=aion.ajax.common.CheckLogin().value;
	if(result!="")
	{
		$("tbIsLogin").style.display="";
		$("tbNotLogin").style.display="none";
		$("tdLoginInfo").innerHTML=result;
	}
	else
	{
		$("tbIsLogin").style.display="none";
		$("tbNotLogin").style.display="";
	}
}
CheckLogin();
