bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
ver="n2";
if (bName == "Netscape" && bVer >= 3) ver = "n3";
else if (bName == "Netscape" && bVer == 2) ver = "n2";
else if (bName == "Microsoft Internet Explorer" && bVer >= 4) ver = "n3";
else if (bName == "Microsoft Internet Explorer" && bVer == 2) ver = "n2";

if (ver != "n2") {
	format_b = new Image();
	format_b.src = "images/formatbuttons_b.gif";
	format_b_over = new Image();
	format_b_over.src = "images/formatbuttons_b-over.gif";
	format_b_press = new Image();
	format_b_press.src = "images/formatbuttons_b-press.gif";
	format_i = new Image();
	format_i.src = "images/formatbuttons_i.gif";
	format_i_over = new Image();
	format_i_over.src = "images/formatbuttons_i-over.gif";
	format_i_press = new Image();
	format_i_press.src = "images/formatbuttons_i-press.gif";
	format_u = new Image();
	format_u.src = "images/formatbuttons_u.gif";
	format_u_over = new Image();
	format_u_over.src = "images/formatbuttons_u-over.gif";
	format_u_press = new Image();
	format_u_press.src = "images/formatbuttons_u-press.gif";
	format_quote = new Image();
	format_quote.src = "images/formatbuttons_quote.gif";
	format_quote_over = new Image();
	format_quote_over.src = "images/formatbuttons_quote-over.gif";
	format_quote_press = new Image();
	format_quote_press.src = "images/formatbuttons_quote-press.gif";
	format_img = new Image();
	format_img.src = "images/formatbuttons_img.gif";
	format_img_over = new Image();
	format_img_over.src = "images/formatbuttons_img-over.gif";
	format_img_press = new Image();
	format_img_press.src = "images/formatbuttons_img-press.gif";	
	format_happy = new Image();
	format_happy.src = "images/formatbuttons_happy.gif";
	format_happy_over = new Image();
	format_happy_over.src = "images/formatbuttons_happy-over.gif";
	format_happy_press = new Image();
	format_happy_press.src = "images/formatbuttons_happy-press.gif";
	format_sad = new Image();
	format_sad.src = "images/formatbuttons_sad.gif";
	format_sad_over = new Image();
	format_sad_over.src = "images/formatbuttons_sad-over.gif";
	format_sad_press = new Image();
	format_sad_press.src = "images/formatbuttons_sad-press.gif";
	format_laugh = new Image();
	format_laugh.src = "images/formatbuttons_laugh.gif";
	format_laugh_over = new Image();
	format_laugh_over.src = "images/formatbuttons_laugh-over.gif";
	format_laugh_press = new Image();
	format_laugh_press.src = "images/formatbuttons_laugh-press.gif";
	format_wink = new Image();
	format_wink.src = "images/formatbuttons_wink.gif";
	format_wink_over = new Image();
	format_wink_over.src = "images/formatbuttons_wink-over.gif";
	format_wink_press = new Image();
	format_wink_press.src = "images/formatbuttons_wink-press.gif";
	format_razz = new Image();
	format_razz.src = "images/formatbuttons_razz.gif";
	format_razz_over = new Image();
	format_razz_over.src = "images/formatbuttons_razz-over.gif";
	format_razz_press = new Image();
	format_razz_press.src = "images/formatbuttons_razz-press.gif";
	format_angry = new Image();
	format_angry.src = "images/formatbuttons_angry.gif";
	format_angry_over = new Image();
	format_angry_over.src = "images/formatbuttons_angry-over.gif";
	format_angry_press = new Image();
	format_angry_press.src = "images/formatbuttons_angry-press.gif";
	format_shocked = new Image();
	format_shocked.src = "images/formatbuttons_shocked.gif";
	format_shocked_over = new Image();
	format_shocked_over.src = "images/formatbuttons_shocked-over.gif";
	format_shocked_press = new Image();
	format_shocked_press.src = "images/formatbuttons_shocked-press.gif";
	
} else {
	format_b = "";
	format_b_over = "";
	format_b_press = "";
	format_i = "";
	format_i_over = "";
	format_i_press = "";
	format_u = "";
	format_u_over = "";
	format_u_press = "";
	format_quote = "";
	format_quote_over = "";
	format_quote_press = "";
	format_img = "";
	format_img_over = "";
	format_img_press = "";
	format_happy = "";
	format_happy_over = "";
	format_happy_press = "";
	format_sad = "";
	format_sad_over = "";
	format_sad_press = "";
	format_laugh = "";
	format_laugh_over = "";
	format_laugh_press = "";
	format_wink = "";
	format_wink_over = "";
	format_wink_press = "";
	format_razz = "";
	format_razz_over = "";
	format_razz_press = "";
	format_laugh_press = "";
	format_angry = "";
	format_angry_over = "";
	format_angry_press = "";
	format_shocked = "";
	format_shocked_over = "";
	format_shocked_press = "";
}

function changeImage(imagename,imagesrc) {
	if (ver == "n2") return false;
	document.images[imagename].src=imagesrc.src;
	return true;
}

		
function getActiveText(textEl) {
	if (textEl.createTextRange)
	textEl.caretPos = document.selection.createRange().duplicate();
	textE1 = (document.all) ? document.selection.createRange().text : document.getSelection();
}

function formatText(textEl, tagstart, tagend) {
	if (textEl.createTextRange && textEl.caretPos) {
	var caretPos = textEl.caretPos;
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? tagstart + textE1 + tagend : tagstart + textE1 + tagend;
	document.topicform.message.focus();
	getActiveText(textEl);
    }
}

function smileyInsert(textEl, smileyType) {
	if (textEl.createTextRange && textEl.caretPos) {
	var caretPos = textEl.caretPos;
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smileyType : smileyType;
	document.topicform.message.focus();
	}
}