/*global YAHOO,Shadowbox */

/*jslint white: true, onevar: true, browser: true, on: true, undef: true,
         eqeqeq: true, plusplus: true, bitwise: true, regexp: true,
         newcap: true, immed: true, indent: 2, nomen: false */

// Shadowbox support - needs to be added to portal_css/portal_javascripts on a per site basis
Shadowbox.init();

// #nav - YUI Menu
YAHOO.util.Event.onContentReady("nav", function () {
  var oMenuBar = new YAHOO.widget.MenuBar("nav", {
    autosubmenudisplay: true,
    hidedelay: 750,
    iframe: true,
    lazyload: true
  });
  oMenuBar.render();
});

// #search - Search Widget
YAHOO.util.Event.onDOMReady(function () {
  var searchmessage = 'Site Search';
  var searchcolor = '#828282';
  var textbox = document.getElementById('search');
  textbox = YAHOO.util.Dom.getElementBy(function (el) {
    return el.className === 'text';
  }, 'input', textbox);
  textbox.value = searchmessage;
  textbox.style.color = searchcolor;
  YAHOO.util.Event.on(textbox, 'click', function (e) {
    if (this.value === searchmessage) {
      this.value = '';
      this.style.color = '';
    }
  });
  YAHOO.util.Event.on(textbox, 'blur', function (e) {
    if (this.value === '') {
      this.value = searchmessage;
      this.style.color = searchcolor;
    }
  });
  textbox = null;
});
