var oldFontSize = 13;


function changePadding() {
	var totalWidth = 0;
	var menuItemCount = 0;
	var menuItems = document.getElementsByTagName('a');
	var menuItemsLI = document.getElementsByTagName('li');
		
	for (var i = 0; i < menuItems.length; i++) {
			
		if (menuItems[i].className == 'menuItem') {
			w = menuItems[i].offsetWidth;
			totalWidth += w;
			menuItemCount++;
		}
			
	}

	var padding = Math.round(((870 - totalWidth)/2)/menuItemCount) + 'px';
	if (padding < 0)
		padding = 0;
			
	for (var i = 0; i < menuItemsLI.length; i++) {
		if (menuItemsLI[i].className == 'menuItem') {
			menuItemsLI[i].style.paddingLeft = padding;
			menuItemsLI[i].style.paddingRight = padding;
		}
	}
		
}	


function getFontSize() {
	if (document.body.currentStyle) { 				// IE
		var newFontSize = document.body.currentStyle['fontSize']; 
	} else if (window.getComputedStyle) {			// FF, Opera 
		var newFontSize = document.defaultView.getComputedStyle(document.body,null).getPropertyValue('font-size'); 
	}

	return newFontSize;
}


function checkFontSize() {
	if (oldFontSize != getFontSize()) {
		changePadding();
	}
}


function documentLoad() {
	changePadding();

	var oldFontSize = getFontSize();
	setInterval("checkFontSize()", 100);
}
