// This script provides the tickertape across the top of the page

// Original Script by: Cameron Gregory - http://www.bloke.com/javascript/StatusTicker/

speed=70;
delay=50;
//tid = 0;
c=1;
len=0;
message_num=-1;

function move() {
	output = "";
	if (c <= (len-delay)){
		//Still writing message out letter by letter...
		if(urls[message_num] != ""){
			output = "<a href=\"" + urls[message_num] + "\">";
		}
		output = output + messages[message_num].substring(0,c) + "_";
		if(urls[message_num] != ""){
			output = output + "</a>";
		}
		document.getElementById('typewriter_output').innerHTML = output;
		c = c + 1;
	}else if(c <= len){
		//Flash the cursor at the end a few times before the change...
		if(urls[message_num] != ""){
			output = "<a href=\"" + urls[message_num] + "\">";
		}
		if (c%2 == 0){
			output = output + messages[message_num];
		}else{
			output = output + messages[message_num] + "_";
		}
		if(urls[message_num] != ""){
			output = output + "</a>";
		}
		document.getElementById('typewriter_output').innerHTML = output;
		c = c + 1;
	}else{
		//Flashing finished, move on to the next message
		new_num = message_num;
		while (new_num == message_num){
			new_num = Math.floor(Math.random()*messages.length);
		}
		message_num = new_num;
		len=messages[message_num].length+delay;
		c=0;
		
	}
	tid=window.setTimeout("move()",speed);
}
 
function startticker(){
  tid=window.setTimeout("move()",speed);
}

// end-->