function check(){

	if(!pub_checkSelected(document.all.info_type,"请选择信息类型")){
		return false
	}
        var infoTypeValue = document.all.item("info_type").value
	if(!pub_checkSelected(document.all.publish_type,"请选择发布类型")){
		return false
	}
	var publishiTypeValue = document.all.item("publish_type").value

	if(publishiTypeValue=="000000010"){
		if(pub_trim(document.all.publish_obj_id.value)=="" || pub_trim(document.all.publish_obj_id_show.value)==""){
			alert("请选择要发送的人员!")
			return false
		}

	}
	if(!pub_trimObj(document.all.info_title,true,"请填写信息主题",true)){
		return false
	}
	if(obj1.displayMode == "HTML")
        {
          alert("请取消HTML复选框的被选中状态")
          return ;
       }
       //STEP 10: Here we move the edited content & style into form fields.
       if (document.getElementById("thehtmleditor").style.display!='none'){
         publishInfoForm.content.value = obj1.getContentBody() //move edited content into form field, to be submitted.
       }
	if(!pub_checkStrLength(document.all.content.value,2000,true,"输入的信息内容太长，您最多可以输入2000个字符")){
		return false
	}
	if(pub_trim(document.all.end_time.value)==""){
	}else{
          if(!pub_checkIsDateYYYYMMDD(document.all.end_time.value,"-",true,"输入的终止日期请按照yyyy-mm-dd的格式输入")){
		document.all.end_time.focus()
		return false
          }
          document.all.end_time.value = pub_convertToDateYYYYMMDD(document.all.end_time.value,"-")
          if(pub_compareDate(document.all.end_time.value,"-",document.all.publish_time.value,"-")=="1"){
		alert("终止日期不能小于当前日期")
		document.all.end_time.focus()
		return false
          }
	}

        if(infoTypeValue=="000000007"){
          if(pub_trim(document.all.uploadFile.value)==""){
            alert("请选择要上传的图片")
            return false
          }
          var filePath = pub_trim(document.all.uploadFile.value)
          var fileSuffix = filePath.substring(filePath.lastIndexOf(".")+1,filePath.length)

          if(fileSuffix.toLowerCase()=="gif" || fileSuffix.toLowerCase()=="jpg"){
          }else{
            alert("您上传的附件不是图片文件")
            return false
          }
        }
        publishInfoForm.submit()
}

function mofifyCheck(){

	if(!pub_checkSelected(document.all.info_type,"请选择信息类型")){
		return false
	}
        var infoTypeValue = document.all.item("info_type").value
	if(!pub_checkSelected(document.all.publish_type,"请选择发布类型")){
		return false
	}
	var publishiTypeValue = document.all.item("publish_type").value

	if(publishiTypeValue=="000000010"){
		if(pub_trim(document.all.publish_obj_id.value)=="" || pub_trim(document.all.publish_obj_id_show.value)==""){
			alert("请选择要发送的人员!")
			return false
		}

	}
	if(!pub_trimObj(document.all.info_title,true,"请填写信息主题",true)){
		return false
	}
	if(obj1.displayMode == "HTML")
        {
          alert("请取消HTML复选框的被选中状态")
          return ;
       }
       //STEP 10: Here we move the edited content & style into form fields.
       if (document.getElementById("thehtmleditor").style.display!='none'){
         publishInfoForm.content.value = obj1.getContentBody() //move edited content into form field, to be submitted.
       }
	if(!pub_checkStrLength(document.all.content.value,2000,true,"输入的信息内容太长，您最多可以输入2000个字符")){
		return false
	}

	if(pub_trim(document.all.end_time.value)==""){
	}else{
          if(!pub_checkIsDateYYYYMMDD(document.all.end_time.value,"-",true,"输入的终止日期请按照yyyy-mm-dd的格式输入")){
		document.all.end_time.focus()
		return false
          }
          document.all.end_time.value = pub_convertToDateYYYYMMDD(document.all.end_time.value,"-")
          if(pub_compareDate(document.all.end_time.value,"-",document.all.publish_time.value,"-")=="1"){
		alert("终止日期不能小于当前日期")
		document.all.end_time.focus()
		return false
          }
	}
	var selectitem
	if(document.all.fileFlag){
		var radioLen = document.all.fileFlag.length

		for(var i=0;i<radioLen;i++){
			if(document.all.fileFlag[i].checked){
				selectitem = i+1;
				break;
			}
		}
		if(selectitem==3){  //重新上传附件
			if(infoTypeValue=="000000007"){
          			if(pub_trim(document.all.uploadFile.value)==""){
            				alert("请选择要上传的图片")
            				return false
          			}
          			var filePath = pub_trim(document.all.uploadFile.value)
          			var fileSuffix = filePath.substring(filePath.lastIndexOf(".")+1,filePath.length)

          			if(fileSuffix.toLowerCase()=="gif" || fileSuffix.toLowerCase()=="jpg"){
          			}else{
            				alert("您上传的附件不是图片文件")
            				return false
          			}
        		}
		}
	}else{
		if(infoTypeValue=="000000007"){
          		if(pub_trim(document.all.uploadFile.value)==""){
            			alert("请选择要上传的图片")
            			return false
          		}
          		var filePath = pub_trim(document.all.uploadFile.value)
          		var fileSuffix = filePath.substring(filePath.lastIndexOf(".")+1,filePath.length)

          		if(fileSuffix.toLowerCase()=="gif" || fileSuffix.toLowerCase()=="jpg"){
          		}else{
            			alert("您上传的附件不是图片文件")
            			return false
          		}
        	}
	}

	return true
}

function openAddPersonWindow(targetObjHidden,targetObjShow){
        childWin = window.open("/SearchPersonList.do?type=new&targetObjHidden="+targetObjHidden+"&targetObjShow="+targetObjShow, "personListWin","toolbar=no,width=600,height=400,scrollbars=yes")
        childWin.parentWin = this

}
function setButtonStatus(){
	if(document.all.item("publish_type").value=="000000010"){
		document.all.searchUser.disabled=false
	}else{
		document.all.searchUser.disabled=true
		document.all.publish_obj_id.value=""
		document.all.publish_obj_id_show.value=""
	}
}
function clearPublishObjId(){
	document.all.publish_obj_id.value=""
	document.all.publish_obj_id_show.value=""
}

