Event.observe(window,'load', function() {
  // add hover selectors to IE6
  if (Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6) {
    if ($('search-go')) {
      $('search-go').observe('mouseenter', function(event) {
        this.addClassName('over');
      });
      $('search-go').observe('mouseleave', function(event) {
        this.removeClassName('over');
      });
    }
    if ($$('#feature li')) {
      $$('#feature li').each(function(e) {
        e.observe('mouseenter', function(event) {
          this.addClassName('over');
        });
        e.observe('mouseleave', function(event) {
          this.removeClassName('over');
        });
      });
    }
    if ($$('.nav-holder')) {
      $$('.nav-holder').each(function(e) {
        e.observe('mouseenter', function(event) {
          this.addClassName('over');
        });
        e.observe('mouseleave', function(event) {
          this.removeClassName('over');
        });
      });
    }
  }

  // clear search default
  if ($('q')) {
    $('q').observe('focus', function(event) {
      if (this.value=='Search') {
        this.value='';
      }
    });
    $('q').observe('blur', function(event) {
      if (this.value=='') {
        this.value='Search';
      }
    });
  }

  // quiz
  if ($('quiz-button')) {
    $('quiz-button').observe('click', function(event) {
      var width  = 600;
      var height = 450;
      var left   = (screen.width  - width)/2;
      var top    = (screen.height - height)/2;

      newwin = window.open('/quiz.html', "mapwindow","status=no,toolbar=no,resizable=no,scrollbars=no,width="+width+",height="+height+",top="+top+",left="+left);
      if (window.focus) {newwin.focus()}

      Event.stop(event);
    });
  }

  // send external links to a new window, add icon
  if ($$('a[href^="http"]')) {
    $$('a[href^="http"]').each(function(e) {
      if (location.hostname!=e.hostname) {
        e.addClassName('external');
        e.observe('click', function(event) {
          window.open(e.href);
          Event.stop(event);
        });
      }
    });
  }

  // add notification to calendar ul larger than container
  if ($$('#calendar .day ul')) {
    $$('#calendar .day ul').each(function(e) {
      if (e.getHeight() > (e.up().getHeight()-e.previous().getHeight()+5)) {
        e.up(1).addClassName('overflow');
      }
    });
  }

});

function track404error(url)
{
  if(pageTracker._trackEvent)
  {
    pageTracker._trackEvent('Pages Not Found', 'Frontend', url);
  }
}