show_rest_t = ''; function showres(i,o,idiv) { if (o == 0) { jQuery(idiv + ' .res'+i).hide(); clearTimeout(show_rest_t); } else if(o == 1){ var p = jQuery(idiv + ' > li').length; clearTimeout(show_rest_t); show_rest_t = setTimeout( function() { jQuery(idiv + ' .res'+i).slideDown({queue : false, duration : "slow"}); for (j = 1; j<= p; j++) { if (j != i) { jQuery(idiv + ' .res'+j).hide(); } } } , 500); } };