<div id="sidebar">
<ul>
	<li>

<center>
<!-- Uncomment and fill in your details if you want to use it. -->
<h3><font color ="#FF0000">Note:</font><br />
These sites are under construction. Here you will soon find information in <i><?php bloginfo('description'); ?></i></h3>
</center>

	<br />
	<p class="about"><i>
	<h2><?php _e('Author'); ?></h2>
		Author information is disabled per default. Uncomment and fill in your details if you want to use it.
		A little something about you, the author. Nothing lengthy, just an overview...
	</p>
	</li>
	<br />
	

	<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?><!-- begin widget -->
	<li>
		<h3><?php _e('Recent Entries'); ?></h3>
		<ul>
		<?php
		$myposts = get_posts('numberposts=5&offset=0&category=0');
		foreach($myposts as $post) :
		setup_postdata($post);
		?>
		<li><span class="left"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span><span class="right"><?php comments_number('(0)','(1)','(%)'); ?></span></li>
		<?php endforeach; ?>
		</ul>
	</li>
	<?php endif; ?>
</ul>				
<div id="sidebar_wrap">
	<div class="left">
		<ul>
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
				<?php echo posts_by_category();	?>
				<p>&nbsp;</p>
			<li>
				<h3><?php _e('Meta'); ?></h3>
				<ul>
					<?php wp_register(); ?>
					<li><?php wp_loginout(); ?></li>
					<?php wp_meta(); ?>
				</ul>
			</li>
			<?php endif; ?>
		</li>
		</ul>
	</div>
	<div class="right">
		<ul>
		<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(3) ) : else : ?>
		<li>
			<p>&nbsp;</p>
			
			
			<!-- googleAds-->
			
			
			<h3><?php _e('Search'); ?></h3>
			<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
				<div>
				<input type="text" class="sidebar_search" value="Searching for ?" onfocus="if (this.value == 'Searching for ?') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Searching for ?';}" name="s" id="s" />
				</div>
			</form>
		</li>
		<li>
			<h3><?php _e('Archives'); ?></h3>
			<ul>
				<?php wp_get_archives('type=monthly'); ?>
			</ul>
		</li>
		<?php endif; ?>
		</ul>
	</div>
	
</div>
	<P>
	<hr />
	<p>&nbsp;</p>
	<h3><?php _e('Links'); ?></h3>
	<ul><?php get_links(-1, '<li>', '</li>', '', FALSE, 'name', FALSE, FALSE, -1, FALSE); ?></ul> 
</div>


<?php

// written by mohammad forgani
// added 20/03/2009
function posts_by_category() {
	global $wpdb, $post;
	$tp = $wpdb->prefix;
	$pc_header = get_option('pc_header');
	$sort_code = 'ORDER BY name ASC, post_date DESC';
	$the_output = NULL;
	$last_posts = (array)$wpdb->get_results("
		SELECT {$tp}terms.name, {$tp}terms.term_id
		FROM {$tp}terms, {$tp}term_taxonomy
		WHERE {$tp}terms.term_id = {$tp}term_taxonomy.term_id
        AND {$tp}term_taxonomy.taxonomy = 'category'
		{$hide_check} 
	");
	if (empty($last_posts)) {return NULL;}
	$the_output .= stripslashes($ddle_header); 
	$used_cats = array();
	$i = 0;
	foreach ($last_posts as $posts) {
		if (in_array($posts->name, $used_cats)) {
			unset($last_posts[$i]);
		} else {
			$used_cats[] = $posts->name;
		}
		$i++;
	}
	$last_posts = array_values($last_posts);
	foreach ($last_posts as $posts) {
	  $the_output .= '<p>&nbsp;</p><li><h3>' . apply_filters('list_cats', $posts->name, $posts) . '</h3></li>';
      $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'" , $r );
      $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND ID IN (Select object_id FROM {$tp}term_relationships, {$tp}terms WHERE {$tp}term_relationships.term_taxonomy_id =" . $posts->term_id . ") ORDER BY post_date DESC");
	  foreach ( $arcresults as $arcresult ) {
	       $the_output .= '<li>&nbsp;&nbsp;<a href="' . get_permalink($arcresult->ID) . '">' . apply_filters('the_title', $arcresult->post_title) . '</a></li>';
	   }
       $the_output .= '';
    }
    return $the_output;
}
?>
