jQuery(document).ready(function($){

  // Top navigation drop down menu
  jQuery('ul.primary-navigation').hoppe_dropdown({
    sub_menu_width: '240px'
  });

  // IE PNG Fix
  if (window.DD_belatedPNG) DD_belatedPNG.fix('*');
  
  // Last Child
  $(':last-child').addClass('last-child');
  
  // First Child
  $(':first-child').addClass('first-child');
  
  // Open Links in new Window
  $('div.comment-meta a, div.comment-text a, div.trackback-meta a, div.trackback-content a').click(function(){
    window.open(this);
    return false;
  });  

  // Cufon fonts
  Cufon.replace('.entry h1, .entry h2, .entry h3, .entry h4, .entry h5, .entry h6, label, th, div.hint, .post-loop .version');
  Cufon.replace('.header a.home-link', { 'fontSize': '65px', 'textTransform': 'uppercase' });
  Cufon.replace('h2.page-title, .post h3.title', { 'fontSize': '32px', 'textTransform': 'uppercase' });
  Cufon.replace('h3.comments-title, h3.respond-title', { 'fontSize': '30px' });
  Cufon.replace('.post-meta, .comment-meta, .trackback-meta, .page-navigation, a.comment-reply-link', { 'fontSize': '18px' });
  Cufon.replace('.post-loop .post-meta .post-date, .post-loop .post-meta .post-edit a', { 'fontSize': '15px' });
  Cufon.replace('.post-navigation a, .post-navigation span.current-page, .comment-navigation a, .comment-navigation span.current-page', { 'fontSize': '16px' });
  Cufon.replace('h2.widget-title', { 'fontSize': '22px' });
  Cufon.replace('.footer-widgets h2.widget-title', { 'fontSize': '22px', 'textShadow': '#000 1px 1px' });
  Cufon.replace('.archive h2.page-title, .search h2.page-title', { 'fontSize': '22px', 'textTransform': 'uppercase' });
  Cufon.replace('ul.primary-navigation>li>a', { 'fontSize': '28px', 'textShadow': '1px 1px #67aae1', 'textTransform': 'uppercase', 'hover': true });
  Cufon.replace('ul.primary-navigation ul li a', { 'fontSize': '18px', 'hover': true });
  Cufon.replace('ul.footer-navigation li a', { 'fontSize': '20px', 'hover': true });  
  Cufon.replace('a.read-more, .read-more a', { 'fontSize': '16px' });
  Cufon.replace('.breadcrumbs .inner .grid_16', { 'fontSize': '20px' });
  Cufon.replace('div.footer .copyright', { 'fontSize': '16px' });

  // Search Widget
  $('div.widget_search input#s')
  .change(function(){
    if (this.value == ''){
      this.value = $search_term_default;
    }
  })
  .change()
  .focus(function(){
    if ( $(this).val() == $search_term_default ) $(this).val('');
    $(this).removeClass ('inactive');
  })
  .focusout(function(){
    $(this).addClass ('inactive').change();
  })
  .focusout();

});
