﻿function Flip(listID, textBoxID, key) {
    var theList = document.getElementById(listID);
    var selectedValue = theList.options[theList.selectedIndex].value;
    if (selectedValue == key) {
        theList.style.display = 'none';
        var theTextbox = document.getElementById(textBoxID);
        theTextbox.style.display = 'inline';
    }

}
function ShowAdditionalLicenses(numLicenseListID) {
    var theList = document.getElementById(numLicenseListID);
    var selectedNumber = theList.selectedIndex;

    var serialNumberID;
    var serialNumber;

    var i;
    for (i = 0; i <= selectedNumber; i++) {
        serialNumberID = theList.options[i].value;
        serialNumber = document.getElementById(serialNumberID);
        serialNumber.style.display = "block";
    }
    for (i = selectedNumber + 1; i < theList.options.length; i++) {
        serialNumberID = theList.options[i].value;
        serialNumber = document.getElementById(serialNumberID);
        serialNumber.style.display = "none";
    }

}
function showContent() {
    document.cookie = 'cookieTest' + escape('nothing')
    if (document.cookie == '') {
        document.getElementById("noCookies").style.display = "block";
        document.getElementById("RegistrationContent").style.display = "none";
    } else {
        document.getElementById("RegistrationContent").style.display = "block";
        document.getElementById("noCookies").style.display = "none";
    }
    EnablePage();
}

function pwait(count, co) {
    var pleaseWait = document.getElementById('pleasewait');
    var widthOfPanel = pleaseWait.style.width.replace(/px/, "");
    var heightOfPanel = pleaseWait.style.height.replace(/px/, "");
    var left = Number(ClientWidth()) / 2 - (widthOfPanel / 2);
    var top = Number(ContentHeight()) / 2 - (heightOfPanel / 2);
    var topOffset;
    var leftOffset;

        if (document.documentElement) {
            topOffset = document.documentElement.scrollTop;
            leftOffset = document.documentElement.scrollLeft;
        }
        else if (document.body) {
            topOffset = document.body.scrollTop;
            leftOffset = document.body.scrollLeft;
        }
    pleaseWait.style.top = top + "px";
    pleaseWait.style.left = left + "px";
    pleaseWait.style.display = 'block';

    var shim = document.getElementById("blocker");
    shim.style.top = "0px";
    shim.style.left = "0px";
    shim.style.width = "96%";
    shim.style.height = (FullBrowserHeight() + topOffset - 20) + "px";

    var shield = document.getElementById("sheild");
    shield.style.top = "0px";
    shield.style.left = "0px";

    shield.style.height = (FullBrowserHeight() + topOffset) + "px";
    shield.style.width = "100%";

    shim.style.display = "block";
    shield.style.display = "block";
}
function ClientWidth() {
    var theWidth = 0;
    var content = document.getElementById('KeyscanOnlineRegistrationContent');
    if (window.innerWidth) {
        theWidth = window.innerWidth;
    }

    if (document.documentElement && document.documentElement.clientWidth) {
        theWidth = content.clientWidth;
    }
    else if (content.innerHeight) {
        theWidth = content.clientWidth;
    }


    return theWidth;
}
function ContentHeight() {
    var theHeight = 0;
    var bodyHeight = 0;
    var browserHeight = 0;


    content = document.getElementById('KeyscanOnlineRegistrationContent');

    if (document.body) {
        bodyHeight = document.body.clientHeight;
    }

    if (content.innerHeight) {
        browserHeight = content.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        browserHeight = content.clientHeight;
    }

    theHeight = browserHeight;
   

    return theHeight;
}

function FullBrowserWidth() {
    var theWidth = 0;
    var contentWidth = document.getElementById('KeyscanOnlineRegistrationContent').style.width.replace(/px/, "");
    if (window.innerWidth) {
        theWidth = window.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth) {
        theWidth = document.documentElement.clientWidth;
    }
    else if (document.body) {
        theWidth = document.body.clientWidth;
    }


    return theWidth;
}
function FullBrowserHeight() {
    var theHeight;
    var bodyHeight = 0;
    var browserHeight = 0;
    if (document.body) {
        bodyHeight = document.body.clientHeight;
    }

    if (window.innerHeight) {
        browserHeight = window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        browserHeight = document.documentElement.clientHeight;
    }
    if (browserHeight > bodyHeight) {
        theHeight = browserHeight;
    } else {
        theHeight = bodyHeight;
    }

    return theHeight;
}

function DisablePage() {
    var shim = document.getElementById("blocker");
    shim.style.zIndex = "1";
    shim.style.position = "absolute";

    var shield = document.getElementById("sheild");

    shield.style.zIndex = "2";
    shield.style.left = "0px";
    shield.style.top = "0px";
    shield.style.position = "absolute";
    shield.style.display = 'block';
}

function EnablePage() {
    var shim = document.getElementById("blocker");
    shim.style.display = "none";

    document.getElementById("sheild").style.display = 'none';
}

function WaitForProcessing() {
    DisablePage();
    pwait(0);
}
function IframeProcess()
{ }
