﻿dropmenu = function() {
    var lis = document.getElementById("altmenu").getElementsByTagName("li");
    for (var i = 0; i < lis.length; ++i) {
        lis[i].onmouseover = function() {
            var ul = this.getElementsByTagName("ul");
            for (var a = 0; a < ul.length; ++a) {
                ul[a].style.left = "auto";
            }
        }
        lis[i].onmouseout = function() {
            var ul = this.getElementsByTagName("ul");
            for (var a = 0; a < ul.length; ++a) {
                ul[a].style.left = "-999em";
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", dropmenu);


dropmenu2 = function() {
    if (document.getElementById("altmenu2")) {
        var lis = document.getElementById("altmenu2").getElementsByTagName("li");
        for (var i = 0; i < lis.length; ++i) {
            lis[i].onmouseover = function() {
                var ul = this.getElementsByTagName("ul");
                for (var a = 0; a < ul.length; ++a) {
                    ul[a].style.left = "auto";
                }
            }
            lis[i].onmouseout = function() {
                var ul = this.getElementsByTagName("ul");
                for (var a = 0; a < ul.length; ++a) {
                    ul[a].style.left = "-999em";
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", dropmenu2);

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize() {

    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {
        xScroll = window.innerWidth + window.scrollMaxX;
        //xScroll = document.body.scrollWidth;
        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 windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        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;
    }

   

    // for small pages with total height less then height of the viewport
    if (yScroll > windowHeight) {
        pageHeight = windowHeight;
        fullHeight = yScroll;
    } else {
        pageHeight = yScroll;
        fullHeight = windowHeight;
    }

    // for small pages with total width less then width of the viewport
    if (xScroll > windowWidth) {
        pageWidth = windowWidth;
        fullWidth = xScroll;
    } else {
        pageWidth = xScroll;
        fullWidth = windowWidth;    
    }


//    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight)
    //    return arrayPageSize;
    return [pageWidth, pageHeight, fullWidth, fullHeight];
}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll() {

    var yScroll;
    var xScroll;

    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;
    }

    arrayPageScroll = new Array(xScroll, yScroll)
    return arrayPageScroll;
}

//function getScrollOffsets() {
//    return _returnOffset(
//      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
//      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
//}

//function _returnOffset(l, t) {
//    var result = [l, t];
//    result.left = l;
//    result.top = t;
//    return result;
//};