//Top Slogan, bring it to attention....

document.observe("dom:loaded",function(){
	if($('top_slogan') && $('top_slogan').getStyle("display") == "block")
	{	
		// $('top_slogan').setStyle({"color":"#D03240"});
		var text=$('top_slogan').innerHTML;
		var delay=60;
		var currentChar=1;
		var destination="top_slogan";
		startTyping(text, delay, destination);
		
		//reveal($(destination), text, delay);
	}
	
	/*
if($('bottom_slogan') && $('bottom_slogan').getStyle("display") == "block")
	{	
		// $('top_slogan').setStyle({"color":"#D03240"});
		var text=$('bottom_slogan').innerHTML;
		var delay=50;
		var currentChar=1;
		var destination="bottom_slogan";
		startTyping(text, delay, destination);
		
		//reveal($(destination), text, delay);
	}
*/
});



function startTyping(textParam, delayParam, destinationParam)
{
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  type();
}

function type()
{
    var dest=$(destination);
    if (dest)
    {
      var brk = '~';
      var lt = 	text.substr(0, currentChar);
      lt = lt.replace(RegExp(brk,'g'),'<br \/>');
      dest.innerHTML= lt;
      //dest.innerHTML+=text[currentChar-1];
      currentChar++
      if (currentChar>text.length)
      {
        currentChar=1;
        //setTimeout("type()", 5000);
      }
      else
      {
        
         setTimeout("type()", delay);
        
      }
    }
   
  
} 

