$(function(){
	$.formValidator.initConfig({onError:function(msg){alert(msg)}});

	$("#name").formValidator({onshow:"",onfocus:"请填写您的真实姓名",oncorrect:"",onempty:""}).InputValidator({min:1,onerror:"请填写您的真实姓名"});
	$("#mobile").formValidator({onshow:"",onfocus:"手机格式错误",oncorrect:"",onempty:""}).InputValidator({min:11,max:11,onerror:"手机号码必须是11位的,请确认"}).RegexValidator({regexp:"mobile",datatype:"enum",onerror:"手机号码格式不正确"});
	$("#email").formValidator({onshow:"",onfocus:"邮箱至少6个字符,最多100个字符",oncorrect:""}).InputValidator({min:6,max:100,onerror:"邮箱格式错误,请确认"}).RegexValidator({regexp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onerror:"邮箱格式错误"});
	$("#question").formValidator({onshow:"",onfocus:"请填写您的保险疑问",oncorrect:"",onempty:""}).InputValidator({min:1,onerror:"请填写您的保险疑问"});
	set();

	$("#question").one("click", function(){
		$(this).text("");
	});

});

function showTable(t1,t2){
	$('#' + t1).show();
	$('#' + t2).hide();
}

function set(){
	var name = $('#hidename').val();
	$('#question').val(name);
	$('#product_name').text(name);
}
//Ajax信息带入
function checklogin()
{
	$.post("/page/PagePageLogin.html", { ajaxString:"memberinfo" }, function(data) {
		if (data.msg == "logout") {
			$("#spDisplay").show();
			$("#province").cnCity({ cityId:'#city' });
		} else if (data.msg == "login"){
			$("#spDisplay").hide();
			$("#name").val(data.name);
			$("#mobile").val(data.phone_mobile);
			$("#email").val(data.email);
			if ($("#gender").val() == "1") {
				$(":radio[name=sex]:eq(0)").attr("checked", true);
			} else {
				$(":radio[name=sex]:eq(1)").attr("checked", true);
			}
			$("#province").cnCity({defaultCity:data.city, defaultProvince:data.cityarea, cityId:'#city'});	
		}
	}, "json");
}
