
var test
	var text_container = new Array ( )
		
		


		text_container[0] = "<a href='/air/petrolvapour.htm'><strong>24.11.2009:</strong> Progressive upgrading of petrol vapour recovery at service stations </a> "
		text_container[1] = "<a href='/air/actionforair/index.htm'><strong>20.11.2009:</strong> Action for Air: 2009 Update </a> "
		text_container[2] = "<a href='/waste/CWRlevy.htm'><strong>02.11.2009:</strong> New coal washery rejects levy to stimulate improved environmental management of coal waste </a> "
		text_container[3] = "<a href='/threatenedspecies/RecoveryPlanningCumberlandPlain.htm'><strong>09.11.2009:</strong> Cumberland Plain Draft Recovery Plan - public consultatation closes 18 December</a> "
		text_container[4] = "<a href='/climateChange/sealevel.htm'><strong>04.11.2009:</strong> NSW sea level rise policy statement outlines NSW government's objectives and commitments in relation to sea level rise </a> "

		
				
		
var i,array_length
//var counter
//counter = 0

var hex_1,hex_2,hex_3
hex_1 = 255 // Initial color value = white.
hex_2 = 255
hex_3 = 255

i = 0;

array_length = text_container.length - 1 //5-1=4

//alert(array_length);
var delay = 4000; 

var lock = false; 

function textshow(counter)
{	
		//i = 4
		//5 = 4 + 1
		//i=0
		//-1=0-1
		i = i+counter;

		if (i <= array_length && i >= 0 )
		{ //alert(i);		
			document.getElementById('sample').innerHTML=text_container[i]
			fadetext();			
		}
		else if (i > array_length)  //5
		{ //alert(i);
			i = 0; 			
			document.getElementById('sample').innerHTML=text_container[i]
			fadetext();			
		} 
		
		else if (i < 0) //-1
		{ //alert(i);
			i = array_length; 			
			document.getElementById('sample').innerHTML=text_container[i]
			fadetext();			
		} 
		else
		{}		
}

function auto_show() 
{ 
	if (lock == true) 
	{  
		//stop the loop
		lock = false; 
		window.clearInterval(run); 
	} 		
	else if (lock == false) 
	{ 
		//play the text
		lock = true; 
		run = setInterval("textshow(1)", delay); 
	} 
} 


function fadetext()
{ 	
	//225->0
	//----------------------------------------------
	//(255-hex1)/20 = 10.2
	//(255-hex2)/15 = 10.2
	//(255-hex3)/10 = 10.2
	//---------------------------------------------
	if(hex_1 >= 51 && hex_2 >=102 && hex_3 >=153)  
	{ 
		hex_1-=20; 
		hex_2-=15; 
		hex_3-=10; 
	
		document.getElementById('sample').style.color="rgb("+hex_1+","+hex_2+","+hex_3+")"; //fade in the first div node
		
		//rgb(hex, hex, hex) //51,102,153
		
		document.getElementById('sample').firstChild.style.color="rgb("+hex_1+","+hex_2+","+hex_3+")";//fade in other nodes
				
		setTimeout("fadetext()",90);	
		
	}
	else
	{	
		hex_1=255 //reset hex value
		hex_2=255 //reset hex value
		hex_3=255 //reset hex value
	}	
}

auto_show();
