$(function() {
	$('#gsearch').suggest("script/gsearch.php");

	$('#gsearch').focus(function() {
	    if($(this).val() == "Rechercher...")
		{
		    $(this).val("");
		}
	});
	
	$('#gsearch').blur(function() {
	    if($(this).val() == "")
		{
		    $(this).val("Rechercher...");
		}
	});

	$('#search').keydown(function(event) {
	    if (event.keyCode == '13') {
		 $(this).parent().submit();
	    }
	});
})


/* FUNCTIONS */
$(function() {
    setInterval("highlight()", 4000);
});


function highlight()
    {
	$('.highlight').fadeOut(300);
	$('.highlight').fadeIn(500);
	$('.highlight').fadeOut(300);
	$('.highlight').fadeIn(500);
    }

 /* PANOPLIES */
 $(function() {
	$('table.classic_table.panoplies a.minimize').click(function() {
	    if($(this).parent().parent().next('tr').css('display') == 'none')
		{
		    $(this).parent().parent().next('tr').show();
		    $(this).html('Masquer');
		} else {
		    $(this).parent().parent().next('tr').hide();
		    $(this).html('Afficher');
		}
	   return false;
	});
})

/* CHALLENGES */
 $(function() {
	$('table.classic_table.challenges a.minimize').click(function() {
	    if($(this).parent().parent().next('tr').css('display') == 'none')
		{
		    $(this).parent().parent().next('tr').show();
		    $(this).html('Masquer');
		} else {
		    $(this).parent().parent().next('tr').hide();
		    $(this).html('Afficher');
		}
	   return false;
	});
})
