/*** 
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="/AppTek/App-Tek.com/www/" 
//oCMenu.onlineRoot="http://localhost/apptek/" 
oCMenu.onlineRoot="http://www.app-tek.com.au/" 
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 0
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width="93"
oCMenu.level[0].height=25
oCMenu.level[0].regClass="clLevel0"
oCMenu.level[0].overClass="clLevel0over"
oCMenu.level[0].borderX=0
oCMenu.level[0].borderY=2
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"

oCMenu.level[1]=new cm_makeLevel() //Add this for each new level
oCMenu.level[1].width="200"
oCMenu.level[1].height=24
oCMenu.level[1].regClass="clLevel0"
oCMenu.level[1].overClass="clLevel0over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].borderClass="clLevel0border"
oCMenu.level[1].offsetX=0
oCMenu.level[1].offsetY=0
oCMenu.level[1].rows=0
oCMenu.level[1].arrow="images/navarrow.gif"
oCMenu.level[1].arrowWidth=6
oCMenu.level[1].arrowHeight=8
oCMenu.level[1].align="right"

oCMenu.level[2]=new cm_makeLevel() //Add this for each new level
oCMenu.level[2].width="200"
oCMenu.level[2].height=24
oCMenu.level[2].regClass="clLevel0"
oCMenu.level[2].overClass="clLevel0over"
oCMenu.level[2].borderX=1
oCMenu.level[2].borderY=1
oCMenu.level[2].borderClass="clLevel0border"
oCMenu.level[2].offsetX=0
oCMenu.level[2].offsetY=0
oCMenu.level[2].rows=0
oCMenu.level[2].arrow="images/navarrow.gif"
oCMenu.level[2].arrowWidth=6
oCMenu.level[2].arrowHeight=8
oCMenu.level[2].align="right"

oCMenu.level[3]=new cm_makeLevel() //Add this for each new level
oCMenu.level[3].width="200"
oCMenu.level[3].height=24 
oCMenu.level[3].regClass="clLevel0"
oCMenu.level[3].overClass="clLevel0over"
oCMenu.level[3].borderX=1
oCMenu.level[3].borderY=1
oCMenu.level[3].borderClass="clLevel0border"
oCMenu.level[3].offsetX=0
oCMenu.level[3].offsetY=0
oCMenu.level[3].rows=0
oCMenu.level[3].arrow=0
oCMenu.level[3].arrowWidth=0
oCMenu.level[3].arrowHeight=0
oCMenu.level[3].align="right"


/******************************************
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;&nbsp;&nbsp;&nbsp;Home','apptek/app-tekcomau/www/index.html','')
	
oCMenu.makeMenu('top1','','&nbsp;About Us','/apptek/app-tekcomau/www/aboutus.html')
	//oCMenu.makeMenu('sub10','top1','New scripts','/scripts/index.asp?show=new')

	
oCMenu.makeMenu('top2','','&nbsp;Products','/apptek/app-tekcomau/www/products/index.html')
	oCMenu.makeMenu('sub21','top2','Air Sampling','/apptek/app-tekcomau/www/products/airsamp.html')
	oCMenu.makeMenu('sub22','top2','Portable Gas Detectors','/apptek/app-tekcomau/www/products/portgas.html')
		oCMenu.makeMenu('sub220','sub22','OdaLog','/apptek/app-tekcomau/www/products/portgas.html')
			oCMenu.makeMenu('sub2200','sub220','OdaLog Type L2','/apptek/app-tekcomau/www/products/portgas.html#ol2')
			oCMenu.makeMenu('sub2201','sub220','7000','/apptek/app-tekcomau/www/products/portgas.html#ol7000')
			oCMenu.makeMenu('sub2202','sub220','6000','/apptek/app-tekcomau/www/products/portgas.html#ol6000')
			oCMenu.makeMenu('sub2203','sub220','Monitor/Detector','/apptek/app-tekcomau/www/products/portgas.html#olmon')
			oCMenu.makeMenu('sub2204','sub220','Methanometer','/apptek/app-tekcomau/www/products/portgas.html#meth')
			oCMenu.makeMenu('sub2205','sub220','Logger','/apptek/app-tekcomau/www/products/portgas.html#ollogger')
			oCMenu.makeMenu('sub2206','sub220','Low Range 0.01-2ppm Logger','/apptek/app-tekcomau/www/products/portgas.html#ollow')
			oCMenu.makeMenu('sub2207','sub220','OdaTrak','/apptek/app-tekcomau/www/products/portgas.html#odatrak')
		oCMenu.makeMenu('sub221','sub22','Multi-Gas','/apptek/app-tekcomau/www/products/portgas.html#multi')
		oCMenu.makeMenu('sub222','sub22','Single Gas','/apptek/app-tekcomau/www/products/portgas.html#single')
		oCMenu.makeMenu('sub223','sub22','Specialised Env.Instruments','/apptek/app-tekcomau/www/products/portgas.html#special')
		oCMenu.makeMenu('sub224','sub22','Detector Tubes','/apptek/app-tekcomau/www/products/portgas.html#tubes')
		oCMenu.makeMenu('sub225','sub22','Combustibles & Leak Detectors','/apptek/app-tekcomau/www/products/portgas.html#leakdetect')
	oCMenu.makeMenu('sub23','top2','Fixed Gas Detectors','/apptek/app-tekcomau/www/products/fixedgas.html')
	oCMenu.makeMenu('sub24','top2','Photo Ionisation','/apptek/app-tekcomau/www/products/photoion.html')
	oCMenu.makeMenu('sub2d','top2','Light Meters','/apptek/app-tekcomau/www/products/light.html')
	oCMenu.makeMenu('sub25','top2','Sound Level Meters','/apptek/app-tekcomau/www/products/soundlevel.html')
		oCMenu.makeMenu('sub250','sub25','Meters','/apptek/app-tekcomau/www/products/soundlevel.html#meters')
		oCMenu.makeMenu('sub251','sub25','Sound Calibrators','/apptek/app-tekcomau/www/products/soundlevel.html#calib')
		oCMenu.makeMenu('sub252','sub25','Octave Band Filters','/apptek/app-tekcomau/www/products/soundlevel.html#octave')
		oCMenu.makeMenu('sub253','sub25','Real Time Analyser','/apptek/app-tekcomau/www/products/soundlevel.html#realtime')
		oCMenu.makeMenu('sub254','sub25','Sound Level Detector','/apptek/app-tekcomau/www/products/soundlevel.html#detector')
	oCMenu.makeMenu('sub26','top2','Noise Dosimeters','/apptek/app-tekcomau/www/products/noise.html')
	oCMenu.makeMenu('sub27','top2','Personal Heat Stress Monitors','/apptek/app-tekcomau/www/products/heatstress.html')
	oCMenu.makeMenu('sub28','top2','Thermal Environment Monitors','/apptek/app-tekcomau/www/products/therm.html')
	oCMenu.makeMenu('sub28b','top2','Indoor Air Quality','/apptek/app-tekcomau/www/products/indoorair.html')
	oCMenu.makeMenu('sub28a','top2','Vibration Monitors','/apptek/app-tekcomau/www/products/vibration.html')
	oCMenu.makeMenu('sub29','top2','Software','/apptek/app-tekcomau/www/products/software.html')
	oCMenu.makeMenu('sub2a','top2','Flowmeters','/apptek/app-tekcomau/www/products/flowmeters.html')
	oCMenu.makeMenu('sub2c','top2','Gas Dilution &amp; Calibration','/apptek/app-tekcomau/www/products/gasdilution.html')
	oCMenu.makeMenu('sub2b','top2','Equipment Hire','/apptek/app-tekcomau/www/products/hire.html')

oCMenu.makeMenu('top3','','&nbsp;Services','/apptek/app-tekcomau/www/services/index.html')
	oCMenu.makeMenu('sub30','top3','Service & Calibration','/apptek/app-tekcomau/www/services/index.html#service')
	oCMenu.makeMenu('sub31','top3','Training Services','/apptek/app-tekcomau/www/services/training.html')
	oCMenu.makeMenu('sub32','top3','Forms','/apptek/app-tekcomau/www/services/forms.html')


oCMenu.makeMenu('top4','','&nbsp;&nbsp;&nbsp;News','/apptek/app-tekcomau/www/news/index.html')
	oCMenu.makeMenu('sub40','top4','Current Newsletter','/apptek/app-tekcomau/www/news/index.html#current')
	oCMenu.makeMenu('sub41','top4','Trade Shows','/apptek/app-tekcomau/www/news/tradeshows.html')
	
oCMenu.makeMenu('top5','','&nbsp;Contact','/apptek/app-tekcomau/www/contact.html')	

oCMenu.makeMenu('top6','','&nbsp;&nbsp;&nbsp;Links','/apptek/app-tekcomau/www/links.html')

oCMenu.makeMenu('top7','','&nbsp;Search','/apptek/app-tekcomau/www/search.php')
	
//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["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])  
  pos = findPos(6)
  oCMenu.m["top6"].b.moveIt(pos[0],pos[1]) 
  pos = findPos(7)
  oCMenu.m["top7"].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()"