<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />

<title><?php 
	global $page, $paged;
	if ( is_home() ) { bloginfo('name'); echo ' | '; bloginfo('description'); } 
	elseif ( is_search() ) { bloginfo('name'); echo ' | '; _e('Search Results', 'newspro');  }  
	elseif ( is_author() ) { bloginfo('name'); echo ' | '; _e('Author Archives', 'newspro');  }
	elseif ( is_page() ) {  bloginfo('name'); echo ' | '; wp_title('');  }
	elseif ( is_single() ) { wp_title(''); echo ' | '; bloginfo('name');  }
	elseif ( is_category() ) { bloginfo('name'); echo ' | '; _e('Archive', 'newspro'); echo ' | '; single_cat_title();  } 
	elseif ( is_month() ) { bloginfo('name'); echo ' | '; _e('Archive', 'newspro'); echo ' | '; the_time('F');  }	
	elseif ( is_tag() ) {  bloginfo('name'); echo ' | '; _e('Tag Archive', 'newspro'); echo ' | ';  single_tag_title("", true); }     
	else { wp_title(''); echo ' | '; bloginfo('name');  }	

	// Add a page number if necessary:
	if ( $paged >= 2 || $page >= 2 )
		echo ' | ' . sprintf( __('%s'), max( $paged, $page ) );	
?></title>

	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php if ( get_option('of_nw_rssaddr') <> "" ) { echo get_option('of_nw_rssaddr'); } else { echo bloginfo('rss2_url'); } ?>" />	
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

	<?php
		if ( is_singular() && get_option( 'thread_comments' ) )
			wp_enqueue_script( 'comment-reply' );
		wp_head();
	?>
</head>

<body>

<div id="wrapper">
	
	<div id="header">	
		<div id="masthead">
			<?php
				if(get_option('of_nw_nav_masthead') == 'true') { 
					wp_nav_menu( array('theme_location' => 'masthead', 'container' => false, 'menu_class' => 'nav_masthead dropdown' ));
				} else { ?>
					<ul class="nav_masthead dropdown">
						<li><a class="gab_rss" href="<?php if ( get_option('of_nw_rssaddr') <> "" ) { echo get_option('of_nw_rssaddr'); } else { echo bloginfo('rss2_url'); } ?>" rel="nofollow" title="<?php esc_attr_e('Subscribe to latest posts in RSS','newspro'); ?>"><?php _e('RSS for Posts','newspro'); ?></a></li>
						
						<?php if ( get_option('of_nw_feedburner') <> "" ) { ?>
							<li><a class="gab_email" href="<?php echo get_option('of_nw_feedburner'); ?>" rel="nofollow" title="<?php esc_attr_e('Subscribe to latest posts via email','newspro'); ?>"><?php _e('Subscribe by e-mail','newspro'); ?></a></li>
						<?php } ?>
						
						<?php if ( get_option('of_nw_twitter') <> "" ) { ?>
							<li><a class="gab_twitter" href="<?php echo get_option('of_nw_twitter'); ?>" rel="nofollow" title="<?php esc_attr_e('follow on twitter','newspro'); ?>"><?php _e('Follow on Twitter','newspro'); ?></a></li>
						<?php } ?>
						
						<?php if ( get_option('of_nw_facebook') <> "" ) { ?>
							<li><a class="gab_facebook" href="<?php echo get_option('of_nw_facebook'); ?>" rel="nofollow" title="<?php esc_attr_e('Connect on facebook','newspro'); ?>"><?php _e('Connect on Facebook','newspro'); ?></a></li>
						<?php } ?>
					</ul>
			 <?php } ?>	
			 
			<div id="search">
				<?php get_search_form(); ?>
			</div><!-- /search -->
			<div class="clear"></div>
		</div>
		
		<?php if(get_option('of_nw_header_type') == 'singleimage') { ?>
			<a href="<?php echo home_url('/'); ?>" title="<?php bloginfo('description'); ?>">
				<img src="<?php echo get_option('of_nw_himageurl'); ?>" style="max-width:970px;" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>"/>
			</a>
		<?php } else { ?>
		
		<div id="logo" style="padding:<?php echo get_option('of_nw_padding_top'); ?>px 0 <?php echo get_option('of_nw_padding_bottom'); ?>px <?php echo get_option('of_nw_padding_left'); ?>px;">
		
			<?php 
			if ( get_option('of_nw_logo_type') == 'Image Based Logo') { ?>
				<a href="<?php echo home_url('/'); ?>" title="<?php bloginfo('description'); ?>">
					<img src="<?php echo get_option('of_nw_logo'); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>"/>
				</a>
			<?php } else { ?>
				<h1>
					<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>">
						<?php bloginfo('name'); ?>
						<span><?php bloginfo('description'); ?></span>
					</a>
				</h1>
			<?php } ?>
		</div><!-- /logo -->
		
		<div id="banner">
			<?php
				if(file_exists(TEMPLATEPATH . '/ads/header_728x90/'. current_catID() .'.php') && (is_single() || is_category())) {
					include_once(TEMPLATEPATH . '/ads/header_728x90/'. current_catID() .'.php');
				}
				else {
					include_once(TEMPLATEPATH . '/ads/header_728x90.php');
				}
			?>
		</div>
			
		<?php } ?>
	</div><!-- /header -->
	
	<div class="clear"></div>		
	
	<div id="navcats">
		<?php
			if(get_option('of_nw_nav_cats') == 'true') { 
				wp_nav_menu( array('theme_location' => 'primary-navigation', 'container' => false, 'menu_class' => 'nav_cats dropdown' ));
			} else { ?>
			<ul class="nav_cats dropdown">
				<li <?php if(is_home() ) { ?>class="current-cat"<?php } ?>><a href="<?php echo home_url('/'); ?>" title="<?php bloginfo('description'); ?>"><?php _e('Home','newspro'); ?></a></li>
				<?php wp_list_categories('orderby='. get_option('of_nw_order_cats') .'&order='. get_option('of_nw_sort_cats') .'&title_li=&exclude='. get_option('of_nw_ex_cats')); ?>
			</ul>
		<?php } ?>
		<div class="clear"></div>
	</div>
	
	<div id="navpages">
		<?php
			if(get_option('of_nw_nav_pages') == 'true') { 
				wp_nav_menu( array('theme_location' => 'secondary-navigation', 'container' => false, 'menu_class' => 'nav_pages dropdown' ));
			} else { ?>
			<ul class="nav_pages dropdown">						
				<?php wp_list_pages('sort_column=menu_order&title_li=&exclude='. get_option('of_nw_ex_pages')); ?>
			</ul>
		 <?php } ?>	
		 <div class="clear"></div>
	</div>
	<div class="clear"></div>