//提交动作
function BBSThreadMessageMaint220_frmSubmit(frm,action,data)
{        
    var date = new Date();
    //如果删除记录,则提示.
    if (trim(action)=="DeleteMessage"){		
        var message = "确认要删除这个帖子吗?" ;
        if (confirm(message)){	
      	           frm.action="BBSThreadMessageMaint.html?BBSThreadMessageMaint220_action="+action+"&BBSThreadMessageMaint220_Data="+data+"&time=" + date.getTime();
                   frm.submit();
	     }else{
		  	return ;
	     }
     } else{		   //如果是发新帖子,则判断  
          if (trim(action)=="PublishMessage" ){ 
             var myElement =  frm.BBSThreadMessageMaint220_Subject ;
             
		     if (myElement.value.length > 50 ) {
			 	alert("标题的长度超过了50个字符！");
			 	myElement.focus();
			 	return;
	         }
            
	         if (trim(myElement.value) == "" ){
			 	alert("标题不能为空 ！");
			 	myElement.focus();
				 return;
	         }
		      //if(htmlEditor.viewhtml.checked){
				//alert("请取消“查看HTML源代码”选项再发表！");
				//return;
			  //}
			var filePath = trim(frm.BBSThreadMessageMaint220_file.value);
			var fileName = filePath.substring(filePath.lastIndexOf("\\") + 1);
	
			if(fileName.length > 64){
				alert("上传附件名最多为64个字符");
				frm.BBSThreadMessageMaint220_file.focus();
				return false;
			} 
	         //给隐藏的变量BBSThreadMessageMaint220_ThreadBody赋值.使用嵌入的编辑器
	         //frm.BBSThreadMessageMaint220_ThreadBody.value = htmlEditor.Composition.document.body.innerHTML;
	         var conenttemp =eWebEditor1.oCKeditor.getData();
	         conenttemp = conenttemp.replace(/<span/g,"<font").replace(/span>/g,"font>"); 
	         frm.BBSThreadMessageMaint220_ThreadBody.value = conenttemp;
	 	}
         
	      //如果是移动帖子.如果没有选择论坛,则提示.并退出
	      if (trim(action)=="MoveThread"){
	          if  (frm.BBSThreadMessageMaint220_MovetoForum.value =="-1")          
	          {
	          	alert("请选择有效的论坛!");
	          	return ;
	          }   	
	      }
	      frm.action="BBSThreadMessageMaint.html?BBSThreadMessageMaint220_action="+action+"&BBSThreadMessageMaint220_Data="+data+"&time=" + date.getTime();
	      frm.submit();
           
	         //如果是移动论坛,则转到主题列表页面     
	      if (trim(action)=="MoveThread"){       
	          	opener.location = "BBSThreadListMaint.html?forumID="+data+"&date=" + date.getTime();
		      	//Window.close();
				window.close();
		   }
  
    	}
}


//在新窗口中打开移动主题的视图
function OpenMoveThreadView(frm,forumID,threadID){
	 var date = new Date();	
         window.open("BBSMoveThreadInMessage.html?BBSThreadMessageMaint220_action=OperateThread+&BBSThreadMessageMaint220_Data=moveThread&forumID="+forumID+"&threadID="+threadID+"&time=" + date.getTime(),"","width=420,height=150,top=90,left=380,top=200");
	
	
}
//设置选择的心情图标
function   setSelectRadio(frm,icoName)
{
  for (n=0 ;n < frm.length ;n++){ 	
  	
  	
	    	//获得当前项
	   	childElement = frm.elements[n];
	   	
	   		//如果是radio对象
	   		
	   		
	   if (childElement.type == "radio"){	
	   	
	   	if (childElement.value == icoName)
		{
	   	  childElement.checked = true;
		}
	   }     
  }

}

//清除数据
function ClearFrm(frm){
     frm.reset();
    //内容
    //htmlEditor.Composition.document.body.innerHTML ="";
    eWebEditor1.oCKeditor.setData("");
	
	}
function WriteHtmlEditor()
{
	//document.write("<iframe src='../../../EbizResourceSet/htmleditor/bbshtml/editor2_2.html' id='htmlEditor' width='670' height='460'></iframe>")
	document.write ("<IFRAME ID='eWebEditor1' src='../../../EbizResourceSet/ckeditor/bbs_HTMLEditor.jsp?id=BBSThreadListMaint_MainForm.BBSThreadMessageMaint220_ThreadBody&style=full' frameborder='0' scrolling='no' width='670' height='460'></IFRAME>");
}

 /*
 *帖子预览
 *@param frm 表单对象
 */
function PreviewMessage(frm){ 
   //frm.BBSThreadMessageMaint220_ThreadBody.value = htmlEditor.Composition.document.body.innerHTML;
   frm.BBSThreadMessageMaint220_ThreadBody.value = eWebEditor1.oCKeditor.getData();
   
   var newWindow = window.open("","预览帖子","width=700,Height=200,top=100,left=200,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no"); 
   newWindow.document.clear();  
   newWindow.document.writeln("<html>");
   newWindow.document.writeln("<head>");
   newWindow.document.writeln("<title>预览</title>");
   newWindow.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
   newWindow.document.writeln("<link TYPE='text/css' REL='STYLESHEET' HREF='../../../EbizResourceSet/css/common/FG/common.css'>");
   newWindow.document.writeln("<body style='background-color:#ffffff'>");
   newWindow.document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='1' class='bbs_bg3'>");
   newWindow.document.writeln("  <tr class='bbs_bg1'>");
   newWindow.document.writeln("<td height='25' align='center' ><span class='bs_title'>帖子预览</span></td>");
   newWindow.document.writeln("  </tr>");
   newWindow.document.writeln("  <tr>");
   newWindow.document.writeln("    <td valign='top'><table width='100%'  border='0' cellspacing='0' cellpadding='2' class='bbs_bg2'>");
   newWindow.document.writeln("      <tr>");
   newWindow.document.writeln("        <td> ");
   newWindow.document.writeln("标题: "+frm.BBSThreadMessageMaint220_Subject.value);
   newWindow.document.writeln("      </td>");
   newWindow.document.writeln("      </tr>");
   newWindow.document.writeln("      <tr>");
   newWindow.document.writeln("        <td> <br/>");
   newWindow.document.writeln("内容:  "+frm.BBSThreadMessageMaint220_ThreadBody.value);
   newWindow.document.writeln("  </td>");
   newWindow.document.writeln("      </tr>");
   
   newWindow.document.writeln("    </table></td>");
   newWindow.document.writeln("  </tr>");
                                               
   
   newWindow.document.writeln("</table>");
   newWindow.document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='1' class='bbs_bg3' >");
   newWindow.document.writeln("      <tr>");
   newWindow.document.writeln("        <td>&nbsp;</td>");
   newWindow.document.writeln("      </tr>");
   
   newWindow.document.writeln("      <tr>");
   newWindow.document.writeln("        <td align ='center'><input class='BBSThreadMessageMaint220_button' type='button' name ='' value= '关闭窗口' onclick = 'window.close();'> </td>");
   newWindow.document.writeln("      </tr>");
   newWindow.document.writeln("</table>");
   
   
   newWindow.document.writeln("</body></head>");
   newWindow.document.writeln("</html>");
   newWindow.document.close();
   
   }

   
   
   
   
   
   
   
   
   
