/**
 * jQuery Quicknav plugin, by madr <anders.ytterstrom@gmail.com>
 * version 1.0
 * 
 * <form action="path-to-a-redirector-script.html"> 
 *   <div>
 *     <label for="goto">Goto some other cool site: </label>
 *     <select class="quicknav" name="redirectTo" id="goto">
 *       <option value="http://example.com">Example with label</option>
 *     </select>
 *     <input type="submit" value="go" />
 *   </div>
 * </form>
 */
(function($){
  $.fn.quicknav = function(options) {
    var defaults = {
      // override this only when testing.
      assign: function(url){ 
        window.location.assign(url);
      }
    };
    
    var opts = $.extend(defaults, options);
    
    return this.each(function() {
      $(this).change(
        function(evt) {
          opts.assign(evt.target.value);
        }
      ).next('input[type=submit]').remove();
    });
  };
})(jQuery);
