var Switcher = {
    initialize: function()
    {
        container = document.getElementById("switcher");
        if (!container) return false;
        link       = container.getAttribute("href");
        image      = container.getElementsByTagName("img")[0];
        language  = Switcher.getLanguage();
        addEvent(window, "unload", function() {window.clearInterval(Timer);}, false);
        Switcher.doSwitch();
        Timer     = window.setInterval("Switcher.doSwitch()", 4000);
        i = 0;
    },
    doSwitch: function()
    {                        
        var l = Switcher.data.length;
        var i = Math.round((l-1)*Math.random());
        container.href = Switcher.data[i][2];
        image.src = Switcher.data[i][0];
        image.alt = Switcher.data[i][1];
    },
    data: new Array(
        ["/_images/customer_barnsley.png",      "Barnsley",      "/customers/barnsley"],
        ["/_images/customer_bedford.png",       "Bedford",       "/customers/bedford"],
        ["/_images/customer_edinburgh.png",     "Edinburgh",     "/customers/edinburgh"],
        ["/_images/customer_hertfordshire.png", "Hertfordshire", "/customers/hertfordshire"]
    ),
    getLanguage: function()
    {
        return "egov2";
    }
}

addEvent(window, "load", Switcher.initialize, false);
