function formatText(el,tag) {
	var selectedText=document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);// IE:Moz
	var newText='<'+tag+'>'+selectedText+'</'+tag+'>';
	// Do IE compatible replacements
	if(document.selection){
		document.selection.createRange().text=newText;
	}
	// Do mozilla compatible replacements
	else{
		el.value=el.value.substring(0,el.selectionStart)+newText+el.value.substring(el.selectionEnd,el.value.length);
	}
}
