//Load speaker information
document.write('<script type="text/javascript" src="js/speakerinfo.js"></script>');

//Number of featured speakers
var num = 3;
//Stores the INDEX of the selected speakers
var selection = [];	
//A temporary list of speakers
var thisSpeakers = [];

function selectSpeakers()
{
	selection = [];

	if(thisSpeakers.length < num)
		thisSpeakers = speakers.slice();
		
	var select = 0;
	for ( var i = 0; i < num; i++){
		select = Math.round(Math.random() * (thisSpeakers.length-1));
		selection.push(thisSpeakers[select]);	
		thisSpeakers.splice(select,1);
	}
}

function generateSpeakers()
{
 //This is the HTML to ouput
	var output = "";
	selectSpeakers();

	for ( var i = 0; i < num; i++){
		var name = selection[i][0];
		var org = selection[i][1];
		var ref = selection[i][2];
	
		output += "<p><a href='speakers.php?#" + ref + "'><img src='images/speakers/" + ref + ".jpg' alt='" + name + "' /><span>" + name + "</span>" + org + "</a></p>";
	}

	return output;
}
