<?php if(!ts_get_option('ts_subpage_teasers') && !get_post_meta($post->ID, "teasers_value", true)) : ?>

<div class="subpages clearfix">
	
	<?php
	    $pages = get_pages('sort_column=menu_order&child_of='.$post->ID.'&parent='.$post->ID.'&exclude='.get_post_meta($post->ID, "teasers_ex_value", true)); $i = 1;
	    foreach($pages as $page) : ?>
	    
	    <?php if($i==1) : ?><div class="content-space"></div><?php endif; ?>
	
	    <div class="box clearfix <?php if($i%2==0) : ?>box-alt<?php endif; ?>">
	
	    	<a href="<?php echo get_page_link($page->ID); ?>">
	    	
	    		<?php if((function_exists('has_post_thumbnail')) && (get_the_post_thumbnail($page->ID, 'dl-thumb'))) : ?>
				
				<?php echo get_the_post_thumbnail($page->ID, 'dl-thumb', array('alt' => ''.$page->post_title.'', 'title' => ''.$page->post_title.'')); ?>
			
				<?php elseif(get_post_meta($page->ID, 'image_value', true)) : ?>
			
				<img src="<?php bloginfo('template_url'); ?>/lib/scripts/thumb.php?src=<?php echo ts_image(get_post_meta($page->ID, "image_value", true)); ?>&amp;w=260&amp;h=140&amp;zc=1&amp;q=95" alt="<?php echo $page->post_title; ?>" width="260" height="140"/>
				
				<?php else : ?>
				
	    		<img src="<?php echo TS_IMG; ?>subpages-default.jpg" alt="<?php echo $page->post_title ?>" width="260" height="140"/>
			
				<?php endif; // endif post thumbnail ?>
	    		<span class="overlay4"></span>
	    	</a>
	    	<h3><a href="<?php echo get_page_link($page->ID) ?>" rel="bookmark" title="<?php echo $page->post_title ?>"><?php echo $page->post_title ?></a></h3>
	    	
	    </div><!-- end post -->
	    
	<?php $i++; endforeach; ?>

</div>

<?php endif; ?>