jQuery(document).ready(function() {
	// Last two widgets needed to have special class
	var  footerWidgets = jQuery(".footerwidget");
	var  noFooterWidgets = footerWidgets.length;
	var indexLastTwo = noFooterWidgets-3;
	jQuery(".footerwidget:first-child").addClass('first');
	jQuery(".footerwidget").slice(-2).addClass('lineup');
	
	// Auto divide widget width based on the number of widgets minus two
 	var curWidth=jQuery("#footer_widgets").css('width');
	var indexBeforeLastTwo = noFooterWidgets-2;
	var boxWidth = parseInt(curWidth)/parseInt(indexBeforeLastTwo);
	
	jQuery(".footerwidget:lt("+indexBeforeLastTwo+")").css("width",boxWidth-subTract)
	
	// Auto Height the footer
	var tallest = 0; 
	jQuery.each(footerWidgets, function(i, val) { 
      var height = val.offsetHeight;
	  if(height>tallest){
		tallest = height;
	  }
	  return (i!=indexLastTwo);
    });
	
	jQuery(".footerwidget:lt("+indexBeforeLastTwo+")").css("height",tallest+20);
	
	// Last Item on Blog Nav no border line
	jQuery(".widget_authors ul li:last-child").addClass('last');
	// Last icon multi on hp secondaray widget area has no bottom divider
	jQuery("#hp_secondary_widgets .icon_multi:last-child").addClass('last');
	
	jQuery(".cat-item:last-child").addClass('last');

});	
