//IDEEA
var animideeaimg=new Image;
var animideeaimgloaded=0;

var stopideeaimg;
stopideeaimg=new Image;
var stopideeaimgloaded=0;
//activity
var acttotal=9;
var images=new Array(acttotal);
images[0]=new Array(12);
images[1]=new Array(12);
images[2]=new Array(24);
images[3]=new Array(1);
images[4]=new Array(24);
images[5]=new Array(1);
images[6]=new Array(24);
images[7]=new Array(24);
images[8]=new Array(1);

var loaded = new Array(0,0,0,0,0,0,0,0,0);
var filename=new Array("lywrclsit","lywsitstd","lywwlk","lywstd","lywrun","lywstd","lywsu","lywsdn","lywstd");
var loops=new Array(1,1,5,1,8,1,5,5,1);
var speed=new Array(100,100,80,100,30,100,100,60,100); //in ms
var pause=new Array(5000,5000,80,5000,30,5000,100,60,15000); //in ms

var PlayIndex=1;
var loopcnt=0;

var act=0;
var paraOneLeft = 210;

function PageLoad()
{

	GetStopIDEEAImg();
	GetAnimIDEEAImg();

	AnimIDEEA();
	setTimeout('StopIDEEA()',2300);
	
	for(act=0;act<acttotal;act++)
		loadgifs();
	act=0;		
	ActAnimMgr();
	

}

function loadgifs()
{
	if(!loaded[act]){
		var i;
		var fn;
		for(i=1;i<=images[act].length;i++)
		{
			if(i<10)
				fn="/images/animation/" + filename[act] + "0" + i + ".gif";		
			else
				fn="/images/animation/" + filename[act] + i + ".gif";		
			images[act][i-1]=new Image;
			images[act][i-1].src=fn;
		}
		loaded[act]=1;
	}	
}

function GetStopIDEEAImg()
{
	if(!stopideeaimgloaded)
	{
		stopideeaimg.src='/images/IDEEA.gif';
		stopideeaimgloaded=1;
	}
}

function GetAnimIDEEAImg()
{
	if(!animideeaimgloaded)
	{
		animideeaimg.src='/images/anim2/ideea_anim_small.gif';
		animideeaimgloaded=1;
	}
}

function StopIDEEA()
{
	GetStopIDEEAImg();
	document.ideea.src=stopideeaimg.src;
}

function AnimIDEEA()
{
	GetAnimIDEEAImg();
	document.ideea.src=animideeaimg.src;
}


function ActAnimMgr()
{
	loadgifs();
	PlayIndex=0;
	loopcnt=0;
	PlayGif();
}

function PlayGif()
{
	document.ActAnimImg.src=images[act][PlayIndex].src;
	PlayIndex++;
	if(PlayIndex>=images[act].length)
	{ // finished one loop
		PlayIndex=0;
		loopcnt++;
		if(loopcnt<loops[act])
			setTimeout('PlayGif()',speed[act]);		
		else{ 
			//goto next activity
			setTimeout('ActAnimMgr()',pause[act]);
			act++;
			if(act>=acttotal) act=0;
		}
	}
	else		
		setTimeout('PlayGif()',speed[act]);		
}

// this function moves the two div elements, containing the text strings,
// back and forth.  If first determines whether the horizontal position for
// each element should be incremented or decremented, based in its alg. for
// moving them back and forth, then sets the new positions.
