function Capitalizer(type, options) {
  this.type = type;
  var defaults = {}
  this.options = options || defaults;
  this.capitalizations = {
    words: function(input) {
      return input.toLowerCase().replace(/(^|[ .;])(\w)/g, function(l) { return l.toUpperCase(); } );
    },
    sentence: function(input) {
      return input.toLowerCase().replace(/(^|[.;] *)(\w)/g, function(l) { return l.toUpperCase(); } );
    },
    all: function(input) {
      return input.toUpperCase();
    },
    none: function(input) {
      return input.toLowerCase();
    },
    title: function(input) {
      var output = input.toLowerCase().replace(/(^|[ .;])(\w)/g, function(l) { return l.toUpperCase(); } );
      output = output[0] + output.substr(1).replace(/\b(of|the|at|in|a|to|for)\b/gi, function(w) { return w.toLowerCase(); });
      return output;
    },
    random: function(input) {
      output_array = [];
      for (var i = 0; i < input.length; i++) {
        var yes = Math.random() * 10 > 5;
        if (yes) {
          output_array.push(input[i].toUpperCase());
        } else {
          output_array.push(input[i].toLowerCase());
        }
      }
      return output_array.join('');
    }
  }
}

Capitalizer.prototype.capitalize = function(input) {
  if (this.capitalizations.hasOwnProperty(this.type)) {
    return this.capitalizations[this.type](input);
  } else {
    alert("Can't capitalize that type!");
  }
}


@@ -1251,16 +1251,66 @@
 nput) %7B%0A
+  if (input.replace(/%5E%5Cs+%7C%5Cs+$/g, '').length) %7B%0A  
   if (th
@@ -1357,24 +1357,26 @@
 ype)) %7B%0A    
+ 
+ 
 return this.
@@ -1410,16 +1410,18 @@
 input);%0A
+  
   %7D else
@@ -1431,40 +1431,202 @@
     
-alert(%22Can't capitalize that typ
+  if (this.type === '') %7B%0A        alert('Please pick a capitalization type');%0A      %7D else %7B%0A        alert(%22Can't capitalize that type!%22);%0A      %7D%0A    %7D%0A  %7D else %7B%0A    alert(%22Please enter a valu
 e!%22)

Check for empty values, better errors