/*
* jQuery 表单ajax检测插件(utf-8)版 1.0
* http://www.firste.cn
* Copyright (c) 2008 - 2009 firste
* 2008年8月下旬开始设计
* 完成于2008年11月20日
* 此文件生成于2008-11-27
*/
$(document).ready(function(){
	var validator = $("#firste_reg").validate({
			rules : {
				title : {
				required: true,
				maxlength: 50,
				minlength: 2
			},
			username : {
				required: true,
				fstring: true
			},
			password : {
				required: true,
				fstring: true
			},
			code: {
				required: true,
				digits: true,
				maxlength: 4,
				minlength: 4
			},
			old_password : {
				required: true,
				fstring: true
			},
			new_password : {
				required: true,
				fstring: true,
				maxlength: 20,
				minlength: 4
			},
			confirm_password:{
				required:true,
				fstring: true,
				equalTo:"#new_password",
				maxlength: 20,
				minlength: 4
			},
			address: {
				required: true,
				maxlength: 100,
				minlength: 2
			},
			columnid: {
				required: true
			},
			streetid: {
				required: true
			},
			endtime: {
				required: true
			},
			addtime: {
				required: true
			},
			contact: {
				required: true,
				maxlength: 30,
				minlength: 2},
			writer: {
				required: true,
				maxlength: 10,
				minlength: 2},
			copyright: {
				required: true,
				maxlength: 30,
				minlength: 2},
			tel: {
				required: true,
				maxlength: 50,
				minlength: 2},	
			qq: {
				digits: true,
				maxlength: 20,
				minlength: 1
			},
			model1 : {
				digits: true,
				maxlength : 1,
				minlength : 1
			},
			area : {
				digits : true,
				required : true,
				maxlength : 3,
				minlength : 1
			},
			price : {
				required : true
			},
			classname : {
				required: true
			},
			company : {
				required: true
			},
			position : {
				required: true
			},
			Content1: {
				required: true,
				minlength: 2
			}
		},
		messages: {
			title: {
				required: "请输入信息标题",
				maxlength: jQuery.format("信息标题不能多于 {0} 个字符"),
				minlength: jQuery.format("信息标题不能少于 {0} 个字符")},
			username: {
				required: "用户名不能为空",
				fstring: "用户名只能由字母或数字组成"},
			password: {
				required: "密码不能为空",
				fstring: "不允许特殊字符"},
			code: {
				required: "验证码不能为空",
				digits: "验证码只能为数字",
				maxlength: jQuery.format("只能为 {0} 位数字"),
				minlength: jQuery.format("只能为 {0} 位数字")},
			old_password: {
				required: "原密码不能为空",
				fstring: "不允许特殊字符"},
			new_password: {
				required: "新密码不能为空",
				fstring: "不允许特殊字符",
				maxlength: jQuery.format("新密码不能多于 {0} 个字符"),
				minlength: jQuery.format("新密码不能少于 {0} 个字符")},
			confirm_password:{
				required:"确认密码不能为空",
				equalTo:"两次输入的密码不一致",
				fstring: "不允许特殊字符",
				maxlength: jQuery.format("密码不能多于 {0} 个字符"),
				minlength: jQuery.format("密码不能少于 {0} 个字符")},
			address: {
				required: "请输入地址",
				maxlength: jQuery.format("地址不能多于 {0} 个字符"),
				minlength: jQuery.format("地址不能少于 {0} 个字符")},
			columnid: {
				required: "请选择信息所属分类"},
			streetid: {
				required: "请选择所属街道"},
			endtime: {
				required: "请选择信息发布期限"},
			addtime: {
				required: "请选择信息发布的时间"},
			contact: {
				required: "请输入联系人姓名或公司名称",
				maxlength: jQuery.format("联系人不能多于 {0} 个字符"),
				minlength: jQuery.format("联系人不能少于 {0} 个字符")},
			writer: {
				required: "请输入作者名称",
				maxlength: jQuery.format("作者名称不能多于 {0} 个字符"),
				minlength: jQuery.format("作者名称不能少于 {0} 个字符")},
			copyright: {
				required: "请输入信息来源",
				maxlength: jQuery.format("信息来源不能多于 {0} 个字符"),
				minlength: jQuery.format("信息来源不能少于 {0} 个字符")},
			tel: {
				required: "请输入联系电话",
				maxlength: jQuery.format("联系电话不能多于 {0} 个字符"),
				minlength: jQuery.format("联系电话不能少于 {0} 个字符")},
			qq: {
				digits:"QQ号码只能为数字",
				maxlength: jQuery.format("QQ号码不能多于 {0} 个字符"),
				minlength: jQuery.format("QQ号码不能少于 {0} 个字符")},
			model1 : {
				digits:"只能为数字",
				maxlength : jQuery.format("房间数输入不能多于{0}个字符"),
				minlength : jQuery.format("房间数输入不能少于{0}个字符")
			},
			area : {
				digits : "面积只能为数字输入",
				required : "请输入面积",
				maxlength : jQuery.format("房间数输入不能多于{0}个字符"),
				minlength : jQuery.format("房间数输入不能少于{0}个字符")
			},
			classname : {
				required : "请选择一个分类"
			},
			price : {
				required : "请输入价格"
			},
			company : {
				required : "请输入招聘单位"
			},
			position : {
				required : "请输入招聘职位"
			},
			Content1: {
				required: "请输入信息内容",
				minlength: jQuery.format("内容不能少于 {0} 个字符")}

		},
		errorPlacement: function(error, element) {
				error.appendTo( element.parent() );
		},
		success: function(label) {
			label.html("&nbsp;").addClass("checked");
		}
	});

});
function getcode(url)
{
document.getElementById("safecodeimg").src=url+"?"+Math.random();}
