var text_enter_url      = "请输入连接网址";
var text_enter_txt      = "请输入连接说明";
var text_enter_email    = "请输入邮件地址";
var text_enter_image    = "请输入图片地址 只限制于.gif/.jpg/.jpeg/.bmp/.png格式";
var text_enter_swf	= "请输入媒体地址 只限制于.swf格式";
var text_enter_mp	= "请输入媒体地址 只限制于.mid/.wma/.wmw/.mpeg/.asf格式";
var text_enter_rm	= "请输入媒体地址 只限制于.ra/.rm/.ram/.rmvb格式";
var text_enter_flv	= "请输入媒体地址 只限制于.flv格式";
var text_enter_sound	= "请输入媒体地址 只限制于.mid/.wma/.mp3格式";

var error_no_url        = "请输入连接网址";
var error_no_txt        = "请输入连接说明";
var error_no_email      = "请输入邮件地址";
var error_no_image      = "请输入图片地址";
var error_no_swf	= "请输入媒体地址";
var error_no_mp		= "请输入媒体地址";
var error_no_rm		= "请输入媒体地址";
var error_no_flv	= "请输入媒体地址";
var error_no_sound	= "请输入媒体地址";

function commentWrite(NewCode) {
document.form.content.value+=NewCode;
document.form.content.focus();
return;
}

function inputs(str)
{
AddText(str);
}

function bold() {
fontbegin="[B]";
fontend="[/B]";
fontchuli();
}

function italicize() {
fontbegin="[I]";
fontend="[/I]";
fontchuli();
}

function underline() {
fontbegin="[U]";
fontend="[/U]";
fontchuli();
}

function left() {
var ToAdd = "[ALIGN=LEFT][/ALIGN]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function center() {
var ToAdd = "[ALIGN=CENTER][/ALIGN]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function right() {
var ToAdd = "[ALIGN=RIGHT][/ALIGN]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function link() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_url, "http://");
var enterTxT   = prompt(text_enter_txt, enterURL);
if (!enterURL)    {
FoundErrors += "\n" + error_no_url;
}
if (!enterTxT)    {
FoundErrors += "\n" + error_no_txt;
}
if (FoundErrors)  {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[URL="+enterURL+"]"+enterTxT+"[/URL]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}


function email() {
var emailAddress = prompt(text_enter_email,"");
if (!emailAddress) { alert(error_no_email); return; }
var ToAdd = "[EMAIL="+emailAddress+"]"+emailAddress+"[/EMAIL]";
commentWrite(ToAdd);
}


function image() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_image, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_url;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[IMG]"+enterURL+"[/IMG]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function swf() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_swf, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_swf;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[SWF=300,270]"+enterURL+"[/SWF]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function mp() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_mp, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_mp;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[MP=300,270]"+enterURL+"[/MP]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function rm() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_rm, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_rm;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[RM=300,210]"+enterURL+"[/RM]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function flv() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_flv, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_flv;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[FLV=300,240]"+enterURL+"[/FLV]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function code() {
var ToAdd = "[CODE][/CODE]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function quote() {
fontbegin="[QUOTE]";
fontend="[/QUOTE]";
fontchuli();
}

function sound() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_sound, "");
if (!enterURL) {
FoundErrors += "\n" + error_no_sound;
}
if (FoundErrors) {
alert("错误！"+FoundErrors);
return;
}
var ToAdd = "[SOUND]"+enterURL+"[/SOUND]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function showsize(size) {
var ToAdd = "[SIZE="+size+"][/SIZE]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function showfont(font) {
var ToAdd = "[FACE="+font+"][/FACE]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}

function showcolor(color) {
var ToAdd = "[COLOR="+color+"][/COLOR]";
document.form.content.value+=ToAdd;
document.form.content.focus();
}


function fontchuli(){
if ((document.selection)&&(document.selection.type == "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;
document.form.content.focus();
}
}


ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.form.submit();}}
}
function DoTitle(addTitle) { 
var revisedTitle; 
var currentTitle = document.form.subject.value; 
revisedTitle = currentTitle+addTitle; 
document.form.subject.value=revisedTitle; 
document.form.subject.focus(); 
return;
}

function rtitle(i)
{
document.form.Title.value=i+document.form.Title.value;
}
