// JavaScript Document


	
function Toggle() {
	if (!document.getElementById) { return; }
	this.visibleElement = new Object(); 
	this.highlightedLink = new Object(); /* "static vars" for tracking currently highlighted element */
}


Toggle.prototype.showSpan = function (currLink) {
	if (!document.getElementById) { return true; } /* if it is an older browser skip function and let it follow the link to the sys requirements page */
	var parentParagraph = (currLink.parentNode).parentNode;
	var spanToBeShown = parentParagraph.getElementsByTagName("span")[0];
	if (this.highlightedLink === currLink) { return false; }
	
	this.visibleElement.className = "hidden"
	this.highlightedLink.className = "";
	
	spanToBeShown.className = "visible";
	currLink.className = "highlight";
	
	this.visibleElement = spanToBeShown;
	this.highlightedLink = currLink;
	
	return false;
}


Toggle.prototype.showDiv = function (currLink, DivId){
	if (!document.getElementById) { return true; }
	var divToBeShown = document.getElementById(DivId);
	if (this.highlightedLink === currLink) { return flase; }
	
	this.visibleElement.className = "hidden"; /* hide old div and remove highlight from old link */
	this.highlightedLink.className = "";
	
	divToBeShown.className = "visible"; /* make new div visible and highlight link */
	currLink.className = "highlight";
	
	this.visibleElement = divToBeShown; /* Update currently visible and highlighted*/
	this.highlightedLink = currLink;
	
	return false;
}



ToggleObj = new Toggle();  /* Create object to be used by event handlers */


function init() { /* Set event handlers for all a tags within the p within #Riddle (poem phrases) */
	if (!document.getElementById) { return; }
	var riddleDiv;
	if ( riddleDiv = document.getElementById("RiddleText") ) {
		var linkTags = riddleDiv.getElementsByTagName("a");  /* all a tags in the riddle */
		var i, numtags = linkTags.length;
		for( i = 0; i < numtags; i++) {
			linkTags[i].onclick = function() { ToggleObj.showSpan(this); return false; }; /* N.B. function is not be called, just assigned */
			linkTags[i].onmouseover = function() { window.status = "Click a phrase to see it's translation"; return true; };
			linkTags[i].onmouseout = function() { window.status = ""; return true; };
		}
	}
	ToggleObj.visibleElement = document.getElementById("Instructions");		/* initialize "static" vars in ToggleObj */
	ToggleObj.highlightedLink = document.getElementById("InstructionsLink"); /* Instructions are shown by defalut within the html code (class = visible) */
}


function Jump(selObj){
  var index = selObj.selectedIndex;
  selObj.selectedIndex=0;
  window.location= selObj.options[index].value;
}

function email_enkoder(linktext, username, subject){
	document.write('<a href="mailto:' + username + '@swarthmore.edu?subject=' + subject + '">' + linktext + '</a>');
}