//
// JavaScript Quote Randomizer
// Author: Strata-G Communications
// Date:   3/14/2006
// Modified Date: 3/14/2006
// Modified By:   Alex Louis
// Notes:  This code is designed to return a random quote from a list of possible quotes
//
// global vars
//	quoteList - is an array of all the QuoteItems
//	randomQuote - the Quoteizer object intantiated
// 
// Calling the Quoteizer:
//	just call the getQuote method of randomQuote passing the name of the List Group you want to use or All for the entire list
// Examples:
//	var rquote = randomQuote.getQuote("Professional Exhibitors");
//	var rquote = randomQuote.getQuote("All");
//
//The getQuote method will return a QuoteItem object.  Use the properties of the QuoteItem to display the value:
//	rquote.quote
//	rquote.by
//
//Possible group values:
//	ALL
//	Professional Exhibitors
//	Healthcare Exhibitors
//	Aerospace Exhibitors
//	Advanced Technology Exhibitors
//	Engineering
//	Job Seekers
//	Newspaper Partners
/*
//example code on page:
<script type="text/javascript">
//get the random quote for this page
var rquote = randomQuote.getQuote("Healthcare Exhibitors");
document.write('<font class=quote>"' + rquote.quote + '" <br>');
document.write('<div align=right><i>' + rquote.by + '</i></div></font>');
</script>

//example code on page version 2
<script type="text/javascript">
randomQuote.writeQuote("Professional Exhibitors");
</script>
*/

//set the list of quote items
quoteList = new Array();
//add the Professional Exhibitors items
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors','Expo Experts sales reps guided me to the right place, we now expect to make over 10 hires.','US Bank');
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors',"We expect to make over 10 offers, wouldn't change a thing.  Expo Experts staff were wonderful.",'American Express Financial Advisors');
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors','Our experience with this organization (Expo Experts) has been wonderful.  They are very professional in setting up the event and the results have been excellent','An Independent Agent Representing Aflac');
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors','We spoke to hundreds of applicants all in one day - lots of potential.','American Family Insurance');
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors','Quality of candidates and the internet promotions make this an effective hiring event.','Country Insurance');
quoteList[quoteList.length] = new QuoteItem('Professional Exhibitors','We plan to made 5-10 offers.','Qwest Communications');
//add the Healthcare Exhibitors items
quoteList[quoteList.length] = new QuoteItem('Healthcare Exhibitors','Expo Experts events consistently generate good candidates!','Providence Health System');
quoteList[quoteList.length] = new QuoteItem('Healthcare Exhibitors','Over and above what we hoped for - really was top notch.','PeaceHealth');
quoteList[quoteList.length] = new QuoteItem('Healthcare Exhibitors','We expect to make 5-10 offers &#151; good exposure.','Select Specialty Hospital ');
quoteList[quoteList.length] = new QuoteItem('Healthcare Exhibitors',"We couldn't be more happy with the Healthcare Career Expo we attended with the Expo Experts. We expect to get 3 hires from the event and probably more. We will definitely attend more of your events in the future.",'Kaiser Permanente');
quoteList[quoteList.length] = new QuoteItem('Healthcare Exhibitors','The Washington Post event seems to have been a great show!  Really loved it even though I did not have time to send in the feedback form.','Doug Walker, Aetna');
//add the Aerospace Exhibitors items
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"We had a really great event in Dallas last week with strong candidates and a really strong diversity pool willing to relocate!",'Alison Lackner Raytheon Missile Systems, Tucson, AZ');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"The price was extremely fair for the extensive advertising, complimentary ad and overall package and we filled our openings!",'COLSA');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"We've attended previous Expo Experts programs and each one continues to exceed our expectations.",'Raytheon');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Very good turnout - the prescreening made the event valuable.",'General Dynamics ES');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Quality of candidates and screening made the event successful.",'ATK Composite Optics');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Sectioning off an area for Top Secret candidates only was most effective.",'Boeing');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Great opportunity to meet applicants with 'Top Secret' clearance.",'Honeywell');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Prescreening was best aspect of the event...we plan to make 5-10 offers.",'Rockwell Collins');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"Great Candidates!",'General Atomics Aeronautical Systems');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"We are extremely impressed with the fair.  The results are overwhelming.  It is obvious that the event was put together by professionals and every step was thoroughly and well organized.  The Online recruiting system has all the necessary search engines; the database is well indexed and very fast, the screen is conveniently laid out.  This is one of the few fairs that's worth every penny.",'Northrop Grumman Integrated Systems');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"I would like to express what a wonderful experience it was to work with Susan Turner, Expo Experts.  She made sure we had everything we needed to be successful at a recent Expo we attended.  The turnout and the quality of candidates were excellent and we look forward to making some hires.  I highly recommend attending one of their Expos.",'Chrissy Randle, TRAX Test Services (TTS)');
quoteList[quoteList.length] = new QuoteItem('Aerospace Exhibitors',"The San Diego Union Tribune events was a 'not to be missed' opportunity for Lockheed Martin.  It provided us the chance to meet and speak to local talent in a central location, maximizing our efficiency and minimizing our travel expenses.  We came away with dozens of solid candidates, and expect to make a good sized dent in our needs!  Thank you again.",'M.H.Chen, Lockheed Martin');
//add the Advanced Technology Exhibitors items
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"The overall package was our biggest factor in attending and proved to be a great decision.",'Hewlett Packard (Canada)');
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"Many experienced candidates, we plan to make 4 or 5 offers.",'Medtronic Corporation');
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"Screening was most effective, we'll attend again.",'Guidant');
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"This has been an excellent event for us.",'Nike');
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"We will attend again.  A very positive hiring atmosphere.",'Motorola Canada Ltd.');
quoteList[quoteList.length] = new QuoteItem('Advanced Technology Exhibitors',"The turn out of 'quality candidates' at the Phoenix event was well worth our attendance.  I personally interviewed a number of candidates whose experience and skill level appear to meet Nammo Talley's high standards.  The staff at Expo Experts gave great attention to the visiting employers and assisted with any and all needs during the event.  Nammo Talley will certainly work with Expo Experts in the future.",'Nammo Talley Inc.');
//add the Engineering items
quoteList[quoteList.length] = new QuoteItem('Engineering',"The Atlanta-Journal Constitution sponsored Job Fair clearly exceeded our expectations.  We met over 200 highly qualified people and are working to extend multiple offers to people not only in the Southeast, but throughout the US.  The return on our investment was significant and we plan on participating in the next venue.",'Mike Turok, CSC, Huntsville, AL');

quoteList[quoteList.length] = new QuoteItem('Engineering',"Well qualified candidates, we plan to make over 10 offers.",'FBI');
quoteList[quoteList.length] = new QuoteItem('Engineering',"From the career fair in Denver yesterday - Awesome turnout - it was great to be a part of.  The managers that attended were very impressed with your organizations professionalism and attention to detail.  Thanks for being so easy to work with and making their experience a good one.",'Debbie Dexter, ENGlobal Engeering Inc.');
//add the Job Seekers items
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"I attended the Dallas Morning News Engineering, Technology & Security Clearance Career Expo and was fortunate enough to find an absolutely terrific job within weeks!",'Edmund Gutierrex EFW, Inc Technical Program Manager');
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"I attended a job fair back in December.  I wanted to follow up to thank you for turning me on to NAVFAC as they have extended a job offer to me as of last week.  I think this will be a good opportunity and could not have found it without you.  Thanks again",'Erik, LEED AP');
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"The personnel at registration was very professional and knowledgeable.  They welcomed me and led me right to companies aligned with my work experience!",'Don Civil Engineer/Director');
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"This was a great event for providing me with information on the different facilities in my area hiring nurses!  I liked being able to talk to employers face to face. Thanks.",'Karla, RN');
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"The job fair was great.  I had a chance to meet with many representatives from different companies.  I have 2 interviews scheduled for this week.",'Cindy, RN');
quoteList[quoteList.length] = new QuoteItem('Job Seekers',"Excellent Experience! Courteous, informative and helpful.",'Lisa, Nurse Practitioner');
//add the Newspaper Partners items
quoteList[quoteList.length] = new QuoteItem('Newspaper Partners',"This has been one of the better decisions I have made (working with your company) and I'm very vocal with my comrades at other papers. Hopefully you've got some business from my referrals, you deserve it.",'Michael Dawes, Recruitment Advertising Director, Houston Chronicle');




//instantiate the Quoteizer
var randomQuote = new Quoteizer();

//classes to be used to build the quoteizer

//QuoteItem is a single quote which consist of a group, the quote, who the quote was by
function QuoteItem (g,q,b) {
	this.group = g;
	this.quote = q;
	this.by = b;
	
}

function Quoteizer_setList(g) {
	//if group is all or not set use the entire quoteList Array
	this.group = g;
	if (this.group=="All" || this.group=="") {
		this.list = quoteList;
	}
	else {
		//truncate the array
		this.list.length = 0;

		//buld the list od items for the group
		for(var gx=0;gx<quoteList.length;gx++) {
			qitem = quoteList[gx];
			if (this.group==qitem.group) {
				this.list[this.list.length] = qitem;
			}
		}
	}
}

function Quoteizer_getIndex() {
	//maxindex = this.list.length - 1;
	maxindex = this.list.length;
	ranindex = Math.floor(Math.random() * maxindex);
	return ranindex;
}

function Quoteizer_getQuote(g) {
	//set the list array if it is not set or the group is different
	if (this.list.length == 0) {
		this.setList(g);
	}
	else if (this.group != g) {
		this.setList(g);
	}
	
	//get the random index
	ridx = this.getIndex();
	//alert(ridx + " - " + this.list.length);
	return this.list[ridx]; 
}

function Quoteizer_writeQuote(g) {
	//this function will write the quote on the page wrapped in HTML
	var rquote = this.getQuote(g);
	document.write('<font class=quote>"' + rquote.quote + '" <br>');
	document.write('<div align=right><i>' + rquote.by + '</i></div></font>');
}

function Quoteizer () {
	this.list = new Array();
	this.group = 'All';
	
	this.getQuote = Quoteizer_getQuote;
	this.setList = Quoteizer_setList;
	this.getIndex = Quoteizer_getIndex;
	this.writeQuote = Quoteizer_writeQuote;
}

