

<?php 
	if(strpos($classes, "first") !== false ) $blocknum = " rt-alpha";
	elseif(strpos($classes, "last") !== false) $blocknum = " rt-omega";
	else $blocknum = "";
	
	$sidebarCount = count(block_list('sidebar')); 
	$sidebarCount2 = count(block_list('sidebar2'));
	
	$totalSidebar = $sidebarCount + $sidebarCount2;
	
	if($sidebarCount > 0 AND $sidebarCount2 > 0)
		$mbGrid = quasar_getMBgrid(2);
	elseif(($sidebarCount > 0 AND $sidebarCount2 == 0) OR ($sidebarCount == 0 AND $sidebarCount2 > 0))
		$mbGrid = quasar_getMBgrid(1);
	else {
		$mbGrid = quasar_getMBgrid(0);
	}
	
	$maingrid = $mbGrid[0];
	
	if($block_count>3) {
		$bottomgrid = $maingrid/3;
	}
	else {
		$bottomgrid = $maingrid/$block_count;
	}
	
	if($blocknum == " rt-alpha") {
		$bottomgrid = ceil($bottomgrid);
	}
	else {
		$bottomgrid = floor($bottomgrid);
	}
?>


<?php if($block_id <= 3) : ?>

<div class="rt-grid-<?=$bottomgrid;?><?=$blocknum;?>">


	<?php if (module_exists('block_class')) : ?>
	<div class="<?php print block_class($block); ?>">
	<?php endif; ?>
	
	
	<?php if (module_exists('block_class')) : ?>
	<div class="<?php print block_class($block); ?>">
	<?php endif; ?>
	
		<div class="rt-block">
			<div class="module-surround">
				<div class="module-icon"></div>
				<?php if ($block->subject) : ?>
					
						<div class="module-title">
							<h2 class="title"><?php print $block->subject; ?></h2>
						</div>
					
				<?php endif; ?>
				
				
					
				<div class="module-content">
					<?php print $content; ?>
					<div class="clear"></div>
				</div>
				
			</div>
					
		</div>
	
	
	
	<?php if (module_exists('block_class')) : ?>
	</div>
	<?php endif; ?>
	
	
	<?php if (module_exists('block_class')) : ?>
	</div>
	<?php endif; ?>

</div>
<?php endif; ?>