
function WrapWithTags(txt, Tag){
    var HTML = "[" + Tag;
    HTML += ("]" +txt + "[/" + Tag + "] ");
    return HTML;
}

function b(){
    var txt = this.toString();
    var Tag = "b";
    return WrapWithTags(txt, Tag);
}
String.prototype.b = b;

function i(){
    var txt = this.toString();
    var Tag = "i";
    return WrapWithTags(txt, Tag);
}
String.prototype.i = i;

function u(){
    var txt = this.toString();
    var Tag = "u";
    return WrapWithTags(txt, Tag);
}
String.prototype.u = u;

function quote(){
    var txt = this.toString();
    var Tag = "quote";
    return WrapWithTags(txt, Tag);
}
String.prototype.quote = quote;

function code(){
    var txt = this.toString();
    var Tag = "code";
    return WrapWithTags(txt, Tag);
}
String.prototype.code = code;

function color(){
    var txt = this.toString();
    var Tag = "color";
    return WrapWithTags(txt, Tag);
}
String.prototype.color = color;

function ApplyTag(Tag){
    if (!document.all || !document.selection.createRange().text){
    	document.forum.e_msg.value = document.forum.e_msg.value + "\n[" + Tag + "]  [/" + Tag + "] "; 
    	document.forum.e_msg.focus();
    	return; 
    } else {
   		var oSelTxt = document.selection.createRange();
   		var sSelTxt = oSelTxt.text;
   		if (sSelTxt) oSelTxt.text = eval("sSelTxt."+Tag+"()");
    	document.forum.e_msg.focus();
    	return; 
    }
}

