(function() {
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
  $(document).ready(function() {
    var update_datetime;
    setInterval(__bind(function() {
      return update_datetime();
    }, this), 1000);
    $('#browser').fadeIn(1000);
    setTimeout(__bind(function() {
      return $('#dock').addClass('slide_up');
    }, this), 500);
    update_datetime = function() {
      var current_time, day, day_of_week, hour, minute, month, months, period, week_days, minute_string;
      current_time = new Date;
      period = 'AM';
      hour = current_time.getHours();
      if (hour > 11) {
        period = 'PM';
      }
      if (hour > 12) {
        hour -= 12;
      }
      if (hour === 0) {
        hour = 12;
      }
      minute = current_time.getMinutes();
      if (minute < 10) {
        minute_string = '0' + minute;
      } else {
        minute_string = minute.toString();
      }
      
      $('.time').text(hour + ':' + minute_string + ' ' + period);
      week_days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
      months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
      day_of_week = current_time.getDay();
      month = current_time.getMonth();
      day = current_time.getDate();
      return $('.date').text(week_days[day_of_week] + ' ' + months[month] + ' ' + day);
    };
    $('#dock a span').each(function() {
      return $(this).css('left', -(($(this).innerWidth() - 52) / 2));
    });
    $('#header input').keypress(function(e) {
      var url;
      if (e.keyCode === 13) {
        if ($('#awesome').attr('value') === '4815162342') {
          $('#dock').after('<div id="lightbox"><div id="video"><iframe width="480" height="300" src="http://www.youtube.com/embed/Gar6JyV6800?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div></div>');
          return $('#lightbox').click(function() {
            return $(this).remove();
          });
        } else if ($('#awesome').attr('value') === 'joebilt.com') {} else {
          $('#about').hide();
          url = $('#awesome').attr('value');
          if (!url.match(/^http:\/\//)) {
            url = 'http://'.concat(url);
          }
          $('#awesome').attr('value', url);
          $('#eight-bit').hide();
          return $('#iframe').show().attr('src', url);
        }
      }
    });
    return $('#home_button').click(function() {
      $('#iframe').hide();
      $('#awesome').attr('value', 'http://joebilt.com');
      $('#content #about').show();
      $('#eight-bit').show();
      return false;
    });
  });
}).call(this);

