/**
 * This file will fade in and fade out selected ID
 */

var fade_to = '';
var fade_from = 'client_1';

var current_index = 0;

var links = new Array();

links[0] = 'client_1';
links[1] = 'client_2';
links[2] = 'client_3';
links[3] = 'client_4';

randomElem();

function randomElem(){
	random = Math.floor(Math.random()*4)
	elem = links[random];
	
	current_index = random;
	
	$(elem).show();
}

function doFade(){	
	fade_from = links[current_index];
	
	if(current_index == (links.length - 1)){
		current_index = -1;		
	}

	fade_to = links[current_index + 1];
	
	new Effect.Fade(fade_from, {duration: .5});
	
	setTimeout("_doFadeIn()", 500);
	
	current_index++;
}

function _doFadeIn(){
	new Effect.Appear(fade_to, {duration: .5});
}