//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=1
                                       
oCMenu.offlineRoot="file:///C:/Users/David/Documents/Penny/Henley/HenleyWeb/" 
oCMenu.onlineRoot="http://www.henley.school.nz" 
// http://www.henley.school.nz or http://test.intranet.henley depending on where you're publishing to...
oCMenu.resizeCheck=1 
oCMenu.wait=1000 
oCMenu.fillImg="/images/cm_fill.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=0

//Level properties - ALL properties have to be specified in level 0
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width="15%"
oCMenu.level[0].height=25 
oCMenu.level[0].regClass="clLevel0"
oCMenu.level[0].overClass="clLevel0over"
oCMenu.level[0].borderX=1
oCMenu.level[0].borderY=1
oCMenu.level[0].borderClass="clLevel0border"
oCMenu.level[0].offsetX=0
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"

//EXAMPLE SUB LEVEL[1] PROPERTIES - You have to specify the properties you want different from LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[1]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[1].width="15%"
oCMenu.level[1].height=25
oCMenu.level[1].regClass="clLevel1"
oCMenu.level[1].overClass="clLevel1over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].align="right" 
oCMenu.level[1].offsetX=0
oCMenu.level[1].offsetY=0
oCMenu.level[1].borderClass="clLevel1border"

/******************************************
Menu item creation:
myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout) 
*************************************/
oCMenu.makeMenu('top0','','&nbsp;&nbsp;Home','/index.htm')

oCMenu.makeMenu('top2','','&nbsp;Our School','/school/index.htm')
	oCMenu.makeMenu('sub20','top2','&nbsp;Our School','/school/index.htm')
	oCMenu.makeMenu('sub21','top2','&nbsp;Principal','/school/principal.htm')
	oCMenu.makeMenu('sub22','top2','&nbsp;Charter','/school/charter.htm')
	oCMenu.makeMenu('sub23','top2','&nbsp;Board of Trustees','/school/bot.htm')
	oCMenu.makeMenu('sub24','top2','&nbsp;Policies','/school/policies.htm')
	oCMenu.makeMenu('sub25','top2','&nbsp;ERO Reports','/school/ero.htm')
	oCMenu.makeMenu('sub26','top2','&nbsp;Enrolments','/school/enrolments.htm')
	oCMenu.makeMenu('sub27','top2','&nbsp;Staff','/school/staff.htm')
	oCMenu.makeMenu('sub28','top2','&nbsp;Map','/school/maps.htm')

oCMenu.makeMenu('top3','','&nbsp;School Office','/office/index.htm')
	oCMenu.makeMenu('sub30','top3','&nbsp;School Office','/office/index.htm')
	oCMenu.makeMenu('sub31','top3','&nbsp;Lunch Orders','/office/lunch.htm')
	oCMenu.makeMenu('sub32','top3','&nbsp;Uniform','/office/uniform.htm')
	oCMenu.makeMenu('sub33','top3','&nbsp;Stationery','/office/stationery.htm')
	oCMenu.makeMenu('sub34','top3','&nbsp;Absences','/office/absences.htm')
	oCMenu.makeMenu('sub35','top3','&nbsp;Parents','/office/parents.htm')
	oCMenu.makeMenu('sub36','top3','&nbsp;Walking School Bus','/office/walkingbus.htm')
	oCMenu.makeMenu('sub37','top3','&nbsp;Miscellaneous','/office/miscellaneous.htm')
	
oCMenu.makeMenu('top4','','&nbsp;News','/news/index.htm')
	oCMenu.makeMenu('sub40','top4','&nbsp;School Newsletter','/news/index.htm')
	oCMenu.makeMenu('sub42','top4','&nbsp;Term Dates','/news/calendar.htm')
	oCMenu.makeMenu('sub43','top4','&nbsp;BOT News','/news/botnews.htm')
	oCMenu.makeMenu('sub44','top4','&nbsp;Parent Liaison News','/news/parentnews.htm')
	
oCMenu.makeMenu('top5','','&nbsp;Library','/library/index.htm')
	oCMenu.makeMenu('sub50','top5','&nbsp;Library','/library/index.htm','')
    oCMenu.makeMenu('sub51','top5','&nbsp;Encouraging Reading','/library/reading.htm')
    oCMenu.makeMenu('sub52','top5','&nbsp;Favourites','/library/favourites.htm')

oCMenu.makeMenu('top6','','&nbsp;School Community','/community/index.htm')
	oCMenu.makeMenu('sub60','top6','&nbsp;School Community','/community/index.htm','')
    oCMenu.makeMenu('sub61','top6','&nbsp;Parent Liaison','/community/parents.htm')
    oCMenu.makeMenu('sub62','top6','&nbsp;School Hall','/community/hall.htm')   
    
oCMenu.makeMenu('top1','','&nbsp;Vacancies','/vacancies/index.htm')
	oCMenu.makeMenu('sub10','top1','&nbsp;Vacancies','/vacancies/index.htm') 

//Leave this line - it constructs the menu
oCMenu.construct()		

//Extra code to find position:
function findPos(num){
  //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; 
        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["top2"].b.moveIt(pos[0],pos[1])
  pos = findPos(2)
  oCMenu.m["top3"].b.moveIt(pos[0],pos[1])
  pos = findPos(3)
  oCMenu.m["top4"].b.moveIt(pos[0],pos[1])
  pos = findPos(4)
  oCMenu.m["top5"].b.moveIt(pos[0],pos[1])
  pos = findPos(5)
  oCMenu.m["top6"].b.moveIt(pos[0],pos[1])
  pos = findPos(6)
  oCMenu.m["top1"].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()"

function sectionMenu(section){
	document.write('<div id="menu">');

	if (section == 'school') {
	document.write('<ul class=sectionlist><li class=sectionhead><a href="index.htm">Our School</a>');
	document.write('<li class=sectionlinks><a href="principal.htm">Principal</a>');
	document.write('<li class=sectionlinks><a href="charter.htm">Charter</a>');
	document.write('<li class=sectionlinks><a href="bot.htm">Board of Trustee\'s</a>');
	document.write('<li class=sectionlinks><a href="policies.htm">Policies</a>');
	document.write('<li class=sectionlinks><a href="ero.htm">ERO Reports</a>');
	document.write('<li class=sectionlinks><a href="enrolments.htm">Enrolments</a>');
	document.write('<li class=sectionlinks><a href="staff.htm">Staff</a>');
	document.write('<li class=sectionlinks><a href="maps.htm">Maps</a>');
	document.write('</ul>');
	}
	
	if (section == 'office') {
	document.write('<ul class=sectionlist><li class=sectionhead><a href="index.htm">School Office</a>');
	document.write('<li class=sectionlinks><a href="lunch.htm">Lunch Orders</a>');
	document.write('<li class=sectionlinks><a href="uniform.htm">Uniform</a>');
	document.write('<li class=sectionlinks><a href="stationery.htm">Stationery</a>');
	document.write('<li class=sectionlinks><a href="absences.htm">Absences</a>');
	document.write('<li class=sectionlinks><a href="parents.htm">Parents</a>');
	document.write('<li class=sectionlinks><a href="walkingbus.htm">Walking School Bus</a>');
	document.write('<li class=sectionlinks><a href="miscellaneous.htm">Miscellaneous</a>');
	document.write('</ul>');
	}
	if (section == 'news') {
	document.write('<ul class=sectionlist><li class=sectionhead><a href="index.htm">School Newsletter</a>');
 	document.write('<li class=sectionlinks><a href="calendar.htm">Term Dates</a>');
 	document.write('<li class=sectionlinks><a href="botnews.htm">BOT News</a>');
 	document.write('<li class=sectionlinks><a href="parentnews.htm">Parent Liaison News</a>');
	document.write('</ul>');
	}
	if (section == 'library') {
	document.write('<ul class=sectionlist><li class=sectionhead><a href="index.htm">Library</a>');
	document.write('<li class=sectionlinks><a href="reading.htm">Encouraging Reading</a>');  
	document.write('<li class=sectionlinks><a href="favourites.htm">Favourites</a>');
	document.write('</ul>');
	}
	if (section == 'community') {
	document.write('<ul class=sectionlist><li class=sectionhead><a href="index.htm">Community</a>');
	document.write('<li class=sectionlinks><a href="parents.htm">Parent Liaison </a>');  
	document.write('<li class=sectionlinks><a href="hall.htm">School Hall </a>'); 
	document.write('</ul>');
	}
	if (section == 'vacancies') {
	document.write('<ul class=sectionlist>');
	document.write('<li class=sectionhead><a href=index.htm>Vacancies</a>');
	document.write('</ul>');
 	}
	
	document.write('</div>');
}
