/*** 
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="/cfsgweb/" 
oCMenu.resizeCheck=1 
oCMenu.wait=1000 
oCMenu.fillImg="cm_fill.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="20%"
oCMenu.level[0].height=30 
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=5
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 spesify 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=30
oCMenu.level[1].regClass="clLevel1"
oCMenu.level[1].overClass="clLevel1over"
oCMenu.level[1].style=""

oCMenu.level[1].offsetX=-10
oCMenu.level[1].offsetY=1
oCMenu.level[1].borderClass="clLevel1border"
oCMenu.level[1].borderX=1 
oCMenu.level[1].borderY=1
oCMenu.level[1].rows=0
oCMenu.level[1].align="right" 


//EXAMPLE SUB level[2] PROPERTIES - You have to spesify the properties you want different from 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].height=30
oCMenu.level[2].regClass="clLevel1"
oCMenu.level[2].overClass="clLevel1over"
oCMenu.level[2].offsetX=-10
oCMenu.level[2].offsetY=1
oCMenu.level[2].borderClass="clLevel1border"
oCMenu.level[2].borderX=1 
oCMenu.level[2].borderY=1
oCMenu.level[2].align="right" 


oCMenu.level[3]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[3].height=30
oCMenu.level[3].regClass="clLevel1"
oCMenu.level[3].overClass="clLevel1over"
oCMenu.level[3].offsetX=-10
oCMenu.level[3].offsetY=1
oCMenu.level[3].borderClass="clLevel1border"
oCMenu.level[3].borderX=1 
oCMenu.level[3].borderY=1
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;首页','home/gb/main.aspx','',45)
	
oCMenu.makeMenu('top1','','&nbsp;研究及推介','research/gb/index.aspx?body=MarketCommentary','',80)
	oCMenu.makeMenu('sub10','top1','名家评论','research/gb/index.aspx?body=commentOfColumnist','',85)
	oCMenu.makeMenu('sub11','top1','今日港股','research/gb/index.aspx?body=MarketCommentary','',85)
	//oCMenu.makeMenu('sub13','top1','研究部推介','research/gb/index.aspx?body=InvestmentIdeas','',85)
	oCMenu.makeMenu('sub14','top1','个股评论','research/gb/index.aspx?body=CompanyAnalysis','',85)
	oCMenu.makeMenu('sub15','top1','研究报告','research/gb/index.aspx?body=ResearchReport','',85)
	        oCMenu.makeMenu('sub150','sub15','上市公司','research/gb/index.aspx?body=ResearchReport&type=Listed','',100)
	        oCMenu.makeMenu('sub151','sub15','新股介绍','research/gb/index.aspx?body=ResearchReport&type=IPO','',100)
	        oCMenu.makeMenu('sub152','sub15','特别报告','research/gb/index.aspx?body=ResearchReport&type=Special','',100)	
	oCMenu.makeMenu('sub16','top1','市场资讯','research/gb/index.aspx?body=DailyCommentary','',85)
	        oCMenu.makeMenu('sub160','sub16','港股美国预托证券及伦敦收市价','research/gb/index.aspx?body=DailyCommentary&type=ADRLSE','',200)
	        oCMenu.makeMenu('sub161','sub16','A – H 股股价对比','research/gb/index.aspx?body=DailyCommentary&type=AHComp','',200)
	        oCMenu.makeMenu('sub162','sub16','能源商品期货价格','research/gb/index.aspx?body=DailyCommentary&type=Commodities','',200)	
	//        oCMenu.makeMenu('sub163','sub16','美国国库债券','research/gb/index.aspx?body=DailyCommentary&type=USTreBonds','',200)
	        oCMenu.makeMenu('sub164','sub16','每日指数','research/gb/index.aspx?body=DailyCommentary&type=DailyIndex','',200)
	//        oCMenu.makeMenu('sub165','sub16','股票抛空纪录','research/gb/index.aspx?body=DailyCommentary&type=ShortSelling','',200)	
	//        oCMenu.makeMenu('sub166','sub16','昨日公布之公司业绩','research/gb/index.aspx?body=DailyCommentary&type=Result','',200)
	//        oCMenu.makeMenu('sub167','sub16','本周公布之美国经济数据','research/gb/index.aspx?body=DailyCommentary&type=USEcoInd','',200)
	//oCMenu.makeMenu('sub12','top1','美股一周','research/gb/index.aspx?body=USWeekly','',85)
	oCMenu.makeMenu('sub17','top1','新股追踪','research/gb/index.aspx?body=IPO','',85)
	        oCMenu.makeMenu('sub170','sub17','现正接受认购申请的新股','research/gb/index.aspx?body=IPO&type=Current','',160)
	        //oCMenu.makeMenu('sub171','sub17','拟上市公司','research/gb/index.aspx?body=IPO&type=Upcoming','',160)
	        oCMenu.makeMenu('sub172','sub17','已公开认购之新股','research/gb/index.aspx?body=IPO&type=Listed','',160)	
	
oCMenu.makeMenu('top2','','&nbsp;投资媒体','','',75)
	oCMenu.makeMenu('sub21','top2','简介','InvestmentMedia/gb/index.aspx?body=Introduction','',110)
	oCMenu.makeMenu('sub27','top2','3G流动通讯网络','InvestmentMedia/gb/index.aspx?body=3G','',110)
	oCMenu.makeMenu('sub22','top2','互联网','InvestmentMedia/gb/index.aspx?body=Internet','',110)
	oCMenu.makeMenu('sub23','top2','流动简短讯息','InvestmentMedia/gb/index.aspx?body=Mobile','',110)
	oCMenu.makeMenu('sub24','top2','无线上网电话','InvestmentMedia/gb/index.aspx?body=WAP','',110)
	oCMenu.makeMenu('sub25','top2','个人数码助理','InvestmentMedia/gb/index.aspx?body=PDA','',110)
	oCMenu.makeMenu('sub26','top2','音频电话','InvestmentMedia/gb/index.aspx?body=IVRS','',110)


oCMenu.makeMenu('top3','','&nbsp;服务及支援','','',95)
//	oCMenu.makeMenu('sub30','top3','电邮','http://webmail.cashon-line.com','',105)
	oCMenu.makeMenu('sub31','top3','下载表格','ServiceSupport/gb/index.aspx?body=downloadcenter','',105)
	oCMenu.makeMenu('sub32','top3','常用联系','ServiceSupport/gb/index.aspx?body=usefullink','',105)
//	oCMenu.makeMenu('sub33','top3','CASH Visa Card','','',134)
	oCMenu.makeMenu('sub34','top3','时富金分','https://www.cashonline.com.hk/CashPoints/gb/index.aspx?body=Redemption&type=Monthly','',105)
	//oCMenu.makeMenu('sub35','top3','常见问题','ServiceSupport/gb/index.aspx?body=faq','',105)
    //19 Feb 2009 - new FAQ Format
    oCMenu.makeMenu('sub35','top3','常见问题','','',105)
	        oCMenu.makeMenu('sub350','sub35','证券交易','','',115)
                    oCMenu.makeMenu('sub3500','sub350','香港现金','securities/gb/index.aspx?headTitle=HKCash&body=FAQ','',85)
                    oCMenu.makeMenu('sub3501','sub350','香港孖展','securities/gb/index.aspx?headTitle=HKMargin&body=FAQ','',85)
                    oCMenu.makeMenu('sub3502','sub350','美国股票','securities/gb/index.aspx?headTitle=USStocks&body=FAQ','',85)
                    oCMenu.makeMenu('sub3503','sub350','中国B股','securities/gb/index.aspx?headTitle=ChinaBShares&body=FAQ','',85)
	        oCMenu.makeMenu('sub351','sub35','外汇交易','forex/gb/index.aspx?body=FAQ','',115)
	        oCMenu.makeMenu('sub352','sub35','期货及期权交易','commodities/gb/index.aspx?headTitle=&body=FAQ','',115)
	

oCMenu.makeMenu('top4','','&nbsp;关于我们','','',80)
	oCMenu.makeMenu('sub40','top4','荣获奖项','','',80,'','','','','','','','','javascript:popUp("../../home/gb/AboutUs/awards/awards.aspx","Awards",780,650);')
	oCMenu.makeMenu('sub41','top4','联络我们','','',80,'','','','','','','','','javascript:popUp("../../home/gb/AboutUs/ContactUs/contactUs.aspx","ContactUs",780,650);')



oCMenu.makeMenu('top5','','&nbsp;就业机会','http://www.cash.com.hk/gb/chi_careers.htm','_blank',80)	


	
oCMenu.makeMenu('top6','','&nbsp;网页索引','SiteMap/gb/index.aspx','',80)

//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])

  //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()"
