$(window).load(function () {
    var total = $('#slider img').length;
    var rand = Math.floor(Math.random() * total);
    $('#slider').nivoSlider({
        effect: 'random',
        slices: 8,
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 500,
        pauseTime: 5000,
        startSlide: rand,
        captionOpacity: 1,
        directionNav: false,
        directionNavHide: true,
        controlNav: true,
        controlNavThumbs: false,
        controlNavThumbsFromRel: true,
        keyboardNav: false,
        pauseOnHover: true,
        manualAdvance: false,
        beforeChange: function () { },
        afterChange: function () { },
        slideshowEnd: function () { },
        lastSlide: function () { },
        afterLoad: function () { }
    });
});
