function getListById()
{
	// Get the required list element (OL/UL)
	var listElement = document.getElementById("mainList");
	
	// Get the width of the list element (if it's been found)
	if (listElement)
	{
		var listWidth = listElement.offsetWidth;

		// Get the child LI elements for the list
		var listItems = document.getElementsByTagName("li");

		// Now we have the width of the list and the number of items, let's work out the size for each LI element

		// We have to take in to account any padding or margins set on the LI elements and remove it from the total
		var listItemWidth = listWidth/listItems.length;

		// We need to loop through each LI element and dynamically set the width
		for(var i = 0; i < listItems.length; i++)
		{
			listItems[i].style.width = listItemWidth-1 + 'px';
			listItems[i].style.display = 'block';
		}
	}
}

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if (oldonload)
			{
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(getListById);

//window.onload = getListById('mainList');