//Menu object creation
oCMenu=new makeCM("oCMenu") //Making the menu object. Argument: menuname

//Menu properties
oCMenu.pxBetween=0
//Using the cm_page object to place the menu ----
oCMenu.fromLeft=0
oCMenu.fromTop=0
oCMenu.rows=0
oCMenu.menuPlacement=0

oCMenu.offlineRoot=""
oCMenu.onlineRoot=""
oCMenu.resizeCheck=1
oCMenu.wait=1000
oCMenu.fillImg="/images/b_images/brookhaven/gleg_brookhaven_12.gif"
oCMenu.zIndex=250

//Background bar properties
oCMenu.useBar=0

//Level properties - ALL properties have to be spesified in level 0
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width=150
oCMenu.level[0].height=20
oCMenu.level[0].regClass="menuitem"
oCMenu.level[0].overClass="menuitemover"
oCMenu.level[0].borderX=0
oCMenu.level[0].borderY=0
oCMenu.level[0].borderClass="backgroundmenu0";
oCMenu.level[0].offsetX=-1
oCMenu.level[0].offsetY=0
oCMenu.level[0].rows=0
oCMenu.level[0].arrow=0
oCMenu.level[0].arrowWidth=0
oCMenu.level[0].arrowHeight=0
oCMenu.level[0].align="bottom"

oCMenu.level[1]=new cm_makeLevel() //Add this for each new level
oCMenu.level[1].width=150
oCMenu.level[1].height=20
oCMenu.level[1].regClass="menuitem"
oCMenu.level[1].overClass="menuitemover"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].borderClass="backgroundmenu1";
oCMenu.level[1].offsetX=0
oCMenu.level[1].offsetY=0
oCMenu.level[1].rows=0
oCMenu.level[1].arrow=0
oCMenu.level[1].arrowWidth=0
oCMenu.level[1].arrowHeight=0
oCMenu.level[1].align="bottom"

/* removed for planned giving
if (window.location.pathname!='/') {
  // get path of url
  var reg=/^(\/[a-z|A-Z|0-9|-|_]*\/)/;
  var result=reg.exec(window.location.pathname);
  var section=result[1];
  //alert (section);
}
*/

// Menu item creation:
  oCMenu.makeMenu('top0','','VISITOR GUIDE','http://www.brookhavenhospital.org/guide/','',140,19,'/images/b_images/brookhaven/gleg_brookhaven_03_off.gif','/images/b_images/brookhaven/gleg_brookhaven_03.gif','menuitem','menuitemover',"bottomleft");
  oCMenu.makeMenu('sub000','top0','Emergency Numbers','http://www.brookhavenhospital.org/guide/emergencynumbers.html','',130,18,'','','','');
  oCMenu.makeMenu('sub002','top0','Community Resources','http://www.brookhavenhospital.org/guide/communityresources.html','',130,18,'','','','');
  oCMenu.makeMenu('sub003','top0','Directories','http://www.brookhavenhospital.org/guide/directories/','',130,18);
  oCMenu.makeMenu('sub004','top0','Directions and Location Map','http://www.brookhavenhospital.org/guide/directionsandmap.html','',130,32,'','','','');
  oCMenu.makeMenu('sub005','top0','Admitting Procedures','http://www.brookhavenhospital.org/guide/admissions.html','',130,18,'','','','');
  oCMenu.makeMenu('sub006','top0','Personal Services','http://www.brookhavenhospital.org/guide/personalservices.html','',130,18,'','','','');
  oCMenu.makeMenu('sub007','top0','Spiritual<BR>Considerations','http://www.brookhavenhospital.org/guide/spiritualconsiderations.html','',130,32,'','','','');
  oCMenu.makeMenu('sub008','top0','Meal Times','http://www.brookhavenhospital.org/guide/mealtimes.html','',130,18,'','','','');
  oCMenu.makeMenu('sub009','top0','Medical Records','http://www.brookhavenhospital.org/guide/medicalrecords.html','',130,18,'','','','');
  oCMenu.makeMenu('sub010','top0','Patient Responsibilities','http://www.brookhavenhospital.org/guide/patientresponsibilities.html','',130,18,'','','','');
  oCMenu.makeMenu('sub011','top0','Patient Advocacy','http://www.brookhavenhospital.org/guide/patientadvocacy.html','',130,18,'','','','');
  oCMenu.makeMenu('sub012','top0','Visiting Hours','http://www.brookhavenhospital.org/guide/visitinghours.html','',130,18,'','','','');
  oCMenu.makeMenu('sub013','top0','Leaving the Hospital','http://www.brookhavenhospital.org/guide/leavingthehospital.html','',130,18,'','','','');
  oCMenu.makeMenu('sub014','top0','JCAHO Public Notice','http://www.brookhavenhospital.org/aboutus/jcahonotice.html','',130,18,'','','','');

  oCMenu.makeMenu('top1','','CAREERS','http://www.brookhavenhospital.org/careers/','',59,19,'/images/b_images/brookhaven/gleg_brookhaven_04_off.gif','/images/b_images/brookhaven/gleg_brookhaven_04.gif','menuitem','menuitemover',"bottomleft");
  oCMenu.makeMenu('sub100','top1','Benefits','http://www.brookhavenhospital.org/careers/benefits.html','',120,18,'','','','');
  oCMenu.makeMenu('sub101','top1','Career Development','http://www.brookhavenhospital.org/careers/careerdevelopment.html','',120,18,'','','','');
  oCMenu.makeMenu('sub102','top1','Contact Us','http://www.brookhavenhospital.org/careers/contactus.html','',120,18,'','','','');

  oCMenu.makeMenu('top2','','ABOUT US','http://www.brookhavenhospital.org/aboutus/','',63,19,'/images/b_images/brookhaven/gleg_brookhaven_05_off.gif','/images/b_images/brookhaven/gleg_brookhaven_05.gif','menuitem','menuitemover',"bottomleft");
  oCMenu.makeMenu('sub200','top2','Contact Us','http://www.brookhavenhospital.org/aboutus/contactus.html','',130,18,'','','','');
  oCMenu.makeMenu('sub201','top2','Mission, Vision<br>and Core Values','http://www.brookhavenhospital.org/aboutus/missionvisionstatements.html','',130,32,'','','','');
  oCMenu.makeMenu('sub202','top2','Chairmans Message','http://www.brookhavenhospital.org/aboutus/chairmanmessage.html','',130,18,'','','','');
  oCMenu.makeMenu('sub203','top2','A Message from the President','http://www.brookhavenhospital.org/aboutus/presidentmessage.html','',130,32,'','','','');
  oCMenu.makeMenu('sub204','top2','Calendar','http://www.brookhavenhospital.org/aboutus/calendar/','',130,18,'','','','');
  oCMenu.makeMenu('sub205','top2','Nursing and<BR>Patient Care','http://www.brookhavenhospital.org/aboutus/nursing.html','',130,32,'','','','');
  oCMenu.makeMenu('sub206','top2','	Economic Impact<br>Statement ','http://www.brookhavenhospital.org/aboutus/impact.html','',130,32,'','','','');
  oCMenu.makeMenu('sub207','top2','Ethics Committee','http://www.brookhavenhospital.org/aboutus/ethicscommittee.html','',130,18,'','','','');
  oCMenu.makeMenu('sub208','top2','	JCAHO Public Notice','http://www.brookhavenhospital.org/aboutus/jcahonotice.html','',130,18,'','','','');
  oCMenu.makeMenu('sub209','top2','HIPAA Privacy<BR>Practices','http://www.brookhavenhospital.org/aboutus/hipaapolicy.html','',130,32,'','','','');

  oCMenu.makeMenu('top3','','COMMUNITY RELATIONS','http://www.brookhavenhospital.org/communityrelations/','',127,19,'/images/b_images/brookhaven/gleg_brookhaven_06_off.gif','/images/b_images/brookhaven/gleg_brookhaven_06.gif','menuitem','menuitemover',"bottomleft");
  oCMenu.makeMenu('sub30','top3','Advertisements','http://www.brookhavenhospital.org/communityrelations/advertisements.html','',130,18,'','','','');
  oCMenu.makeMenu('sub31','top3','News Articles','http://www.brookhavenhospital.org/communityrelations/newsarticles.html','',130,18,'','','','');
  oCMenu.makeMenu('sub32','top3','Newsletters','http://www.brookhavenhospital.org/communityrelations/newsletters.html','',130,18,'','','','');
  oCMenu.makeMenu('sub33','top3','Annual Report','http://www.brookhavenhospital.org/waystogive/annualreport.html','',130,18,'','','','');

  oCMenu.makeMenu('top4','','WAYS TO GIVE','http://www.brookhavenhospital.org/waystogive/','',80,19,'/images/b_images/brookhaven/gleg_brookhaven_07.gif','/images/b_images/brookhaven/gleg_brookhaven_07.gif','menuitem','menuitemover',"bottomleft");
  oCMenu.makeMenu('sub40','top4','Make a Donation','https://www.brookhavenhospital.org/waystogive/donate.html','',130,18,'','','','');
  oCMenu.makeMenu('sub41','top4','Benefits of Giving','http://www.brookhavenhospital.org/waystogive/benefitsofgiving.html','',130,18,'','','','');
  oCMenu.makeMenu('sub42','top4','Types of Gifts','http://www.brookhavenhospital.org/waystogive/typesofgifts.html','',130,18,'','','','');
  oCMenu.makeMenu('sub43','top4','Planned Giving','http://www.brookhavenhospital.org/waystogive/plannedgiving.html','',130,18,'','','','');
  oCMenu.makeMenu('sub44','top4','Commemorative Gifts','http://www.brookhavenhospital.org/waystogive/commemorativegifts.html','',130,18,'','','','');
  oCMenu.makeMenu('sub45','top4','Volunteerism','http://www.brookhavenhospital.org/waystogive/volunteerism.html','',130,18,'','','','');
  oCMenu.makeMenu('sub46','top4','Annual Report','http://www.brookhavenhospital.org/waystogive/annualreport.html','',130,18,'','','','');

  oCMenu.makeMenu('top5','','SITE MAP','http://www.brookhavenhospital.org/sitemap/','',65,19,'/images/b_images/brookhaven/gleg_brookhaven_08_off.gif','/images/b_images/brookhaven/gleg_brookhaven_08.gif','menuitem','menuitemover',"bottomleft");

//Leave this line - it constructs the menu

oCMenu.construct()

//Extra code to find position:
function findPos(num){
  if(bw.ns4){   //Netscape 4
    x = document.layers["layerMenu"+num].pageX
    y = document.layers["layerMenu"+num].pageY
  }else{ //other browsers
    x=0; y=0; var el,temp
    el = bw.ie4?document.all["divMenu"+num]:document.getElementById("divMenu"+num);
    if(el.offsetParent){
      temp = el
      while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
        temp=temp.offsetParent;
        x+=temp.offsetLeft
        y+=temp.offsetTop;
      }
    }
    x+=el.offsetLeft
    y+=el.offsetTop
  }
  //Returning the x and y as an array
  return [x,y]
}

function placeElements(){
  //Changing the position of ALL top items:
  pos = findPos(0);
  oCMenu.m["top0"].b.moveIt(pos[0],pos[1]);
  pos = findPos(1);
  oCMenu.m["top1"].b.moveIt(pos[0],pos[1]);
  pos = findPos(2);
  oCMenu.m["top2"].b.moveIt(pos[0],pos[1]);
  pos = findPos(3);
  oCMenu.m["top3"].b.moveIt(pos[0],pos[1]);
  pos = findPos(4);
  oCMenu.m["top4"].b.moveIt(pos[0],pos[1]);
  pos = findPos(5);
  oCMenu.m["top5"].b.moveIt(pos[0],pos[1]);
  //Setting the fromtop value
  oCMenu.fromTop = pos[1];
}
placeElements();
//Setting it to re place the elements after resize - the resize is not perfect though..
oCMenu.onafterresize="placeElements()"
