/*******************************************************
FLASH DETECTION:

This script only detects playerVersion in widows and
not MajorRevision or MinorRevision.
*******************************************************/

// place in header
/*  <script language="javascript" src="flashDetection.js"></script>
	example code: if(flash.ver[7]){ }
*/

// This script will test up to the following version.
flash_versions = 10;

// Initialize variables and arrays
var flash = new Object();
flash.installed=false;
flash.version='0.0';

// Dig through Netscape-compatible plug-ins first.
if (navigator.plugins && navigator.plugins.length) {
	for (x=0; x < navigator.plugins.length; x++) {
		if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
			//alert(flash.version);
			flash.installed = true;
			break;
		}
	}
}

// Then, dig through ActiveX-style plug-ins afterwords
else if (window.ActiveXObject) {
	for (x = 2; x <= flash_versions; x++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = x + '.0';
			}
		}
		catch(e) {}
	}
	//alert(flash.version);
}

//use array to check for current versions
// example code: if(flash.ver[7]){ }
flash.ver = Array();
for(i = 4; i <= flash_versions; i++) {
	eval("flash.ver[" + i + "] = (flash.installed && parseInt(flash.version) >= " + i + ") ? true : false;");
}
//alert("Version >= 7 : " + flash.ver[7]);
function printLayout(flashVersion,flashLayout,htmlLayout){
	//also check for cookie
	if(useFlash() && flash.ver[flashVersion]){
		document.writeln(flashLayout);
	}else{
		document.writeln(htmlLayout);
	}
}
function reloadPage___(){
	// 'true' makes it reload from server
	window.location.reload(true);
}
//cookie Name
flashCookieCheck = "flashCookieCheck";
//example setUseFlash("true"); or setUseFlash("false");
function setUseFlash(value) {
	var name = flashCookieCheck;
	var expires = new Date();
	fixDate(expires);
	expires.setTime(expires.getTime() + 365 * 24 * 60 * 60 * 1000);
	var path = new String("/");
	var domain = new String("");
	var secure = new String("");
	var curCookie = name + "=" + escape(value) +
	  ((expires) ? "; expires=" + expires.toGMTString() : "") +
	  ((path.length>0) ? "; path=" + path : "") +
	  ((domain.length>0) ? "; domain=" + domain : "") +
	  ((secure.length>0) ? "; secure" : "");
	document.cookie = curCookie;
}
function initUseFlash(){
	//checks for existing cookie
	var cookieValue = "";
	var search = flashCookieCheck + "=";
	
	offset = document.cookie.indexOf(search);
	//DNE
	if (offset == -1){ 
		//sets cookie to true by default
		setUseFlash("true");
	}
}
initUseFlash();

function fixDate(date) {
 var base = new Date(0);
 var skew = base.getTime();
 if (skew > 0)
   date.setTime(date.getTime() - skew);
}

function useFlash(){
	// returns true or false based on cookie
	//if cookies disabled defaults to true
	var cookieValue = "";
	var search = flashCookieCheck + "=";
	if(document.cookie.length > 0){ 
		offset = document.cookie.indexOf(search);
		if (offset != -1){ 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}else { return true; }
	// if no cookies then return true - flash as default
	}else{ return true; }
	return eval(cookieValue);
}
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 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];}
}
// Return Flash Layout
function flashHeaderLayout(swfURL,bgColor,width,height,firstView,campusLocation,liveServiceInProgress,ministry,username,baseURL,currentURL,fvar_onLoad){
	flashHeaderProxyID = new Date().getTime();
	// FlashProxy is defined in JavaScriptFlashGateway.js
	flashHeaderProxy = new FlashProxy(flashHeaderProxyID, '/flash/fjsgateway/JavaScriptFlashGateway.swf');
	var flashID = 'flashHeader';
	var menu = 'false';
	var logoutURL = 'login/logout.cfm';
	var flashDoc = '';
	if(navigator.appName.indexOf ("Microsoft") != -1){ // ie browsers
		flashDoc += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" name="'+flashID+'" width="'+width+'" height="'+height+'" align="middle" id="'+flashID+'">';
		flashDoc += '<param name="allowScriptAccess" value="sameDomain" />';
		flashDoc += '<param name="movie" value="'+swfURL+'" />';
		flashDoc += '<param name="menu" value="'+menu+'" />';
		flashDoc += '<param name="quality" value="high" />';
		flashDoc += '<param name="bgcolor" value="#'+bgColor+'" />';
		flashDoc += '<param name="flashvars" value="lcId='+flashHeaderProxyID+'&firstview='+firstView+'&campusLocation='+campusLocation+'&liveServiceInProgress='+liveServiceInProgress+'&username='+username+'&ministry='+ministry+'&baseURL='+baseURL+'&currentURL='+currentURL+'&logoutURL='+logoutURL+'&fvar_onLoad='+fvar_onLoad+'" />';
		flashDoc += '</object>';
	}else{
		flashDoc += '<embed src="'+swfURL+'" width="'+width+'" height="'+height+'" align="middle" menu="'+menu+'" quality="high" bgcolor="#'+bgColor+'" id="'+flashID+'" name="'+flashID+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" flashvars="lcId='+flashHeaderProxyID+'&campusLocation='+campusLocation+'&firstview='+firstView+'&liveServiceInProgress='+liveServiceInProgress+'&username='+username+'&ministry='+ministry+'&baseURL='+baseURL+'&currentURL='+currentURL+'&logoutURL='+logoutURL+'&fvar_onLoad='+fvar_onLoad+'"></embed>';
	}
	flashDoc += '<br>';
	
	return flashDoc;
}
// HTML HEADER Varialbles ---------------------------------------------------------------------
//return HTML Layout
function htmlHeaderLayout(baseURL,ministry,username,currentURL,campusLocation,liveServiceInProgress){
	//alert(ministry);
	campusLocationALT = "Fort Lauderdale";
	if(campusLocation=="CCPL") campusLocationALT = "Plantation";
	if(campusLocation=="CCBR") campusLocationALT = "Boca Raton";
	//URL target pages
	var liveServiceInProgress = parseInt(liveServiceInProgress); // 1:0
	var liveServiceURL		= baseURL + 'AWMedia/LiveService.cfm';
	var adminLink			= baseURL + 'Ministries/AdminAndSupport/index.cfm';
	var descipleshipLink	= baseURL + 'Ministries/Discipleship/index.cfm';
	var familyLink			= baseURL + 'Ministries/Family/index.cfm';
	var mediaLink			= baseURL + 'Ministries/Media/index.cfm';
	var worshipLink			= baseURL + 'Ministries/Worship/index.cfm';
	//Sub-menu URLs
	var logInURL 			= baseURL + 'login/index.cfm?referer='+currentURL;
	var logOutURL 			= baseURL + 'login/logout.cfm?referer='+currentURL;
	var memberProfileURL 	= baseURL + 'MemberProfile/index.cfm';
	var contributionURL		= baseURL + 'Stewardship/contribution.cfm';
	var contactURL			= baseURL + 'ContactUs/';
	//header image
	var defaultHeaderALT 			= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Calvary Chapel - "+campusLocationALT;
	var defaultImageHeaderURL		= baseURL + "images/header/default_header_"+campusLocation+".gif";
	var defaultImageLiveHeaderURL	= baseURL + "images/header/default_headerLive_"+campusLocation+".gif";
	var actualDefaultHeader			= (liveServiceInProgress)?defaultImageLiveHeaderURL:defaultImageHeaderURL;
	var adminHeaderALT 				= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Administration - Calvary Chapel - "+campusLocationALT;
	var adminImageHeaderURL 		= baseURL + "images/header/admin_header_"+campusLocation+".gif";
	var adminImageLiveHeaderURL 	= baseURL + "images/header/admin_headerLive_"+campusLocation+".gif";
	var actualAdminHeader			= (liveServiceInProgress)?adminImageLiveHeaderURL:adminImageHeaderURL;
	var discipleshipHeaderALT 		= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Discipleship - Calvary Chapel - "+campusLocationALT;
	var discipleshipImageHeaderURL 	= baseURL + "images/header/discipleship_header_"+campusLocation+".gif";
	var discipleshipImageLiveHeaderURL = baseURL + "images/header/discipleship_headerLive_"+campusLocation+".gif";
	var actualDiscipleshipHeader	= (liveServiceInProgress)?discipleshipImageLiveHeaderURL:discipleshipImageHeaderURL;
	var familyHeaderALT 			= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Family - Calvary Chapel - "+campusLocationALT;
	var familyImageHeaderURL 		= baseURL + "images/header/family_header_"+campusLocation+".gif";
	var familyImageLiveHeaderURL 	= baseURL + "images/header/family_headerLive_"+campusLocation+".gif";
	var actualFamilyHeader			= (liveServiceInProgress)?familyImageLiveHeaderURL:familyImageHeaderURL;
	var mediaHeaderALT 				= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Media - Calvary Chapel - "+campusLocationALT;
	var mediaImageHeaderURL 		= baseURL + "images/header/media_header_"+campusLocation+".gif";
	var mediaImageLiveHeaderURL 	= baseURL + "images/header/media_headerLive_"+campusLocation+".gif";
	var actualMediaHeader			= (liveServiceInProgress)?mediaImageLiveHeaderURL:mediaImageHeaderURL;
	var worshipHeaderALT 			= (liveServiceInProgress)?"Click Here to View the LIVE Service underway.":"Worship - Calvary Chapel - "+campusLocationALT;
	var worshipImageHeaderURL 		= baseURL + "images/header/worship_header_"+campusLocation+".gif";
	var worshipImageLiveHeaderURL 	= baseURL + "images/header/worship_headerLive_"+campusLocation+".gif";
	var actualWorshipHeader			= (liveServiceInProgress)?worshipImageLiveHeaderURL:worshipImageHeaderURL;
	//Sub-menu images
	var logInImage					= baseURL + 'images/header/login.gif';
	var logInImage_rollover			= baseURL + 'images/header/login_over.gif';
	var logOutImage					= baseURL + 'images/header/logout.gif';
	var logOutImage_rollover		= baseURL + 'images/header/logout_over.gif';
	var memberProfileImage			= baseURL + 'images/header/member_profile.gif';
	var memberProfileImage_rollover	= baseURL + 'images/header/member_profile_over.gif';
	var contributionImage			= baseURL + 'images/header/contribution.gif';
	var contributionImage_rollover	= baseURL + 'images/header/contribution_over.gif';
	var contactImage				= baseURL + 'images/header/contact.gif';
	var contactImage_rollover		= baseURL + 'images/header/contact_over.gif';
	//nav images
	var adminImageURL 					= baseURL + "images/header/admin.gif";
	var adminImageURL_rollover 			= baseURL + "images/header/admin_rollover.gif";
	var discipleshipImageURL 			= baseURL + "images/header/discipleship.gif";
	var discipleshipImageURL_rollover 	= baseURL + "images/header/discipleship_rollover.gif";
	var familyImageURL 					= baseURL + "images/header/family.gif";
	var familyImageURL_rollover 		= baseURL + "images/header/family_rollover.gif";
	var mediaImageURL 					= baseURL + "images/header/media.gif";
	var mediaImageURL_rollover 			= baseURL + "images/header/media_rollover.gif";
	var worshipImageURL 				= baseURL + "images/header/worship.gif";
	var worshipImageURL_rollover 		= baseURL + "images/header/worship_rollover.gif";
	//bottom bar image
	var bottom_bar_image				= baseURL + "images/header/bottom_bar.gif";
	
	//Image tags
	var adminImageTAG	= '<img src="'+adminImageURL+'" alt="Admin & Support" name="admin" border="0" id="admin">';
	var discipleshipImageTAG = '<img src="'+discipleshipImageURL+'" alt="Discipleship Ministry" name="discipleship" border="0" id="discipleship">';
	var familyImageTAG = '<img src="'+familyImageURL+'" alt="Family Ministry" name="family" border="0" id="family">';
	var mediaImageTAG = '<img src="'+mediaImageURL+'" alt="Media Ministry" name="media" border="0" id="media">';
	var worshipImageTAG = '<img src="'+worshipImageURL+'" alt="Worship Ministry" name="worship" border="0" id="worship">';
	//A tags
	var ADMIN_aTAG = '<a href="'+adminLink+'" onMouseOver="MM_swapImage(\'admin\',\'\',\''+adminImageURL_rollover+'\',1)" onMouseOut="MM_swapImgRestore()">'+adminImageTAG+'</a>';
	var DISC_aTAG = '<a href="'+descipleshipLink+'" onMouseOver="MM_swapImage(\'discipleship\',\'\',\''+discipleshipImageURL_rollover+'\',1)" onMouseOut="MM_swapImgRestore()">'+discipleshipImageTAG+'</a>';
	var FAM_aTAG = '<a href="'+familyLink+'" onMouseOver="MM_swapImage(\'family\',\'\',\''+familyImageURL_rollover+'\',1)" onMouseOut="MM_swapImgRestore()">'+familyImageTAG+'</a>';
	var MEDIA_aTAG = '<a href="'+mediaLink+'" onMouseOver="MM_swapImage(\'media\',\'\',\''+mediaImageURL_rollover+'\',1)" onMouseOut="MM_swapImgRestore()">'+mediaImageTAG+'</a>';
	var WORSH_aTAG = '<a href="'+worshipLink+'" onMouseOver="MM_swapImage(\'worship\',\'\',\''+worshipImageURL_rollover+'\',1)" onMouseOut="MM_swapImgRestore()">'+worshipImageTAG+'</a>';
		
	//define layout
	var htmlDoc = '';
	//define sub-menu nav
	var loginRow = '';
	loginRow += '  <tr>';
	if(username!=""){
		loginRow += '  		<td class="subHeaderLogin___"><a href="'+logOutURL+'" onmouseover="MM_swapImage(\'logout\',\'\',\''+logOutImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img name="logout" src="'+logOutImage+'" alt="Logout" width="65" height="20" border="0" /></a></td>';
		loginRow += '		<td class="subHeaderWelcome___">Welcome '+username+'</td>';
		loginRow += '		<td width="" class="subHeaderNavigation___" nowrap><a href="'+memberProfileURL+'" onmouseover="MM_swapImage(\'member_profile\',\'\',\''+memberProfileImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img src="'+memberProfileImage+'" alt="Member Profile" name="member_profile" width="110" height="20" border="0" id="member_profile" /></a><a href="'+contributionURL+'" onmouseover="MM_swapImage(\'contribution\',\'\',\''+contributionImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img src="'+contributionImage+'" alt="Contribution" name="contribution" width="100" height="20" border="0" id="contribution" /></a><a href="'+contactURL+'" onmouseover="MM_swapImage(\'contact\',\'\',\''+contactImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img src="'+contactImage+'" alt="Contact" name="contact" width="82" height="20" border="0" id="contact" /></a></td>';
	}else{ 
		//not loged in		
		loginRow += '  		<td class="subHeaderLogin___"><a href="'+logInURL+'" onmouseover="MM_swapImage(\'login\',\'\',\''+logInImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img name="login" src="'+logInImage+'" alt="Login" width="65" height="20" border="0" /></a></td>';
		loginRow += '		<td class="subHeaderWelcome___"></td>';
		loginRow += '		<td width="" class="subHeaderNavigation___" nowrap><a href="'+contributionURL+'" onmouseover="MM_swapImage(\'contribution\',\'\',\''+contributionImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img src="'+contributionImage+'" alt="Contribution" name="contribution" width="100" height="20" border="0" id="contribution" /></a><a href="'+contactURL+'" onmouseover="MM_swapImage(\'contact\',\'\',\''+contactImage_rollover+'\',1)" onmouseout="MM_swapImgRestore()"><img src="'+contactImage+'" alt="Contact" name="contact" width="82" height="20" border="0" id="contact" /></a></td>';
	}
	loginRow += '  </tr>';
	
	//Layout Switch
	switch(ministry){
		case "AdminAndSupport":
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+adminHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualAdminHeader+'" alt="'+adminHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  <tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+WORSH_aTAG+ADMIN_aTAG+DISC_aTAG+FAM_aTAG+MEDIA_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt="" /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
		case "Discipleship":
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+discipleshipHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualDiscipleshipHeader+'" alt="'+discipleshipHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  </tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+ADMIN_aTAG+DISC_aTAG+FAM_aTAG+MEDIA_aTAG+WORSH_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt=""  /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
		case "Family":
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+familyHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualFamilyHeader+'" alt="'+familyHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  </tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+DISC_aTAG+FAM_aTAG+MEDIA_aTAG+WORSH_aTAG+ADMIN_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt=""  /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
		case "Media":
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+mediaHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualMediaHeader+'" alt="'+mediaHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  </tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+FAM_aTAG+MEDIA_aTAG+WORSH_aTAG+ADMIN_aTAG+DISC_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt=""  /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
		case "Worship":
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+worshipHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualWorshipHeader+'" alt="'+worshipHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  </tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+MEDIA_aTAG+WORSH_aTAG+ADMIN_aTAG+DISC_aTAG+FAM_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt=""  /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
		default :
			//discipleship layout
			htmlDoc += '<table border="0" cellspacing="0" cellpadding="0" class="headerTable___" summary="'+defaultHeaderALT+'">';
			htmlDoc += '  <tr>';
			htmlDoc += '    <td colspan="5">';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'<a href="'+liveServiceURL+'">':htmlDoc;
			htmlDoc += '<img src="'+actualDefaultHeader+'" alt="'+defaultHeaderALT+'" width="770" height="85" border="0" id="header" />';
			htmlDoc = (liveServiceInProgress)?htmlDoc+'</a>':htmlDoc;
			htmlDoc += '</td>';
			htmlDoc += '  </tr>';
			htmlDoc += loginRow;
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" height="26" nowrap>'+ADMIN_aTAG+DISC_aTAG+FAM_aTAG+MEDIA_aTAG+WORSH_aTAG+'</td>';
			htmlDoc += '  </tr>';
			htmlDoc += '  <tr>';
			htmlDoc += '  	<td colspan="5" nowrap><img src="'+bottom_bar_image+'" width="770" height="4" alt=""  /></td>';
			htmlDoc += '  </tr>';
			htmlDoc += '</table>';
			break;
	}
	
	var CssScript ='\n';
	CssScript += '<style type="text/css">\n';
	CssScript += '<!-- \n';
	CssScript += '.headerTable___ {\n';
	CssScript += '	border: 5px solid #000000;\n';
	CssScript += '	width:780px;\n';
	CssScript += '}\n';
	CssScript += '.subHeaderLogin___ {\n';
	CssScript += '	background-color:#000000;\n';
	CssScript += '	color:#FFFFFF;\n';
	CssScript += '	width:65px;\n';
	CssScript += '	height:20px;\n';
	CssScript += '	text-align:left;\n';
	CssScript += '}\n';
	CssScript += '.subHeaderWelcome___ {\n';
	CssScript += '	background-color:#000000;\n';
	CssScript += '	color:#FFFFFF;\n';
	CssScript += '	width:413px;\n';
	CssScript += '	height:20px;\n';
	CssScript += '	text-align:left;\n';
	CssScript += '	padding-left:5px;\n';
	CssScript += '	font-family:Verdana, sans-serif;\n';
	CssScript += '	font-size:11px;\n';
	CssScript += '	vertical-align:middle;\n';
	CssScript += '}\n';
	CssScript += '.subHeaderNavigation___ {\n';
	CssScript += '	background-color:#000000;\n';
	CssScript += '	color:#FFFFFF;\n';
	CssScript += '	width:292px;\n';
	CssScript += '	height:20px;\n';
	CssScript += '	text-align:right;\n';
	CssScript += '}\n';
	CssScript += '-->\n';
	CssScript += '</style>\n';

	var preloadImagesScript ='\n';
	preloadImagesScript += '<script language="JavaScript" type="text/javascript">\n';
	preloadImagesScript += '<!--\n';
	preloadImagesScript += "MM_preloadImages('"+adminImageURL_rollover+"','"+discipleshipImageURL_rollover+"','"+familyImageURL_rollover+"','"+mediaImageURL_rollover+"','"+worshipImageURL_rollover+"','"+logInImage_rollover+"','"+logOutImage_rollover+"','"+memberProfileImage_rollover+"','"+contributionImage_rollover+"','"+contactImage_rollover+"')\n";
	preloadImagesScript += '//-->\n';
	preloadImagesScript += '</script>\n';

	return  CssScript + htmlDoc + preloadImagesScript;
}

// Menu Fade-In-Out
var ns4 = (typeof (document.layers)!="undefined"||(document.layers))?true:false;
var ns6 = (document.getElementById && !document.all);
var ie4 = (typeof (document.all)!="undefined"||(document.all))?true:false;
var ie5  = (typeof (document.all && document.getElementById)!="undefined"||(document.all && document.getElementById))?true:false;
var useLayers = (ns4 || ns6 || ie4 || ie5);
//alert("ns4: "+ns4+" ns6: "+ns6+" ie4: "+ie4+" ie5: "+ie5);
function BrowserInfo()
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}
var b___ = new BrowserInfo();
function fullscreen(urlStr){
	var xOffset = -6; //WinXP IE
	var yOffest = -35; //WinXP IE
	var xPos = 0;
	var yPos = 0;
	var winName = "fullscreen";
	var features = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+(b___.screenWidth+xOffset)+",height="+(b___.screenHeight+yOffest);
	if(typeof winObj != "undefined") winObj.close();
	winObj = window.open(urlStr,winName,features);
	winObj.moveTo(xPos,yPos);
	winObj.focus();
}
//alert("what is it?  "+b___.name); 
//alert("Debug - use layers :"+useLayers);
menuBGLayer 	= new Object();
menuTextLayer 	= new Object();
// initMenu(xPos,yPos,width,height)
function initMenu(xPos,yPos,width,height){ 
	if(useLayers){
		if(ns4 || ns6){
			xPos += 3;
		}
		var bodyWidth = '780px';
		var cssStyles = '\n';
		cssStyles += '<style type="text/css">\n';
		cssStyles += '<!--\n';
		cssStyles += '.bgFade{background-color:#000000;position:absolute;visibility:hidden;z-index:99;left:'+xPos+'px;width:'+width+'px;height:'+height+'px;clip:rect(0px,'+width+'px,'+height+'px,0px);}\n';
		cssStyles += '.menuText{position:absolute;visibility:hidden;z-index:100;text-align:left;left:'+xPos+'px;width:'+width+'px;height:'+height+'px;clip:rect(0px,'+width+'px,'+height+'px,0px);overflow:hidden;}\n';
		cssStyles += '-->\n';
		cssStyles += '</style>\n';
		var DIVs = '\n';
		DIVs += '<div align="center" style="position:absolute; top:'+yPos+'px; width:100%;">';
		DIVs += 	'<div style="width:'+bodyWidth+';">';
		DIVs +=			'<div id="menuBGLayer" class="bgFade"></div>';
		DIVs +=			'<div id="menuTextLayer" class="menuText"></div>';
		DIVs +=		'</div>';
		DIVs +=	'</div>';
		DIVs += '';//<div id="offLayer" class="offLayerCSS" onMouseOver="pauseFade();"></div>\n';
		document.writeln((cssStyles + DIVs));
		menuBGLayer 	= MM_findObj('menuBGLayer');
		menuTextLayer 	= MM_findObj('menuTextLayer');
		menuBGLayer.style.visibility 	= "hidden";
		menuTextLayer.style.visibility 	= "hidden";
		if(ie5){ menuBGLayer.filters.alpha.opacity = 80;
		}else if(ns6){ menuBGLayer.style.MozOpacity = 0.8;
		}else{
			menuBGLayer.filters.alpha.opacity = 100;
			menuBGLayer.style.MozOpacity = 1.0;
		}
	}
}
function showMinistryMenu(textContent) {
	if(useLayers){
		menuBGLayer.style.visibility = "visible";
		writeContent('menuTextLayer',textContent);
	}
}
function hideMinistryMenu(){
	if(useLayers){
		menuTextLayer.style.visibility = "hidden";
		menuBGLayer.style.visibility = "hidden";
	}
}
//function used in 
function menuLayout(Content,CSS){
	var defaultCSS = ((typeof CSS=="undefined")||CSS=="")?true:false;
	defualtCSS = (defaultCSS)?"style='color:#ffffff;font-family: Verdana, Arial, Helvetica, sans-serif;font-size:11px;'":CSS;
	return "<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0' style='padding-left:10px;padding-top:5px;padding-right:5px;padding-bottom:5px;'><tr><td valign='top' "+((!defualtCSS)?"class='"+CSS+"'":defualtCSS)+">"+Content+"</td></tr></table>";
}
function writeContent(target,textContent){
	var targetObj = MM_findObj(target);
    if(ns4)
    {
      targetObj.document.write(textContent);
      targetObj.document.close();
      targetObj.visibility = "visible";
	  targetObj.style.visibility= "visible";
    }
    if(ns6)
    {
      targetObj.innerHTML = textContent;
      targetObj.display='block';
	  targetObj.style.visibility= "visible";
    }
    if(ie4 || ie5)
    {
      targetObj.innerHTML=textContent;
      targetObj.display='block'
	  targetObj.style.visibility= "visible";
    }
}
function initToolTip(){
	offsetfrommouse=[15,-15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
	displayduration=0; //duration in seconds image should remain visible. 0 for always.
	if (document.getElementById || document.all){
		document.writeln('<style type="text/css">');
		document.writeln('<!--');
		document.writeln('#trailimageid { position: absolute; visibility: hidden; left: 0px; top: 0px; width: 170px; height: 1px; z-index: 1000; }');
		document.writeln('-->');
		document.writeln('</style>');
		document.writeln('<div id="trailimageid">');
		document.writeln('</div>');
	}
}
function gettrailobj(){
	if (document.getElementById)
		return document.getElementById("trailimageid").style
	else if (document.all)
		return document.all.trailimagid.style
}
function gettrailobjnostyle(){
	if (document.getElementById)
		return document.getElementById("trailimageid")
	else if (document.all)
		return document.all.trailimagid
}
function truebody(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function showToolTip(msg){
	document.onmousemove=followmouse;
	newHTML = '<div style="padding: 3px; background-color: #FFFFFF; border: 1px solid #000000; font-family:Arial, Helvetica, sans-serif; font-size:9px; color: black;">';
	newHTML += msg + '</div>';
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().visibility="visible";
}
function hideToolTip(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-500px"
}
function followmouse(e){
	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 200){
			xcoord = e.pageX - xcoord - 170; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (40)){
			ycoord += e.pageY - Math.max(0,(40 + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}
	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 200){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 170; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (40)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(40 + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
}
function customFieldCheck(msg){
	var checkMSG = new Array("f2ausername","f2apassword","address1","membernamelast","membernamefirst");
	var displays = new Array("Email","Password","Address","Last Name","First Name");
	for(var i=0;i<checkMSG.length;i++){
		if(msg==checkMSG[i]){
			return displays[i];
		}
	}
	return msg;
}
function MM_validateForm() { //v4.0
  var i,p,q,z,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); z=val.indexOf('.');
        if (z<1 || z==(val.length-1) || p<1 || p==(val.length-1)) errors+='- '+customFieldCheck(nm)+' must contain a valid e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+customFieldCheck(nm)+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+customFieldCheck(nm)+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+customFieldCheck(nm)+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
