var Testimonials = {
	
	current: 0,
	
	imageDir: "/Websites/oklahomandirect/Images/",
	
	targetContainer: "testimonial_container",
	
	data: [
		{
			"image":"testimonial_brad-peltier.jpg",
			"quote":"We had a lot of success with our direct mail campaign done by The Oklahoman DIRECT, but with the addition of customer profiling we're able to more efficiently build our business. We can reach people who look like the customers we already have. It means we don't waste money sending out direct mail to the wrong prospects.",
			"name":"Brad Peltier",
			"position":"Marketing Director",
			"company":"Firelake Enterprises"
		},
		{
			"image":"testimonial_durrett.jpg",
			"quote":"The past few years our fundraising efforts had not achieved the desired results. The Oklahoman DIRECT demonstrated to us how they could help target the best audience and create a more dynamic creative brochure/letter. All of this was exactly what we needed. We achieved success early in the campaign and increased our fundraising results dramatically. We could not have done it without The Oklahoman DIRECT.",
			"name":"David Durrett",
			"position":"Annual Funds Committee Chair",
			"company":"Library Endowment Trust"
		},
		{
			"image":"testimonial_john-handley.jpg",
			"quote":"For the 2006 Senior PGA Championship we implemented a strategic marketing campaign with the goal of promoting the Championship to key consumers. Direct mail was an integral part of our plan and allowed us to target our marketing dollars. We would definitely recommend The Oklahoman DIRECT to companies as an effective means of reaching out to their customer base.",
			"name":"John Handley",
			"position":"Director of Sales and Marketing",
			"company":"2006 Senior PGA Championship"
		},
		{
			"image":"testimonial_nancy-berland.jpg",
			"quote":"In the 10 years since I have launched my PR business, the only mailing service that I have been able to depend on is The Oklahoman DIRECT. I don't know what I would do without them. My Oklahoman DIRECT representative always makes sure what we send flies through the postal system without a hitch.",
			"name":"Nancy Berland",
			"position":"President",
			"company":"Nancy Berland Public Relations, Inc"
		},
		{
			"image":"testimonial_joann-pierce.jpg",
			"quote":"The Oklahoman DIRECT offers a turn-key product, it is an efficient way to do business. They can do the design and layout of our materials, then print and mail them. The biggest reason we have stayed with The Oklahoman DIRECT is the great service.",
			"name":"Jo Ann Pearce",
			"position":"Executive Director",
			"company":"A Chance To Change Foundation"
		}
	],
	
	init: function(arg)
	{
		
		return Testimonials.getTestimonial( arg == 'random' || !arg ? Testimonials.getRandom() : arg );
		
	},
	
	getRandom: function()
	{
		
		return Math.floor(Math.random()*Testimonials.data.length);
		
	},
	
	
	getTestimonial: function(num)
	{

		var g = document.getElementById('testimonial_container');
		
		while (g.hasChildNodes()) { g.removeChild(g.firstChild);} // clean
		
		
		var Current = Testimonials.data[num];
		
		//alert(Current.length);
		
		var divElement = document.createElement('div');
		divElement.className = 'testimonial';
		
		var imgElement = document.createElement('img');
		imgElement.src = Testimonials.imageDir + Current.image;
		imgElement.alt = Current.name;
		
		var blockquoteElement = document.createElement('blockquote');
		blockquoteElement.innerHTML = '<big>&#8220;</big>' + Current.quote + '&#8221;';
		
		var citeElement = document.createElement('cite');
		citeElement.innerHTML = '<strong>' + Current.name + '</strong><br /> ' + Current.position + '<br /> ' + '<em>' + Current.company + '</em>';
		
		var a = document.createElement('a');
		a.className = 'nextButton';
		a.ref = num;
		a.href = 'javascript:Testimonials.next();';
		a.innerHTML = 'next &raquo;';
		
		divElement.appendChild(imgElement);
		divElement.appendChild(blockquoteElement);
		divElement.appendChild(citeElement);
		divElement.appendChild(a);
		
		Testimonials.current = num;
		
		g.appendChild(divElement);
		
	},
	
	next: function()
	{
		var num = Testimonials.current + 1;
		
		if( num > (Testimonials.data.length-1) ){ num = 0; }
		
		Testimonials.getTestimonial(num);
		
	}

}


Testimonials.init();