﻿//Spotlight JS Methods
//V 1

var igb_spotlight_activeSpotlight = '';

function igb_spotlight_toggleSpotlight(clientId) {

    if (igb_spotlight_activeSpotlight != '' && igb_spotlight_activeSpotlight != clientId) {
        var oldSpot = document.getElementById(igb_spotlight_activeSpotlight);
        oldSpot.style.display = 'none';
    }

    var spotlight = document.getElementById(clientId);
    
    if (spotlight.style.display == 'none')
        spotlight.style.display = '';
    else
        spotlight.style.display = 'none';

    var bWidth = document.body.clientWidth;
    var bHeight = document.body.clientHeight;

    if (window.innerHeight) {
        bWidth = window.innerWidth;
        bHeight = window.innerHeight;
    }
    else if (document.documentElement.clientHeight != undefined || document.documentElement.clientHeight != 0) {
        bWidth = document.documentElement.clientWidth;
        bHeight = document.documentElement.clientHeight;
    }
    else {
        bWidth = document.body.clientWidth;
        bHeight = document.body.clientHeight;
    }
    
    var sWidth = spotlight.offsetWidth;
    var sHeight = spotlight.offsetHeight;

    spotlight.style.left = (bWidth - sWidth) / 2 + 'px';
    spotlight.style.top = (bHeight - sHeight) / 2 + 'px';
    
    igb_spotlight_activeSpotlight = clientId;
}