//This file contols the navigational structure of the web site. Be careful when editing.
//Top - Vertical Submenu code; Bottom - Vertical Menu

/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* Modified for use for the Annandale High School NHS by Peter Epley, Class of 2008
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for Index menu (not used)
var menu1=new Array()
menu1[0]='<a href="./index.htm" class="menulink">NHS Home</a>'

//Contents for About NHS
var menu2=new Array()
menu2[0]='<a href="./about.htm" class="menulink">About</a>'
menu2[1]='<a href="http://www.thea-blast.org/news/134/ARTICLE/1217/2007-11-05.html" class="menulink" target="_blank">News</a>'
menu2[2]='<a href="./application.htm" class="menulink">Application</a>'

//Contents for Calendar
var menu3=new Array()
menu3[0]='<a href="./calendar.htm" class="menulink">View Calendar</a>'
menu3[1]='<a href="forms/NHS Calendar 2009.pdf" class="menulink" target="_blank">Download</a>'

//Contents for Service
var menu4=new Array()
menu4[0]='<a href="./service.htm" class="menulink">Service</a>'
menu4[1]='<a href="./ossian.htm" class="menulink">Ossian Hall Clean-Up</a>'
menu4[2]='<a href="./student.htm" class="menulink">Student to Student</a>'

//Contents for Leadership (not used)
var menu5=new Array()
menu5[0]='<a href="./leadership.htm" class="menulink">Leadership</a>'

//Contents for Photo Gallery (not used)
var menu6=new Array()
menu6[0]='<a href="./photo.htm" class="menulink">Photo Gallery</a>'

//Contents for Constitution
var menu7=new Array()
menu7[0]='<a href="./constitution.htm" class="menulink">View</a>'
menu7[1]='<a href="forms/Constitution of the National Honor Society of Annandale High School.doc" target="_blank" class="menulink">Download WORD</a>'
menu7[2]='<a href="forms/Constitution of the National Honor Society of Annandale High School.pdf" target="_blank" class="menulink">Download PDF</a>'

//Contents for AHS Home
var menu8=new Array()
menu8[0]='<a href="http://www.fcps.edu/AnnandaleHS/" target="_blank" class="menulink">AHS Home</a>'
menu8[1]='<a href="http://www.fcps.edu/AnnandaleHS/StudentActivities/studentact.htm" target="_blank" class="menulink">Student Activities</a>'
menu8[2]='<a href="http://fcps.blackboard.com" target="_blank" class="menulink">Blackboard</a>'


var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" 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=-500
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-obj.offsetWidth < 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 menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
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")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-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)
}


////////////////////////////////////////////////////////////////////////////////
//
//Vertical Menu Code by Peter Epley, AHS Class of 2008
//
////////////////////////////////////////////////////////////////////////////////
var ns4class=''

function writenav() {

document.write("<table border=\"0\" width=\"100%\">");
document.write("<tr><td width=\"100%\"><a href=\"./index.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu1, '140px')\" onMouseout=\"delayhidemenu()\">NHS Home Page</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./about.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu2, '140px')\" onMouseout=\"delayhidemenu()\">About NHS</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./calendar.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu3, '140px')\" onMouseout=\"delayhidemenu()\">Calendar</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./service.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu4, '140px')\" onMouseout=\"delayhidemenu()\">Service</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./leadership.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu5, '140px')\" onMouseout=\"delayhidemenu()\">Leadership</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./photo.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu6, '140px')\" onMouseout=\"delayhidemenu()\">Photo Gallery</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"./constitution.htm\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu7, '140px')\" onMouseout=\"delayhidemenu()\">Constitution</a></td></tr>");
document.write("<tr><td width=\"100%\"><a href=\"http://www.fcps.edu/AnnandaleHS/\" class=\"menulink\" class=&{ns4class}; onMouseover=\"dropdownmenu(this, event, menu8, '140px')\" onMouseout=\"delayhidemenu()\">AHS Home Page</a></td></tr>");
document.write("</table>");

}
