﻿function get_random() {
    var ranNum = Math.floor(Math.random() * 3);
    return ranNum;
}

function setMainNavOnState()
{

}

function updateHomePage() {

    if ($.cookie("returnvisitor") == "true") {
        // Randomize home page content
        var i = get_random();
        i++; // shift into the correct number range
        var bannerID;

        for (x = 1; x < 4; x++) {

            bannerID = "#banner" + x.toString();
            
            if ($(bannerID)) {
                // hide all banners, if they exist.
                $(bannerID).hide();
            }
        }

        bannerID = "#banner" + i.toString();

        if ($(bannerID)) {
            // show randomly selected banner.
            $(bannerID).show();
        }

        if ($('#phone')) {
            // update phone number color to match selected banner.
            var newClass = 'phone' + i.toString();
            $('#phone').removeClass();
            $('#phone').addClass(newClass);
        }
    }
    else {
        $.cookie("returnvisitor", "true");
        // just set cookie. Default content will always be available.
    }
}

