/*
Name:		transtext.js
Author:		Chris Goddard (http://www.chris-goddard.co.uk)
Date:		13/07/2010 (d/m/y)
Description:	This library creates steady transitions between text in a div tag
Copyright:	Released under GNU Licence. Can be used in other sites, this header must be kept
*/

window.addEventListener?window.addEventListener("load",tinit,false):window.attachEvent("onload",tinit);

var d=document, spanb, current=0, val=6,interval=500000;
var items = new Array();

items[0] = "&quot;I've just confirmed my first 2 clients from the site and I have about 5 enquires which is great news considering it's been up a week!&quot;<br /><br />Fiona Tanner<br/>FT Makeup London";
items[1] = "&quot;I've just confirmed my first 2 clients from the site and I have about 5 enquires which is great news considering it's been up a week!&quot;<br /><br />Fiona Tanner<br/>FT Makeup London";

function tinit() {
	spanb = d.getElementById("textContainer");
	spanb.innerHTML= "<span style='font-size: 14px; color: #666666'><em>" + items[current] + "</em>";

	setTimeout(tfade,interval);
}

function tfade() {
	tfadeout();
}

function tfadein() {
	val = val - 1;
	var oValue = val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16);

	spanb.innerHTML="<span style=\"color:#" + oValue + "\">" + items[current] + "</span>";
	
	if (val==6) {
		setTimeout(tfade,interval);
	} else {
		setTimeout(tfadein, 50);
	}
}

function tfadeout(){
	val = val + 1;
	var oValue = val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16) + val.toString(16);

	spanb.innerHTML="<span style=\"color:#" + oValue + "\">" + items[current] + "</span>";

	if (val==16) {
		current = current + 1;
		if (current==items.length) current = 0;
		tfadein();
	} else {
		setTimeout(tfadeout, 50);
	}
}

