descr=new Array
w=new Array
h=new Array
ratio=new Array
urls=new Array
var wmax
var hmax
var items
var showbg
var buttonbgcolor
var buttontextcolor
var descriptionbgcolor
var textcolor

//changes area

items=16	//number of items (image, url and description pairs)
tablewidth=400	//width of slide show area
tabheight=500	//height of slide show area        

buttonbgcolor="#0099CC"		//background color of buttons
buttontextcolor="#000000"	//text color for buttons
descriptionbgcolor="#0099CC"	//background color of description area
textcolor="#FFFFFF"		//text color of description area
showbg="#0099CC"	//background picture for images and buttons area

//leave blank text color to get black text
//leave blank background color to get transparent background
//leave blank showbg to get descriptionbgcolor for background
//experiment, but make sure you don't delete quotation marks!

img=new Array
for(i=1;i<=items;i++)img[i]=new Image()

//web address for images used in show
//add or delete here rows to match the number of images;
//make sure you update the number in the square brackets:
//the next row should be img[16].src="images/next_image.jpg"
img[1].src="images/galpao.jpg"
img[2].src="images/galpao1.jpg"
img[3].src="images/galpao2.jpg"
img[4].src="images/ponte_rolante.jpg"
img[5].src="images/bobinadeiras.jpg"
img[6].src="images/torno.jpg"
img[7].src="images/torno1.jpg"
img[8].src="images/estufa.jpg"
img[9].src="images/fresa.jpg"
img[10].src="images/fresa1.jpg"
img[11].src="images/balanceadora.jpg"
img[12].src="images/balanceadora1.jpg"
img[13].src="images/bancada.jpg"
img[14].src="images/tanque.jpg"
img[15].src="images/equip_medicao.jpg"
img[16].src="images/laboratorio.jpg"

//image sizes, make sure you enter correct values
//add or delete here rows to match the number of images;
//make sure you update the number in the square brackets:
w[1]=400
h[1]=300
w[2]=400
h[2]=300
w[3]=400
h[3]=300
w[4]=400
h[4]=300
w[5]=400
h[5]=300
w[6]=400
h[6]=300
w[7]=400
h[7]=300
w[8]=400
h[8]=300
w[9]=400
h[9]=300
w[10]=400
h[10]=300
w[11]=400
h[11]=300
w[12]=400
h[12]=300
w[13]=400
h[13]=300
w[14]=400
h[14]=300
w[15]=400
h[15]=300
w[16]=400
h[16]=300

//description for each images
//add or delete here rows to match the number of images;
//make sure you update the number in the square brackets:
descr[1]="Shed"
descr[2]="Shed"
descr[3]="Shed"
descr[4]="Gantry cranes"
descr[5]="Rewinding machines"
descr[6]="Lathe machines"
descr[7]="Lathe machines"
descr[8]="Ovens"
descr[9]="Milling machines"
descr[10]="Milling machines"
descr[11]="Balancing machines"
descr[12]="Balancing machines"
descr[13]="Test Panel"
descr[14]="Vacuum Impregnation Sistem (VPI)"
descr[15]="Test Equipment"
descr[16]="Test Laboratory"
//link urls for each image
//add or delete here rows to match the number of images;
//make sure you update the number in the square brackets:


//end of changes area

for(i=1;i<=items;i++)descr[i]='<font color="' + textcolor + '">' + descr[i] + '</font>'


for(i=1;i<=items;i++)ratio[i]=h[i]/w[i]
maxs()

if(wmax>tablewidth)
{
for(i=1;i<=items;i++)
	{
		if(w[i]>tablewidth)
			{
			 w[i]=tablewidth
			 h[i]=w[i]*ratio[i]
			}
	}
maxs()
}

if(hmax>tabheight)
{
for(i=1;i<=items;i++)
	{
		if(h[i]>tabheight)
		{
		 h[i]=tabheight 
		 w[i]=h[i]/ratio[i]
		}
	}
}
maxs()


function maxs()
{
hmax=h[1]
for(j=1;j<=items;j++)
{
if(h[j]>hmax)hmax=h[j]
}
wmax=h[1]
for(j=1;j<=items;j++)
{
if(w[j]>wmax)wmax=w[j]
}
}

layerLeft = new Array
layerTop = new Array

position_layers()

function position_layers()
{
for(i=1;i<=items;i++)
{
layerLeft[i] = Math.floor((wmax-w[i])/2);
layerTop[i] = Math.floor((hmax-h[i])/2);
}
}

document.write('<STYLE TYPE="text/css">')
document.write('# container {position: relative; z-index: 1; top:0px; left:0px}')
document.write('.buttons { background: ' + buttonbgcolor + '; color: ' + buttontextcolor + '; font-weight: bold; }')
if(document.layers)document.write('# description {position: absolute; z-index: 3; top:0px; left:0px;}')

document.write('#con {position: relative; z-index: 1; top:0px; left:0px}')
for(i=1;i<=items;i++)
{
document.write('#pic'+ i + '{position: absolute; z-index: 1; top:' + layerTop[i] + 'px; left:' + layerLeft[i] + 'px; visibility:hidden}');
}
document.write('</style>')


navtest="KO"
j=0
if (document.layers)
{
navtest="OK"
layerRef="document.layers"
styleDef=""
}

if(document.all)
{
navtest="OK"
layerRef="document.all"
styleDef=".style"
}

function start()
{
eval(layerRef + '["con"].' + layerRef + '["pic1"]' + styleDef + '.visibility="visible"')
displayText(1)
currentcommand="stop"
j=1
document.playercomm.stop.disabled=true
document.playercomm.faster.disabled=true
document.playercomm.slower.disabled=true
}
var rotation
var rotspeed
rotspeed=3000

function rotate()
{
for(i=1;i<=items;i++)
{
eval(layerRef + '["con"].' + layerRef + '["pic' + i + '"]' + styleDef + '.visibility="hidden"')
}
j++
if(j==0)j=items
if(j>items)j=1
eval(layerRef + '["con"].' + layerRef + '["pic' + j + '"]' + styleDef + '.visibility="visible"')
displayText(j)
rotation = setTimeout("rotate()",rotspeed)
}

function displayText(opt){
text='<center><b>'+descr[opt]+'</b></center>'

if(document.layers){
document.layers["container"].document.layers["description"].document.write(text)
document.layers["container"].document.layers["description"].document.close();
}

if(document.all)
{
document.all["description"].innerHTML=text;
}
}

currentcommand="play"
function player(command)
{
if(currentcommand=="play")
{
if(command=="stop")
	{ 
	clearTimeout(rotation)
	currentcommand="stop"
	document.playercomm.stop.disabled=true
	document.playercomm.play.disabled=false
	document.playercomm.faster.disabled=true
	document.playercomm.slower.disabled=true
	document.playercomm.previous.disabled=false
	document.playercomm.next.disabled=false
}
}

if(currentcommand=="stop")
{
if(command=="play")
	{ 
	rotate()
	currentcommand="play"
	document.playercomm.play.disabled=true
	document.playercomm.stop.disabled=false
	document.playercomm.faster.disabled=false
	document.playercomm.slower.disabled=false
	document.playercomm.previous.disabled=true
	document.playercomm.next.disabled=true
}
}

if(command=="next")
	{ 
	clearTimeout(rotation)
	rotate()
	if(currentcommand=="stop")clearTimeout(rotation)
}

if(command=="previous")
	{ 
	clearTimeout(rotation)
	j=j-2
	rotate()
	if(currentcommand=="stop")clearTimeout(rotation)
}
}

function fasterslower(action)
	{
	if(currentcommand=="play")
		{
		if(action=="faster")
			{
			rotspeed=rotspeed-500
			if (rotspeed<0)rotspeed=0
			}
		if(action=="slower")rotspeed=rotspeed+500
		}
	}
