jQuery.noConflict();

function newWindows() {
  jQuery('a[href^=http]').click( function() {
    window.open(this.href);
    return false;
  });
}

function startList() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("menu");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover=function() {
          this.className+=" over";
        }
        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
        }
      }
    }
  }
}

function resizeFooterHeight() {
  var mainHeight = jQuery('#top').outerHeight(true) + jQuery('#container').outerHeight(true);
  var windowHeight = window.innerHeight ? window.innerHeight : jQuery(window).height();
  var footer;
  var bottom;
  
  if (jQuery('div#footer').length)
  {
    footer = jQuery('div#footer');
    bottom = jQuery('div#bottom');
  } else
  {
    footer = jQuery('div#footer-subpage');
    bottom = jQuery('div#bottom-subpage');
  }
  
  var minBottomHeight = footer.height();
  var bottomHeight = windowHeight - mainHeight;
  if ( bottomHeight < minBottomHeight) {
    bottomHeight = minBottomHeight;
  }

  var newHeight = bottomHeight + 'px';
  bottom.css('height',newHeight);
}

jQuery(document).ready(function(e) {

  searchBox = jQuery('#search-field');
  searchBox.bind('focus', function(event)
  {
    if( this.value == 'find it here' )
    {
      jQuery(this).val('');
    }
  });
  searchBox.bind('blur', function(event)
  {
    if( this.value == '')
    {
      jQuery(this).val('find it here');
    }
  });
  
  startList();
  newWindows();
});

jQuery(window).load(function () {
  resizeFooterHeight();
});

jQuery(window).resize(resizeFooterHeight);

jQuery(function() {
  jQuery('#menu').superfish({
    hoverClass: 'over',
    delay: 600,  /* how long outside the hover area before the submenu disappears */
    speed: 10,   /* how long animation takes for submenu to pop up */
    autoArrows: false,
    dropShadows: false
  });
});

