/* adds the print and bookmark buttons */
window.onload = function() {
	if(!document.getElementById) return;
	var insertionpoint = $('insertion-point');
	if(!insertionpoint) return;
	var canvas = insertionpoint.parentNode;
	
	/* add the print link */
	var print_a = document.createElement('a');
	print_a.setAttribute('href', '#');
	print_a.setAttribute('title', 'Prints this document');
	print_a.onclick = function() { window.print(); return false; }
	print_a.appendChild(document.createTextNode('Print'));
	var print_li = document.createElement('li');
	print_li.setAttribute('id', 'print-link');
	print_li.appendChild(print_a);
	canvas.insertBefore(print_li, insertionpoint);
	
	/* add the bookmark link (ie only) */
	if(!window.external) return;
	var bookmark_a = document.createElement('a');
	bookmark_a.setAttribute('href', '#');
	bookmark_a.setAttribute('title', 'Bookmarks this document');
	bookmark_a.onclick = function() { window.external.AddFavorite(location.href, document.title); return false; }
	bookmark_a.appendChild(document.createTextNode('Bookmark'));
	var bookmark_li = document.createElement('li');
	bookmark_li.setAttribute('id', 'bookmark-link');
	bookmark_li.appendChild(bookmark_a);
	canvas.insertBefore(bookmark_li, insertionpoint);
}

function $(id) { return document.getElementById(id); }