/* Extras */

String.prototype.ellipse = function(maxLength){
    if(this.length > maxLength){
        return this.substr(0, maxLength-3) + '...';
    }
    return this;
};

/* Copied from prototype */
jQuery.extend({
    createClass: function() {
        return function() {
            this.initialize.apply(this, arguments);
        }
    }
});

Function.prototype.bindListener = function(o) {
    var _m = this;
    var args = [].slice.call(arguments, 0);
    var obj = args.shift();
    return function(e) {
        return _m.apply(obj, [e, this].concat(args));
    }
} 

Function.prototype.bind = function() {
  var __method = this, args = [].slice.call(arguments, 0), object = args.shift();
  return function() {
    return __method.apply(object, args.concat([].slice.call(arguments, 0)));
  }
}

function $J(selector) {
    return $(selector).get(0);
}

