function x() { return; } var thisForm; function mozWrap(txtarea, lft, rgt, pmt, pmr) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; if (selEnd==1 || selEnd==2) selEnd=selLength; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd) var s3 = (txtarea.value).substring(selEnd, selLength); if (s2 == "" && pmt != "") { var s2 = prompt("Enter " + pmt + ":", pmr); } txtarea.value = s1 + lft + s2 + rgt + s3; } function IEWrap(lft, rgt, pmt, pmr) { strSelection = document.selection.createRange().text; if (strSelection == "" && pmt != "") { var strSelection = prompt("Enter " + pmt + ":", pmr); var currenttresForm = document.tresForm.message.value; document.tresForm.message.value = currenttresForm + lft + strSelection + rgt; } else if (strSelection == "") { var strSelection = ""; var currenttresForm = document.tresForm.message.value; document.tresForm.message.value = currenttresForm + lft + strSelection + rgt; } else { document.selection.createRange().text = lft + strSelection + rgt; } } function wrapSelection(txtarea, lft, rgt, pmt, pmr) { if (document.all) {IEWrap(lft, rgt, pmt, pmr);} else if (document.getElementById) {mozWrap(txtarea, lft, rgt, pmt, pmr);} document.tresForm.message.focus(); } function wrapSelectionWithLink(txtarea) { var my_link = prompt("Enter Link URL:","http://"); if (my_link != null) { lft="[url=" + my_link + "]"; rgt="[/url]"; wrapSelection(txtarea, lft, rgt, "Link Name", "Here"); } return; } function wrapSelectionWithEmail(txtarea) { var my_link = prompt("Enter Email Address:","you@address.com"); if (my_link != null) { lft="[email=" + my_link + "]"; rgt="[/email]"; wrapSelection(txtarea, lft, rgt, "Text", "Email"); } return; } function wrapSelectionWithImage(txtarea, lft, rgt) { wrapSelection(txtarea, lft, rgt, "Image URL", "http://"); return; } function wrapSelectionWithColor(txtarea) { var my_link = prompt("Enter Color:","red"); if (my_link != null) { lft="[color=" + my_link + "]"; rgt="[/color]"; wrapSelection(txtarea, lft, rgt, "Color Name", "Red"); } return; } function wrapSelectionWithSmilie(txtarea, lft, rgt) { wrapSelection(txtarea, lft, rgt, "", ""); return; }