<?php
/**
 * The Sidebar containing the footer widget areas.
 *
 * @package circles
 * @since circles 1.0
 */
$sidebars = array();
for ($i = 1; $i <= 4; $i ++) {
	if (is_active_sidebar('footer-area-'.$i)) {
		$sidebars[] = 'footer-area-'.$i;
	}
}

if (count($sidebars) == 4) {
	$j = 4;
	$class = 'grid_3';
} else {
	$j = 3;
	$class = 'grid_4';
}

for ($i = 0; $i < $j; $i ++) { ?>
	<div class='<?php echo $class; ?>'>
		<?php if (isset($sidebars[$i])) {
			dynamic_sidebar( $sidebars[$i] );
		} ?>
	</div>
<?php }
