﻿//function fadeIn()
//{
//	var current = testimonial_contents[tcounter];
//	current.style.opacity = cOpacity / 100;
//	current.style.MozOpacity = cOpacity / 100;
//	current.style.KhtmlOpacity = cOpacity / 100;
//	current.style.filter = "alpha(opacity=" + cOpacity + ")";
//	
//	if (cOpacity < 100)
//	{
//		cOpacity += 5;
//		setTimeout("fadeIn()", 100);
//	}
//	else
//	{
//		setTimeout("fadeOut()", 5000);
//	}
//}

//function fadeOut()
//{
//	var current = testimonial_contents[tcounter];
//	current.style.opacity = cOpacity / 100;
//	current.style.MozOpacity = cOpacity / 100;
//	current.style.KhtmlOpacity = cOpacity / 100;
//	current.style.filter = "alpha(opacity=" + cOpacity + ")";
//	
//	if (cOpacity > 0)
//	{
//		cOpacity -= 5;
//		setTimeout("fadeOut()", 100);
//	}
//	else
//	{
//		tcounter = (tcounter >= testimonial_contents.length - 1) ? 0 : tcounter + 1;
//		setTimeout("fadeIn()", 100);
//	}

//}
//// get all testimonial divs
//var testimonial_holder = document.getElementById("testimonials");
//if (testimonial_holder)
//{
//	var testimonial_contents = testimonial_holder.getElementsByTagName("div");
//	// set all opacity to 0
//	if (testimonial_contents.length > 0)
//	{
//		for (var i = 0; i < testimonial_contents.length; i++)
//		{
//			testimonial_contents[i].style.opacity = 0;
//			testimonial_contents[i].style.MozOpacity = 0;
//			testimonial_contents[i].style.KhtmlOpacity = 0;
//			testimonial_contents[i].style.filter = "alpha(opacity=0)";
//		}
//		// set counter to 0
//		var tcounter = 0;
//		var cOpacity = 0;

//		fadeIn();
//	}
//}


var quotefadeBox = document.getElementById("testimonials");
var quotes = new Array();
var showQuote = 0;

for (var i = 0; i < quotefadeBox.childNodes.length; i++)
{
    if (quotefadeBox.childNodes[i].className == "testimonial-content")
    {
        quotes.push(quotefadeBox.childNodes[i]);
    }
}

function nextQuote()
{
    Effect.Fade(quotes[showQuote]);
    if (showQuote < quotes.length - 1)
    {
        showQuote++;
    }
    else
    {
        showQuote = 0;
    }
    Effect.Appear(quotes[showQuote]);
}

if (quotes.length > 0)
{
    Effect.Appear(quotes[0]);
    setInterval("nextQuote()", 12000);
}
