﻿function randomImage(element, imagePath, imageExtension, imageTotal) {
    /* get a random number within the defined range and set the background
    image for the defined element accordingly */

    if ($('body').hasClass('fullwidth')) {
        imgPath = (imagePath + 't' + imageExtension);
        $(element).css('background-image', ('url("' + imgPath + '")'));
    } else {
        randomNumber = Math.round(Math.random() * (imageTotal - 1)) + 1;
        imgPath = (imagePath + randomNumber + imageExtension);
        $(element).css('background-image', ('url("' + imgPath + '")'));
    }
};

