
function DoConfirm(xText, url) {
	if(confirm(xText)) location.href = url;
}


function WhichClicked(ww) {
	window.document.myform.waction.value = ww;
}

function storeCaret(text) { 
	if (text.createTextRange) {
		text.caretPos = document.selection.createRange().duplicate();
	}
}


/*function AddText(text) {
	if (document.forms[0].xText.createTextRange && document.forms[0].xText.caretPos) {      
		var caretPos = document.forms[0].xText.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.forms[0].xText.value += text;
	document.forms[0].xText.focus(caretPos)
}
*/

function AddText(text) {
	if (document.myform.xText.createTextRange && document.myform.xText.caretPos) {      
		var caretPos = document.myform.xText.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.myform.xText.value += text;
	document.myform.xText.focus(caretPos)
}



function hr() {
	AddTxt="[hr]";
	AddText(AddTxt);
}

function size() {
	AddTxt="[font class=2][/font]";
	AddText(AddTxt);
}

function font() {
	AddTxt="[font=Verdana][/font]";
	AddText(AddTxt);
}

function teletype() {
	AddTxt="[tt][/tt]";
	AddText(AddTxt);
}

function right() {
	AddTxt="[right][/right]";
	AddText(AddTxt);
}

function left() {
	AddTxt="[left][/left]";
	AddText(AddTxt);
}

function superscript() {
	AddTxt="[sup][/sup]";
	AddText(AddTxt);
}

function subscript() {
	AddTxt="[sub][/sub]";
	AddText(AddTxt);
}

function image() {
	AddTxt="[img src=IMAGE LINK]";
	AddText(AddTxt);
}

function ftp() {
	AddTxt="[ftp][/ftp]";
	AddText(AddTxt);
}

function move() {
	AddTxt="[move]STUFF[/move]";
	AddText(AddTxt);
}

function shadow() {
	AddTxt="[shadow=red,left,300]TEXT[/shadow]";
	AddText(AddTxt);
}

function glow() {
	AddTxt="[glow=red,2,300]TEXT[/glow]";
	AddText(AddTxt);
}

function flash() {
	AddTxt="[flash=200,200]URL[/flash]";
	AddText(AddTxt);
}

function pre() {
	AddTxt="[pre][/pre]";
	AddText(AddTxt);
}

function tcol() {
	AddTxt="[td][/td]";
	AddText(AddTxt);
}

function trow() {
	AddTxt="[tr][/tr]";
	AddText(AddTxt);
}

function table() {
	AddTxt="[table][tr][td][/td][/tr][/table]";
	AddText(AddTxt);
}

function strike() {
	AddTxt="[s][/s]";
	AddText(AddTxt);
}

function underline() {
	AddTxt="[u][/u]";
	AddText(AddTxt);
}

function emai1() {
	AddTxt="[a href=mailto:EMAIL_ADDRESS]EMAIL_TEXT[/a]";
	AddText(AddTxt);
}

function bold() {
	AddTxt="[b][/b]";
	AddText(AddTxt);
}

function italicize() {
	AddTxt="[i][/i]";
	AddText(AddTxt);
}

function quote() {
	AddTxt="[quote][/quote]";
	AddText(AddTxt);
}

function center() {
	AddTxt="[center][/center]";
	AddText(AddTxt);
}

function hyperlink() {
	AddTxt="[a href=]LINK NAME[/a]";
	AddText(AddTxt);
}

function pdf() {
	AddTxt="[pdf target='_blank' href=PDF NAME]PDF NAME[/a]";
	AddText(AddTxt);
}

function showcode() {
	AddTxt="[code][/code]";
	AddText(AddTxt);
}

function list() {
	AddTxt="[ul][li][li][li][/ul]";
	AddText(AddTxt);
}

function alist() {
	AddTxt="[dl][dt][/dt][dd][/dd][dd][/dd][/dl]";
	AddText(AddTxt);
}

function paragraph() {
	AddTxt="[p][/p]";
	AddText(AddTxt);
}

function newline() {
	AddTxt="[br]";
	AddText(AddTxt);
}

function blockquote() {
	AddTxt="[blockquote][/blockquote]";
	AddText(AddTxt);
}

function showcolor(color) {
	AddTxt="[color="+color+"][/color]";
	AddText(AddTxt);
}





//--------------------------------------------------------------
function smiley(xmiley) {
	AddTxt="{xyz"+xmiley+"} ";
	AddText(AddTxt);
}

//--------------------------------------------------------------

//--------------------------------------------------------------
function smileym(xmiley) {
	AddTxt="{xyz"+xmiley+"} ";
	alert  (AddTxt);
	AddText(AddTxt);
}

//--------------------------------------------------------------








function goColor(theForm,strColor)
{
	var strChanged = prompt("Enter the text to be formatted:","");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
//		theForm.value = theForm.value + " [color]" + strColor + "[/color]" + strChanged + "[/color/] ";
//		theForm.value = theForm.value + " [/font][font color=" + strColor + "]" + strChanged + "[/font][font class='fldnam10']";
		theForm.value = theForm.value + " [font color=" + strColor + "]" + strChanged + "[/font]";
		theForm.focus();
	}
}


function goText(theForm,strAttribute)
{
	var strChanged = prompt("Enter the text to be formatted:","");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
		theForm.value = theForm.value + " [" + strAttribute + "]" + strChanged + "[/" + strAttribute + "] ";
		theForm.focus();
	}
}

function goSize(theForm,strAttribute)
{
	var strChanged = prompt("Enter the text to be formatted:","");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
		theForm.value = theForm.value + " [font size=" + strAttribute + "]" + strChanged + "[/font]"
		theForm.focus();
	}
}


function goImage(theForm)
{
	var strChanged = prompt("Enter the image name:","");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
		theForm.value = theForm.value + " [img src=images/uploads/events/" + strChanged + " border=0] ";
		theForm.focus();
	}
}

function goURL(theForm)
{
	var strChanged = prompt("Enter the Link address: ","http://");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
		theForm.value = theForm.value + " [a href=" + strChanged + "]" + strChanged + "[/a]"
		theForm.focus();
	}
}

function goMail(theForm)
{
	var strChanged = prompt("Enter the Email Address:","");
	if ((strChanged == "undefined") || (strChanged == "") || (strChanged == null))
	{
		theForm.focus();
	}
	else
	{
		theForm.value = theForm.value + " [a href=mailto:" + strChanged + "]" + strChanged + "[/a]"
		theForm.focus();
	}
}
