// Variables
var navTimer = 0;
var snavArr = new Array("snav_home","snav_bible_fellowships");
var hmImgCt = 8;

// Functions
function externalLinks() {
	var anchors=document.getElementsByTagName("a");
	for(var i=0;i<anchors.length;i++)
		if(anchors[i].getAttribute("href")&&anchors[i].getAttribute("rel")=="external")anchors[i].target="_blank";
}
function show(obj){document.getElementById(obj).style.display="block";}
function hide(obj){document.getElementById(obj).style.display="none";}
function setNavTimer(){
	navTimer = setTimeout("hideNav()",50);
}
function showNav(obj){
	clearTimeout(navTimer);
	for (var i=0; i<snavArr.length; i++) hide(snavArr[i]);
	show(obj);
}
function hideNav(){
	for (var i=0; i<snavArr.length; i++) {
		if (document.getElementById(snavArr[i]).className=="snav") hide(snavArr[i]);
		else show(snavArr[i]);
	}
}
function genemail(user,domain,suffix,text) {
	mailto=user+'@'+domain+'.'+suffix;
	text=(text)?text:mailto;
	document.write('<a href="mailto:'+mailto+'">'+text+'</a>');
}
function randimg() {
	document.write('<img src="images/photos/home'+Math.ceil(Math.random()*hmImgCt)+'.jpg" width="500" height="340" alt="Grace Community Church of Saddleback Valley" title="Grace Community Church of Saddleback Valley" class="block" />');
}
function screenHeight() {
  var height=600;
  if(typeof(window.innerHeight)=='number')height=window.innerHeight;
  else if(document.documentElement&&document.documentElement.clientHeight)height=document.documentElement.clientHeight;
  else if(document.body&&document.body.clientHeight)height=document.body.clientHeight;
  return height+1;
}
document.write('<style type="text/css">#top{min-height:'+screenHeight()+'px;}</style>');
window.onload = externalLinks;