{include 'sorting.php'}

{foreach $posts as $item}
{first}<ul class="items">{/first}
	<li class="item clear{ifset $item->packageClass} {$item->packageClass}{/ifset}{ifset $item->optionsDir['featured']} featured{/ifset}">
		{if $item->thumbnailDir}
		<div class="thumbnail">
			<a href="{!$item->link}"><img src="{thumbnailResize $item->thumbnailDir, w => 155, h => 115}" alt="{__ 'Item thumbnail'}"></a>
		</div>
		{/if}
		<div class="description">
			<div class="desc-head">
				<h3><a href="{!$item->link}">{$item->post_title}</a></h3>
				{if $item->rating}
				<div class="item-rating">
					{for $i = 1; $i <= $item->rating['max']; $i++}
						<div class="star{if $i <= $item->rating['val']} active{/if}"></div>
					{/for}
				</div>
				{/if}
				{var $lp = getTourPrice($item->ID)}
				{if $lp}<div class="item-price"><span><span>{$lp}</span></span></div>{/if}
			</div>
			<div class="desc-text">
			{!$item->excerptDir}
			</div>
		</div>	
		<!-- tour offers -->
		{ifset $GLOBALS['findedOffers'][$item->ID]}
			{if count($GLOBALS['findedOffers'][$item->ID]) > 0}
			<table class="item-offers">
				{foreach $GLOBALS['findedOffers'][$item->ID] as $offer}
				<tr class="offer">
					<td class="offer-title"><a href="{add_query_arg(array('offer' => $offer->ID),$item->link)}">{$offer->post_title}</a></td>
					<td class="offer-date">{$offer->from} - {$offer->to}</td>
					<td class="offer-price">{$offer->price}</td>
				</tr>
				{/foreach}
			</table>
			{/if}
		{/ifset}
	</li>
{last}</ul>{/last}
{/foreach}
