﻿// ** General Functions
// Registers an ASP .NET server control for use in JavaScript, mapping the full Client ID to a more friendly name that can be used in JS.
RegisterControl = function(ID, ClientID) {
    eval("window." + ID + " = {}");
    eval("window." + ID + ".get = function GetClientControl() { return document.getElementById(ClientID); }");
}

GetDocumentHeight = function() {
    /// <summary>Get the height of the document.</summary>
    return Math.max(
        Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
        Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
        Math.max(document.body.clientHeight, document.documentElement.clientHeight)
        );
}

GetClientWindowHeight = function() {
    /// <summary>Get the height of the client area.</summary>
    if (window.innerHeight)
        return window.innerHeight;

    if (document.documentElement.clientHeight && document.documentElement.clientHeight > 0)
        return document.documentElement.clientHeight;

    return document.body.clientHeight;
}
