
$(document).ready(function(){

  // config
  // show the content with this ID:
  var activeStartId = 'wordpress';
  
  var activeId = window.location.hash;
  if( activeId == ''){
  
    activeId = activeStartId;
    
  } 
  
  // Animation Time in ms:
  var effectTime = 1000;
  
  // Animation effect (swing or linear)
  var effectEasing = 'linear';
  
  // Slider Items
  var sliderItems = 'slider_canvas';
  var sliderItems = '#' + sliderItems;
  var $sliderItems = $(sliderItems);
  
  // Content Wrapper
  var contentWrapper = 'content_wrapper';
  var contentWrapper = '#' + contentWrapper;
  var $contentWrapper = $(contentWrapper);
  
  // Set a class name when JavaScript is Ready 
  var jsActiveClass = 'js_ready';
  
  // select where jsActiveClass should be set
  var jsActiveSelector = 'body';
  
  // active content Class for CSS actions:
  var activeClass = 'show_content';
  
  // select, where the menu is
  var clickSelector = '#main_navigation a';
  var $startClickSelector = $(clickSelector + '[href^=' + activeId + ']');
  
  // Deal with CSS 3
  $(jsActiveSelector).addClass(jsActiveClass);
  
  
  $(clickSelector).click(function(){
    
  console.log(activeId)
    var showId = $(this).attr('href');
    
    if($(this).parent('li').is('.blog, .facebook, .twitter, .photoblog')){
    
      window.open($(this).attr('href'));
      
    } else {
    
      var myScrollTop = $(window).scrollTop();
      window.location.hash = showId;
      if(myScrollTop == 0){
      
        $(window).scrollTop('0');
        
      }
      
      var activeElemHeight = $(showId).height();
      var activeElemHeight = activeElemHeight + 10;
      
      $('#slider_canvas .content').removeClass('focused').addClass('notinfocus');
      $(showId).removeClass('notinfocus').addClass('focused');
      
      $contentWrapper.animate({height: activeElemHeight},500);
      
    }
    
    return false;      
    
  });
  
  $startClickSelector.click();
  
  
  // Tooltips
  $('.logo_wall img[title], #meta_navigation a[title]').tooltip({ 
  
    offset: [-4, 0],
    predelay: 75, 
    delay: 75
    
  });
  
  $('header .contact a img[title]').tooltip({
  
    position: 'bottom center', 
    offset: [10, 0],
    predelay: 75, 
    delay: 75,
    tipClass: 'contact_content'
    
  });
  
});

