function init() {

  initLink();
  initMenu();

  if (window.initPNG) { initPNG(); }
}

function initLink() {

  var aLink = document.getElementsByTagName( 'a' );

  for (var i = 0; i < aLink.length; i++) {
    if (aLink[i].className && aLink[i].className.match( 'window' )) {
      aLink[i].onclick = function() {
        window.open( this.href );
        return false;
      };
    }
  }
}

function initMenu() {

  var aItem = document.getElementsByTagName( 'li' );
  for (var i = 0; i < aItem.length; i++) {

    if (aItem[i].id.match( 'liMenu_' )) {

      if ((aItem[i].getElementsByTagName( 'a' ))[0].href) {
        aItem[i].onclick = function () { window.location = (this.getElementsByTagName( 'a' ))[0].href; }
        if (aItem[i].className.match( 'current' ) == null) {
          aItem[i].onmouseover = function ( event ) { setImage( event, this ); }
          aItem[i].onmouseout  = function ( event ) { setImage( event, this ); }
        } else { aItem[i].style.cursor = 'pointer'; }
      } else {
        aItem[i].style.cursor = 'auto';
        aItem[i].style.backgroundPosition = '0 -15px';
      }

      if (aItem[i].className.match( 'current' )) {
        aItem[i].style.backgroundPosition = '0 -15px';
      }
    }
  }
}

function setImage( oEvent, oElement ) {

  if (oEvent == null) { oEvent = this.event; }

  oElement.style.backgroundPosition = (oEvent.type == 'mouseover' ? '0 -15px' : '0 0');
}
