function pageLoaded()
{
/*
	if (document.getElementById('TOC') != null)
	{
		buildTOC();
	}
*/
}

function buildTOC() {
	var toc = '<blockquote>';
	var head;
	var anchors = document.getElementsByTagName('a')
	window.alert(anchors.length);
	for (var i = 0; i < anchors.length; i++ ) 
	{
		
		if (anchors[i].hasChildNodes) 
		{
		
			head = anchors[i].firstChild;
			
			if (head.tagName == 'h1') {
				window.alert(head.textContent);
				toc += head.textContent + "<br/>\n";
			}	else if (head.tagName == 'h2') {
				toc += '-- ' + head.textContent + "<br/>\n"; 
			}
			
		}
	}
	toc += "</blockquote>\n";
	document.getElementById('TOC').innerHTML = toc;
	window.alert(toc);
}