$(function() {
  Tabs.init();
  
  $(window).konami(function(){
    $('#body').prepend('<div class="pythong"></div>')
  });
  
  $('#header .search_form input').focus(function(e) {
    if (this.value == "Search projects") {
      this.value = ""
    }
  });
  $('#header .search_form input').blur(function(e) {
    if (this.value == "") {
      this.value = "Search projects"
    }
  });
});


var Tabs = {
  init: function() {
    tabs = $('.tab_group .tabs li a');

    // Hide all tab contents
    tabs_off = $('.tab_group .tabs li[class!=on] a');
    tab_hrefs = tabs_off.map(function() { return $(this).attr('href'); }).get().join(', ');
    if (tab_hrefs) {
      $(tab_hrefs).hide();
    }

    tabs.bind('click', this.click);
  },
  
  click: function(e) {
    e.preventDefault();
    target = $(this);
    tab_group = target.parents('.tab_group');
    
    // Hide tab content areas
    tabs = tab_group.find('.tabs li a');
    tabs.parent().removeClass('on')
    hrefs = tabs.map(function() { return $(this).attr('href'); }).get().join(', ')
    $(hrefs).hide();
    
    // Show clicked tab
    target.parent().addClass('on');
    $(target.attr('href')).show();
  }
}