(function($) {
  $.fn.konami = function(callback, code) {
    if(code == undefined) code = "38,38,40,40,37,39,37,39,66,65";

    return this.each(function() {
      var kkeys = [];
      $(this).keydown(function(e){
        kkeys.push( e.keyCode );
        if ( kkeys.toString().indexOf( code ) >= 0 ){
          $(this).unbind('keydown', arguments.callee);
          callback(e);
        }
      });
    });
  }
})(jQuery);

$(document).ready(function(){
  // who page
  $(document).konami(function(){
    $('#easteregg').fadeIn("slow");
  });

  // what page
  Shadowbox.init({});

  if (location.hash) {
    setTimeout(function(){
      var $client =$(".clients a." + location.hash.substr(1)).click();
      Shadowbox.open({player:'iframe',
        content: $client.attr('href'),
        title: $client.attr('shadowbox-title')
        });
    }, 1000);
  }
});

//web apps
$(document).ready(function(){

  $("#showFancyModal").click(function() {
      $("div#fancyModal").addClass("show");
    return false;
});

  $("#showFancyModal2").click(function() {
      $("div#fancyModal").addClass("show");
    return false;
});

  $("#closeFancy").click(function() {
      $("div#fancyModal").removeClass("show");
    return false;
  });
});

