var slideShow = new Array()
slideShow[0] = "images/home_images/head01.jpg";
slideShow[1] = "images/home_images/head11.jpg";
slideShow[2] = "images/home_images/head03.jpg";
slideShow[3] = "images/home_images/head04.jpg";
slideShow[4] = "images/home_images/head05.jpg";
slideShow[5] = "images/home_images/head06.jpg";
slideShow[6] = "images/home_images/head07.jpg";
slideShow[7] = "images/home_images/head08.jpg";
slideShow[8] = "images/home_images/head09.jpg";
slideShow[9] = "images/home_images/head10.jpg";
slideShow[10] = "images/home_images/head02.jpg";

function fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current) {
    var listSize = imageList.length;
    if (!current || current >= listSize) current = 0;
    if (!slideDuration) slideDuration = 8000;
    if (!fadeSpeed) fadeSpeed = 4000;
    $(elem + " img").attr("src", imageList[current]);
    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("#home_slideshow", slideShow, 6000, 2000);
}

$(document).ready(runSlideshow);
