jQuery.fn.quickfinder = function() {
	$this = jQuery(this);

	var dc = function(e){return document.createElement(e);};

	var qf_select = jQuery("select", this).get(0);
	var do_replace = false;

	if (!qf_select) {
		var title = jQuery("h1,h2,h3", this).text()

		qf_select = jQuery(dc('select'))
		.append(
			'<option value="">'+title+'</option>'
		);

		do_replace = true;
	} else {
		qf_select = jQuery(qf_select).removeAttr("disabled");
	}

	qf_select.change(function(){
		var target = this.value;

		if (target != this.defaultValue) {
			location.replace(target);
		}
	});

	jQuery("li > a", this).each(function(){
		var item = jQuery(this);
		qf_select.append(
			jQuery(dc('option'))
				.text(item.text())
				.attr({value:item.attr('href')}));
	});
	jQuery("ul", this).remove();

	if (do_replace) {
		$this.replaceWith(qf_select);
	}

	return this;
}

