// <!--

// function to insert smileys where cursor is in a given textfield
function insertAtCursor(TextField, smileyCode, smileyLength)
{
	if (smileyCode != null)
	{
		//IE support
		if (document.selection)
		{
			TextField.focus();
			var selectionRange = document.selection.createRange();
			selectionRange.text = smileyCode;
		}
		
		//MOZILLA/NETSCAPE support
		else if (TextField.selectionStart || TextField.selectionStart == '0')
		{
			var startPos = TextField.selectionStart;
			var endPos = TextField.selectionEnd;
			var newPosition = startPos + smileyLength + 1;
			TextField.value = TextField.value.substring(0, startPos) + smileyCode + TextField.value.substring(endPos, TextField.value.length);
			TextField.focus();
			TextField.setSelectionRange(newPosition, newPosition);
		}
		
		// else, just add the smiley at the end of the text
		else
		{
			TextField.value += smileyCode;
		}
		
	}
}


//function to count how many characters there are in a text area
function CountChars(textElement, target)
{
	var textElementLength = textElement.value;
	var textElementLength = textElementLength.length;		
	var targetElement = document.getElementById(target);
	targetElement.innerHTML = textElementLength;
}

// --> 