

function ybbsize(theSmilie){
fontbegin="[size="+theSmilie+"]";
fontend="[/size]";
fontchuli();
}


function ybbfont(theSmilie){
fontbegin="[font="+theSmilie+"]";
fontend="[/font]";
fontchuli();
}


function YBBurl() {
var enterURL   = prompt("请输入链接地址", "");
fontbegin="[URL]";
if (enterURL) {
fontbegin="[URL="+enterURL+"]";
}
fontend="[/URL]";
fontchuli();
}


function YBBimage() {
var enterURL   = prompt("请输入图片地址", "");
if (enterURL) {
var ToAdd = "[IMG]"+enterURL+"[/IMG]";
document.form.content.value+=ToAdd;
}
}



function YBBemail() {
var emailAddress = prompt("请输入邮件地址","");
if (emailAddress) {
var ToAdd = "[EMAIL]"+emailAddress+"[/EMAIL]";
document.form.content.value+=ToAdd;
}
}

function YBBflash() {
var enterURL  = prompt("请输入FLASH地址", "");
var entersize = prompt("请输入FLASH的宽度,高度", "500,375");
if (enterURL) {
var ToAdd = "[FLASH="+entersize+"]"+enterURL+"[/FLASH]";
document.form.content.value+=ToAdd;
}
}

function YBBrm() {
var enterURL  = prompt("请输入RealPlayer文件地址", "");
var entersize = prompt("请输入视频宽度,高度", "500,375");
if (enterURL) {
var ToAdd = "[RM="+entersize+"]"+enterURL+"[/RM]";
document.form.content.value+=ToAdd;
}
}

function YBBmp() {
var enterURL  = prompt("请输入Media Player文件地址", "");
var entersize = prompt("请输入视频宽度,高度", "500,420");
if (enterURL) {
var ToAdd = "[MP="+entersize+"]"+enterURL+"[/MP]";
document.form.content.value+=ToAdd;
}
}

function YBBsound() {
var enterURL = prompt("请输入背景音乐地址", "");
if (enterURL) {
var ToAdd = "[SOUND]"+enterURL+"[/SOUND]";
document.form.content.value+=ToAdd;
}
}


function YBBbold() {
fontbegin="[B]";
fontend="[/B]";
fontchuli();
}


function YBBitalic() {
fontbegin="[I]";
fontend="[/I]";
fontchuli();
}


function YBBunder() {
fontbegin="[U]";
fontend="[/U]";
fontchuli();
}

function YBBmarquee() {
fontbegin="[marquee]";
fontend="[/marquee]";
fontchuli();
}

function YBBstrike() {
fontbegin="[STRIKE]";
fontend="[/STRIKE]";
fontchuli();
}

function YBBcenter() {
fontbegin="[CENTER]";
fontend="[/CENTER]";
fontchuli();
}

function Ybblight()
{
fontbegin="[LIGHT=#F8C747]";
fontend="[/LIGHT]";
fontchuli();
}

function YbbSHADOW()
{
fontbegin="[SHADOW=#330000,5]";
fontend="[/SHADOW]";
fontchuli();
}

function Ybbtext1()
{
fontbegin="[text1]";
fontend="[/text1]";
fontchuli();
}

function Ybbtext2()
{
fontbegin="[text2]";
fontend="[/text2]";
fontchuli();
}

function Ybbtext3()
{
fontbegin="[text3]";
fontend="[/text3]";
fontchuli();
}

function Ybbtext4()
{
fontbegin="[text4]";
fontend="[/text4]";
fontchuli();
}

function Ybbtext5()
{
fontbegin="[text5]";
fontend="[/text5]";
fontchuli();
}
function YBBquote() 
{
fontbegin="[QUOTE]";
fontend="[/QUOTE]";
fontchuli();
}

function YBBglow() {
fontbegin="[glow]";
fontend="[/glow]";
fontchuli();
}



function replyview() {
fontbegin="[replyview]";
fontend="[/replyview]";
fontchuli();
}


function power() {
var enterpower   = prompt("请输入数值,如：5 (即限制威望值在5点以下的用户不能浏览该内容!)", "5");

if (enterpower) {
fontbegin="[power]";
fontbegin="[power="+enterpower+"]";
fontend="[/power]";
fontchuli();
}

}

function fact() {
var enterfact   = prompt("请输入帮派名字,如：阿水帮 (即限制阿水帮以为的用户不能浏览该内容!)", "阿水帮");

if (enterfact) {
fontbegin="[fact]";
fontbegin="[fact="+enterfact+"]";
fontend="[/fact]";
fontchuli();
}

}


function magicpower() {
var entermagicpower   = prompt("请输入数值,如：10 (即限制魅力值在10点以下的用户不能浏览该内容!)", "10");

if (entermagicpower) {
fontbegin="[magicpower]";
fontbegin="[magicpower="+entermagicpower+"]";
fontend="[/magicpower]";
fontchuli();
}

}


function point() {
var enterexp   = prompt("请输入数值,如：100 (即限制经验值在100点以下的用户不能浏览该内容!)", "100");

if (enterexp) {
fontbegin="[point]";
fontbegin="[point="+enterexp+"]";
fontend="[/point]";
fontchuli();
}

}
function money() {
var entermoney   = prompt("请输入数值,如：100 (即限制社区酷币在100点以下的用户不能浏览该内容!)", "100");

if (entermoney) {
fontbegin="[money]";
fontbegin="[money="+entermoney+"]";
fontend="[/money]";
fontchuli();
}

}
function buypost() {
var entermoney   = prompt("请输入数值,如：50 (即看贴者需要付出50元酷币才可浏览该内容!)", "50");

if (entermoney) {
fontbegin="[buy]";
fontbegin="[buy="+entermoney+"]";
fontend="[/buy][guy][/guy]";
fontchuli();
}

}


function YBBHTML() 
{
document.form.content.value="[HTML]"+document.form.content.value+"[/HTML]";
}

function MM_findObj(n, d) { 
  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); return x;
}

function insertTag(MyString)
{
fontbegin='[color=' + MyString + ']'
fontend='[/color]'
fontchuli();
}


var base_hexa = "0123456789ABCDEF";
function dec2Hexa(number)
{
   return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
}

function RGB2Hexa(TR,TG,TB)
{
  return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
}

function lightCase(MyObject,objName)
{
	MM_findObj(objName).bgColor = MyObject.bgColor;
}

col = new Array;
col[0] = new Array(255,0,255,-1,255,-1);
col[1] = new Array(255,0,0,1,0,0);
col[2] = new Array(255,-1,255,0,0,0);
col[3] = new Array(0,0,255,0,0,1);
col[4] = new Array(0,0,255,-1,255,0);
col[5] = new Array(0,1,0,0,255,0);
col[6] = new Array(255,-1,0,0,255,-1);

function rgb(pas,w,h){
	for (j=0;j<6+1;j++){
		for (i=0;i<pas+1;i++){
			r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
			g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
			b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
		  codehex = r + '' + g + '' + b;
		  document.write('<td bgColor=\"' + RGB2Hexa(r,g,b) + '\"onmouseover="lightCase(this,\'ColorUsed\')" onClick=\"insertTag(this.bgColor)\" width=\"'+w+'\" height=\"'+h+'\"><IMG height='+h+' width='+w+' border=0 title=\"字体颜色：'+RGB2Hexa(r,g,b)+'\"></TD>\n');
		}
	}
}
function fontchuli(){
if (document.selection.createRange().text!='') {
var range = document.selection.createRange();
var ch_text=range.text;
range.text = fontbegin + ch_text + fontend;
} 
else {
document.form.content.value=fontbegin+document.form.content.value+fontend;

}
}


function YBBtable() {
var sRow = prompt("请输入表格行数","1");
var sCol = prompt("请输入表格列数","1");
var entercontent = prompt("请输入表格内容", "ECC计算机协会");
var enteralign = prompt("表格对齐方式，左对齐(left)居中(center)右对齐(right)", "center");
var enterborder = prompt("表格边框粗细", "1");
var entercellpadding = prompt("表格单元边距", "3");
var entercellspacing = prompt("表格单元间距", "2");
var enterwidth = prompt("表格宽度，请填写百分比", "100%");
var enterbordercolor = prompt("表格边框颜色", "#CCCCCC");
var enterbgcolor = prompt("表格背景颜色", "#FFFFFF");
if (entercontent) {
var ToAdd = "[TABLE algin='"+enteralign+"' border="+enterborder+" cellpadding="+entercellpadding+" cellspacing="+entercellspacing+" width="+enterwidth+" bordercolor="+enterbordercolor+" bgcolor="+enterbgcolor+"]\n";
		for (var i=1;i<=sRow;i++){
			ToAdd = ToAdd + "[TR]\n";
			for (var j=1;j<=sCol;j++){
				ToAdd = ToAdd + "[TD]"+entercontent+"[/TD]";
			}
		}
		ToAdd = ToAdd +  "\n[/TR][/TABLE]"

document.form.content.value+=ToAdd;
}
}