﻿function storePageScrollPosition() {
    if (document.getElementById("XPos").value != "") {
        var x = document.getElementById("XPos").value;
        var y = document.getElementById("YPos").value;
        window.scrollTo(x, y);
    }
    document.getElementById("XPos").value = "0";
    document.getElementById("YPos").value = "0";
}

function scrollPageToPosition() {
    var scrollX, scrollY;
    if (document.all) {
        if (!document.documentElement.scrollLeft)
            scrollX = document.body.scrollLeft;
        else
            scrollX = document.documentElement.scrollLeft;
        if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
        else
            scrollY = document.documentElement.scrollTop;
    }
    else {
        scrollX = window.pageXOffset;
        scrollY = window.pageYOffset;
    }
    document.getElementById("XPos").value = scrollX;
    document.getElementById("YPos").value = scrollY;
}

function swapSelectedOther(list, textBox) {
    var selectedVal;

    selectedVal = list.options[list.selectedIndex].value;
    textBox.value = selectedVal;
    if (selectedVal == '') {
        textBox.style.display = '';
        textBox.focus();
    } else {
        textBox.style.display = 'none';
    }
}

function hideObject(id) {
    document.getElementById(id).style.display = 'none';
}

function setUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}

if (document.getElementById("navigation") != null) {
    navHover = function() {
        var lis = document.getElementById("navigation").getElementsByTagName("LI");
        for (var i = 0; i < lis.length; i++) {
            lis[i].onmouseover = function() {
                this.className += " iehover";
            }
            lis[i].onmouseout = function() {
                this.className = this.className.replace(new RegExp(" iehover\\b"), "");
            }
        }
    }
    if (window.attachEvent) window.attachEvent("onload", navHover);
}
