
  // --------------------------------------------------------------------------

  Zoomedia = {

    version: '1.0',

    redirect: function(url) {
      var anchor_pos = url.indexOf("#");
      document.location.href = (anchor_pos == -1) ? url : url.substr(0, anchor_pos);
    },

    print: function() {
      if (window.print) {
        window.print();
      } else {
        alert("Sorry, your browser doesn't support this feature.\nPlease use your browser's print button");
      }
      return false;
    }
  };

  // --------------------------------------------------------------------------

  Zoomedia.Menu = function(id) {
    if (id) {
      try { this.build( document.getElementById( id ) ); } catch(err) {}
    }
  };

  // --------------------------------------------------------------------------

  var masthead_swfObj = null;
  function isMenuActive()
  {
    if (!masthead_swfObj) {
      masthead_swfObj = document.getElementById('hp-masthead-swfobj');
    }

    var active = zoomenu.isActive(); 

    if (masthead_swfObj) {
      masthead_swfObj.isMenuActive(active == true ? 'true' : 'false');
    }

    return active;
  }

  // --------------------------------------------------------------------------

  Zoomedia.Menu.prototype = {

    // ------------------------------------------------------------------------

    ptr: null,
    timer: null,
    delay: 500,
    liList: [],
    active: false,

    // ------------------------------------------------------------------------

    setActive: function(enabled) {
      this.active = enabled;
      isMenuActive();
    },

    // ------------------------------------------------------------------------

    isActive: function() {
      return this.active;
    },

    // ------------------------------------------------------------------------

    setTimeOut: function(el) {
      var self = this;
      var id = el.getAttribute('id');
      this.timer = window.setTimeout(function() { self.mouseOut(document.getElementById(id)); }, this.delay);
    },

    // ------------------------------------------------------------------------

    mouseOut: function(el) {
      this.setActive(false);

      if (this.timer != null && this.ptr != null&& this.ptr.id == el.id) {
        if (!el.firstChild.getAttribute('on')) {
          el.firstChild.className = '';
        }

        for(var ulList = el.getElementsByTagName('ul'), i=0; i < ulList.length; ++i) {
          ulList.item(i).style.visibility = 'hidden';
        }

        for(var liList = el.getElementsByTagName('li'), i=0; i < liList.length; ++i) {
          liList.item(i).firstChild.className = '';
        }

        this.ptr = null;
        this.liList = new Array();

        return;
      }

      var className = '';
      for(var i=0; i < this.liList.length; i++) {
        if (this.liList[i] == el.id) {
          className = 'hover';
          break;
        }
      }

      if (!el.firstChild.getAttribute('on')) {
        el.firstChild.className = className;
      }
    },

    // ------------------------------------------------------------------------

    mouseOver: function(el) {
      for(var i=0; i < this.liList.length; ++i) {
        if (this.liList[i] == el.id) {
          break;
        }
      }

      if (i == this.liList.length) {
        this.liList[i] = el.id;
      }

      if (this.timer != null && this.ptr != null) {
        if (!this.ptr.firstChild.getAttribute('on')) {
          this.ptr.firstChild.className = '';
        }
        for(var ulList = this.ptr.getElementsByTagName('ul'), i=0; i < ulList.length; ++i) {
          ulList.item(i).style.visibility = 'hidden';
        }
        window.clearTimeout(this.timer);
        this.timer = null;
        this.liList = new Array();
      }

      this.ptr = el;

      if (this.ptr.tagName.toLowerCase() == 'li') {
        if (!this.ptr.firstChild.getAttribute('on')) {
          this.ptr.firstChild.className = 'hover';
        }
      }

      var ulList = this.ptr.getElementsByTagName('ul');

      if (ulList.length > 0) {
        this.setActive(true);
        ulList.item(0).style.visibility = 'visible';
      }
    },

    // ------------------------------------------------------------------------

    build: function(el) {
      var self = this;
      for(var i=0; i < el.childNodes.length; ++i) {
        if (el.childNodes[i].nodeName.toLowerCase() == 'li') {
          for(var j=0; j < el.childNodes[i].childNodes.length; ++j) {
            if (el.childNodes[i].childNodes[j].nodeName.toLowerCase() == 'ul') {
              el.childNodes[i].onmouseover = function() { try { self.mouseOver(this); } catch(err) {} };
              el.childNodes[i].onmouseout = function() { try { self.setTimeOut(this); } catch(err) {} };
              //this.build(el.childNodes[i].childNodes[j]);
              //break;
            }
          }
        }
      }
    }

    // ------------------------------------------------------------------------

  }//Zoomedia.Menu

  // --------------------------------------------------------------------------

