if(typeof window.XMLHttpRequest==="undefined"){
			window.XMLHttpRequest=function(){
				return new window.ActiveXObject(navigator.userAgent.indexOf("MSIE 5")>=0?"Microsoft.XMLHTTP":"Msxml2.XMLHTTP");
			};
	}
	var jrAjax = function(uri,options){
			var httpRequest,httpSuccess,timeout,isTimeout=false,isComplete=false;
			options={
				method:options.method||"GET",
				data:options.data||null,
				arguments:options.arguments||null,
				onSuccess:options.onSuccess||function(){},
				onError:options.onError||function(){},
				onComplete:options.onComplete||function(){},
				onTimeout:options.onTimeout||function(){},
				isAsync:options.isAsync||true,
				timeout:options.timeout?options.timeout:30000,
				contentType:options.contentType?options.contentType:"utf-8",
				type:options.type||"xml"
			};
			uri=uri||"";
			timeout=options.timeout;
			httpRequest=new window.XMLHttpRequest();
			httpRequest.open(options.method,uri,options.isAsync);
			//httpRequest.setRequestHeader("Content-Type",options.contentType);
			httpRequest.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
			httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
			httpRequest.send(options.data);
			httpSuccess=function(r){ 
				try{
					return(!r.status&&location.protocol=="file:")||
						(r.status>=200&&r.status<300)||
						(r.status==304)||
						(navigator.userAgent.indexOf("Safari")>-1&&typeof r.status=="undefined");
				}catch(e){}
			return false;
			};
		httpRequest.onreadystatechange=function(){
			if(httpRequest.readyState==4){
				if(!isTimeout){
					var o={};
					o.responseText=httpRequest.responseText;
					o.responseXML=httpRequest.responseXML;
					o.data=options.data;
					o.status=httpRequest.status;
					o.uri=uri;
					o.arguments=options.arguments;
					if(httpSuccess(httpRequest)){
						if(options.type==="script"){
							eval.call(window,data);
						}
						options.onSuccess(o);
					}else{
						options.onError(o);
					}
					options.onComplete(o);
				}
				isComplete=true;
				httpRequest=null;
			}
		};

		window.setTimeout(
			function(){
				var o;
				if(!isComplete){
					isTimeout=true;
					o={};
					o.uri=uri;
					o.arguments=options.arguments;
					options.onTimeout(o);
					options.onComplete(o);
				}
			},timeout);
		return httpRequest;
		};
function doDone(){
	var user = document.getElementById('uname').value.trim();
	var tel = document.getElementById('tel').value.trim();
	var email = document.getElementById('email').value.trim();
	var cl = document.getElementById('class').value.trim();
	var area = document.getElementById('area').value.trim();
	if(user == ''){
		alert('姓名不能为空!');
		document.getElementById('uname').focus();
	}else if('' == tel){
		alert('请填写联系电话!');
		document.getElementById('tel').focus();
	}else if('' == cl){
		alert('请选择年级!');
		document.getElementById('class').focus();
	}else if(area == ""){
		alert("请选择校区!");
		document.getElementById('area').focus();
	}else{
		var options = {
			method : 'POST',
			data : 'uname=' + encodeURIComponent(user) + '&tel=' + encodeURIComponent(tel) + '&email=' + encodeURIComponent(email) + '&class=' + encodeURIComponent(cl) + '&area=' + encodeURIComponent(area),
			isAsync : true,
			onSuccess : function(data){if(data.responseText == 'ok'){
				alert('信息提交完毕，我们的专业人员将尽快与您取得联系，并会为您及时开通测评账号。请您保持联系方式的畅通，谢谢。');
				document.getElementById('uname').value = "";
				document.getElementById('tel').value = "";
				document.getElementById('email').value = "";
				document.getElementById('class').value = "";
			}}
		};
		var uri = 't.php';
		jrAjax(uri, options);
	}
}


String.prototype.trim = function(){
	return this.replace(/^\s*|\s*$/, '');
}
