/*** 
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=300 ;
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="109";
oCMenu.level[0].height=28;
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=-1;
oCMenu.level[0].rows=0;
oCMenu.level[0].align="bottom";

oCMenu.level[1]=new cm_makeLevel(); //Add this for each new level
oCMenu.level[1].width="150";
oCMenu.level[1].height=22;
oCMenu.level[1].regClass="clLevel1";
oCMenu.level[1].overClass="clLevel1over";
oCMenu.level[1].borderX=1;
oCMenu.level[1].borderY=1;
oCMenu.level[1].borderClass="clLevel1border";
oCMenu.level[1].offsetX=-10;
oCMenu.level[1].offsetY=10;
oCMenu.level[1].rows=0;
oCMenu.level[1].arrow="images/arrow_right.gif";
oCMenu.level[1].arrowWidth=7;
oCMenu.level[1].arrowHeight=10;
oCMenu.level[1].align="right";

oCMenu.level[2]=new cm_makeLevel(); //Add this for each new level
oCMenu.level[2].width="150";
oCMenu.level[2].height=22;
oCMenu.level[2].regClass="clLevel1";
oCMenu.level[2].overClass="clLevel1over";
oCMenu.level[2].borderX=1;
oCMenu.level[2].borderY=1;
oCMenu.level[2].borderClass="clLevel2border";
oCMenu.level[2].offsetX=-1;
oCMenu.level[2].offsetY=-1;
oCMenu.level[2].rows=0;
oCMenu.level[2].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","","","physicians.htm","",111,30,"images/physicians.gif","images/physicians_on.gif");
  oCMenu.makeMenu("sub00","top0","Neurosurgeons","neurosurgeons.php","",150,22);
//  oCMenu.makeMenu("sub01","top0","Consultant Neurologist","consultantneurologists.htm","",150,22);
  oCMenu.makeMenu("sub02","top0","Physiatrists","physiatrists.htm","",150,22);
  oCMenu.makeMenu("sub03","top0","Non-Physician Practitioners","nonphysician.htm","",150,22);
		
oCMenu.makeMenu("top1","","","cp-main.htm","",111,30,"images/conditions.gif","images/conditions_on.gif");
  oCMenu.makeMenu("sub10","top1","Brain","cpbrain.htm","",150,22);
  oCMenu.makeMenu("sub11","top1","Spine","cpspine.htm","",150,22);
//  oCMenu.makeMenu("sub12","top1","Extremities","cpextremities.htm","",150,22);
  oCMenu.makeMenu("sub13","top1","Other","cpother.htm","",150,22);
	
oCMenu.makeMenu("top2","","","about.php","",111,30,"images/about.gif","images/about_on.gif");

oCMenu.makeMenu("top3","","","patientinfo.htm","",111,30,"images/patient.gif","images/patient_on.gif");
	oCMenu.makeMenu("sub30","top3","Appointments","","",150,22);
		oCMenu.makeMenu("lowsub00","sub30","How to be referred to LNSA","PI-appointments1.php","",180,22);
		oCMenu.makeMenu("lowsub01","sub30","Which physician will you see?","PI-appointments1.php","",180,22);
		oCMenu.makeMenu("lowsub02","sub30","Making your appointment","PI-appointments1.php","",180,22);
		oCMenu.makeMenu("lowsub03","sub30","Patient registration forms","patinfo-04.htm","",180,22);
		oCMenu.makeMenu("lowsub04","sub30","Second opinion","patinfo-05.htm","",180,22);
		oCMenu.makeMenu("lowsub05","sub30","If you need accomodations","patinfo-06.htm","",180,22);

	oCMenu.makeMenu("sub31","top3","Office information","","",150,22);
		oCMenu.makeMenu("lowsub10","sub31","Phone numbers","patinfo-07.htm","",110,22);
		oCMenu.makeMenu("lowsub11","sub31","Office hours","patinfo-08.htm","",110,22);
		oCMenu.makeMenu("lowsub12","sub31","Office visits","patinfo-09.htm","",110,22);

	oCMenu.makeMenu("sub32","top3","Details regarding treatment","","",150,22);
		oCMenu.makeMenu("lowsub20","sub32","Examination and testing","patinfo-10.htm","",170,22);
		oCMenu.makeMenu("lowsub21","sub32","Confidentiality","patinfo-11.htm","",170,22);
		oCMenu.makeMenu("lowsub22","sub32","Diagnosis","patinfo-12.htm","",170,22);
		oCMenu.makeMenu("lowsub23","sub32","Surgery","patinfo-13.htm","",170,22);
		oCMenu.makeMenu("lowsub24","sub32","Treatment alternatives","patinfo-14.htm","",170,22);

	oCMenu.makeMenu("sub33","top3","Prescription refill","patinfo-15.htm","",150,22);
	oCMenu.makeMenu("sub34","top3","Support groups","supportgroups.htm","",150,22);
	oCMenu.makeMenu("sub35","top3","Cost Information","","",150,22);
		oCMenu.makeMenu("lowsub50","sub35","Costs","patinfo-16.htm","",90,22);
		oCMenu.makeMenu("lowsub51","sub35","Insurance","patinfo-17.htm","",90,22);
		oCMenu.makeMenu("lowsub52","sub35","Billing","patinfo-18.htm","",90,22);
		
	oCMenu.makeMenu("sub36","top3","General Information","","",150,22);
		oCMenu.makeMenu("lowsub53","sub36","Confidentiality Compliance","patinfo-confidentiality.htm","",150,22);
		oCMenu.makeMenu("lowsub54","sub36","Medical Liability Insurance","patinfo-liabilityins.htm","",150,22);
	oCMenu.makeMenu("sub37","top3","Online Surveys","surveys.htm","",150,22);

oCMenu.makeMenu("top4","","","locationsMO.php","",111,30,"images/directions.gif","images/directions_on.gif");
	//oCMenu.makeMenu("sub40","top4","Main office","mainoffice.htm");
	//oCMenu.makeMenu("sub41","top4","Campus office","campusoffice.htm");
	//oCMenu.makeMenu("sub42","top4","Ephrata office","ephrataoffice.htm");
//	oCMenu.makeMenu("sub44","top4","",".htm");

oCMenu.makeMenu("top5","","","appointments.htm","",111,30,"images/faq.gif","images/faq_on.gif");
	oCMenu.makeMenu("sub50","top5","Appointments","appointments.htm");
	oCMenu.makeMenu("sub51","top5","Insurance","insurance.htm");
	oCMenu.makeMenu("sub52","top5","Locations/Directions","locations.htm");
	oCMenu.makeMenu("sub53","top5","Neurosurgery","neurosurgery.htm");
//	oCMenu.makeMenu("sub54","top5","Neurology","neurology.htm");
	oCMenu.makeMenu("sub55","top5","Physiatry","physiatry.htm");
	oCMenu.makeMenu("sub56","top5","Referrals","referrals.htm");
	oCMenu.makeMenu("sub57","top5","Support Groups","faqsupportgroups.htm");
	oCMenu.makeMenu("sub58","top5","Related Health Links","faqRelatedLinks.htm");
//	oCMenu.makeMenu("sub58","top5","Stroke","stroke.htm");
	
oCMenu.makeMenu("top6","","","news.php","",111,30,"images/news.gif","images/news_on.gif");

//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()"

