
function dowin( width, height, url)
{
 var openOptions = 'width='+width+',height='+height+",scrollbars=yes";
 window.open( url, 'TestWin', openOptions);
}

function dowin2(width, height, url )
{
 var openOptions = 'width='+width+',height='+height+",scrollbars=no";
 window.open( url, 'TestWin', openOptions);
}

function dowinText(width, height, text)
{
 var openOptions = 'width='+width+',height='+height+",scrollbars=no";
 wh = window.open( '', 'TestWin', openOptions);
 wh.document.write('<HTML>');
 wh.document.write('<HEAD>');
 wh.document.write('<TITLE>' + "RPCI" + '</TITLE>');
 wh.document.write('<BODY>');
 wh.document.write(text);
 wh.document.write('</BODY>');
 wh.document.write('</HTML>');
}

function getCookie(Name)
{
        var search = Name + "=";
 
    if (document.cookie.length > 0)
    { // if there are any cookies
                offset = document.cookie.indexOf(search);
		if (offset != -1)
		{ // if cookie exists
			offset += search.length;				// set index of beginning of value
			end = document.cookie.indexOf(";", offset);	// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}

function menuline(text, link)
{
	document.write("<A HREF=\"");
	document.write(link);
	document.write("\" class=\"MenuNormal\" ");
	document.write("onmouseover=\"this.className='MenuHighlight'\" ");
	document.write("onmouseout=\"this.className='MenuNormal'\">");
	document.write(text);
	document.write("</A><BR>");
}

function displaylogin()
{
	if (getCookie("userid"))
	{
		menuline("My Account", "/cgi-bin/myaccount.cgi");

		if (document.domain.indexOf("www.rpc.") == 0 ||
			document.domain.indexOf("rpc.") == 0 )
		{
			menuline("Prayer Requests", "/cgi-bin/prayer.cgi");
			menuline("Email Lists", "/cgi-bin/email-lists.cgi");
			menuline("Bulletin Board", "/cgi-bin/bb.cgi");
		}
		
		document.write("<BR>");
		menuline("Logout", "/cgi-bin/login.cgi");
	}
	else
	{
		menuline("Login", "/login.php");
	}
}

function showLayer2(layerName)
{
    var myDivs = document.getElementsByTagName("div");
    myDivs[layerName].style.visibility = 'visible';
}

function hideLayer2(layerName)
{
    var myDivs = document.getElementsByTagName("div");
    myDivs[layerName].style.visibility = 'hidden';
}

// show / hide rows
function toggleDetail(id,number)
{
	for (i=1;i<=number;i++)
	{
          body=document.getElementById(id+i);
          if (body) {
          if (body.style.display == 'none') {
            // To make tr tags disappear
            // we set display to none, as usual
            // to make them appear again
            // we set style to block for IE
            // but for firefox we use table-row
            try {
              body.style.display='table-row';
            } catch(e) {
              body.style.display = 'block';
            }
          }
          else {
            body.style.display = 'none';
          }
          }
	}
}


