var currentSlide;

$(document).ready(function() {
    $(window).load(function() {
        setTimeout("nextSlide()",3000);
    });
});

function nextSlide() {
    if (!currentSlide) currentSlide = firstSlide()

    nextOne = currentSlide.next("li");

    if (nextOne.length == 0)
        nextOne = firstSlide();
    
    nextOne.css({zIndex:99}).show();
    currentSlide.css({zIndex:100}).fadeOut(1700,"",setTimeout(function() {
        currentSlide = nextOne;
        setTimeout("nextSlide()",3000);
    }));            
}

function firstSlide() {
    return $(".slides").find("li:first");
}

jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ($(window).height() - this.height()) / 8+$(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2+$(window).scrollLeft() + "px");
    return this;
} 


