var gYpos=1
var rePlace=0

/*** 
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

oCMenu.frames = 0

//Menu properties   
oCMenu.pxBetween=0
oCMenu.fromLeft=0
oCMenu.fromTop=0   
oCMenu.rows=1
oCMenu.menuPlacement="left"
                                                             
oCMenu.offlineRoot="/" 
oCMenu.onlineRoot="/" 
oCMenu.resizeCheck=1
oCMenu.wait=1000 
oCMenu.fillImg="images/cm_fill.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=0
oCMenu.barWidth="100%"
oCMenu.barHeight="menu" 
oCMenu.barClass="clBar"
oCMenu.barX=0 
oCMenu.barY=0
oCMenu.barBorderX=0
oCMenu.barBorderY=0
oCMenu.barBorderClass=""

//Level 0 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=120
oCMenu.level[0].height=24
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="bottom"

//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].width=188
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].align="right" 
oCMenu.level[1].offsetX=-(oCMenu.level[0].width-2)/2+20
oCMenu.level[1].offsetY=0
oCMenu.level[1].borderClass="clLevel1border"
oCMenu.level[1].arrow="images/menuarrow.gif"
oCMenu.level[1].arrowWidth=10
oCMenu.level[1].arrowHeight=10


//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[1].width=oCMenu.level[0].width-2
oCMenu.level[2].width=175
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].align="right" 
oCMenu.level[2].offsetX=-(oCMenu.level[0].width-2)/2+20
oCMenu.level[2].offsetY=0
oCMenu.level[2].borderClass="clLevel1border"
oCMenu.level[2].arrow="images/menuarrow.gif"
oCMenu.level[2].arrowWidth=10
oCMenu.level[2].arrowHeight=10

oCMenu.level[3]=new cm_makeLevel()
oCMenu.level[3].width=150

/******************************************
Menu item creation:
myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout) 
*************************************/

//Ticket To Heaven
oCMenu.makeMenu('top0','','Ticket To Heaven','','','113','24','images/ticket_off1.gif','images/ticket_on1.gif','','','','','','')
	oCMenu.makeMenu('0sub00','top0','Believing In God','reader.aspx?sect=1&article=ticket_believing.inc','','','','','','','','','','','','window.status=\'Believing In God\';','window.status=\'\';')
	oCMenu.makeMenu('0sub01','top0','Discerning God\'s Will','reader.aspx?sect=1&article=ticket_topical_discerning.inc','','','','','','','','','','','','window.status=\'Discerning Gods Will\';','window.status=\'\';')
	oCMenu.makeMenu('0sub01b','top0','The Bible','reader.aspx?sect=1&article=ticket_bible.inc','','','','','','','','','','','','window.status=\'The Bible\';','window.status=\'\';')
	oCMenu.makeMenu('0sub02','top0','Prayer','','','','','','','','','','','','','window.status=\'Prayer\';','window.status=\'\';')
		oCMenu.makeMenu('sub0201','0sub02','An Introduction','reader.aspx?sect=1&article=ticket_topical_prayer1.inc','','','','','','','','','','','','window.status=\'Prayer - An Introduction\';','window.status=\'\';')
		oCMenu.makeMenu('sub0202','0sub02','Practical Tips','reader.aspx?sect=1&article=ticket_topical_prayer2.inc','','','','','','','','','','','','window.status=\'Prayer - Practical Tips\';','window.status=\'\';')
	oCMenu.makeMenu('0sub03','top0','Priorities Of The Church','reader.aspx?sect=1&article=ticket_topical_priorities.inc','','','','','','','','','','','','window.status=\'Priorities Of The Church\';','window.status=\'\';')
	oCMenu.makeMenu('0sub04','top0','Christianity','','','','','','','','','','','','','window.status=\'Christianity\';','window.status=\'\';')
		oCMenu.makeMenu('sub0401','0sub04','An Overview','reader.aspx?sect=1&article=ticket_christianity.inc','','','','','','','','','','','','window.status=\'An Overview\';','window.status=\'\';')
		oCMenu.makeMenu('sub0402','0sub04','The Gospel Of Jesus Christ','reader.aspx?sect=1&article=ticket_topical_gospel.inc','','','','','','','','','','','','window.status=\'The Gospel Of Jesus Christ\';','window.status=\'\';')
		oCMenu.makeMenu('sub0403','0sub04','Doing Good Things','reader.aspx?sect=1&article=ticket_goodthings.inc','','','','','','','','','','','','window.status=\'Doing Good Things\';','window.status=\'\';')
		oCMenu.makeMenu('sub0404','0sub04','Grace','reader.aspx?sect=1&article=ticket_topical_grace.inc','','','','','','','','','','','','window.status=\'Grace\';','window.status=\'\';')
		oCMenu.makeMenu('sub0405','0sub04','Obedience','reader.aspx?sect=1&article=ticket_topical_obedience.inc','','','','','','','','','','','','window.status=\'Obedience\';','window.status=\'\';')
		oCMenu.makeMenu('sub0406','0sub04','Do I Have To Be Religious?','reader.aspx?sect=1&article=ticket_religious.inc','','','','','','','','','','','','window.status=\'Do I Have To Be Religious?\';','window.status=\'\';')
		oCMenu.makeMenu('sub0407','0sub04','Not Convinced Yet?','reader.aspx?sect=1&article=ticket_convinced.inc','','','','','','','','','','','','window.status=\'Not Convinced Yet?\';','window.status=\'\';')
	oCMenu.makeMenu('0sub05','top0','Making A Committment','','','','','','','','','','','','','window.status=\'Make A Committment\';','window.status=\'\';')
		oCMenu.makeMenu('sub0501','0sub05','Humility And Repentance','reader.aspx?sect=1&article=ticket_topical_humility.inc','','','','','','','','','','','','window.status=\'Humility And Repentence\';','window.status=\'\';')
		oCMenu.makeMenu('sub0502','0sub05','Get Saved','reader.aspx?sect=1&article=ticket_getsaved.inc','','','','','','','','','','','','window.status=\'Get Saved\';','window.status=\'\';')
		oCMenu.makeMenu('sub0503','0sub05','Trust In God','reader.aspx?sect=1&article=ticket_topical_trustgod.inc','','','','','','','','','','','','window.status=\'Trust God\';','window.status=\'\';')
	oCMenu.makeMenu('0sub07','top0','Spiritual Gifts','','','','','','','','','','','','','window.status=\'Spiritual Gifts\';','window.status=\'\';')
		oCMenu.makeMenu('sub0701','0sub07','Living Sacrifices','reader.aspx?sect=1&article=gifts1.inc','','','','','','','','','','','','window.status=\'Part I - Living Sacrifices\';','window.status=\'\';')
		oCMenu.makeMenu('sub0702','0sub07','Humble Service','reader.aspx?sect=1&article=gifts2.inc','','','','','','','','','','','','window.status=\'Part II - Humble Christian Service\';','window.status=\'\';')
		oCMenu.makeMenu('sub0703','0sub07','A Basic Understanding','reader.aspx?sect=1&article=gifts3.inc','','','','','','','','','','','','window.status=\'Part III - Digging Deeper\';','window.status=\'\';')
		oCMenu.makeMenu('sub0704','0sub07','The Whirlwind Tour','reader.aspx?sect=1&article=gifts4.inc','','','','','','','','','','','','window.status=\'Part IV - ...and Deeper\';','window.status=\'\';')
		oCMenu.makeMenu('sub0705','0sub07','Healing, Miracles, And Tongues','reader.aspx?sect=1&article=gifts5.inc','','','','','','','','','','','','window.status=\'Part V - ...and Deeper\';','window.status=\'\';')
	oCMenu.makeMenu('0sub08','top0','Always A Debate','','','','','','','','','','','','','window.status=\'Always A Debate\';','window.status=\'\';')
		oCMenu.makeMenu('sub0801','0sub08','Creation Vs. Evolution','','','','','','','','','','','','','window.status=\'Creation Vs. Evolution\';','window.status=\'\';')
			oCMenu.makeMenu('sub080101','sub0801','Overview','reader.aspx?sect=1&article=ticket_topical_creation1.inc','','','','','','','','','','','','window.status=\'Overview\';','window.status=\'\';')
			oCMenu.makeMenu('sub080102','sub0801','Background On Genesis','reader.aspx?sect=1&article=ticket_topical_creation2.inc','','','','','','','','','','','','window.status=\'Background On Genesis\';','window.status=\'\';')
			oCMenu.makeMenu('sub080103','sub0801','Day 1','reader.aspx?sect=1&article=ticket_topical_creation3.inc','','','','','','','','','','','','window.status=\'Day 1\';','window.status=\'\';')
			oCMenu.makeMenu('sub080104','sub0801','Days 2, 3, and 4','reader.aspx?sect=1&article=ticket_topical_creation4.inc','','','','','','','','','','','','window.status=\'Days 2, 3, and 4\';','window.status=\'\';')
			oCMenu.makeMenu('sub080105','sub0801','Days 5 and 6','reader.aspx?sect=1&article=ticket_topical_creation5.inc','','','','','','','','','','','','window.status=\'Days 5 and 6\';','window.status=\'\';')
			oCMenu.makeMenu('sub080106','sub0801','Day 7: Complete','reader.aspx?sect=1&article=ticket_topical_creation6.inc','','','','','','','','','','','','window.status=\'Day 7: Complete\';','window.status=\'\';')
		oCMenu.makeMenu('sub0802','0sub08','Does God Exist?','reader.aspx?sect=1&article=ticket_topical_godexists.inc','','','','','','','','','','','','window.status=\'Does God Exist?\';','window.status=\'\';')
		oCMenu.makeMenu('sub0803','0sub08','Does Satan Exist?','reader.aspx?sect=1&article=ticket_topical_satan.inc','','','','','','','','','','','','window.status=\'Does Satan Exist?\';','window.status=\'\';')
		oCMenu.makeMenu('sub0804','0sub08','How To Get To Heaven','reader.aspx?sect=1&article=ticket_topical_gettoheaven.inc','','','','','','','','','','','','window.status=\'How To Get To Heaven\';','window.status=\'\';')
		oCMenu.makeMenu('sub0805','0sub08','The Resurrection','reader.aspx?sect=1&article=ticket_topical_resurrection.inc','','','','','','','','','','','','window.status=\'The Resurrection\';','window.status=\'\';')
		oCMenu.makeMenu('sub0806','0sub08','The Trinity','reader.aspx?sect=1&article=ticket_topical_trinity.inc','','','','','','','','','','','','window.status=\'The Trinity\';','window.status=\'\';')
		oCMenu.makeMenu('sub0807','0sub08','Baptism','reader.aspx?sect=1&article=ticket_topical_baptism.inc','','','','','','','','','','','','window.status=\'Baptism\';','window.status=\'\';')
	oCMenu.makeMenu('0sub09','top0','False Teachings','reader.aspx?sect=1&article=ticket_topical_falseteaching.inc','','','','','','','','','','','','window.status=\'False Teachings\';','window.status=\'\';')	
	oCMenu.makeMenu('0sub10','top0','Other Religions','','','','','','','','','','','','','window.status=\'Other Religions\';','window.status=\'\';')
		oCMenu.makeMenu('sub1001','0sub10','Judaism','reader.aspx?sect=1&article=ticket_judaism.inc','','','','','','','','','','','','window.status=\'Judaism\';','window.status=\'\';')
		oCMenu.makeMenu('sub1002','0sub10','Islam','reader.aspx?sect=1&article=ticket_islam.inc','','','','','','','','','','','','window.status=\'Islam\';','window.status=\'\';')
		oCMenu.makeMenu('sub1003','0sub10','Buddhism','reader.aspx?sect=1&article=ticket_buddhism.inc','','','','','','','','','','','','window.status=\'Buddhism\';','window.status=\'\';')
		oCMenu.makeMenu('sub1004','0sub10','Hinduism','reader.aspx?sect=1&article=ticket_hinduism.inc','','','','','','','','','','','','window.status=\'Hinduism\';','window.status=\'\';')
		oCMenu.makeMenu('sub1005','0sub10','Scientology','reader.aspx?sect=1&article=ticket_scientology.inc','','','','','','','','','','','','window.status=\'Scientology\';','window.status=\'\';')
		oCMenu.makeMenu('sub1006','0sub10','Humanism','reader.aspx?sect=1&article=ticket_humanism.inc','','','','','','','','','','','','window.status=\'Humanism\';','window.status=\'\';')
		oCMenu.makeMenu('sub1007','0sub10','Momonism','reader.aspx?sect=1&article=ticket_mormonism.inc','','','','','','','','','','','','window.status=\'Mormonism\';','window.status=\'\';')
		oCMenu.makeMenu('sub1008','0sub10','Jehovah\'s Witnesses','reader.aspx?sect=1&article=ticket_jehovahswitnesses.inc','','','','','','','','','','','','window.status=\'Jehovahs Witnesses\';','window.status=\'\';')
		oCMenu.makeMenu('sub1009','0sub10','Christian Science','reader.aspx?sect=1&article=ticket_christianscience.inc','','','','','','','','','','','','window.status=\'Christian Science\';','window.status=\'\';')
	oCMenu.makeMenu('0sub11','top0','Government And Politics','','','','','','','','','','','','','window.status=\'Government And Politics\';','window.status=\'\';')
		oCMenu.makeMenu('sub1101','0sub11','America Under Attack','reader.aspx?sect=1&article=ticket_attack.inc','','','','','','','','','','','','window.status=\'America Under Attack\';','window.status=\'\';')
		oCMenu.makeMenu('sub1102','0sub11','A Christian Citizen - Part 1','reader.aspx?sect=1&article=ticket_topical_government1.inc','','','','','','','','','','','','window.status=\'A Christian Citizen - Part 1\';','window.status=\'\';')
		oCMenu.makeMenu('sub1103','0sub11','A Christian Citizen - Part 2','reader.aspx?sect=1&article=ticket_topical_government2.inc','','','','','','','','','','','','window.status=\'A Christian Citizen - Part 2\';','window.status=\'\';')
	oCMenu.makeMenu('0sub12','top0','Christmas','','','','','','','','','','','','','window.status=\'Christmas\';','window.status=\'\';')
		oCMenu.makeMenu('sub1201','0sub12','The Virgin Birth','reader.aspx?sect=1&article=ticket_topical_christmas1.inc','','','','','','','','','','','','window.status=\'The Virgin Birth\';','window.status=\'\';')
		oCMenu.makeMenu('sub1202','0sub12','The Birth of Jesus','reader.aspx?sect=1&article=ticket_topical_christmas2.inc','','','','','','','','','','','','window.status=\'The Birth Of Jesus\';','window.status=\'\';')
		oCMenu.makeMenu('sub1203','0sub12','The Wise Men','reader.aspx?sect=1&article=ticket_topical_christmas3.inc','','','','','','','','','','','','window.status=\'The Wise Men\';','window.status=\'\';')

oCMenu.makeMenu('top1','','About KRCC','','','69','24','images/about_off1.gif','images/about_on1.gif','','','','','','')
	oCMenu.makeMenu('1sub00','top1','Who We Are','who.aspx','','','','','','','','','','','','window.status=\'Who We Are\';','window.status=\'\';')
	oCMenu.makeMenu('1sub01','top1','Our Worship Services','worship.aspx','','','','','','','','','','','','window.status=\'Our Worship Services\';','window.status=\'\';')
	oCMenu.makeMenu('1sub02','top1','Adult Small Groups & Bible Studies','adultgroups.aspx','','','','','','','','','','','','window.status=\'Adult Small Groups & Bible Studies\';','window.status=\'\';')
	oCMenu.makeMenu('1sub03','top1','Adult & Youth Sunday School','sundayschool.aspx','','','','','','','','','','','','window.status=\'Adult & Youth Sunday School\';','window.status=\'\';')
	oCMenu.makeMenu('1sub04','top1','Children & Youth Small Groups','youthgroups.aspx','','','','','','','','','','','','window.status=\'Children & Youth Small Groups\';','window.status=\'\';')
	oCMenu.makeMenu('1sub05','top1','Our Ministries','ministries.aspx','','','','','','','','','','','','window.status=\'Our Ministries\';','window.status=\'\';')
	oCMenu.makeMenu('1sub06','top1','Meet Our Staff','staff.aspx','','','','','','','','','','','','window.status=\'Meet Our Staff\';','window.status=\'\';')
	oCMenu.makeMenu('1sub07','top1','Our History','history.aspx','','','','','','','','','','','','window.status=\'Our History\';','window.status=\'\';')
	oCMenu.makeMenu('1sub08','top1','Map & Directions','directions.aspx','','','','','','','','','','','','window.status=\'Map & Directions\';','window.status=\'\';')
	oCMenu.makeMenu('1sub09','top1','Contact Us','contact.aspx','','','','','','','','','','','','window.status=\'Contact Us\';','window.status=\'\';')
	
oCMenu.makeMenu('top2','','News & Events','newspaper.aspx','','98','24','images/news_off1.gif','images/news_on1.gif','','','','','','')

oCMenu.makeMenu('top3','','Sermon Videos','sermons.aspx','','98','24','images/sermons_off1.gif','images/sermons_on1.gif','','','','','','')

oCMenu.makeMenu('top4','','Other Useful Things','','','128','24','images/other_off1.gif','images/other_on1.gif','','','','','','')
	oCMenu.makeMenu('4sub00','top4','Scriptures In Times Of Need','scriptures.aspx','','','','','','','','','','','','window.status=\'Scriptures In Times Of Need\';','window.status=\'\';')
	oCMenu.makeMenu('4sub01','top4','Spiritual Gifts Inventory','sg1.aspx','','','','','','','','','','','','window.status=\'Spiritual Gifts Inventory\';','window.status=\'\';')
	oCMenu.makeMenu('4sub02','top4','Tell Your Friends!','friends.aspx','','','','','','','','','','','','window.status=\'Tell Your Friends\';','window.status=\'\';')
	oCMenu.makeMenu('4sub03','top4','Internet Sites','links.aspx','','','','','','','','','','','','window.status=\'Internet Sites\';','window.status=\'\';')
	oCMenu.makeMenu('4sub04','top4','Our Building','building.aspx','','','','','','','','','','','','window.status=\'Our Building\';','window.status=\'\';')
	oCMenu.makeMenu('4sub05','top4','Website Requirements','sysreqs.aspx','','','','','','','','','','','','window.status=\'Website Requirements\';','window.status=\'\';')
	oCMenu.makeMenu('4sub07','top4','Recommended Books','books.aspx','','','','','','','','','','','','window.status=\'Recommended Books\';','window.status=\'\';')

oCMenu.makeMenu('top5','','Member Login','atrium/default.aspx','','96','24','images/login_off1.gif','images/login_on1.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
  }
	if(bw.mac&&bw.ie){x+=9}
	else {x-=1;}
  //Returning the x and y as an array
  return [x+1,y]
}
function placeElements(){
	var replace=0;
	//Changing the position of ALL top items:
	pos = findPos(0)

	if(gYpos==1) gYpos=pos[1]

	oCMenu.m["top0"].b.moveIt(pos[0],gYpos)

	//this handles the second menu item
	pos = findPos(1)
	oCMenu.m["top1"].b.moveIt(pos[0],gYpos)

	//this handles the third menu item
	pos = findPos(2)
	oCMenu.m["top2"].b.moveIt(pos[0],gYpos)

	//this handles the fourth menu item
	pos = findPos(3)
	oCMenu.m["top3"].b.moveIt(pos[0],gYpos)
	
	//this handles the fifth menu item
	pos = findPos(4)
	oCMenu.m["top4"].b.moveIt(pos[0],gYpos)

	//this handles the sixth menu item
	pos = findPos(5)
	oCMenu.m["top5"].b.moveIt(pos[0],gYpos)

	//Setting the fromtop value
  oCMenu.fromTop = pos[1]	
	rePlace=setTimeout("placeElements()",2000)
}
placeElements()

//Setting it to re place the elements after resize - the resize is not perfect though..
oCMenu.onafterresize="placeElements()"
