var slideShow = new Array()
slideShow[0] = "img/tanitim/1.jpg";
slideShow[1] = "img/tanitim/2.jpg";
slideShow[2] = "img/tanitim/3.jpg";
slideShow[3] = "img/tanitim/4.jpg";
slideShow[4] = "img/tanitim/5.jpg";

function fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current) {
    
    var listSize = imageList.length;
   
    if (!current || current >= listSize) current = 0;
    
    if (!slideDuration) slideDuration = 5000;

    if (!fadeSpeed) fadeSpeed = 1000;
  
    $(elem + " img").attr("src", imageList[current]);
	 $("#numerator img").attr("src", "img/tanitim/numerator-"+current+".gif");
   
    if (current == (listSize - 1)) {
        $(elem).css("background", "transparent url(" + imageList[0] + ") no-repeat");
    } else {
   
        $(elem).css("background", "transparent url(" + imageList[current + 1] + ") no-repeat");
    }
   
    $(elem + " img").animate({ opacity: "1" }, slideDuration).animate({ opacity: "0.01" }, fadeSpeed, function() { $(this).css("opacity", "1"); fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current + 1) });
} 

function runSlideshow(){
    fadeinSlideshow("#tanitim", slideShow, 5000, 1000);
}

$(document).ready(runSlideshow);


