/***
This is the menu creation code - place it right after you body tag
Feel free to add this to a stand-alone js file and link it to your page.
**/

//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=1
oCMenu.menuPlacement=0

oCMenu.offlineRoot=""
oCMenu.onlineRoot=""
oCMenu.resizeCheck=1
oCMenu.wait=1000
oCMenu.fillImg="images/spacer.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=0

//Level properties - ALL properties have to be spesified in level 1
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width=179
oCMenu.level[0].height=36
oCMenu.level[0].regClass="clLevel1"
oCMenu.level[0].overClass="clLevel1over"
oCMenu.level[0].borderX=1
oCMenu.level[0].borderY=0
oCMenu.level[0].borderClass="clLevel1border"
oCMenu.level[0].offsetX=-2
oCMenu.level[0].offsetY=0
oCMenu.level[0].rows=0
oCMenu.level[0].arrow="images/arrow.gif"
oCMenu.level[0].arrowWidth=0
oCMenu.level[0].arrowHeight=0
oCMenu.level[0].align="right"
oCMenu.level[0].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.2); alpha(opacity=85, style=0);"

//Level properties - ALL properties have to be spesified in level 2
oCMenu.level[1]=new cm_makeLevel() //Add this for each new level
oCMenu.level[1].width=179
oCMenu.level[1].height=36
oCMenu.level[1].regClass="clLevel2"
oCMenu.level[1].overClass="clLevel2over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].borderClass="clLevel2border"
oCMenu.level[1].offsetX=-1
oCMenu.level[1].offsetY=-1
oCMenu.level[1].rows=0
oCMenu.level[1].arrow="images/arrow.gif"
oCMenu.level[1].arrowWidth=15
oCMenu.level[1].arrowHeight=12
oCMenu.level[1].align="botttom"
oCMenu.level[1].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.2); alpha(opacity=85, style=0);"

//Level properties - ALL properties have to be spesified in level 3
oCMenu.level[2]=new cm_makeLevel() //Add this for each new level
oCMenu.level[2].width=179
oCMenu.level[2].height=36
oCMenu.level[2].regClass="clLevel3"
oCMenu.level[2].overClass="clLevel3over"
oCMenu.level[2].borderX=1
oCMenu.level[2].borderY=1
oCMenu.level[2].borderClass="clLevel3border"
oCMenu.level[2].offsetX=-1
oCMenu.level[2].offsetY=-1
oCMenu.level[2].rows=0
oCMenu.level[2].arrow="images/arrow.gif"
oCMenu.level[2].arrowWidth=15
oCMenu.level[2].arrowHeight=12
oCMenu.level[2].align="botttom"
oCMenu.level[2].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.2); alpha(opacity=85, style=0);"

//Level properties - ALL properties have to be spesified in level 4
oCMenu.level[3]=new cm_makeLevel() //Add this for each new level
oCMenu.level[3].width=179
oCMenu.level[3].height=36
oCMenu.level[3].regClass="clLevel4"
oCMenu.level[3].overClass="clLevel4over"
oCMenu.level[3].borderX=1
oCMenu.level[3].borderY=1
oCMenu.level[3].borderClass="clLevel4border"
oCMenu.level[3].offsetX=-1
oCMenu.level[3].offsetY=-1
oCMenu.level[3].rows=0
oCMenu.level[3].arrow="images/arrow.gif"
oCMenu.level[3].arrowWidth=15
oCMenu.level[3].arrowHeight=12
oCMenu.level[3].align="botttom"
oCMenu.level[3].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.2); alpha(opacity=85, style=0);"

/******************************************
Menu item creation:
myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass, align, rows, nolink, onclick, onmouseover, onmouseout)
*************************************/


// Level1 (id=12) - Who We Are (no parent)



oCMenu.makeMenu('120','','','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.whoweare&x=8474886','_self','','36','images/spacer.gif','images/whoWeAre_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=16) - Board of Trustees (parent of Level1 (id=12) - Who We Are)
	oCMenu.makeMenu('16012','120','Board of Trustees','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.trustees&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel1Bg','','','','','','')
		
	// Level2 (id=5) - Staff (parent of Level1 (id=12) - Who We Are)
	oCMenu.makeMenu('5012','120','Staff','https://www.palmhealthcare.org/index.cfm?fuseaction=contactus.main&x=8474886','_self','','52','','','clLevel2','clLevel2over clLevel1Bg','','','','','','')
		
	// Level2 (id=18) - Annual Report (parent of Level1 (id=12) - Who We Are)
	oCMenu.makeMenu('18012','120','Annual Report','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.annualreport&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel1Bg','','','','','','')
		
	// Level2 (id=3) - Contact Palm Healthcare Foundation (parent of Level1 (id=12) - Who We Are)
	oCMenu.makeMenu('3012','120','Contact Palm Healthcare Foundation','https://www.palmhealthcare.org/contactus.htm','_self','','52','','','clLevel2','clLevel2over clLevel1Bg','','','','','','')
		
// Level1 (id=193) - Give (no parent)



oCMenu.makeMenu('1930','','','https://www.palmhealthcare.org/give.htm','_self','','36','images/spacer.gif','images/give_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=270) - Make a Gift (parent of Level1 (id=193) - Give)
	oCMenu.makeMenu('2700193','1930','Make a Gift','http://www.palmhealthcare.org/index.cfm?fuseaction=pages.give','_self','','36','','','clLevel2','clLevel2over clLevel2Bg','','','','','','')
		
	// Level2 (id=251) - PHF Giving Societies (parent of Level1 (id=193) - Give)
	oCMenu.makeMenu('2510193','1930','PHF Giving Societies','https://www.palmhealthcare.org/GiveSociety','_self','','52','','','clLevel2','clLevel2over clLevel2Bg','','','','','','')
		
	// Level2 (id=215) - Planned Giving (parent of Level1 (id=193) - Give)
	oCMenu.makeMenu('2150193','1930','Planned Giving','https://www.palmhealthcare.org/plangiving.htm','_self','','52','','','clLevel2','clLevel2over clLevel2Bg','','','','','','')
		
	// Level2 (id=273) - Our Donor Family (parent of Level1 (id=193) - Give)
	oCMenu.makeMenu('2730193','1930','Our Donor Family','https://www.palmhealthcare.org/donors2008.html','_self','','36','','','clLevel2','clLevel2over clLevel2Bg','','','','','','')
		
// Level1 (id=13) - What We Do (no parent)



oCMenu.makeMenu('130','','','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.whatwedo&x=8474886','_self','','36','images/spacer.gif','images/whatWeDo_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=139) - Initiatives (parent of Level1 (id=13) - What We Do)
	oCMenu.makeMenu('139013','130','Initiatives','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.initiatives&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel3Bg','','','','','','')
		
		// Level3 (id=141) - Healthcare Workforce Partnership (parent of Level2 (id=139) - Initiatives)
		oCMenu.makeMenu('1410139013','139013','Healthcare Workforce Partnership','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.healthcareworkforcepartnership&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
		// Level3 (id=162) - Nursing Education Initiative (parent of Level2 (id=139) - Initiatives)
		oCMenu.makeMenu('1620139013','139013','Nursing Education Initiative','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.nursingeducationinitiative&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
		// Level3 (id=165) - Novice Nurse Leadership Institute (parent of Level2 (id=139) - Initiatives)
		oCMenu.makeMenu('1650139013','139013','Novice Nurse Leadership Institute','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.novicenurseleadershipinstitute&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
	// Level2 (id=175) - Grant Programs (parent of Level1 (id=13) - What We Do)
	oCMenu.makeMenu('175013','130','Grant Programs','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.grants&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel3Bg','','','','','','')
		
		// Level3 (id=29) - Apply Online (parent of Level2 (id=175) - Grant Programs)
		oCMenu.makeMenu('290175013','175013','Apply Online','https://www.palmhealthcare.org/onlinegrantapplications.htm','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
		// Level3 (id=134) - Oncology and Cancer-Related Focus (parent of Level2 (id=175) - Grant Programs)
		oCMenu.makeMenu('1340175013','175013','Oncology and Cancer-Related Focus','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.oncology&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
		// Level3 (id=135) - Patient Financial Support Program (parent of Level2 (id=175) - Grant Programs)
		oCMenu.makeMenu('1350175013','175013','Patient Financial Support Program','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.patientfinancialsupport&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
		// Level3 (id=19) - Responsive Grant Program (parent of Level2 (id=175) - Grant Programs)
		oCMenu.makeMenu('190175013','175013','Responsive Grant Program','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.rgrants&x=8474886','_self','','52','','','clLevel3','clLevel3over clLevel3Bg','','','','','','')
			
	// Level2 (id=300) - Recent Grants  (parent of Level1 (id=13) - What We Do)
	oCMenu.makeMenu('300013','130','Recent Grants ','https://www.palmhealthcare.org/recentgrants','_self','','36','','','clLevel2','clLevel2over clLevel3Bg','','','','','','')
		
	// Level2 (id=243) - Palm Healthcare Pavilion (parent of Level1 (id=13) - What We Do)
	oCMenu.makeMenu('243013','130','Palm Healthcare Pavilion','http://www.greatertogether.org','_blank','','52','','','clLevel2','clLevel2over clLevel3Bg','','','','','','')
		
// Level1 (id=287) - Volunteer (no parent)



oCMenu.makeMenu('2870','','','https://www.palmhealthcare.org/volunteer.htm','_self','','36','images/spacer.gif','images/volunteer_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=170) - Events Listing (no parent)



oCMenu.makeMenu('1700','','','https://www.palmhealthcare.org/eventslisting.htm','_self','','36','images/spacer.gif','images/events_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=269) - Event Calendar (parent of Level1 (id=170) - Events Listing)
	oCMenu.makeMenu('2690170','1700','Event Calendar','http://www.palmhealthcare.org/index.cfm?fuseaction=events.main','_self','','36','','','clLevel2','clLevel2over clLevel5Bg','','','','','','')
		
	// Level2 (id=268) - Photo Gallery (parent of Level1 (id=170) - Events Listing)
	oCMenu.makeMenu('2680170','1700','Photo Gallery','https://www.palmhealthcare.org/index.cfm?fuseaction=photoalbum.main&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel5Bg','','','','','','')
		
// Level1 (id=7) - News (no parent)



oCMenu.makeMenu('70','','','https://www.palmhealthcare.org/newslisting.htm','_self','','36','images/spacer.gif','images/newsPress_hover.jpg','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=295) - Media Kit (parent of Level1 (id=7) - News)
	oCMenu.makeMenu('29507','70','Media Kit','https://www.palmhealthcare.org/mediakit.htm','_self','','36','','','clLevel2','clLevel2over clLevel6Bg','','','','','','')
		
	// Level2 (id=291) - Newsletter (parent of Level1 (id=7) - News)
	oCMenu.makeMenu('29107','70','Newsletter','https://www.palmhealthcare.org/index.cfm?fuseaction=pages.newsletter&x=8474886','_self','','36','','','clLevel2','clLevel2over clLevel6Bg','','','','','','')
		
	// Level2 (id=299) - Press Releases (parent of Level1 (id=7) - News)
	oCMenu.makeMenu('29907','70','Press Releases','http://www.palmhealthcare.org/newslisting.htm','_self','','36','','','clLevel2','clLevel2over clLevel6Bg','','','','','','')
		

//Leave this line - it constructs the menu
oCMenu.construct()


//Extra code to find position:
function findPos(num,offset)
{
  //alert(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;
				if(bw.ns6)
				{
			 x+=temp.offsetLeft - offset;
				}
				else
				{
				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(offset)
{
  //Changing the position of ALL top items:
  
	pos = findPos(120,offset)
	oCMenu.m["120"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(1930,offset)
	oCMenu.m["1930"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(130,offset)
	oCMenu.m["130"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(2870,offset)
	oCMenu.m["2870"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(1700,offset)
	oCMenu.m["1700"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(70,offset)
	oCMenu.m["70"].b.moveIt(pos[0],pos[1])
	
  //Setting the fromtop value
  oCMenu.fromTop = pos[1]
}
placeElements(0)
//Setting it to re place the elements after resize - the resize is not perfect though..
oCMenu.onafterresize="placeElements(0)" 