

var http_request;
function findByAcctelAndCid(){

	var cid=document.getElementById("cid");
	if(null==cid||cid.value==""){
		$.prompt("\u8bf7\u8f93\u5165\u516c\u53f8\u7f16\u53f7\uff01");
		cid.focus();
		return;
	}
	var acctel=document.getElementById("acctel");
	if(null==acctel||acctel.value==""){		
		$.prompt("\u8bf7\u8f93\u5165\u60a8\u7684\u624b\u673a\u53f7\uff01");
		acctel.focus();
		return;
	}
	http_request = new ActiveXObject("Microsoft.XMLHTTP");
	http_request.open("POST", "accountOS.do?method=findByAcctelAndCid", true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.onreadystatechange = findPassByAcctel;
	http_request.send("acctel=" + acctel.value+"&cid="+cid.value);
}
function findPassByAcctel(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var isexists=http_request.responseText;
			if(isexists!=""&&isexists=="true"){
				var bool=confirm("\u662f\u5426\u9700\u8981\u627e\u56de\u5bc6\u7801\uff1f");
				if(bool){
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
					http_request.open("POST", "accountOS.do?method=findPassByAcctel", true);
					http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					http_request.onreadystatechange = sendPassByAcctel;
					http_request.send();
				}
			}else{
				$.prompt("\u8be5\u624b\u673a\u53f7\u4e0d\u5b58\u5728!");
			}
		}
	}
	
}

function sendPassByAcctel(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			alert(http_request.responseText);
		}
	}
}
/**
 * 找回密码
 * @author chenwei
 */
function Tofindpassword(){
	var cid=$("#cid").val();
	var username=$("#acctel").val();
	var url="accountOS.do?method=TofindPassByAcctel&cid="+cid+"&acctel="+username;
	window.open(url,"_blank");
	
}
/**
 * 修改不支持FireFox的BUG
 * chenwei
 */
function addTravellerByAjaxNew2() {
			var base=$("#bathPath").val();
			$.ajax({
				type : "post",
				url : base+"servlet/RandImgCheck",
				data : {
					type:1,
					rand2 : $("#rand2").val()
				},
				beforeSend : function(XMLHttpRequest) {
					if($("#cid").val()==""){
						$.prompt("公司代码不能为空！");
						return false;
					}else if($("#acctel").val()==""){
						$.prompt("手机号码不能为空！");
						return false;
					}else if($("#password").val()==""){
						$.prompt("密码不能为空！");
						return false;
					}
				},
				success : function(data) {
					if(data=='1'){
						document.forms[0].submit();
						}else{
						$.prompt("验证码输入错误！");
						reloadcode2();
						}
				}
	});
}