$(document).ready(function(){	
	$.each($('.main_content'), function() {
		$('hr', this).replaceWith('--pagebreaker--');	
		var columns = $(this).html().split('--pagebreaker--');
		var padding = 20;
		//determine the width based upon how many columns with fixed padding of 20px
		var column_width = (($(this).width()- ((columns.length -1) * padding)) / columns.length);	
		
		//clear the existing content
		$(this).html('');	
		for (var i = 0; i < columns.length; i++){
			$(this).append('<div class="column column_'+i+'"></div>');
			var new_elm = $('.column_'+i, this);
			new_elm.css('width',column_width+'px');
			new_elm.css('float','left');		
			//for every column except the last add in som right padding
			if (i < columns.length -1){
				new_elm.css('padding-right',padding +'px');
			}		
		}	
		var count = 0;
		$.each($('.column',this), function() { 
			$(this).html(columns[count]);		
			count++;		
		});																			
	});
	
});
