

$(document).ready(function() { 
	col1 = $('.column:first')
	col2 = $('.column:eq(1)')
	col3 = $('.column:eq(2)')
	col4 = $('.column:eq(3)')

	numcolbreaks=col1.find('hr').length;
	arr=col1.find('hr').addClass('column-break');
	kids=col1.children();
	j=kids.length;
	columnnum=2;
	var column;
	for(i=0;i<j;i++){
		if (columnnum<=3){
			if (column){j--;i--;col1.children().eq(i).appendTo(column);}
			if (col1.children().eq(i).hasClass('column-break')){column=$('.column:eq('+columnnum+')');columnnum++;i++;j++;}
		}
	}

	col1.children().detach('.column-break');

	col1.children().last().appendTo(col2);
	h1 = col1.height();
	h2 = col2.height();

	while (h1>h2){
		col1.children().last().insertBefore(col2.children().first());
		h1 = col1.height();
		h2 = col2.height();
	}
	col2.children().first().appendTo(col1);


	col3.children().last().appendTo(col4);
	h1 = col3.height();
	h2 = col4.height();

	while (h1>h2){
		col3.children().last().insertBefore(col4.children().first());
		h1 = col3.height();
		h2 = col4.height();
	}
	col4.children().first().appendTo(col3);
});
