//Variable Definitions
//
//
var Body1teffect = 8;      //Body1index of the current effect
var Body1transitions = 23; //Total number of transition effects; 23 is the maximum.
var Body1speed=2.0;        //Transition Body1speed
var Body1index =1; 	      //Body1index number used to reference images

var Body2teffect = 9;      //Body1index of the current effect
var Body2transitions = 23; //Total number of transition effects; 23 is the maximum.
var Body2speed=2.0;        //Transition Body1speed
var Body2index =1; 

var Body3teffect = 10;      //Body1index of the current effect
var Body3transitions = 23; //Total number of transition effects; 23 is the maximum.
var Body3speed=2.0;        //Transition Body1speed
var Body3index =1;		

// ***************************Body1******************************
//Array Definitions 
Body1img = new Array(6);   //This array contains the image names
Body1link = new Array(6);  //This array contains image Web links
Body1delay = new Array(6); //This array contains the amount of time that an image should be displayed

//***************************Body2*******************************
Body2img = new Array(4);   //This array contains the image names
Body2link = new Array(4);  //This array contains image Web links
Body2delay = new Array(4); //This array contains the amount of time that an image should be displayed

//****************************Body3******************************
Body3img = new Array(4);   //This array contains the image names
Body3link = new Array(4);  //This array contains image Web links
Body3delay = new Array(4); //This array contains the amount of time that an image should be displayed

//This function start the image rotation when this page is loaded into a Web browser.
function BodystartRot(){

//Define four ad images to rotate and related Web links
//******************************Body1****************************
	Body1img[1] = "images/index/11.gif";
	Body1img[2] = "images/index/12.gif";
	Body1img[3] = "images/index/13.gif";
	Body1img[4] = "images/index/14.gif";
	Body1img[5] = "images/index/15.gif";

	Body1link[1] = "TransactionScope/Reclaim/Reclaimindex.asp";
	Body1link[2] = "UsingTechnology/UsingTechnologyindex.asp";
	Body1link[3] = "TransactionScope/Reclaim/Reclaimindex.asp";
	Body1link[4] = "TransactionScope/Reclaim/Reclaimindex.asp";
	Body1link[5] = "UsingTechnology/UsingTechnologyindex.asp";

	Body1delay[1] = 1;
	Body1delay[2] = 1;
	Body1delay[3] = 1;
	Body1delay[4] = 1;
	Body1delay[5] = 1;	
//*************************Body2**********************************
	Body2img[1] = "images/index/21.gif";
	Body2img[2] = "images/index/22.gif";
	Body2img[3] = "images/index/23.gif";

	Body2link[1] = "TransactionScope/ProjectBuild/ProjectBuildindex.asp";
	Body2link[2] = "TransactionScope/ProjectBuild/ProjectBuildindex.asp";
	Body2link[3] = "TransactionScope/ProjectBuild/ProjectBuildindex.asp";
	
	Body2delay[1] = 1;
	Body2delay[2] = 1;
	Body2delay[3] = 1;
//***********************Body3************************************
	Body3img[1] = "images/index/31.gif";
	Body3img[2] = "images/index/32.gif";
	Body3img[3] = "images/index/33.gif";

	Body3link[1] = "TransactionScope/ProductAgent/Cooling.asp";
	Body3link[2] = "TransactionScope/ProductAgent/Valve.asp?Type=butterfly";
	Body3link[3] = "TransactionScope/ProductAgent/Valve.asp?Type=compensator";

	Body3delay[1] = 1;
	Body3delay[2] = 1;
	Body3delay[3] = 1;


//Define dimension of images
	var imgHeight = 211;  
	var imgWidth = 133;	

//***************************Body1***********************
//Define the default images that the rotators displays first and set their dimensions
	Body1image1.src = Body1img[1];
	Body1image2.src = Body1img[2];

	Body1imamap.coords = "0,0," + imgWidth + "," + imgHeight;
	Body1rotImg.style.height = imgHeight;
	Body1rotImg.style.width = imgWidth;
//*************************Body2**************************
	Body2image1.src = Body2img[1];
	Body2image2.src = Body2img[2];

	Body2imamap.coords = "0,0," + imgWidth + "," + imgHeight;
	Body2rotImg.style.height = imgHeight;
	Body2rotImg.style.width = imgWidth;
//**************************Body3*************************
	Body3image1.src = Body3img[1];
	Body3image2.src = Body3img[2];

	Body3imamap.coords = "0,0," + imgWidth + "," + imgHeight;
	Body3rotImg.style.height = imgHeight;
	Body3rotImg.style.width = imgWidth;
	
//***********************Body1****************************
//Prepare to begin image rotation
	Body1image1.style.visibility = "hidden";		
	Body1transImage(); 

//**********************Body2*****************************
	Body2image1.style.visibility = "hidden";		
	Body2transImage(); 

//*********************Body3******************************
	Body3image1.style.visibility = "hidden";		
	Body3transImage();	
}

//************************Body1*********************************
//When the transition is completed, select a new transition filter.
function Body1changeTrans() {
	if (Body1teffect%5 == 0)  {
	Body1index = 0;
	}
	Body1index = Body1index + 1;
	
	//Delay next transition by the amount of time (milliseconds) specified by the duration variable
	window.setTimeout( 'Body1transImage()', Body1duration); 

}

function Body1transImage() {
	
	//Freeze image		
	Body1rotImg.filters.item(0).Apply();
	Body1rotImg.filters.item(0).transition = Body1teffect;

	if (Body1teffect % 2 == 0) {	
		
		Body1image1.src = Body1img[Body1index];
		Body1image1.style.visibility = "";
		Body1imamap.href = Body1link[Body1index];		
		Body1image2.style.visibility = "hidden";	
		Body1duration = Body1delay[Body1index]*1000;

	}

	else {	
	
		Body1image2.src =  Body1img[Body1index];
		Body1image2.style.visibility = "";	
		Body1imamap.href = Body1link[Body1index];		
		Body1image1.style.visibility = "hidden";
		Body1duration = Body1delay[Body1index]*1000;
	}
	
	//Start transition
	Body1rotImg.filters(0).Play(Body1speed);


	Body1teffect = Body1teffect + 1;
	if (Body1teffect > Body1transitions) {
		Body1teffect = 0;
	}
	
}


//**************************Body2****************************
function Body2changeTrans() {
	if (Body2teffect%3 == 0)  {
	Body2index = 0;
	}
	Body2index = Body2index + 1;
	
	//Delay next transition by the amount of time (milliseconds) specified by the duration variable
	window.setTimeout( 'Body2transImage()', Body2duration); 

}

function Body2transImage() {
	
	//Freeze image		
	Body2rotImg.filters.item(0).Apply();
	Body2rotImg.filters.item(0).transition = Body2teffect;

	if (Body2teffect%2 == 0) {	
		
		Body2image1.src = Body2img[Body2index];
		Body2image1.style.visibility = "";
		Body2imamap.href = Body2link[Body2index];		
		Body2image2.style.visibility = "hidden";	
		Body2duration = Body2delay[Body2index]*1000;

	}

	else {	
	
		Body2image2.src =  Body2img[Body2index];
		Body2image2.style.visibility = "";	
		Body2imamap.href = Body2link[Body2index];		
		Body2image1.style.visibility = "hidden";
		Body2duration = Body2delay[Body2index]*1000;
	}
	
	//Start transition
	Body2rotImg.filters(0).Play(Body2speed);


	Body2teffect = Body2teffect + 1;
	if (Body2teffect > Body2transitions) {
		Body2teffect = 0;
	}
	
}


//************************Body3********************************
//When the transition is completed, select a new transition filter.
function Body3changeTrans() {
	if (Body3teffect%3 == 0)  {
	Body3index = 0;
	}
	Body3index = Body3index + 1;
	
	//Delay next transition by the amount of time (milliseconds) specified by the duration variable
	window.setTimeout( 'Body3transImage()', Body3duration); 

}

function Body3transImage() {
	
	//Freeze image		
	Body3rotImg.filters.item(0).Apply();
	Body3rotImg.filters.item(0).transition = Body3teffect;

	if (Body3teffect % 2 == 0) {	
		
		Body3image1.src = Body3img[Body3index];
		Body3image1.style.visibility = "";
		Body3imamap.href = Body3link[Body3index];		
		Body3image2.style.visibility = "hidden";	
		Body3duration = Body3delay[Body3index]*1000;

	}

	else {	
	
		Body3image2.src =  Body3img[Body3index];
		Body3image2.style.visibility = "";	
		Body3imamap.href = Body3link[Body3index];		
		Body3image1.style.visibility = "hidden";
		Body3duration = Body3delay[Body3index]*1000;
	}
	
	//Start transition
	Body3rotImg.filters(0).Play(Body3speed);


	Body3teffect = Body3teffect + 1;
	if (Body3teffect > Body3transitions) {
		Body3teffect = 0;
	}
	
}
