// JavaScript Document
function AddText(text, box) {
	if (box.caretPos) box.caretPos.text=text;
	else box.value+=text;
	box.focus();
}

function AddSelText(bbopen, bbclose, box) {
	if (box.caretPos) box.caretPos.text = bbopen + box.caretPos.text + bbclose;
	else box.value += bbopen + bbclose;
	box.focus()
}

function micro(box) {
	AddText("&micro;", box);
}

function alpha(box) {
	AddText("&alpha;", box);
}

function beta(box) {
	AddText("&beta;", box);
}

function delta(box) {
	AddText("&Delta;", box);
}

function plusmn(box) {
	AddText("&plusmn;", box);
}

function subscript(box) {
	AddSelText("[sub]","[/sub]",box);
}

function superscript(box) {
	AddSelText("[sup]","[/sup]",box);
}

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