$(document).ready(function(e)
{
    $('#messagewrapper').slideDown('fast');
    $('#q').focus(function()
    {
        if($('#q').val() == 'Search')
        {
        	$('#q').val('');
        }
    });
    $('#q').blur(function()
    {
        $('#suggestions').fadeOut('fast');
        if($('#q').val() == '')
        {
        	$('#q').val("Search");
        }
    });
	$('#messagewrapper').delay(3000).slideUp('fast');
	
	$("#q").keydown(function (e)
	{
		if (e.which == 40)
		{
			// down
		}
		else if (e.which == 39)
		{
			// up
		}
	});

});
function lookup()
{
	if($('#q').val().length == 0)
	{
		$('#suggestions').fadeOut('fast');
	}
	else if($('#q').val().length > 2)
	{
		$.ajax({
			type: "POST",
			url: "/search/box",
			data: {q: $('#q').val()},
			dataType: "html",
			success: function(results)
			{
        		$('#suggestions').fadeIn('fast');
				$('#suggestions').html(results);
			},
			error: function(e, m)
			{
        		$('#suggestions').fadeIn('fast');
				$('#q').html("<p>error</p>");
			}
		});
	}
}
function closemessage()
{
	$('#messagewrapper').slideUp('fast');
}
function destroymesssage()
{
	$('#messagewrapper').remove();
}
function sitemap()
{
	$('#sitemap').slideToggle('fast');
}