// JavaScript Document



/*
 *	UTILITY FUNCTIONS
 * ============================================================================================
 */

function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		var func = function() {
			fn.apply(window.event.srcElement);
		};
		obj.attachEvent( "on"+type, func );
		EventCache.add(obj, type, func);
	}

	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}

var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();
addEvent(window,'unload',EventCache.flush);








/*
 *	CUSTOMER QUOTE ROTATIONS
 * ============================================================================================
 */

var customer_quote_1 = '<p>"This training surpassed my expectations – I was wow\'ed … I have the utmost confidence that my team will succeed in their sales goals."</p><p style="color:#666;">C. Thompson, Assistant Manager</p>';

var customer_quote_2 = '<p>" A real eye-opener as to managing a team vs. leading a team … [It\'s] information I can use each day in my job."</p><p style="color:#666;">J. Collins, Quality Manager</p>';

var customer_quote_3 = '<p>"I liked the way we didn\'t merely ‘go by the book\' but instead focused on concerns of the staff … It was refreshing."</p><p style="color:#666;">A. Vales, Librarian</p>';
var customer_quote_4 = '<p>"I was dreading this [training] because I have so many tight deadlines, but I\'m glad that I came … I got a lot of action steps that I can implement easily."</p><p style="color:#666;">A. Lewis, Senior Communications Specialist</p>';
var customer_quote_5 = '<p>"This training gave me a different perspective to approach old problems."</p><p style="color:#666;">B. Beason, Manager</p>';

var customer_quote_6 = '<p>"I\'m glad we were able to [complete training] in-house because as a group we needed to deal with issues."</p><p style="color:#666;">A. Howard, Assistant Director</p>';

var current_customer_quote = 1;
var num_customer_quotes = 6;

function nextCustQuote() {
	current_customer_quote ++;
	if (current_customer_quote > num_customer_quotes)
		current_customer_quote = 1;
	showCustQuote();
}

function prevCustQuote() {
	current_customer_quote --;
	if (current_customer_quote < 1)
		current_customer_quote = num_customer_quotes;
	showCustQuote();
}

function showCustQuote() {
	var temptext = eval('customer_quote_'+current_customer_quote);
	document.getElementById('customer_quote_container').innerHTML = temptext;
}

addEvent(window, "load", showCustQuote);


/*
var case_study_1 = '<h3>Generate additional revenue!</h3><p><strong>Situation:</strong> A property management group was needing help with their sales skills.  They desired to lease additional properties, but struggled to close and negotiate deals.</p><p><strong>Our Solution:</strong> Sales Training for their leasing agents and realtors, focusing on closing deals. We also incorporated negotiation strategies into the training so that they could work through real life daily scenarios.</p><p><strong>Result:</strong> The day after the training, a leasing agent put his new skills to work.  He was able to close a lease on a large unit that had sat vacant for the last year.  This new unit generated $54,000 additional revenue for them a year!</p>';

var case_study_2 = '<h3>Meet goals!</h3><p> <strong>Situation:</strong> A large pharmaceutical company rolled out a new vision statement.  Employees met with their supervisors &amp; laid out an IDP (Individual Development Plan) to ensure they were in line with the new vision.  In order for employees to implement their IDPs, the Employee Development Department at one site had to provide a large number of training courses that would support a majority of the goals defined in the IDPs.</p><p><strong>Our Solution:</strong> A needs assessment that polled employees to determine which goals were most often represented in the IDPs.  We then developed a curriculum of courses to meet the most pressing needs.</p><p><strong>Result:</strong> Employees have been able to meet their IDP goals due to the fact that the right courses have been offered to meet these needs.  This has allowed this site of the pharmaceutical company to meet the vision statement goals.</p>';

var case_study_3 = '<h3>Increase Sales!</h3><p> <strong>Situation:</strong> The owners of upscale shopping centers were looking to conduct sales training right before the holiday shopping season due to an underachieving &quot;enhanced gift card&quot; product.  The product was fairly new, but had not performed up to expectations.</p><p><strong>Our Solution:</strong> Sales Training to coach them on specific product placement and presentation during the busy shopping season.  We also helped them with closing techniques and securing sales.</p><p><strong>Result</strong>: The day after our interactive session, they had accomplished their largest sales transaction ever with the product.</p>';

var case_study_4 = '<h3>Retain valuable employees!</h3><p> <strong>Situation:</strong> A public school district had not achieved necessary student achievement testing results and was facing major changes in the upcoming school year.  Teaching staff members were frustrated with the upcoming changes and were contemplating resigning.  This would have left the school in an even worse situation as the new school year was rapidly approaching &amp; they needed to keep a qualified teaching staff.</p><p> <strong>Our Solution:</strong> Making Change Work for the school administration, focusing on how to roll out changes in a way that would gain buy-in from the teaching staff.  Positive Thinking &amp; Peak Performance for the teaching staff, focusing on not taking things personally &amp; how attitude can affect productivity &amp; job satisfaction.</p><p><strong>Result:</strong> Teachers reported that they felt much better able to deal with changes as they were implemented &amp; they bought into changes as they were rolled-out.  Teachers who had been contemplating resigning stayed on through the school year.</p>';

var case_study_5 = '<h3>Improve morale!</h3><p><strong>Situation:</strong> Personnel at a state agency faced daily pressure of frequent and final deadlines.  Missing a deadline could result in delaying or effecting court outcomes.  They were struggling to not take the high pressure demands personally and the workplace environment was negative.</p><p><strong>Our Solution:</strong> Positive Thinking and Peak Performance for all employees, giving them the tools to remain focused, productive, and positive, even in the face of daily deadlines.</p><p><strong>Result:</strong> Overall team morale increased dramatically as participants held each other accountable to making an immediate and lasting attitude change.  The first example of this change occurred the day after the training.  One employee who regularly rode the elevator with a co-worker was shocked when the co-worker, who had previously been dour and dejected every day, greeted her with a smile and an enthusiastic, &quot;It\'s going to be a great day.&quot;</p>';

var current_case_study = 1;
var num_case_studies = 5;
var case_study_collapsed = true;

function nextCaseStudy() {
	current_case_study ++;
	if (current_case_study > num_case_studies)
		current_case_study = 1;
	showCaseStudy();
}

function prevCaseStudy() {
	current_case_study --;
	if (current_case_study < 1)
		current_case_study = num_case_studies;
	showCaseStudy();
}

function showCaseStudy() {
	var temptext = eval('case_study_'+current_case_study);
	if (case_study_collapsed) {
		temptext = temptext.substring(0,200) + '... ' + '<a href="javascript:toggleCaseStudy();" id="toggle_case_study">[+]</a>';
	} else {
		temptext += '<a href="javascript:toggleCaseStudy();" id="toggle_case_study">[-]</a>';
	}
	document.getElementById('case_study_container').innerHTML = temptext;
}

function toggleCaseStudy() {
	case_study_collapsed = !case_study_collapsed;
	showCaseStudy();
}

addEvent(window, "load", showCaseStudy);

*/

/*
 *	CASE STUDY ROTATIONS
 * ============================================================================================
 */
 
var num_case_studies = 5;

function toggleCaseStudy(num) {
	var elm;
	for (var i = 1; i<= num_case_studies; i++) {
		elm = document.getElementById("caseStudy"+i);
		elm.style.display = (i==num && elm.style.display != "block") ? 'block' : 'none';
		document.getElementById("caseStudyTrigger"+i).innerHTML = (elm.style.display == "block") ? "[&ndash;]" : "[+]";
	}
}

function toggleOnSiteDescription() {
	var elm = document.getElementById("onSiteDescription");
	elm.style.display = (elm.style.display != "block") ? 'block' : 'none';
	document.getElementById("onSiteDescriptionTrigger").innerHTML = (elm.style.display == "block") ? "[&ndash;]" : "[+]";
}





/*
 *	TOP TOPIC ROTAITONS
 * ============================================================================================
 */
 
var topTopics = new Array();
topTopics.push("How to Deliver Exceptional Customer Service");
topTopics.push("Coaching Skills for Managers and Supervisors");
topTopics.push("Managing Multiple Priorities");
topTopics.push("Dealing with Difficult People");
topTopics.push("The Art of Working with People");
topTopics.push("Mistake-Free Grammar and Proofreading");
topTopics.push("Managing Emotions Under Pressure");
topTopics.push("Business Writing for Results");
topTopics.push("How to Supervise People");
topTopics.push("The Ultimate Supervisor");
topTopics.push("Team Communication Tactics");
topTopics.push("Speed Reading with Evelyn Wood Reading Dynamics®");
topTopics.push("How to Handle People with Tact & Skill");
topTopics.push("Microsoft Excel - A One-Day Seminar");
topTopics.push("Criticism and Discipline Skills for Managers");
topTopics.push("How to Give Exceptional Customer Service Over the Phone");
topTopics.push("Successful Solutions for Unacceptable Employee Behavior");
topTopics.push("Advanced Microsoft Excel");
topTopics.push("Effective Communication Skills");
topTopics.push("Creative Leadership Workshop");
topTopics.push("Project Management");
topTopics.push("Successful Communication Skills");
topTopics.push("Microsoft Office 2007 training — CareerTrack");
topTopics.push("Getting It All Done");
topTopics.push("Making Change Work");

var currentTopic = 0;
var topTopicsList;

// RANDOM SORT FUNCTION TO RANDOMIZE TOPICS
function randomSort() {
	return (Math.round(Math.random())-0.5);
}
topTopics.sort(randomSort);


function initTopicList() {
	topTopicsList = document.getElementById('topTopicsList');
	
	if (topTopicsList.hasChildNodes()) {
		while(topTopicsList.childNodes.length >= 1 ) {
			topTopicsList.removeChild(topTopicsList.firstChild);
		}
	}
	
	for (var i=1; i<=6; i++) {
		appendNextTopTopic();
	}
	setInterval(changeTopTopics, 3000);
}

function appendNextTopTopic() {
	var newDiv = document.createElement("div");
	var newList = document.createElement("ul");
	var newListItem = document.createElement("li");
	
	newDiv.appendChild(newList);
	newList.appendChild(newListItem);
	newListItem.appendChild(document.createTextNode(topTopics[currentTopic]));

	topTopicsList.appendChild(newDiv);
	/*new Effect.BlindDown(newDiv, {
						 transition: Effect.Transitions.linear
					});
	*/
	
	currentTopic = (currentTopic + 1) % topTopics.length;
}


function changeTopTopics() {
	new Effect.SlideUp (topTopicsList.firstChild, {
						afterFinish: removeTopListItem,
						transition: Effect.Transitions.linear
					});
	
	appendNextTopTopic();
}
function removeTopListItem() {
	topTopicsList.removeChild(topTopicsList.firstChild);
}

// START TOPIC ROTATION
addEvent(window, "load", initTopicList);
// setInterval(changeTopTopics, 3000);