(function() {
  var WF;

  WF = {};

  WF.BodyRoutes = {
    sell: "Sell",
    browse: "Browse",
    account: "Account",
    listing: "Listing",
    messages: "Messages"
  };

  WF.Core = {
    init: function() {
      var body_slug;
      $("input.toggle").each(function(index) {
        var input, label;
        input = $(this);
        label = $(this).siblings("label");
        input.focus(function() {
          return label.hide();
        }).blur(function() {
          if (!input.val()) return label.show();
        });
        label.click(function() {
          return input.focus();
        });
        if (input.val()) return label.hide();
      });
      body_slug = $("body").attr("id").split("-")[0];
      if (body_slug in WF.BodyRoutes) {
        try {
          WF[WF.BodyRoutes[body_slug]].init();
        } catch (_error) {}
      }
      setupZoom();
      $('li.disabled a').bind('click', function() {
        alert('Sorry, but this section of our site is still under active development.');
        return false;
      });
      WF.Router.add("dialog", 'compose_message', WF.Messages.compose_message);
      return null;
    }
  };

  String.prototype.shorten = function(n, i) {
    var indicator;
    indicator = i || "&hellip;";
    if (this.length > n) {
      return String(this.substr(0, n) + indicator);
    } else {
      return String(this);
    }
  };

  String.prototype.title = function() {
    return this.replace(/\w\S*/g, function(s) {
      return s.charAt(0).toUpperCase() + s.substr(1).toLowerCase();
    });
  };

  $(window).load(function() {
    return WF.Core.init();
  });

  window.WF = WF;

}).call(this);

