var anim_intv, anim_speed = 25, anim_index = 0, anim_char = -1, anim_n = null, anim_li;
var anim = [
	"The only company that will never try to sell you the mortgage of the month." ,
	"Respects consumer rights." ,
	"Understands that knowledge is power." ,
	"Stands by all promises." ,
	"Truly delivers what they promise."
];

function init_anim()
{
	if ( anim_n == null )
		if ( (anim_n = document.getElementById("trust")) )
			anim_n.innerHTML = "";
	
	if ( anim_n )
	{
		if ( anim_intv )
			clearInterval(anim_intv);
		
		anim_intv = setInterval(animate, anim_speed);
	}
}

function animate()
{
	if ( anim_char == null )
	{
		anim_char = -1;
		anim_n.innerHTML = "";
	}
	if ( anim_char >= anim[anim_index].length - 1 )
	{
		anim_char = -1;

		clearInterval(anim_intv);
		anim_intv = null;

		if ( ++anim_index >= anim.length )
		{
			anim_index = 0;
			anim_char = null;
			setTimeout(init_anim, 5500);
		} else
			setTimeout(init_anim, 2500);
		
		return;
	}
	if ( anim_char++ < 0 )
	{
		var span = document.createElement("SPAN");
		span.className = "bold";
		span.appendChild( document.createTextNode( anim[anim_index].charAt(anim_char) ) );
		
		anim_li = document.createElement("LI");
		anim_li.appendChild( span );
		
		anim_n.appendChild( anim_li );
		
		clearInterval(anim_intv);
		anim_intv = null;
		setTimeout(init_anim, 2500);
	} else
		anim_li.appendChild( document.createTextNode( anim[anim_index].charAt(anim_char) ) );
}

if ( window.addEventListener )
	window.addEventListener("load", init_anim, false);
else
	window.attachEvent("onload", init_anim);