
function ReplaceSyntax(frm, resultfld, dowhat){//String containing selected text
	var SelectedString = document.selection.createRange().text;  //alert(SelectedString);
	if(SelectedString.length >0) {
		//String containing updated SelectedString
		if(dowhat == 'p') 
			var ReplaceString = "<"+dowhat+">"+SelectedString;//  alert(ReplaceString);
		else 
			var ReplaceString = "<"+dowhat+">"+SelectedString+"</"+dowhat+">";//  alert(ReplaceString);
		//assign the replace string value to the selected string
		document.selection.createRange().text = ReplaceString;
	}
}

function Pop(Url, WinW, WinH) {
	if (document.all)
		var xMax = screen.width, yMax = screen.height;
	else
		if (document.layers)
			var xMax = window.outerWidth, yMax = window.outerHeight;
		else
			var xMax = 640, yMax=480;

	var xOffset = (xMax - WinH)/2, yOffset = (yMax - WinW)/2;

	var features =
		' width='+ WinW +
		', height='+ WinH +
		', directories=no'+
		', location=no'+
		', menubar=no'+
		', scrollbars=yes'+
		', status=no'+
		', toolbar=no'+
		', resizable=yes'+
		', screenX='+ xOffset +
		', screenY='+ yOffset +
		', top='+ yOffset +
		', left='+ xOffset
	popup = window.open (Url, 'PopUp', features);
	popup.focus();
}