﻿function GlobalLoad() {
    if (document.imgSpinner != null) {
        PreloadImage(document.imgSpinner);
    }
    if (document.imgSpinnerWhite != null) {
        PreloadImage(document.imgSpinnerWhite);
    }
    if (document.imgSpacer != null) {
        PreloadImage(document.imgSpacer);
    }
}
addEvent(window, 'load', GlobalLoad);
/* http://www.alistapart.com/articles/footers/ */
function initCreditLine() {
    var creditElement = document.getElementById('ezytire-credit-line');
    if (creditElement != null) {
        setCreditLine();
        document.CreditElement = creditElement;
        if (creditElement.attachEvent) {
            creditElement.attachEvent('onmouseover', creditLineHover);
            creditElement.attachEvent('onmouseout', creditLineBlur);
        } else if (creditElement.addEventListener) {
            creditElement.addEventListener('mouseover', creditLineHover, false);
            creditElement.addEventListener('mouseout', creditLineBlur, false);
        }
    }
}
function getCreditLine() {
    var creditElement = document.CreditElement;
    if (creditElement == null) {
        creditElement = document.getElementById('ezytire-credit-line');
        if (creditElement != null) {
            document.CreditElement = creditElement;
        }
    }
    return creditElement;
}
function creditLineHover() {
    if (document.HideCreditTimeout) clearTimeout(document.HideCreditTimeout);
    var creditElement = getCreditLine();
    if (creditElement != null) {
        var hoverCss = '-hover';
        if (creditElement.className.indexOf(hoverCss) < 0) {
            creditElement.className += hoverCss;
        }
    }
}
function creditLineBlur() {
    document.HideCreditTimeout = setTimeout("creditLineBlurGo()", 2000);
}
function creditLineBlurGo() {
    var creditElement = getCreditLine();
    if (creditElement != null) {
        var hoverCss = '-hover';
        creditElement.className = creditElement.className.replace(hoverCss, '');
    }
}
function setCreditLine() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            var contentHeight = getElementHeight('top');
            var noticeHeight = getElementHeight('trial-notice');
            var borderHeight = 6;
            var creditElement = getCreditLine();
            if (creditElement != null) {
                var footerHeight = creditElement.offsetHeight;
                if (windowHeight - (contentHeight + footerHeight) >= 0) {
                    var positionHeight = (windowHeight - footerHeight - noticeHeight - borderHeight) + 'px';
                    creditElement.style.top = positionHeight;
                }
                else {
                    creditElement.style.top = contentHeight + 'px';
                }
            }
        }
    }
}
function getIsMSIE() {
    var isMSIE = /*@cc_on!@*/false;
    return isMSIE;
}
function getElementHeight(id) {
    var elementHeight = 0;
    var element = document.getElementById(id);
    if (element != null) {
        elementHeight = element.offsetHeight;
    }
    return elementHeight;
}
function getWindowHeight() {
    var windowHeight = 0;
    if (typeof (window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}
addEvent(window, 'load', initCreditLine);
addEvent(window, 'resize', setCreditLine);
