//This makes both the left and right column have the same height, regarding the MainCanvas section
var RColMinH;

$(document).ready(function(){
	init_resize();
});

function init_resize()
{
	RColMinH = $('#sidebar').height();
	resize_columns(true);
}

function resize_columns(sifr)
{
	var RefCol = $('#content');
	var RefH = RefCol.height();
	RefH += parseInt(RefCol.css("padding-top"), 10) + parseInt(RefCol.css("padding-bottom"), 10);
	RefH += parseInt(RefCol.css("margin-top"), 10) + parseInt(RefCol.css("margin-bottom"), 10);
	
	var RCol = $('#sidebar');
	var RColH = RCol.height();
	RColH += parseInt(RCol.css("padding-top"), 10) + parseInt(RCol.css("padding-bottom"), 10);
	RColH += parseInt(RCol.css("margin-top"), 10) + parseInt(RCol.css("margin-bottom"), 10);
	
	/* Adjust size of columns to the text div */

		if(RefH > RColMinH)
		{
			//RCol.height(RefH);
			RCol.animate({height:(RefH + 'px')});
		}
		else
		{
			//RCol.height(RColMinH);
			RCol.animate({height:RColMinH + 'px'});
		}

	
	//alert('R Column Height: ' + RCol.height() + '\nRef Column Height: ' + RefCol.height());
	
	if(sifr)
	{
		//Run resize_columns again after sifr is updating the h2 & h3 tags, changing the columns heights
		setTimeout('resize_columns()',2000);	
	}
}
