var css_orig_font_size = '';

$(document).ready(
	function(){
		$('#testimonials_content').height(158);
		setInterval(doScrollTestimonials, 7000);
		
		//$('#testimonials_content').click( function () { window.location = 'http://www.textalibrarian.com/clients.php'; } ).css('cursor', 'pointer');
	}
);

var t = Array();
var t_index = 0;

t.push( new Testimonial('This solution was designed for libraries, addressing their specific security and technology needs.', 
												'Michelle Roubal, Plainfield Public Library'));
t.push( new Testimonial("Answering questions was easy. I just sat down at the computer and when I saw a question come in, I clicked on the big red 'Answer' button and started typing.", 
												'ALA Ambassador at ALA Annual 2009'));
t.push( new Testimonial('Text a Librarian is a great way to expand library services and provide mobile patrons answers to simple questions.', 
												'Tracey Ray, Free Library of Philadelphia'));
t.push( new Testimonial("The new service provides an easy-to-use interface for our librarians and maintains the privacy of our patrons' information.",
												'Eva Poole, City of Denton Libraries'));
t.push( new Testimonial("Mosio's Text a Librarian is a great solution for us!", 
												'Emilie Smart, East Baton Rouge Parish Libraries'));
t.push( new Testimonial('Texting a librarian is no longer a myth thanks to TextaLibrarian.com, which is easy to implement and actually keeps patron phone numbers private.', 
												'Mirela Roncevic, Library Journal'));

t.push( new Testimonial("It's another way to reach out to people on the level that they are communicating, instead of expecting people to come out to the library, we're reaching out to them in the mode they prefer.", 
												'Cheryl Houts, Community Librarian, Campbell Library', 
												'http://bit.ly/40ZpuE'));

t.push( new Testimonial('Text messaging is becoming an increasingly important tool for the community, and we want to be available that way for communication.', 
												'Allison Parham, Santa Clara County Library', 
												'http://bit.ly/40ZpuE'));

t.push( new Testimonial("Given the fast pace of life right now, it's more convenient for people to text us than to walk into a library. It's a more natural way for them to communicate, and we want to be there.", 
												'Nancy Howe, Deputy County Librarian, Morgan Hill Library', 
												'http://bit.ly/40ZpuE'));


//t.push( new Testimonial('', 
//												''));



function doScrollTestimonials() {
	$('#testimonials_content').fadeOut(700, doUpdateTestimonialText);

	t_index++;
	if (t_index >= t.length) {
		t_index = 0;
	}
	
}

function doUpdateTestimonialText() {
	//alert(t_index + ' - ' + t[t_index].quote);
	$('#testimonials_quote').html('<img src="/images/front_door_green/quote_open.png" alt="" />' + t[t_index].quote + '<img src="/images/front_door_green/quote_close.png" alt="" />');
	
	// set font size
	$('#testimonials_quote').css('font-size', '14pt');
	if (t[t_index].quote.length > 140) {
		$('#testimonials_quote').css('font-size', '12pt');
	}

	// set link
	if (t[t_index].cite) {
		$('#testimonials_source').html('&mdash; <a target="_blank" href="' + t[t_index].cite + '">' + t[t_index].source + '</a>');
	}
	else {
		$('#testimonials_source').html('&mdash; ' + t[t_index].source);
	}
	
	$('#testimonials_content').height(158);
	$('#testimonials_content').fadeIn(700);
}

function Testimonial(quote, source, cite) {
	this.quote = quote;
	this.source = source;
	if ( ! cite) {
		cite = '';
	}
	this.cite = cite;
}
