// JavaScript Document
window.onload=function(){
	//$("banner").style.aligh="center";
	//$("banner").style.lineHeight="80px";
	//$("banner").innerHTML="广告加载中……";
	//$("UserLoginInfo").hide();
	//$("banner").hide();      //注册广告是否显示。
	//$("UserViewedProduct").hide();  //用户最近浏览商品是否显示。
	//车型显示

	$("user").onchange=function(){
		$("CanRegMsg").style.width="50%";
		$("CanRegMsg").style.paddingLeft="20px";
		if(!$F(this)){
			$("CanRegMsg").innerHTML="请输入用户名！";
			$("user").focus();
			return false;
		}
		var url="check.php?user="+$F(this);
		var myAjax=new Ajax.Request(
			url,
			{
				method:'get',
				onComplete:function(AjaxResponse){
					if(AjaxResponse.responseText=="111"){
						$("CanRegMsg").innerHTML="恭喜！用户名可用！";
						$("user").canuse=true;
					}else{
						$("CanRegMsg").innerHTML="抱歉！用户名已经存在！";
						$("user").canuse=false;					
						$("user").focus();
					}
				}
			}
		);
	}

	$("email").onchange=function(){
		$("EmailMsg").style.width="50%";
		$("EmailMsg").style.paddingLeft="20px";
		if(!$F(this)){
			$("EmailMsg").innerHTML="请输入E-mail！";
			$("user").focus();
			return false;
		}
		var url="check1.php?email="+$F(this);
		var myAjax=new Ajax.Request(
			url,
			{
				method:'get',
				onComplete:function(AjaxResponse){
					if(AjaxResponse.responseText=="333"){
						$("EmailMsg").innerHTML="恭喜！E-mail可用！";
						$("email").canuse=true;
					}else{
						$("EmailMsg").innerHTML="抱歉！E-mail已被占用！";
						$("email").canuse=false;					
						$("email").focus();
					}
				}
			}
		);
	}

	
	var myAjax=new Ajax.Request(
		url,
		{
			methord:'get',
			onComplete:function(AjaxResponse){
				$("CarInnerCor").length=0;
				var root=AjaxResponse.responseXML.documentElement.getElementsByTagName("item");
				for(var i=0;i<root.length;i++){
					var opt=document.createElement("option");
					opt.text=root[i].firstChild.data;
					opt.value=root[i].firstChild.data;
					$("CarInnerCor").options.add(opt);
				}
			}
		}
	);

}

