function storeCaret(text) {
if (text.createTextRange) {
text.caretPos = document.selection.createRange().duplicate();
}
}

function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}

function validate(theform) {
if (theform.subject.value=="" || theform.message.value=="") {
alert("Please complete all fields.");
return false;
}
}

function bold()
{
var textbold = prompt('Please enter the text', '');
if (textbold)
{
textbold = "[b]"+textbold+"[/b]";
addtext(textbold);
}
}
function italics()
{
var textitalics = prompt('Please enter the text', '');
if (textitalics)
{
textitalics = "[i]"+textitalics+"[/i]";
addtext(textitalics);
}
}
function underline()
{
var textunderline = prompt('Please enter the text', '');
if (textunderline)
{
textunderline = "[u]"+textunderline+"[/u]";
addtext(textunderline);
}
}
function quote()
{
var textquote = prompt('Please enter the text', '');
if (textquote)
{
textquote = "[quote]"+textquote+"[/quote]";
addtext(textquote);
}
}
function url()
{
var texturl = prompt('Please enter the text (for the hyperlink)', '');
if (texturl)
{
var linkurl= prompt('Please enter the URL', '');
if (linkurl)
{
texturl="[url="+linkurl+"]"+texturl+"[/url]";
addtext(texturl);
}
}
}
function image()
{
var textimage = prompt('Please enter the URL', '');
if (textimage)
{
textimage = "[img]"+textimage+"[/img]";
addtext(textimage);
}
}
function glow()
{
var textglow = prompt('Please enter the text', '');
if (textglow)
{
var colorglow = prompt('Please enter the glow color', 'red');
if (colorglow)
{
var colortext = prompt('Please enter the text color', 'black');
if (colortext)
{
var textsize = prompt('Please enter the text size', '2');
if (textsize)
{
var glowsize = prompt('Please enter the Strength of the Glow [1-5]','1');
if (glowsize)
{
textglow = "[glow tcolor="+colorglow+", fcolor="+colortext+", size="+textsize+", strength="+glowsize+"]"+textglow+"[/glow]";
addtext(textglow);
}
}
}
}
}
}
function color(color2)
{
var textcolor= prompt('Please enter the text', '');
if (textcolor)
{
textcolorize = "[color="+color2+"]"+textcolor+"[/color]";
addtext(textcolorize);
}
}
function addtext(text)
{
message = document.forum.message.value;
document.forum.message.value  = message + text
}

function leapto(form, tgroup) {
var myindex=form.dest.selectedIndex
var choosen=form.dest.options[myindex].value
if (choosen != "") {
if (choosen != "all") {
parent.Smilies.location.href=(form.dest.options[myindex].value);}
else {
var url = "post.php?action=smilies&set=all&templategroup="+tgroup
var extra = "width=185,height=300,top=20,left=20,resizable=yes,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no";
newWindow=window.open(url,"",extra);}
}}


