
function textToggle(id, len)
{
	ob = $("#" + id);
	if (textToggleInit(ob) === true)
	{
		setTimeout("textToggleRun(ob, 0, " + len + ")", len);
	}
}

function textToggleInit(ob)
{
	if (ob.children().length >= 2)
	{
		ob.children().each(function(i) {
			$(this).attr("rel", i);
		});
		
		ob.children().first().fadeToggle();
		
		return true;
	}
	return false;
}

function textToggleRun(ob, crt, len)
{
	var next = crt + 1;
	if (next == ob.children().length) next = 0;
	
	ob.children("[rel=" + crt + "]").fadeToggle("fast", function() {
		ob.children("[rel=" + next  + "]").fadeToggle("fast", function() {
			setTimeout("textToggleRun(ob, " + next + ", " + len + ")", len);
		});
	});
	
}

$(document).ready(function() {
	
	textToggle("text_slider", 5000);
	
});

