function setDynamicTitle(node, size, maxwidth) {
	background = '/image/titles/%text.%size.%maxwidth.png'
	background = background.replace('%text', encodeURI(node.firstChild.nodeValue));
	background = background.replace('%size', size);
	background = background.replace('%maxwidth', maxwidth);
	node.style.textIndent = '-3000px';
	node.style.background = "url('" + background + "') no-repeat";
}

function dynamicTitles() {
	configuration = new Array(
		new Array('h1', 14),
		new Array('h2', 11)
	);
	
	for (n = 0; n < configuration.length; n++) {
		name = configuration[n][0];
		size = configuration[n][1];
		nodes = document.getElementById('content').getElementsByTagName(name);
		for (i = 0; i < nodes.length; i++) {
			heading = nodes[i];
			maxwidth = heading.parentNode.clientWidth;
			setDynamicTitle(heading, size, maxwidth);
		}
	}
}

// disable for now:
//window.onload.actions.push(dynamicTitles);
