﻿/*
    Tempora Software Ltd © 2008
*/
function swapImages(elmt) {
    var path = elmt.src;
    var ext = path.substring(path.lastIndexOf("."));
    var elmt_name = path.substring(path.lastIndexOf("/")+1, path.indexOf("-"));
    var imgPath = path.substring(0, path.lastIndexOf("/"));
    if (path.indexOf("-off") > 0) {
        elmt.src = imgPath + "/" + elmt_name + "-on" + ext;
    } else if (path.indexOf("-on") > 0) {
        elmt.src = imgPath + "/" + elmt_name + "-off" + ext;
    }
}
function openWindow(wndPath, wndName) {
    window.open(wndPath, wndName, "menubar=0,scrollbars=1,resizable=1,status=1");
}
function trialProgress() {
    var obj1 = document.getElementById("MainText");
    var obj2 = document.getElementById("MainSubmit");
    var obj3 = document.getElementById("ProgressText");
    if (obj1 != null && obj2 != null && obj3 != null) {
        obj1.style.display = "none";
        obj2.style.display = "none";
        obj3.style.display = "block";
    }
}
document.onkeypress = function(e) {
    if (document.location.href.lastIndexOf("/Login.aspx") > 0) {
        var cPrefix = document.getElementById("ClientPrefix");
        var evt = e || window.event;
        var key = evt.which || evt.keyCode;

        // IE
        if (window.event != null) {
            if (key == 13) {
                document.getElementById(cPrefix.innerText + "ContentPane_btnLogin").click();
                evt.returnValue = false;
            }
        } else {
            // FF
            if (key == 13) {
                document.getElementById(cPrefix.innerText + "ContentPane_btnLogin").click();
                evt.preventDefault();
            }
        }
    } else {
        return;
    }
}
window.onload = function(e) {
    var footer = document.getElementById("ExpandingCell");
    var container = document.getElementById("MainContainer");
    if (footer != null) {
        var docHeight = document.documentElement.clientHeight;
        if (footer.offsetTop < document.documentElement.clientHeight) {
            var newFooterHeight = docHeight - container.offsetHeight;
            if (newFooterHeight > 0) {
                footer.style.height = docHeight - container.offsetHeight + "px";
            }
        }
    }
}
