show/hide toggle function

show/hide toggle function

Hi

I have made this toggle function where I can show/hide a layer (.result-layer) by clicking #result_layer_btn. I can also close it with .close-btn.

But if I close it with .close-btn and want to show it again by clicking #result_layer_btn it is not showing the result_over.gif but result.gif.

What can I do?

$p(document).ready(function() {

$p('.result-layer').hide();


$p('#result_layer_btn').toggle (
function() {
$p('#result_layer_btn').attr('src', '/graphics/result_over.gif');
$p('.result-layer').slideToggle('900');
},

function() {
$p('#result_layer_btn').attr('src', '/graphics/result.gif');
$p('.result-layer').slideToggle('900');

}
);

$p('.close-btn').click (function() {
$p('.result-layer').slideUp('900');
$p('#result_layer_btn').attr('src', '/graphics/logos/sport_result.gif');

});

});