function showinfo(prefix,description,clicks) 
{
	$('#info').html('<strong>'+prefix+'</strong>: '+description+' ('+clicks+')');
	$('#'+prefix).attr('title', description);
}

function loadbuts(type) 
{
	  $('#info').html('Loading...');
		$('#buttons').fadeOut('fast');
		$('#menu>ul>li>a').removeClass("strong");
		$('#t_'+type).addClass("strong");
		$.get("/", { page: "ajax", action: "buttons", t: type },
		function(data){
			$('#info').html('Showing category <strong>'+$('#t_'+type).html()+'</strong> ordered by <strong>'+$('#selectedorder').html()+'</strong>');
			$('#buttons').html(data);
			$('#buttons').fadeIn();
			$('#searchtext').focus();
		});
}

var waitabit = 2;
function filterme() 
{
	if ($('#filterbytxt').val()=="") 
	{
		loadbuts('all');
	}
	else
	{
		if (waitabit=2)
		{
			setTimeout(filterthis(), 2000);
			waitabit = 1;
		}
	}
}

function filterthis() 
{
	  $('#info').html('Loading...');
	  waitabit = 2;
		$('#menu>ul>li>a').removeClass("strong");
		$.get("/", { page: "ajax", action: "filterthis", t: $('#filterbytxt').val() },
		function(data){
			$('#info').html('Filtering by <strong>'+$('#filterbytxt').val()+'</strong> search engines ordered by '+$('#selectedorder').html()+'</strong>');
			$('#buttons').html(data);
			$('#buttons').fadeIn();
		});
}

function watchtut() {
	$('#subheader>p').html('Loading...');
	$.get("/", { page: "ajax", action: "watchtut" },
	function(data){
		$('#subheader>p').html(data);
	});
	return false;
}
function hidetut() {
	$('#subheader').html('');
}

document.search.q.focus();

