//Global JS
//Pops up the copyright and disclaimer
function PopUpFooter(pageName)
{
	var strPageLink = "/common/" + pageName;
	window.open(strPageLink, "", "screenX=10,screenY=25,width=400px,height=340px,scrollbars=yes,menubar=no,resizable=yes,status=no,toolbar=no");
}


function OpenPopUpWindow(url, winname, features)
{
	window.open(url, winname, features);
}


//Main Navigation Handler
function NavOn(oNavID)
{
	if(document.getElementById)
	{
		var strImagePath = document.getElementById(oNavID).src;
		var aSplit = strImagePath.split("_");
		document.getElementById(oNavID).src = aSplit[0] + "_r.gif";
	}
}

function NavOut(oNavID)
{
	if(document.getElementById)
	{
		var strImagePath = document.getElementById(oNavID).src;
		var aSplit = strImagePath.split("_");
		document.getElementById(oNavID).src = aSplit[0] + "_n.gif";
	}
}

//Our Journey of Hope - Global JavaScript File
function openWin(path, winname, attributes){
	window.open(path, winname, attributes);
}
var bAlreadyCleared = false; //for e-mail field
function ClearSearchField(oTextBox)
{
	if(!bAlreadyCleared)
	{
		oTextBox.value = '';
		bAlreadyCleared = true;
	}
	return false;
}

function RolloverImage(ImageID)
{
	var aImageName = new Array();
	aImageName = document.getElementById(ImageID).src.split("_");
	document.getElementById(ImageID).src = aImageName[0] + "_r.gif";
}

function RolloutImage(ImageID)
{
	var aImageName = new Array();
	aImageName = document.getElementById(ImageID).src.split("_");
	document.getElementById(ImageID).src = aImageName[0] + "_n.gif";
}


//Hide - Show the Sub Navigation
function ShowSubNavigation(iNav)
{
	if(iNav == 1) //Spiritual Support
	{
		if(document.getElementById("SpiritualNavigation").className == "SpiritualNavigationHide")
		{
			document.getElementById("SpiritualNavigation").className = "SpiritualNavigationShow";
		}
	}
	else
	{
		if(document.getElementById("AboutUsNavigation").className == "AboutUsNavigationHide")
		{
			document.getElementById("AboutUsNavigation").className = "AboutUsNavigationShow";
		}
	}
}

function HideSubNavigation(iNav)
{
	if(iNav == 1) //Spiritual Support
	{
		if(document.getElementById("SpiritualNavigation").className == "SpiritualNavigationShow")
		{
			document.getElementById("SpiritualNavigation").className = "SpiritualNavigationHide";
		}
	}
	else
	{
		if(document.getElementById("AboutUsNavigation").className == "AboutUsNavigationShow")
		{
			document.getElementById("AboutUsNavigation").className = "AboutUsNavigationHide";
		}
	}
}

//Pops up the copyright and disclaimer
function PopUpFooter(pageName)
{
	var strPageLink = "/common/" + pageName;
	window.open(strPageLink, "", "screenX=10,screenY=25,width=400px,height=340px,scrollbars=yes,menubar=no,resizable=yes,status=no,toolbar=no");
}

//Pops up the corresponding tables for the reseach study
function PopUpStudiesTable(iPageNum)
{
	var strPageLink = "/spiritual-support/studies/table" + iPageNum + ".htm";
	if(iPageNum == 3)
	{
		window.open(strPageLink, "", "screenX=10,screenY=25,width=500px,height=370px,scrollbars=yes,menubar=no,resizable=yes,status=no,toolbar=no");
	}
	else
	{
		window.open(strPageLink, "", "screenX=10,screenY=25,width=700px,height=400px,scrollbars=yes,menubar=no,resizable=yes,status=no,toolbar=no");	
	}
}

//Pops up window and registers email in database
function RegisterEmailAddress()
{
	var strEmailAdd;
	if(document.all)
	{
		var strEmailAdd = document.all.emailaddress.value;
		document.all.emailaddress.value = "Thank You!";
	}
	else
	{
		var strEmailAdd = document.getElementById("emailaddress").value;
		document.getElementById("emailaddress").value = "Thank You!";
	}
	
	var strPage = "/contact-us/emailus.cfm?emailaddress=" + strEmailAdd;
	window.open(strPage, "", "screenX=10,screenY=25,width=400px,height=150px,scrollbars=no,menubar=no,resizable=yes,status=no,toolbar=no");
	
}

function ToggleDisplay(id){
	var elem = document.getElementById(id);

	if (elem){
		if (elem.style.display != 'block'){
			elem.style.display = 'block';
			elem.style.visibility = 'visible';
		}else{
			elem.style.display = 'none';
			elem.style.visibility = 'hidden';
		}
	}
	return false;
}

