$(document).ready(function(){
  if ($.browser.msie && $.browser.version == 7) {

	console.log("You're using IE7, time to fix some layout");
	
	var tc_layout_classes = new Array( ".half", ".third", ".two_third", ".quarter", ".fifth", ".sixth", ".eighth", ".two_third");
 	
	for (var i = 0; i < tc_layout_classes.length; i++) {
		$( tc_layout_classes[i] + ' + .gutter' ).each( function( index ) {
//			$(this).prev().css('background-color', 'red');
			$(this).prev().css( 'min-width', $(this).prev().outerWidth()-15 );
			$(this).prev().width( $(this).prev().outerWidth()-15);
			});
			
		$('.gutter + ' + tc_layout_classes[i]).each( function( index ) {
//			$(this).css('background-color', 'orange');
			$(this).css( 'min-width', $(this).outerWidth()-15 );
			$(this).width( $(this).outerWidth()-15);
			});

		}

 		$('.clearafter').each( function( index ) {
			$(this).after('<div style="clear:both; display: block; height: 0px; width: 100%;"></div>');
			});
			
 		$('.clearbefore').each( function( index ) {
			$(this).before('<div style="clear:both; display: block; height: 0px; width: 100%;"></div>');
			});

 	
	  } // if is IE7
	});
