//=======================================================================================================
//-------------------------------------------------------------------------------------------------------
//	Custom Javascript functions
//-------------------------------------------------------------------------------------------------------
//=======================================================================================================

//-------------------------------------------------------------------------------------------------------
//	Rotating testimonials
//-------------------------------------------------------------------------------------------------------

// browser compatibility
function compatibility(id)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		return document.getElementById(id)
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		return document.all[id]
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		return document.layers[id]
	}
}

var skiptimer;
var auto;

function slideshowhide(showid, hideid, autoplay)
{
	//	Clicking on prev or next will cause the autoplay to stop
	if (!autoplay)
	{
		auto = false;
		clearTimeout(skiptimer);
	}

	//	Show and hide divs
	var hidediv = compatibility("slide_"+hideid);
	var showdiv = compatibility("slide_"+showid);

	if(showdiv)
	{
		hidediv.style.display = 'none';
		showdiv.style.display = 'block';

		if (auto)
		{
			var next = parseInt(showid)+1;
			var nextdiv = compatibility("slide_"+next);

			if (nextdiv)
			{
				skiptimer = setTimeout("slideshowhide('" + next + "','" + showid + "','true')",7000);
			}
			else
			{
				skiptimer = setTimeout("slideshowhide('1','" + showid + "','true')",7000);
			}
		}
	}
}

skiptimer = setTimeout("slideshowhide('2','1','true')",7000);
auto = true;
