var _file_creatAjax = '<script language="JavaScript"  src="javascript/CreatHttpRequest.js"></script>';
document.write(_file_creatAjax);

function vConvert(str){
	str = str.replace(/\+/g, "%2B");
	str = str.replace(/\&/g, "%26");
	return str;
	
}



function reqlogin(){
	var username=document.getElementById("username").value;
	var pwds=document.getElementById("pwd").value;
	if(username==""){
		alert("User name can not be empty")
		return false
	}

	if(pwds==""){
		alert("Password can not be empty");
		return false;
	}
	
	username=vConvert(username);
	pwds=vConvert(pwds);
	
	
	
	urlRequest="proc_login.php";
	strPost="username="+username+"&password="+pwds+"&cmd_login=accLogin";
	
	var oA=new ConnAjax(urlRequest,strPost);
	
	oA.iEvtFunc=function(){  // 开始事件
		waitLoading_v2("imgLoading","8","on"); // 加载等待图片
	}


	oA.eEvtFunc=function(){ // 截止事件
		rstLogin(oA.vRtn);
		waitLoading_v2("imgLoading","8","off"); // 加载等待图片
		

	}
	
	
	oA.inProcess(1);
	
	
	return true;


}





function rstLogin(r){
	
	var strRep=r;
	
	if(strRep=="1"){
		//alert(strRep)
		window.location.href="MemberSearch.php";
		return;
	}else{
		if(strRep=="3001"){
			alert("The User Name and Password combination you have entered is invalid. Please try again.");
			return;
		}

		if(strRep=="2202(2)"){
			//alert("用户未通过邮件验证");
			window.location.href="pmtActivation.php?l=cn";
			return;
		}
		
		if(strRep=="2202(3)" ){
			//alert("用户未通过邮件验证");
			window.location.href="pmtActivation.php?l=en";
			return;
		}


		//document.getElementById("loading").innerHTML="";
		alert(strRep);
	}

}
