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.comment.value+=NewCode;
document.form.comment.focus();
return;
}
function YBBCurl() {
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.comment.value+=ToAdd;
document.form.comment.focus();
}
function YBBCimage() {
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.comment.value+=ToAdd;
document.form.comment.focus();
}
function YBBCemail() {
var emailAddress = prompt(text_enter_email,"");
if (!emailAddress) { alert(error_no_email); return; }
var ToAdd = "[EMAIL]"+emailAddress+"[/EMAIL]";
commentWrite(ToAdd);
}
function YBBCcode() {
if (Code == 0) {
ToAdd = "[CODE]";
document.form.code.value = "代碼*";
Code = 1;
} else {
ToAdd = "[/CODE]";
document.form.code.value = "代碼 ";
Code = 0;
}
commentWrite(ToAdd);
}
function YBBCquote() {
if (Quote == 0) {
ToAdd = "[QUOTE]";
document.form.quote.value = "引用*";
Quote = 1;
} else {
ToAdd = "[/QUOTE]";
document.form.quote.value = "引用 ";
Quote = 0;
}
commentWrite(ToAdd);
}
function YBBCbold() {
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 YBBCitalic() {
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 YBBCunder() {
if (Underline == 0) {
ToAdd = "[U]";
document.form.under.value = " U*";
Underline = 1;
} else {
ToAdd = "[/U]";
document.form.under.value = " U ";
Underline = 0;
}
commentWrite(ToAdd);
}
