var sp=[

"<h1><span>clear &amp; concise <span class='lowlight'>it</span></h1><p>A direct, jargon-free and upfront approach ensures that our clients feel comfortable. We'll take care to make sure that you understand the implications of IT decisions for your business, and help you to have confidence that you're making progress in the right direction.</p>",

"<h1>coffee &amp; chocolate <span class='lowlight'>it</span></h1><p>We'll work all hours to ensure that you can work any you choose. We'll be there when you need us and we'll make sure that your down-time is kept to an absolute minimum.</p>",

"<h1>complementary &amp; cost-effective <span class='lowlight'>it</span></h1><p>Minimising disruption, working to optimise your existing systems and making the most of older hardware helps us to deliver tangible value for money as well as an ecologically-sound approach to business computing.</p>",

"<h1>considerate &amp; careful <span class='lowlight'>it</span></h1><p>It's all about making things run smoothly, from behind the scenes to the interface with your users.</p>",

"<h1>creative &amp; clever <span class='lowlight'>it</span></h1><p>Innovation is essential, as is the smart application of existing technologies. We make sure you get the best of both worlds.</p>"

];


var spsize = 5;
var timeout = 10000;

var displayed1=-1, displayed2=-1;

function spstart()
{
	document.getElementById("sp1").innerHTML = sp[0];
	document.getElementById("sp2").innerHTML = sp[1];

	displayed1 = 0;
	displayed2 = 1;
	setTimeout( function() {sprotate();}, timeout);
}

/* Every TIMEOUT seconds, swap one of the texts in one of the sps */
function sprotate()
{
	var target;

	if( Math.random() < 0.5 ) // sp1
	{
		target = document.getElementById("sp1");
		target.style.opacity=0.0;
		target.innerHTML = sp[select_new(1)];
		fadein(0.0,target);
	}
	else	 // sp2
	{
		target = document.getElementById("sp2");
		target.style.opacity=0.0;
		target.innerHTML = sp[select_new(2)];
		fadein(0.0,target);
	}

	setTimeout( function() {sprotate();}, timeout );	
}

function fadeout( opacity, div )
{
	opacity -= 0.05;
	div.style.opacity = opacity;
	if( opacity > 0 )
		setTimeout( function() {fadeout(opacity,div);}, 25 );
}

function fadein( opacity, div )
{
	opacity += 0.02;
	div.style.opacity = opacity;
	if( opacity < 1.0 )
		setTimeout( function() {fadein(opacity,div);}, 25 );

}

function select_new(divno)
{
	var tentative=-1;
	while( !check( tentative ) )
	{
		var randno = Math.random();
		randno *= spsize;
		randno = Math.floor(randno);
		tentative = randno;
	}
	if( divno==1 )
		displayed1=tentative;
	else
		displayed2=tentative;

	return tentative;
}

function check( t )
{	
	if (t==-1) return false;

	return( (displayed1!=t) && (displayed2!=t) );
}
