if (!document.getElementById) {
    if (document.all) {
        accessObj = function() {
            if (typeof document.all[arguments[0]] != "undefined")
                return document.all[arguments[0]]
            else
                return null
        }
    }
    else if (document.layers) {
        accessObj = function() {
            if (typeof document[arguments[0]] != "undefined")
                return document[arguments[0]]
            else
                return null
        }
    }
}
else {
    accessObj = function() {
        return document.getElementById(arguments[0]);
    }
}

function setOpacity(objname, o) {
    var obj = accessObj(objname);
    var per = o / 100;
    if (o < 0) {
        o = 0;
        per = 0;
    }
    if (o > 100) {
        o = 100;
        per = 1;
    }
    obj.style.opacity = (per);
    obj.style.MozOpacity = (per);
    obj.style.KhtmlOpacity = (per);
    obj.style.filter = 'alpha(opacity=' + o + ')';
}

function openDiv(name) {
    var obj = accessObj(name);
    if (!isNull(obj))
        obj.style.display = "block";
    obj.style.zIndex = "10000";
}

function closeDiv(name) {
    var obj = accessObj(name);
    if (!isNull(obj))
        obj.style.display = "none";
}

function isNull(val) {
    return (val == null);
}

function getWindowSize() {
    var windowWidth, windowHeight;

    if (self.innerHeight) {	// all except Explorer
        if (document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth;
        } else {
            windowWidth = self.innerWidth;
        }
        windowHeight = self.innerHeight;

    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    return [windowWidth, windowHeight];
}

function getPageSize() {
    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {
        xScroll = window.innerWidth + window.scrollMaxX;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }

    var temp = getWindowSize();
    var windowWidth = temp[0];
    var windowHeight = temp[1];

    // for small pages with total height less then height of the viewport
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if (xScroll < windowWidth) {
        pageWidth = xScroll;
    } else {
        pageWidth = windowWidth;
    }

    return [pageWidth, pageHeight];
}
