xb.addEvent(window, 'load', headerReSize);

function headerReSize(e)
{
	var pageHeader = document.getElementById('site_title'); // The H2 element used for the heading of each page
	var pageHeaderLink = pageHeader.getElementsByTagName('A')[0]; // The A element inside the H2 which contains the header text
	var maxLinkWidth = pageHeader.offsetWidth - pageHeaderLink.offsetLeft - 30; // Pixel width between the LHS of the A and the RHS of the H2. Extra 30 is for IE6. THis is the width the page heading has to fit into.

	// If the A element runs out of bounds, repeatedly reduce it by 1% until it fits
	var relSize = 100; // Will be used as a percentage for font size
	while (pageHeaderLink.offsetWidth > maxLinkWidth) {
		relSize--;
		pageHeaderLink.style.fontSize = relSize+"%";
	}
}

