$(document).ready(function() {
  
  $('#sitemap').columnize({ columns: 3 });
  $('.entry-content h1:first').addClass('entry-title').appendTo('.entry-header a');

  $('#sidebar li.pagenav ul li ul.children').each(function(){
    var $linktext = $(this).prev().text();
    $(this).prev().replaceWith($linktext);
  });

  $('nav ul li a').each(function() {
    if (" " + location.pathname.indexOf($(this).attr('href')) > -1 ) {
      $(this).addClass('active');
     }
  });

  $('.media-post .authors a').each(function() {
    var $linktext = $(this).text();
    $(this).replaceWith($linktext);
  });

  $('header nav ul li a').hover(function() {
     $(this).stop(true,true).addClass('selected');
    }, function() {
     $(this).stop(true,true).removeClass('selected');
  });

  $('#sidebar ul li a, #sitemap ul.children a').hover(function() {
    $(this).stop(true,true).addClass('selected', 150);
  }, function() {
    $(this).stop(true,true).removeClass('selected', 150);
  });

  $('#thecity .bigbutton').hover(function() {
    $(this).animate({ opacity: 0.7}, 150);
  }, function() {
    $(this).animate({ opacity: 1}, 150);
  });


      $('#featured').after('<ul id="nav">').cycle({
        fx: 'scrollLeft',
        speed:  2000,
        startingSlide: 0,
        fastOnEvent: 500,
        timeout: 10000,
        pauseOnPagerHover: true,
        pager:  '#nav',
        pagerAnchorBuilder: function(idx, slide) {
            return '<li><a href="#"><img src="' + $(slide).find('img').attr('src').split('.').reverse().slice(1).reverse().join('.') + '_sm.png" /></a></li>';
        }
    });  

});

