<?php

if ( ! isset( $content_width ) ) $content_width = 760;

add_theme_support('automatic-feed-links');
add_theme_support('custom-background');
add_custom_image_header('hello_sexy_header_style', 'hello_sexy_admin_header_style');
add_action('widgets_init', 'hello_sexy_sidebar');
add_action('wp_enqueue_scripts', 'hello_sexy_enqueue_scripts' );

// custom header stuff
define('HEADER_TEXTCOLOR', 'ffffff');
define('HEADER_IMAGE', ''); // %s is the template dir uri
define('HEADER_IMAGE_WIDTH', 1900); // use width and height appropriate for your theme
define('HEADER_IMAGE_HEIGHT', 250);

// gets included in the site header
function hello_sexy_header_style() {
  ?>
  <style type="text/css">
      <?php if(get_header_image()) { ?>
      header {
          background: url('<?php header_image(); ?>') repeat-x scroll top center;
      }
      <?php } ?>
      
      header h1 a, header p {
       color:  #<?php echo get_header_textcolor(); ?>
      }
      
  </style>
  <?php
}
// gets included in the admin header
function hello_sexy_admin_header_style() {
  ?>
  <style type="text/css">
      #headimg {
          width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
          height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
          background: repeat-x;
      }
      
      #headimg a {
       text-decoration: none; 
      }
      
      #headimg #name {
       font-size: 48px;
       font-weight: bold;
       letter-spacing: -2px;
       text-decoration: none; 
       padding: 50px 0 0 20px;
      }
      
      #headimg #desc {
        font-size: 21px;
        font-weight: bold;
        padding-left: 20px;
      }
  </style>
  <?php
}

// end custom header stuff


function hello_sexy_sidebar() {
  register_sidebar(array(
    'id' => 'sidebar',    
    'name' => 'Primary Sidebar',
  	'before_widget' => '<li><aside id="%1$s" class="widget %2$s">',
  	'after_widget' => '</aside></li>',
  	'before_title' => '<h3 class="widgettitle">',
  	'after_title' => '</h3>',
  ));
}


function hello_sexy_enqueue_scripts() {
  if ( ! is_admin() ) {
    // register html5_shim script
    wp_register_script('hello-sexy_html5_shim', get_template_directory_uri() . '/html5.js');
    // enqueue html5_shim script
    wp_enqueue_script('hello-sexy_html5_shim');
  }
}

// hack to add a class to the body tag when the sidebar is active
function hellosexy_has_sidebar($classes) {
	if (is_active_sidebar('sidebar')) {
		// add 'class-name' to the $classes array
		$classes[] = 'has_sidebar';		
	}
	// return the $classes array
	return $classes;
}
add_filter('body_class','hellosexy_has_sidebar');

?>