//Config
var textsize=9;				//Font Size
var textfont="Verdana, Arial, Helvetica, sans-serif";			//Font Face
var startcolour = "FFFFFF";		//Background /start colour
var endcolour = "CC0000";		//Text / end colour
var coloursteps = 20;			//Number of increment steps for colour change
var pausetime=4;				//Hold message time in seconds
var steptime=30;				//Time between transition steps in ms
//Messages
var message = new Array();
message[0]="The 2012 season starts on Wednesday 2nd May...";
message[1]="Check out the new rules on the News Page...";

//Working Vars
var count_message=0;			//Counter for current message
var count_textcolor=0;			//Counter for colour change
var rgbstart = hex2rgb(startcolour);
var rgbend = hex2rgb(endcolour);
var textcolor= new Array();
var mycolor = new Array();
//Function - Convert int 0-255 to hex
function toHex(N) {
 if (N==null) return "00";
 N=parseInt(N); if (N==0 || isNaN(N)) return "00";
 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
 return "0123456789ABCDEF".charAt((N-N%16)/16)
      + "0123456789ABCDEF".charAt(N%16);
}
//Function - Convert hex string to rgb array
function hex2rgb(Hex){
rhex = Hex.substring(0,2);
ghex = Hex.substring(2,4);
bhex = Hex.substring(4,6);
var rgb = new Array()
rgb[0] = ""+parseInt(rhex,16);
rgb[1] = ""+parseInt(ghex,16);
rgb[2] = ""+parseInt(bhex,16);
return rgb;
}
//Function - Main function
function APHmessage() {
	if(document.getElementById) { //DOM browsers only - only IE understand filter:blur.
		element = document.getElementById("ticker");
		if (count_textcolor < textcolor.length-1) {
			element.innerHTML="\x3Cspan id='mymessage' style='color:#"+textcolor[count_textcolor]+";'\x3E"+message[count_message]+"\x3C/span\x3E";
			count_textcolor++
			var timer=setTimeout("APHmessage()",steptime)
		}
		else {
			count_textcolor=textcolor.length-1;
			element.innerHTML="\x3Cspan id='mymessage' style='color:#"+endcolour+"'\x3E"+message[count_message]+"\x3C/span\x3E";
			count_message++
			if (count_message>=message.length){count_message=0}
			count_textcolor=0
			clearTimeout(timer)
			var timer=setTimeout("APHmessage()",(1000*pausetime))
		}
	}
}
//Initialisation - Set colour array
for (i=1;i < coloursteps; i++){
	for (j=0;j < 3; j++){
		coladjust = (rgbend[j] - rgbstart[j])*i/coloursteps;
		mycolor[j] = Math.round(eval( rgbstart[j] +"+"+ coladjust));
	}
	textcolor[i-1] = "" + toHex(mycolor[0]) + toHex(mycolor[1]) + toHex(mycolor[2]);
}

