Hi - I need to amend the script below so that when the title of each accordion block is clicked on the block will close again. Currently each accordion block only closes when the title of another accordion block is clicked on. I think it's missing a slideToggle somewhere but not sure where to put it! I'm a JS newbie so would really appreciate any help! Many thanks.

$('.accordion ul').hide();
$('.accordion li:first').find('a.title').addClass('tab-active');
$('.accordion ul:first').hide();
$('.accordion li a.title').click(

function() {
var checkElement = $(this).next();
if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
return false;
if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('.accordion ul:visible').slideUp(500);
return false;