var pIcons = new Array();
var pTitles = new Array();
var pDescr = new Array();
var pLayerTitles = new Array();
var pLayerElements = new Array();


pIcons[0]="brain";
pTitles[0]="Brain";
pDescr[0]="Reflective thinkers like time to consider everything before they make a decision, whereas impulsive thinkers make quick decisions based on little information.";

pIcons[1]="analytic";
pTitles[1]="Analytic";
pDescr[1]="left-brain dominant people prefer logical, step-by-step information, concentrate well on details and are highly sequential in taking in new information.";

pIcons[2]="holistic";
pTitles[2]="Holistic";
pDescr[2]="'right-brain' dominant people prefer to see the 'big picture' when learning new things, are not interested in details and process information simultaneously.";

pIcons[3]="auditory";
pTitles[3]="Auditory";
pDescr[3]="Some people remember things they hear, they are good listeners, like verbal instructions and/or prefer to discuss new information.";

pIcons[4]="visual";
pTitles[4]="Visual";
pDescr[4]="Some people remember much of what they read and prefer instructions to be written, others remember and understand best when shown pictures, others use their imagination and many a combination of these modalities.";

pIcons[5]="tactile";
pTitles[5]="Tactile";
pDescr[5]="People with this preference have a strong need to manipulate things and use their hands while listening or concentrating.";

pIcons[6]="kinesthetic";
pTitles[6]="Kinesthetic";
pDescr[6]="Some people like to be actively, physically involved in work projects and remember best through their own experiences; others have a strong intuition and need to feel good to understand and remember easily.";

pIcons[7]="mobility";
pTitles[7]="Mobility";
pDescr[7]="Some people find it hard to sit still and need to move around a lot, especially when they are working or concentrating hard. Others prefer to stay put and avoid getting up when they work on something difficult.";

pIcons[8]="intake";
pTitles[8]="Intake";
pDescr[8]="Some people work better when they nibble, eat or drink while concentrating, while others find it distracting when working on difficult tasks.";

pIcons[9]="time";
pTitles[9]="Time";
pDescr[9]="People have different peak times when their brains are most active and then they can concentrate most easily. For some it's the early or late morning, for a few it's the afternoon and for many others it's the evening.";

pIcons[10]="sounds";
pTitles[10]="Sounds";
pDescr[10]="Some people need it quiet when working on something difficult, others prefer sound or music in the background.";

pIcons[11]="light";
pTitles[11]="Light";
pDescr[11]="Some people prefer bright light while others work far better in low light situations - too much light disrupts their concentration.";

pIcons[12]="temperature";
pTitles[12]="Temperature";
pDescr[12]="Some people like warm temperatures when working but others concentrate better when it's cool.";

pIcons[13]="workplace";
pTitles[13]="Workplace";
pDescr[13]="Straight back chairs with desks suit a formal working style. Lounge chairs or lying on the floor when concentrating suit people with an informal working style.";

pIcons[14]="alone";
pTitles[14]="Alone";
pDescr[14]="Some people concentrate best when allowed to work on their own.";

pIcons[15]="pair";
pTitles[15]="Pair";
pDescr[15]="Some people prefer to have another person to work with.";

pIcons[16]="peers";
pTitles[16]="Peers";
pDescr[16]="Some people perform best when they can share their ideas and work within a group of like-minded people who are all at a similar level.";

pIcons[17]="team";
pTitles[17]="Team";
pDescr[17]="Some people love to be part of a team (sometimes as leader) and work most easily with others.";

pIcons[18]="authority";
pTitles[18]="Authority";
pDescr[18]="Some people accept authority and need very regular feedback, while others prefer not to have authority figures present, and don't need supervision.";

pIcons[19]="motivation";
pTitles[19]="Motivation";
pDescr[19]="Some enjoy work, are self-starters and high achievers. Others can lose motivation easily, like incentives and need all other preferences matched to improve their work motivation.";

pIcons[20]="persistence";
pTitles[20]="Persistence";
pDescr[20]="Some people always finish what they begin while others stop when they lose interest and need frequent breaks and lots of encouragement to complete tasks.";

pIcons[21]="conformity";
pTitles[21]="Conformity";
pDescr[21]="Some people need rules and regulations and always like to do what's 'right'; others follow their own rules and like doing unconventional things, often going 'against the stream'.";

pIcons[22]="responsibility";
pTitles[22]="Responsibility";
pDescr[22]="People who take responsibility do what's expected of them and consider the consequences of their actions carefully. Others don't consider work the most important thing in their lives, can be easily distracted from their duties and often forget what they promised.";

pIcons[23]="structure";
pTitles[23]="Structure";
pDescr[23]="Some people need clear guidelines and a framework to work within; others prefer to  work independently without needing instructions.";

pIcons[24]="variety";
pTitles[24]="Variety";
pDescr[24]="Some people like change, variety and challenges, hardly ever doing the same thing twice.  Others work better under routine and like predictability and steadiness in their work.";

pLayerTitles[0]="LEFT/RIGHT BRAIN DOMINANCE";
pLayerElements[0]=new Array();
	
pLayerElements[0][0]=0;
	
pLayerElements[0][1]=1;
	
pLayerElements[0][2]=2;
	
pLayerTitles[1]="SENSES";
pLayerElements[1]=new Array();
	
pLayerElements[1][0]=3;
	
pLayerElements[1][1]=4;
	
pLayerElements[1][2]=5;
	
pLayerElements[1][3]=6;
	
pLayerTitles[2]="PHYSICAL";
pLayerElements[2]=new Array();
	
pLayerElements[2][0]=7;
	
pLayerElements[2][1]=8;
	
pLayerElements[2][2]=9;
	
pLayerTitles[3]="ENVIRONMENT";
pLayerElements[3]=new Array();
	
pLayerElements[3][0]=10;
	
pLayerElements[3][1]=11;
	
pLayerElements[3][2]=12;
	
pLayerElements[3][3]=13;
	
pLayerTitles[4]="SOCIAL";
pLayerElements[4]=new Array();
	
pLayerElements[4][0]=14;
	
pLayerElements[4][1]=15;
	
pLayerElements[4][2]=16;
	
pLayerElements[4][3]=17;
	
pLayerElements[4][4]=18;
	
pLayerTitles[5]="ATTITUDES";
pLayerElements[5]=new Array();
	
pLayerElements[5][0]=19;
	
pLayerElements[5][1]=20;
	
pLayerElements[5][2]=21;
	
pLayerElements[5][3]=22;
	
pLayerElements[5][4]=23;
	
pLayerElements[5][5]=24;

var urlstring = "";

/*
	config = {
		heading: true,
		iconAlign: "left",
		blockLink: true,
		footer: true,
		abbreviate: false
	}
*/

	function GetDidYouKnow() {
		var index = Math.round(Math.random()*24);
		return getDidYouKnow(index, {
			heading: false,
			iconAlign: "left",
			blockLink: true,
			footer: false,
			abbreviate: true
		});
	}

//this is required to callback functions. read http://www.snook.ca/archives/javascript/javascript_pass/ for more info.
if ( ! Function.prototype.bind ) {
    Function.prototype.bind = function( object ) {
        var __method = this;
        return function() {
            __method.apply( object, arguments );
        };
    };
}

function PyramidElementSlideshow(config, interval, element) {
	this.config = config;
	this.index = Math.round(Math.random()*pTitles.length-1);
	this.element = element;

	this.nextElement = function () {
		this.index++;
		this.index = this.index % pTitles.length;
		this.element.innerHTML = getPyramidElement(this.index, this.config);
	}

	this.nextElement();
	setInterval(this.nextElement.bind(this), interval*1000);
}

function getPyramidElement(index, config) {

	if (typeof Format == 'undefined')
		return;

	var result = "";
	

	if (config.heading) {
		result += "<H4>"+pTitles(index)+"</H4>";
	}

	if (!config.iconAlign)
	{
		config.iconAlign = "right";
	}

	var page = "/about-learning-styles-pyramid-model.html";
	if (urlstring!="")
	{
		page = "/learningstyles.asp?page=styles&sub=pyramid"+urlstring;
	}

	result += "<img src='/images/pyramid/icons_48x48/"+pIcons[index]+".gif' width=48 height=48 border=0 align='"+config.iconAlign+"' style='margin-right: 5px'>";
	
	if (config.abbreviate)	{
		result += shortenText(pDescr[index], 10, Format("%0#%1", new Array(page, pTitles[index])));
	} else {
		result += pDescr[index];
	}
	
	if (config.blockLink) {
		result = "<a href='"+Format("%0#%1", new Array(page, pTitles[index]))+"' style='text-decoration: none; color: black'>"+result+"</a>";
	}
	
	if (config.footer) {
		result += "<BR><BR>";
		result += "This refers to the "
		result += "<b><a href='"+Format("%0#%1", new Array(page, pTitles[index]))+"'>"+pTitles[index]+"</a></b> element "
		result += "on the <a href='"+Format("%0", new Array(page))+"'>Pyramid Model</a>.";
	}

	return result;
}

function shortenText(txt, words, url) {
	
	var i, wordCount, ch;
	wordCount=0
	for (i=0; i<txt.length; i++)
	{
		if (txt.charAt(i)==" ")
		{
			wordCount++;
			if (wordCount>words)
			{
				break;
			}
		}
	}
	return txt.substring(0, i)+"..."+"<br><a href='"+url+"' class=LinkWithIcon>Read more...</a>";
}