function kflErr(name,value)
{
	$("#"+name).attr("class","pexErr");
	$("#"+name).html(value);
}
function kflRig(name)
{
	$("#"+name).attr("class","pexRig");
	$("#"+name).html("");
}
function valiPost(name)
{
	try {
		var post_con='{"kTitle":"'+$("#title").val()+'","kAddress":"'+$("#address").val()+'","kAddress1":"'+$("#address1").val()+'","kName":"'+$("#name").val()+'","kPrice":"'+$("#price").val()+'","kPic":"'+$("#pic").val()+'","kContent":"'+$("#content").val()+'","kTel":"'+$("#tel").val()+'","kWeixin":"'+$("#weixin").val()+'","kQq":"'+$("#qq").val()+'","kOverDate":"'+$("#overdate").val()+'","kAdminPassWord":"'+$("#adminpassword").val()+'"}';
	setCookie("post_con",post_con);
	}
	catch(e){}
var bRef=true;
var errorTag="";
if(name=="exVali" || name=="all")
{
	if(_q("vali")!=null)
	{
		if(_q("vali").value=="")
		{
			kflErr("exVali","请输入正确答案！");
			bRef=false;
			errorTag="vali";
		}
		else
		{
			$.get("/action/?s=valiSession&n=15&v="+escape($("#vali").val())+"&t="+Math.random(),function(data,status)
	 		{
	 			if(data=="True")
				{
					kflRig("exVali");
					bRef=true;
				}
				else
				{
					bRef=false;
					kflErr("exVali","回答不正确！");
    			}
			});
		}
	}
}

if(name=="exValiDate" || name=="all")
{
	if(_q("validate")!=null)
	{
		if(_q("validate").value=="")
		{
			kflErr("exValiDate","<span class=\"freshVali\" onclick=\"document.getElementById('valiPic').src='/validate/?cache='+Math.random()\">请输入验证码！看不清？换一张</span>");
			bRef=false;
			errorTag="validate";
		}
		else
		{
			$.get("/action/?s=valiSession&n=9&v="+escape($("#validate").val())+"&t="+Math.random(),function(data,status)
	 		{
	 			if(data=="True")
				{
					kflRig("exValiDate");
					bRef=true;
				}
				else
				{
					bRef=false;
					kflErr("exValiDate","<span class=\"freshVali\" onclick=\"document.getElementById('valiPic').src='/validate/?cache='+Math.random()\">验证码不正确！看不清？换一张</span>");

    			}
			});
		}
	}
}
if(name=="exAdminPassWord" || name=="all")
{
	if(_q("adminpassword")!=null)
	{
		if(_q("adminpassword").value=="" || _q("adminpassword").value.length>16)
		{
			kflErr("exAdminPassWord","请输入1-16位管理密码！");
			bRef=false;
			errorTag="adminpassword";
		}
		else
		{
			kflRig("exAdminPassWord");
		}
	}
}
if(name=="exOverDate" || name=="all")
{
	if(_q("overdate").value=="" || !/^\d+$/.test(_q("overdate").value))
	{
		kflErr("exOverDate","请输入数字！");
		bRef=false;
		errorTag="overdate";
	}
	else
	{
		kflRig("exOverDate");
	}
}
if(name=="exName" || name=="all")
{
	if(_q("name").value.length>10)
	{
		kflErr("exName","10个字以内！如：张先生");
		bRef=false;
		errorTag="name";

	}
	else
	{
		kflRig("exName");
	}
}
if(name=="exQq" || name=="all")
{
	if($("#qq").val()!=""&&!/^\d{3,13}$/.test($("#qq").val()))
	{
		kflErr("exQq","请输入正确QQ");
		bRef=false;
		errorTag="qq";
	}
	else
	{
		kflRig("exQq");
	}
}

if(name=="exWeixin" || name=="all")
{
	if($("#weixin").val()!=""&&$("#weixin").val().length>25)
	{
		kflErr("exWeixin","请输入正确微信");
		bRef=false;
		errorTag="weixin";
	}
	else
	{
		kflRig("exWeixin");
	}
}
if(name=="exTel" || name=="all")
{
	if($("#tel").val()==""||$("#tel").val().length>20)
	{
		kflErr("exTel","请输入正确电话号码");
		bRef=false;
		errorTag="tel";
	}
	else
	{
		kflRig("exTel");
	}
}
if(name=="exPrice" || name=="all")
{
	if(_q("price").value!=""&&!/^\d+[.]?\d*$/.test(_q("price").value))
	{
		kflErr("exPrice","请输入数字！");
		bRef=false;
		errorTag="price";
	}
	else
	{
		kflRig("exPrice");
	}
}
if(name=="exAddress" || name=="all")
{
	if(_q("address").value=="")
	{
		kflErr("exAddress","请选择所在地！");
		bRef=false;
		errorTag="address";
	}
	else
	{
		kflRig("exAddress");
	}
}
if(name=="exContent" || name=="all")
{
	if(_q("content").value==""||_q("content").value.length>1000)
	{
		kflErr("exContent","请输入内容，1000字以内！");
		bRef=false;
		errorTag="content";
	}
	else
	{
		kflRig("exContent");
	}
}
if(name=="exTitle" || name=="all")
{
	if(_q("title").value==""|| _q("title").value.length>50)
	{
		kflErr("exTitle","标题50字以内！");
		errorTag="title";
		bRef=false;
	}
	else
	{
		kflRig("exTitle");
	}
}
if(!bRef&&errorTag!="")
{
	if(name=="all")
	{
		if(errorTag=="address")
		{
			$(document).scrollTop($("#exAddress").offset().top-160);
		}
		else
		{
			$(document).scrollTop($("#"+errorTag).offset().top-160);
			$("#"+errorTag).focus();
		}
	}
}
return bRef;
}
// JavaScript Document