<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<title><?php bloginfo('name'); ?> <?php wp_title(' | '); ?></title>
	<meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
	<link rel="icon" href="<?php if(grain_get_option('favicon')){ echo grain_get_option('favicon');}?>"/>
	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
		<?php wp_head(); ?>
	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />	
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed <?php echo grain_get_option('color_scheme', 'blue' ); ?> <?php echo grain_get_option('layout', 'narrow-sidebar' ); ?>">
	<div id="header">
			<div id="branding">
				<div id="blog-details">
					<a id="blog-title" href="<?php echo home_url();?>/" title="<?php bloginfo( 'name' ); _e('" rel="home">', 'grain'); bloginfo( 'name' ) ?></a>
					<?php if ( is_home() || is_front_page() ) { ?>
					<h1 id="blog-description"><?php bloginfo( 'description' ) ?></h1>
					<?php } else { ?>	
					<div id="blog-description"><?php bloginfo( 'description' ) ?></div>
					<?php } ?>
				</div>
				<div id="feed"><a href="<?php if(grain_get_option('feed_url')){echo grain_get_option('feed_url');} else {echo get_bloginfo('rss2_url');} ?>" title="<?php _e('Follow us through this Feed via RSS','grain')?>"><img src="<?php echo get_template_directory_uri()?>/images/rss.png" height="42px" alt="<?php _e('RSS feed', 'grain')?>"/></a></div>
			</div><!-- #branding -->
		<div id="access-outer">
			<div id="access">
				<div class="skip-link"><a href="#content" title="<?php _e( 'Skip to content', 'grain' ) ?>"><?php _e( 'Skip to content', 'grain' ) ?></a></div>
				<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header', 'theme_location' => 'main-menu' ) ); ?>		
			</div><!-- #access -->
		</div>
		<div id="header-image-outer">
			<div id="header-image">
			<?php
			// Check if this is a post or page, if it has a thumbnail, and if it's a big one
			if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ( /* $src, $width, $height */ $grain_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $grain_image[1] >= HEADER_IMAGE_WIDTH ) :
			// Houston, we have a new header image!
			echo get_the_post_thumbnail( $post->ID );
			elseif ( get_header_image() ) : ?>
			<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
			<?php endif; ?>
			</div>
		</div>
	</div><!-- #header -->
	<div id="main">