
var activeMenu = null;
var activeSubMenu = null;
var onMenu = null;
var TimerID=null;

function showSubMenu(menuid, flag, e) {
	var obj=document.getElementById("sub_"+menuid);
	if (! obj) {
		/* Do nothing 
		alert("sub_"+menuid+" does not exist");
		*/
	} else {
		if (flag) {
			if (onMenu) {
				hideSubMenu();
			}
			activeMenu = menuid;
			onMenu = menuid;
			obj.style.position="absolute";
			obj.style.visibility="visible";
			var pos = YAHOO.util.Dom.getXY(menuid);
			pos[1] += YAHOO.util.Dom.get(menuid).offsetHeight;
			YAHOO.util.Dom.setXY(obj,pos);
		} else {
			activeMenu = null;
			TimerID = setTimeout('hideSubMenu()', 1500);
		}
	}
}

function onSubMenu(menuid, flag) {
	if (flag) {
		activeSubMenu = menuid;
	} else {
		activeSubMenu = null;
		TimerID = setTimeout('hideSubMenu()',300);
	}
}
function hideSubMenu() {
	if (!activeSubMenu && onMenu != null) {
		var obj=document.getElementById("sub_"+onMenu);
		obj.style.visibility="hidden";
		TimerID = null;
		onMenu = null;
	}
}

function myutmost() {
	var thisDate = new Date();
	var month=thisDate.getMonth()+1;
	var date=thisDate.getDate();
	if (month < 10) {
		month="0"+month;
	}
	if (date < 10) {
		date="0"+date;
	}
	open("http://www.myutmost.org/"+month+"/"+month+date+".html",
		"devotion","location=no,resizable=yes,width=600,height:600,scrollbars=yes,toolbar=no,top=50");
}

function showPhoto(photo_path) {
	var loc=document.getElementById("picture");
	var content=photo_path+"<br>Click the photo to see the original "+
	"size<a href=\"/gallery/"+photo_path+"\" target=\"_new\">"+
	"<img src=\"/gallery/phpThumb.php?src="+photo_path+"&w=540\" "+
	"border=0 class=\"reflect rheight40 ropacity40\"></a>";
	loc.innerHTML=content;
	addReflections();
}
function showPhoto2(photo_path) {
	var loc=document.getElementById("picture");
	var curr_img_path = photo_path.replace('displays', 'originals');
	var content=photo_path+"<br>Click the photo to see the original "+
	"size<a href=\""+curr_img_path+"\" target=\"_new\">"+
	"<img src="+photo_path+
	" border=0 class=\"reflect rheight40 ropacity40\"></a>";
	loc.innerHTML=content;
	addReflections();
}

/* upload bulletin file */
function upload() {
	var obj=document.getElementById("upload_form");
	obj.style.display="block";
	obj.style.visibility="visible";
	var f=document.form1;
	f.elements[1].focus();
}
