(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 (!code.indexOf(kkeys.toString())) {
                                        if (code == kkeys.toString()) {
                                                $(this).unbind('keydown', arguments.callee);
                                                callback(e);
                                        }
                                        return false;
                                }
                                kkeys = [];
                                kkeys.push( e.keyCode );
                                return true;
                        });
                });
        }
})(jQuery);
