﻿
// styleName = new ItemStyle(length of items, spacing after items, 'popout indicator HTML',
//  popout indicator position, padding of text within item, 'out background colour or image
//  filename', 'hover background colour or filename', 'out text stylesheet class', 'hover text class',
//  'out border stylesheet class', 'hover border class', out opacity percentage or null to make
//  it fully opaque, hover opacity percentage or null, 'CSS mouse cursor for normal items',
//  'CSS cursor for sm: and blank items');

var rootBar = new ItemStyle(100, 0, '', 0, 0, '', '', 'lowText', 'highText', '', '', null, 0);
var hBar1 = new ItemStyle(111, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);

var hBar2 = new ItemStyle(79, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar3 = new ItemStyle(92, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar4 = new ItemStyle(129, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar5 = new ItemStyle(79, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar6 = new ItemStyle(128, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar7 = new ItemStyle(224, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);
var hBar8 = new ItemStyle(123, 0, '', 0, 0, '#EFF8C5', '#1A2B3B', 'lowText', 'highText ', '', '', null, 0);

var subM = new ItemStyle(22, 0, '&gt;', -15, 3, '#EFF8C5', '#1A5173', 'lowText', 'highText', 'itemBorder', 'itemBorder', 100, 100);
var pMenu = new PopupMenu('pMenu');

with (pMenu)
{

// startMenu('menu name', Vertical menu (true/false)?, left, top, width, default ItemStyle
//  for items in this menu, optional parent frame/window or layer in which this menu resides);

// use this startMenu to center menus
//startMenu('root', false, 'page.winW()/2 - pMenu.menu.root[0].menuW/2', 88, 20, rootBar); // Centres.

// added an offset of -11 to centered
 startMenu('root', false, '', 129, 0, rootBar); // Centres.

// use this startMenu to position menus absolutely
// startMenu('root', false, 200, 98, 20, rootBar);


// addItem('Text', 'URL or menuname', 'action type', optional ItemStyle, length, spacing,
//  'popout indicator', popout indicator position, etc... in the same order as ItemStyles);

addItem('<a href="programs.html"><img src="images/topnav_01.gif" width="111" height="31" border="0" alt="Our Programs"></a>', 'mPrograms', 'sm:', hBar1);

addItem('<a href="faculty.html"><img src="images/topnav_03.gif" width="79" height="31" border="0" alt="Faculty"></a>', 'mFaculty', 'sm:', hBar2);
addItem('<a href="residents.html"><img src="images/topnav_04.gif" width="92" height="31" border="0" alt="Residents"></a>', 'mResidents', 'sm:', hBar3);
addItem('<a href="med_students.html"><img src="images/topnav_05.gif" width="129" height="31" border="0" alt="Medical Students"></a>', 'mStudents', 'sm:', hBar4);
addItem('<a href="alumni.html"><img src="images/topnav_06.gif" width="79" height="31" border="0" alt="Alumni"></a>', 'mAlumni', 'sm:', hBar5);
addItem('<a href="res_events.html"><img src="images/topnav_07.gif" width="128" height="31" border="0" alt="Residency Events"></a>', 'mEvents', 'sm:', hBar6);
addItem('<a href="cmmf.html"><img src="images/topnav_02.gif" width="224" height="31" border="0" alt="About Central Maine Medical Family"></a>', 'mAbout', 'sm:', hBar7);
addItem('<a href="maine_resources.html"><img src="images/topnav_08.gif" width="123" height="31" border="0" alt="Maine Resources"></a>', 'mResources', 'sm:', hBar8);

startMenu("mPrograms", true, 10, 30, 200, subM);
addItem("CMMC - Lewiston Programs", 'lew_programs.html', "");
addItem("CMMC - Swift River Rural Track", 'swift_programs.html', "");
addItem("CMMC - Hospitalist Fellowship", 'hospitalist.html', "");

startMenu('mAbout', true, 10, 30, 150, subM);
addItem("CMMC", "cmmc.html", "");
addItem("Bridgton Hospital", "bridgton.html", "");
addItem("Rumford Hospital", "rumford.html", "");
addItem("CMHVI", "cmhvi.html", "");

startMenu("mFaculty", true, 10, 30, 150, subM);
addItem("CMMC - Lewiston Faculty", "personnel.taf?faculty=1&lewiston=1", "");
addItem("CMMC - Swift River Faculty", "personnel.taf?faculty=1&swiftriver=1", "");

startMenu("mResidents", true, 10, 30, 190, subM);
addItem("CMMC - Lewiston Residents", "residents.taf?lewiston=1", "");
addItem("CMMC - Swift River Residents", "residents.taf?swiftriver=1", "");

startMenu("mStudents", true, 10, 30, 129, subM);
addItem("Overview", "med_students.html", "");
addItem("Elective Clerkship", "students_elective.html", "");
addItem("Elective Rotations", "students_elective_rotations.html", "");
addItem("Online Application", "students_online.html", "");

startMenu("mAlumni", true, 10, 30, 129, subM);
startMenu("mEvents", true, 10, 30, 129, subM);
startMenu("mAbout", true, 10, 30, 129, subM);
startMenu("mResources", true, 10, 30, 129, subM);

}





// *** (3) EVENTS ***


if (!isNS4)
{
 // Write menus now in non-NS4 browsers, by calling the "Fast" mode .update(true) method.
 pMenu.update(true);
 //anotherMenu.update(true);
}
else
{
 // For Netscape 4, back up the old onload function and make a new one to update our menus.
 // This is the regular "Dynamic" mode menu update, it works in IE and NS6 too if required.
 var popOldOL = window.onload;
 window.onload = function()
 {
  if (popOldOL) popOldOL();
  pMenu.update();
  //anotherMenu.update();
 }
}


// Other events must be assigned, these are less complicated, just add or remove menu objects.

var nsWinW = window.innerWidth, nsWinH = window.innerHeight, popOldOR = window.onresize;
window.onresize = function()
{
 if (popOldOR) popOldOR();
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
 pMenu.position();
 //anotherMenu.position();
}

window.onscroll = function()
{
 pMenu.position();
 //anotherMenu.position();
}


// NS4 can't reliably capture clicks on layers, so here's a workaround.
if (isNS4)
{
 document.captureEvents(Event.CLICK);
 document.onclick = function(evt)
 {
  with (pMenu) if (overI) click(overM, overI);
  //with (anotherMenu) if (overI) click(overM, overI);
  return document.routeEvent(evt);
 }
}

// Activate the window.onscroll() event in non-Microsoft browsers.
if (!isIE || isOp)
{
 var nsPX=pageXOffset, nsPY=pageYOffset;
 setInterval('if (nsPX!=pageXOffset || nsPY!=pageYOffset) ' +
 '{ nsPX=pageXOffset; nsPY=pageYOffset; window.onscroll() }', 50);
}



// *** (4) ANIMATION ***
/*

function menuClip(menuObj, menuName, dir)
{
 var mD = menuObj.menu[menuName][0];
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;
 with (mD)
 {
  clearTimeout(timer);
  if (!lyr || !lyr.ref) return;
  if (dir==1) lyr.vis('visible');
  lyr.sty.zIndex = 1001 + dir;
  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/20),0.75) );
  counter += dir;
  if (counter==11) { counter = 10; if (isDOM&&!isIE) lyr.sty.clip='' }
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout(menuObj.myName+'.'+(dir==1?'show':'hide')+'Menu("'+menuName+'")', 40);
 }
}

if (!window.opera)
{
 pMenu.showMenu = new Function('mN','menuClip(pMenu, mN, 1)');
 pMenu.hideMenu = new Function('mN','menuClip(pMenu, mN, -1)');
}

*/


pMenu.onclick = function(mN, iN) { with (this)
{
 // Do actions depending on the item that the mouse was over at the time of the click.
 // You may with to use nested IFs or 'switch' statements etc. if you're familiar with JS.

 if (mN == 'mSubsea')
 {
  if (iN == 1) location.href = 'adcpsystems.html';
 }
}}

// Set the status message to the URL if the 'action type' is nothing, and clear on mouseout.
pMenu.onmouseover = function(mN, iN) { with (this)
{
 // By now, you either have my JS Object Browser script from my site or you need it... try
 // embedding in an IFrame and typing 'pMenu' into its Go To field to see the menu internals.
 with (menu[mN][iN]) if (!type) status = href;
}}
pMenu.onmouseout = function() { status = '' }







// function navMouseOver(imgid,imgnew,text)
// {
// 	if (navigator.appVersion.substring(0,1) >= 3)
// 	{
// 		document.images[imgid].src=eval(imgnew + ".src");
// 		window.status=text;
// 	}
// }
// 	logina      = new Image (58,17);
// 	logina.src  = "/NR/sampledata2/NavImages/login.gif";
// 	loginb      = new Image (58,17);
// 	loginb.src  = "/NR/sampledata2/NavImages/logins.gif";
// 	logouta      = new Image (58,17);
// 	logouta.src  = "/NR/sampledata2/NavImages/logout.gif";
// 	logoutb      = new Image (58,17);
// 	logoutb.src  = "/NR/sampledata2/NavImages/logouts.gif";


