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('
'); }
wp_menus.prototype.EndMenu = function() { document.write('
'); this.m_active = null; }
wp_menus.prototype.AddLink = function(id_name,title,url,id_submenu) {
document.write('');
document.writeln(title+'\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' );
if( this.m_leftGraphic && !this.m_repeatGraphic ) {
document.write( ' ' );
if( this.m_type==1 ) document.write( ' ' );
}
for( var i=0; i' );
if( this.m_type==1 ) document.write( ' ' );
}
document.write( '' );
document.write( ' ' );
document.write( '' );
if( this.m_type==1 ) document.writeln( ' ' );
if( this.m_rightGraphic && this.m_repeatGraphic ) { document.write( ' ' ); if( this.m_type==1 ) document.write( ' ' ); }
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( ' ' );
document.writeln( ' |
' );
}
menus.prototype.createAll = function( current,depth ) {
if( !current ) return;
if( depth ) current.create( depth );
for( var i=0;i' );
document.write( '| ' );
for( var i=0; i' );
document.writeln( this.m_links[i].m_name+'' );
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( ' |
' );
}
}
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; }}}