$(document).ready(function(){

   var uri = window.location.toString();

   $('#header-menu li a').each(function(){
      var copy = $(this).html();
      var regex = new RegExp(copy, 'gi');

      if ($(this).attr('href') == window.location || uri.search(regex) > 0) {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Portfolio' && $('body').attr('id') == 'portfolio-page') {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Blog' && $('body').attr('id') == 'blog-page') {
         $(this).parent().addClass('current-menu-item');
      }

   });

   $('#sidebar-menu li a').each(function(){
      var copy = $(this).html();
      var regex = new RegExp(copy, 'gi');

      if ($(this).attr('href') == window.location || uri.search(regex) > 0) {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Portfolio' && $('body').attr('id') == 'portfolio-page') {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Blog' && $('body').attr('id') == 'blog-page') {
         $(this).parent().addClass('current-menu-item');
      }

   });

   $('#footer-menu li a').each(function(){
      var copy = $(this).html();
      var regex = new RegExp(copy, 'gi');

      if ($(this).attr('href') == window.location || uri.search(regex) > 0) {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Portfolio' && $('body').attr('id') == 'portfolio-page') {
         $(this).parent().addClass('current-menu-item');
      }

      if ($(this).html()== 'Blog' && $('body').attr('id') == 'blog-page') {
         $(this).parent().addClass('current-menu-item');
      }

   });

   $('#follow-menu li a').each(function(){
      $(this).addClass('new-window');
   });

   $('a.new-window').click(function(){
      window.open(this.href);
      return false;
   });

   $('#portfolio-entry-detail p').cycle({
      fx: 'fade',
      timeout: 3000,
      next: '#portfolio-navigation a.next',
      prev: '#portfolio-navigation a.prev'
   });

});

