//************************************************************
//  文件：Ajax处理函数集合
//  作者：唐鸣 (529Z.COM)
//  版权：部分函数转载于互联网，仅用作学习之用。开源授权。
//  创建：2009-11-01
//  修改：
//  记录：
//                                       Powered By 529Z.COM
//************************************************************

function ajax_bg(o) {
	$("ajax_bg").style.display = o;
	$("ajax_bg").style.width = document.documentElement.scrollWidth + "px";
	$("ajax_bg").style.height = document.documentElement.scrollHeight + "px";
}
function messenger_bg(o) {
	$("messenger_bg").style.display = o;
}
function frame_bg(o) {
	$("frame_bg").style.display = o;
}
function showtime(o, t, l) {
	window.setTimeout("showtime('" + o + "', " + t + ", " + l + ")", 1);
	var toppx = document.documentElement.scrollTop + (document.documentElement.clientHeight-t)/2;
	var leftpx = document.documentElement.scrollLeft + (document.documentElement.clientWidth-l)/2;
	$(o).style.margin = toppx + "px 0px 0px " + leftpx + "px";
}

function createajax() {
	var xmlhttp;
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {}
		}
	}
	return xmlhttp;
}

function ajaxdisplay(o) {
	$(o).style.display = "block";
}

function ajaxhidden(o) {
	$(o).style.display = "none";
}

function ajaxright(o) {
	$(o).innerHTML = "<img src=\"images/right.gif\" />";
}

function codecheck(i, o) {
	var code = $(i).value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o).innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&code=" + escape(code) + "&n=" + Math.random());
}

function passcheck(i, o) {
	$(o).style.display = "none";
	var pass = document.recoverform["pass"].value;
	var pass2 = document.recoverform["pass2"].value;
	var code = document.recoverform["usercode"].value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o + "2").innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&pass=" + escape(pass) + "&pass2=" + escape(pass2) + "&code=" + escape(code) + "&n=" + Math.random());
}

function modifycheck1(i, o) {
	$(o).style.display = "none";
	var opass = document.modifyform1["opass"].value;
	var pass = document.modifyform1["pass"].value;
	var pass2 = document.modifyform1["pass2"].value;
	var code = document.modifyform1["usercode1"].value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o + "2").innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&pass=" + escape(pass) + "&pass2=" + escape(pass2) + "&code=" + escape(code) + "&n=" + Math.random());
}

function modifycheck2(i, o) {
	$(o).style.display = "none";
	var protection = document.modifyform2["protection"].value;
	var result = document.modifyform2["result"].value;
	var idcard = document.modifyform2["idcard"].value;
	var idcardnumber = document.modifyform2["idcardnumber"].value;
	var email = document.modifyform2["email"].value;
	var code = document.modifyform2["usercode2"].value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o + "2").innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&protection=" + escape(protection) + "&result=" + escape(result) + "&idcard=" + escape(idcard) + "&idcardnumber=" + escape(idcardnumber) + "&email=" + escape(email) + "&code=" + escape(code) + "&n=" + Math.random());
}

function modifycheck3(i, o) {
	$(o).style.display = "none";
	var name = document.modifyform3["name"].value;
	var sex = document.modifyform3["sex"].value;
	var tel = document.modifyform3["tel"].value;
	var mobile = document.modifyform3["mobile"].value;
	var qq = document.modifyform3["qq"].value;
	var msn = document.modifyform3["msn"].value;
	var code = document.modifyform3["usercode3"].value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o + "2").innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&name=" + escape(name) + "&sex=" + escape(sex) + "&tel=" + escape(tel) + "&mobile=" + escape(mobile) + "&qq=" + escape(qq) + "&msn=" + escape(msn) + "&code=" + escape(code) + "&n=" + Math.random());
}

function ajaxcheck(i, o) {
	$(o).style.display = "none";
	var user = document.regform["user"].value;
	var pass = document.regform["pass"].value;
	var pass2 = document.regform["pass2"].value;
	var name = document.regform["name"].value;
	var sex = document.regform["sex"].value;
	var tel = document.regform["tel"].value;
	var mobile = document.regform["mobile"].value;
	var qq = document.regform["qq"].value;
	var msn = document.regform["msn"].value;
	var code = document.regform["code"].value;
	var protection = document.regform["protection"].value;
	var result = document.regform["result"].value;
	var email = document.regform["email"].value;
	var idcard = document.regform["idcard"].value;
	var idcardnumber = document.regform["idcardnumber"].value;
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o + "2").innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_register.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("input=" + escape(i) + "&user=" + escape(user) + "&pass=" + escape(pass) + "&pass2=" + escape(pass2) + "&name=" + escape(name) + "&sex=" + escape(sex) + "&tel=" + escape(tel) + "&mobile=" + escape(mobile) + "&qq=" + escape(qq) + "&msn=" + escape(msn) + "&code=" + escape(code) + "&protection=" + escape(protection) + "&result=" + escape(result) + "&email=" + escape(email) + "&idcard=" + escape(idcard) + "&idcardnumber=" + escape(idcardnumber) + "&n=" + Math.random());
}

function ajaxmessenger(o, p, i) {
	if (o == "send") {
		var u = document.writeform.user.value;
		var t = document.writeform.title.value;
		var x = document.writeform.text.value;
	}
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				if (o == "close") {
					ajax_bg("none");
					messenger_bg("none");
					$("messenger_user").innerHTML = xmlhttp.responseText;
				} else {
					ajax_bg("block");
					messenger_bg("block");
					if ((o == "send") && (u == "" || t == "" || x == "")) {
						alert("收件人、主题、消息内容不能为空。");
					} else {
						$("messenger_bg").innerHTML = xmlhttp.responseText;
					}
					showtime("messenger_id", 500, 650);
				}
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_messenger.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("act=" + escape(o) + "&p=" + escape(p) + "&i=" + escape(i) + "&u=" + escape(u) + "&t=" + escape(t) + "&x=" + escape(x) + "&n=" + Math.random());
}

function ajax_skin(o, i, p, s, m) {
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o).innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_info.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("act=" + escape(o) + "&i=" + escape(i) + "&p=" + escape(p) + "&s=" + escape(s) + "&m=" + escape(m) + "&n=" + Math.random());
}

function ajax_date(o, i) {
	var xmlhttp = createajax();
	xmlhttp.onreadystatechange = function() {
		if (4 == xmlhttp.readyState) {
			if (200 == xmlhttp.status) {
				$(o).innerHTML = xmlhttp.responseText;
			} else {
				alert("异步提交数据时发生一个错误。");
			}
		}
	}
	xmlhttp.open("post","ajax_info.asp",true);
	xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xmlhttp.send("act=" + escape(o) + "&i=" + escape(i) + "&n=" + Math.random());
}
