/*** 
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.
**/

//Extra code to find position:
function findPos(){
  if(bw.ns4){   //Netscape 4
    x = document.layers.layerMenu.pageX
    y = document.layers.layerMenu.pageY
  }else{ //other browsers
    x=0; y=0; var el,temp
    el = bw.ie4?document.all["divMenu"]:document.getElementById("divMenu");
    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]
}

pos = findPos()
//Menu object creation
oCMenu=new makeCM("oCMenu") //Making the menu object. Argument: menuname
//Menu properties   
oCMenu.frames = 0
oCMenu.pxBetween=3
//Using the cm_page object to place the menu ----
oCMenu.fromLeft=pos[0]
oCMenu.fromTop=pos[1]
//We also need to "re place" the menu on resize. So:
//oCMenu.onresize="pos = findPos(); oCMenu.fromLeft=pos[0]; oCMenu.fromTop=pos[1];window.location.reload()"
oCMenu.onresize="window.location.reload()"
oCMenu.rows=0 
oCMenu.menuPlacement=0
                                                             
oCMenu.offlineRoot="./" 
oCMenu.onlineRoot="./" 
oCMenu.resizeCheck=1 
oCMenu.wait=500 
oCMenu.fillImg="cm_fill.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=0
oCMenu.barWidth="menu"
oCMenu.barHeight="menu" 
oCMenu.barClass="clBar"
oCMenu.barX=0 
oCMenu.barY=0
oCMenu.barBorderX=0
oCMenu.barBorderY=0
oCMenu.barBorderClass=""

//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=141
oCMenu.level[0].height=15 
oCMenu.level[0].regClass="clLevel0"
oCMenu.level[0].overClass="clLevel0over"
oCMenu.level[0].borderX=0
oCMenu.level[0].borderY=0
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="right"

//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=oCMenu.level[0].width-2
oCMenu.level[1].height=22
oCMenu.level[1].regClass="clLevel1"
oCMenu.level[1].overClass="clLevel1over"
oCMenu.level[1].borderX=0
oCMenu.level[1].borderY=0
oCMenu.level[1].align="right" 
oCMenu.level[1].offsetX=-150
oCMenu.level[1].offsetY=20
oCMenu.level[1].borderClass="clLevel1border"


//EXAMPLE SUB LEVEL[2] PROPERTIES - You have to spesify the properties you want different from LEVEL[1] OR LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[2]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[2].width=150
oCMenu.level[2].height=20
oCMenu.level[2].offsetX=0
oCMenu.level[2].offsetY=0
oCMenu.level[2].regClass="clLevel2"
oCMenu.level[2].overClass="clLevel2over"
oCMenu.level[2].borderClass="clLevel2border"


/******************************************
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','','text.html','aboutFNA.htm','',141,28,'/images/AboutFNA.gif','/images/AboutFNAon.gif')

oCMenu.makeMenu('top1','','text.html','whatsnew.htm','',141,21,'/images/WhatsNew.gif','/images/WhatsNewon.gif')

oCMenu.makeMenu('topsicf','','text.html','http://www.sawcentre.nus.edu.sg/sicf/','',141,21,'/images/sicf_off.gif','/images/sicf_on.gif')

oCMenu.makeMenu('top2','','text.html','','',141,21,'/images/FacultyStaff.gif','/images/FacultyStaffon.gif')
    oCMenu.makeMenu('sub20','top2','','','',150,15,'/images/curveup.gif','/images/curveup.gif')
		oCMenu.makeMenu('sub21','top2','','facultymembers.asp','',150,20,'/images/sub2_1off.gif','/images/sub2_1on.gif')
		oCMenu.makeMenu('sub22','top2','','facultyotherstaff.htm','',150,20,'/images/sub2_2off.gif','/images/sub2_2on.gif')
		oCMenu.makeMenu('sub23','top2','','faculty_achievements.htm','',150,20,'/images/achievements_off.gif','/images/achievements_on.gif')
		oCMenu.makeMenu('sub24','top2','','facultystaff.htm','',150,20,'/images/sub2_3off.gif','/images/sub2_3on.gif')
    oCMenu.makeMenu('sub25','top2','','','',150,15,'/images/curvedown.gif','/images/curvedown.gif')

oCMenu.makeMenu('top3','','text.html','courses.htm','',141,21,'/images/Courses.gif','/images/Courseson.gif')
	
oCMenu.makeMenu('top4','','text.html','','',141,21,'/images/PhDMSc_off.gif','/images/PhDMSc_on.gif')
    oCMenu.makeMenu('sub40','top4','','','',150,15,'/images/curveup.gif','/images/curveup.gif')
		oCMenu.makeMenu('sub41','top4','','studentsProspective.htm','',150,20,'/images/prospective_students_off.gif','/images/prospective_students_on.gif')
		oCMenu.makeMenu('sub42','top4','','studentsCurrent.htm','',150,20,'/images/current_students_off.gif','/images/current_students_on.gif')
    oCMenu.makeMenu('sub43','top4','','','',150,15,'/images/curvedown.gif','/images/curvedown.gif')

oCMenu.makeMenu('top5','','text.html','','',141,21,'/images/Seminars.gif','/images/Seminarson.gif')
    oCMenu.makeMenu('sub50','top5','','','',150,15,'/images/curveup.gif','/images/curveup.gif')
		oCMenu.makeMenu('sub51','top5','','seminars.asp','',150,20,'/images/department_off.gif','/images/department_on.gif')
		oCMenu.makeMenu('sub52','top5','','BrownBag.htm','',150,20,'/images/brownbag_off.gif','/images/brownbag_on.gif')
		//oCMenu.makeMenu('sub52','top5','','seminarscitibank.htm','',150,20,'/images/sub5_2off.gif','/images/sub5_2on.gif')
    oCMenu.makeMenu('sub53','top5','','','',150,15,'/images/curvedown.gif','/images/curvedown.gif')

//oCMenu.makeMenu('top6','','text.html','workingpapers.htm','',141,21,'/images/WorkingPapers.gif','/images/WorkingPaperson.gif')

oCMenu.makeMenu('top7','','text.html','visitingscholars.asp','',141,21,'/images/VisitingScholars.gif','/images/VisitingScholarson.gif')

oCMenu.makeMenu('top8','','text.html','financialdatabase.htm','',141,21,'/images/FinancialDatabase.gif','/images/FinancialDatabaseon.gif')

oCMenu.makeMenu('top9','','text.html','','',141,21,'/images/researchcentres.gif','/images/researchcentres_on.gif')
    oCMenu.makeMenu('sub90','top9','','','',150,15,'/images/curveup.gif','/images/curveup.gif')
		oCMenu.makeMenu('sub91','top9','','../../Research/CGFRC/home.htm','',150,50,'/images/sub9_1off.gif','/images/sub9_1on.gif')
		oCMenu.makeMenu('sub92','top9','','http://www.sawcentre.nus.edu.sg','',150,35,'/images/sub9_2off.gif','/images/sub9_2on.gif')
    oCMenu.makeMenu('sub93','top9','','','',150,15,'/images/curvedown.gif','/images/curvedown.gif')

oCMenu.makeMenu('top10','','text.html','events.htm','',141,21,'/images/Eventsoff.gif','/images/Eventson.gif')

oCMenu.makeMenu('top11','','text.html','wearehiring.htm','',141,21,'/images/job_off.gif','/images/job_on.gif')

oCMenu.makeMenu('top12','','text.html','contactus.htm','',141,21,'/images/ContactUsoff.gif','/images/ContactUson.gif')

//Leave this line - it constructs the menu
oCMenu.construct()