/* some of this crap didn't work.  I left it in case I might find time to work some more*/

var visitor = "";		//make visitor a global variable so we can use it on other pages

function setGreeting(win, choice)
{
	
	if (choice == "yes")
	{
		visitor = prompt('Please enter your name for a personal greeting!', 'your name here, please'); 
		
		if ((visitor == "") || (visitor == " ") || (visitor ==  'your name here, please') || (visitor == undefined))
			visitor = "<i>one who wishes to remain anonymous</i>";

		var winPop = win.openScaledWindow('PopUpGreeting.html', win, visitor);
	
		document.getElementById('greeting_home').innerHTML = "<p>Eventually, " + visitor + ", I hope to have some actual content.  Now wouldn't that be fun?</p>";
		
	}
	else
	{
		document.getElementById('greeting_home').innerHTML = "<p>Nothing wrong with choosing to remain anonymous.  Eventually, I hope to have some actual content.  Now wouldn't that be fun?</p>";
		
		visitor = 'anonymous';

	}

}



/*Open a popup window that is scaled in the way that makes sense to me*/
function openScaledWindow(linkTarget, opener, name)
{
	var winWidth = Math.floor(0.40*docWidth());
	var winHeight = Math.floor(0.50*docHeight());
	var winPop;
	
	//create the window
	
	winPop = opener.open('', 'popWin', 'toolbar=no, menubar=no, location=no, status=no, width=120, height=120, resizable=yes scrollbars=yes'); 
	
	//write the document
	
	winPop.document.open();
	
	winPop.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	
	winPop.document.write('<html xmlns="http://www.w3.org/1999/xhtml" lang="EN"><head> <title>Larry Piper\'s Pop-Up Greeting</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link rel="stylesheet" href="./lgp.css" type="text/css" /><link rel="stylesheet" href="./popup.css" type="text/css" /></head>');
	
	
	winPop.document.write('<body ><h2><a id="top">Larry Piper\'s Pop-Up Greeting</a></h2>');
	winPop.document.write('<p>Hiya, ' + name + '! </p><p> I hope you have fun here!</p>');
	winPop.document.write('<br /><a href="#" onclick="self.close();">close window</a>');

	winPop.document.write('</body></html>');


	winPop.document.close();

	//resize  and relocate the window
	
	winPop.resizeTo(winWidth, winHeight);
	
	winPop.moveTo((docWidth()-winWidth)/2, (docHeight() - winHeight)/2);
		
	winPop.focus();
	return winPop;
}


//Set a greeting appropriate to the page, *if* the visitor registered a name
function pageGreeting(visitor)
{
	if ((visitor != undefined) && visitor.indexOf('anonymous') == -1)
	{
			//		alert ("visitor: " + visitor + "\n visitor.indexOf('anonymous'): " + visitor.indexOf('anonymous') );
		var i, gr_div, gr_suffix; 
		
		var grDivArray = new Array ('greeting_home', 'greeting_fam', 'greeting_mus', 'greeting_spir', 'greeting_tech', 'greeting_van', 'greeting_wri'); 
		
		var grStringArray = new Array ();
		
		grStringArray[0] = "Welcome back <b>" + visitor + "</b>!";
		grStringArray[1] = "Hiya <b>" + visitor + "</b>!  Let me introduce you to my family";
		grStringArray[2] = "Hiya <b>" + visitor + "</b>!  I hope you like the free music.";
		grStringArray[3] = "Hiya <b>" + visitor + "</b>!  This section contains material of a more spiritual nature.";
		grStringArray[4] = "Hiya <b>" + visitor + "</b>!  Here are my <em>nerd</em> pages.  Some things about PChem and some things about my adventures in learning web-site creation.";
		grStringArray[5] = "Hiya <b>" + visitor + "</b>!  Here you'll find trivialities I like, such as ascii art and cow porn";
		grStringArray[6] = "Hiya <b>" + visitor + "</b>!  Here are links to some non-scientific things I wrote.";
		
		for (i = 0; i<grDivArray.length; i++)
		{
			if (document.getElementById(grDivArray[i]))
			{
				document.getElementById(grDivArray[i]).innerHTML = grStringArray[i];
				
				if (i !=0)
					document.getElementById(grDivArray[i]).style.display = 'block';
			}
			else
				continue;
		}		
	}
	else
		return null;
}