/*******************************
 *******************************
 Class: TextFader			  */


/*
 strings=new Array();
strings.push('Together, we are providing a unified choice.');
		strings.push('Together, we have over 200 years of experience.');
		strings.push('Together, we are able to respond to any kind of crisis anywhere in the world.');
		strings.push('We\'re in it together.');

		strings.push('Nous travaillons ensemble.');
		strings.push('Ensemble et unis, nous pouvons faire plus.');
		strings.push('Ensemble, nous avons plus de 200 ans d\'exp&eacute;rience.');
		strings.push('Ensemble, pour agir quand il le faut, o&ugrave; il le faut.');
*/


function TextFader(in_delay,string,delimit,div_id) 
{

		x=0;


		c_maxx = 150;
		c_maxy = 30;

		c_x = 25+c_maxx*Math.random();
		c_y = 10+c_maxy*Math.random();

		div_x = c_x;
		div_y = c_y;

		c_x = 25+c_maxx*Math.random();
		c_y = 10+c_maxy*Math.random();

		new Effect.Move('displayDiv', {x:div_x,y:div_y ,mode:'absolute', duration:0});


		if(in_delay==null)
		{
			in_delay=1000;
		}
		///Hooks for common events
		this.delay=in_delay;
		//this.delay=in_delay;

		this.construct = function()
		{
			

		};
		this.construct();

		this.Run = function () 
		{
			//alert(1);
			div_id='displayDiv';
			delay_sec=(this.delay/1000.0);
			c_x = 15+c_maxx*Math.random();
			$(div_id).innerHTML=strings[x];

			c_y =10+c_maxy*Math.random();
			if(x==2)
			{
				c_x =5+ (c_maxx-30)*Math.random();
				if((x==2)&&(c_x>0))
				{
					//alert("adjusted");
					c_x=15;
				}
			}
			new Effect.Appear(div_id,{duration:delay_sec});


			setTimeout("new Effect.Fade('"+div_id+"',{duration:"+delay_sec+"});",this.delay*6);
			

			setTimeout("new Effect.Move('"+div_id+"', {x:"+c_x+",y:"+c_y+" ,mode:'absolute', duration:0});",this.delay*7);

			x=(x+1)%strings.length;
			if (x >=strings.length )
			{
				x=5;
			}

			setTimeout("txt_fader.Run();",this.delay*7);
		};
		this.PostRun = function()
		{
		
		
		
		};


		



}

	var txt_fader; 
	function InitFade()
	{
				txt_fader = new	TextFader();



	}
	function RunFade()
	{
		txt_fader.Run();
	}
	
