var captionLength = 0;
var caption = "";

$(document).ready(function()
{
 	setInterval ( "cursor()", 600 );
	caption = $('span.caption').html();
	type();
});

function type() 
{
	$('span.caption').html(caption.substr(0, captionLength++));
	if(captionLength < caption.length+1)
	{
		setTimeout("type()", 50);
	}
	else {
		captionLength = 0;
		caption = "";
	}	
}

function cursor() 
{
  $("span.cursor").animate(
  {
    opacity: 0
  }, "fast", "swing").animate(
  {
    opacity: 1
  }, "fast", "swing");
}
