<!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">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<?php if((is_home() && ($paged < 2 )) || is_single() || is_page()) { echo '<meta name="robots" content="index,follow" />'; } else { echo '<meta name="robots" content="noindex,follow" />'; } ?>

<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<meta name="description" content="<?php metaDesc(); ?>" />
<?php csv_tags(); ?>
<?php endwhile; endif; elseif(is_home()) : ?>
<meta name="description" content="<?php if(theme_option('site_description')) { echo trim(stripslashes(theme_option('site_description'))); } else { bloginfo('description'); } ?>" />
<meta name="keywords" content="<?php if(theme_option('keywords')) { echo trim(stripslashes(theme_option('keywords'))); } else { echo 'wordpress, c.bavota, moderno, custom theme, themes.bavotasan.com, premium themes'; } ?>" />
<?php endif; ?>

<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?><?php bloginfo('name'); if(is_home()) { echo ' | '; bloginfo('description'); } ?></title>

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo THEME_URL; ?>/admin/css/fonts.css" type="text/css" media="screen" />
<?php pbt_header_css(); ?>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php if(is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); ?>
<?php wp_enqueue_script('effects_js'); ?>
<?php wp_head(); ?>
<?php if(theme_option('google_analytics')) { echo stripslashes(theme_option('google_analytics')); } ?>
</head>

<body <?php body_class(); ?>>
    <!-- begin header -->
    <div id="header">
       <?php 
        $headeralign = theme_option('logo_location');
        if($headeralign=="fl") $adfloat = ' class="fr"';
        if($headeralign=="fr") $adfloat = ' class="fl"';
        if($headeralign=="aligncenter") $adfloat = ' class="aligncenter"';
        if(theme_option('header_ad')) { ?>
            <div id="headerad"<?php echo $adfloat; ?>>
                <?php echo stripslashes(theme_option('header_ad')); ?>
            </div>
        <?php } ?>
        <?php 
        $float = ' class="'.$headeralign.'"';
        if (theme_option('logo_header')) { ?>
            <a href="<?php echo home_url(); ?>/" class="headerimage"><img src="<?php echo theme_option('logo_header'); ?>" alt="<?php bloginfo('name'); ?>"<?php echo $float; ?> /></a>
        <?php } else { ?>
            <div id="title"<?php echo $float; ?>>
                <h1><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a></h1>
            </div>
        <?php } ?>
        <div id="description"<?php echo $float; ?>>
            <?php bloginfo('description'); ?>
        </div>
    </div>
    <!-- end header -->
   	<div id="content">
	   	<div id="wrapper">
            <div id="leftbg"></div>
            <div id="rightbg"></div>
			<?php
                $sidebar_layout = get_post_meta($post->ID, 'pbt_single_layout', true);
                $loc = theme_option('sidebar_location1');
                if($sidebar_layout==2 && is_singular()) {
                    // nothing
                } else {
                    if($loc==1 || $loc==3 || $loc==5) {
                        if(theme_option('sidebar_width1')!=0) get_sidebar(); // calling the First Sidebar
                    }
                }
            ?>
			<div id="postwrapper">
			<?php
            if(function_exists('wp_nav_menu')) {
                 wp_nav_menu( array( 'theme_location' => 'main', 'menu_class' => 'menu','sort_column' => 'menu_order', 'container_id' => 'main-navigation', 'fallback_cb' => 'menu_default' ) ); 
            } else {
                echo '<div id="main-navigation"><ul class="menu"><li><a href="'.home_url().'">Home</a></li>';
                wp_list_categories('title_li=');
                echo '</ul></div>';
            }
            ?>