function newToolbar(textarea) {
if ((document.getSelection) || (document.selection && document.selection.createRange)) {
	var toolbar=document.createElement("ul");
	return toolbar;
}
return false;  
}

function addButton(toolbar, id, title, icon, fn) {
var a = document.createElement("a");
a.href = "#";
a.id = 'tb_'.id;
a.title=title;
a.onclick = function() { try { fn() } catch (e) { } return false };
a.tabIndex = 400;
if (icon!="") {
	var img=document.createElement("img");
	img.src = "/images/icons/"+icon+".png";
	/* Standard icon size */
	img.width=24;
	img.height=24;
	img.border=0;
	img.alt=title;
	a.appendChild(img);
} else {
	a.appendChild(document.createTextNode(title));
}
li=document.createElement("li");
li.appendChild(a);
li.className='btn';
toolbar.appendChild(li);
}

function insertToolbar(toolbar, item)
{
var tbc=document.createElement("div");
tbc.className="toolbar";
tbc.id="toolbar";
tbc.appendChild(toolbar);
item.parentNode.insertBefore(tbc, item);
}


