var NavMenu = {
	start: function() {
		NavMenu.parseItems();
	},

	parseItems: function() {
		var squeeze_to = 41;
		var max_width = 163;

		//get original widths
		var start_widths = new Array();
		var items = $$('#navMenu a');
		var fx = new Fx.Elements(items, {wait: false, duration: 400, transition:Fx.Transitions.Cubic.easeOut});
		items.each(function(item, i) {
			start_widths[i] = item.getStyle('width').toInt();

			//mouse is in, squeeze and expand
			item.addEvent('mouseenter', function(e) {
				var obj = {};
				obj[i] = { 'width': [item.getStyle('width').toInt(), max_width] };

				var counter = 0;
				items.each(function(other, j) {
					if (other != item) {
						var w = other.getStyle('width').toInt();
						if (w != squeeze_to) obj[j] = { 'width': [w,squeeze_to] };
					}
				});
				fx.start(obj);
			}
			);
		});

		//mouse is out, squeeze back
		$('navMenu').addEvent('mouseleave', function(e) {
			var obj = {};
			items.each(function(other, j) {
				obj[j] = {'width': [other.getStyle('width').toInt(), start_widths[j]] };
			});
			fx.start(obj);
		});
	}
};

window.addEvent('domready', NavMenu.start);