var VerticalAligner = Class.create(
{
	initialize: function(mainColId, leftColId, colHeights)
	{
		if($(mainColId) && $(leftColId))
		{
			var mainColHeight = colHeights.mainCol;
			var leftColHeight = colHeights.leftCol;
			
			//console.log('main: '+mainColHeight+' - left: '+leftColHeight);
			
			if(mainColHeight > leftColHeight)
			{
				var boxheight = $('taste-life').offsetHeight;
				var oldHeight = (leftColHeight - boxheight);
				var newHeight = (leftColHeight-oldHeight)-20;
				//alert(document.getElementById('taste-life').offsetHeight);
				if(boxheight != newHeight)
					this.resizeBox($('taste-life'), newHeight);
			}
			else
				this.resizeBox(mainColId, leftColHeight);				
		}
	},
	
	resizeBox: function(elemId, height)
	{
		new Effect.Morph(elemId,
		{
			style: 'height:'+height+'px'
		});
	}
});
Event.observe(window, 'load', function()
{
	if($$('#main-col .content')[0])
	{
		if($$('.search-results')[0] || $('article'))
		{
			var mainColElem = $$('#main-col .content')[0];
			if($$('#side-col')[0])
			{
				var leftColElem = $$('#side-col')[0];
				
				if($('article'))
					var newLeftColHeight = ($(leftColElem).offsetHeight-46);
				else
					var newLeftColHeight = ($(leftColElem).offsetHeight-40);
		
				var SearchResultColumns = new VerticalAligner(mainColElem, leftColElem , 
				{ 
					mainCol: $(mainColElem).offsetHeight, 
					leftCol: newLeftColHeight
				});
			}
		}			
	}
});