var scrWin = parent, page = new Object(), isNS4 = scrWin.isNS4,
 nsWinW = window.innerWidth, nsWinH = window.innerHeight,
 nsPX = window.pageXOffset, nsPY = window.pageYOffset;
for (var f in scrWin.page) page[f] = scrWin.page[f];
page.win = window;

var scrOK = (window.onscroll||window.onscroll==null);



function doFunc(func, em)
{
 for (var m in PMO.list)
 {
  var mObj=PMO.list[m];
  if (em) for (var mN in mObj.menu) with (mObj.menu[mN][0])
  {
   if (par.substring(par.lastIndexOf('.')+1)==window.name) eval(func);
  }
  else eval(func);
 }
}

function createMenus(mode)
{
 doFunc('mObj.update('+mode+', mN)',1);

 if (!scrOK) setInterval('if (nsPX!=pageXOffset || nsPY!=pageYOffset) ' +
   '{ nsPX=pageXOffset; nsPY=pageYOffset; doFunc("mObj.position()",1) }', 50);
}





var PMO = scrWin.PopupMenu;
if (PMO)
{

doFunc('window[mObj.myName]=mObj',0);

window.onload = function()
{
 if (isNS4) createMenus(false);
 window.onunload = new Function('doFunc("mObj.menu[mN][0].lyr=null",1)');
}
if (!isNS4) createMenus(true);


window.onresize = function()
{
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
 doFunc('mObj.position()',1);
}

if (scrOK) window.onscroll = function(){ doFunc('mObj.position()',1) }

if (isNS4)
{
 document.captureEvents(Event.CLICK);
 document.onclick = function(evt)
 {
  doFunc('with(mObj) if(overI) click(overM, overI)',0);
  return document.routeEvent(evt);
 }
}

}
