Timeout for javascript execution
===

    jQuery(document).click(function () {        
       
    jQuery('.close-news').css('display', function(){return jQuery('#colorbox').css('display');});
    });
    
I have this script, which make my link appear\dissappear depends on state of #colorbox block. But somewhy link appear\dissappear not immediatelly, but after 2 click.
Basically i have to click one more time in random area to make my script work
I guess its because my html code isnt update fast enought to make . So how do i add some timeout for this script?