// *******************************************************

tags = new Array();

// *******************************************************
// replacements for unsupported array functions (because arrayname.push(var)
// and arrayname.pop() are not implemented in IE until version 5.5)

function getarraysize(thearray) {
// replacement for arrayname.length property
	for (i = 0; i < thearray.length; i++) {
		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null)) {
			return i;
		}
	}
	return thearray.length;
}

function arraypush(thearray, value) {
// replacement for arrayname.push(value)
	thearraysize = getarraysize(thearray);
	thearray[thearraysize] = value;
}

function arraypop(thearray) {
// replacement for arrayname.pop()
	thearraysize = getarraysize(thearray);
	retval = thearray[thearraysize - 1];
	delete thearray[thearraysize - 1];
	return retval;
}

// *******************************************************

function setmode(modevalue) {
// sets cookie for normal (0) and enhanced (1) modes
	document.cookie = "mvncodemode="+modevalue+"; path=/; expires=Wed, 1 Jan 2020 00:00:00 GMT;";
}

function normalmode(theform) {
// checks value of mode radio buttons. returns true if normal mode
		return true;
}


// *******************************************************


function closeall(theform) {
// closes all open tags
	if (normalmode(theform)) {
	} else {
		if (tags[0]) {
			while (tags[0]) {
				theform.message.value += "[/"+ arraypop(tags) +"]";
			}
			theform.message.value += " ";
		} else {
		}
	}
	//theform.closealltags.checked=false;
	theform.message.focus();
}



function dolist(theform) {
// inserts list with option to have numbered or alphabetical type
	listtype = prompt(list_type_prompt, "");
	if ((listtype == "a") || (listtype == "1")) {
		thelist = "[list="+listtype+"]\n";
		listend = "[/list="+listtype+"] ";
	} else {
		thelist = "[list]\n";
		listend = "[/list] ";
	}
	listentry = "initial";
	while ((listentry != "") && (listentry != null)) {
		listentry = prompt(list_item_prompt, "");
		if ((listentry != "") && (listentry != null)) {
			thelist = thelist+"[*]"+listentry+"\n";
		}
	}
	theform.message.value += thelist+listend;
	theform.message.focus();
}

function smilie(thesmilie) {
// inserts smilie text
	document.mvnform.message.value += thesmilie+" ";
	document.mvnform.message.focus();
}

