title: randomly fade images in and out
body: <p>I want to fade in and out some images,randomly from when the page loads until closed.
  What I have so for.
  css</p>
  
  <pre><code>#block{position:relative;top:100px;left:100px;}
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="block"&gt;
  &lt;img src="images/block/blockone.jpg"width="95"height="95"&gt;
  &lt;img src="images/block/blocktwo.jpg"width="95"height="95"&gt;
  //Five images as such
  &lt;/div&gt;
  </code></pre>
  
  <p>The script</p>
  
  <pre><code>function random(n){
  return Math.floor(Math.random()*n);
  var transition_time=500;
  var waiting_time=500;
  var images=$('div#block img');
  var n=images.length;
  var current=random(n);
  images.hide();
  images.eq(current).show();
  var interval_id=setInterval(function(){
  images.eq(current).fadeOut(transition_time,function(){current=random(n);
  images.eq(current).fadeIn(transition_time);
  });
  },2*transition_time+waiting_time);
  </code></pre>
  
  <p>It is not working and I' really like to hear your advice</p>