function ltrim(s){return s.replace( /^\s*/, "");}function rtrim(s){return s.replace( /\s*$/, "");}function trim(s){return rtrim(ltrim(s));}function isNumberString (InString,RefString){if(InString.length==0) return (false);for (Count=0; Count < InString.length; Count++){TempChar= InString.substring (Count, Count+1);if (RefString.indexOf (TempChar, 0)==-1)return (false);}return (true);}function NoahSystemCheckboxSelectCheck(buttongroup){re=0;if (isNaN(buttongroup.length)){if(buttongroup.checked){re=10;} }else{for(var i=0;i<buttongroup.length;i++){ if(buttongroup[i].checked){re++;}}}if(re>0){return false;}return true; }

//检测新闻评论提交
function CheckNewsReviewAddFormValues()
{
	if (trim(document.getElementById("mycontent").value)=='')
	{
		alert("请输入评论内容");
		document.getElementById("mycontent").focus();
		return false;
	}
}
//检测新闻评论提交

function CheckSendMialFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}



//检测Blog留言表单
function CheckLeaveWordBlogsFormValues(theForm)
{
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入留言内容");
		document.getElementById("mycontents").focus();
		return false;
	}	
}
//检测Blog留言表单

//检测添加日志表单
function CheckAddBlogsArticleFormValue()
{
 	if(document.getElementById("mytitle").value=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	/*
	if(document.getElementById("mycontents").value=='')
	{
		alert("请输入内容");
		document.getElementById("mycontents").focus();
		return false;
	}
	*/
}
//检测添加日志表单

//检测编辑日志表单
function CheckEditBlogsArticleFormValue()
{
 	if(document.getElementById("mytitle").value=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if(document.getElementById("mycontents").value=='')
	{
		alert("请输入内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测编辑日志表单

//检测Blog日志评论表单
function CheckAddBlogsArticleReviewFormValues(theForm)
{
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入评论内容");
		document.getElementById("mycontents").focus();
		return false;
	}
	if (document.getElementById("mycontents").value.length>1000)
	{
		alert("评论字数不能超过1000个字");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测Blog日志评论表单

//检测Blog日志草稿表单
function CheckEditBlogsDraftFormValue()
{
 	if(document.getElementById("mytitle").value=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if(document.getElementById("mycontents").value=='')
	{
		alert("请输入内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测Blog日志草稿表单

//检测上传新照片
function CheckAddBlogsAlbumFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (document.getElementById("mytitle").value.length>50)
	{
		alert("标题字数不能超过50个字");
		document.getElementById("mytitle").focus();
		return false;
	}
}
//检测上传新照片

//检测设置BLOG信息表单
function CheckSetBlogInfoFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入您的天地名称");
		document.getElementById("mytitle").focus();
		return false;
	}
	
}
//

//检测添加产品类型表单
function CheckWorkstationProductTypeAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入名称");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (document.getElementById("mytitle").value.length>50)
	{
		alert("名称字数不能超过50字");
		document.getElementById("mytitle").focus();
		return false;
	}
}
//检测添加产品类型表单

//检测添加产品销售记录表单
function CheckWorkstationProductSellAddFormValues(theForm)
{
	if (trim(document.getElementById("mycustomename").value)=='')
	{
		alert("请输入客户姓名");
		document.getElementById("mycustomename").focus();
		return false;
	}
	if (trim(document.getElementById("mycustomelinkphone").value)=='')
	{
		alert("请输入客户联系电话");
		document.getElementById("mycustomelinkphone").focus();
		return false;
	}
	if(isNumberString(document.getElementById("mycustomelinkphone").value,"1234567890")!=1)
	{
	   alert('请输入有效的电话号码')
	  document.getElementById("mycustomelinkphone").focus();
	   return false;
	}
	if (trim(document.getElementById("myseller").value)=='')
	{
		alert("请输入销售人");
		document.getElementById("myseller").focus();
		return false;
	}
	if (trim(document.getElementById("myproductname").value)=='')
	{
		alert("请输入商品名称");
		document.getElementById("myproductname").focus();
		return false;
	}
	if (trim(document.getElementById("myproductprice").value)=='')
	{
		alert("请输入商品单价");
		document.getElementById("myproductprice").focus();
		return false;
	}
	if (isNaN(document.getElementById("myproductprice").value)||document.getElementById("myproductprice").value<=0)
	{
		alert("请输入一个有效的数字作为商品单价");
		document.getElementById("myproductprice").focus();
		return false;
	}
	if (trim(document.getElementById("myproductamount").value)=='')
	{
		alert("请输入商品数量");
		document.getElementById("myproductamount").focus();
		return false;
	}
	if (isNaN(document.getElementById("myproductamount").value)||document.getElementById("myproductamount").value<=0)
	{
		alert("请输入一个有效的正整数作为商品数量");
		document.getElementById("myproductamount").focus();
		return false;
	}
	if (trim(document.getElementById("myselldatetime").value)=='')
	{
		alert("请输入销售时间");
		document.getElementById("myselldatetime").focus();
		return false;
	}
}
//检测添加产品销售记录表单

//检测转移客户表单
function CheckWorkstationCustomerListValues(theForm)
{
	theform=document.getElementById(theForm);
	
	if (NoahSystemCheckboxSelectCheck(theform.myp))
	{ 
		alert("请选择您要转移的客户");
		return false;
	}
}
//检测转移客户表单

//检测添加客户联系表单
function CheckWorkstationCustomerContactAddFormValues(theForm)
{
	var	today =	new	Date();
	var	dateNow	 = today.getDate();
	var	monthNow = today.getMonth()+ 1;
	var	yearNow	 = today.getYear();
	var hour = today.getHours();
	var minute = today.getMinutes();
	if (monthNow<10)
	{
		var monthNow = '0'+monthNow
	}
	if (dateNow<10)
	{
		var dateNow = '0'+dateNow
	}
	var  nowdate = yearNow+'-'+monthNow+'-'+dateNow;
	if (trim(document.getElementById("mycustomername").value)=='')
	{
		alert("请输入客户姓名");
		document.getElementById("mycustomername").focus();
		return false;
	}
	if (trim(document.getElementById("mycustomerlinkway").value)=='')
	{
		alert("请输入客户联系方式");
		document.getElementById("mycustomerlinkway").focus();
		return false;
	}
	if (trim(document.getElementById("mycontactman").value)=='')
	{
		alert("请输入访问者");
		document.getElementById("mycontactman").focus();
		return false;
	}
	if (trim(document.getElementById("mycontactdate").value)=='')
	{
		alert("请输入访问日期");
		document.getElementById("mycontactdate").focus();
		return false;
	}
	if (nowdate<document.getElementById("mycontactdate").value)
	{
		alert("访问日期不能超过当前日期");
		document.getElementById("mycontactdate").focus();
		return false;
	}
	if (trim(document.getElementById("mystarthour").value)=='')
	{
		alert("请选择访问开始时间");
		document.getElementById("mystarthour").focus();
		return false;
	}
	if (nowdate==document.getElementById("mycontactdate").value)
	{
		if (hour<trim(document.getElementById("mystarthour").value))
		{
			alert("开始时间不能超过当前时间");
			document.getElementById("mystarthour").focus();
			return false;
		}
	}
	if (trim(document.getElementById("mystartminute").value)=='')
	{
		alert("请选择访问开始时间");
		document.getElementById("mystartminute").focus();
		return false;
	}
	if (nowdate==document.getElementById("mycontactdate").value)
	{
		if (minute<trim(document.getElementById("mystartminute").value))
		{
			alert("开始时间不能超过当前时间");
			document.getElementById("mystartminute").focus();
			return false;
		}
	}
	if (trim(document.getElementById("myendhour").value)=='')
	{
		alert("请选择访问结束时间");
		document.getElementById("myendhour").focus();
		return false;
	}
	if (nowdate==document.getElementById("mycontactdate").value)
	{
		if (hour<trim(document.getElementById("myendhour").value))
		{
			alert("结束时间不能超过当前时间");
			document.getElementById("myendhour").focus();
			return false;
		}
	}
	if (trim(document.getElementById("myendminute").value)=='')
	{
		alert("请选择访问结束时间");
		document.getElementById("myendminute").focus();
		return false;
	}
	if (nowdate==document.getElementById("mycontactdate").value)
	{
		if (minute<trim(document.getElementById("myendminute").value))
		{
			alert("开始时间不能超过当前时间");
			document.getElementById("myendminute").focus();
			return false;
		}
	}
	if (trim(document.getElementById("mystarthour").value)+trim(document.getElementById("mystartminute").value)>trim(document.getElementById("myendhour").value)+trim(document.getElementById("myendminute").value))
	{
		alert("访问结束时间不能在访问开始时间之前");
		document.getElementById("myendhour").focus();
		return false;
	}
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入访问主题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (document.getElementById("mytitle").value.length>50)
	{
		alert("访问主题字数不能超过50字");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入访问内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测添加客户联系表单

//检测添加新闻表单
function CheckWorkstationNewsAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入新闻标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (document.getElementById("mytitle").value.length>150)
	{
		alert("新闻标题字数不能超过150字");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mynewsdate").value)=='')
	{
		alert("请输入新闻日期");
		document.getElementById("mynewsdate").focus();
		return false;
	}
	if (trim(document.getElementById("mydockets").value)=='')
	{
		alert("请输入新闻摘要");
		document.getElementById("mydockets").focus();
		return false;
	}
	if (document.getElementById("mydockets").value.length>500)
	{
		alert("新闻摘要不能超过500个字");
		document.getElementById("mydockets").focus();
		return false;
	}
	/*
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入新闻内容");
		document.getElementById("mycontents").focus();
		return false;
	}
	*/
}
//检测添加新闻表单

//检测工作站信息表单
function CheckWorkstationInfoSetFormValues(theForm)
{
	if (trim(document.getElementById("myaddress").value)=='')
	{
		alert("请输入地址");
		document.getElementById("myaddress").focus();
		return false;
	}
	if (trim(document.getElementById("mylinkman").value)=='')
	{
		alert("请输入联系人");
		document.getElementById("mylinkman").focus();
		return false;
	}
	if (trim(document.getElementById("myphone").value)=='')
	{
		alert("请输入电话");
		document.getElementById("myphone").focus();
		return false;
	}
	
}
//检测工作站信息表单

//检测用户留言表单
function CheckLeaveWordToWebFormValues(theForm)
{
	if (trim(document.getElementById("myname").value)=='')
	{
		alert("请输入姓名");
		document.getElementById("myname").focus();
		return false;
	}
	if (trim(document.getElementById("myemail").value)=='')
	{
		alert("请输入邮箱");
		document.getElementById("myemail").focus();
		return false;
	}
	if(!NoahWebJsExpTest(document.getElementById("myemail").value,/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/))
	{
		alert("请输入一个有效的邮箱地址");
		document.getElementById("myemail").focus(); 
		return false; 
	}
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入留言");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测用户留言表单

//删除日志提示
function DelBlogsArticle(pointid,pointtitle)
{
	var truthBeTold = window.confirm("单击“确定”删除日志“"+ pointtitle+"”。单击“取消”停止。");
	if (truthBeTold) 
	{
		window.location='/delblogsarticleex&pointid='+pointid;
	}
}
//删除日志提示

//删除草稿提示
function DelBlogsDraft(pointid,pointtitle)
{
	var truthBeTold = window.confirm("单击“确定”删除草稿“"+ pointtitle+"”。单击“取消”停止。");
	if (truthBeTold) 
	{
		window.location='/delblogsdraftex&pointid='+pointid;
	}
}
//删除草稿提示

//删除相册图片提示
function DelAlbum(pointid,pointtitle)
{
	var truthBeTold = window.confirm("单击“确定”删除图片“"+ pointtitle+"”。单击“取消”停止。");
	if (truthBeTold) 
	{
		window.location='/delblogsalbumex&pointid='+pointid;
	}
}
//删除相册图片提示

//检测工作站公告表单
function CheckWorkstationAnnouncementAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入公告内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}
//检测工作站公告表单

function ShowTeacherHiddenTr(va)
{
	if(va==1)
	{
		document.getElementById("Parents").style.display="";
		document.getElementById("Child").style.display="none";
	}
	if(va==2)
	{
		document.getElementById("Parents").style.display="none";
		document.getElementById("Child").style.display="";
	}
	if (va==3)
	{
		document.getElementById("HonourRoll").style.display="";
		document.getElementById("Fail").style.display="none";
	}
	if (va==4)
	{
		document.getElementById("HonourRoll").style.display="none";
		document.getElementById("Fail").style.display="";
	}
	
}

//检测添加教育项目表单
function CheckWorkstationEducationProjectAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入教育项目标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mydockets").value)=='')
	{
		alert("请输入教育项目介绍");
		document.getElementById("mydockets").focus();
		return false;
	}
	/*
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入教育项目内容");
		document.getElementById("mycontents").focus();
		return false;
	}
	*/
}

//检测添加教育产品表单
function CheckWorkstationEducationProductAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入教育产品标题");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mydockets").value)=='')
	{
		alert("请输入教育产品描述");
		document.getElementById("mydockets").focus();
		return false;
	}
	/*
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入教育产品内容");
		document.getElementById("mycontents").focus();
		return false;
	}
	*/
}

//检测添加本站之星表单
function CheckWorkstationStarAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入本站之星名称");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mydockets").value)=='')
	{
		alert("请输入本站之星描述");
		document.getElementById("mydockets").focus();
		return false;
	}
	/*
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入本站之星详细信息");
		document.getElementById("mycontents").focus();
		return false;
	}
	*/
}

//检测添加专家咨询表单
function CheckWorkstationExpertconsultaboutAddFormValues(theForm)
{
	if (trim(document.getElementById("mytitle").value)=='')
	{
		alert("请输入专家名称");
		document.getElementById("mytitle").focus();
		return false;
	}
	if (trim(document.getElementById("mynewstypeid").value)=='')
	{
		alert("请选择专家类型");
		document.getElementById("mynewstypeid").focus();
		return false;
	}
	/*
	if (trim(document.getElementById("mydockets").value)=='')
	{
		alert("请输入专家介绍");
		document.getElementById("mydockets").focus();
		return false;
	}
	*/
}

//检测服务指南表单
function CheckWorkstationServeaGuideEditFormValues(theForm)
{
	if (trim(document.getElementById("myserveaguide").value)=='')
	{
		alert("请输入服务指南信息");
		document.getElementById("myserveaguide").focus();
		return false;
	}
}
//检测关于我们表单
function CheckWorkstationAboutUsEditFormValues(theForm)
{
	if (trim(document.getElementById("myaboutus").value)=='')
	{
		alert("请输入关于我们信息");
		document.getElementById("myaboutus").focus();
		return false;
	}
}

//弹出回复留言表单
function ReLeaveWordsTable(pointid)
{
	window.open('/windowopen/action=ReLeaveWordsTable&pointid='+pointid,'ReLeaveWordsTable','width=600,height=450');
}

//弹出回复留言表单
function ReLeaveWordsTableByEducation(pointid)
{
	window.open('/windowopen/action=ReLeaveWordsTableByEducation&pointid='+pointid,'ReLeaveWordsTable','width=600,height=450');
}
//检测关于我们表单
function CheckReWorkstationLeaveWordsFormValues(theForm)
{
	if (trim(document.getElementById("mycontents").value)=='')
	{
		alert("请输入回复内容");
		document.getElementById("mycontents").focus();
		return false;
	}
}

//检测本校特色表单
function CheckEducationCharacteristicUpdateFormValues(theForm)
{
	/*
	if (trim(document.getElementById("mycharacteristic").value)=='')
	{
		alert("请输入特色信息");
		document.getElementById("mycharacteristic").focus();
		return false;
	}
	*/
}

//检测本校信息表单
function CheckEducationInfoUpdateFormValues(theForm)
{
	if (trim(document.getElementById("myaddress").value)=='')
	{
		alert("请输入本校地址");
		document.getElementById("myaddress").focus();
		return false;
	}
	if (trim(document.getElementById("mylinkman").value)=='')
	{
		alert("请输入联系人");
		document.getElementById("mylinkman").foucs();
		return false;
	}
	if (trim(document.getElementById("myphone").value)=='')
	{
		alert("请输入联系电话");
		document.getElementById("myphone").foucs();
		return false;
	}
	/*
	if (trim(document.getElementById("mydocket").value)=='')
	{
		alert("请输入本校简介");
		document.getElementById("mydocket").foucs();
		return false;
	}
	*/
}


//检测教育机构添加学生
function CheckEducationStudentAddFormValues(theForm)
{
	if (trim(document.getElementById("myusername").value)=='')
	{
		alert("请输入姓名");
		document.getElementById("myusername").focus();
		return false;
	}
	if (trim(document.getElementById("studentclass").value)=='')
	{
		alert("请选择年级");
		document.getElementById("studentclass").focus();
		return false;
	}
}

//检测添加班主任表单
function CheckEducationClassAdviserAddFormValues(theForm)
{
	if (trim(document.getElementById("myusername").value)=='')
	{
		alert("请输入班主任姓名");
		document.getElementById("myusername").focus();
		return false;
	}
	if (trim(document.getElementById("myage").value)=='')
	{
		alert("请输入年龄");
		document.getElementById("myage").focus();
		return false;
	}
	if (trim(document.getElementById("studentclass").value)=='')
	{
		alert("请选择年级");
		document.getElementById("studentclass").focus();
		return false;
	}
	if (trim(document.getElementById("mylinkphone").value)=='')
	{
		alert("请输入联系电话");
		document.getElementById("mylinkphone").focus();
		return false;
	}
}

//检测学生匹配
function CheckEducationStudentListValues(theForm)
{
	theform=document.getElementById(theForm);
	
	if (NoahSystemCheckboxSelectCheck(theform.myp))
	{ 
		alert("请选择您要匹配的学生");
		return false;
	}
}
//检测学生匹配

function CheckWorkStationSetPersonalPassWordFormValues(tehForm)
{
	if (trim(document.getElementById("myoldpass").value)=='')
	{
		alert("请输入原始密码");
		document.getElementById("myoldpass").focus();
		return false;
	}
	if (trim(document.getElementById("mynewpass").value)=='')
	{
		alert("请输入新密码");
		document.getElementById("mynewpass").focus();
		return false;
	}
	if (trim(document.getElementById("mynewpass1").value)=='')
	{
		alert("请确认密码");
		document.getElementById("mynewpass1").focus();
		return false;
	}
	if (document.getElementById("mynewpass1").value!=document.getElementById("mynewpass").value)
	{
		alert("两次密码输入不一致");
		document.getElementById("mynewpass1").focus();
		return false;
	}
}

function CheckEducationSetPersonalPassWordFormValues(tehForm)
{
	if (trim(document.getElementById("myoldpass").value)=='')
	{
		alert("请输入原始密码");
		document.getElementById("myoldpass").focus();
		return false;
	}
	if (trim(document.getElementById("mynewpass").value)=='')
	{
		alert("请输入新密码");
		document.getElementById("mynewpass").focus();
		return false;
	}
	if (trim(document.getElementById("mynewpass1").value)=='')
	{
		alert("请确认密码");
		document.getElementById("mynewpass1").focus();
		return false;
	}
	if (document.getElementById("mynewpass1").value!=document.getElementById("mynewpass").value)
	{
		alert("两次密码输入不一致");
		document.getElementById("mynewpass1").focus();
		return false;
	}
}