var Site = {
	
	start: function(){
		if ($('portfolio')) Site.parseGalleries();
	},
	
	parseGalleries: function(){
		var galleries = $$('#portfolio a');
		var fx = new Fx.Elements(galleries, {wait: false, duration: 200, transition: Fx.Transitions.quadOut});
		galleries.each(function(gallery, i){
			gallery.addEvent('mouseenter', function(e){
				var obj = {};
				obj[i] = {
					'width': [gallery.getStyle('width').toInt(), 300]
				};
				galleries.each(function(other, j){
					if (other != gallery){
						var w = other.getStyle('width').toInt();
						if (w != 160) obj[j] = {'width': [w, 160]};
					}
				});
				fx.start(obj);
			});
		});
		
		galleries.addEvent('mouseleave', function(e){
			var obj = {};
			galleries.each(function(other, j){
				obj[j] = {'width': [other.getStyle('width').toInt(), 188]};
			});
			fx.start(obj);
		});
	}
};

window.addEvent('load', Site.start);