﻿/* PUB PROMO MAINHIGHLIGHT HOME PAGE */
function showHighlight(n) {
    var max = 3;
    var toshow = 0;

    if (n > max - 1) {
        toshow = 0;
    }
    else {
        if (n >= 0) {
            toshow = n;
        }
        else {
            toshow = max;
        }
    }


    $(".mainHighlight").hide();

    for (var i = 0; i < $("#mhl_buttons img").length; i++) {
        if (i == n)
        // Change selected highlight's button to the "on" state
            $("#mhl_buttons img").get(n).src = $("#mhl_buttons img").get(n).src.replace(/\_off/, "_on");

        else
        // Replace all buttons to their "off" state
            $("#mhl_buttons img").get(i).src = $("#mhl_buttons img").get(i).src.replace(/\_on/, "_off");
        $("#spotlight" + toshow).fadeIn(600);
    }
}

var curspot = 0;
var t;
var interval = 6000;



function startslideshow() {
    curspot++;
    if (curspot > 2) curspot = 0;
    showHighlight(curspot);
}

function stopslideshow() {
    window.clearInterval(t);
    window.clearTimeout(t);
}

t = window.setInterval('startslideshow()', interval)