var current = 0, randnum = 0;
var imgs = new Array(7);

    imgs[0] = "images/banners/banner_home_15_DAL05.jpg";
    imgs[1] = "images/banners/banner-mobile.jpg";
    imgs[2] = "images/banners/banner_home_15_DAL05.jpg";
    imgs[3] = "images/banners/banner_home_14_BYOC_light.jpg";
    imgs[4] = "images/banners/banner-mobile.jpg";
    imgs[5] = "images/banners/banner_home_05.jpg";
    imgs[6] = "images/banners/banner_home_11_VMwareESX.jpg";
    

var lnks = new Array(7);

    lnks[0] = "/facilities/dallas-five-details";
    lnks[1] = "resources/mobile-apps/index.html";
    lnks[2] = "/facilities/dallas-five-details";
    lnks[3] = "/cloudlayer/build-your-own-cloud";
    lnks[4] = "resources/mobile-apps/index.html";
    lnks[5] = "services/storage-layer/index.html";
    lnks[6] = "services/software/index.html";
    

var alt = new Array(7);

    alt[0] = "DAL05 Now Online";
    alt[1] = "The Next Killer App? - Introducing the new SoftLayer Mobile Clients";
    alt[2] = "DAL05 Now Online";
    alt[3] = "Build Your Own Cloud - One size doesn't have to fit all";
    alt[4] = "The Next Killer App? - Introducing the new SoftLayer Mobile Clients";
    alt[5] = "StorageLayer";
    alt[6] = "VMware";

function trim(val) {
    return val.replace(/^\s+|\s+$/g, "");
}

function bannerRotate() {
    $('#home-banner').attr('src', imgs[current]).attr('alt', alt[current]);
    $('#home-banner-a').attr('href', lnks[current]);

    if (current == 6)
        current = 0;
    else
        current++;
}

function toDifference()
{   
    $('#sub-content').html($('#softlayer-difference').html());
    $('#sub-title').html($('#difference-title').html());
}

function toSolutions()
{
    $('#sub-content').html($('#softlayer-solutions').html());    
    $('#sub-title').html($('#solutions-title').html());
}

$(function () {
    window.setInterval("bannerRotate()", 7000);

    randnum = Math.floor(Math.random() * 11)
    if (randnum >= 5)
        toDifference();
    else
        toSolutions();    
});
