function insertAtCaret(obj, string)
{

if (string = ' ')
{
var site = prompt("Type the URL of the web site.", "http://");

var sitename = prompt("Type the title of the web site.", site);

string = '<a href="' + site + '" target="_blank">'
+ sitename
+ '</a>';
}

obj.focus();

if (typeof(document.selection) != 'undefined')
{
var range = document.selection.createRange();

if (range.parentElement() != obj)
return;

range.text = string;
range.select();
}
else if (typeof(obj.selectionStart) != 'undefined')
{
var start = obj.selectionStart;

obj.value = obj.value.substr(0, start)
+ string
+ obj.value.substr(obj.selectionEnd, obj.value.length);

start += string.length;
obj.setSelectionRange(start, start);
}
else
obj.value += string;

obj.focus();
}
