/*	tell server that javascript is enabled. */
document.cookie = 'javascript=Y';



/*
	Get browser
*/
var browser_ie = (navigator.userAgent.indexOf('MSIE') >= 0);










/*
	Get page parameters from query string.
*/
var rayPageParameters = null;
function getPageParameters()
{	
	rayOutParameters = new Array();
	strQueryString = location.search.replace(/\?/,'&');
	rayQueryString = strQueryString.split('&');
	for (i=1; i < rayQueryString.length; i++)
	{	strParameter = rayQueryString[i];
		rayParameter = strParameter.split('=');
		rayOutParameters[rayParameter[0]] = rayParameter[1];
	}
	return rayOutParameters;
}
function getPageParameter(strInParam)
{	
	if (!rayPageParameters) rayPageParameters = getPageParameters();
	return rayPageParameters[strInParam];
}









/*
	Cookies
*/
function writeCookie(cname, cvalue, cexpire)
{
	document.cookie = cname + '=' + escape(cvalue) +
	(typeof cexpire == 'date' ? 'expires=' + cexpire.toGMTString() : '') +
		',path=/;domain=about.com';
}






























































/*
	Call renderMenu like so...
	
	pagename = window.location.pathname;
	pagename = pagename.substring(pagename.lastIndexOf('/')+1);
	renderMenu(pagename);
	
	(menu item id should be the page name without extension.)
*/

var rayMenuItems = new Array(
	{ 'id':'index', 'name':'Home', 'href':'index.htm' },
	{ 'id':'about_ehc', 'name':'About EHC', 'href':'about_ehc.php' },
	{ 'id':'purpose', 'name':'Purpose', 'href':'purpose.htm' },
	{ 'id':'ministry', 'name':'Ministry', 'href':'ministry.htm' },
	{ 'id':'impact', 'name':'Impact', 'href':'impact.htm' },
	{ 'id':'prayer', 'name':'Prayer', 'href':'prayer.htm' },
	{ 'id':'outreach', 'name':'Outreach', 'href':'outreach.php' },
	{ 'id':'resources', 'name':'Resources', 'href':'resources.htm' },
	{ 'id':'partnership', 'name':'Partnership', 'href':'partnership.htm' },
	{ 'id':'contact', 'name':'Contact EHC', 'href':'contact.php' }
	);

function renderMenu(strFromPage)
{	
	if (!strFromPage) strFromPage = 'index.htm';
	strMenuOut = "<div id='navlist_container'><ul id='navlist'>";
	
	for (m=0; m < rayMenuItems.length; m++)
	{	
		thisMenu = rayMenuItems[m];
		
		booThisIsCurrent = (strFromPage.indexOf(thisMenu['id']) >= 0);
		
		strMenuOut += "<li><a href='"+thisMenu['href']+"'"+
			(booThisIsCurrent ? " id='current'" : "")+
			">"+thisMenu['name']+"</a></li>";
	}
	
	strMenuOut += "</ul></div>";
	return strMenuOut;
}































































/*
	Numerical processing and formatting...
*/


function toNumber(strInNumber)
{	
	strOutNumber = strInNumber.replace(/,/g,'').replace('$','');
	intOutNumber = new Number(strOutNumber);
	return intOutNumber ? intOutNumber : 0;
}



function formatCurrency(intInAmount)
{
	strDecimal = '.';
	strDelim = ',';
	strOutAmount = "";
	
	intInAmount = new Number(intInAmount);
	if (isNaN(intInAmount)) return false;
	
	booNegative = (intInAmount < 0);
	strInAmount = Math.abs(intInAmount).toFixed(2);
	rayInAmount = strInAmount.split('.');
	strLeftAmount = rayInAmount[0];
	
	rayLeftAmount = new Array();
	while(strLeftAmount.length > 3)
	{	
		strThisNumber = strLeftAmount.substr(strLeftAmount.length-3);
		
		rayLeftAmount.unshift(strThisNumber);
		strLeftAmount = strLeftAmount.substr(0,strLeftAmount.length-3);
	}
	if (strLeftAmount.length > 0) rayLeftAmount.unshift(strLeftAmount);
	
	strOutAmount = (booNegative?'-':'')+
		rayLeftAmount.join(strDelim)+strDecimal+rayInAmount[1];
	
	return strOutAmount;
}































































