//ANIMATING LAYER CODE  
 
var topStopPoint=100;
var topStopPoint2=10;
var	r_value=0;
var	g_value=0;
var	b_value=0;


function textColorChangeOver(layerName,rgbValue) {
			document.getElementById(layerName).style.color=rgbValue;
			}
			
function textColorChangeOut(layerName,rgbValue) {
			document.getElementById(layerName).style.color=rgbValue;
			}

	
	var el=0;			// Index of the element (<div> tag). 
	var anicounter=0;  		// Frame counter. 
	var colorvalue=0;		// Aux color value. 

	///////////////////////////////////////////////////////////////////////////////////////
	// First step of animation - First loop
	// Fades in the text while increasing the font spacing and at the same time decreasing the 
	// text color from white (255,255,255) to black (0,0,0). Since the background color
	// is white, the effect will be like moving from transparent to black. 
	//
	// This effect will be applied in the object whose id is "text"+el. NOTE that, in the 
	// end of the fadeout function, el increases by one and fadein is called again. This
	
	// end of this document. 
	//
	function fadein() {
		// This is a 20-steps animation procedure. 
		if(anicounter<20) {
				// Increases anicounter.
				anicounter++;

				// Gets the current letterSpacing value. NOTE that this value was 
				// initialized as 1 pixel (see HTML section).
				currentSpace=parseFloat(document.getElementById("text"+el).style.letterSpacing);

				// Increases the currentSpace by .2 
				currentSpace+=.0;

				
				// Decreases the colorvalue after the 10th element. 
				if(anicounter>10) colorvalue+=25;

				// Sets the color value for the "text"+el element. 
				document.getElementById("text"+el).style.color="rgb("+colorvalue+","+colorvalue+","+colorvalue+")";
			
				// Gets the current left position. 
				posleft=parseInt(document.getElementById("text"+el).style.left);
			
				
				// Call fadein again. 
				setTimeout("fadein()",20);
		} else {
				// After the 20 steps, reset values and call fadeout procedure. 
				anicounter=0;
				ge_valopacity=0;
				fadeout();
		}
	}

	//************************************************************************
	// Second step of animation -	Second loop
	// Fades out the text while increasing the font spacing and at the same time increasing the 
	// text color value from white (0,0,0) to white (255,255,255). Since the background color
	// is white, the effect will be like moving from black to transparent. 
	//
	// Everything is the same except that colorvalue increases.
	//

	function fadeout() {
		// 30 steps of animation. 
	        if(anicounter<0) {
				// Increases anicounter.
				anicounter++;

				// Gets the current letterSpacing value. NOTE that this value was 
				// initialized as 1 pixel (see HTML section).
					                				

				// Increases the currentSpace by .2 
				currentSpace+=.7;

				// Update the letterSpacing style property with the increased value. 
				document.getElementById("text"+el).style.letterSpacing=currentSpace+"px";

				// Decreases the colorvalue after the 10th element. 
				
				if(anicounter>10) colorvalue-=8;

				// Sets the color value for the "text"+el element. 
				document.getElementById("text"+el).style.color="rgb("+colorvalue+","+colorvalue+","+colorvalue+")";	

				// Gets the current left position. 
				posleft=parseInt(document.getElementById("text"+el).style.left);

				// Updates the left position.
				posleft-=0;
				document.getElementById("text"+el).style.left=posleft+"px";

				setTimeout("fadeout()",30);
	        } else {
			// Reset all animation parameters. 
			anicounter=0;               
			colorvalue=0;   
			
			// Update the element index. 
			el++;
			
			// Call fadein again until the last element. 
			if(el<8) fadein();
			
			
	        }
	}
			

