﻿$(function(){
	var q = $("#search input")[0];
	q.focus();
	$("#search a").click(function(){
		if ($.trim(q.value).length > 0)
			$("#dform")[0].submit();
		else
			q.focus();
		return false;
	});
	var remove = function(){
		if ($(this).val() == "")
			$(this).removeClass("clicked");
	};
	$("#sort").change(function(){
		if ($(this).val().length > 0)
			$("#dform")[0].submit();
	}).each(function(){
		if ($(this).val() != "")
			$(this).addClass("clicked");
	}).mousedown(function(){
		$(this).addClass("clicked");
	}).change(remove).blur(remove);
});