<?php
global $news;
load_theme_textdomain('news', TEMPLATEPATH.'/languages/');
wp_head();
?>

<div id="wrapper">

<!-- time, weather, hot news -->
<div id="top">

	<?php if (!empty($news['headerdate'])) { ?><div id="date"><?php echo date($news['headerdate']); ?></div><?php } ?>

	<?php if ($news['showhotnews'] == 1) { ?>

	<?php $display = new WP_query(); $display->query('showposts='.$news['hotnewsnum'].'&meta_key=hotnews'); ?>
	<?php global $wp_query; $wp_query->in_the_loop = true; ?>
	<?php if ($display->have_posts()) : ?>
	<ul id="hotnewshide">
		<?php for ($i = 1; $i <= $display->post_count; $i++) { ?>
		<li><?php echo $i; ?></li>
		<?php } ?>
	</ul>

	<div id="hotnews">
		<ul>
			<?php while ($display->have_posts()) : $display->the_post(); ?>
			<li><span class="category"><?php dt_category(); ?></span><span class="heading"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span><span class="info"><?php the_time('d.m.Y'); ?> | <a href="<?php the_permalink(); ?>#comments"><?php comments_number(__('0 comments','news'), __('1 comment','news'), __('% comments','news')); ?></a></span></li>
			<?php endwhile; ?>
		</ul>
	</div>
	<?php endif; ?>
	
	<?php } ?>

	<?php require_once TEMPLATEPATH.'/lib/weather/show.weather.php'; ?>

<div class="clear"></div>
</div>
<!-- time, weather, hot news -->

<!-- logo, ad -->
<div id="header">
	<div id="logo"><a href="<?php bloginfo('home'); ?>/" title="<?php bloginfo('name'); ?>"><?php dt_logo_image(); ?></a></div>
	<?php dt_show_ads('position=Header&before=<div class="header-ad">&after=</div>'); ?>
<div class="clear"></div>
</div>
<!-- logo, ad -->

<!-- navigation -->
<div id="force-menu">
<?php if ($news['nav_custom'] == 0) { ?>
<ul id="menu">
	<li<?php if (is_home()) { echo ' class="current-cat" '; } ?>><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Home','news'); ?>"><?php _e('Home','news'); ?></a></li>
	<?php
	$categories = wp_list_categories('orderby='.$news['nav_sort'].'&order='.$news['nav_order'].'&hide_empty='.$news['nav_hide_empty'].'&title_li=&echo=0'); 
	$categories = preg_replace('/View all posts filed under /','',$categories);
	echo $categories;
	?>
</ul><div class="clear"></div>
<?php
} else {
wp_nav_menu( array( 'theme_location' => 'nav', 'container' => '', 'menu_id' => 'menu', 'menu_class' => '') );
}
?>
</div>
<!-- navigation -->

<!-- links, search -->
<div id="links"<?php if ($news['searchform'] != 1) echo ' style="background:#fff"'; ?>>

	<?php if ($news['pages_custom'] == 0) { ?>
	<ul id="linklist">
		<?php if ($news['newspulse']) : ?><li><a href="<?php echo get_page_link($news['newspulse']); ?>" title="<?php _e('The NewsPulse','news'); ?>"><?php _e('The NewsPulse','news'); ?></a></li><?php endif; ?>
		<?php dt_profile_links(); ?>
		<li><a href="#"><?php _e('Stay Connected','news'); ?></a>
			<ul>
				<?php if (!empty($news['feedburner'])) { ?>
				<li><a href="http://feeds.feedburner.com/<?php echo $news['feedburner']; ?>" class="feedburner"><?php _e('Subscribe via FeedBurner','news'); ?></a></li>
				<li><a href="http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $news['feedburner']; ?>" class="feedburner-email"><?php _e('Subscribe via e-mail','news'); ?></a></li>
				<?php } ?>
				<?php if (!empty($news['twitter'])) { ?>
				<li><a href="http://twitter.com/<?php echo $news['twitter']; ?>" class="twitter"><?php _e('Follow us on Twitter','news'); ?></a></li>
				<?php } ?>
				<?php if (!empty($news['facebook'])) { ?>
				<li><a href="<?php echo $news['facebook']; ?>" class="facebook"><?php _e('Connect on Facebook','news'); ?></a></li>
				<?php } ?>
			</ul>
		</li>
		<li><a href="<?php bloginfo_rss('rss2_url'); ?>" class="rsslink"><?php _e('Entries RSS','news'); ?></a>
			<ul class="rssmenu">
				<?php
				$categories = get_categories(); 
				foreach ($categories as $category) {
				echo '<li><a href="'.get_category_feed_link($category->cat_ID).'">'.$category->cat_name.'</a></li>';
				}
				?>
			</ul>
		</li>
		<li><a href="<?php bloginfo_rss('comments_rss2_url'); ?>" class="rsslink"><?php _e('Comments RSS','news'); ?></a></li>
	</ul>
	<?php
	} else {
	wp_nav_menu( array( 'theme_location' => 'pages', 'container' => '', 'menu_id' => 'linklist', 'menu_class' => '') );
	}
	?>
	
	<?php if ($news['searchform'] == 1) { ?>
	<form>
		<fieldset class="search-form" action="/" method="get">
			<input type="text" name="s" id="s" value="<?php if (get_search_query()) { echo get_search_query(); } else { echo __('Search...','news'); } ?>" class="search-text clearfield" />
			<input type="submit" value="" class="search-go" />
		</fieldset>
	</form>
	<?php } ?>

<div class="clear"></div>
</div>
<!-- links, search -->

<?php dt_show_ads('position=Header Wide&title=Advertisement&before=<div class="adzone">&after=</div>'); ?>