/*
 * login_out.js
 * This document contains the user login and logout of the basic operation
 */

/*
 * Check the existence of members
 */
function checkName(){
	var email = $('#ue').val();
	if(email=='' || !(/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,5}$/i).test(email)) {
		alert('メールが間違っている');
		return false;
	} else {
		return true;
	}
}

/*
 * Check the password is correct
 */
function checkPwd(){
	var pwd = $('#up').val();
	if(pwd=='' || !(/^\S{6,16}$/i).test(pwd)) {
		alert('パスワードが間違っている');
		return false;
	} else {
		return true;
	}
}

/*
 * Asynchronous login
 */
function asyn_login() {
	if(checkName()==false || checkPwd()==false) { return false; }
}

/*
 * Asynchronous logout
 */
function asyn_logout() {
	window.location.href = url+'/Member/logout';
}
