<?php
$leftcategories = ARRAY(); // initiate
$rightcategories = ARRAY(); // initiate
for ($i = 1; $i <= $Webcolors['leftcatsN']; $i++ ) array_push($leftcategories, $Webcolors['leftcats'.$i]);
for ($i = 1; $i <= $Webcolors['rightcatsN']; $i++ ) array_push($rightcategories, $Webcolors['rightcats'.$i]);
$widgetsArray = array_merge($leftcategories, $rightcategories);
?>
<div id="smallCats">
                                          	<div id="rightSmallCats">
                                              <?php foreach($rightcategories as $section) : ?>
                                              <div class="categoryWidgetSmall">
                                                  <div class="catWidgetTop">
                                                      <h2>
                                                      <a href="<?php print get_category_link($section); ?>" title="<?php print get_cat_name($section); ?>">
													  <?php print get_cat_name($section); ?></a></h2>
                                                      <a href="#" class="catRss"></a>
                                                  </div><!--End Cat Widget Top-->
                                                  <div class="catContent">
                                                      <div class="latestPosts">
                                                      <?php $getposts = new WP_query(); $getposts->query('showposts=1&cat='.$section); ?>
      <?php global $wp_query; $wp_query->in_the_loop = true; ?>
      <?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
                                                                  <div class="latestPost">
                                                                      <div class="postInfo">
                                                                                <h1 class="postTitle"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php the_title(); ?>
            </a></h1>
                                                                                <a href="<?php the_permalink();?>" class="postThumb"><?php the_post_thumbnail(); ?></a>
                                                                                <p>
													<?php the_excerpt_max_charlength('250'); ?> ..
                                                </p>
                                                                            <a href="<?php the_permalink(); ?>" class="postMore">المزيد ..</a>
                                                                            </div><!--End Post Info-->
                                                                  </div><!--End Latest Post-->
                                                                  <?php endwhile; ?>
                                                              </div><!--End Latest Posts-->
                                                              <div class="catPosts">
                                                              	<?php $getposts = new WP_query(); $getposts->query('showposts='.$Webcolors['moreitems'].'&offset=1&cat='.$section); ?>
      <?php global $wp_query; $wp_query->in_the_loop = true; ?>
                                                              <ul>
                                                              	<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
                                                                <li>
                                                                    <a href="<?php the_permalink();?>" class="smallpostThumb">
                                                                    <?php the_post_thumbnail(); ?></a>
                                                                    <a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php echo short_title('...', 5); ?></a>
                                                                </li>
                                                                <?php endwhile; ?>
                                                              </ul>
                                                       </div><!--End smallCatPosts-->
                                                  </div><!--End Cat Content-->
                                                  <div class="catBtm">
                                                  	<a href="<?php print get_category_link($section); ?>" class="smallCatMore">مقالات أكثر ..</a>
                                                  </div><!--End Cat Bottom-->  
                                              </div><!--End Category Widget Small-->
                                              <?php endforeach; ?>
                                            </div><!--End Right Small Cats-->
                                            
                                            <div id="leftSmallCats">
                                              <?php foreach($leftcategories as $section) : ?>
                                              <div class="categoryWidgetSmall">
                                                  <div class="catWidgetTop">
                                                      <h2>
                                                      <a href="<?php print get_category_link($section); ?>" title="<?php print get_cat_name($section); ?>">
													  <?php print get_cat_name($section); ?></a></h2>
                                                      <a href="#" class="catRss"></a>
                                                  </div><!--End Cat Widget Top-->
                                                  <div class="catContent">
                                                      <div class="latestPosts">
                                                      <?php $getposts = new WP_query(); $getposts->query('showposts=1&cat='.$section); ?>
      <?php global $wp_query; $wp_query->in_the_loop = true; ?>
      <?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
                                                                  <div class="latestPost">
                                                                      <div class="postInfo">
                                                                                <h1 class="postTitle"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php the_title(); ?>
            </a></h1>
                                                                                <a href="<?php the_permalink();?>" class="postThumb"><?php the_post_thumbnail(); ?></a>
                                                                                <p>
													<?php the_excerpt_max_charlength('300'); ?> ..
                                                </p>
                                                                            <a href="<?php the_permalink(); ?>" class="postMore">المزيد ..</a>
                                                                            </div><!--End Post Info-->
                                                                  </div><!--End Latest Post-->
                                                                  <?php endwhile; ?>
                                                              </div><!--End Latest Posts-->
                                                              <div class="catPosts">
                                                              	<?php $getposts = new WP_query(); $getposts->query('showposts='.$Webcolors['moreitems'].'&offset=1&cat='.$section); ?>
      <?php global $wp_query; $wp_query->in_the_loop = true; ?>
                                                              <ul>
                                                              	<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
                                                                <li>
                                                                    <a href="<?php the_permalink();?>" class="smallpostThumb">
                                                                    <?php the_post_thumbnail(); ?></a>
                                                                    <a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php echo short_title('...', 5); ?></a>
                                                                </li>
                                                                <?php endwhile; ?>
                                                              </ul>
                                                       </div><!--End smallCatPosts-->
                                                  </div><!--End Cat Content-->
                                                  <div class="catBtm">
                                                  	<a href="<?php print get_category_link($section); ?>" class="smallCatMore">مقالات أكثر ..</a>
                                                  </div><!--End Cat Bottom-->  
                                              </div><!--End Category Widget Small-->
                                              <?php endforeach; ?>
                                            </div><!--End Left Small Cats-->
                                          </div><!--End Small Cats-->