/******************************************
Menu item creation:
oCMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout) 
*************************************/

oCMenu.makeMenu('top1','','','index.html','',78,50,'images/homeoff.gif','images/homeon.gif')
	oCMenu.makeMenu('sub11','top1','<div align="center">Home</div>','index.html','','78')
	oCMenu.makeMenu('sub12','top1','<div align="center">Introduction</div>','intro.html','','78')

oCMenu.makeMenu('top2','','','company.html','',96,50,'images/aboutoff.gif','images/abouton.gif')
	oCMenu.makeMenu('sub21','top2','<div align="center">History</div>','company.html','','96')
	oCMenu.makeMenu('sub22','top2','<div align="center">Our Team</div>','team.html','','96')

oCMenu.makeMenu('top3','','','/projects.asp','',96,50,'images/projectsoff.gif','images/projectson.gif')
	oCMenu.makeMenu('sub31','top3','<div align="center">Current Projects</div>','/projects.asp','','96')
	oCMenu.makeMenu('sub32','top3','<div align="center">Search Project Database</div>','search.asp','','96','33')

oCMenu.makeMenu('top4','','','contact.html','',116,50,'images/contactoff.gif','images/contacton.gif')
	oCMenu.makeMenu('sub41','top4','<div align="center">Contact Information</div>','contact.html','','116')
	oCMenu.makeMenu('sub42','top4','<div align="center">Employment</div>','employment.html','','116')

//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(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])
   
  //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()"

