
  level1=new Array()
  level2=new Array()
  level3=new Array()
  var levelCount1=0
  var levelCount2=0
  var levelCount3=0
  var levelColorTab1=""
  var levelColorTab2=""
  var levelColorTab3=""
  var lastimgarro1=""
   var lastimgarro2=""
    var lastimgarro3=""
	var levelbefore=""
  var menuStr=""
  var tableCount=1
  var currentLevel=0
  var openMenuName=-1;
  var divStr=""
  var ischange=0
  function openCloseMenu(level,number,indicator){
    currentLevel=level; 
   if (level==1) name="subDril"
   if (level==2) name="subSubDril"
   if (level==3) name="subSubSubDril"
   for (i=level+1;i<=3;i++){
      for (j=0;j<eval("level"+i+".length");j++){
	      MM_showHideLayers(eval("level"+i+"["+j+"]"),'','hide')
	  }
   }
   tmp=name+number
   if (indicator!=-1){
     MM_showHideLayers(tmp,'','show')
	 if ((obj=MM_findObj(tmp))!=null) {
	    if ((window.screen.availWidth-document.all(tmp).offsetLeft)<document.all(tmp).offsetWidth) {
		    num=0;
		    for (j=0;j<eval("level"+level+".length");j++){
		     if ((obj=MM_findObj(eval("level"+level+"["+j+"]")))!=null){
			     if (obj.style.visibility=="visible") {
			     num=num+1
				 tmp2=obj
			   }
			 }
			 }
			 if (num==1){
			   
			    document.all(tmp).style.left=tmp2.offsetLeft-document.all(tmp).offsetWidth
			   }
		}
	 }
  }
  }
  
  
 function swapBg(tabl,level,labelnum,isroot){
  
    if (levelbefore>level){
	   eval("levelColorTab"+levelbefore+".bgColor='#E2E2E2'")
	   eval("levelColorTab"+levelbefore+".labelobject.style.color='#000000'")
	   eval("if (lastimgarro"+levelbefore+"!=''){document[lastimgarro"+levelbefore+"].src='images/arrow_r.gif';lastimgarro"+levelbefore+"='';}")
	
	}
     if (level==1) {
     if (levelColorTab1!="") {
	      levelColorTab1.bgColor="#E2E2E2"
		  levelColorTab1.labelobject.style.color="#000000"
		  }
	 levelColorTab1=tabl
	 levelColorTab1.bgColor="#2E0104"
	 a=document.all.tags('a')
     a(labelnum-1).style.color="#FFFFFF"
	 levelColorTab1.labelobject=a(labelnum-1)
	 ischange=1
	 if (levelColorTab2!="") levelColorTab2.bgColor="#E2E2E2"
	 if (levelColorTab3!="") levelColorTab3.bgColor="#E2E2E2"
	 if (lastimgarro1!="")
	   {
	    document[lastimgarro1].src="images/arrow_r.gif"
		lastimgarro1=""
	   }	
	 if (isroot==1)
	   {
	 	tmp="arrow"+labelnum
	    document[tmp].src="images/arrow.gif"
		lastimgarro1=tmp
		
	} 
	 }
     if (level==2)  {
	 if (levelColorTab2!=""){
	    levelColorTab2.bgColor="#E2E2E2"
		levelColorTab2.labelobject.style.color="#000000"
		}
	 levelColorTab2=tabl
	 levelColorTab2.bgColor="#2E0104"
	 a=document.all.tags('a')
     a(labelnum-1).style.color="#FFFFFF"
	 levelColorTab2.labelobject=a(labelnum-1)
     ischange=1
	 if (levelColorTab3!="") levelColorTab3.bgColor="#E2E2E2"
	 if (lastimgarro2!="")
	   {
	    document[lastimgarro2].src="images/arrow_r.gif"
		lastimgarro2=""
	   }	
	 if (isroot==1)
	   {
	 	tmp="arrow"+labelnum
	    document[tmp].src="images/arrow.gif"
		lastimgarro2=tmp
		
	} 
	 }
      if (level==3)  {
	   if (levelColorTab3!="") {
	    levelColorTab3.bgColor="#E2E2E2"
		levelColorTab3.labelobject.style.color="#000000"
		}
	 levelColorTab3=tabl
	 levelColorTab3.bgColor="#2E0104"
	 a=document.all.tags('a')
     a(labelnum-1).style.color="#FFFFFF"
	 levelColorTab3.labelobject=a(labelnum-1)
	
    ischange=1
	if (lastimgarro3!="")
	   {
	    document[lastimgarro3].src="images/arrow_r.gif"
		lastimgarro3=""
	   }	
	 if (isroot==1)
	   {
	 	tmp="arrow"+labelnum
	    document[tmp].src="images/arrow.gif"
		lastimgarro3=tmp
		
	  } 
	 }
   levelbefore=level
   
 }
 
 
  
  function menu(name,count,left,top,width,color,position,headsCount){
    this.writeMenus = writeMenus;
	this.count=count;
	this.left=left;
	this.top=top;
	this.width=width;
	this.name=name;
	this.position=position; 
	this.MBgColor=color
	this.addItem=addItem
	this.headsCount=headsCount
	if (name=="Dril"){
	   level1[levelCount1]=name+count
	   levelCount1=levelCount1+1
	   }
	if (name=="subDril"){
	   level2[levelCount2]=name+count
	   levelCount2=levelCount2+1
	   }
	if (name=="subSubDril"){
	   level3[levelCount3]=name+count
	   levelCount3=levelCount3+1
	   }      
 }
 
 var count=0;
 

 function addItem(menu,itemStr,isRoot,level,num,url){
    var str="<tr bgcolor='#E2E2E2'><td height='16'>"
    if (isRoot=="root"){
	   str=str+"<table cellspacing='0' cellpadding='0' border='0' height='14' width='"+menu.width+"' id='table"+tableCount+"' onmouseover='openCloseMenu("+level+","+num+",1);swapBg(this,"+level+","+tableCount+",1)'><tr class='sub_menu'>"
	   str=str+"<td width='4'></td>"
	   str=str+"<td   ><a style='cursor:hand' class='sub_menu' id='lable"+tableCount+"'>"+itemStr+"</a></td><td width='14' align=right>"
	   str=str+"<img src='" + imgPath + "/arrow_r.gif' width='10' height='14' border='0' name='arrow"+tableCount+"'>"
	}else{
	  str=str+"<table style='cursor:hand' onclick=gotoUrl('"+url+"')  cellspacing='0' cellpadding='0' border='0' height='14' width='"+menu.width+"' id='table"+tableCount+"' onmouseover='openCloseMenu("+level+",-1,-1);swapBg(this,"+level+","+tableCount+",-1)'><tr class='sub_menu'>"
	  str=str+"<td width='4'></td>"
	  str=str+"<td   ><a href='"+url+"' id='lable"+tableCount+"' class='sub_menu'>"+itemStr+"</a></td><td width='14' >"
				
	 }
	tableCount=tableCount+1
	str=str+"</td></tr></table></td></tr>" 
	menuStr=menuStr+str
 }
 
   function createMenu(menu){
      aray=createMenu.arguments;
	  menu.writeMenus(menu,aray[1])
	  for (i=2;i<aray.length;i++){
	  if (aray[i]=="item"){
		   if (aray[i+2]=="root"){
		       menu.addItem(menu,aray[i+1],aray[i+2],aray[i+3],aray[i+4])
		       i=i+4
		   }else{
		       menu.addItem(menu,aray[i+1],aray[i+2],aray[1],-1,aray[i+3])
			   
		       i=i+3
		   }
		 }
		
	  }
	  divStr=divStr+menuStr
	  divStr=divStr+"</table></td></tr></table></div>";
      document.write (divStr)
	  menuStr=""
	  divStr=""
  }
  

  

  
  
 
  
  function writeMenus(menu,level){
    
	 divStr="<div align='CENTER' id='"+menu.name+menu.count+"' style='position:"+menu.position+";top:"+menu.top+"px; left:"+menu.left+"px;background-color: "+menu.MBgColor+";z-index:2;' >"
     divStr=divStr+"<table width='1%' border='0' cellspacing='0' cellpadding='1'>"
     divStr=divStr+"<tr valign='top' bgcolor='#000000'><td>"
     divStr=divStr+"<table width='100%' border='1' cellspacing='0' cellpadding='0'  bordercolor='#CCCCCC'>"
	 
	  }
 
  function gotoUrl(location){
    
    window.location=location
  }

