/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu b1, COMMUNITIES
var menub1=new Array()
menub1[0]='<a target="main" href="http://www.berlinmd.gov">Berlin</a>'
menub1[1]='<a target="main" href="http://www.town.ocean-city.md.us">Ocean City</a>'
menub1[2]='<a target="main" href="http://www.oceanpines.org">Ocean Pines Association</a>'
menub1[3]='<a target="main" href="http://www.cityofpocomoke.com">Pocomoke</a>'
menub1[4]='<a target="main" href="http://www.snowhillmd.com">Snow Hill</a>'

//Contents for menu b2, COUNTY AGENCIES / QUICKLINKS
var menub2=new Array()
menub2[0]='<a href="http://www.co.worcester.md.us/wcso/animalctrl.htm">Animal Control</a>'
menub2[1]='<a href="http://www.co.worcester.md.us/commissioners/comm.htm">County Commissioners</a>'
menub2[2]='<a href="http://www.co.worcester.md.us/drp/drpindex.htm">Development Review & Permitting</a>'
menub2[3]='<a href="http://www.co.worcester.md.us/econ/econindex.htm">Economic Development</a>'
menub2[4]='<a href="http://www.co.worcester.md.us/EmergencyServices/emerservindex.htm">Emergency Services</a>'
menub2[5]='<a href="http://www.wcfmo.org">Fire Marshal</a>'
menub2[6]='<a href="http://www.co.worcester.md.us/hr/jobs.htm">Human Resources</a>'
menub2[7]='<a href="http://www.co.worcester.md.us/jail/jail.htm">Jail</a>'
menub2[8]='<a href="http://www.co.worcester.md.us/pw/publicworks.htm">Public Works</a>'
menub2[9]='<a href="http://www.co.worcester.md.us/recreation/rec.htm">Recreation & Parks</a>'
menub2[10]='<a href="http://www.co.worcester.md.us/wcso/index.html">Sheriffs Office</a>'
menub2[11]='<a href="http://skipjack.net/le_shore/visitworcester/">Tourism</a>'
menub2[12]='<a href="http://www.co.worcester.md.us/trs/treasindex.htm">Treasurer</a>'
menub2[13]='<a href="http://www.co.worcester.md.us/volunteerservices.htm">Volunteer Services</a>'
menub2[14]='<a href="http://www.co.worcester.md.us/pw/waterwastewater.htm">Water & Wastewater</a>'

//Contents for menu b3, LOCAL STATE AGENCIES
var menub3=new Array()
menub3[0]='<a target="main" href="http://www.worcesterlibrary.org/library/LBE.htm">Board of Election Supervisors</a>'
menub3[1]='<a target="main" href="http://www.courts.state.md.us/circuit/worcester/index.html">Clerk of Courts</a>'
menub3[2]='<a target="main" href="http://www.worcesterhealth.org">Health Department</a>'
menub3[3]='<a target="main" href="http://www.worcesterchildren.org">Local Management Board</a>'
menub3[4]='<a target="main" href="http://www.registers.state.md.us/county/wo/html/worcester.html">Register Of Wills</a>'
menub3[5]='<a target="main" href="http://www.worsatty.sailorsite.net/">States Attorney</a>'
menub3[6]='<a target="main" href="http://www.lowershore.org">Tri-County Council</a>'
menub3[7]='<a target="main" href="http://www.worcesterlibrary.org">Worcester County Library</a>'

//Contents for menu b4, EDUCATION
var menub4=new Array()
menub4[0]='<a target="main" href="http://www.worcesterk12.com/">Board of Education</a>'
menub4[1]='<a target="main" href="http://www.worwic.cc.md.us">Wor-Wic Community College</a>'

//Contents for menu b5, TRANSPORTATION
var menub5=new Array()
menub5[0]='<a target="main" href="http://www.mdta.state.md.us">Maryland Transportation Authority</a>'
menub5[1]='<a target="main" href="http://www.shoretransit.com">Shore Transit</a>'

var disappeardelay=800  //menu disappear speed onMouseout (in miliseconds) 250 default
var horizontaloffset=-38 //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="dropmenubdiv" 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 dropdownmenub(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenubdiv") : dropmenubdiv
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))
delayhidemenub()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenub()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenub(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
