<?php
function lioit_small_box($cat) { ?>
<?php
		global $data;
		global $post;
		$small_cat = stripslashes($data['smallbox_'.$cat]); 
		$category_id = get_cat_ID($small_cat);
		


		
		?>
<div class="smallNewsBox">
  <div class="smallNewsBoxTop">
    <div class="smallNewsBoxTitle"> <a href="<?php echo get_category_link($category_id); ?>">
      <h2><?php echo get_cat_name($category_id); ?></h2>
      </a> </div>
    <!--End smallNews PostsTitle--> 
    <span class="titleArrow"></span> <a href="#" class="whiteRss"></a> </div>
  <!--End smallNewsPostsTop-->
  <div class="contentBox">
    <?php query_posts(array('showposts' => 1, 'cat' => $category_id )); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="smallNewsBoxPost">
      <div class="smallNewsBoxPostThumb ThumbCover">
        <div class="cover" style="top: 100%;"> <a class="postype" href="<?php the_permalink(); ?>"></a> <a class="detail" href="<?php the_permalink(); ?>" title="View detail"></a> </div>
        <?php $img = catch_that_image($post->ID); ?>
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <img src="<?php echo Lioit_URI; ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;w=260&amp;h=180&amp;zc=1" alt="<?php the_title(); ?>" /> </a> </div>
      <!--End smallNewsPostThumb-->
      <?php $type_badge = get_post_meta($post->ID, 'lioit_post_type', true);?>
      <h1 class="smallNewsBoxPostTitle">
        <div class="<?php echo $type_badge; ?> articleType"></div>
        <a href="<?php the_permalink();?>">
        <?php the_title();?>
        </a></h1>
      <p>
        <?php the_excerpt_max_charlength('120'); ?>
        ...</p>
      <div class="smallNewsBoxPostDetails">
        <ul class="postMeta">
          <li class="postDate">
            <?php the_time('F d, Y'); ?>
          </li>
          <li class="postComments"><a href="<?php comments_link();?>">
            <?php comments_number('0 Comments','1 Comment','% Comments');?>
            </a></li>
        </ul>
        <!--End smallNewspostMeta--> 
      </div>
      <!--End smallNewsPostDetails--> 
    </div>
    <!--End smallNewsBoxPost-->
    <?php endwhile; ?>
    <?php  else:  ?>
    <!-- Else in here -->
    <?php  endif; ?>
    <?php wp_reset_query(); ?>
    <div class="smallNewsBoxList">
      <?php query_posts(array('showposts' => 2,'offset' => 1, 'cat' => $category_id )); ?>
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <div class="smallNewsBoxListPost">
      	
        <div class="smallNewsBoxListPostThumb ThumbCover">
          <div class="cover" style="top: 100%;"> <a class="postype" href="<?php the_permalink(); ?>"></a> <a class="detail" href="<?php the_permalink(); ?>" title="View detail"></a> </div>
          <?php $img = catch_that_image($post->ID); ?>
          <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <img src="<?php echo Lioit_URI; ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;w=70&amp;h=70&amp;zc=1" alt="<?php the_title(); ?>" /> </a> </div>
        <!--End smallNewsBoxListPostThumb-->
        <div class="smallNewsBoxListPostDetails">
          <?php $type_badge = get_post_meta($post->ID, 'lioit_post_type', true);?>
      	<h1 class="smallNewsBoxListPostTitle"><div class="<?php echo $type_badge; ?> articleType"></div><a href="<?php the_permalink();?>">
            <?php the_title();?>
            </a></h1>
          <ul class="postMeta">
          	
            <li class="postDate">
              <?php the_time('F d, Y'); ?>
            </li>
            <li class="postComments"><a href="<?php comments_link();?>">
              <?php comments_number('0 Comments','1 Comment','% Comments');?>
              </a></li>
          </ul>
          <!--End postMeta--> 
        </div>
        <!--End smallNewsBoxListPostDetails--> 
      </div>
      <!--End smallNewsBoxListPost-->
      <?php endwhile; ?>
      <?php  else:  ?>
      <!-- Else in here -->
      <?php  endif; ?>
      <?php wp_reset_query(); ?>
    </div>
    <!--End NewsBoxList-->
    <div class="smallNewsBoxMore">
      <ul>
        <?php query_posts(array('showposts' => 3,'offset' => 3, 'cat' => $category_id )); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <li>
          <h4 class="smallNewsBoxListPostTitle"><a href="<?php the_permalink();?>"><span>
            <?php _e('&raquo;', 'lioit'); ?>
            </span>
            <?php $title = the_title('','',FALSE); echo substr($title, 0, 40); ?>
            ..</a></h4>
        </li>
        <?php endwhile; ?>
        <?php  else:  ?>
        <!-- Else in here -->
        <?php  endif; ?>
        <?php wp_reset_query(); ?>
      </ul>
    </div>
    <!--End smallNewsBoxMore--> 
  </div>
  <!--End ContentBox--> 
</div>
<!--End NewsBox-->
<?php
}
?>