<?php 
	global $post, $query_string, $SMTheme;
	
	
	if (have_posts()) :
	
	
	
	
	if (!isset($_GET['ajaxpage'])) {?> <div class='articles'> <?php }
	
	
	
	
	while (have_posts()) : the_post(); ?>
		<div class='one-post'>

			<div class='post-body'>
			<?php		

			$post_thumbnail_id = get_post_thumbnail_id( $post_id ); 
				$img = wp_get_attachment_image_src( $post_thumbnail_id, 'post-thumbnail' );
				
				if ( $SMTheme->get( 'layout','imgpos' ) == 'alignleft' ) {
					$fimage=(has_post_thumbnail())?'width:'.($img['1']+14).'px; float:left':'';
					$meta=(has_post_thumbnail())?'margin-left:'.($img['1']+34).'px':'';
					
				} elseif ( $SMTheme->get( 'layout','imgpos' ) == 'alignright' ) {
					$fimage=(has_post_thumbnail())?'width:'.($img['1']+14).'px; float:right':'';
					$meta=(has_post_thumbnail())?'margin-right:'.($img['1']+34).'px':'';
					
				} elseif ( $SMTheme->get( 'layout','imgpos' ) == 'aligncenter' ) {
					$fimage=(has_post_thumbnail())?'width:'.($img['1']+14).'px; float:none; margin:0 auto 10px':'';
					$indent=(has_post_thumbnail())?'margin-left:-'.($img['1']/2).'px; left:50%':'';
				} 
			?>
			<div class='fimage <?php echo $SMTheme->get( 'layout','imgpos' ); ?> <?php if(!has_post_thumbnail()) echo 'no_thumb' ?>' style="<?php echo $fimage; ?>">
				<?php // Post featured image
					if(has_post_thumbnail())  {
						if (!is_single()){ ?><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>"> <?php }
							the_post_thumbnail(
								'post-thumbnail',
								array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
							);
						if (!is_single()){ ?></a><?php }
					}

				?>
				<a href='<?php the_permalink(); ?>' class='fimage-more'></a>
			</div>
			
			<div id="post-<?php the_ID(); ?>" <?php post_class("post-caption"); ?>>
			<?php  //Title
			if (!is_single()&&!is_page()) { ?>
				<h2><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>" class='post_ttl'><?php the_title(); ?></a></h2>
			<?php } else { ?>
				<h1><?php the_title(); ?></h1>
			<?php } 

			
			//Post meta (comments, date, categories)
			if (!is_page()) {?><p class='post-meta' style="<?php echo $meta ?>">
			
				<span class='post-date'><img alt="" src="<?php echo get_template_directory_uri(); ?>/images/smt/date.png" class="meta-com-img"><?php echo get_the_date('d M Y'); ?></span>				
				<span class='post-category'><img alt="" src="<?php echo get_template_directory_uri(); ?>/images/smt/category.png" class="meta-com-img"> <?php echo $SMTheme->_('before-category'); ?><?php the_category(', '); ?></span><br />
				
				<?php
				if(comments_open( get_the_ID() ))  {
                    ?> <span class='post-comments'><img alt="" src="<?php echo get_template_directory_uri(); ?>/images/smt/comments.png" class="meta-com-img"><?php comments_popup_link( $SMTheme->_( 'noresponses' ), $SMTheme->_( 'oneresponse' ), $SMTheme->_( 'multiresponse' ) ); ?></span>
				<?php } 
				edit_post_link( $SMTheme->_( 'edit' ), '     |     <span class="edit-link">', '</span>' );
				?>
			</p><?php } ?>
			
			</div>			
			
			
			
			
			
				<?php
				//Post content
				if (!is_single()&&!is_page()) { 
					smtheme_excerpt('echo=1');
					?><a href='<?php the_permalink(); ?>' class='readmore'><?php echo $SMTheme->_( 'readmore' ); ?></a><?php
				} else {
					the_content('');
				}
				wp_link_pages(); ?>
			</div>
		</div>
		
		
		
		
	<?php endwhile; ?>
	
	
	
	
	
	<?php if (!isset($_GET['ajaxpage'])) {?></div><?php } ?>
	
	
	
	
	
	
<?php endif; ?>