﻿function killErrors(){return true;}
window.onerror=killErrors;

function setTab(name,cursel,n){
	for(i=1;i<=n;i++){
		var menu=$('#'+name+i);
		var con=$("#con_"+name+"_"+i);
		menu[0].className=i==cursel?"hover":"";
		con[0].style.display=i==cursel?"block":"none";
	}
}
function trim(s){return  s.replace(/(^\s*)|(\s*$)/g,  "");} 

function checkmail(theform)
{
	if (trim(theform.t0.value)=='')
	{   
		alert('请输入姓名');
		theform.t0.focus();
		return false
	}
	if (trim(theform.t0.value)=='请输入姓名')
	{   
		alert('请输入姓名');
		theform.t0.focus();
		return false
	}
	if (trim(theform.t1.value)=='')
	{
		alert('请输入邮箱');
		theform.t1.focus();
		return false
	}
	if (trim(theform.t1.value)=='请输入邮箱')
	{
		alert('请输入邮箱');
		theform.t1.focus();
		return false
	}
	if (trim(theform.t1.value).search(/^[^\s@:"'<>,&]{2,}@[^\[\.]+\.[^\[]{2,}$/gi)<0)
	{
		alert('请正确输入邮箱');
		theform.t1.focus();
		return false
	}
	if (trim(theform.t2.value)=='')
	{   
		alert('请选择分类');
		theform.t2.focus;
		return false
	}
	var url,param;
	url="/Inc/ajax.asp?act=save";
	param="t0="+escape(trim(theform.t0.value));
	param+="&t1="+escape(trim(theform.t1.value));
	param+="&t2="+escape(trim(theform.t2.value));
	$.ajax({
	type:"post",
	cache:false,
	url:url,
	data:param,
	timeout:param,
	error:function(){alert(Ajax_msg);},
	success:function(_)
	{
		alert(_.substring(1));
		if(_.substring(0,1)==1){theform.t0.value='请输入姓名';theform.t1.value='请输入邮箱';}
		}
	});
	return false
}

