$(function(){
	$('#Submit').click(function(){
		$('#n1, #n2, #n3').html('');
		var f_types	= $('#types').val();
		var uid		= $('#uid').val();
		var name	= $('#name').val();
		var fname;
		if(f_types == '') {
			$('#n1').html('<FONT COLOR="#CC0000">请选择您的参加方式！</FONT>');
			$('#types').focus();
		}
		else if(name == '') {
			$('#n2').html('<FONT COLOR="#CC0000">姓名不能为空！</FONT>');
			$('#name').focus();
		}
		else if(uid == '') {
			$('#n3').html('<FONT COLOR="#CC0000">身份证号码不能为空！</FONT>');
			$('#uid').focus();
		}
		else {
			if(f_types == 1) {
				fname = 'cs';
			}
			else if(f_types == 2) {
				fname = 'yh';
			}
			else if(f_types == 3) {
				fname = 'zyz';
			}
			$(this).attr('disabled','disabled');
			$.ajax({
				type:		"POST",
				url:		"./myajax.php",
				data:		"act=reg&uid="+uid+"&name="+name+"&types="+f_types,
				dataType:	"html",
				success:	function(result) {
								if(result == 0) {
									$('#n4').html('此身份证号已被注册！<br />请刷新本页从新填写');
								}
								else if(result == 1) {
									$('#n4').html('提交至后台的信息不完整！<br />请刷新本页从新填写');
								}
								else if(result > 2569) {
									$('#n4').html('您已注册成功，您的编号是'+result+'，请牢记！<br /><A class="z12_bai" HREF="../docs/'+fname+'.doc">请点此下载文档</A>');
								}
								else {
									$('#n4').html('有错误发生，请与我们联系！<br />刷新本页可以尝试从新填写');
								}
							}
			})
		}
	})

	$('#Query').click(function(){
		$('#n1, #n2, #n3').html('');
		var uid		= $('#uid').val();
		if(uid == '') {
			$('#n3').html('<FONT COLOR="#CC0000">身份证号码不能为空！</FONT>');
			$('#uid').focus();
		}
		else {
			$.ajax({
				type:		"POST",
				url:		"./myajax.php",
				data:		"act=qry&uid="+uid,
				dataType:	"html",
				success:	function(result) {
								if(result == 0) {
									$('#n4').html('您的信息尚未进行注册！<br />您可以填写您的信息注册，并下载相关文档填写打印后邮寄给我们');
								}
								else {
									$('#n4').html(result);
								}
							}
			})
		}
	})
})