/**
	randomly select joke from the array and displays
**/

var joke = new Array();
var jused = new Array();
var njokes = 5;
var j;

joke[0] = "<h3>Definition : Gentleman</h3> <p>Someone who knows how to play the banjo and doesn't.</p>";
joke[1] = "<h3>Question:</h3><p>How many luthiers does it take to screw in a lightbulb? <br/><br/> Answer: Only one, but it takes him six months to make the jig.</p>"
joke[2] = "<h3>Question:</h3><p>What's the difference between a large pepperoni pizza and a luthier? <br/><br/> Answer: The large pepperoni pizza will feed a family of four.</p>"
joke[3] = "<h3>Question:</h3><p>What's the difference between a banjo and harmonica? <br/><br/> Answer: On a harmonica, only every other note sucks.</p>"
joke[4] = "<h3>Question:</h3><p>Why did the luthier cross the road? <br/><br/> Answer: He was tied to a chicken.</p>"

function Showjoke(){
	j = Math.floor(Math.random() * (njokes));
	while (jused[j]){  // cycle until you get an unused index
		 j = Math.floor(Math.random() * (njokes));
	}

	document.write('<p>' + joke[j] + '</p>');
	jused[j]=1;  // mark this index as used
	document.write('<hr/>');
	return ("");
}

