Ext.BLANK_IMAGE_URL = 'resources/images/default/s.gif';
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'qtip';

var userAdd;
var store1="";
var storeValue="";
var comstore1="";
var comstoreValue="";
var Threestore1="";
var ThreestoreValue = "";

//简化document.getElementById
function S(i,win){
	try{
		return( win || window ).document.getElementById(i);
	}
	catch( e ){
		return null;
	}
}

//多选限制
function check_num(id){
	var s = 0;
	for(i=0;i<document.UserReg.specialid.length;i++){
		if(document.UserReg.specialid[i].checked){
			s = s+1;
		}
	}
	if(s>6){
		alert("最多只能选择6个!");
		document.getElementById(id).checked=false;
	}else{
		on_input('div-ly','Msg-Blur-Style')
	}
	
}

//正则检测
function expression(str,expStr){
	var reg = new RegExp(expStr);
	if(!reg.test(str)){
		return false;
	}else{
		return true;
	}
}

//checkbox选择判断
function check_box(){
	var num=0;
    if(document.UserReg.specialid.length>0){
        for(i=0;i<document.UserReg.specialid.length;i++){
            if(document.UserReg.specialid[i].checked) num++;
        }
	    if(num>0){
			return true;
		}else{
			return false;
		}
	}
}
//AJAX设置下拉框
function setComBox(comBoxId,action,url,paramValue){
	//alert(paramValue);
	var comBox = new class_ajax();
	comBox.ID = comBoxId;
	comBox.init();
	comBox.set_sync();
	comBox.set_method("POST");
	comBox.set_event(function(){
		if(comBox.complete()){ 
			if(comBox.success()){
				var g_comBox = S(comBoxId);
				var q_comBox = S("u_diqu");
				q_comBox.length = 1;
				g_comBox.length = 1;
				var response = eval(comBox.get_content('txt')); 
				for(var i=0;i<response.length;i++)
				{
					var p=response[i];
					var oOption = document.createElement("option");
					oOption.appendChild(document.createTextNode(p.name));
					oOption.setAttribute("value", p.code);
					g_comBox.appendChild(oOption);
						//content.add(new Option(p.name,p.code));
				}
			}else{ 
				alert("服务器返回错误！请联系管理员.Error.State="+comBox.xmlHttp.responseText);
			} 
		}
	});
	comBox.set_url(url+"?action="+escape(action));
	comBox.add_param("param",escape(paramValue));
  	comBox.add_param("a", new Date().getTime());
  	comBox.submit();
}
//表单检测
function on_input(objname,style){
	var txt;
	var Myreg11 =  /^(((13[0-9]{1})|(18[0-9]{1})|15[0-9]{1})+\d{8})$/;
	var obj=document.getElementById(objname);
	obj.className=style;
	switch (objname){
		case "div-un":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserName.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，用户名不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserName.value!="" && document.UserReg.UserName.value.length<4){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，用户名长度小于4位！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserName.value!="" && document.UserReg.UserName.value.length>3){
			  txt="<img src=images/loading.gif> loading...";
			  ajax(1,document.UserReg.UserName.value);
			}else{
			  txt="只限输入英文、数字以及“_”下划线，长度为4-20个字符之间！";
			}
			break;
		case "div-pwd":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.password.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，密码不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.password.value!="" && document.UserReg.password.value.length<6){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，密码长度小于6位！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.password.value!="" && document.UserReg.password.value.length>5){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，密码填写通过！";
			  
			}else{
			  txt="长度范围在6-20个字符之间！";
			}
			break;
		case "div-pwd2":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.password2.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，确认密码不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.password2.value!="" && document.UserReg.password2.value.length<6){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，确认密码长度小于6位！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.password.value!=document.UserReg.password2.value){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，确认密码与密码不一致！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.password2.value!="" && document.UserReg.password2.value.length>5 && document.UserReg.password.value==document.UserReg.password2.value){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，确认密码填写通过！";
			  
			}else{
			  txt="长度范围在6-20个字符之间！";
			}
			break;
		case "div-email":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.Email.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，E-mail不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.Email.value!="" && expression(document.UserReg.Email.value,"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$")==false){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，无效E-mail地址！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.Email.value!="" && expression(document.UserReg.Email.value,"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$")==true){
			  txt="<img src=images/loading.gif> loading...";
			  ajax(2,document.UserReg.Email.value);
			}else{
			  txt="请正确填写email地址，以保证能够正常收到活动通知以及电子期刊等重要邮件！";
			}
			break;
		case "div-run":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserRealName.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，真实姓名不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserRealName.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，真实姓名填写通过！";
			  
			}else{
			  txt="限中文，小于20个字符，请正确填写您的真实姓名，姓名不真实者将无法获得心血管网任何活动奖品以及奖励积分！";
			}
			break;
		case "div-useraddname":
			if(obj.className=="Msg-Blur-Style" && document.UserReg.u_diqu.value==""){
				obj.className="Msg-Err-Style";
				txt="<img src=images/reg_no.gif> 错误，请正确选择省市区！"
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.u_diqu.value!=""){
				obj.className="Msg-Ok-Style";
			  	txt="<img src=images/reg_ok.gif> 正确，省市区已经选择！";
				
			}else{
				txt="请选择省市区！！";
			}
			break;
		case "div-dwlb":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserUnitType.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，请选择单位类别！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserUnitType.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，单位类别已经选择！";
			  
			}else{
			  txt="请选择单位类别！！";
			}
			break;
		case "div-dw":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserUnit.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，单位不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserUnit.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，单位填写通过！";
			  
			}else{
			  txt="请填写您的工作单位！！";
			}
			break;
		case "div-ks":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserDePartMent.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，部门不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserDePartMent.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，部门填写通过！";
			  
			}else{
			  txt="请填写您所属的部门！";
			}
			break;
		case "div-zw":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserFuncTions.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，职务不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserFuncTions.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，职务填写通过！";
			  subOk = true;
			  inputNull = true;
			}else{
			  txt="请填写您的职务！";
			}
			break;
		case "div-xh1":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh1zhiwu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，学会名称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh1zhiwu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，学会名称填写通过！";
			}else{
			  txt="请填写您的学会名称！";
			}
			break;
		case "div-xh2":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh2zhiwu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，学会名称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh2zhiwu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，学会名称填写通过！";
			}else{
			  txt="请填写您的学会名称！";
			}
			break;
		case "div-xh3":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh3zhiwu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，学会名称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh3zhiwu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，学会名称填写通过！";
			}else{
			  txt="请填写您的学会名称！";
			}
			break;
		case "div-xh4":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh4zhiwu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，学会名称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh4zhiwu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，学会名称填写通过！";
			}else{
			  txt="请填写您的学会名称！";
			}
			break;
		case "div-xh5":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh5zhiwu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，学会名称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.userxh5zhiwu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，学会名称填写通过！";
			}else{
			  txt="请填写您的学会名称！";
			}
			break;
		case "div-zzsd":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.zhenzhishouduan.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，诊治手段不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.zhenzhishouduan.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，诊治手段填写通过！";
			}else{
			  txt="请填写您的诊治手段！";
			}
			break;
		case "div-zc":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserTitles.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，职称不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserTitles.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，职称填写通过！";
			  inputNull = true;
			  subOk = true;
			}else{
			  txt="请填写您的职称！";
			}
			break;
		case "div-tel":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserTel.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，联系电话不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserTel.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，联系电话填写通过！";
			  inputNull = true;
			  subOk = true;
			}else{
			  txt="多个号码用\"|\"分割，限半角输入";
			}
			break;
		case "div-mobile":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.ElibomResu.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，手机号码不能为空！"; }
			  
           else if(obj.className=="Msg-Blur-Style" && document.UserReg.ElibomResu.value.length!=11)
           {
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，手机号码必需为11位！";
            }else if(obj.className=="Msg-Blur-Style" && !Myreg11.test(document.UserReg.ElibomResu.value)){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，手机号码不合法！";
			  
			  
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.ElibomResu.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，手机号码填写通过！";
			  inputNull = true;
			  subOk = true;
			}else{
			  txt="多个号码用\"|\"分隔，限半角输入！";
			}
			break;
		case "div-addr":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserAddress.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，通讯地址不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserAddress.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，通讯地址填写通过！";
			  inputNull = true;
			  subOk = true;
			}else{
			  txt="请正确输入您的通讯地址，这将影响到通知以及活动奖品的邮递！";
			}
			break;
		case "div-post":
		    if(obj.className=="Msg-Blur-Style" && document.UserReg.UserPost.value==""){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，邮政编码不能为空！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserPost.value!="" && document.UserReg.UserPost.value.length<6){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，邮政编码位数不对！";
			}else if(obj.className=="Msg-Blur-Style" && document.UserReg.UserPost.value!=""){
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，邮政编码填写通过！";
			  inputNull = true;
			  subOk = true;
			}else{
			  txt="只限数字！";
			}
			break;
		case "div-ly":
		    if(!check_box()){
	          obj.className="Msg-Err-Style";
			  txt="<img src=images/reg_no.gif> 错误，至少要选择一个领域！";
			}else{
	          obj.className="Msg-Ok-Style";
			  txt="<img src=images/reg_ok.gif> 正确，涉及领域选择完毕！";
			  subOk = true;
			  inputNull = false;
			}
			break;
	}
	obj.innerHTML=txt;
}

//AJAX检测是否存在
function ajax(flag,str){
	var ajaxData = new class_ajax();
	ajaxData.ID = "ajaxDataId";
	ajaxData.init();
	ajaxData.set_method("POST");
	ajaxData.set_event(function(){
		if(ajaxData.complete()){ 
			if(ajaxData.success()){
				var data = ajaxData.get_content('txt');
				if(data=="success" && flag==1){
					S("div-un").className="Msg-Ok-Style";
					S("div-un").innerHTML="<img src=images/reg_ok.gif> 正确，用户名可以注册！";
					
				}else if(data=="success" && flag==2){
					S("div-email").className="Msg-Ok-Style";
					S("div-email").innerHTML="<img src=images/reg_ok.gif> 正确，E-mail填写通过！";
				}else if(data!="success" && flag==1){
					S("div-un").className="Msg-Err-Style";
					S("div-un").innerHTML="<img src=images/reg_no.gif> 错误，用户名["+str+"]已经存在！"; 
				}else if(data!="success" && flag==2){
					S("div-email").className="Msg-Err-Style";
					S("div-email").innerHTML="<img src=images/reg_no.gif> 错误，已经有用户在注册时使用了["+str+"]邮箱，请填写其他E-mail地址！"; 
				}
			}else{ 
				if(flag==1){
					S("div-un").className="Msg-Err-Style";
					S("div-un").innerHTML="<img src=images/reg_no.gif> 用户名检测失败，稍后再试！"; 
				}else if(flag==2){
					S("div-email").className="Msg-Err-Style";
					S("div-email").innerHTML="<img src=images/reg_no.gif> E-mail检测失败，稍后再试！";
				}
			}
		}else{
			if(flag==1){
				S("div-un").className="Msg-Focus-Style";
				S("div-un").innerHTML=" 用户名检测中...！"; 
			}else if(flag==2){
				S("div-email").className="Msg-Focus-Style";
				S("div-email").innerHTML=" E-mail检测中...！";
			}
		}
	});
	ajaxData.set_url('reg_ajax.asp');
	ajaxData.add_param("flag",escape(flag));
	ajaxData.add_param("str",escape(str));
  	ajaxData.add_param("a", new Date().getTime());
  	ajaxData.submit();
}

//设置用户地址输入框
function SetAdd(){
	on_input('div-useraddname','Msg-Blur-Style')
	document.UserReg.UserAddress.value = "";
	var sheng = S("u_sheng");
	store1 =  sheng.options[sheng.selectedIndex].text;
	storeValue = sheng.value;
	
	var shi = S("u_shi");
	comstore1 = shi.options[shi.selectedIndex].text;
	comstoreValue = shi.value;
			
	var qu = S("u_diqu");
	Threestore1 = qu.options[qu.selectedIndex].text;
	ThreestoreValue = qu.value;
	
	userAdd = sheng.options[sheng.selectedIndex].text + shi.options[shi.selectedIndex].text + qu.options[qu.selectedIndex].text;
	document.UserReg.UserAddress.value = userAdd;
	var userType = document.getElementsByName("UserType");
    for (i=0;i<userType.length;i++){
		if (userType[i].checked){
        	var values = userType[i].value;
        }
    }
	if(values==3){
		S("ShowButt").style.visibility="visible";
	}
}

//设置职务
function setFunction(){
	var p = S("SUserFuncTions");
	var userFunction = p.options[p.selectedIndex].text;
	if(userFunction=="其他"){
		document.UserReg.UserFuncTions.value = "请在此处正确填写您的职务"
	}
	else{
		document.UserReg.UserFuncTions.value = userFunction;
	}
	document.UserReg.userfunction_code.value = p.value;
}

//设置诊治手段
function setzzsd(){
	var p = S("Szhenzhishouduan");
	var zhenzhishouduan = p.options[p.selectedIndex].text;
	if(zhenzhishouduan=="其他"){
		document.UserReg.zhenzhishouduan.value = "请在此处正确填写您的诊治手段"
	}
	else{
		document.UserReg.zhenzhishouduan.value = zhenzhishouduan;
	}
	document.UserReg.zhenzhishouduan_code.value = p.value;
}

//设置职称
function setTitles(){
	var p = S("Susertitles");
	var userTitle = p.options[p.selectedIndex].text;
	if(userTitle=="其它"){
		document.UserReg.UserTitles.value = "请在此处正确填写您的职称"
	}
	else{
		document.UserReg.UserTitles.value = userTitle;
	}
	document.UserReg.usertitle_code.value = p.value;
}

//设置文本框数据
function setInputData(comBoxValue,inputId){
	S(inputId).value = comBoxValue;
}

//定义省的数据源
var store=new Ext.data.Store({
        autoLoad:true,
        proxy:new Ext.data.HttpProxy({
            url:'city.asp?action=cityn&a='+new Date().getTime()+''
        }),
        reader:new Ext.data.JsonReader({
            id:'ID',
            fields:['name','code']
        }),
        remoteSort:true
    });
//定义市的数据源
var comstore =new Ext.data.Store({
	autoLoad:false,
    proxy:new Ext.data.HttpProxy({
    	url:'city.asp?action=cityt&a='+new Date().getTime()+'',
        method:'post'
    }),
    reader:new Ext.data.JsonReader({
    	id:'ID',
        fields:['name','code']
    }),
    remote:true
    });
//定义区的数据源数据源
var Threestore =new Ext.data.Store({
        autoLoad:false,
        proxy:new Ext.data.HttpProxy({
            url:'city.asp?action=citys&a='+new Date().getTime()+'',
            method:'post'
        }),
        reader:new Ext.data.JsonReader({
            id:'ID',
            fields:['name','code']
        }),
        remote:true
   });
var hospital = new Ext.data.Store({
		autoLoad : false,
		proxy : new Ext.data.HttpProxy({
			url : 'Hospital.asp?action=HospList&a='+new Date().getTime()+'',
			method : 'post'
		}),
		reader : new Ext.data.JsonReader({
			id : 'ID',
			fields : ['name','code']
		}),
		remote : true
	});
//弹出选择医院层
function ShowHospWin()
{
	var shengValue; 
	var shiValue; 
	var quValue;
	var userDw;
	var userDwCode;
	var hospWin = new Ext.Window({
		id:'HWin',
		title : '选择医院',
		width : 400,
		height:210,
		modal:true,
		closable : true,
		resizable : false,
		createFormPanel:function(){
			return new Ext.form.FormPanel({
				bodyStyle : 'padding-top:6px', 
				defaultType : 'textfield', 
				labelAlign : 'right', 
				labelWidth : 65, 
				labelPad : 0, 
				frame : true, 
				defaults : { 
					allowBlank : false, 
					width : 300, 
					selectOnFocus:true 
				},
				items : [{
						xtype:"combo",
						name:'hosp_sheng1',
						id : 'hosp_sheng',
						fieldLabel:'请选择省',
						displayField:'name',
						valueField:'code',
						store:store,
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'hosp_sheng1',
						emptyText:'请选择省',
						blankText : '请选择省',
						listeners:{   
							select:function(combo, record,index){
								 try{
									 //userAdd = record.data.name;
									 var parent=Ext.getCmp('hosp_shi');
									 var parent1 = Ext.getCmp("hosp_qu");
									 parent1.clearValue();
									 parent.clearValue();
									 parent.store.reload({params:{param:this.value}});
								 }
								 catch(ex){
									 Ext.MessageBox.alert(ex);
								 }
							}
						}
					},
					{
						xtype:"combo",
						name:'hosp_shi1',
						id : 'hosp_shi',
						fieldLabel:'请选择市',
						displayField:'name',
						valueField:'code',
						store:comstore,
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'hosp_shi1',
						emptyText:'请选择市',
						blankText : '请选择市',
						listeners:{   
							select:function(combo, record,index){
								try{
									 var parent1=Ext.getCmp('hosp_qu');
									 parent1.clearValue();
									 //alert(record.data.name);
									 parent1.store.reload({params:{param:this.value}});
								}
								catch(ex){
									Ext.MessageBox.alert(ex);
								}
							}
						}
					},
					{
						xtype:"combo",
						name:'hosp_qu1',
						id : 'hosp_qu',
						fieldLabel:'请选择区',
						displayField:'name',
						valueField:'code',
						store:Threestore,
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'hosp_qu1',
						emptyText:'请选择区',
						blankText : '请选择区',
						listeners:{   
							select:function(combo, record,index){
							try{
								 var s1 = Ext.getCmp("hosp_sheng").getValue();
								 var s2 = Ext.getCmp("hosp_shi").getValue();
								 var s3 = this.value;
								 var parent=Ext.getCmp('select_hosp');
								 parent.clearValue();
								 //alert(record.data.name);		 
								 parent.store.reload({
									params:{
										Param1:s1,
										Param2:s2,
										Param3:s3
									}
								});
							}
							catch(ex)
							{
								Ext.MessageBox.alert(ex);
							}
							}
						}
					},
					{
						xtype:"combo",
						name:'hospital',
						id : 'select_hosp',
						fieldLabel:'请选择医院',
						displayField:'name',
						valueField:'code',
						store : hospital,
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'hospital',
						emptyText:'请选择医院',
						blankText : '请选择医院',
						listeners:{
							select:function(combo, record,index){
								userDw = record.data.name;
								userDwCode = record.data.code;
							}   
						}
					},
					{
						xtype : "textfield",
						name : "userhosp",
						id : "userhosp",
						fieldLabel : "请填写医院",
						allowBlank : false,
						emptyText : "如没有您所在医院可选，请将您的医院全称填入此栏"
					}],
				buttons:[{
					text:"确定",
	  				handler:function(){
						if(typeof(userDw)=="undefined" && Ext.getCmp("userhosp").getValue()==""){
							Ext.MessageBox.alert("提示！","请选择医院或填写您医院的全称！");
						}else{
							if (userDwCode.indexOf("|")!=-1)
							{
								userDwCodes=userDwCode.split("|");
								userunit_code=userDwCodes[0];
								userpost_code=userDwCodes[1];
							}
							else
							{
								userunit_code=userDwCode;
								userpost_code="";
							}
							if(typeof(userDw)!="undefined"){
								document.UserReg.UserUnit.value = userDw;
								document.UserReg.UserUnit_code.value = userunit_code;
								document.UserReg.UserUnit.focus();
								if (document.UserReg.UserPost)
								{
									document.UserReg.UserPost.value = userpost_code;
								}
								Ext.getCmp("HWin").close();
							}else{
								document.UserReg.UserUnit.value = Ext.getCmp("userhosp").getValue();
								document.UserReg.UserUnit_code.value = "";
								document.UserReg.UserUnit.focus();
								if (document.UserReg.UserPost)
								{
									document.UserReg.UserPost.value = "";
								}
								Ext.getCmp("HWin").close();
							}
						}
					},
	  				scope:this
				}]
			});
		},
		initComponent : function(){  
			//UserRegWindow.superclass.initComponent.call(this); 
			this.fp=this.createFormPanel(); 
			this.add(this.fp); 
		}
	});	
	if(store1!=""){
		Ext.getCmp('hosp_shi').store.reload({params:{param:storeValue}});
		Ext.getCmp('hosp_sheng').setValue(store1);
	}
	if(comstore1!=""){
		Ext.getCmp('hosp_qu').store.reload({params:{param:comstoreValue}});
		Ext.getCmp('hosp_shi').setValue(comstore1);
	}
	if(Threestore1!="")
	{
		Ext.getCmp('hosp_qu').setValue(Threestore1);	
	}
	if(Threestore1!=""){
		Ext.getCmp('select_hosp').store.reload({
			params:{
				Param3:ThreestoreValue
			}
		});
	}else if(storeValue!="" || comstoreValue!=""){
		Ext.getCmp('select_hosp').store.reload({
			params:{
				Param1:storeValue,
				Param2:comstoreValue
			}
		});
	}
	hospWin.show();
}

function checkForm(){
	var userType_name = document.getElementsByName("UserType");
	
	for (i=0;i<userType_name.length;i++)
     {
            if (userType_name[i].checked)
           {
                 var userType = userType_name[i].value;
           }
     }
	
	if(S("UserType").value == ""){
		alert("请选择注册类别");
		return false;
	}
	if(S("UserName").value == ""){
		alert("用户名不能为空");
		S("UserName").focus();
		return false;
	}
	if(S("password").value == ""){
		alert("密码不能为空");
		S("password").focus();
		return false;
	}
	if(S("password2").value == ""){
		alert("确认密码不能为空");
		S("password2").focus();
		return false;
	}
	//alert(userType);
	//return false;
	if(userType != 4){
		if(S("user_realName").value == ""){
			alert("真实姓名不能为空");
			S("user_realName").focus();
			return false;
		}
		if(S("u_sheng").value == "" || S("u_shi").value == "" || S("u_diqu").value == ""){
			alert("省市区不能为空");
			return false;
		}
		if(document.UserReg.UserUnit.value == ""){
			alert("工作单位不能为空");
			document.UserReg.UserUnit.focus();
			return false;
		}
		if(document.UserReg.UserAddress.value == ""){
			alert("通讯地址不能为空");
			document.UserReg.UserAddress.focus();
			return false;
		}
		if(document.UserReg.UserDePartMent.value == ""){
			alert("所属部门不能为空");
			document.UserReg.UserDePartMent.focus();
			return false;
		}
		if(document.UserReg.UserFuncTions.value == ""){
			alert("职务不能为空");
			document.UserReg.UserFuncTions.focus();
			return false;
		}
		if(document.UserReg.ElibomResu.value == ""){
			alert("手机号码不能为空");
			document.UserReg.ElibomResu.focus();
			return false;
		}
		if(document.UserReg.UserTel.value == ""){
			alert("联系电话不能为空");
			document.UserReg.UserTel.focus();
			return false;
		}
		if(document.UserReg.UserPost.value == ""){
			alert("邮政编码不能为空");
			document.UserReg.UserPost.focus();
			return false;
		}
	}
	if(userType == 0 || userType == 1 || userType == 2 || userType == 3){
		if(S("user_sex").value == ""){
			alert("请选择性别");
			return false;
		}
	}
	
	if(userType == 3){
		if(S("UserBornDateY").value == "" || S("UserBornDateM").value == "" || S("UserBornDateD").value == ""){
			alert("请选择出生日期");
			return false;
		}
		if(document.UserReg.UserTitles.value == ""){
			alert("请选择职称");
			document.UserReg.UserTitles.focus();
			return false;
		}
		if(document.UserReg.sjly.value == ""){
			alert("请选择涉及领域");
			return false;
		}
		if(!check_box()){
	    	alert("请选择关注的领域");
			return false;
		}
	}
	if(document.UserReg.Email.value == ""){
		alert("电子邮件不能为空");
		document.UserReg.Email.focus();
		return false;
	}
}