function startProcessing()
{
	if(!document.getElementById || !document.getElementsByTagName)
	{
		// Unssupported browser, go away!
		return;
	}
	
	var i;
	
	// Handle section navigation hovers
	var preloadArray = 
	[
		'/img/titles/section_nav/about_me_hover.gif',
		'/img/titles/section_nav/blog_hover.gif',
		'/img/titles/section_nav/portfolio_hover.gif'
	];
	
	var sectionLinks = document.getElementById('section_nav').getElementsByTagName('A');
	for(i = 0; i < sectionLinks.length; i++)
	{
		sectionLinks[i].onmouseover = function()
		{
			var img = this.childNodes[0];
			// The following replace will fail in a word with more than one space
			img.src = '/img/titles/section_nav/' + img.alt.replace(' ', '_') + '_hover.gif';
		}
		
		sectionLinks[i].onmouseout = function()
		{
			var img = this.childNodes[0];
			// The following replace will fail in a word with more than one space
			img.src = '/img/titles/section_nav/' + img.alt.replace(' ', '_') + '.gif';
		}
	}
	
	// sidebar navigation hovers
	if(document.body.id && document.body.id == 'portfolio')
	{
		var links;
		var DTs = document.getElementById('sidebar').getElementsByTagName('DT');
		for(i = 0; i < DTs.length; i++)
		{
			links = DTs[i].getElementsByTagName('A');
			if(links[0])
			{
				preloadArray[preloadArray.length] = links[0].childNodes[0].src.replace('_.gif', '.gif');
				
				links[0].onmouseover = function()
				{
					var img = this.childNodes[0];
					img.src = '/img/titles/sidebar/' + img.alt + '.gif';
				}
				
				links[0].onmouseout = function()
				{
					var img = this.childNodes[0];
					img.src = '/img/titles/sidebar/' + img.alt + '_.gif';
				}
			}
		}
	}
	
	
	preload(preloadArray);
}

/**
 * Preload some images
 * @param {Array} images Array of images
 */
function preload(images)
{
	var i;
	var length = images.length;
	window.preloadArray = [];
	for(i = 0; i < length; i++)
	{
		preloadArray[i] = new Image();
		preloadArray[i].src = images[i];
	}
}

if (document.daddEventListener)
{
	document.addEventListener('DOMContentLoaded', startProcessing, false);
}
else
{
	window.onload = startProcessing;
}