var menu_1 = new ItemStyle(120, 0, '', 0, 0, 'images/menu_1.gif', 'images/menu_1_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_1_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_1_active.gif', 'images/menu_1_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_2 = new ItemStyle(105, 0, '', 0, 0, 'images/menu_2.gif', 'images/menu_2_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_2_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_2_active.gif', 'images/menu_2_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_3 = new ItemStyle(105, 0, '', 0, 0, 'images/menu_3.gif', 'images/menu_3_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_3_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_3_active.gif', 'images/menu_3_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var menu_4 = new ItemStyle(113, 0, '', 0, 0, 'images/menu_4.gif', 'images/menu_4_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_4_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_4_active.gif', 'images/menu_4_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_5 = new ItemStyle(105, 0, '', 0, 0, 'images/menu_5.gif', 'images/menu_5_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_5_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_5_active.gif', 'images/menu_5_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_6 = new ItemStyle(105, 0, '', 0, 0, 'images/menu_6.gif', 'images/menu_6_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_6_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_6_active.gif', 'images/menu_6_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_7 = new ItemStyle(120, 0, '', 0, 0, 'images/menu_7.gif', 'images/menu_7_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var menu_7_active = new ItemStyle(140, 0, '', 0, 0, 'images/menu_7_active.gif', 'images/menu_7_sel.gif', 'highText', 'highText', '', '', null, null, 'hand', 'default');

var logo = new ItemStyle(113, 0, '', 0, 0, 'images/logo.gif', 'images/logo_sel.gif', 'logohighText', 'logohighText', '', '', null, null, 'hand', 'default');

var globe = new ItemStyle(50, 0, '', 0, 0, 'images/globe.gif', 'images/globe.gif', 'globehighText', 'globehighText', '', '', null, null, 'hand', 'default');

var hBar = new ItemStyle(40, 10, '', 0, 0, '#336699', '#6699CC', 'highText', 'highText', '', '', null, null, 'hand', 'default'); 
 
 
// The 'sub Menu' items: these have popout indicators of "Greater Than" signs ">" 15px from their
// right edge, and CSS borders. Text class also changes on mouseover.
//var subM = new ItemStyle(22, 0, '&gt;', -15, 3, '#CCCCDD', '#6699CC', 'lowText', 'highText',
// 'itemBorder', 'itemBorder', null, null, 'hand', 'default');

var menu_1_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_1_subbgboven.gif', 'images/menu_1_subbgboven.gif', 'menu_1_lowText', 'menu_1_highText', '', '', null, null, 'hand', 'default');

var menu_1_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_1_subbg.gif', 'images/menu_1_subbg.gif', 'menu_1_lowText', 'menu_1_highText', '', '', null, null, 'hand', 'default');

var menu_1_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_1_subbgonder.gif', 'images/menu_1_subbgonder.gif', 'menu_1_lowText', 'menu_1_highText', '', '', null, null, 'hand', 'default');

var menu_1_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_1_subbg.gif', 'images/menu_1_subbg.gif', 'menu_1_DimText', 'menu_1_DimText', '', '', null, null, 'default', 'default');

var menu_1_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_1_subbgboven.gif', 'images/menu_1_subbgboven.gif', 'menu_1_DimText', 'menu_1_DimText', '', '', null, null, 'hand', 'default');

var menu_1_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_1_subbgonder.gif', 'images/menu_1_subbgonder.gif', 'menu_1_DimText', 'menu_1_DimText', '', '', null, null, 'default', 'default');

var menu_2_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_2_subbgboven.gif', 'images/menu_2_subbgboven.gif', 'menu_2_lowText', 'menu_2_highText', '', '', null, null, 'hand', 'default');

var menu_2_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_2_subbg.gif', 'images/menu_2_subbg.gif', 'menu_2_lowText', 'menu_2_highText', '', '', null, null, 'hand', 'default');

var menu_2_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_2_subbgonder.gif', 'images/menu_2_subbgonder.gif', 'menu_2_lowText', 'menu_2_highText', '', '', null, null, 'hand', 'default');

var menu_2_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_2_subbgboven.gif', 'images/menu_2_subbgboven.gif', 'menu_2_DimText', 'menu_2_DimText', '', '', null, null, 'hand', 'default');

var menu_2_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_2_subbg.gif', 'images/menu_2_subbg.gif', 'menu_2_DimText', 'menu_2_DimText', '', '', null, null, 'default', 'default');

var menu_2_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_2_subbgonder.gif', 'images/menu_2_subbgonder.gif', 'menu_2_DimText', 'menu_2_DimText', '', '', null, null, 'default', 'default');

var menu_3_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_3_subbgboven.gif', 'images/menu_3_subbgboven.gif', 'menu_3_lowText', 'menu_3_highText', '', '', null, null, 'hand', 'default');

var menu_3_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_3_subbgboven.gif', 'images/menu_3_subbgboven.gif', 'menu_3_DimText', 'menu_3_DimText', '', '', null, null, 'hand', 'default');

var menu_3_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_3_subbg.gif', 'images/menu_3_subbg.gif', 'menu_3_lowText', 'menu_3_highText', '', '', null, null, 'hand', 'default');

var menu_3_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_3_subbgonder.gif', 'images/menu_3_subbgonder.gif', 'menu_3_lowText', 'menu_3_highText', '', '', null, null, 'hand', 'default');

var menu_3_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_3_subbg.gif', 'images/menu_3_subbg.gif', 'menu_3_DimText', 'menu_3_DimText', '', '', null, null, 'default', 'default');

var menu_3_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_3_subbgonder.gif', 'images/menu_3_subbgonder.gif', 'menu_3_DimText', 'menu_3_DimText', '', '', null, null, 'default', 'default');

var menu_4_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_4_subbgboven.gif', 'images/menu_4_subbgboven.gif', 'menu_4_lowText', 'menu_4_highText', '', '', null, null, 'hand', 'default');

var menu_4_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_4_subbgboven.gif', 'images/menu_4_subbgboven.gif', 'menu_4_DimText', 'menu_4_DimText', '', '', null, null, 'hand', 'default');

var menu_4_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_4_subbg.gif', 'images/menu_4_subbg.gif', 'menu_4_lowText', 'menu_4_highText', '', '', null, null, 'hand', 'default');

var menu_4_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_4_subbgonder.gif', 'images/menu_4_subbgonder.gif', 'menu_4_lowText', 'menu_4_highText', '', '', null, null, 'hand', 'default');

var menu_4_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_4_subbg.gif', 'images/menu_4_subbg.gif', 'menu_4_DimText', 'menu_4_DimText', '', '', null, null, 'default', 'default');

var menu_4_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_4_subbgonder.gif', 'images/menu_4_subbgonder.gif', 'menu_4_DimText', 'menu_4_DimText', '', '', null, null, 'default', 'default');

var menu_5_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_5_subbgboven.gif', 'images/menu_5_subbgboven.gif', 'menu_5_lowText', 'menu_5_highText', '', '', null, null, 'hand', 'default');

var menu_5_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_5_subbgboven.gif', 'images/menu_5_subbgboven.gif', 'menu_5_DimText', 'menu_5_DimText', '', '', null, null, 'hand', 'default');																																			  

var menu_5_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_5_subbg.gif', 'images/menu_5_subbg.gif', 'menu_5_lowText', 'menu_5_highText', '', '', null, null, 'hand', 'default');

var menu_5_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_5_subbgonder.gif', 'images/menu_5_subbgonder.gif', 'menu_5_lowText', 'menu_5_highText', '', '', null, null, 'hand', 'default');

var menu_5_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_5_subbg.gif', 'images/menu_5_subbg.gif', 'menu_5_DimText', 'menu_5_DimText', '', '', null, null, 'default', 'default');

var menu_5_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_5_subbgonder.gif', 'images/menu_5_subbgonder.gif', 'menu_5_DimText', 'menu_5_DimText', '', '', null, null, 'default', 'default');

var menu_6_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_6_subbgboven.gif', 'images/menu_6_subbgboven.gif', 'menu_6_lowText', 'menu_6_highText', '', '', null, null, 'hand', 'default');

var menu_6_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_6_subbgboven.gif', 'images/menu_6_subbgboven.gif', 'menu_6_DimText', 'menu_6_DimText', '', '', null, null, 'hand', 'default');																																									
																																									 
var menu_6_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_6_subbg.gif', 'images/menu_6_subbg.gif', 'menu_6_lowText', 'menu_6_highText', '', '', null, null, 'hand', 'default');

var menu_6_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_6_subbgonder.gif', 'images/menu_6_subbgonder.gif', 'menu_6_lowText', 'menu_6_highText', '', '', null, null, 'hand', 'default');

var menu_6_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_6_subbg.gif', 'images/menu_6_subbg.gif', 'menu_6_DimText', 'menu_6_DimText', '', '', null, null, 'default', 'default');

var menu_6_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_6_subbgonder.gif', 'images/menu_6_subbgonder.gif', 'menu_6_DimText', 'menu_6_DimText', '', '', null, null, 'default', 'default');

var menu_7_subbgboven = new ItemStyle(126, 0, '', 0, 12, 'images/menu_7_subbgboven.gif', 'images/menu_7_subbgboven.gif', 'menu_7_lowText', 'menu_7_highText', '', '', null, null, 'hand', 'default');

var menu_7_subbgboven_dim = new ItemStyle(126, 0, '', 0, 12, 'images/menu_7_subbgboven.gif', 'images/menu_7_subbgboven.gif', 'menu_7_DimText', 'menu_7_DimText', '', '', null, null, 'hand', 'default');																																														 
																																														  
var menu_7_subbg = new ItemStyle(126, 0, '', 0, 0, 'images/menu_7_subbg.gif', 'images/menu_7_subbg.gif', ' menu_7_lowText', ' menu_7_highText', '', '', null, null, 'hand', 'default');

var menu_7_subbgonder = new ItemStyle(126, 0, '', 0, 0, 'images/menu_7_subbgonder.gif', 'images/menu_7_subbgonder.gif', ' menu_7_lowText', ' menu_7_highText', '', '', null, null, 'hand', 'default');

var menu_7_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_7_subbg.gif', 'images/menu_7_subbg.gif', 'menu_7_DimText', 'menu_7_DimText', '', '', null, null, 'default', 'default');

var menu_7_onder_dim = new ItemStyle(126, 0, '', 0, 0, 'images/menu_7_subbgonder.gif', 'images/menu_7_subbgonder.gif', 'menu_7_DimText', 'menu_7_DimText', '', '', null, null, 'default', 'default');


// logo menu items

var logoMenu_bg= new ItemStyle(113, 0, '', 0, 0, 'images/logo_bg.gif', 'images/logo_bg.gif', 'logolowText', 'logohighText', '', '', null, null, 'hand', 'default');

var logoMenu_Dim= new ItemStyle(113, 0, '', 0, 0, 'images/logo_bg.gif', 'images/logo_bg.gif', 'logoDimText', 'logoDimText', '', '', null, null, 'default', 'default');																														  
																														   
//var logoMenu_bgboven= new ItemStyle(132, 0, '', 0, 0, 'images/logo_menu_bgboven.gif', 'images/logo_menu_bgboven.gif', 'logolowText', 'logohighText', '', '', null, null, 'hand', 'default');

var logoMenu_bgonder= new ItemStyle(113, 0, '', 0, 0, 'images/logo_bgonder.gif', 'images/logo_bgonder.gif', 'logolowText', 'logohighText', '', '', null, null, 'hand', 'default');

var logoMenu_bgonder_Dim= new ItemStyle(113, 0, '', 0, 0, 'images/logo_bgonder.gif', 'images/logo_bgonder.gif', 'logoDimText', 'logoDimText', '', '', null, null, 'hand', 'default');


// Create a PopupMenu() object, and pass its own name so it can reference itself later on.
// We also use a 'with' block to work with its properties and functions below.

var pMenu = new PopupMenu('pMenu');
with (pMenu)
{
startMenu('root', false, 'page.elmPos("logo").x', 70, 156,  hBar);

addItem('&nbsp;', 'mLogo', 'sm:', logo);

startMenu('mLogo', true, 0, 156, 113, logo);

// addItem('', '#', '', logoMenu_bgboven, 27);
addItem('home', 'http://www.ld4all.nl', '', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('welkom', 'content.load("ld4all_welcome.shtml"); altercontent(0);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('achtergrond', 'content.load("ld4all_about.shtml"); altercontent(1);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('doneer', 'content.load("ld4all_donate.shtml"); altercontent(2);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('historie', 'content.load("ld4all_history.shtml"); altercontent(3);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('publiciteit', 'content.load("ld4all_publicity.shtml"); altercontent(4);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
//addItem('awards', 'content.load("ld4all_awards.shtml"); altercontent(5);', 'js:', logoMenu_bg, 24).activeStyle = logoMenu_Dim;
addItem('contact', 'content.load("ld4all_contact.shtml"); altercontent(6);', 'js:', logoMenu_bgonder, 49).activeStyle = logoMenu_bgonder_Dim;



// End of 'with (pMenu)' block. That's one menu object created!

}

var anotherMenu = new PopupMenu('anotherMenu');
with (anotherMenu)
{

 startMenu('root', false, 'page.winW()/2 - anotherMenu.menu.root[0].menuW/2', 20, 35, hBar); 
 // Centres met y scroll geval.

addItem('', 'Menu_1', 'sm:', menu_1).activeStyle = menu_1_active;
addItem('', 'Menu_2', 'sm:', menu_2).activeStyle = menu_2_active;
addItem('', 'Menu_3', 'sm:', menu_3).activeStyle = menu_3_active;
addItem('', 'Menu_4', 'sm:', menu_4).activeStyle = menu_4_active;
addItem('', 'Menu_5', 'sm:', menu_5).activeStyle = menu_5_active;
addItem('', 'Menu_6', 'sm:', menu_6).activeStyle = menu_6_active;
addItem('', 'Menu_7', 'sm:', menu_7).activeStyle = menu_7_active;

startMenu('Menu_1', true, 9, 35, 126, menu_1);

addItem('slaap', 'content.load("what_sleep.shtml"); altercontent(11);', 'js:', menu_1_subbgboven, 41).activeStyle = menu_1_subbgboven_dim;
addItem('dromen', 'content.load("what_dreaming.shtml"); altercontent(12);', 'js:', menu_1_subbg, 29).activeStyle = menu_1_dim;
addItem('lucidideit', 'content.load("what_lucidity.shtml"); altercontent(13);', 'js:', menu_1_subbg, 29).activeStyle = menu_1_dim;
addItem('culturen', 'content.load("what_cultures.shtml"); altercontent(14);', 'js:', menu_1_subbg, 29).activeStyle = menu_1_dim;
addItem('wetenschap', 'content.load("what_science.shtml"); altercontent(15);', 'js:', menu_1_subbg, 29).activeStyle = menu_1_dim;
addItem('research', 'content.load("what_research.shtml"); altercontent(16);', 'js:', menu_1_subbgonder, 43).activeStyle = menu_1_onder_dim;

startMenu('Menu_2', true, -6, 35, 126, menu_2);

addItem('herinner', 'content.load("first_remember.shtml"); altercontent(21);', 'js:', menu_2_subbgboven, 41).activeStyle = menu_2_subbgboven_dim;
addItem('schrijf', 'content.load("first_write.shtml"); altercontent(22);', 'js:', menu_2_subbg, 29).activeStyle = menu_2_dim;
addItem('herken', 'content.load("first_recognize.shtml"); altercontent(23);', 'js:',menu_2_subbg, 29).activeStyle = menu_2_dim;
addItem('reality check', 'content.load("first_reality.shtml"); altercontent(24);', 'js:',menu_2_subbg, 29).activeStyle = menu_2_dim;
addItem('tekens', 'content.load("first_signs.shtml"); altercontent(25);', 'js:', menu_2_subbgonder, 43).activeStyle = menu_2_onder_dim;

startMenu('Menu_3', true, -6, 35, 126, menu_3);

addItem('advies', 'content.load("how_advice.shtml"); altercontent(31);', 'js:', menu_3_subbgboven, 41).activeStyle = menu_3_subbgboven_dim;
addItem('MILD', 'content.load("how_mild.shtml"); altercontent(32);', 'js:', menu_3_subbg, 29).activeStyle = menu_3_dim;
addItem('WILD', 'content.load("how_wild.shtml"); altercontent(33);', 'js:', menu_3_subbg, 29).activeStyle = menu_3_dim;
addItem('WBTB', 'content.load("how_wbtb.shtml"); altercontent(34);', 'js:', menu_3_subbg, 29).activeStyle = menu_3_dim;
addItem('reality check', 'content.load("how_reality.shtml"); altercontent(35);', 'js:', menu_3_subbg, 29).activeStyle = menu_3_dim;
addItem('software', 'content.load("how_software.shtml"); altercontent(37);', 'js:', menu_3_subbg, 29).activeStyle = menu_3_dim;
addItem('meer', 'content.load("how_otherwise.shtml"); altercontent(38);', 'js:', menu_3_subbgonder, 43).activeStyle = menu_3_onder_dim;

startMenu('Menu_4', true, -6, 35, 126, menu_4);

addItem('blijf lucide', 'content.load("while_stay_lucid.shtml"); altercontent(41);', 'js:', menu_4_subbgboven, 41).activeStyle = menu_4_subbgboven_dim;
addItem('nachtmerries', 'content.load("while_nightmares.shtml"); altercontent(42);', 'js:', menu_4_subbg, 29).activeStyle = menu_4_dim;
addItem('vlieg', 'content.load("while_fly.shtml"); altercontent(43);', 'js:', 
menu_4_subbg, 29).activeStyle = menu_4_dim;
addItem('ontdek', 'content.load("while_explore.shtml"); altercontent(44);', 'js:', menu_4_subbg, 29).activeStyle = menu_4_dim;
addItem('heb lol', 'content.load("while_fun.shtml"); altercontent(45);', 'js:', 
menu_4_subbg, 29).activeStyle = menu_4_dim;
addItem('verder', 'content.load("while_beyond.shtml"); altercontent(46);', 'js:', menu_4_subbg, 29).activeStyle = menu_4_dim;
addItem('meer idee&euml;n', 'content.load("while_more.shtml"); altercontent(47);', 'js:', menu_4_subbgonder, 43).activeStyle = menu_4_onder_dim;

startMenu('Menu_5', true, -15, 35, 126, menu_5);

addItem('droomwerk', 'content.load("more_dreamwork.shtml"); altercontent(51);', 'js:', menu_5_subbgboven, 41).activeStyle = menu_5_subbgboven_dim;
addItem('LD4all FAQ', 'content.load("more_faq.shtml"); altercontent(53);', 'js:', menu_5_subbgonder, 43).activeStyle = menu_5_onder_dim;

startMenu('Menu_6', true, -15, 35, 126, menu_6);

addItem('LD4all', 'content.load("store_ld4all.shtml"); altercontent(61);', 'js:', menu_6_subbgboven, 41).activeStyle = menu_6_subbgboven_dim;
//addItem('lucide boeken', 'content.load("store_books.shtml"); altercontent(62);', 'js:', menu_6_subbg, 29).activeStyle = menu_6_dim;
addItem('boeken', 'content.load("store_books.shtml"); altercontent(63);', 'js:', menu_6_subbgonder, 43).activeStyle = menu_6_onder_dim;
																																																																																							
startMenu('Menu_7', true, -15, 35, 126, menu_7);

addItem('forum', 'content.load("join_forum.shtml"); altercontent(71);', 'js:', menu_7_subbgboven, 41).activeStyle = menu_7_subbgboven_dim;
addItem('chat', 'content.load("join_chat.shtml"); altercontent(72);', 'js:', menu_7_subbgonder, 43).activeStyle = menu_7_onder_dim;

}


// script extension dim active item 

// Variables to store the active item.
var oldMenuObj = null, oldMenuName = '', oldMenuItem = 0;

PopupMenu.prototype.swapItemStyle = function(mN, iN, isActive) { with (this)
{
 var item = menu[mN][iN];

 // Retrieve either the new or original style and swap the item itself.
 var newStyle = null;
 if (isActive) newStyle = item.activeStyle;
 else if (oldMenuObj)
 {
  var oldM = oldMenuObj.menu[oldMenuName];
  newStyle = oldM[oldMenuItem].itemSty ? oldM[oldMenuItem].itemSty : oldM[0].itemSty;
 }
 if (newStyle) for (var p in newStyle) item[p] = newStyle[p];

 // Swap the item's parent root menu trigger.
 var parM = isActive ? mN : oldMenuName, rootItem = 0;
 do {
  rootItem = menu[parM][0].parentItem;
  parM = menu[parM][0].parentMenu;
 } while (parM && !menu[parM][0].isRoot);
 if (rootItem)
 {
  var rootI = menu.root[rootItem];
  var rootStyle = isActive ? rootI.activeStyle :
   rootI.itemSty ? rootI.itemSty : menu[parM || 'root'][0].itemSty;
  if (rootStyle) for (var p in rootStyle) rootI[p] = rootStyle[p];
 }
}};

PopupMenu.prototype.onclick = function(mN, iN, noUpdate) { with (this)
{
 
//if (mN == 'root') return;

if (mN == 'root') return false;
 // Swap the old item back, and the new item to its active state.
 // Both will automatically update their respective root menu items.
 if (oldMenuObj && !noUpdate) oldMenuObj.swapItemStyle(oldMenuName, oldMenuItem, 0);
 swapItemStyle(mN, iN, 1);

 // Update the document last to avoid rewriting the same menu several times.
 if (!noUpdate)
 {
  if (oldMenuObj)
  {
   oldMenuObj.update(false, 'root');
   if (oldMenuName != 'root') oldMenuObj.update(false, oldMenuName);
  }
  if (this != oldMenuObj) this.update(false, 'root');
  if (mN != 'root') this.update(false, mN);
 }

 // Record this item as the new active item.
 oldMenuObj = this;
 oldMenuName = mN;
 oldMenuItem = iN;
}};



// Pre-activate an item in your 'root' menu.
pMenu.onclick('root', 1, true);
pMenu.onclick('mLogo', 2, true);

// This is the "positioning from page anchors" code used by the advanced positioning expressions.
page.elmPos=function(e,p)
{
 var x=0,y=0,w=p?p:this.win;
 e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;
 if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}
 else if (e && e.focus && e.href && this.MS && /Mac/.test(navigator.platform))
 {
  e.onfocus = new Function('with(event){self.tmpX=clientX-offsetX;' +
   'self.tmpY=clientY-offsetY}');
  e.focus();x=tmpX;y=tmpY;e.blur()
 }
 else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}
 return{x:x,y:y};
};




