var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
  
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
  
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }

function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function GetMonth(intMonth){
    var MonthArray = new Array("January", "February", "March",
                               "April", "May", "June",
                               "July", "August", "September",
                               "October", "November", "December") 
    return MonthArray[intMonth] 	  	 
    }
	
function getDateStr(){
    var today = new Date()
    var year = today.getYear()
    if(year<1000) year+=1900
    var todayStr = GetMonth(today.getMonth()) + " " + today.getDate()
    todayStr += ", " + year
    return todayStr
    }

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mmLoadMenus() {
  if (window.mm_menu_0419154032_0) return;
    window.mm_menu_0419154032_0 = new Menu("root",139,23,"Arial, Helvetica, sans-serif",11,"#333333","#FFFFFF","#E6E6E6","#999999","left","middle",6,0,0,-5,7,true,false,true,0,true,true);
  mm_menu_0419154032_0.addMenuItem("Message Archive","location='http://www.therock.org/messages/index.htm'");
  mm_menu_0419154032_0.addMenuItem("The Rock Podcast","location='http://www.therock.org/messages/podcast.htm'");
   mm_menu_0419154032_0.hideOnMouseOut=true;
   mm_menu_0419154032_0.bgColor='#555555';
   mm_menu_0419154032_0.menuBorder=1;
   mm_menu_0419154032_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0419154032_0.menuBorderBgColor='#666666';
window.mm_menu_0601142546_0 = new Menu("root",151,25,"Arial, Helvetica, sans-serif",11,"#333333","#FFFFFF","#E6E6E6","#999999","left","middle",6,0,0,-5,7,true,false,true,0,true,true);
  mm_menu_0601142546_0.addMenuItem("About&nbsp;the&nbsp;Church","location='http://www.therock.org/aboutus/index.htm'");
  mm_menu_0601142546_0.addMenuItem("What&nbsp;We&nbsp;Believe","location='http://www.therock.org/aboutus/whatwebelieve.htm'");
  mm_menu_0601142546_0.addMenuItem("How&nbsp;to&nbsp;Know&nbsp;God","location='http://www.therock.org/aboutus/knowgod.htm'");
  mm_menu_0601142546_0.addMenuItem("Service&nbsp;Information","location='http://www.therock.org/aboutus/serviceinfo.htm'");
  mm_menu_0601142546_0.addMenuItem("Our&nbsp;New&nbsp;Building","location='http://www.therock.org/aboutus/building.htm'");
   mm_menu_0601142546_0.hideOnMouseOut=true;
   mm_menu_0601142546_0.bgColor='#555555';
   mm_menu_0601142546_0.menuBorder=1;
   mm_menu_0601142546_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0601142546_0.menuBorderBgColor='#666666';

    window.mm_menu_0601143400_0 = new Menu("root",153,23,"Arial, Helvetica, sans-serif",11,"#333333","#FFFFFF","#E6E6E6","#999999","left","middle",6,0,0,-5,7,true,false,true,0,true,true);
  mm_menu_0601143400_0.addMenuItem("All&nbsp;Ministries","location='http://www.therock.org/ministries/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Children","location='http://www.therock.org/ministries/children/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Students","location='http://www.therock.org/ministries/students/index.htm'");
  mm_menu_0601143400_0.addMenuItem("20's&nbsp;and&nbsp;30's","window.open('http://www.coreoftherock.com/', '_blank');");
  mm_menu_0601143400_0.addMenuItem("Women","location='http://www.therock.org/ministries/women/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Men","location='http://www.therock.org/ministries/men/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Community&nbsp;Groups","location='http://www.therock.org/ministries/lifegroups/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Marriage","location='http://www.therock.org/ministries/marriage/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Missions","location='http://www.therock.org/ministries/missions/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Worship","location='http://www.therock.org/ministries/worship/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Support&nbsp;Groups","location='http://www.therock.org/ministries/pastoralcare/index.htm'");
  mm_menu_0601143400_0.addMenuItem("Prayer&nbsp;&&nbsp;Ministry","location='http://www.therock.org/ministries/prayer/index.htm'");
   mm_menu_0601143400_0.hideOnMouseOut=true;
   mm_menu_0601143400_0.bgColor='#555555';
   mm_menu_0601143400_0.menuBorder=1;
   mm_menu_0601143400_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0601143400_0.menuBorderBgColor='#666666';

mm_menu_0601143400_0.writeMenus();
} // mmLoadMenus()

function MM_showMenu(menu, x, y, child, imgname) {
	if (!window.mmWroteMenu) return;
	MM_clearTimeout();
	if (menu) {
		var obj = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];
		x = moveXbySlicePos (x, obj);
		y = moveYbySlicePos (y, obj);
	}
	if (document.layers) {
		if (menu) {
			var l = menu.menuLayer || menu;
			l.top = l.left = 1;
			hideActiveMenus();
			if (this.visibility) l = this;
			window.ActiveMenu = l;
		} else {
			var l = child;
		}
		if (!l) return;
		for (var i=0; i<l.layers.length; i++) { 			   
			if (!l.layers[i].isHilite) l.layers[i].visibility = "inherit";
			if (l.layers[i].document.layers.length > 0) MM_showMenu(null, "relative", "relative", l.layers[i]);
		}
		if (l.parentLayer) {
			if (x != "relative") l.parentLayer.left = x || window.pageX || 0;
			if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
			if (y != "relative") l.parentLayer.top = y || window.pageY || 0;
			if (l.parentLayer.isContainer) {
				l.Menu.xOffset = window.pageXOffset;
				l.Menu.yOffset = window.pageYOffset;
				l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
				l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
				if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
			}
		}
		l.visibility = "inherit";
		if (l.Menu) l.Menu.container.visibility = "inherit";
	} else if (FIND("menuItem0")) {
		var l = menu.menuLayer || menu;	
		hideActiveMenus();
		if (typeof(l) == "string") l = FIND(l);
		window.ActiveMenu = l;
		var s = l.style;
		s.visibility = "inherit";
		if (x != "relative") {
			s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
			s.left = s.pixelLeft + 'px';
		}
		if (y != "relative") {
			s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
			s.top = s.pixelTop + 'px';
		}
		l.Menu.xOffset = document.body.scrollLeft;
		l.Menu.yOffset = document.body.scrollTop;
	}
	if (menu) window.activeMenus[window.activeMenus.length] = l;
	MM_clearTimeout();
}
//-->


