wp_menus.prototype.m_type = 0;
wp_menus.prototype.m_delay = 500;
wp_menus.prototype.m_bordersize = 1;
wp_menus.prototype.m_fontsize = 12;
wp_menus.prototype.m_filterOpacity = 100;
wp_menus.prototype.m_mozOpacity = 1;
wp_menus.prototype.m_fontfamily = 'sans-serif';
wp_menus.prototype.m_bordercolor = '#000000';
wp_menus.prototype.m_bkgndcolor = '#ccccff';
wp_menus.prototype.m_textcolor = '#000000';
wp_menus.prototype.m_bkgndcolorhl = '#000000';
wp_menus.prototype.m_textcolorhl = '#ccccff';
wp_menus.prototype.m_imagearrow = 'arrow.gif';
wp_menus.prototype.m_imagearrowhl = 'arrowhl.gif';
wp_menus.prototype.m_timeout = null;
wp_menus.prototype.m_active = null;
wp_menus.prototype.m_acStack = new wp_activestack();

function wp_menus() {}
wp_menus.prototype.InitElement = function(id_name,normal,over) { var e = document.getElementById(id_name); e.p_root = this; e.m_imgNormal = new Image(); e.m_imgOver = new Image(); e.m_imgNormal.src = normal; e.m_imgOver.src = over; }
wp_menus.prototype.BeginMenu = function(id_name) { this.m_active = id_name; document.write('<div id="'+id_name+'" style="z-index:100;border:'+this.m_bordersize+'px solid '+this.m_bordercolor+';filter:alpha( opacity='+this.m_filterOpacity+' );-moz-opacity:'+this.m_mozOpacity+';position:absolute;visibility:hidden;">'); }
wp_menus.prototype.EndMenu = function() { document.write('</div>'); this.m_active = null; }
wp_menus.prototype.AddLink = function(id_name,title,url,id_submenu) {
  document.write('<a id="'+id_name+'" href="'+url+'" style="display:block;padding:3px 20px 3px 10px;position:relative;text-decoration:none;background-color:'+this.m_bkgndcolor+';color:'+this.m_textcolor+';font-size:'+this.m_fontsize+'px;font-family:'+this.m_fontfamily+';');
  if(id_submenu) { document.write('background-image:url('+this.m_imagearrow+');background-repeat:no-repeat;background-position:right;'); }
  document.write('" onmouseover="wp_SubMenuOver(\''+id_name+'\');');
  document.write('" onmouseout="wp_SubMenuOut(\''+id_name+'\');">');
  document.writeln(title+'</a>\n');
  var e = document.getElementById(id_name);
  e.m_root = this; e.m_idchild = id_submenu; e.m_menu = this.m_active;
}
function wp_ImageRoll(action,id_name) { var e = document.getElementById(id_name); if(action == 0) { e.src = e.m_imgNormal.src; } else { e.src = e.m_imgOver.src; }}
function wp_MenuItemOver(id_name,p_root,id_sub) { clearInterval(p_root.m_timeout); if(id_sub) document.getElementById(id_sub).m_depth = 1; p_root.m_active = id_name; p_root.m_acStack.push(0,id_name,id_sub); }
function wp_SubMenuOver(id_name) { var e = document.getElementById(id_name); var pm = document.getElementById(e.m_menu); if(e.m_idchild) document.getElementById(e.m_idchild).m_depth = pm.m_depth+1; clearInterval(e.m_root.m_timeout); e.m_root.m_acStack.push(pm.m_depth,id_name,e.m_idchild); }
function wp_SubMenuOut(id_name) { var e = document.getElementById(id_name); e.m_root.m_timeout = setInterval("wp_Timeout('"+e.m_root.m_active+"')",e.m_root.m_delay); }
function wp_MenuItemOut(id_name,p_menu) { p_menu.m_timeout = setInterval("wp_Timeout('"+id_name+"')",p_menu.m_delay); }
function wp_Timeout(id_name) { var e = document.getElementById(id_name); e.p_root.m_acStack.clear(); e.p_root.m_active = null; }

wp_activestack.prototype.count = 0;
wp_activestack.prototype.depth = new Array();
wp_activestack.prototype.element = new Array();
wp_activestack.prototype.type = 0;
function wp_activestack() {}

wp_activestack.prototype.push = function(depth,idelem,idchild) {
  while(( this.count>0 )&&( depth<=this.depth[this.count-1] )) { this.pop(); }
  if(idelem) {
    this.depth[this.count] = depth; this.element[this.count] = idelem; this.count++;
    document.getElementById(idelem).m_idchild = idchild;
    if(depth==0) { wp_ImageRoll(1,idelem); if(idchild) this.ShowMenu(idchild,idelem,true);
    } else {
      var e = document.getElementById(idelem);
      e.style.backgroundColor = e.m_root.m_bkgndcolorhl;
      e.style.color = e.m_root.m_textcolorhl;
      if(e.style.backgroundImage) e.style.backgroundImage = 'url('+e.m_root.m_imagearrowhl+')';
      if(idchild) this.ShowMenu(idchild,idelem,false);
    }
  }
}

wp_activestack.prototype.pop = function() {
  with( this ) {
    if(count>0) { count--;
      if(depth[count]==0) { wp_ImageRoll(0,element[count]); }
      else {
        var e = document.getElementById(element[count]);
        e.style.backgroundColor = e.m_root.m_bkgndcolor;
        e.style.color = e.m_root.m_textcolor;
        if( e.style.backgroundImage ) e.style.backgroundImage = 'url('+e.m_root.m_imagearrow+')';
      }
      var idchild = document.getElementById(element[count]).m_idchild;
      if(idchild) document.getElementById(idchild).style.visibility = "hidden";
      depth[count] = element[count] = null;
    }
  }
}

wp_activestack.prototype.clear = function() { while(this.count>0) { this.pop(); }}
wp_activestack.prototype.ShowMenu = function(id_name,id_parent,down) { var p = document.getElementById(id_parent); var e = document.getElementById(id_name);  var top = 0; var left = 0; var c = p;
  while(c) { top += c.offsetTop; left += c.offsetLeft; c = c.offsetParent; }
  if( this.type==1 || !down ) left += p.offsetWidth; else top += p.offsetHeight; e.style.top = top+"px"; e.style.left = left+"px"; e.style.visibility = "visible";
}

// OLD CODE //
menus.prototype.m_colorHighlight = ''; menus.prototype.m_colorBackground = ''; menus.prototype.m_colorText = ''; menus.prototype.m_colorTextHighlight = ''; menus.prototype.m_colorBorder = '';
menus.prototype.m_fontSizeMenuBar = 14; menus.prototype.m_fontSizeMenuItem = 12; menus.prototype.m_borderSize = 1; menus.prototype.m_fontFamilyMenuBar = ''; menus.prototype.m_fontFamilyMenuItem = '';
menus.prototype.m_imageArrow = ''; menus.prototype.m_imageArrowHighlight = ''; menus.prototype.m_filterOpacity = 100; menus.prototype.m_mozOpacity = 1; menus.prototype.m_leftGraphic = null;
menus.prototype.m_rightGraphic = null; menus.prototype.m_repeatGraphic = false; menus.prototype.m_separatorGraphic = null; menus.prototype.m_name = ""; menus.prototype.m_stack = new stack();
menus.prototype.m_current = null; menus.prototype.m_start = null; menus.prototype.m_count = 0; menus.prototype.m_activeMenus = new activeMenuStack(); menus.prototype.m_timeout = null;
menus.prototype.m_widthOfImage = 0; menus.prototype.m_type = 0; function menus() {}
menus.prototype.findGraphicWidth = function() {
  if( this.m_widthOfImage>0 ) return;
  for( var n=0; n<this.m_start.m_count; n++ ) { if( this.m_start.m_links[n].m_graphics ) { this.m_widthOfImage = this.m_start.m_links[n].m_graphics.width; this.m_styleMenuBar = ''; break; }}
}
menus.prototype.initialise = function( menu_type ) {
  this.m_type = menu_type; this.m_styleMenuBar = ''; this.m_styleMenuBarHeading = ''; this.m_styleMenuItem = 'z-index:100;filter:alpha( opacity='+this.m_filterOpacity+' );-moz-opacity:'+this.m_mozOpacity+';border:'+this.m_borderSize+'px solid '+this.m_colorBorder+';position:absolute;visibility:hidden;';
  this.m_styleMenuItemHeading = 'display:block;padding:3px 20px 3px 10px;position:relative;background-color:'+this.m_colorBackground+';display:block;text-decoration:none;font-family:'+this.m_fontFamilyMenuItem+';font-size:'+this.m_fontSizeMenuItem+'px;color:'+this.m_colorText+';';
  this.findGraphicWidth(); this.createAll( this.m_start,0 );
}
menus.prototype.createEx = function( left_g,right_g,repeat ) { this.m_leftGraphic = new Image(); this.m_rightGraphic = new Image(); this.m_leftGraphic.src = left_g; this.m_rightGraphic.src = right_g; this.m_repeatGraphic = repeat; this.create(); }
menus.prototype.create = function() {
  document.write( '<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap="true">' );
  if( this.m_leftGraphic && !this.m_repeatGraphic ) {
    document.write( '<img src="'+this.m_leftGraphic.src+'" />' );
    if( this.m_type==1 ) document.write( '<br />' );
  }
  for( var i=0; i<this.m_start.m_count; i++ ) {
    if( this.m_leftGraphic && this.m_repeatGraphic ) {
      document.write( '<img src="'+this.m_leftGraphic.src+'" />' );
      if( this.m_type==1 ) document.write( '<br />' );
    }
    document.write( '<a href="'+this.m_start.m_links[i].m_url+'" ' );
    document.write( 'onmouseover="menuItemOver( '+this.m_type+',\''+this.m_start.m_links[i].m_uid+'\',0,\''+this.m_name+i+'_d0\' );" ' );
    document.write( 'onmouseout="menuItemOut(\''+this.m_name+i+'_d0\');">' );
    document.write( '<img id="'+this.m_name+i+'_d0" style="border:0;" src="'+this.m_start.m_links[i].m_graphics.src+'" alt="'+this.m_start.m_links[i].m_name+'" />' );
    document.write( '</a>' );
    if( this.m_type==1 ) document.writeln( '<br />' );
    if( this.m_rightGraphic && this.m_repeatGraphic ) { document.write( '<img src="'+this.m_rightGraphic.src+'" />' ); if( this.m_type==1 ) document.write( '<br />' ); }
    var e = document.getElementById( this.m_name+i+'_d0' );
    e.src_normal = this.m_start.m_links[i].m_graphics;
    e.src_over = this.m_start.m_links[i].m_graphics_over;
    e.p_menus = this;
  }
  if( this.m_rightGraphic && !this.m_repeatGraphic ) document.write( '<img src="'+this.m_rightGraphic.src+'" />' );
  document.writeln( '</td></tr></table>' );
}
menus.prototype.createAll = function( current,depth ) {
  if( !current ) return;
  if( depth ) current.create( depth );
  for( var i=0;i<current.m_count;i++ ) { this.createAll( current.m_links[i],depth+1 ); }
}
menu.prototype.create = function( depth ) {
  if( this.m_count ) {
    document.write( '<div id="'+this.m_uid+'" style="'+this.m_root.m_styleMenuItem+'">' );
    document.write( '<table border="0" cellpadding="0" cellspacing="0"><tr><td style="' );
    if( depth==1 && this.m_root.m_type==0 && this.m_m_widthOfImage > 0 ) document.write( 'width:'+this.m_root.m_widthOfImage+'px;' );
    if( browser.isOpera5 ) document.write( 'background-color:'+this.m_colorBackground+';' );
    document.write( '">' );
    for( var i=0; i<this.m_count;i++ ) {
      document.write( '<a id="'+this.m_uid+'_'+i+'d'+depth+'" href="'+this.m_links[i].m_url+'" ' );
      document.write( 'style="'+this.m_root.m_styleMenuItemHeading+';' );
      if( this.m_links[i].m_count )
	    document.write( 'background-image:url('+this.m_root.m_imageArrow+');background-repeat:no-repeat;background-position:right;" ' );
	  else document.write( '" ' );
      document.write( 'onmouseover="menuItemOver( 1,\''+this.m_links[i].m_uid+'\','+depth+',\''+this.m_uid+'_'+i+'d'+depth+'\' );" ' );
      document.write( 'onmouseout="menuItemOut(\''+this.m_uid+'_'+i+'d'+depth+'\');">' );
      document.writeln( this.m_links[i].m_name+'</a>' );
      var e = document.getElementById( this.m_uid+'_'+i+'d'+depth );
      e.src_normal = this.m_links[i].m_graphics;
      e.src_over = this.m_links[i].m_graphics_over;
      e.p_menus = this.m_root;
    }

    document.writeln( '</td></tr></table></div>' );
  }
}
function menuTimeout( id_name ) { var m = null; m = document.getElementById( id_name ); m.p_menus.m_activeMenus.clear(); clearInterval( m.p_menus.m_timeout ); }
function menuItemOver( type,id_next,depth,id_name ) {
  var m = null;
  m = document.getElementById( id_name );
  clearInterval( m.p_menus.m_timeout );
  m.p_menus.m_activeMenus.push( type,id_next,depth,id_name );
}
function menuItemOut( id_name ) {
  var m = null;
  m = document.getElementById( id_name );
  m.p_menus.m_timeout = setInterval( "menuTimeout('"+id_name+"')",500 );
}
activeMenuStack.prototype.showMenu = function( type,id_next,depth,id_name ) {
  var next = null;
  var current = null;
  next = document.getElementById( id_next );
  current = document.getElementById( id_name );
  if( current.src_normal ) current.src = current.src_over.src;
  else {
    current.style.backgroundColor = current.p_menus.m_colorHighlight;
    current.style.color = current.p_menus.m_colorTextHighlight;
    if( current.style.backgroundImage ) current.style.backgroundImage = 'url('+current.p_menus.m_imageArrowHighlight+')'
  }
  if( next ) {
    var tp = current; var top = 0; var left = 0;
    while( tp ) { top  += tp.offsetTop; left += tp.offsetLeft; tp = tp.offsetParent; }
    if( type==0 ) { top += current.offsetHeight; } else { left += current.offsetWidth; }
    if( browser.isOpera6 ) top += 7;
    next.style.top = top+"px"; next.style.left = left+"px"; next.style.visibility = "visible";
  }
}
activeMenuStack.prototype.removeMenu = function( id_next,depth,id_name ) {
  var next = null; var current = null;
  next = document.getElementById( id_next );
  current = document.getElementById( id_name );
  if( current.src_normal ) current.src = current.src_normal.src;
  else {
    current.style.backgroundColor = current.p_menus.m_colorBackground;
    current.style.color = current.p_menus.m_colorText;
    if( current.style.backgroundImage ) current.style.backgroundImage = 'url('+current.p_menus.m_imageArrow+')'
  }
  if( next ) next.style.visibility = "hidden";
}
menus.prototype.beginMenu = function( name,url,g,g_over ) {
  with( this ) {
    if( !m_current ) { m_count++; m_name = name; m_start = m_current = new menu( this,name,url,m_name+m_count,g,g_over );
    } else { m_count++; m_current.addLink( this,name,url,m_name+m_count,g,g_over ); m_stack.push( m_current ); m_current = m_current.m_links[m_current.m_count-1]; }
  }
}
menus.prototype.addLink = function( name,url,g,g_over ) { with( this ) { m_count++; m_current.addLink( this,name,url,m_name+m_count,g,g_over ); }}
menus.prototype.endMenu = function() { with( this ) { m_current = m_stack.pop(); }}
function menu( root,name,url,id,g,g_over ) {
  this.m_root  = root; this.m_count = 0; this.m_name  = name; this.m_url   = url; this.m_links = null; this.m_uid   = id; this.m_graphics = null; this.m_graphics_over = null;
  if( g!=null ) { this.m_graphics = new Image(); this.m_graphics.src = g; }
  if( g_over!=null ) { this.m_graphics_over = new Image(); this.m_graphics_over.src = g_over; }
}
menu.prototype.addLink = function( root,name,url,id,g,g_over ) { with( this ) { if( !m_links ) m_links = new Array(); m_links[m_count] = new menu( root,name,url,id,g,g_over ); m_count++; }}
menus.prototype.addSeparator = function() { with( this ) { m_count++; m_current.addLink( "","","id_hr",null,null ); }}
stack.prototype.stack_array = new Array();
stack.prototype.stack_length = 0;
function stack( name ) { this.stack_name = name; }
stack.prototype.isEmpty = function() { return( this.stack_length==0 ); }
stack.prototype.push = function( x ) { this.stack_array[this.stack_length++] = x; }
stack.prototype.pop = function() { with( this ) { if( stack_length==0 ) return null; var x = stack_array[--stack_length]; stack_array[stack_length] = null; return x; }}
stack.prototype.peek = function() { with( this ) { if( stack_length==0 ) return null; return stack_array[stack_length-1]; }}
activeMenuStack.prototype.count  = 0;
activeMenuStack.prototype.id     = new Array();
activeMenuStack.prototype.depth  = new Array();
activeMenuStack.prototype.parent = new Array();
function activeMenuStack() {}
activeMenuStack.prototype.push = function( align,id,depth,parent ) {
  while(( this.count>0 )&&( depth<=this.depth[this.count-1] )) { this.pop(); }
  this.id[this.count]     = id;
  this.depth[this.count]  = depth;
  this.parent[this.count] = parent;
  this.count++;
  this.showMenu( align,id,depth,parent );
}
activeMenuStack.prototype.pop = function() { with( this ) { if( count>0 ) { count--; removeMenu( id[count],depth[count],parent[count] ); id[count] = depth[count] = parent[count] = null; }}}
activeMenuStack.prototype.clear = function() { with( this ) { while( count>0 ) { count--; removeMenu( id[count],depth[count],parent[count] ); id[count] = depth[count] = parent[count] = null; }}}