var date = new Date();
function frmEssential(page,compID,frm,currentPage)
{
	var flag = false;
	if(frm.BBSThreadListMaint_ThreadID){
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1){
			for(i=0;i<num;i++){
				if(frm.BBSThreadListMaint_ThreadID[i].checked){
					flag = true;
				}
			}
		}
		else if(frm.BBSThreadListMaint_ThreadID.checked) 
			flag = true;
	}
	else
	{
		alert("本页面没有你可设为精华（或取消精华）的主题！");	
		return;
	}
	if(flag)
	{
		frm.action=page+"?"+compID+"_action=Essential&currentPage="+currentPage+"&time=" + date.getTime();
		if (confirm("确定要对您所选择的主题进行设为精华（或取消精华）的操作吗?"))
		{
			frm.submit();
		}
	}
	else
	{
		alert("请选择您要设为精华（或取消精华）的主题！");
		//return false;
	}
}
function frmTop(page,compID,frm)
{
	var flag = false;
	if(frm.BBSThreadListMaint_ThreadID){
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1){
			for(i=0;i<num;i++){
				if(frm.BBSThreadListMaint_ThreadID[i].checked){
					flag = true;
				}
			}
		}
		else if(frm.BBSThreadListMaint_ThreadID.checked) 
			flag = true;
	}
	else
	{
		alert("本页面没有你可置顶（或取消置顶）的主题！");	
		return;
	}
	if(flag)
	{
		frm.action=page+"?"+compID+"_action=Top&time=" + date.getTime();
		if (confirm("确定要对您所选择的主题进行置顶（或取消置顶）的操作吗?"))
		{
			frm.submit();
		}
	}
	else
	{
		alert("请选择您要置顶（或取消置顶）的主题！");
		//return false;
	}
}
function frmLocked(page,compID,frm,currentPage)
{
	var flag = false;
	if(frm.BBSThreadListMaint_ThreadID){
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1){
			for(i=0;i<num;i++){
				if(frm.BBSThreadListMaint_ThreadID[i].checked){
					flag = true;
				}
			}
		}
		else if(frm.BBSThreadListMaint_ThreadID.checked) 
			flag = true;
	}
	else
	{
		alert("本页面没有你可锁定（或取消锁定）的主题！");	
		return;
	}
	if(flag)
	{
		frm.action=page+"?"+compID+"_action=Locked&currentPage="+currentPage+"&time=" + date.getTime();
		if (confirm("确定要对您所选择的主题进行锁定（或取消锁定）的操作吗?"))
		{
			frm.submit();
		}
	}
	else
	{
		alert("请选择您要锁定（或取消锁定）的主题！");
		//return false;
	}
}
function frmShowadd(page,compID,frm,forumID)
{
	frm.action=page+"?"+compID+"_action=Showadd&forumID="+forumID;
	frm.submit();
}
function frmPost(page,compID,frm,forumID)
{
	if(htmlEditor.viewhtml.checked){
		alert("请取消“查看HTML源代码”选项再发表！");
		return false;
		}
	BBSThreadListMaint_MainForm.BBSThreadListMaint_ThreadBody.value= htmlEditor.Composition.document.body.innerHTML;
	if(trim(frm.BBSThreadListMaint_ThreadSubject.value)=="")
	{
		alert("帖子标题不得为空！");
		frm.BBSThreadListMaint_ThreadSubject.focus();
		return false;
	}
	var filePath = trim(frm.BBSThreadListMaint_FilePath.value);
	var fileName = filePath.substring(filePath.lastIndexOf("\\") + 1);
	 if(fileName.length > 64){
		alert("上传附件名最多为64个字符");
		frm.BBSThreadListMaint_FilePath.focus();
		return false;
	}
	else
	{
		//frm.action = page;
		//alert(forumID);
		//frm.forumID.value=forumID;
		frm.action=page+"?"+compID+"_action=Add&forumID="+forumID+"&time=" + date.getTime();
		frm.submit();
	}
}
function openPreview(compID,forumID)
{
	window.open("BBSPreviewThread.html?"+compID+"_action=Preview&forumID="+forumID,"","width=620px,height=250px");
}
function frmDelete(page,compID,frm)
{
	var flag = false;
	if(frm.BBSThreadListMaint_ThreadID){
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1){
			for(i=0;i<num;i++){
				if(frm.BBSThreadListMaint_ThreadID[i].checked){
					flag = true;
				}
			}
		}
		else if(frm.BBSThreadListMaint_ThreadID.checked) 
			flag = true;
	}
	else
	{
		alert("本页面没有你可删除的主题！");
		return;	
	}
	if(flag)
	{
		frm.action=page+"?"+compID+"_action=Delete&time=" + date.getTime();
		if (confirm("确定要删除您所选择的主题吗?"))
		{
			frm.submit();
		}
	}
	else
	{
		alert("请选择要删除的主题！");
		//return false;
	}
} 
function frmPreview(page,compID,frm,forumID)
{
	frm.action=page+"?"+compID+"_action=Previewstore&forumID="+forumID+"&time=" + date.getTime();
	frm.submit();
	window.open("BBSMoveThread.html?"+compID+"_action=Preview&forumID="+forumID);
	
}
function openMove(page,compID,frm)
{
	var flag = false;
	var movedThreadIDs="-";
	if(frm.BBSThreadListMaint_ThreadID)
	{
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1)
		{
			for(i=0;i<num;i++)
			{
				if(BBSThreadListMaint_MainForm.BBSThreadListMaint_ThreadID[i].checked )
				{
					flag = true;
					movedThreadIDs = movedThreadIDs + BBSThreadListMaint_MainForm.BBSThreadListMaint_ThreadID[i].value +"-";
				}
			}
		}
		else if (frm.BBSThreadListMaint_ThreadID.checked)
		{
			flag = true;
			movedThreadIDs = frm.BBSThreadListMaint_ThreadID.value
		}
	}
	else
	{
		alert("本页面没有你可移动的主题！");
		return;
	
	}
	if (flag) 
	{	//return true;
		//frm.submit();
		//window.open("BBSMoveThread.html?"+compID+"_action=Showmove&ListType="+BBSThreadListMaint_MainForm.ListType.value+"&forumID="+BBSThreadListMaint_MainForm.forumID.value+"&movedThreadIDs="+movedThreadIDs);
		window.open("BBSMoveThread.html?"+compID+"_action=Showmove&ListType="+BBSThreadListMaint_MainForm.ListType.value+"&forumID="+BBSThreadListMaint_MainForm.forumID.value+"&movedThreadIDs="+movedThreadIDs+"&time="+date.getTime(),"","width=420,height=150,top=90");
	}
	else
	{
		alert("请选择你要移动的主题");
		//return false;
	}
	//window.open("BBSMoveThread.html?"+compID+"_action=Showmove&forumID="+forumID+"&str="+str,"","width=420,height=150,top=90");
	
}
function frmMove(page,compID,frm,ListType,forumID,MovedThreadIDs)
{
	
	var  selectedNo=frm.BBSThreadListMaint_NewForumID.options.selectedIndex;
	var newForumID = frm.BBSThreadListMaint_NewForumID.options[selectedNo].value;
	//alert(aavalue);
	var Father = window.opener.document.BBSThreadListMaint_MainForm;
	if(frm.BBSThreadListMaint_NewForumID.value==0)
	{
		alert("请选择您要移向的论坛！");
	}
	else
	{ 
		//Father.action
		//alert(Father.BBSThreadListMaint150_action);
		Father.BBSThreadListMaint220_action.value="Move";
		
		//alert(Father.BBSThreadListMaint150_action.value);
		//Father.newForumID.value=newForumID;
		//Father.movedThreadIDs.value=movedThreadIDs;
		Father.action="BBSThreadListMaint.html?forumID="+forumID+"&ListType="+ListType+"&BBSThreadListMaint_NewForumID="+newForumID+"&movedThreadIDs="+MovedThreadIDs+"&time=" + date.getTime();
		//alert(Father.action);
	//alert("BBSThreadListMaint.html?"+compID+"_action=Move&forumID="+forumID+"&ListType="+ListType+"&time=" + date.getTime());
		Father.submit();	
	//window.close();
	//alert(opener.location.substr(5,10));
//opener.form1.submit();

		//opener.location = "BBSThreadListMaint.html?forumID="+forumID+"&ListType="+ListType+"&time="+ date.getTime();
		//opener.location = opener.location+"&time="+ date.getTime();
		//alert("success!");
		window.close();
	}
}
function expandTree(page,selectedMessageID,frm,currentPage)
{
	frm.action=page+"?selectedMessageID=" + selectedMessageID + "&currentPage="+currentPage+"&time=" + date.getTime();
	frm.submit();
}
function frmPage(page,compID,frm,forumID,currentPage,ListType)
{
	if((ListType==null)||(ListType=="") || (ListType=="FromForum"))
	{
		frm.action=page+"?forumID="+forumID+"&"+compID+"_action=Page&currentPage="+currentPage+"&time=" + date.getTime();
		frm.submit();
	}
	else
	{
		frm.action=page+"?"+compID+"_action=Page&currentPage="+currentPage+"&time=" + date.getTime();
		frm.submit();
	}
}
function frmGo(page,compID,frm,pages)
{
	var gotopage=trim(frm.BBSThreadListMaint_GoToPage.value);
	if(!isInt(gotopage,false))
	{
		alert("请输入你要到达的页码数！");
		return false;
	}
	else if(compareFloat(gotopage,pages)<0 || gotopage<0)
	{
		alert("请输入合适的页码数！");
		return false;
	}
	else
	{
		frm.action=page+"?currentPage="+gotopage;
		frm.submit();
	}
}
function checkOperation(frm){
	var flag = false;
	if(frm.BBSThreadListMaint_ThreadID){
		var num = frm.BBSThreadListMaint_ThreadID.length;
		if(num > 1){
			for(i=0;i<num;i++){
				if(frm.BBSThreadListMaint_ThreadID[i].checked){
					flag = true;
				}
			}
		}
		else if(frm.BBSThreadListMaint_ThreadID.checked) 
			flag = true;
	}
	if (flag) 
		return true;
	else 
		return false;
}
/*function frmUser(page,userID)
{
	var applicationWindow;
	if(applicationWindow!=null) 
	applicationWindow.close();

	applicationWindow=window.open(page+"?BBSUserInfoExhibit_UserID="+userID+"&time=" + date.getTime());
}*/
function frmMessage(page,forumID,threadID,messageID,ListType,fromCurrentPage)
{
	window.location=page+"?forumID="+forumID+"&threadID="+threadID+"&messageID="+messageID+"&ListType="+ListType+"&FromCurrentPage="+fromCurrentPage+"&time=" +date.getTime();
}
function frmReset(frm)
{
	frm.reset();
	htmlEditor.Composition.document.body.innerHTML="";
}
function frmReturn(page,forumID)
{
	window.location=page+"?forumID="+forumID+"&time="+date.getTime();
}
function WriteHtmlEditor()
{
	document.write("<iframe src='../../../EbizResourceSet/htmleditor/bbshtml/editor2_2.html' id='htmlEditor' width='670' height='460'></iframe>")
}
function PreviewMessage(frm){ 
frm.BBSThreadListMaint_ThreadBody.value = htmlEditor.Composition.document.body.innerHTML;
   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' topmargin='20' leftmargin='40'>");
newWindow.document.writeln("<table width='600' border='0' cellpadding='0' cellspacing='1' class='bbs_bg3'>");

newWindow.document.writeln("<td height='25' align='center' class='bbs_bg1'><span  class='BBSThreadMessageMaint150_title'>帖子预览</span></td>");
newWindow.document.writeln("  </tr>");
newWindow.document.writeln("  <tr>");
newWindow.document.writeln("    <td valign='top' bgcolor='#F6F6F6' style='padding-top:10px' class='bbs_bg2'><table width='100%'  border='0' cellspacing='0' cellpadding='2'>");
newWindow.document.writeln("      <tr>");
newWindow.document.writeln("        <td> ");
newWindow.document.writeln("标题: "+frm.BBSThreadListMaint_ThreadSubject.value);
newWindow.document.writeln("      </td>");
newWindow.document.writeln("      </tr>");
newWindow.document.writeln("      <tr>");
newWindow.document.writeln("        <td> <br/>");
newWindow.document.writeln("内容:  "+frm.BBSThreadListMaint_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='600' border='0' cellpadding='0' cellspacing='1' >");
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 ='bbs_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();

}

function View_Add(forumID)
{
	window.location="BBSThreadListMaint.html?forumID="+forumID+"&BBSThreadSearch150_IsClearCache=true&BBSThreadSearch150_IsClearDom=true";
}
