
  $.browser.chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

  (function($) {
  $.fn.ellipsis = function(options) {
    options = options || {};
    options.suffix = options.suffix || "…";
    return this.each(function() {
      var el = $(this);
      
      if (el.css("overflow") == "hidden") {
        var text = el.html();
        var multiline = el.hasClass('multiline');
        var t = $(this.cloneNode(true))
          .hide()
          .css('position', 'absolute')
          .css('overflow', 'visible')
          .width(options.multiline ? el.width() : 'auto')
          .height(options.multiline ? 'auto' : el.height());
        
        el.after(t);
        function height() { return t.height() > el.height(); };
        function width() { return t.width() > el.width(); };
        var func = options.multiline ? height : width;
        
        while (text.length > 0 && func()) {
          text = text.substr(0, text.length - 1);
          t.html(text + options.suffix);
        }
        
        el.html(t.html());
        t.remove();
      }
    });
  };
})(jQuery);;

  $(function() {
    var FlashWarning, flashWarning, preloadImage, _base;
    $('#speech-bubble .ellipsised').ellipsis({
      multiline: true
    });
    preloadImage = function(url, callback) {
      var image;
      image = $(new Image);
      image.load(callback);
      image.attr({
        src: url
      });
      return image;
    };
    preloadImage('/left_bulb_on.png');
    preloadImage('/right_bulb_on.png');
    preloadImage('/eshop_fun_mouseover.png');
    preloadImage('/eshop_play_mouseover.png');
    preloadImage('/eshop_customize_mouseover.png');
    preloadImage('/giggles_mouseover.png');
    preloadImage('/news_mouseover.png');
    preloadImage('/play_mouseover.png');
    preloadImage('/eshop_mouseover.png');
    preloadImage('/play_button_mouseover.png');
    preloadImage('/secretfiles_mouseover.png');
    preloadImage('/tradingcards_mouseover.png');
    if (typeof (_base = $('.media-list li a')).fancybox === "function") {
      _base.fancybox({
        titleShow: false,
        showNavArrows: true,
        showCloseButton: true,
        hideOnOverlayClick: true,
        hideOnContentClick: true,
        easingIn: 'easeOutBack',
        easingOut: 'easeInBack',
        transitionIn: 'elastic',
        transitionOut: 'elastic'
      });
    }
    $('.game-link').click(function(e) {
      var height, href, width, _ref;
      href = $(this).attr('href');
      _ref = [976, 650], width = _ref[0], height = _ref[1];
      window.popup = window.open(href, 'crimeville', "width=" + width + ",height=" + height + ",left=" + (parseInt((screen.availWidth - width) / 2)) + ",top=" + (parseInt((screen.availHeight - height) / 2)) + ",toolbar=0,scrollbars=0,resizable=0");
      $('#billboard-wrapper .slideshow-indicators').children().removeClass('current');
      $('#billboard-wrapper #billboard').remove();
      return e.preventDefault();
    });
    if (window.location.pathname === '/') {
      if (!swfobject.hasFlashPlayerVersion('8.0.0')) {
        FlashWarning = (function() {

          function FlashWarning() {
            var _this = this;
            this.modal = $('<div id="no-flash"><a href="http://get.adobe.com/flashplayer/" class="modal"></a></div>');
            this.close = $('<a href="#" class="close"></a>');
            this.modal.append(this.close);
            this.close.click(function() {
              _this.dismiss();
              return false;
            });
          }

          FlashWarning.prototype.present = function() {
            return $('body').append(this.modal);
          };

          FlashWarning.prototype.dismiss = function() {
            return this.modal.remove();
          };

          return FlashWarning;

        })();
        flashWarning = new FlashWarning;
        return flashWarning.present();
      }
    }
  });

  this.openGameWindowFromButton = function() {
    var height, width, _ref;
    _ref = [976, 650], width = _ref[0], height = _ref[1];
    window.popup = window.open("" + ($('.game-link').attr('href')) + "?from-button", 'crimeville', "width=" + width + ",height=" + height + ",left=" + (parseInt((screen.availWidth - width) / 2)) + ",top=" + (parseInt((screen.availHeight - height) / 2)) + ",toolbar=0,scrollbars=0,resizable=0");
    $('#billboard-wrapper .slideshow-indicators').children().removeClass('current');
    $('#billboard-wrapper #billboard').remove();
  };

  this.openGameWindowFromSlideshow = function() {
    var height, width, _ref;
    _ref = [976, 650], width = _ref[0], height = _ref[1];
    window.popup = window.open("" + ($('.game-link').attr('href')) + "?from-slideshow", 'crimeville', "width=" + width + ",height=" + height + ",left=" + (parseInt((screen.availWidth - width) / 2)) + ",top=" + (parseInt((screen.availHeight - height) / 2)) + ",toolbar=0,scrollbars=0,resizable=0");
    $('#billboard-wrapper .slideshow-indicators').children().removeClass('current');
    $('#billboard-wrapper #billboard').remove();
  };

