this is an example i use for using the IF operator in javascript when using jquery.
$(document.body).click(function () {
if ($("div:first").is(":hidden")) {
$("div").slideDown("slow");
} else {
$("div").hide();
}
});


you can find the complete script at the jquery official site:

http://api.jquery.com/slideDown/