
// EDIT THESE ARRAYS
// EDIT THESE ARRAYS
// EDIT THESE ARRAYS
var about = new Array()
 about[0] = '<a href="philosophy.cfm">Our Philosophy</a>'
about[1] = '<a href="programs.cfm">Programs</a>'
about[2] = '<a href="camps.cfm">Summer Camps</a>'
about[3] = '<a href="bios.cfm">Our Staff</a>'
about[4] = '<a href="facility.cfm">Our Facility</a>'

var resource = new Array()
 resource[0] = '<a href="links.cfm">Links</a>'
resource[1] = '<a href="newparentinfo.cfm">New Parent Info</a>'

var events = new Array()
 events[0] = '<a href="eventslist.cfm">Events List</a>'
events[1] = '<a href="events.cfm">Events Calendar</a>'


// EDIT THESE ARRAYS
// EDIT THESE ARRAYS
// EDIT THESE ARRAYS




/////No further editting needed
/////No further editting needed
/////No further editting needed
/////No further editting needed
function getInternetExplorerVersion() {
    var rv = -1;
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
        rv = parseFloat(RegExp.$1);
    }
    return rv;
}

var menuwidth = '120px'
//default menu width
var menubgcolor = '#BAC48D'
//menu bgcolor
var disappeardelay = 250
//menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick = "yes"
//hide menu when user clicks within menu?

function getCenter() {
    var screenwidth = document.body.clientWidth;
    var screenhalf = screenwidth / 2;
    return screenhalf;
    //navDropDiv.style.left = (screenhalf - 344);
}

function whichBrs() {
    var agt = navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1) return 'Opera';
    if (agt.indexOf("staroffice") != -1) return 'Star Office';
    if (agt.indexOf("webtv") != -1) return 'WebTV';
    if (agt.indexOf("beonex") != -1) return 'Beonex';
    if (agt.indexOf("chimera") != -1) return 'Chimera';
    if (agt.indexOf("netpositive") != -1) return 'NetPositive';
    if (agt.indexOf("phoenix") != -1) return 'Phoenix';
    if (agt.indexOf("firefox") != -1) return 'Firefox';
    if (agt.indexOf("safari") != -1) return 'Safari';
    if (agt.indexOf("skipstone") != -1) return 'SkipStone';
    if (agt.indexOf("msie") != -1) return 'Internet Explorer';
    if (agt.indexOf("netscape") != -1) return 'Netscape';
    if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
    if (agt.indexOf('\/') != -1) {
        if (agt.substr(0, agt.indexOf('\/')) != 'mozilla') {
            return navigator.userAgent.substr(0, agt.indexOf('\/'));
        }
        else return 'Netscape';
    } else if (agt.indexOf(' ') != -1)
    return navigator.userAgent.substr(0, agt.indexOf(' '));
    else return navigator.userAgent;
}

var browserName = whichBrs();

if (browserName == 'Firefox') {
    // FIREFOX OFFSET
    var browserOffsetFix = 14;
    var horzOffsetFix = -2;
}
 else {
    // IE OFFSET
    var browserOffsetFix = getInternetExplorerVersion() < 8 ? 42: 0;
    var horzOffsetFix = 1;
}

var ie4 = document.all
var ns6 = document.getElementById && !document.all

if (ie4 || ns6)
 document.write('<div id="dropmenudiv" style="visibility:hidden;width:' + menuwidth + ';background-color:' + menubgcolor + '" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

 function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left") ? what.offsetLeft: what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft: totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth) {
    if (ie4 || ns6)
    dropmenuobj.style.left = dropmenuobj.style.top = "-500px"
    if (menuwidth != "") {
        dropmenuobj.widthobj = dropmenuobj.style
        dropmenuobj.widthobj.width = menuwidth
    }
    if (e.type == "click" && obj.visibility == hidden || e.type == "mouseover")
    obj.visibility = visible
    else if (e.type == "click")
    obj.visibility = hidden
}

function iecompattest() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement: document.body
}

function clearbrowseredge(obj, whichedge) {
    var edgeoffset = 0
    if (whichedge == "rightedge") {
        var windowedge = ie4 && !window.opera ? iecompattest().scrollLeft + iecompattest().clientWidth - 15: window.pageXOffset + window.innerWidth - 15
        dropmenuobj.contentmeasure = dropmenuobj.offsetWidth
        if (windowedge - dropmenuobj.x < dropmenuobj.contentmeasure)
        edgeoffset = dropmenuobj.contentmeasure - obj.offsetWidth
    }
    else {
        var topedge = ie4 && !window.opera ? iecompattest().scrollTop: window.pageYOffset
        var windowedge = ie4 && !window.opera ? iecompattest().scrollTop + iecompattest().clientHeight - 15: window.pageYOffset + window.innerHeight - 18
        dropmenuobj.contentmeasure = dropmenuobj.offsetHeight
        if (windowedge - dropmenuobj.y < dropmenuobj.contentmeasure) {
            //move up?
            edgeoffset = dropmenuobj.contentmeasure + obj.offsetHeight
            if ((dropmenuobj.y - topedge) < dropmenuobj.contentmeasure)
            //up no good either?
            edgeoffset = dropmenuobj.y + obj.offsetHeight - topedge
        }
    }
    return edgeoffset
}

function populatemenu(what) {
    if (ie4 || ns6)
    dropmenuobj.innerHTML = what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth, fc) {
    var leftAlign = getCenter() - fc + horzOffsetFix;
    if (window.event) event.cancelBubble = true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()
    dropmenuobj = document.getElementById ? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)

    if (ie4 || ns6) {
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)


        dropmenuobj.x = getposOffset(obj, "left");
        dropmenuobj.y = getposOffset(obj, "top") + browserOffsetFix;
        dropmenuobj.style.left = leftAlign + "px";
        dropmenuobj.style.top = dropmenuobj.y + "px"; // - clearbrowseredge(obj, "bottomedge") + "px"
    }

    return clickreturnvalue()
}

function clickreturnvalue() {
    if (ie4 || ns6) return false
    else return true
}

function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
}

function dynamichide(e) {
    if (ie4 && !dropmenuobj.contains(e.toElement))
    delayhidemenu()
    else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
}

function hidemenu(e) {
    if (typeof dropmenuobj != "undefined") {
        if (ie4 || ns6)
        dropmenuobj.style.visibility = "hidden"
    }
}

function delayhidemenu() {
    if (ie4 || ns6)
    delayhide = setTimeout("hidemenu()", disappeardelay)
}

function clearhidemenu() {
    if (typeof delayhide != "undefined")
    clearTimeout(delayhide)
}

if (hidemenu_onclick == "yes")
 document.onclick = hidemenu

