// JavaScript Document
<!--
function insertface(smileface)
{
	document.lyform.ncont.value+=smileface;
}

function insertFFString( ubbtype )
{
	var endString;
	var selContent;
	if ( ubbtype != "images" )
		selContent = prompt("请输入文字：", "文字");
	
	switch( ubbtype )
	{
		case "link":
			var theurl = prompt("请输入网址：", "http://");
			endString = "[url=" + theurl + "]" + selContent + " [/url]";
			break;
		case "size":
			var thesize = prompt("请输入字体大小：", "4");
			endString = "[size=" + thesize + "]" + selContent + "[/size]";
			break;
		case "bold":
			endString = "[b]" + selContent + "[/b]";
			break;
		case "ital":
			endString = "[i]" + selContent + "[/i]";
			break;
		case "underline":
			endString = "[u]" + selContent + "[/u]";
			break;
		case "color":
			var theColor	= prompt("请输入字体颜色：\n(红：red；绿：green；蓝：blue；等)", "red");
			endString = "[color=" + theColor + "]" + selContent + "[/color]";
			break;
		case "font":
			endString = "[font=宋体]" + selContent + "[/font]";
			break;
		case "quote":
			endString = "[quote]" + selContent + "[/quote]";
			break;
		case "sup":
			endString = "[sup]" + selContent + "[/sup]";
			break;
		case "sub":
			endString = "[sub]" + selContent + "[/sub]";
			break;
		case "images":
			var imgUrl 	= prompt("请输入图片网址：", "http://");
			endString   = "[img]" + imgUrl + "[/img]";
			break;
	}
	return endString;
}

function insertIEString( ubbtype, selContent )
{
	var endString;
	switch( ubbtype )
	{
		case "link":
			var theurl 		= prompt("请输入网址：", "http://");
			endString 		= "[url=" + theurl + "] " + selContent + " [/url]";
			break;
		case "size":
			var thesize = prompt("请输入字体大小：", "4");
			endString = "[size=" + thesize + "]" + selContent + "[/size]";
			break;
		case "bold":
			endString = "[b]" + selContent + "[/b]";
			break;
		case "ital":
			endString = "[i]" + selContent + "[/i]";
			break;
		case "underline":
			endString = "[u]" + selContent + "[/u]";
			break;
		case "color":
			var theColor	= prompt("请输入字体颜色：\n(红：red；绿：green；蓝：blue；等)", "red");
			endString = "[color=" + theColor + "]" + selContent + "[/color]";
			break;
		case "font":
			endString = "[font=宋体]" + selContent + "[/font]";
			break;
		case "quote":
			endString = "[quote]" + selContent + "[/quote]";
			break;
		case "sup":
			endString = "[sup]" + selContent + "[/sup]";
			break;
		case "sub":
			endString = "[sub]" + selContent + "[/sub]";
			break;
		case "images":
			var imgUrl 	= prompt("请输入图片网址：", "http://");
			endString   = "[img]" + imgUrl + "[/img]";
			break;
	}
	return endString;
}

function insertUBB( ubbtype )
{
	var selContent;
	if ( window.getSelection ) // FF
	{
		document.getElementById("ncont").value += insertFFString( ubbtype );
	}
	else if ( document.getSelection ) // Opera
	{
		document.getElementById("ncont").focus();
		document.getElementById("ncont").document.selection.createRange().text = insertFFString( ubbtype );
	}
	else if ( document.selection ) // IE
	{
		selContent = document.selection.createRange().text;
		document.getElementById("ncont").focus();
		document.getElementById("ncont").document.selection.createRange().text = insertIEString( ubbtype, selContent );
	}
}


		function MM_jumpMenu(targ,selObj,restore){ //v3.0
		  	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		  	if (restore) selObj.selectedIndex=0;
		}
		
		function MM_findObj(n, d) { //v4.01
		  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		  if(!x && d.getElementById) x=d.getElementById(n); return x;
		}
		
		function MM_jumpMenuGo(selName,targ,restore){ //v3.0
		  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
		}
//-->