var quickMenu = new Array();
quickMenu["newsletter"]="http://www.massmatch.org/newsletter.htm";
quickMenu["changecolor"]="?style=1";
quickMenu["contact"]="http://www.massmatch.org/contact.htm";


sfHover = function() {
  var thislen = 0;
  var sfEle = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEle.length; i++) {
    if(sfEle[i].getElementsByTagName("A")[0]==null)
      continue;
    sfEle[i].getElementsByTagName("A")[0].onfocus=function() {
      var c = 0;
      var sw = 0;
      var pLen = 0
      var parents = new Array();
      if (this.parentNode!=null){
        var ref=this.parentNode;
        var top = document.getElementById("nav");
        var rtele = top.getElementsByTagName("LI");
        while ( ref.parentNode != top ){
          parents[c++]=ref.parentNode;
          if(ref.parentNode)
            ref=ref.parentNode;
          else
            break;
        }
        pLen = parents.length;
        for (var i=0; i< rtele.length; i++) {
          c = 0;
          sw = 0;
          for (c = 0; c < pLen; c++){
            if(parents[c]==rtele[i])
              sw=1;
          }
          if (sw==1)
            --pLen;
          else
            rtele[i].className=rtele[i].className.replace(/ *sfhover/g, "");
        }
      }      
      this.parentNode.className+=" sfhover";
    }
    sfEle[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEle[i].onmouseout=function(){
        this.className=this.className.replace(/ *sfhover/g, "");
    }

  
  } 
  i=0;
  sfEle = document.getElementById("quicknav").getElementsByTagName("LI");
  for (i=0; i<sfEle.length; i++) {
    sfEle[i].onmouseover=function() {
      this.className+="_hover";
    }
    sfEle[i].onmouseout=function() {
      this.className=this.className.replace(/_hover\b/, "");
    }
    sfEle[i].onclick=function() {
      if( this.className.indexOf("button_")> -1 ) 
        window.location = quickMenu[this.className.replace(/(^.*?button_)|(_hover\b)/g, "")];
    }
  }
}

if (window.addEventListener){
  window.addEventListener("load", sfHover, false);
}else if (window.attachEvent){
  window.attachEvent("onload", sfHover);
}
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function P7_colH(){ 
 var i,oh,hh,h=0,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=0;i<dA.length;i++){dA[i].style.height='auto';}for(i=0;i<dA.length;i++){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i<dA.length;i++){if(an){
 dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){
 for(i=0;i<dA.length;i++){hh=dA[i].offsetHeight;if(hh>h){
 dA[i].style.height=(h-(hh-h))+'px';}}}else{document.p7eqa=1;}
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT(){
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){
 P7_colH();}
}
function P7_equalCols(){
 if(document.getElementById){document.p7eqc=new Array;for(i=0;i<arguments.length;i++){
 document.p7eqc[i]=document.getElementById(arguments[i]);}setInterval("P7_eqT()",10);}
}
function P7_eqA(el,h,ht){ 
 var sp=10,inc=5,nh=h,g=document.getElementById(el),oh=g.offsetHeight,ch=parseInt(g.style.height);
 ch=(ch)?ch:h;var ad=oh-ch,adT=ht-ad;nh+=oh;nh=(nh>adT)?adT:nh;g.style.height=nh+'px';
 oh=g.offsetHeight;if(oh>ht){nh=(ht-(oh-ht));g.style.height=nh+'px';}
 if(nh<adT){setTimeout("P7_eqA('"+el+"',"+nh+","+ht+")",sp);}
}


