//登入驗證(主要是用戶名和密碼空白驗證)
function passwordCheck(ipt){//密碼檢測
	if (isNull(g(ipt).value)){
		g(ipt).focus();
		//alert("密　碼不能空白！");
		return false;
	}
	return true;
}


function emailCheck(ipt){//郵件地址驗證
	if(!emlCheck(g(ipt).value)){
		g(ipt).focus();
		return false;
	}
	return true;
}

function toLoginCheck(){//檢測登入用戶名和密碼是否空白
	if(!passwordCheck("email")){alert("申請會員帳號不能空白！");$('#submit1').removeAttr("disabled");return}
	if(!emailCheck("email")){alert("申請會員帳號格式不正確，應該為郵件地址！");$('#submit1').removeAttr("disabled");return}
	if(!passwordCheck("password1")){alert("密碼不能空白！");$('#submit1').removeAttr("disabled");return}
	return true;
}



function ajaxReq() 
{
		if (!toLoginCheck()) {
			return false;
		}
		createCover('msg3');
		var para = {email : '', password1 : ''};
		for (key in para) {
					para[key] = $('#'+key).val();
		}
		//alert("111");
		$.post(root + 'registerLogin/reqMobileCheck/', para, addAdBack);
		function addAdBack(data){
			removeCover('msg3');
			var i = data.split('-');
			if(i.length < 2){
				alert(data);
				$('#submit1').removeAttr("disabled");
			}else if(i[0]=="4"){
				alert(i[1]);
				$('#submit1').removeAttr("disabled");
				if(isNull(i[2])){
					document.location.href=root+'user';
				}else{
					document.location.href=root+'user/index/lastType/1';
				}
			}else{
				$('#u_id').val(i[1]);
				createCover('msg'+i[0]);
				$('#submit1').removeAttr("disabled");
			}
		}		
}
