// 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?--According to a recent university study, wearing horizontal stripes can actually make a person appear thinner.\n\
Did you know?--A woman wearing a jacket is perceived as being more powerful and authoritative than a woman not wearing a jacket.\n\
Did you know?--A University of Alabama study found that extroverted people use firm handshakes while shy, neurotic personalities don\'t.\n\
Did you know?--Women who are open to new ideas use firm handshakes. Men use the same handshake whether they are open to new ideas or not.\n\
Did you know?--If you are a shorter individual, you can neutralize the intimidation of a taller person by inviting him or her to sit at opposite ends of a table.\n\
Did you know?--Researchers found people can retain up to three times more information about things they see in their right visual field than they do in their left.  So when giving a presentation, the left side of your face is the best side.\n\
Did you know?--Wearing light colours close to your face bring the viewer\'s eye up to focus on what you are saying.\n\
Did you know?--When attending a business function, keep a supply of business cards in your jacket pocket so you won\'t be rummaging around in your bag or wallet.\n\
Did you know?--Maintaining eye contact when meeting someone shows you are confident and enhances your personal presence.\n\
Did you know?--Don\'t experiment with clothes for an important meeting. Wear a tried and true outfit that makes you feel comfortable, well-dressed and confident.\n\
Did you know?--To make it easy for people to read your name, wear a name tag on your right side, up towards your shoulder.\n\
Did you know?--When dining out with a client or business associate, wait until the meal has been ordered before you discuss business.\n\
Did you know?--If you are involved in a videoconference, pay particular attention to your body language. It does most of the talking for you, especially when you are sitting listening.\n\
Did you know?--Remember to say \"thank you\" or send a handwritten thank you note. It\'s a small gesture, but can be very powerful.\n\
';

function init ()
	{		
	// 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; x < ( interestQuoteArray.length - 1 ); 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( "quote_container" ).appendChild( quoteContainer );
	}

window.onload = init;