function imgOn(imgName) {
if (document.images) { document.images[imgName].src = "images/nav/" + imgName + "On.jpg"; }
}

function imgOff(imgName) {
if (document.images) { document.images[imgName].src = "images/nav/" + imgName + "Off.jpg"; }
}

/* Function to open popup window */
function locationWindow(theURL,winName,features) { 
      window.open(theURL,winName,features);
}	

/***********************************************
* AnyLink Drop Down 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 menuGeneral
var menuGeneral=new Array()
menuGeneral[0]='<a href="facts.php" class="subnav">About</a>'
menuGeneral[1]='<a href="course.php" class="subnav">Course</a>'
menuGeneral[2]='<a href="inns.php" class="subnav">Accomodations</a>'
menuGeneral[3]='<a href="directions.php" class="subnav">Directions</a>'

//Contents for menuMarathon
var menuMarathon=new Array()
menuMarathon[0]='<a href="mara.php" class="subnav"> Info & Registration</a>'
menuMarathon[1]='<a href="runnersearch.php" class="subnav"> Marathon Entrants</a>'
menuMarathon[2]='<a href="maramap.php" class="subnav">Maps</a>'
menuMarathon[3]='<a href="chowdah.php" class="subnav">Clam Chowdah Challenge</a>'

//Contents for menuHalfMarathon
var menuHalfMarathon=new Array()
menuHalfMarathon[0]='<a href="halfmara.php" class="subnav"> Info & Registration</a>'
menuHalfMarathon[1]='<a href="halfrunnersearch.php" class="subnav">Half Marathon Entrants</a>'
menuHalfMarathon[2]='<a href="maps/halfcourse.jpg" class="subnav">Map</a>'
menuHalfMarathon[3]='<a href="chowdah.php" class="subnav">Clam Chowdah Challenge</a>'

//Contents for menuRelay
var menuRelay=new Array()
menuRelay[0]='<a href="relay.php" class="subnav">Info & Registration</a>'
menuRelay[1]='<a href="relaysearch.php" class="subnav">Relay Team Entrants</a>'
menuRelay[2]='<a href="relaymap.php" class="subnav">Maps</a>'

//Contents for menuClamChowdahChallenge
var menuClamChowdahChallenge=new Array()
menuClamChowdahChallenge[0]='<a href="chowdah.php" class="subnav"> Info & Registration</a>'
menuClamChowdahChallenge[1]='<a href="chowdahrunnersearch.php" class="subnav">Clam Chowdah Challenge Entrants</a>'

//Contents for menuHistory
var menuHistory=new Array()
menuHistory[0]='<a href="result.php" class="subnav">Race Results</a>'
menuHistory[1]='<a href="pics.php" class="subnav">Photo Galleries</a>'
menuHistory[2]='<a href="history7881.php" class="subnav">History by Year</a>'
		
var menuwidth='200px' //default menu width
var menubgcolor='#f7ecb4'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editing needed

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){
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")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"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
// end dropdown menus


/***********************************************
* Gradual Highlight image script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var baseopacity=30

function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

preloadFlag = true;
