/*jslint browser:true,undef:true,eqeqeq:false,nomen:true,white:false,plusplus:false,onevar:true */
/*global jQuery, $ */

// Serenity Functions, for the serenity.php page

/* show/hide toggle the "suggestions" div */
function toggleSuggestions() {
   var display,
       suggestion = $("#suggestions"),
       hider = $("#hider");

   display = suggestion.attr('displayed');

   if (display == 'on') {
     suggestion.fadeOut(1000);
     hider.attr("src","media/images/show-suggestion.gif");
     display = 'off';
   } else {
     suggestion.fadeIn(1000);
     hider.attr("src","media/images/hide-suggestion.gif");
     display = 'on';
   }
   suggestion.attr('displayed', display);
}

/* dom hook and setup */
$(function() {
    $('#hider').click(toggleSuggestions);
    $('#suggestions').attr('displayed', 'on');
});

