var Quote = 0;
var Bold  = 0;
var Italic = 0;
var Underline = 0;
var Code = 0;
var text_enter_url      = "请输入主页地址";
var text_enter_image    = "请输入图片地址";
var text_enter_email    = "请输入邮件地址";
var error_no_url        = "您必须输入地址";
var error_no_title      = "您必须输入主页标题";
var error_no_email      = "您必须输入邮件地址";
function commentWrite(NewCode) {
document.form.f_comment.value+=NewCode;
document.form.f_comment.focus();
return;
}
function ZBBCurl() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_url, "http://");
if (!enterURL)    {
FoundErrors += "\n" + error_no_url;
}
if (FoundErrors)  {
alert("错误!"+FoundErrors);
return;
}
var ToAdd = "[URL]"+enterURL+"[/URL]";
document.form.f_comment.value+=ToAdd;
document.form.f_comment.focus();
}
function ZBBCimage() {
var FoundErrors = '';
var enterURL   = prompt(text_enter_image, "http://");
if (!enterURL) {
FoundErrors += "\n" + error_no_url;
}
if (FoundErrors) {
alert("错误!"+FoundErrors);
return;
}
var ToAdd = "[IMG]"+enterURL+"[/IMG]";
document.form.f_comment.value+=ToAdd;
document.form.f_comment.focus();
}
function ZBBCemail() {
var emailAddress = prompt(text_enter_email,"");
if (!emailAddress) { alert(error_no_email); return; }
var ToAdd = "[EMAIL]"+emailAddress+"[/EMAIL]";
commentWrite(ToAdd);
}
function ZBBCcode() {
if (Code == 0) {
ToAdd = "[CODE]";
document.form.code.value = " 代码*";
Code = 1;
} else {
ToAdd = "[/CODE]";
document.form.code.value = " 代码 ";
Code = 0;
}
commentWrite(ToAdd);
}
function ZBBCquote() {
if (Quote == 0) {
ToAdd = "[QUOTE]";
document.form.quote.value = " 引用*";
Quote = 1;
} else {
ToAdd = "[/QUOTE]";
document.form.quote.value = " 引用 ";
Quote = 0;
}
commentWrite(ToAdd);
}
function ZBBCbold() {
if (Bold == 0) {
ToAdd = "[B]";
document.form.bold.value = " B*";
Bold = 1;
} else {
ToAdd = "[/B]";
document.form.bold.value = " B ";
Bold = 0;
}
commentWrite(ToAdd);
}
function ZBBCitalic() {
if (Italic == 0) {
ToAdd = "[I]";
document.form.italic.value = " I*";
Italic = 1;
} else {
ToAdd = "[/I]";
document.form.italic.value = " I ";
Italic = 0;
}
commentWrite(ToAdd);
}
function ZBBCunder() {
if (Underline == 0) {
ToAdd = "[U]";
document.form.under.value = " U*";
Underline = 1;
} else {
ToAdd = "[/U]";
document.form.under.value = " U ";
Underline = 0;
}
commentWrite(ToAdd);
}