function findPwd() {
	var userName = document.getElementById("userName").value;
	var email = document.getElementById("email").value;
	if (userName.replace(/(^\s*)|(\s*$)/g, "") == "") {
		alert("\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a");
	} else {
		if (email.replace(/(^\s*)|(\s*$)/g, "") == "") {
			alert("\u9a8c\u8bc1email\u4e0d\u80fd\u4e3a\u7a7a");
		} else {
			checkUserIdEmail(userName, email);
		}
	}
}
function action(u, em) {
	var command = new Command("FindPasswordByEmailCmd", a_back);
        command.setParameter("userId", u);
		command.setParameter("email", em);
		command.execute();
	
}

function  checkUserIdEmail(userId,email){

  	var command=new Command('IsExsitUserIdEmailCmd',function(data){
  		if(data.result=="1" && data.userId&& data.email){
	   	  if(confirm("点击确认后您的原密码将会重置，随机生成的新密码发送至您注册时填邮箱，请及时查收。是否确认？")){
	   	     action(userId,email);
	   	  } 
	   	}else if(data.result=="2"){
	   	  alert("用户不存在!");
	   	}
  	
  	});
  	command.setParameter('userId',userId);
  	command.setParameter('email',email);
	command.execute();
}

function a_back(d){
    if(d.data){
       alert(d.data);
       window.location.href="http://main.clickeye.com.cn/home/login_big.html";
    }
}



