//list.js

/*
 * -----------------------------------------------------------------
 * 'SAUTI' (c) 2005/2006, Kwame Ansong-Dwamena 
 * -----------------------------------------------------------------
 */
 
/*
  * This js file creates the list of article titles in the div(id='articleList').
  * IN THE FUTURE, THIS FILE WILL PROBABLY BE MODIFIED TO COMMUNICATE WITH A SERVER/DATABASE
  * TO OBTAIN TEXT NEEDED FOR THE LIST IETMS.
  */

var originalColor = "";		// holds original background-color of a link when the function highlightLink(link) is executed. This ensures that the background can be reverted to that color.

var titleArray = new Array();
titleArray[0] = "Causality and the Casualty of Truth";
titleArray[1] = "Reflections from Africa I";
titleArray[2] = "Mobile Telecommunications In Africa";
titleArray[3] = "Personal Reflection";
titleArray[4] = "The Role of Elections in Post-Conflict Situations";
titleArray[5] = "Reflections from Africa II";
titleArray[6] = "Punishing Genocide";
titleArray[7] = "Mobile Phone Use and Policy in Southern Africa";
titleArray[8] = "Energy Issues in Sub-Saharan Africa";
titleArray[9] = "Learning of Science and Math among Females";

// Creates the list of article titles in the rightmost div(id="articleList"). Other nice colors to use: #f7f8f9 ; #ebf2f5, or maybe not.
function createList()
{
	var lists = "";
	for(var i = 0; i < titleArray.length; i++)
	{
		lists += "<div style='padding-left: 25px; padding-top: 5px; padding-bottom: 5px;";
		if(i%2 == 0) lists+= " background-color: #336699;";
		lists += "' onmouseover='hightlightLink(this)' onmouseout='removehighlightLink(this)'><li><a style='color: #fff; font-size: 12px; text-decoration: none;' href='html/vol2/article" + (i+1) + ".html'>" + titleArray[i] + "</a></li></div>";
	}
	//document.getElementById("articleList").innerHTML = "<ul style='margin-top: 0; margin-left: 0; padding-left: 0; padding-top: 25px; list-style-image: url(images/bullet.gif);'>" + lists + "</ul>";
	document.getElementById("articleList").innerHTML = "<ul style='margin-top: 0; margin-left: 0; padding-left: 0; padding-top: 25px; list-style-image: url(images/external-link.gif);'>" + lists + "</ul>";
}

function hightlightLink(link)
{
	originalColor = link.style.backgroundColor;
	link.style.backgroundColor="#33cc99";
}

function removehighlightLink(link)
{
	link.style.backgroundColor=originalColor;
}