var paragraph = document.getElementsByTagName('h1')[0];

function textEffect(animationName,flag) 
{
	var text = paragraph.innerHTML,
	chars = text.length,
	newText = '',
	animation = animationName,
	char,
	i;

	for (i = 0; i < chars; i += 1) 
	{
		newText += '<i>' + text.charAt(i) + '</i>';
	}

	paragraph.innerHTML = newText;

	var wrappedChars = document.getElementsByTagName('i'),
	wrappedCharsLen = wrappedChars.length,
	j = 0;

	function addEffect () 
	{
		setTimeout(function () 
		{
			wrappedChars[j].className = animation;
			wrappedChars[j].style.transform = "translate3d(0, 0px, 0)";
			j += 1;
			if (j < wrappedCharsLen) 
			{
				addEffect();
			}
		}, 50)
		
	}
	addEffect();
};

textEffect('fly-in-out');
