Hi, new to jQuery, not to JS

Hi, new to jQuery, not to JS

Having a tough time integrating the 2. Trying to create 2 loops, the inner one I had working as below, until I tried to add the outer loop which iterates through the tables. Appreciate any pointers. 

<script type="text/javascript">
// <![CDATA[ 

var i=0;
$("document").ready(function() {
$("div").fadeOut(1000);
if(i<5) {

$("table:eq(i) div").each(function(index) {
$(this).delay(1000*index).fadeIn(1000);


});
i++;  }

});
// ]]> 
</script>