//http://stackoverflow.com/questions/6167805/using-rails-3-1-where-do-you-put-your-page-specific-javascript-code POKE = { blank: function(o) { return typeof o === "undefined" || o === null; }, get_or_create: function(namespace_string) { var current_namepace = window; $.each(namespace_string.split('.'), function(index, level) { if (POKE.blank(current_namepace[level])) current_namepace[level] = {}; current_namepace = current_namepace[level]; }); return current_namepace; }, define: function(namespace_string, definition) { var found_namespace = POKE.get_or_create(namespace_string); return $.extend(found_namespace, definition); }, traverse_namespace: function(namespace, levels) { if (!$.isArray(levels)) levels = [levels.controller, levels.format, levels.action]; levels = POKE.formatted_levels(levels); var current_level = namespace; var level; for (var i=0;i