// Start - SPOTLIGHT ROTATION
var currentSpotlight = '';
        
function startSpotlight() {
    spotRotations = spotlightsArray.length;
    var currentRotation = Math.floor(Math.random()*spotRotations);
    if(currentRotation == 0) {
        currentRotation = 1;
    }
    for (i=1; i<spotRotations; i++) {
        if(i != currentRotation) {
            document.getElementById(spotlightsArray[i]).style.display = 'none';
        }
        else {
            document.getElementById(spotlightsArray[i]).style.display = 'block';
        }
    }
    highlightSpotNav(currentRotation);
    currentSpotlight = currentRotation;
}
var loopingStatus = 1;
var MaskOpacity = '';
var currentMask = '';
function rotateSpotlight() {
    currentSpotlight = currentSpotlight - 1;
    if(currentSpotlight == 0) {
        currentSpotlight = spotlightsArray.length - 1;
    }
    if(loopingStatus == 1) { 
        setTimeout("maskOn('mask_spotlight','spotlights')",5000);
        setTimeout("loadSpotlight(currentSpotlight)",5500);
        setTimeout("maskOff()",6000);
        setTimeout("rotateSpotlight();",8000);
    }
}
 
function detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
    }
}
                    
//var MacXFF = detectMacXFF();
var MacXFF = false;
        
function maskOn(maskID,maskContainer) {
    MaskOpacity = 0;
    currentMask = document.getElementById(maskID);
    maskContainer = document.getElementById(maskContainer);
    currentMask.style.height = maskContainer.offsetHeight - 15 + 'px';
    currentMask.style.display = "block";
    if(MacXFF == true) {
        currentMask.style.opacity = 1;
        currentMask.style.background = 'none'; 
        currentMask.style.backgroundImage = "url(/images/pagemask.png)";
        currentMask.style.backgroundRepeat = "repeat";
    }
    else {            
        fadeOn();
    }
}
function fadeOn() {
    if(MaskOpacity < 1) {
        MaskOpacity = MaskOpacity + .1;
        currentMask.style.opacity = MaskOpacity;
        currentMask.style.filter = 'alpha(opacity=' + MaskOpacity*100 + ')';
        setTimeout("fadeOn()",20);
    }
}
            
function maskOff() {
    MaskOpacity = 1;
    if(MacXFF == true) { 
        currentMask.style.display = "none";
    }
    else {
        fadeOff();
    }
}
function fadeOff() {
    if(MaskOpacity > 0) {
        MaskOpacity = MaskOpacity - .1;
        currentMask.style.opacity = MaskOpacity;
        currentMask.style.filter = 'alpha(opacity=' + MaskOpacity * 100 + ')';
        setTimeout("fadeOff()",20);
    }
    else {
        MaskOpacity = 0;
        currentMask.style.display = "none";
    }    
}
function setLooping(loopset) {
    loopingStatus = loopset;
}
// End - SPOTLIGHT ROTATION
   
// Start - SPOTNAV     
spotnavPrefix = 'spotnav_';
spotnavlnkPrefix = 'spotnavlnk_';
            
function initSpotNav() {
    for(i=1; i<spotlightsArray.length; i++) {
        document.getElementById(spotnavPrefix + i).style.display = "block";
        document.getElementById(spotnavlnkPrefix + i).style.backgroundColor = "";
    }
}
        
function loadSpotlight(spotID) {
    for(i=1; i<spotlightsArray.length; i++) {
        document.getElementById(spotnavlnkPrefix + i).style.backgroundColor = "";
        document.getElementById(spotlightsArray[i]).style.display = "none";
    }
    document.getElementById(spotlightsArray[spotID]).style.display = "block";
    highlightSpotNav(spotID);
}
        
function highlightSpotNav(spotID) {
    document.getElementById(spotnavlnkPrefix + spotID).style.backgroundColor = "#1A1D55";
}
// End - SPOTNAV