﻿/// <reference path="jquery-1.6.2-vsdoc.js" />

$(document).ready(function () {
    Cufon.replace('h1, h2', { fontFamily: 'Aller Bold' });
    PhotoSlider.Run();
});


var PhotoSlider = {
    CurrentIndex: 1,
    Time: 5000,
    SlideCount: 0,
    Run: function () {
        this.GetSlideCount();
        window.setTimeout(
            "PhotoSlider.LoadNext();",
            this.Time
            );
    },

    LoadNext: function () {
        toHide = "#slide_" + this.CurrentIndex;
        this.GetNext();
        toShow = "#slide_" + this.CurrentIndex;
        $(toHide).fadeOut(2500);
        $(toShow).fadeIn(2500);
        this.Run();
    },
    GetNext: function () {
        this.CurrentIndex++;
        if (this.CurrentIndex > this.SlideCount) {
            this.CurrentIndex = 1;
        }
    },
    GetSlideCount: function () {
        this.SlideCount = $("#slideshow").children("div").length;
    }

}
