var currently_open = false; function ShowAnonce(id, a_id) { if ($.browser.msie && $.browser.version == '5.5') { document.location.href = document.getElementById("a-"+id); } if (currently_open != id) { $.ajax({ url: "/ajax/get-anonce/?a_id=" + a_id, cache: true, timeout: 2000, success: function(html){ if (currently_open) { $("#anonce-" + currently_open).slideUp(300, function(){$("#anonce-" + id).html(html).slideDown(300)}); } else { $("#anonce-" + id).html(html).slideDown(300); } currently_open = id; }, error: function (XMLHttpRequest, textStatus, errorThrown) { document.location.href = $("#a-"+id).attr("href"); } }); } if ($("#anonce-" + id).css("display") == "block") { $("#anonce-" + id).slideUp(300, function(){currently_open = false}); } }