// Digital Literacy Resource JavaScript: Expert Answer Randomizer
// ---------------------------------------------------------------------------------

expertArray = ["tracy","camille","paul"];
tracyArray = ["tracy1","tracy2"];

random1 = Math.floor(Math.random() * expertArray.length);

secondPick = [];
for (i=0;i<expertArray.length;i++) {
	if (i != random1) {
		secondPick.push(expertArray[i]);
	}
}

random2 = Math.floor(Math.random() * secondPick.length);

if (expertArray[random1] == "tracy") {
	expert1 = tracyArray[Math.floor(Math.random() * tracyArray.length)];
} else {
	expert1 = expertArray[random1];
}
if (secondPick[random2] == "tracy") {
	expert2 = tracyArray[Math.floor(Math.random() * tracyArray.length)];
} else {
	expert2 = secondPick[random2];
}

function writeExpert(whichExpert) {
	
	document.write('<div class="feature-box">\n');
	
	if (whichExpert == "tracy1") {
		document.write('\t<a class="image-link" href="tutorial/dpl3400.html"><img src="images/home_tracy2.jpg" alt="Tracy Mitrano" width="237" height="92" border="0" /></a>\n');
		document.write('\t<p><a href="tutorial/dpl3400.html">Your Rights as an Author</a> <a class="image-link" href="tutorial/dpl3400.html"><img class="icon-play-sm" src="images/icon_play_sm.gif" alt="" width="11" height="11" border="0" /></a> <span class="timecode">(02:45)</span></p>\n');
		document.write('\t<p>Tracy Mitrano discusses considerations facing the student as an author and producer. <a href="tutorial/dpl3400.html">Watch the video...</a></p>\n');
	}
	else if (whichExpert == "tracy2") {
		document.write('\t<a class="image-link" href="privacy/dpl5100.html"><img src="images/home_tracy2.jpg" alt="Tracy Mitrano" width="237" height="92" border="0" /></a>\n');
		document.write('\t<p><a href="privacy/dpl5100.html">Privacy and the Internet</a> <a class="image-link" href="privacy/dpl5100.html"><img class="icon-play-sm" src="images/icon_play_sm.gif" alt="" width="11" height="11" border="0" /></a> <span class="timecode">(03:58)</span></p>\n');
		document.write('\t<p>Tracy Mitrano discusses how Internet postings that you might believe are private and fleeting are instead public and accessible, not just today, but for many years to come. <a href="privacy/dpl5100.html">Watch the video...</a></p>\n');
	}
	else if (whichExpert == "camille") {
		document.write('\t<a class="image-link" href="tutorial/dpl3201.html"><img src="images/home_camille2.jpg" alt="Camille Andrews" width="237" height="92" border="0" /></a>\n');
		document.write('\t<p><a href="tutorial/dpl3201.html">Using Internet Search Tools</a> <a class="image-link" href="tutorial/dpl3201.html"><img class="icon-play-sm" src="images/icon_play_sm.gif" alt="" width="11" height="11" border="0" /></a> <span class="timecode">(02:08)</span></p>\n');
		document.write('\t<p>Camille Andrews speaks on the intricacies of using Internet search tools for research. <a href="tutorial/dpl3201.html">Watch the video...</a></p>\n');
	}
	else if (whichExpert == "paul") {
		document.write('\t<a class="image-link" href="tutorial/dpl3321.html"><img src="images/home_paul1.jpg" alt="Paul Sawyer" width="237" height="92" border="0" /></a>\n');
		document.write('\t<p><a href="tutorial/dpl3321.html">Plagiarism</a> <a class="image-link" href="tutorial/dpl3321.html"><img class="icon-play-sm" src="images/icon_play_sm.gif" alt="" width="11" height="11" border="0" /></a> <span class="timecode">(03:55)</span></p>\n');
		document.write('\t<p>Paul Sawyer speaks about plagiaristic practices among inexperienced writers and what it means to create original work. <a href="tutorial/dpl3321.html">Watch the video...</a></p>\n');
	}
	
	document.write('</div>\n');
}

writeExpert(expert1);
writeExpert(expert2);