function grabtext(element,sTag,eTag) {
	var textElement = $(element);
	if( textElement.selectionStart != "undefined" ) {
		var selLength = textElement.textLength;
		var selStart = textElement.selectionStart;
		var selEnd = textElement.selectionEnd;
		if (selEnd == 1 || selEnd == 2)	selEnd = selLength;
		var s1 = (textElement.value).substring(0,selStart);
		var s2 = (textElement.value).substring(selStart, selEnd)
		var s3 = (textElement.value).substring(selEnd, selLength);
		textElement.value = s1 + sTag + s2 + eTag + s3;
		textElement.focus();
		return;		
	} else {
		textElement.focus();
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			textElement.value += sTag + eTag;
			textElement.focus();
			return;
		}
		document.selection.createRange().text = sTag + theSelection + eTag;
		textElement.focus();
		return;
	}
	return;
}