function news_add()
{
	if (creator.news_title.value==""){
		alert("标题不能为空！");
		creator.news_title.focus();
		return false
	}
	if (creator.classa.value==""){
		alert("请选择栏目！");
		creator.classa.focus();
		return false
	}
	if (isNaN(creator.news_order.value)||creator.news_order.value==""){
		alert("排序不能为空且为数字！");
		creator.news_order.focus();
		return false
	}
	if (isNaN(creator.news_number.value)||creator.news_number.value==""){
		alert("期数不能为空且为数字！");
		creator.news_number.focus();
		return false
	}
	return true
}


function confirm_chk(str,loc_href)
{
	if(confirm(str)) {
	void(location.href=loc_href);
	}
}


function alert_chk(str,loc_href)
{
	if(alert(str)) {
	void(location.href=loc_href);
	}
}

function check_id_window(value){
	window.open("ChkUserLoginName.asp?user="+value,"",'toolbar=no,directories=no,scrollbars=0,resizable=1,status=no,menubar=0,width=250,height=100');
}



var whichOpen="";
var whichContinue='';
function menuShow(strobj,maxheight,strobj2)
{
   //展开下拉菜单
  if(strobj.style.pixelHeight<maxheight)
  {
    strobj.style.pixelHeight+=maxheight/10;
	strobj.filters.alpha.opacity+=20;
	strobj2.background="../images/pics/title_bg_hide.gif";
    if(strobj.style.pixelHeight==maxheight/10)
	  strobj.style.display='block';
	mystrobj=strobj;
	mymaxheight=maxheight;
	mystrobj2=strobj2;
	setTimeout('menuShow(mystrobj,mymaxheight,mystrobj2)','5');
  }
}
function menuHide(strobj,maxheight,strobj2)
{
  //收起下拉菜单
  if(strobj.style.pixelHeight>0)
  {
    if(strobj.style.pixelHeight==maxheight/5)
	  strobj.style.display='none';
    strobj.style.pixelHeight-=maxheight/5;
	strobj.filters.alpha.opacity-=10;
	strobj2.background="../images/pics/title_bg_show.gif";
	mystrobj=strobj;
	mymaxheight=maxheight
	mystrobj2=strobj2;
	setTimeout('menuHide(mystrobj,mymaxheight,mystrobj2)','5');
  }
  else
    if(whichContinue)
	  whichContinue.click();
}
function menuChange(strobj,maxheight,strobj2)
{//指定下拉菜单
  if(strobj.style.pixelHeight)
  {
    menuHide(strobj,maxheight,strobj2);
	whichOpen='';
	whichcontinue='';
  }
  else
    if(whichOpen)
	{
	  whichContinue=strobj2;
      whichOpen.click();
	}
	else
	{
	  menuShow(strobj,maxheight,strobj2);
	  whichOpen=strobj2;
	  whichContinue='';
	}
}

function checkemail(inputstr){
	if(inputstr.indexOf('@') != -1 && inputstr.indexOf('.')!= -1)
		return true;
	else 
   		return false;	
}

function checkrealname(realname){
	var str=realname;
	 //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
	var Expression=/[^\u4E00-\u9FA5]/; 
	var objExp=new RegExp(Expression);
	if(objExp.test(str)==true){
		return true;
	}else{
		return false;
	}
}	

function UserUnitCHK()
{
	if (UserUnit.unit_name.value=="")
	{
		alert(" 用户名不能为空！");
		UserUnit.unit_name.focus();
		return false
	}
	if (checkrealname(UserUnit.unit_name.value))
	{
		alert("部门名称只能为汉字！");
		UserUnit.unit_name.focus();
		return false
	}
	
	if (UserUnit.unit_order.value==""|| isNaN(UserUnit.unit_order.value))
	{
		alert("部门排序不能为空\n\n且只能是数字！");
		UserUnit.unit_order.focus();
		return false
	}
return true
}


function UserRegLogin()
{
	if (creator.user_login_name.value=="")
	{
		alert(" 用户名不能为空！");
		creator.user_login_name.focus();
		return false
	}
	if (creator.user_login_pwd.value=="")
	{
		alert("密码不能为空！");
		creator.user_login_pwd.focus();
		return false
	}
	if (creator.pwd_again.value=="")
	{
		alert("验证密码不能为空！");
		creator.pwd_again.focus();
		return false
	}
	if (creator.pwd_again.value!=creator.user_login_pwd.value)
	{
		alert("密码验证不相符！");
		creator.pwd_again.focus();
		return false
	}
	
	if (creator.user_site.value=="")
	{
		alert("请选择你所在的部门！");
		creator.user_site.focus();
		return false
	}
	if (creator.RealName.value=="")
	{
		alert("真实姓名不能为空！");
		creator.RealName.focus();
		return false
	}
	if (checkrealname(creator.RealName.value))
	{
		alert("真实姓名只能为汉字！");
		creator.RealName.focus();
		return false
	}
	if (creator.age.value==""|| isNaN(creator.age.value))
	{
		alert("年龄不能为空且只能数字！");
		creator.age.focus();
		return false
	}
	if (creator.user_tel.value=="" || isNaN(creator.user_tel.value))
	{
		alert("电话号码不能为空且为数字！");
		creator.user_tel.focus();
		return false
	}
	if (creator.user_email.value == "" || !checkemail(creator.user_email.value)) {
		alert("\E-Mail 填写错误，请填写有效的信箱，如 username@163.com ！");
		creator.user_email.focus();
		return false;
	}
	if (creator.checkcard.value=="")
	{
		alert("请验证码不能为空！");
		creator.checkcard.focus();
		return false
	}
return true
}

function Openwin(url,artwidth,artheight) {
	popupWin = window.open(url,'','width='+artwidth+',height='+artheight+',scrollbars=yes')
}
function placardcheck()
{
    if (placard.title.value=="") 
		alert("公告标题不能为空！");
	else if (placard.writer.value=="") 
		alert("公告发布人不能为空！");
	else if (placard.contents.value=="") 
		alert("公告内容不能为空！");
	else
		placard.submit();
}
function UserGroupCHK()
{
	if (UserGroup.unit_name.value=="")
	{
		alert("用户组名不能为空！");
		UserGroup.unit_name.focus();
		return false
	}
	if (checkrealname(UserGroup.unit_name.value))
	{
		alert("真实姓名只能为汉字！");
		UserGroup.unit_name.focus();
		return false
	}
	if (UserGroup.unit_order.value==""||isNaN(UserGroup.unit_order.value))
	{
		alert("用户组排序不能为空\n\n且只能是数字！");
		UserGroup.unit_order.focus();
		return false
	}
	return true
}
function checkpage()
{
 if (isNaN(go2to.page.value))
		alert("请正确填写转到页数！");
   	else if (go2to.page.value=="") 
	    {
		alert("请输入转到页数！");
		}
   	else
		go2to.submit();
}