var MemberLogin = {
	'name':null,
	'pwd':null,
	'flag':false,
	'check':function(){
		this.name = $('cust').value;
		this.pwd = $('passwd').value;
		if(this.name =='')
		{
			alert("請輸入會員帳號！");
			this.flag = false;
			return;
		}
		else if(this.pwd =='')
		{
			alert("請輸入會員密碼！");
			this.flag = false;
			return;
		}
		this.flag = true;
	},
	'submit':function(){
		this.check();
		if(this.flag)
		{
			var str = "username="+this.name+"&password="+this.pwd;
			var url = "login2.php";
			new Ajax.Request(url,{
				method:'post',
				parameters:str,
				onComplete:function(txt){
					var b = txt.responseText;
					if(b==0){
						alert("帳號或密碼錯誤");
					}
					else{
						alert('會員登入成功，歡迎使用');
						//location.href='index.php';
						location.reload();
					}
				}
			});
		}
	},
	out:function()
	{
		var url = "login2.php?action=out";
		new Ajax.Request(url,{
			method:'get',
			parameters:'',
			onComplete:function(txt){
				location.reload();
			}
		});
	}
}

