﻿var isIE6 = (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') == -1);
var isIE = window.addEventListener ? false : true;

AddEvent(window.document, 'click', HideSplash);
function HideSplash() {
   $('modSplashScreen').style.display = 'none';
   RemoveEvent(window.document, 'click', HideSplash);
   if (isIE6) {
       IE6SelectFix('visible');
   }
}
function SplashScreen() {    
    var marginLeft = 0;
    var splashscreen = $('modSplashScreen');
    if (isIE6) {
        IE6SelectFix('hidden');
    }
    if (isIE) {
        marginLeft = document.body.clientWidth - 660;
    }
    else {
        marginLeft = window.outerWidth - 660;
    }

    splashscreen.style.left = marginLeft / 2 + 'px';
    
    var wheight = GetWindowHeight();
    var marginTop = wheight - 275;
    if (marginTop > 0) {
        splashscreen.style.top = marginTop / 2 + 'px';
    } else {
        splashscreen.style.top = '30px';
    }
    splashscreen.style.display = 'block';
}
function GetWindowHeight() {
    var windowHeight = 0;
    if (self.innerHeight) {	// all except Explorer
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowHeight = document.body.clientHeight;
    }
    return windowHeight;
}
function IE6SelectFix(newState) {

    var elements = document.documentElement.getElementsByTagName('select');

    for (var i = 0; i < elements.length; i++) {
        elements[i].style.visibility = newState;
    }

}