
  WF.Router = {
    ROUTES: {},
    init: function() {
      window.ROUTES = self.ROUTES;
      this.dialogInit();
      this.miniMenuInit();
      return this.initialized = true;
    },
    add: function(type, slug, callback) {
      if (!(type in this.ROUTES)) this.ROUTES[type] = new Array();
      this.ROUTES[type][slug] = callback;
      if (!this.initialized) return this.init();
    },
    addMultiple: function(type, routes) {
      var callback, slug;
      for (slug in routes) {
        callback = routes[slug];
        this.add(type, slug, callback);
      }
      return null;
    },
    dialogInit: function() {
      var self;
      self = this;
      return $("a.dialog-btn").bind("click", function(event) {
        var dialog_class, dialog_route;
        dialog_class = $(this).attr("href").substr(1);
        dialog_route = dialog_class.split("?")[0];
        try {
          self.ROUTES["dialog"][dialog_route].call($(this), dialog_class.split("?")[1]);
        } catch (e) {
          console.log("[WF.Dialog] -- " + e);
          alert("Error: A dialog route has not been configured for this link yet.");
        }
        return false;
      });
    },
    miniMenuInit: function() {
      var self;
      self = this;
      return $("a.mini-menu-btn").bind("click", function(event) {
        var menu_class, menu_route;
        menu_class = $(this).attr("href").substr(1);
        menu_route = menu_class.split("?")[0];
        try {
          self.ROUTES["minimenu"][menu_route].call($(this), menu_class.split("?")[1]);
        } catch (e) {
          alert("Error: A minimenu route has not been configured for this link yet.");
        }
        return false;
      });
    }
  };

  window.WF.Router = WF.Router;

