

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;

}
}

