<ul id="tabs" class="tabs" style="margin:15px 0 0 0">
<li><a href="#" rel="viewed" class="selected">بیشترین بازدید ها</a></li>
<li><a href="#" rel="discussed">موضوعات مهم</a></li>
<li><a href="#" rel="commented">نظرات</a></li>
<li><a href="#" rel="tags">برچسب ها</a></li>
</ul>

<div class="clear"></div>

<div id="viewed" class="tabcontent">
	<?php if (function_exists('get_most_viewed')): ?>
	<ol>
	<?php get_most_viewed('post', $mytheme['viewed']); ?>
	</ol>
	<?php endif; ?>
</div>

<div id="discussed" class="tabcontent">
	<ol>
	<?php
	$now = gmdate("Y-m-d H:i:s",time());
	$ap = $mytheme['commented'];
	$popularposts = "SELECT ID, post_title, post_date, comment_count, COUNT($wpdb->comments.comment_post_ID) AS 'popular' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY popular DESC LIMIT $ap";
	$posts = $wpdb->get_results($popularposts);
	$popular = '';
	if($posts){
	foreach($posts as $post){
	$post_title = stripslashes($post->post_title);
	$post_date = stripslashes($post->post_date);
	$comments = stripslashes($post->comment_count);
	$guid = get_permalink($post->ID);
	$popular .= '<li><a href="'.$guid.'" title="'.$post_title.'">'.$post_title.'</a>
	<span><a href="'.$guid.'#commenting" class="icomment">'.$comments.' comments</a></span></li>';
	}
	}echo $popular;
	?>
	</ol>
</div>

<div id="commented" class="tabcontent"><?php if (function_exists('src_simple_recent_comments')) { src_simple_recent_comments($mytheme['comments'], 30, '', ''); } ?></div>

<div id="tags" class="tabcontent"><?php wp_tag_cloud('smallest=8&largest=22'); ?></div>

<script type="text/javascript">
var tabs=new ddtabcontent("tabs")
tabs.setpersist(false)
tabs.setselectedClassTarget("link")
tabs.init()
</script>