(function($) {
  
  $.extend(jQuery.expr[":"], {
    search: function(elem) {
      // could be done much better?
      return "search" === elem.type;
    }
  });

  $.fn.applesearch = function(options) {
    var opts = $.extend({}, $.fn.applesearch.defaults, options);
  };

  $.fn.applesearch.defaults = {
    className: '',
    placeholder: 'Site Search',
    autocompleate: 'off',
    autosave: 'search-cache',
    results: 10
  };

  if( !$.browser.safari ) {
    $(' <link href="/css/applesearch.css" rel="stylesheet" type="text/css"/>').appendTo('head');
  }
 
  $(document).ready(function() {

    if( $.browser.safari ) {
      $(':search').each(function(n, elem) {
        $(elem).attr({
          autosave:'search-cache',
          results:'10'
        });
      });
    }
    
  });

})(jQuery);
