﻿         $(function(){
            // remove link background images since we're re-doing the hover interaction below 
            // (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
            // we also want to only remove the image on non-selected nav items, so this is a bit more complicated
            $(".nav").children("li").each(function() {
               var current = "nav current-" + ($(this).attr("class"));
               var parentClass = $(".nav").attr("class");
               if (parentClass != current) {
                  $(this).children("a").css({backgroundImage:"none"});
               }
            });
            // create events for each nav item
            attachNavEvents(".nav", "menu1");
            attachNavEvents(".nav", "menu2");
            attachNavEvents(".nav", "menu3");
            attachNavEvents(".nav", "menu4");
            attachNavEvents(".nav", "menu5");
            attachNavEvents(".nav", "menu6");
            attachNavEvents(".nav", "menu7");

            function attachNavEvents(parent, myClass) {
               $(parent + " ." + myClass).mouseover(function() {
                  $(this).append('<div class="nav-' + myClass + '"></div>');
                  $("div.nav-" + myClass).css({display:"none"}).fadeIn(200);
               }).mouseout(function() {
                  $("div.nav-" + myClass).fadeOut(200, function() {
                     $(this).remove();
                  });
               }).mousedown(function() {
                  $("div.nav-" + myClass).attr("class", "nav-" + myClass + "-click");
               }).mouseup(function() {
                  $("div.nav-" + myClass + "-click").attr("class", "nav-" + myClass);
               });
            }
         });
   
function to_top(h,i,t) {
var s=20;
if (t) clearInterval(t); else var t;
if (!h) var h=document.body.scrollHeight,i=h;
if (h/s <= i) { i-=h/s; window.scrollTo(0,parseInt(i));
t=setInterval(function(){t=to_top(h,i,t);},1); }
else window.scrollTo(0,0);
return t;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


