//---------------------------------------- Action
var NUM_PAGES = 25;

function Action(what)
{
	if(what=="") return;
	else
	{
		var it=0;
		for(i=0;i<what.length;i++)
		{
			it += what.charCodeAt(i);
		}
		it = (it % (NUM_PAGES)); // returns it=0 to (NUM_PAGES-1)

    // just to be safe:
    if(it<0) it = 2; if(it>NUM_PAGES) it = 8;

    if(it<10) it = "0" + it; 

    location.replace("adv"+it+".html");
  }
}

////////////////////////////////////////////////////////
// these are no longer needed but remain just in case...

if(document.layers){
  document.captureEvents(Event.KEYPRESS);
  document.onkeypress = keyPressed;
}

function keyPressed(e){ submitEnter(e); }

function submitEnter(e)
{
  window.status = e.keyCode;
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

  if (keycode == 13)
	{
		Action(document.actionForm.actionInput.value);
		return false;
	}
	else return true;
}