// JavaScript Document
// This simple little javascript selects a quote at random from the list we provide
// and displays it on page load.

// This javascript also add the hover behaviours necessary to show/hide the services menu

interestQuotes = '\
Did you know?:--The Etruscans made skillfully designed false teeth out of ivory and bone, secured by gold bridgework, as early as 700 BC.\n\
Did you know?:--Early Egyptian, Chinese, Greek, and Roman writings describe numerous mixtures for both tooth pastes and tooth powders. The more palatable ingredients included powdered fruit, burnt shells, talc, honey, ground shells, and dried flowers. The less appetizing ingredients included mice, the head of a hare, lizard livers, and urine. (Travers)\n\
Did you know?:--Dental floss is an ancient invention, researchers have found dental floss and toothpick grooves in the teeth of prehistoric humans.\n\
Did you know?:--In the late 1790s, the British chemist Humphry Davy began experimenting with the effects of inhaling nitrous oxide. He noted its exhilarating effects, and the way it made him want to laugh, which gave the gas its popular name, "laughing gas." Davy repeatedly demonstrated the gas\'s exhilarating effect to gatherings of his friends, and inhalation parties became quite popular. (Travers)\n\
Did you know?:--Cavities in teeth have been filled since earliest times with a variety of materials: stone chips, turpentine resin, gum, metals. Arculanus recommended gold-leaf fillings in 1848.\n\
Did you know?:--In fourteenth-century England barber-surgeons regularly extracted teeth, and their familiar red and white barber poles - advertisements they used to indicate they would also bleed the sick - were sometimes adorned with teeth they had pulled. (Travers)\n\
Did you know?:--A 2,000-year-old male skeleton found near Paris had a wrought-iron implant apparently made by a blacksmith.\n\
Did you know?:--In primitive societies teeth were sometimes extracted with a chisel-shaped piece of wood held against the tooth and pounded with a mallet. Early Chinese tooth-pullers used their fingers, strengthening them for the task by spending hours pulling nails out of planks. (Travers)\n\
Did you know?:--Toothpaste was used as long ago as 500 BC in China and India.\n\
Did you know?:--George Washington\'s dentures were made of hippopotamus, walrus and cow\'s teeth, and elephant tusks.\n\
Did you know?:--Early toothbrushes used bristles from the necks of cold climate pigs. Natural bristle brushes were invented by the ancient Chinese.\n\
Did you know?:--Next to the common cold, tooth decay remains the most prevalent disease in the United States, even though a third of all youngsters between the ages of 5 and 17 are cavity free.\n\
Did you know?:--In medieval times, gaps between teeth were expected. Queen Elizabeth I (1533-1603) filled the holes in her mouth with cloth to improve her appearance in public. (Travers)\n\
Did you know?:--The first commercial shown on British TV, in September 1955, was for toothpaste. (B.D.H.F)\n\
Did you know?:--Modern dental drills are turbine-powered; they rotate at speeds of 300,000 to 4000,000 revolutions per minute. (Travers, B., ed., World of Invention, Gale, 1994)\n\
Did you know?:--Cocaine was widely used as a local anaesthetic after Carl Koller demonstrated its effectiveness in 1884. By the end of the 1800s, however, the addictive properties of cocaine had been recognized. Doctors, realizing they needed to develop substitutes for cocaine\'s active anesthetic ingredient, carefully studied the exact chemical structure of cocaine which eventually led to the development of novocain in 1905. (Travers)\n\
';


// this function shows the services menu
function showServices ()
	{
	document.getElementById("services").style.display = "block";	
	}
	
// this function hides the services menu
function hideServices ()
	{
	document.getElementById("services").style.display = "none";	
	}

function init ()
	{
	// add the onmouseover & onmouseout event handlers to the services menu
	document.getElementById("service_button").onmouseover = showServices;
	document.getElementById("service_button").onmouseout = hideServices;
	
	// now hide the services menu
	document.getElementById("services").style.display = "none";
		
		
	// split the individual quote into an array by splitting the string at any newline characters
	interestQuoteArray = interestQuotes.split("\n");
	// now split the resulting array elements wherever there is a double hyphen
	// to divide the item heading from it's content
	for( x = 0, length = (interestQuoteArray.length - 1 ); x < length; x++ )
		{
		interestQuoteArray[x] = interestQuoteArray[x].split("--");
		}
		
	// pick a random number to decide which quote will be shown
	randomNumber = Math.floor( Math.random()*( interestQuoteArray.length - 1 ));
	
	// create a container div for the quote
	quoteContainer = document.createElement("div");
	quoteContainer.id = "interest_note";
	
	// Create a H2 Tag and append the quote heading text to it
	quoteHeading = document.createElement("h2");
	quoteHeading.appendChild( document.createTextNode( interestQuoteArray[randomNumber][0]));
	
	// append the quote heading to the container div
	quoteContainer.appendChild( quoteHeading );
	
	// append the quote content to the container div
	quoteContainer.appendChild( document.createTextNode( interestQuoteArray[randomNumber][1]));
	
	// append the quote container to the page
	document.getElementById( "interest_note_footer" ).appendChild( quoteContainer );
	}

window.onload = init;