// JavaScript Document
//Author:畅想色彩
//Date:08/06
function createAjax() {	
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');
	}
	catch (e) {
		try {
			_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			//_xmlhttp=new XMLHttpRequest();	//FF等浏览器的创建方式
		}
		catch (ee) {
			_xmlhttp=false;		//如果创建失败，将返回false
		}
	}
	    if (!_xmlhttp && typeof XMLHttpRequest != 'undefined')
        _xmlhttp = new XMLHttpRequest();
	return _xmlhttp;	//返回xmlhttp对象实例
}

function ajaxto(URL,ids) {	
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var idv=document.getElementById(ids);
		xmlhttp.open('GET',URL+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {	
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			    if (unescape(xmlhttp.responseText) == '该用户名已被注册'
			    || unescape(xmlhttp.responseText) == '验证码错误!请重新输入'
			    || unescape(xmlhttp.responseText) == '该昵称已被注册'
			    || unescape(xmlhttp.responseText) == '呢称受限制,请换一个重试'
			    || unescape(xmlhttp.responseText) == '身份证号码错误'
			    ) {
				idv.className="errmsg";
				idv.innerHTML=unescape(xmlhttp.responseText);
				}
				else{
				idv.className="okmsg";
				idv.innerHTML=unescape(xmlhttp.responseText);
				}
			}
			else {
				idv.innerHTML='';	
			}
		}
		xmlhttp.send(null);	
		}
}