$(document).ready(function () {
   runAnimation = true;
   if (runAnimation == true){
    delay = 100;
    for(x=0;x<5;x++) setTimeout("runAnim('"+(x+1)+"')",delay*x);
   }

   refIN(1);

});


function runAnim(i){
      $("#a"+i).show("slide", { direction: "down" }, 800);
}


maxRef = 6;

function refIN(id){

       $("#l1"+id).show().animate({'marginRight': '+=50', 'opacity': '1'}, 1000);
//       $("#l1"+id).fadeTo(1000, 1, function(){ $("#l1"+id).css('filter','') } );
       $("#l2"+id).show().animate({'marginRight': '-=40', 'opacity': '1'}, 1000);
       setTimeout("refOUT('"+id+"')",5000);

       /*
       ,  function(){ $("#l1"+id).css({'filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src=)"})}
       */
}

function refOUT(id){
       $("#l1"+id).animate({'marginRight': '-=50', 'opacity': '0'}, 1000);
       $("#l2"+id).animate({'marginRight': '+=40', 'opacity': '0'}, 1000);
       nextID = parseInt(id) + 1;
       if (nextID > maxRef) nextID = 1;
       setTimeout("refIN('"+nextID+"')",1000);
}


