var blokadaDiv = 0;
var activeBox = 1; // domyslny pierwszy box
var changeBox; //uchwyt interwalu glownej zmieniarki

function startAutoChangeBox()
{
   changeBox = setInterval("autoChangeBox()", 5000);
}

   // automatyczna zmiana divow
function autoChangeBox()
{
	countDiv = $('#images').children('div.img').length;
   if(countDiv > 1)
   {
      activeBox = parseInt(activeBox) + 1;
      if(activeBox > countDiv)
      {
         activeBox = 1;
      }
      changeBoxImg(activeBox, countDiv);
   }
}

function changeBoxImg(id, countDiv)
{
   if(id > 1) var id_prev = id - 1;
   else var id_prev = countDiv;
   if(id < countDiv) var id_next = id + 1;
   else var id_next = 1;
	$('#images').children('div#img'+id_prev).fadeOut(3000);
   $('#images').children('div#img'+id).fadeIn(3000);
   if(id==1) $('#images').children('div.tit').fadeOut(1000);
   $('#images').children('div#tit'+id_prev).fadeIn(3000);
}
