/***
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=""
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 specified in level 1
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width=166
oCMenu.level[0].height=24
oCMenu.level[0].regClass="clLevel1"
oCMenu.level[0].overClass="clLevel1over"
oCMenu.level[0].borderX=0
oCMenu.level[0].borderY=0
oCMenu.level[0].borderClass="clLevel1border"
oCMenu.level[0].offsetX=0
oCMenu.level[0].offsetY=-1
oCMenu.level[0].rows=0
oCMenu.level[0].arrow="images/arrow.gif"
oCMenu.level[0].arrowWidth=0
oCMenu.level[0].arrowHeight=0
oCMenu.level[0].align="right"
oCMenu.level[0].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.5)"


//Level properties - ALL properties have to be specified in level 2
oCMenu.level[1]=new cm_makeLevel() //Add this for each new level
oCMenu.level[1].width=175
oCMenu.level[1].height=24
oCMenu.level[1].regClass="clLevel2"
oCMenu.level[1].overClass="clLevel2over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].borderClass="clLevel2border"
oCMenu.level[1].offsetX=-1
oCMenu.level[1].offsetY=-1
oCMenu.level[1].rows=0
oCMenu.level[1].arrow="images/arrow.gif"
oCMenu.level[1].arrowWidth=15
oCMenu.level[1].arrowHeight=12
oCMenu.level[1].align="right"
oCMenu.level[1].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.5)"


//Level properties - ALL properties have to be specified in level 3
oCMenu.level[2]=new cm_makeLevel() //Add this for each new level
oCMenu.level[2].width=166
oCMenu.level[2].height=24
oCMenu.level[2].regClass="clLevel3"
oCMenu.level[2].overClass="clLevel3over"
oCMenu.level[2].borderX=1
oCMenu.level[2].borderY=1
oCMenu.level[2].borderClass="clLevel3border"
oCMenu.level[2].offsetX=-1
oCMenu.level[2].offsetY=-1
oCMenu.level[2].rows=0
oCMenu.level[2].arrow="images/arrow.gif"
oCMenu.level[2].arrowWidth=15
oCMenu.level[2].arrowHeight=12
oCMenu.level[2].align="right"
oCMenu.level[2].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.5)"


//Level properties - ALL properties have to be specified in level 4
oCMenu.level[3]=new cm_makeLevel() //Add this for each new level
oCMenu.level[3].width=166
oCMenu.level[3].height=24
oCMenu.level[3].regClass="clLevel4"
oCMenu.level[3].overClass="clLevel4over"
oCMenu.level[3].borderX=1
oCMenu.level[3].borderY=1
oCMenu.level[3].borderClass="clLevel4border"
oCMenu.level[3].offsetX=-1
oCMenu.level[3].offsetY=-1
oCMenu.level[3].rows=0
oCMenu.level[3].arrow="images/arrow.gif"
oCMenu.level[3].arrowWidth=15
oCMenu.level[3].arrowHeight=12
oCMenu.level[3].align="bottom"
oCMenu.level[3].filter="progid:DXImageTransform.Microsoft.Fade(duration=0.5)"



/******************************************
Menu item creation:
myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass, align, rows, nolink, onclick, onmouseover, onmouseout)
*************************************/


// Level1 (id=7) - Products and Services (no parent)
oCMenu.makeMenu('70','','Products and Services','http://www.pbiag.com/productsandservices.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=8) - Group Health (no parent)
oCMenu.makeMenu('80','','Group Health','http://www.pbiag.com/grouphealth.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=9) - Indivdual Health (no parent)
oCMenu.makeMenu('90','','Indivdual Health','http://www.pbiag.com/indivdualhealth.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
	// Level2 (id=20) - Family Physician Plan 4 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2009','90','Family Physician Plan 4','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-4&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=21) - Family Physician Plan 3 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2109','90','Family Physician Plan 3','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-3&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=22) - Family Physician Plan 10 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2209','90','Family Physician Plan 10','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-10&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=24) - Family Physician Plan 70 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2409','90','Family Physician Plan 70','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-70&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=25) - Family Physician Plan 71 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2509','90','Family Physician Plan 71','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-71&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=26) - Family Physician Plan 72 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2609','90','Family Physician Plan 72','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-72&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=27) - Family Physician Plan 73 (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('2709','90','Family Physician Plan 73','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bcbs-plan-73&x=6189441','_self','','25','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=39) - Physician Copayment Plans 3-5 Alachua (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('3909','90','Physician Copayment Plans 3-5 Alachua','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-alachua&x=6189441','_self','','35','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=40) - Physician Copayment Plans 3-5 Bay (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('4009','90','Physician Copayment Plans 3-5 Bay','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-plan-3-5-baker&x=6189441','_self','','35','','','clLevel2','clLevel2over','','','','','','')
		
	// Level2 (id=41) - Physician Copayment Plans 3-5 - Bay (parent of Level1 (id=9) - Indivdual Health)
	oCMenu.makeMenu('4109','90','Physician Copayment Plans 3-5 - Bay','http://www.pbiag.com/index.cfm?fuseaction=pages.individual-health-insurance-bay&x=6189441','_self','','35','','','clLevel2','clLevel2over','','','','','','')
		
// Level1 (id=10) - Medicare Supplements (no parent)
oCMenu.makeMenu('100','','Medicare Supplements','http://www.pbiag.com/medicaresupplements.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=11) - Dental (no parent)
oCMenu.makeMenu('110','','Dental','http://www.pbiag.com/dental.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=12) - Long Term Care (no parent)
oCMenu.makeMenu('120','','Long Term Care','http://www.pbiag.com/longtermcare.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=13) - Life Insurance (no parent)
oCMenu.makeMenu('130','','Life Insurance','http://www.pbiag.com/lifeinsurance.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=14) - Disability (no parent)
oCMenu.makeMenu('140','','Disability','http://www.pbiag.com/disability.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=15) - Our Partners (no parent)
oCMenu.makeMenu('150','','Our Partners','http://www.pbiag.com/ourpartners.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=16) - Glossary (no parent)
oCMenu.makeMenu('160','','Glossary','http://www.pbiag.com/glossary.htm','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	
// Level1 (id=44) - Free Insurance Quote (no parent)
oCMenu.makeMenu('440','','Free Insurance Quote','http://www.flainsurancequote.com','_self','','25','','','clLevel1','clLevel1over','','','','','','')
	

//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;
		if(bw.ns6) { 
		     x+=temp.offsetLeft; 
		} 
		else {
		     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(70)
	oCMenu.m["70"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(80)
	oCMenu.m["80"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(90)
	oCMenu.m["90"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(100)
	oCMenu.m["100"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(110)
	oCMenu.m["110"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(120)
	oCMenu.m["120"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(130)
	oCMenu.m["130"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(140)
	oCMenu.m["140"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(150)
	oCMenu.m["150"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(160)
	oCMenu.m["160"].b.moveIt(pos[0],pos[1])
	
	pos = findPos(440)
	oCMenu.m["440"].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()" 