function menuShow(menu) //定义显示菜单的方法，参数menu即菜单的id。
{
  menu.style.display='block';
  //注意这里如何用JavaScript改变style对象的属性来达到改变CSS属性的目的。
}
function menuHide(menu) //定义隐藏菜单的方法，参数menu即菜单的id。
{
  menu.style.display='none';
  //同上
}


function showMenu(oSrc,e,sCont,w,h)
{
	var lay,iLeft;
	if(w!=null){
		lay=document.getElementById("popMenu");
		if(lay){lay.style.width=parseInt(w) - (document.all ? 0 : 40);lay.style.height=parseInt(h);}
	}
	else{
		lay=document.getElementById("topicPrompt");
	}
	if(lay==null)return;
	lay.innerHTML=sCont;
	if(document.all){
		iLeft=document.body.scrollLeft + e.clientX - e.offsetX + oSrc.offsetLeft;
		lay.style.left=lay.scrollWidth + iLeft - 2 > document.body.scrollWidth ? iLeft - lay.scrollWidth + 24 : iLeft - 2;
		lay.style.top=document.body.scrollTop + e.clientY -e.offsetY + oSrc.offsetTop + 12;
	}
	else{
		lay.style.left=document.body.scrollLeft + e.clientX + lay.scrollWidth > document.body.scrollWidth ? document.body.scrollLeft + e.clientX + 24 - lay.scrollWidth : document.body.scrollLeft + e.clientX - 24;
		lay.style.top=document.body.scrollTop + e.clientY;
	}
	lay.style.visibility='visible';
}
function hideMenu(s)
{
	var lay=document.getElementById(s);
	if(lay) lay.style.visibility='hidden';
}
//-------------------------------------------------------------------------------------
function doEncrypt(o)
{
	var sel;
	sel=document.getElementById('Ratings');
	if (o.checked)
	{
		sel.disabled=false;
		sel.selectedIndex=1;
	}else{
		sel.disabled=true;
	}
}
//--------------------------------------------------------------------------
function addText(str) {
	var o=document.PostTopic.Message;
	if (o.createTextRange && o.currPos) {      
		var currPos = o.currPos;      
		currPos.text = str;
	}
	else o.value += str;
	//o.focus(currPos);
	o.focus();
}
var ie = (document.all)? true:false
if (ie)
{
	function fastPost(eventobject)
	{
		if(event.ctrlKey && window.event.keyCode==13)
		{
			var o=window.document.PostTopic;
			if(ie && o.BackupContent.checked) window.clipboardData.setData("Text",o.Message.value);
			o.submit();
		}
	}
}
function getActiveText(o){
	o.currPos = document.selection.createRange().duplicate();
	}
var strBegin,strEnd
function addTag()
{
	if ((document.selection) && (document.selection.type == "Text"))
	{
		var range = document.selection.createRange();
		addText(strBegin + range.text + strEnd);
	} 
	else
	{
		addText(strBegin + strEnd);
	}
}
function sd(a,re){
   return (a.search(re));
}
function showfont(font) {strBegin="[font="+font+"]";strEnd="[/font]";addTag();}
function showsize(size) {strBegin="[size="+size+"]";strEnd="[/size]";addTag();}
function showcolor(color) {strBegin="[color="+color+"]";strEnd="[/color]";addTag();}
function bold() {strBegin="[b]";strEnd="[/b]";addTag();}
function italicize() {strBegin="[i]";strEnd="[/i]";addTag();}
function underline() {strBegin="[u]";strEnd="[/u]";addTag();}
function hyperlink() {strBegin="[url=]";strEnd="[/url]";addTag();}
function email(){strBegin="[email]";strEnd="[/email]";addTag();}
function quote() {strBegin="\r[quote]";strEnd="[/quote]";addTag();}
function center() {strBegin="\r[center]";strEnd="[/center]";addTag();}
function image() {strBegin="[img]";strEnd="[/img]";addTag();}
function showcode() {strBegin="[code]";strEnd="[/code]";addTag();}
function list() {strBegin="[*]";strEnd="";addTag();}
function setsmiley(what) {addText(" "+what);} 
function smilieopen() {var MainWindow = window.open ('smiles.htm',"_blank","toolbar=no,location=no,menubar=no,scrollbars=yes,width=400,height=400,resizeable=yes,status=no");}
function viewubb() {msg=window.open("ubbcode.htm","","height=500,width=500,left=5,top=5,scrollbars=yes,toolbar=no,directories=no,status=no,menubar=no,resizable=yes");}
function afp() {msg=window.open("afp.htm","","height=315,width=420,left=5,top=5,scrollbars=no,toolbar=no,directories=no,status=no,menubar=no,resizable=yes");}

